amis-core 6.0.0 → 6.2.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 (307) hide show
  1. package/esm/Root.js +2 -2
  2. package/esm/RootRenderer.js +4 -3
  3. package/esm/SchemaRenderer.js +5 -2
  4. package/esm/Scoped.d.ts +6 -0
  5. package/esm/Scoped.js +47 -8
  6. package/esm/StatusScoped.js +2 -2
  7. package/esm/WithRootStore.js +2 -2
  8. package/esm/WithStore.js +4 -6
  9. package/esm/actions/Action.js +2 -2
  10. package/esm/actions/AjaxAction.js +2 -2
  11. package/esm/actions/BreakAction.js +2 -2
  12. package/esm/actions/BroadcastAction.js +2 -2
  13. package/esm/actions/CmptAction.js +2 -2
  14. package/esm/actions/ContinueAction.js +2 -2
  15. package/esm/actions/CopyAction.js +2 -2
  16. package/esm/actions/CustomAction.js +3 -3
  17. package/esm/actions/DialogAction.js +2 -2
  18. package/esm/actions/DrawerAction.js +2 -2
  19. package/esm/actions/EmailAction.js +2 -2
  20. package/esm/actions/LinkAction.js +10 -5
  21. package/esm/actions/LoopAction.js +2 -2
  22. package/esm/actions/PageAction.js +2 -2
  23. package/esm/actions/ParallelAction.js +2 -2
  24. package/esm/actions/PrintAction.d.ts +19 -0
  25. package/esm/actions/PrintAction.js +49 -0
  26. package/esm/actions/StatusAction.js +2 -2
  27. package/esm/actions/SwitchAction.js +2 -2
  28. package/esm/actions/ToastAction.js +2 -2
  29. package/esm/actions/index.d.ts +1 -0
  30. package/esm/components/CustomStyle.d.ts +1 -2
  31. package/esm/components/CustomStyle.js +20 -7
  32. package/esm/components/ErrorBoundary.js +2 -2
  33. package/esm/components/LazyComponent.js +2 -2
  34. package/esm/components/Overlay.js +11 -9
  35. package/esm/components/PopOver.js +7 -5
  36. package/esm/env.d.ts +4 -0
  37. package/esm/env.js +2 -2
  38. package/esm/envOverwrite.js +2 -2
  39. package/esm/factory.js +15 -2
  40. package/esm/index.d.ts +3 -2
  41. package/esm/index.js +16 -9
  42. package/esm/locale.js +2 -2
  43. package/esm/polyfills.js +2 -2
  44. package/esm/renderers/Form.d.ts +4 -3
  45. package/esm/renderers/Form.js +97 -45
  46. package/esm/renderers/Item.d.ts +1 -0
  47. package/esm/renderers/Item.js +15 -16
  48. package/esm/renderers/Options.d.ts +5 -0
  49. package/esm/renderers/Options.js +27 -10
  50. package/esm/renderers/Placeholder.js +2 -2
  51. package/esm/renderers/builtin.js +2 -2
  52. package/esm/renderers/register.js +2 -2
  53. package/esm/renderers/wrapControl.js +37 -29
  54. package/esm/store/app.js +3 -3
  55. package/esm/store/combo.d.ts +48 -24
  56. package/esm/store/combo.js +2 -2
  57. package/esm/store/crud.js +2 -2
  58. package/esm/store/form.d.ts +20 -10
  59. package/esm/store/form.js +2 -2
  60. package/esm/store/formItem.d.ts +2 -1
  61. package/esm/store/formItem.js +4 -3
  62. package/esm/store/iRenderer.js +5 -3
  63. package/esm/store/index.js +2 -2
  64. package/esm/store/list.d.ts +11 -0
  65. package/esm/store/list.js +9 -2
  66. package/esm/store/manager.js +2 -2
  67. package/esm/store/modal.js +2 -2
  68. package/esm/store/node.js +2 -2
  69. package/esm/store/pagination.js +2 -2
  70. package/esm/store/root.js +3 -3
  71. package/esm/store/service.js +6 -3
  72. package/esm/store/status.js +2 -2
  73. package/esm/store/table.d.ts +70 -47
  74. package/esm/store/table.js +40 -24
  75. package/esm/store/table2.js +2 -2
  76. package/esm/theme.js +2 -2
  77. package/esm/utils/Animation.js +2 -2
  78. package/esm/utils/ColorScale.js +2 -2
  79. package/esm/utils/DataSchema.js +2 -2
  80. package/esm/utils/DataScope.js +2 -2
  81. package/esm/utils/RootClose.js +2 -2
  82. package/esm/utils/SimpleMap.js +2 -2
  83. package/esm/utils/api.js +4 -3
  84. package/esm/utils/arraySlice.js +2 -2
  85. package/esm/utils/attachmentAdpator.js +4 -3
  86. package/esm/utils/autobind.js +2 -2
  87. package/esm/utils/browser.d.ts +1 -0
  88. package/esm/utils/browser.js +8 -3
  89. package/esm/utils/columnsSplit.js +2 -2
  90. package/esm/utils/concatData.js +2 -2
  91. package/esm/utils/dataMapping.js +2 -2
  92. package/esm/utils/date.js +2 -2
  93. package/esm/utils/debug.js +2 -2
  94. package/esm/utils/decodeEntity.js +2 -2
  95. package/esm/utils/dom.js +8 -3
  96. package/esm/utils/errors.js +2 -2
  97. package/esm/utils/escapeHtml.js +2 -2
  98. package/esm/utils/filter-schema.js +2 -2
  99. package/esm/utils/filter.js +2 -2
  100. package/esm/utils/formatDuration.js +2 -2
  101. package/esm/utils/formula.js +2 -2
  102. package/esm/utils/getVariable.js +2 -2
  103. package/esm/utils/grammar.js +2 -2
  104. package/esm/utils/handleAction.js +2 -2
  105. package/esm/utils/helper.d.ts +8 -1
  106. package/esm/utils/helper.js +28 -10
  107. package/esm/utils/highlight.js +4 -3
  108. package/esm/utils/icon.js +2 -2
  109. package/esm/utils/image.js +2 -2
  110. package/esm/utils/index.d.ts +1 -0
  111. package/esm/utils/isPureVariable.js +2 -2
  112. package/esm/utils/json-schema-2-amis-schema.js +2 -2
  113. package/esm/utils/keyToPath.js +2 -2
  114. package/esm/utils/labelToString.d.ts +1 -0
  115. package/esm/utils/labelToString.js +38 -0
  116. package/esm/utils/makeSorter.js +2 -2
  117. package/esm/utils/math.js +2 -2
  118. package/esm/utils/memoryParse.js +2 -2
  119. package/esm/utils/normalizeLink.js +2 -2
  120. package/esm/utils/normalizeOptions.js +2 -2
  121. package/esm/utils/object.js +2 -2
  122. package/esm/utils/offset.js +2 -2
  123. package/esm/utils/offsetParent.js +2 -2
  124. package/esm/utils/optionValueCompare.js +2 -2
  125. package/esm/utils/position.js +2 -2
  126. package/esm/utils/prettyBytes.js +2 -2
  127. package/esm/utils/printElement.d.ts +6 -0
  128. package/esm/utils/printElement.js +71 -0
  129. package/esm/utils/renderer-event.js +2 -2
  130. package/esm/utils/replaceText.js +10 -12
  131. package/esm/utils/resize-sensor.js +2 -2
  132. package/esm/utils/resolveCondition.js +2 -2
  133. package/esm/utils/resolveVariable.js +2 -2
  134. package/esm/utils/resolveVariableAndFilter.js +2 -2
  135. package/esm/utils/resolveVariableAndFilterForAsync.js +2 -2
  136. package/esm/utils/scrollPosition.js +2 -2
  137. package/esm/utils/string2regExp.d.ts +1 -1
  138. package/esm/utils/string2regExp.js +5 -4
  139. package/esm/utils/stripNumber.js +2 -2
  140. package/esm/utils/style-helper.d.ts +24 -5
  141. package/esm/utils/style-helper.js +47 -17
  142. package/esm/utils/style.js +2 -2
  143. package/esm/utils/toNumber.js +2 -2
  144. package/esm/utils/tokenize.d.ts +1 -0
  145. package/esm/utils/tokenize.js +11 -4
  146. package/esm/utils/tpl-builtin.js +2 -2
  147. package/esm/utils/tpl-lodash.js +2 -2
  148. package/esm/utils/tpl.js +7 -9
  149. package/esm/utils/uncontrollable.js +2 -2
  150. package/esm/utils/validateId.d.ts +16 -0
  151. package/esm/utils/validateId.js +154 -0
  152. package/esm/utils/validations.js +17 -9
  153. package/lib/Root.js +2 -2
  154. package/lib/RootRenderer.d.ts +1 -1
  155. package/lib/RootRenderer.js +4 -3
  156. package/lib/SchemaRenderer.js +5 -2
  157. package/lib/Scoped.d.ts +6 -0
  158. package/lib/Scoped.js +47 -7
  159. package/lib/StatusScoped.js +2 -2
  160. package/lib/WithRootStore.js +2 -2
  161. package/lib/WithStore.js +4 -6
  162. package/lib/actions/Action.js +2 -2
  163. package/lib/actions/AjaxAction.js +2 -2
  164. package/lib/actions/BreakAction.js +2 -2
  165. package/lib/actions/BroadcastAction.js +2 -2
  166. package/lib/actions/CmptAction.js +2 -2
  167. package/lib/actions/ContinueAction.js +2 -2
  168. package/lib/actions/CopyAction.js +2 -2
  169. package/lib/actions/CustomAction.js +3 -3
  170. package/lib/actions/DialogAction.js +2 -2
  171. package/lib/actions/DrawerAction.js +2 -2
  172. package/lib/actions/EmailAction.js +2 -2
  173. package/lib/actions/LinkAction.js +10 -5
  174. package/lib/actions/LoopAction.js +2 -2
  175. package/lib/actions/PageAction.js +2 -2
  176. package/lib/actions/ParallelAction.js +2 -2
  177. package/lib/actions/PrintAction.d.ts +19 -0
  178. package/lib/actions/PrintAction.js +53 -0
  179. package/lib/actions/StatusAction.js +2 -2
  180. package/lib/actions/SwitchAction.js +2 -2
  181. package/lib/actions/ToastAction.js +2 -2
  182. package/lib/actions/index.d.ts +1 -0
  183. package/lib/components/CustomStyle.d.ts +1 -2
  184. package/lib/components/CustomStyle.js +20 -7
  185. package/lib/components/ErrorBoundary.js +2 -2
  186. package/lib/components/LazyComponent.js +2 -2
  187. package/lib/components/Overlay.js +10 -8
  188. package/lib/components/PopOver.js +7 -5
  189. package/lib/env.d.ts +4 -0
  190. package/lib/env.js +2 -2
  191. package/lib/envOverwrite.js +2 -2
  192. package/lib/factory.js +15 -2
  193. package/lib/index.d.ts +3 -2
  194. package/lib/index.js +19 -5
  195. package/lib/locale.js +2 -2
  196. package/lib/polyfills.js +2 -2
  197. package/lib/renderers/Form.d.ts +4 -3
  198. package/lib/renderers/Form.js +96 -44
  199. package/lib/renderers/Item.d.ts +1 -0
  200. package/lib/renderers/Item.js +15 -16
  201. package/lib/renderers/Options.d.ts +5 -0
  202. package/lib/renderers/Options.js +27 -10
  203. package/lib/renderers/Placeholder.js +2 -2
  204. package/lib/renderers/builtin.js +2 -2
  205. package/lib/renderers/register.js +2 -2
  206. package/lib/renderers/wrapControl.js +36 -28
  207. package/lib/store/app.js +3 -3
  208. package/lib/store/combo.d.ts +72 -48
  209. package/lib/store/combo.js +2 -2
  210. package/lib/store/crud.js +2 -2
  211. package/lib/store/form.d.ts +30 -20
  212. package/lib/store/form.js +2 -2
  213. package/lib/store/formItem.d.ts +2 -1
  214. package/lib/store/formItem.js +4 -3
  215. package/lib/store/iRenderer.js +5 -3
  216. package/lib/store/index.js +2 -2
  217. package/lib/store/list.d.ts +11 -0
  218. package/lib/store/list.js +9 -2
  219. package/lib/store/manager.js +2 -2
  220. package/lib/store/modal.js +2 -2
  221. package/lib/store/node.js +2 -2
  222. package/lib/store/pagination.js +2 -2
  223. package/lib/store/root.js +3 -3
  224. package/lib/store/service.js +6 -3
  225. package/lib/store/status.js +2 -2
  226. package/lib/store/table.d.ts +90 -68
  227. package/lib/store/table.js +40 -24
  228. package/lib/store/table2.js +2 -2
  229. package/lib/theme.js +2 -2
  230. package/lib/utils/Animation.js +2 -2
  231. package/lib/utils/ColorScale.js +2 -2
  232. package/lib/utils/DataSchema.js +2 -2
  233. package/lib/utils/DataScope.js +2 -2
  234. package/lib/utils/RootClose.js +2 -2
  235. package/lib/utils/SimpleMap.js +2 -2
  236. package/lib/utils/api.js +4 -3
  237. package/lib/utils/arraySlice.js +2 -2
  238. package/lib/utils/attachmentAdpator.js +4 -3
  239. package/lib/utils/autobind.js +2 -2
  240. package/lib/utils/browser.d.ts +1 -0
  241. package/lib/utils/browser.js +8 -2
  242. package/lib/utils/columnsSplit.js +2 -2
  243. package/lib/utils/concatData.js +2 -2
  244. package/lib/utils/dataMapping.js +2 -2
  245. package/lib/utils/date.js +2 -2
  246. package/lib/utils/debug.js +2 -2
  247. package/lib/utils/decodeEntity.js +2 -2
  248. package/lib/utils/dom.js +8 -3
  249. package/lib/utils/errors.js +2 -2
  250. package/lib/utils/escapeHtml.js +2 -2
  251. package/lib/utils/filter-schema.js +2 -2
  252. package/lib/utils/filter.js +2 -2
  253. package/lib/utils/formatDuration.js +2 -2
  254. package/lib/utils/formula.js +2 -2
  255. package/lib/utils/getVariable.js +2 -2
  256. package/lib/utils/grammar.js +2 -2
  257. package/lib/utils/handleAction.js +2 -2
  258. package/lib/utils/helper.d.ts +8 -1
  259. package/lib/utils/helper.js +29 -8
  260. package/lib/utils/highlight.js +4 -3
  261. package/lib/utils/icon.js +2 -2
  262. package/lib/utils/image.js +2 -2
  263. package/lib/utils/index.d.ts +1 -0
  264. package/lib/utils/isPureVariable.js +2 -2
  265. package/lib/utils/json-schema-2-amis-schema.js +2 -2
  266. package/lib/utils/keyToPath.js +2 -2
  267. package/lib/utils/labelToString.d.ts +1 -0
  268. package/lib/utils/labelToString.js +46 -0
  269. package/lib/utils/makeSorter.js +2 -2
  270. package/lib/utils/math.js +2 -2
  271. package/lib/utils/memoryParse.js +2 -2
  272. package/lib/utils/normalizeLink.js +2 -2
  273. package/lib/utils/normalizeOptions.js +2 -2
  274. package/lib/utils/object.js +2 -2
  275. package/lib/utils/offset.js +2 -2
  276. package/lib/utils/offsetParent.js +2 -2
  277. package/lib/utils/optionValueCompare.js +2 -2
  278. package/lib/utils/position.js +2 -2
  279. package/lib/utils/prettyBytes.js +2 -2
  280. package/lib/utils/printElement.d.ts +6 -0
  281. package/lib/utils/printElement.js +75 -0
  282. package/lib/utils/renderer-event.js +2 -2
  283. package/lib/utils/replaceText.js +9 -15
  284. package/lib/utils/resize-sensor.js +2 -2
  285. package/lib/utils/resolveCondition.js +2 -2
  286. package/lib/utils/resolveVariable.js +2 -2
  287. package/lib/utils/resolveVariableAndFilter.js +2 -2
  288. package/lib/utils/resolveVariableAndFilterForAsync.js +2 -2
  289. package/lib/utils/scrollPosition.js +2 -2
  290. package/lib/utils/string2regExp.d.ts +1 -1
  291. package/lib/utils/string2regExp.js +5 -4
  292. package/lib/utils/stripNumber.js +2 -2
  293. package/lib/utils/style-helper.d.ts +24 -5
  294. package/lib/utils/style-helper.js +47 -17
  295. package/lib/utils/style.js +2 -2
  296. package/lib/utils/toNumber.js +2 -2
  297. package/lib/utils/tokenize.d.ts +1 -0
  298. package/lib/utils/tokenize.js +11 -3
  299. package/lib/utils/tpl-builtin.js +2 -2
  300. package/lib/utils/tpl-lodash.js +2 -2
  301. package/lib/utils/tpl.js +6 -8
  302. package/lib/utils/uncontrollable.js +2 -2
  303. package/lib/utils/validateId.d.ts +16 -0
  304. package/lib/utils/validateId.js +160 -0
  305. package/lib/utils/validations.js +17 -9
  306. package/package.json +4 -9
  307. package/LICENSE +0 -201
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -43,7 +43,6 @@ require('../utils/icon.js');
43
43
  require('../utils/image.js');
44
44
  require('lodash/isEqual');
45
45
  require('../actions/Action.js');
46
- require('lodash/cloneDeep');
47
46
  require('../utils/resize-sensor.js');
48
47
  require('react-overlays/useRootClose');
49
48
  require('../utils/SimpleMap.js');
@@ -73,7 +72,7 @@ var getItemLabelClassName = function (props) {
73
72
  var staticLabelClassName = props.staticLabelClassName, labelClassName = props.labelClassName, id = props.id, themeCss = props.themeCss;
74
73
  return props.static && staticLabelClassName
75
74
  ? staticLabelClassName
76
- : cx__default["default"](labelClassName, styleHelper.setThemeClassName('labelClassName', id, themeCss, 'item'));
75
+ : cx__default["default"](labelClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'labelClassName', id: id, themeCss: themeCss, extra: 'item' })));
77
76
  };
78
77
  var getItemInputClassName = function (props) {
79
78
  var staticInputClassName = props.staticInputClassName, inputClassName = props.inputClassName;
@@ -365,7 +364,7 @@ var FormItemWrap = /** @class */ (function (_super) {
365
364
  typeof controlSize === 'string' &&
366
365
  !!controlSize &&
367
366
  controlSize !== 'full',
368
- _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', rest.id, rest.wrapperCustomStyle, 'item'), getItemInputClassName(this.props)) }));
367
+ _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, this.props), { name: 'wrapperCustomStyle', id: rest.id, themeCss: rest.wrapperCustomStyle, extra: 'item' })), getItemInputClassName(this.props)) }));
369
368
  }
370
369
  return null;
371
370
  };
@@ -388,7 +387,7 @@ var FormItemWrap = /** @class */ (function (_super) {
388
387
  formStore: undefined
389
388
  })
390
389
  : null,
391
- _J$X_(CustomStyle["default"], { config: {
390
+ _J$X_(CustomStyle["default"], tslib.__assign({}, this.props, { config: {
392
391
  themeCss: themeCss || css,
393
392
  classNames: [
394
393
  {
@@ -400,7 +399,7 @@ var FormItemWrap = /** @class */ (function (_super) {
400
399
  ],
401
400
  wrapperCustomStyle: wrapperCustomStyle,
402
401
  id: id && id + '-item'
403
- }, env: env })));
402
+ }, env: env }))));
404
403
  };
405
404
  /**
406
405
  * 布局扩充点,可以自己扩充表单项的布局方式
@@ -424,7 +423,7 @@ var FormItemWrap = /** @class */ (function (_super) {
424
423
  },
425
424
  _a["is-error"] = model && !model.valid,
426
425
  _a["is-required"] = required,
427
- _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
426
+ _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
428
427
  label !== false ? (_J$X_("label", { className: cx("Form-label", (_b = {},
429
428
  _b["Form-itemColumn--".concat(typeof horizontal.leftFixed === 'string'
430
429
  ? horizontal.leftFixed
@@ -477,7 +476,7 @@ var FormItemWrap = /** @class */ (function (_super) {
477
476
  Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
478
477
  renderDescription !== false && description
479
478
  ? render('description', description, {
480
- className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
479
+ className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
481
480
  })
482
481
  : null)));
483
482
  },
@@ -489,7 +488,7 @@ var FormItemWrap = /** @class */ (function (_super) {
489
488
  'is-error': model && !model.valid
490
489
  },
491
490
  _a["is-required"] = required,
492
- _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
491
+ _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
493
492
  label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)) },
494
493
  _J$X_("span", null,
495
494
  label ? render('label', label) : null,
@@ -532,7 +531,7 @@ var FormItemWrap = /** @class */ (function (_super) {
532
531
  Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
533
532
  renderDescription !== false && description
534
533
  ? render('description', description, {
535
- className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
534
+ className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
536
535
  })
537
536
  : null)) : (_J$X_(React__default["default"].Fragment, null,
538
537
  renderControl(),
@@ -562,7 +561,7 @@ var FormItemWrap = /** @class */ (function (_super) {
562
561
  Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
563
562
  renderDescription !== false && description
564
563
  ? render('description', description, {
565
- className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
564
+ className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
566
565
  })
567
566
  : null))));
568
567
  },
@@ -575,7 +574,7 @@ var FormItemWrap = /** @class */ (function (_super) {
575
574
  'is-error': model && !model.valid
576
575
  },
577
576
  _a["is-required"] = required,
578
- _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
577
+ _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
579
578
  label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
580
579
  _J$X_("span", null,
581
580
  label ? render('label', label) : label,
@@ -618,7 +617,7 @@ var FormItemWrap = /** @class */ (function (_super) {
618
617
  Array.isArray(model.errors) ? (_J$X_("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
619
618
  renderDescription !== false && description
620
619
  ? render('description', description, {
621
- className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
620
+ className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
622
621
  })
623
622
  : null)));
624
623
  },
@@ -631,7 +630,7 @@ var FormItemWrap = /** @class */ (function (_super) {
631
630
  'is-error': model && !model.valid
632
631
  },
633
632
  _a["is-required"] = required,
634
- _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName('wrapperCustomStyle', id, wrapperCustomStyle, 'item')), style: style },
633
+ _a), model === null || model === void 0 ? void 0 : model.errClassNames, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'wrapperCustomStyle', id: id, themeCss: wrapperCustomStyle, extra: 'item' }))), style: style },
635
634
  _J$X_("div", { className: cx('Form-rowInner') },
636
635
  label && renderLabel !== false ? (_J$X_("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
637
636
  _J$X_("span", null,
@@ -673,7 +672,7 @@ var FormItemWrap = /** @class */ (function (_super) {
673
672
  Array.isArray(model.errors) ? (_J$X_("ul", { className: cx('Form-feedback') }, model.errors.map(function (msg, key) { return (_J$X_("li", { key: key }, msg)); }))) : null,
674
673
  description && renderDescription !== false
675
674
  ? render('description', description, {
676
- className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName('descriptionClassName', id, themeCss, 'item'))
675
+ className: cx("Form-description", descriptionClassName, styleHelper.setThemeClassName(tslib.__assign(tslib.__assign({}, props), { name: 'descriptionClassName', id: id, themeCss: themeCss, extra: 'item' })))
677
676
  })
678
677
  : null));
679
678
  }
@@ -126,6 +126,11 @@ export interface FormOptionsControl extends FormBaseControl {
126
126
  autoFill?: {
127
127
  [propName: string]: string;
128
128
  };
129
+ /**
130
+ * @default fillIfNotSet
131
+ * 初始化时是否把其他字段同步到表单内部。
132
+ */
133
+ initAutoFill?: boolean | 'fillIfNotSet';
129
134
  }
130
135
  export interface OptionsBasicConfig extends FormItemBasicConfig {
131
136
  autoLoadOptionsFromSource?: boolean;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -43,13 +43,13 @@ require('../utils/icon.js');
43
43
  require('../utils/image.js');
44
44
  var keyToPath = require('../utils/keyToPath.js');
45
45
  var rendererEvent = require('../utils/renderer-event.js');
46
- require('lodash/cloneDeep');
47
46
  require('../utils/resize-sensor.js');
48
47
  require('react-overlays/useRootClose');
49
48
  require('react-dom');
50
49
  require('../utils/SimpleMap.js');
51
50
  require('lodash/mapValues');
52
51
  require('lodash/camelCase');
52
+ require('lodash/cloneDeep');
53
53
  require('lodash/map');
54
54
  require('lodash/isEmpty');
55
55
  require('lodash/kebabCase');
@@ -96,6 +96,7 @@ function registerOptionsControl(config) {
96
96
  _this = _super.call(this, props) || this;
97
97
  _this.toDispose = [];
98
98
  _this.mounted = false;
99
+ _this.initedFilled = false;
99
100
  var initFetch = props.initFetch, formItem = props.formItem, source = props.source, data = props.data, setPrinstineValue = props.setPrinstineValue, defaultValue = props.defaultValue, multiple = props.multiple, joinValues = props.joinValues, extractValue = props.extractValue, addHook = props.addHook, formInited = props.formInited, valueField = props.valueField, options = props.options, value = props.value, defaultCheckAll = props.defaultCheckAll;
100
101
  if (formItem) {
101
102
  formItem.setOptions(normalizeOptions.normalizeOptions(options, undefined, valueField), _this.changeOptionValue, data);
@@ -104,12 +105,20 @@ function registerOptionsControl(config) {
104
105
  return JSON.stringify(formItem.getSelectedOptions(formItem.tmpValue));
105
106
  }, function () {
106
107
  return _this.mounted &&
108
+ _this.initedFilled &&
107
109
  _this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue));
108
110
  }));
109
- if (options &&
110
- formItem.tmpValue &&
111
- formItem.getSelectedOptions(formItem.tmpValue).length) {
112
- _this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue));
111
+ if (formInited || !addHook) {
112
+ _this.initedFilled = true;
113
+ _this.props.initAutoFill !== false &&
114
+ _this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue), _this.props.initAutoFill === 'fillIfNotSet');
115
+ }
116
+ else if (addHook) {
117
+ addHook(function () {
118
+ _this.initedFilled = true;
119
+ _this.props.initAutoFill !== false &&
120
+ _this.syncAutoFill(formItem.getSelectedOptions(formItem.tmpValue), _this.props.initAutoFill === 'fillIfNotSet');
121
+ }, 'init');
113
122
  }
114
123
  // 默认全选。这里会和默认值\回填值逻辑冲突,所以如果有配置source则不执行默认全选
115
124
  if (multiple &&
@@ -241,7 +250,8 @@ function registerOptionsControl(config) {
241
250
  onChange === null || onChange === void 0 ? void 0 : onChange(resetValue !== null && resetValue !== void 0 ? resetValue : '');
242
251
  }
243
252
  };
244
- FormOptionsItem.prototype.syncAutoFill = function (selectedOptions) {
253
+ FormOptionsItem.prototype.syncAutoFill = function (selectedOptions, skipIfExits) {
254
+ if (skipIfExits === void 0) { skipIfExits = false; }
245
255
  var _a = this.props, autoFill = _a.autoFill, multiple = _a.multiple, onBulkChange = _a.onBulkChange, data = _a.data;
246
256
  var formItem = this.props.formItem;
247
257
  // 参照录入|自动填充
@@ -263,11 +273,18 @@ function registerOptionsControl(config) {
263
273
  var result_1 = tslib.__assign({}, toSync_1);
264
274
  Object.keys(autoFill).forEach(function (key) {
265
275
  var keys = keyToPath.keyToPath(key);
276
+ var value = getVariable.getVariable(toSync_1, key);
277
+ if (skipIfExits) {
278
+ var originValue = getVariable.getVariable(data, key);
279
+ if (typeof originValue !== 'undefined') {
280
+ value = originValue;
281
+ }
282
+ }
283
+ object.setVariable(result_1, key, value);
266
284
  // 如果左边的 key 是一个路径
267
285
  // 这里不希望直接把原始对象都给覆盖没了
268
286
  // 而是保留原始的对象,只修改指定的属性
269
287
  if (keys.length > 1 && isPlainObject__default["default"](tmpData_1[keys[0]])) {
270
- var value = getVariable.getVariable(toSync_1, key);
271
288
  // 存在情况:依次更新同一子路径的多个key,eg: a.b.c1 和 a.b.c2,所以需要同步更新data
272
289
  object.setVariable(tmpData_1, key, value);
273
290
  result_1[keys[0]] = tmpData_1[keys[0]];
@@ -935,7 +952,7 @@ function registerOptionsControl(config) {
935
952
  : [], nodePath: nodePathArray, loading: formItem ? formItem.loading : false, setLoading: this.setLoading, setOptions: this.setOptions, syncOptions: this.syncOptions, reloadOptions: this.reload, deferLoad: this.deferLoad, leftDeferLoad: this.leftDeferLoad, expandTreeOptions: this.expandTreeOptions, creatable: creatable !== false && api.isEffectiveApi(addApi) ? true : creatable, editable: editable || (editable !== false && api.isEffectiveApi(editApi)), removable: removable || (removable !== false && api.isEffectiveApi(deleteApi)), onAdd: this.handleOptionAdd, onEdit: this.handleOptionEdit, onDelete: this.handleOptionDelete })));
936
953
  };
937
954
  FormOptionsItem.displayName = "OptionsControl(".concat(config.type, ")");
938
- FormOptionsItem.defaultProps = tslib.__assign({ delimiter: ',', labelField: 'label', valueField: 'value', joinValues: true, extractValue: false, multiple: false, placeholder: 'Select.placeholder', resetValue: '', deleteConfirmText: 'deleteConfirm' }, Control.defaultProps);
955
+ FormOptionsItem.defaultProps = tslib.__assign({ delimiter: ',', labelField: 'label', valueField: 'value', joinValues: true, extractValue: false, multiple: false, placeholder: 'Select.placeholder', resetValue: '', deleteConfirmText: 'deleteConfirm', initAutoFill: 'fillIfNotSet' }, Control.defaultProps);
939
956
  FormOptionsItem.propsList = Control.propsList
940
957
  ? tslib.__spreadArray([], tslib.__read(Control.propsList), false) : [];
941
958
  FormOptionsItem.ComposedComponent = Control;
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -42,13 +42,13 @@ require('../utils/highlight.js');
42
42
  require('../utils/icon.js');
43
43
  require('../utils/image.js');
44
44
  require('../actions/Action.js');
45
- require('lodash/cloneDeep');
46
45
  require('../utils/resize-sensor.js');
47
46
  require('react-overlays/useRootClose');
48
47
  require('react-dom');
49
48
  require('../utils/SimpleMap.js');
50
49
  require('lodash/mapValues');
51
50
  require('lodash/camelCase');
51
+ require('lodash/cloneDeep');
52
52
  require('lodash/isObject');
53
53
  require('lodash/map');
54
54
  require('lodash/isEmpty');
@@ -128,26 +128,7 @@ function wrapControl(ComposedComponent) {
128
128
  model.setIsControlled(true);
129
129
  }
130
130
  else {
131
- var isExp = formula.isExpression(value);
132
- if (isExp) {
133
- model.changeTmpValue(formula.FormulaExec['formula'](value, data), // 对组件默认值进行运算
134
- 'formulaChanged');
135
- }
136
- else {
137
- var initialValue = model.extraName
138
- ? [
139
- store === null || store === void 0 ? void 0 : store.getValueByName(model.name, form === null || form === void 0 ? void 0 : form.canAccessSuperData),
140
- store === null || store === void 0 ? void 0 : store.getValueByName(model.extraName, form === null || form === void 0 ? void 0 : form.canAccessSuperData)
141
- ]
142
- : store === null || store === void 0 ? void 0 : store.getValueByName(model.name, form === null || form === void 0 ? void 0 : form.canAccessSuperData);
143
- if (model.extraName &&
144
- initialValue.every(function (item) { return item === undefined; })) {
145
- initialValue = undefined;
146
- }
147
- model.changeTmpValue(initialValue !== null && initialValue !== void 0 ? initialValue : formula.replaceExpression(value), typeof initialValue !== 'undefined'
148
- ? 'initialValue'
149
- : 'defaultValue');
150
- }
131
+ _this.setInitialValue(value);
151
132
  }
152
133
  if (onChange &&
153
134
  value !== undefined &&
@@ -185,9 +166,7 @@ function wrapControl(ComposedComponent) {
185
166
  var _this = this;
186
167
  var _a = this.props; _a.store; _a.formStore; var validate = _a.$schema.validate, addHook = _a.addHook;
187
168
  // 提交前先把之前的 lazyEmit 执行一下。
188
- this.hook3 = function () {
189
- _this.lazyEmitChange.flush();
190
- };
169
+ this.hook3 = function () { return _this.lazyEmitChange.flush(); };
191
170
  addHook === null || addHook === void 0 ? void 0 : addHook(this.hook3, 'flush');
192
171
  var formItem = this.model;
193
172
  if (formItem && validate) {
@@ -204,6 +183,7 @@ function wrapControl(ComposedComponent) {
204
183
  }
205
184
  };
206
185
  class_1.prototype.componentDidUpdate = function (prevProps) {
186
+ var _this = this;
207
187
  var _a, _b, _c;
208
188
  var props = this.props;
209
189
  var model = this.model;
@@ -211,6 +191,7 @@ function wrapControl(ComposedComponent) {
211
191
  return;
212
192
  }
213
193
  helper.changedEffect([
194
+ 'name',
214
195
  'id',
215
196
  'validations',
216
197
  'validationErrors',
@@ -237,6 +218,9 @@ function wrapControl(ComposedComponent) {
237
218
  model.config(tslib.__assign(tslib.__assign({}, changes), {
238
219
  // todo 优化后面两个
239
220
  isValueSchemaExp: formula.isExpression(props.$schema.value), inputGroupControl: props === null || props === void 0 ? void 0 : props.inputGroupControl }));
221
+ if (changes.hasOwnProperty('name')) {
222
+ _this.setInitialValue(_this.props.$schema.value);
223
+ }
240
224
  });
241
225
  if (props.required !== prevProps.required) {
242
226
  model.config({
@@ -312,6 +296,30 @@ function wrapControl(ComposedComponent) {
312
296
  (_g = this.reaction) === null || _g === void 0 ? void 0 : _g.call(this);
313
297
  this.disposeModel();
314
298
  };
299
+ class_1.prototype.setInitialValue = function (value) {
300
+ var model = this.model;
301
+ var _a = this.props, form = _a.formStore, data = _a.data, canAccessSuperData = _a.canAccessSuperData;
302
+ var isExp = formula.isExpression(value);
303
+ if (isExp) {
304
+ model.changeTmpValue(formula.FormulaExec['formula'](value, data), // 对组件默认值进行运算
305
+ 'formulaChanged');
306
+ }
307
+ else {
308
+ var initialValue = model.extraName
309
+ ? [
310
+ getVariable.getVariable(data, model.name, canAccessSuperData !== null && canAccessSuperData !== void 0 ? canAccessSuperData : form === null || form === void 0 ? void 0 : form.canAccessSuperData),
311
+ getVariable.getVariable(data, model.extraName, canAccessSuperData !== null && canAccessSuperData !== void 0 ? canAccessSuperData : form === null || form === void 0 ? void 0 : form.canAccessSuperData)
312
+ ]
313
+ : getVariable.getVariable(data, model.name, canAccessSuperData !== null && canAccessSuperData !== void 0 ? canAccessSuperData : form === null || form === void 0 ? void 0 : form.canAccessSuperData);
314
+ if (model.extraName &&
315
+ initialValue.every(function (item) { return item === undefined; })) {
316
+ initialValue = undefined;
317
+ }
318
+ model.changeTmpValue(initialValue !== null && initialValue !== void 0 ? initialValue : formula.replaceExpression(value), typeof initialValue !== 'undefined'
319
+ ? 'initialValue'
320
+ : 'defaultValue');
321
+ }
322
+ };
315
323
  class_1.prototype.disposeModel = function () {
316
324
  var _a;
317
325
  var _b = this.props, form = _b.formStore, formItem = _b.formItem, rootStore = _b.rootStore;
@@ -524,10 +532,10 @@ function wrapControl(ComposedComponent) {
524
532
  }
525
533
  };
526
534
  class_1.prototype.getValue = function () {
527
- var _a = this.props, data = _a.formStore, control = _a.$schema;
535
+ var _a = this.props, formStore = _a.formStore, data = _a.data, control = _a.$schema;
528
536
  var value = this.model ? this.model.tmpValue : control.value;
529
537
  if (control.pipeIn) {
530
- value = api.callStrFunction.call(this, control.pipeIn, ['value', 'data'], value, data);
538
+ value = api.callStrFunction.call(this, control.pipeIn, ['value', 'store', 'data'], value, formStore, data);
531
539
  }
532
540
  return value;
533
541
  };
package/lib/store/app.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
- * amis-core v6.0.0
3
- * Copyright 2018-2023 fex
2
+ * amis-core v6.2.0
3
+ * Copyright 2018-2024 fex
4
4
  */
5
5
 
6
6
  'use strict';
@@ -35,7 +35,6 @@ require('../utils/image.js');
35
35
  require('lodash/isEqual');
36
36
  require('../actions/Action.js');
37
37
  require('lodash/debounce');
38
- require('lodash/cloneDeep');
39
38
  require('../utils/resize-sensor.js');
40
39
  require('react');
41
40
  require('react-overlays/useRootClose');
@@ -43,6 +42,7 @@ require('react-dom');
43
42
  require('../utils/SimpleMap.js');
44
43
  require('lodash/mapValues');
45
44
  require('lodash/camelCase');
45
+ require('lodash/cloneDeep');
46
46
  require('lodash/map');
47
47
  require('lodash/isEmpty');
48
48
  require('lodash/kebabCase');