amis-core 2.5.4-alpha.4 → 2.6.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 (235) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +5 -3
  3. package/esm/SchemaRenderer.js +1 -1
  4. package/esm/Scoped.js +24 -2
  5. package/esm/WithRootStore.js +1 -1
  6. package/esm/WithStore.js +1 -1
  7. package/esm/actions/Action.js +1 -1
  8. package/esm/actions/AjaxAction.js +1 -1
  9. package/esm/actions/BreakAction.js +1 -1
  10. package/esm/actions/BroadcastAction.js +1 -1
  11. package/esm/actions/CmptAction.js +5 -3
  12. package/esm/actions/ContinueAction.js +1 -1
  13. package/esm/actions/CopyAction.js +1 -1
  14. package/esm/actions/CustomAction.js +1 -1
  15. package/esm/actions/DialogAction.js +1 -1
  16. package/esm/actions/DrawerAction.js +1 -1
  17. package/esm/actions/EmailAction.js +1 -1
  18. package/esm/actions/LinkAction.js +1 -1
  19. package/esm/actions/LoopAction.js +1 -1
  20. package/esm/actions/PageAction.js +1 -1
  21. package/esm/actions/ParallelAction.js +1 -1
  22. package/esm/actions/SwitchAction.js +1 -1
  23. package/esm/actions/ToastAction.js +1 -1
  24. package/esm/components/LazyComponent.js +1 -1
  25. package/esm/components/Overlay.js +1 -1
  26. package/esm/components/PopOver.js +1 -1
  27. package/esm/env.d.ts +4 -0
  28. package/esm/env.js +1 -1
  29. package/esm/envOverwrite.js +1 -1
  30. package/esm/factory.js +1 -1
  31. package/esm/index.d.ts +3 -3
  32. package/esm/index.js +4 -4
  33. package/esm/locale.d.ts +2 -0
  34. package/esm/locale.js +15 -2
  35. package/esm/renderers/Form.d.ts +5 -0
  36. package/esm/renderers/Form.js +13 -6
  37. package/esm/renderers/Item.js +8 -7
  38. package/esm/renderers/Options.js +1 -1
  39. package/esm/renderers/Placeholder.js +1 -1
  40. package/esm/renderers/builtin.js +1 -1
  41. package/esm/renderers/register.js +1 -1
  42. package/esm/renderers/wrapControl.js +1 -1
  43. package/esm/store/app.js +1 -1
  44. package/esm/store/combo.js +1 -1
  45. package/esm/store/crud.js +1 -1
  46. package/esm/store/form.js +13 -4
  47. package/esm/store/formItem.js +1 -1
  48. package/esm/store/iRenderer.js +1 -1
  49. package/esm/store/index.js +1 -1
  50. package/esm/store/list.js +1 -1
  51. package/esm/store/manager.js +1 -1
  52. package/esm/store/modal.js +1 -1
  53. package/esm/store/node.js +1 -1
  54. package/esm/store/pagination.js +1 -1
  55. package/esm/store/root.d.ts +1 -1
  56. package/esm/store/root.js +3 -3
  57. package/esm/store/service.js +1 -1
  58. package/esm/store/table.js +1 -1
  59. package/esm/store/table2.js +1 -1
  60. package/esm/theme.js +1 -1
  61. package/esm/utils/Animation.js +1 -1
  62. package/esm/utils/ColorScale.js +1 -1
  63. package/esm/utils/DataSchema.js +1 -1
  64. package/esm/utils/DataScope.js +1 -1
  65. package/esm/utils/RootClose.js +1 -1
  66. package/esm/utils/SimpleMap.js +1 -1
  67. package/esm/utils/api.js +1 -1
  68. package/esm/utils/attachmentAdpator.js +1 -1
  69. package/esm/utils/autobind.js +1 -1
  70. package/esm/utils/columnsSplit.js +1 -1
  71. package/esm/utils/dataMapping.js +1 -1
  72. package/esm/utils/date.js +1 -1
  73. package/esm/utils/debug.js +1 -1
  74. package/esm/utils/decodeEntity.js +1 -1
  75. package/esm/utils/dom.js +1 -1
  76. package/esm/utils/errors.js +1 -1
  77. package/esm/utils/escapeHtml.js +1 -1
  78. package/esm/utils/filter-schema.js +1 -1
  79. package/esm/utils/filter.js +8 -3
  80. package/esm/utils/formatDuration.js +1 -1
  81. package/esm/utils/formula.js +1 -1
  82. package/esm/utils/getVariable.js +1 -1
  83. package/esm/utils/grammar.js +1 -1
  84. package/esm/utils/handleAction.js +1 -1
  85. package/esm/utils/helper.js +1 -1
  86. package/esm/utils/highlight.js +1 -1
  87. package/esm/utils/icon.js +1 -1
  88. package/esm/utils/image.js +1 -1
  89. package/esm/utils/isPureVariable.js +1 -1
  90. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  91. package/esm/utils/keyToPath.js +1 -1
  92. package/esm/utils/makeSorter.js +1 -1
  93. package/esm/utils/normalizeLink.js +1 -1
  94. package/esm/utils/normalizeOptions.js +1 -1
  95. package/esm/utils/object.js +1 -1
  96. package/esm/utils/offset.js +1 -1
  97. package/esm/utils/offsetParent.js +1 -1
  98. package/esm/utils/optionValueCompare.js +1 -1
  99. package/esm/utils/position.js +1 -1
  100. package/esm/utils/prettyBytes.js +1 -1
  101. package/esm/utils/renderer-event.js +1 -1
  102. package/esm/utils/replaceText.js +1 -1
  103. package/esm/utils/resize-sensor.js +1 -1
  104. package/esm/utils/resolveVariable.js +1 -1
  105. package/esm/utils/resolveVariableAndFilter.js +1 -1
  106. package/esm/utils/scrollPosition.js +1 -1
  107. package/esm/utils/string2regExp.js +1 -1
  108. package/esm/utils/stripNumber.js +1 -1
  109. package/esm/utils/style.js +1 -1
  110. package/esm/utils/toNumber.js +1 -1
  111. package/esm/utils/tokenize.js +1 -1
  112. package/esm/utils/tpl-builtin.d.ts +2 -2
  113. package/esm/utils/tpl-builtin.js +2 -2
  114. package/esm/utils/tpl-lodash.js +1 -1
  115. package/esm/utils/tpl.js +1 -1
  116. package/esm/utils/uncontrollable.js +1 -1
  117. package/esm/utils/validations.js +1 -1
  118. package/lib/Root.js +1 -1
  119. package/lib/RootRenderer.js +5 -3
  120. package/lib/SchemaRenderer.js +1 -1
  121. package/lib/Scoped.js +24 -2
  122. package/lib/WithRootStore.js +1 -1
  123. package/lib/WithStore.js +1 -1
  124. package/lib/actions/Action.js +1 -1
  125. package/lib/actions/AjaxAction.js +1 -1
  126. package/lib/actions/BreakAction.js +1 -1
  127. package/lib/actions/BroadcastAction.js +1 -1
  128. package/lib/actions/CmptAction.js +5 -3
  129. package/lib/actions/ContinueAction.js +1 -1
  130. package/lib/actions/CopyAction.js +1 -1
  131. package/lib/actions/CustomAction.js +1 -1
  132. package/lib/actions/DialogAction.js +1 -1
  133. package/lib/actions/DrawerAction.js +1 -1
  134. package/lib/actions/EmailAction.js +1 -1
  135. package/lib/actions/LinkAction.js +1 -1
  136. package/lib/actions/LoopAction.js +1 -1
  137. package/lib/actions/PageAction.js +1 -1
  138. package/lib/actions/ParallelAction.js +1 -1
  139. package/lib/actions/SwitchAction.js +1 -1
  140. package/lib/actions/ToastAction.js +1 -1
  141. package/lib/components/LazyComponent.js +1 -1
  142. package/lib/components/Overlay.js +1 -1
  143. package/lib/components/PopOver.js +1 -1
  144. package/lib/env.d.ts +4 -0
  145. package/lib/env.js +1 -1
  146. package/lib/envOverwrite.js +1 -1
  147. package/lib/factory.js +1 -1
  148. package/lib/index.d.ts +3 -3
  149. package/lib/index.js +7 -2
  150. package/lib/locale.d.ts +2 -0
  151. package/lib/locale.js +15 -1
  152. package/lib/renderers/Form.d.ts +5 -0
  153. package/lib/renderers/Form.js +13 -6
  154. package/lib/renderers/Item.js +8 -7
  155. package/lib/renderers/Options.js +1 -1
  156. package/lib/renderers/Placeholder.js +1 -1
  157. package/lib/renderers/builtin.js +1 -1
  158. package/lib/renderers/register.js +1 -1
  159. package/lib/renderers/wrapControl.js +1 -1
  160. package/lib/store/app.js +1 -1
  161. package/lib/store/combo.js +1 -1
  162. package/lib/store/crud.js +1 -1
  163. package/lib/store/form.js +14 -4
  164. package/lib/store/formItem.js +1 -1
  165. package/lib/store/iRenderer.js +1 -1
  166. package/lib/store/index.js +1 -1
  167. package/lib/store/list.js +1 -1
  168. package/lib/store/manager.js +1 -1
  169. package/lib/store/modal.js +1 -1
  170. package/lib/store/node.js +1 -1
  171. package/lib/store/pagination.js +1 -1
  172. package/lib/store/root.d.ts +1 -1
  173. package/lib/store/root.js +3 -3
  174. package/lib/store/service.js +1 -1
  175. package/lib/store/table.js +1 -1
  176. package/lib/store/table2.js +1 -1
  177. package/lib/theme.js +1 -1
  178. package/lib/utils/Animation.js +1 -1
  179. package/lib/utils/ColorScale.js +1 -1
  180. package/lib/utils/DataSchema.js +1 -1
  181. package/lib/utils/DataScope.js +1 -1
  182. package/lib/utils/RootClose.js +1 -1
  183. package/lib/utils/SimpleMap.js +1 -1
  184. package/lib/utils/api.js +1 -1
  185. package/lib/utils/attachmentAdpator.js +1 -1
  186. package/lib/utils/autobind.js +1 -1
  187. package/lib/utils/columnsSplit.js +1 -1
  188. package/lib/utils/dataMapping.js +1 -1
  189. package/lib/utils/date.js +1 -1
  190. package/lib/utils/debug.js +1 -1
  191. package/lib/utils/decodeEntity.js +1 -1
  192. package/lib/utils/dom.js +1 -1
  193. package/lib/utils/errors.js +1 -1
  194. package/lib/utils/escapeHtml.js +1 -1
  195. package/lib/utils/filter-schema.js +1 -1
  196. package/lib/utils/filter.js +8 -3
  197. package/lib/utils/formatDuration.js +1 -1
  198. package/lib/utils/formula.js +1 -1
  199. package/lib/utils/getVariable.js +1 -1
  200. package/lib/utils/grammar.js +1 -1
  201. package/lib/utils/handleAction.js +1 -1
  202. package/lib/utils/helper.js +1 -1
  203. package/lib/utils/highlight.js +1 -1
  204. package/lib/utils/icon.js +1 -1
  205. package/lib/utils/image.js +1 -1
  206. package/lib/utils/isPureVariable.js +1 -1
  207. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  208. package/lib/utils/keyToPath.js +1 -1
  209. package/lib/utils/makeSorter.js +1 -1
  210. package/lib/utils/normalizeLink.js +1 -1
  211. package/lib/utils/normalizeOptions.js +1 -1
  212. package/lib/utils/object.js +1 -1
  213. package/lib/utils/offset.js +1 -1
  214. package/lib/utils/offsetParent.js +1 -1
  215. package/lib/utils/optionValueCompare.js +1 -1
  216. package/lib/utils/position.js +1 -1
  217. package/lib/utils/prettyBytes.js +1 -1
  218. package/lib/utils/renderer-event.js +1 -1
  219. package/lib/utils/replaceText.js +1 -1
  220. package/lib/utils/resize-sensor.js +1 -1
  221. package/lib/utils/resolveVariable.js +1 -1
  222. package/lib/utils/resolveVariableAndFilter.js +1 -1
  223. package/lib/utils/scrollPosition.js +1 -1
  224. package/lib/utils/string2regExp.js +1 -1
  225. package/lib/utils/stripNumber.js +1 -1
  226. package/lib/utils/style.js +1 -1
  227. package/lib/utils/toNumber.js +1 -1
  228. package/lib/utils/tokenize.js +1 -1
  229. package/lib/utils/tpl-builtin.d.ts +2 -2
  230. package/lib/utils/tpl-builtin.js +5 -1
  231. package/lib/utils/tpl-lodash.js +1 -1
  232. package/lib/utils/tpl.js +1 -1
  233. package/lib/utils/uncontrollable.js +1 -1
  234. package/lib/utils/validations.js +1 -1
  235. package/package.json +3 -3
package/esm/Root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -19,7 +19,9 @@ import { normalizeApi } from './utils/api.js';
19
19
  var RootRenderer = /** @class */ (function (_super) {
20
20
  __extends(RootRenderer, _super);
21
21
  function RootRenderer(props) {
22
- var _this = _super.call(this, props) || this;
22
+ var _this = this;
23
+ var _a;
24
+ _this = _super.call(this, props) || this;
23
25
  _this.store = props.rootStore.addStore({
24
26
  id: guid(),
25
27
  path: _this.props.$path,
@@ -27,7 +29,7 @@ var RootRenderer = /** @class */ (function (_super) {
27
29
  parentId: ''
28
30
  });
29
31
  _this.store.initData(props.data);
30
- _this.store.updateLocation(props.location);
32
+ _this.store.updateLocation(props.location, (_a = _this.props.env) === null || _a === void 0 ? void 0 : _a.parseLocation);
31
33
  bulkBindFunctions(_this, [
32
34
  'handleAction',
33
35
  'handleDialogConfirm',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
package/esm/Scoped.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -7,9 +7,10 @@ import { __assign, __extends, __rest, __decorate, __metadata } from 'tslib';
7
7
  import React from 'react';
8
8
  import find from 'lodash/find';
9
9
  import hoistNonReactStatic from 'hoist-non-react-statics';
10
- import 'amis-formula';
10
+ import { registerFunction } from 'amis-formula';
11
11
  import 'moment';
12
12
  import 'lodash/isPlainObject';
13
+ import { getVariable } from './utils/getVariable.js';
13
14
  import { dataMapping } from './utils/dataMapping.js';
14
15
  import './utils/filter.js';
15
16
  import { findTree, qsparse, qsstringify, parseQuery, autobind } from './utils/helper.js';
@@ -174,6 +175,27 @@ function createScopedTools(path, parent, env) {
174
175
  }
175
176
  }
176
177
  };
178
+ registerFunction('GETRENDERERDATA', function (componentId, path, scoped) {
179
+ var _a;
180
+ if (scoped === void 0) { scoped = self; }
181
+ var component = scoped.getComponentById(componentId);
182
+ var data = (_a = component === null || component === void 0 ? void 0 : component.getData) === null || _a === void 0 ? void 0 : _a.call(component);
183
+ if (path) {
184
+ var variable = getVariable(data, path);
185
+ return variable;
186
+ }
187
+ return data;
188
+ });
189
+ registerFunction('GETRENDERERPROP', function (componentId, path, scoped) {
190
+ if (scoped === void 0) { scoped = self; }
191
+ var component = scoped.getComponentById(componentId);
192
+ var props = component === null || component === void 0 ? void 0 : component.props;
193
+ if (path) {
194
+ var variable = getVariable(props, path);
195
+ return variable;
196
+ }
197
+ return props;
198
+ });
177
199
  if (!parent) {
178
200
  return self;
179
201
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
package/esm/WithStore.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -28,7 +28,8 @@ var CmptAction = /** @class */ (function () {
28
28
  // 显隐&状态控制
29
29
  if (['show', 'hidden', 'visibility'].includes(action.actionType)) {
30
30
  visibility = action.actionType === 'visibility'
31
- ? (_b = action.args) === null || _b === void 0 ? void 0 : _b.value : action.actionType === 'show';
31
+ ? (_b = action.args) === null || _b === void 0 ? void 0 : _b.value
32
+ : action.actionType === 'show';
32
33
  return [2 /*return*/, renderer.props.topStore.setVisible(action.componentId, visibility)];
33
34
  }
34
35
  else if (['static', 'nonstatic'].includes(action.actionType)) {
@@ -36,7 +37,8 @@ var CmptAction = /** @class */ (function () {
36
37
  }
37
38
  else if (['enabled', 'disabled', 'usability'].includes(action.actionType)) {
38
39
  usability = action.actionType === 'usability'
39
- ? !((_c = action.args) === null || _c === void 0 ? void 0 : _c.value) : action.actionType === 'disabled';
40
+ ? !((_c = action.args) === null || _c === void 0 ? void 0 : _c.value)
41
+ : action.actionType === 'disabled';
40
42
  return [2 /*return*/, renderer.props.topStore.setDisable(action.componentId, usability)];
41
43
  }
42
44
  // 数据更新
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
package/esm/env.d.ts CHANGED
@@ -66,6 +66,10 @@ export interface RendererEnv {
66
66
  * 文本替换的黑名单,因为属性太多了所以改成黑名单的 fangs
67
67
  */
68
68
  replaceTextIgnoreKeys?: String[];
69
+ /**
70
+ * 解析url参数
71
+ */
72
+ parseLocation?: (location: any) => Object;
69
73
  }
70
74
  export declare const EnvContext: React.Context<void | RendererEnv>;
71
75
  export interface EnvProps {
package/esm/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
package/esm/factory.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
package/esm/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export * from './types';
15
15
  export * from './store';
16
16
  import * as utils from './utils/helper';
17
17
  import { RegisterStore } from './store';
18
- import { setDefaultLocale, getDefaultLocale, makeTranslator, register as registerLocale, extendLocale, localeable } from './locale';
18
+ import { setDefaultLocale, getDefaultLocale, makeTranslator, register as registerLocale, extendLocale, removeLocaleData, localeable } from './locale';
19
19
  import type { LocaleProps, TranslateFn } from './locale';
20
20
  import Scoped, { ScopedContext } from './Scoped';
21
21
  import type { IScopedContext } from './Scoped';
@@ -32,7 +32,7 @@ import { Schema } from './types';
32
32
  import { addRootWrapper, RootRenderProps } from './Root';
33
33
  import { EnvContext } from './env';
34
34
  import type { RendererEnv } from './env';
35
- import { evaluate, Evaluator, extendsFilters, filters, getFilters, lexer, parse, registerFilter } from 'amis-formula';
35
+ import { evaluate, Evaluator, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
36
36
  import type { FilterContext } from 'amis-formula';
37
37
  import LazyComponent from './components/LazyComponent';
38
38
  import Overlay from './components/Overlay';
@@ -40,5 +40,5 @@ import PopOver from './components/PopOver';
40
40
  import { FormRenderer } from './renderers/Form';
41
41
  import type { FormHorizontal } from './renderers/Form';
42
42
  export declare const version = "__buildVersion";
43
- export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, evaluate, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig };
43
+ export { clearStoresCache, updateEnv, Renderer, RendererProps, RenderOptions, RendererEnv, EnvContext, RegisterStore, FormItem, FormItemWrap, FormItemProps, OptionsControl, FormRenderer, FormHorizontal, utils, getRendererByName, registerRenderer, unRegisterRenderer, getRenderers, registerFormItem, getFormItemByName, registerOptionsControl, resolveRenderer, filterSchema, Scoped, ScopedContext, IScopedContext, setDefaultTheme, theme, themeable, ThemeProps, getTheme, classPrefix, getClassPrefix, classnames, makeClassnames, getDefaultLocale, setDefaultLocale, registerLocale, makeTranslator, extendLocale, removeLocaleData, localeable, LocaleProps, TranslateFn, ClassNamesFn, parse, lexer, Evaluator, FilterContext, filters, getFilters, registerFilter, extendsFilters, registerFunction, evaluate, LazyComponent, Overlay, PopOver, addSchemaFilter, OptionsControlProps, FormOptionsControl, FormControlProps, FormBaseControl, extendDefaultEnv, addRootWrapper, RendererConfig };
44
44
  export declare function render(schema: Schema, props?: RootRenderProps, options?: RenderOptions, pathPrefix?: string): JSX.Element;
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -72,7 +72,7 @@ import { RendererStore } from './store/index.js';
72
72
  export { RegisterStore, RendererStore } from './store/index.js';
73
73
  import { getEnv } from 'mobx-state-tree';
74
74
  import { getDefaultLocale, makeTranslator } from './locale.js';
75
- export { extendLocale, getDefaultLocale, localeable, makeTranslator, register as registerLocale, setDefaultLocale } from './locale.js';
75
+ export { extendLocale, getDefaultLocale, localeable, makeTranslator, register as registerLocale, removeLocaleData, setDefaultLocale } from './locale.js';
76
76
  export { HocScoped as Scoped, ScopedContext } from './Scoped.js';
77
77
  import { getClassPrefix, getTheme } from './theme.js';
78
78
  export { classnames, getClassPrefix, getTheme, makeClassnames, setDefaultTheme, theme, themeable } from './theme.js';
@@ -101,7 +101,7 @@ import { envOverwrite } from './envOverwrite.js';
101
101
  import { EnvContext } from './env.js';
102
102
  export { EnvContext } from './env.js';
103
103
  import React from 'react';
104
- export { Evaluator, evaluate, extendsFilters, filters, getFilters, lexer, parse, registerFilter } from 'amis-formula';
104
+ export { Evaluator, evaluate, extendsFilters, filters, getFilters, lexer, parse, registerFilter, registerFunction } from 'amis-formula';
105
105
  export { default as LazyComponent } from './components/LazyComponent.js';
106
106
  export { default as Overlay } from './components/Overlay.js';
107
107
  export { default as PopOver } from './components/PopOver.js';
@@ -123,7 +123,7 @@ export { StoreNode } from './store/node.js';
123
123
 
124
124
  var classPrefix = getClassPrefix();
125
125
  // @ts-ignore
126
- var version = '2.5.4-alpha.4';
126
+ var version = '2.6.0';
127
127
  function render(schema, props, options, pathPrefix) {
128
128
  if (props === void 0) { props = {}; }
129
129
  if (options === void 0) { options = {}; }
package/esm/locale.d.ts CHANGED
@@ -6,6 +6,8 @@ interface LocaleConfig {
6
6
  }
7
7
  export declare function register(name: string, config: LocaleConfig): void;
8
8
  export declare function extendLocale(name: string, config: LocaleConfig): void;
9
+ /** 删除语料数据 */
10
+ export declare function removeLocaleData(name: string, key: Array<string> | string): void;
9
11
  export declare function makeTranslator(locale?: string): TranslateFn;
10
12
  export declare function getDefaultLocale(): string;
11
13
  export declare function setDefaultLocale(loacle: string): void;
package/esm/locale.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -21,6 +21,19 @@ function register(name, config) {
21
21
  function extendLocale(name, config) {
22
22
  locales[name] = __assign(__assign({}, (locales[name] || {})), config);
23
23
  }
24
+ /** 删除语料数据 */
25
+ function removeLocaleData(name, key) {
26
+ var _a;
27
+ if (Array.isArray(key)) {
28
+ key.forEach(function (item) {
29
+ removeLocaleData(name, item);
30
+ });
31
+ return;
32
+ }
33
+ if ((_a = locales === null || locales === void 0 ? void 0 : locales[name]) === null || _a === void 0 ? void 0 : _a[key]) {
34
+ delete locales[name][key];
35
+ }
36
+ }
24
37
  var fns = {};
25
38
  function format(str, data) {
26
39
  return str.replace(/(\\)?\{\{([\s\S]+?)\}\}/g, function (_, escape, key) {
@@ -101,4 +114,4 @@ function localeable(ComposedComponent) {
101
114
  return result;
102
115
  }
103
116
 
104
- export { LocaleContext, extendLocale, getDefaultLocale, localeable, makeTranslator, register, setDefaultLocale };
117
+ export { LocaleContext, extendLocale, getDefaultLocale, localeable, makeTranslator, register, removeLocaleData, setDefaultLocale };
@@ -279,6 +279,10 @@ export interface FormProps extends RendererProps, Omit<FormSchemaBase, 'mode' |
279
279
  }>;
280
280
  lazyChange?: boolean;
281
281
  formLazyChange?: boolean;
282
+ loadingConfig?: {
283
+ root?: string;
284
+ show?: boolean;
285
+ };
282
286
  }
283
287
  export default class Form extends React.Component<FormProps, object> {
284
288
  static defaultProps: {
@@ -381,4 +385,5 @@ export declare class FormRenderer extends Form {
381
385
  reload(target?: string, query?: any, ctx?: any, silent?: boolean, replace?: boolean): void;
382
386
  receive(values: object, name?: string, replace?: boolean): void;
383
387
  setData(values: object, replace?: boolean): void;
388
+ getData(): any;
384
389
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -768,7 +768,7 @@ var Form = /** @class */ (function (_super) {
768
768
  });
769
769
  };
770
770
  Form.prototype.buildActions = function () {
771
- var _a = this.props, actions = _a.actions, submitText = _a.submitText, body = _a.body, __ = _a.translate;
771
+ var _a = this.props, actions = _a.actions, submitText = _a.submitText, body = _a.body, __ = _a.translate, loadingConfig = _a.loadingConfig;
772
772
  if (typeof actions !== 'undefined' ||
773
773
  !submitText ||
774
774
  (Array.isArray(body) &&
@@ -785,7 +785,8 @@ var Form = /** @class */ (function (_super) {
785
785
  {
786
786
  type: 'submit',
787
787
  label: __(submitText),
788
- primary: true
788
+ primary: true,
789
+ loadingConfig: loadingConfig
789
790
  }
790
791
  ];
791
792
  };
@@ -908,7 +909,7 @@ var Form = /** @class */ (function (_super) {
908
909
  return render("".concat(region ? "".concat(region, "/") : '').concat(key), subSchema, subProps);
909
910
  };
910
911
  Form.prototype.renderBody = function () {
911
- var _a = this.props, body = _a.body, mode = _a.mode, className = _a.className, cx = _a.classnames, debug = _a.debug, debugConfig = _a.debugConfig, $path = _a.$path, store = _a.store, columnCount = _a.columnCount, render = _a.render, staticClassName = _a.staticClassName, _b = _a.static, isStatic = _b === void 0 ? false : _b;
912
+ var _a = this.props, body = _a.body, mode = _a.mode, className = _a.className, cx = _a.classnames, debug = _a.debug, debugConfig = _a.debugConfig, $path = _a.$path, store = _a.store, columnCount = _a.columnCount, render = _a.render, staticClassName = _a.staticClassName, _b = _a.static, isStatic = _b === void 0 ? false : _b, loadingConfig = _a.loadingConfig;
912
913
  var restError = store.restError;
913
914
  var WrapperComponent = this.props.wrapperComponent ||
914
915
  (/(?:\/|^)form\//.test($path) ? 'div' : 'form');
@@ -929,7 +930,8 @@ var Form = /** @class */ (function (_super) {
929
930
  : null,
930
931
  render('spinner', { type: 'spinner' }, {
931
932
  overlay: true,
932
- show: store.loading
933
+ show: store.loading,
934
+ loadingConfig: loadingConfig
933
935
  }),
934
936
  this.renderFormItems({
935
937
  body: body
@@ -954,7 +956,7 @@ var Form = /** @class */ (function (_super) {
954
956
  })));
955
957
  };
956
958
  Form.prototype.render = function () {
957
- var _a = this.props; _a.$path; _a.$schema; var wrapWithPanel = _a.wrapWithPanel, render = _a.render, title = _a.title, store = _a.store, panelClassName = _a.panelClassName, headerClassName = _a.headerClassName, footerClassName = _a.footerClassName, footerWrapClassName = _a.footerWrapClassName, actionsClassName = _a.actionsClassName, bodyClassName = _a.bodyClassName, cx = _a.classnames, affixFooter = _a.affixFooter, lazyLoad = _a.lazyLoad, __ = _a.translate, footer = _a.footer;
959
+ var _a = this.props; _a.$path; _a.$schema; var wrapWithPanel = _a.wrapWithPanel, render = _a.render, title = _a.title, store = _a.store, panelClassName = _a.panelClassName, headerClassName = _a.headerClassName, footerClassName = _a.footerClassName, footerWrapClassName = _a.footerWrapClassName, actionsClassName = _a.actionsClassName, bodyClassName = _a.bodyClassName, cx = _a.classnames, style = _a.style, affixFooter = _a.affixFooter, lazyLoad = _a.lazyLoad, __ = _a.translate, footer = _a.footer;
958
960
  var body = this.renderBody();
959
961
  if (wrapWithPanel) {
960
962
  body = render('body', {
@@ -962,6 +964,7 @@ var Form = /** @class */ (function (_super) {
962
964
  title: __(title)
963
965
  }, {
964
966
  className: cx(panelClassName, 'Panel--form'),
967
+ style: style,
965
968
  formStore: this.props.store,
966
969
  children: body,
967
970
  actions: this.buildActions(),
@@ -1186,6 +1189,10 @@ var FormRenderer = /** @class */ (function (_super) {
1186
1189
  onChange &&
1187
1190
  onChange(store.data, difference(store.data, store.pristine), this.props);
1188
1191
  };
1192
+ FormRenderer.prototype.getData = function () {
1193
+ var store = this.props.store;
1194
+ return store.data;
1195
+ };
1189
1196
  FormRenderer.contextType = ScopedContext;
1190
1197
  FormRenderer = __decorate([
1191
1198
  Renderer({
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -452,9 +452,9 @@ var FormItemWrap = /** @class */ (function (_super) {
452
452
  },
453
453
  normal: function (props, renderControl) {
454
454
  var _a;
455
- var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, renderLabel = props.renderLabel, renderDescription = props.renderDescription, hint = props.hint, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate;
455
+ var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, renderLabel = props.renderLabel, renderDescription = props.renderDescription, hint = props.hint, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate; var isStatic = props.static, staticClassName = props.staticClassName;
456
456
  description = description || desc;
457
- return (React.createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--normal", className, (_a = {
457
+ return (React.createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--normal", isStatic && staticClassName ? staticClassName : className, (_a = {
458
458
  'is-error': model && !model.valid
459
459
  },
460
460
  _a["is-required"] = required,
@@ -514,10 +514,10 @@ var FormItemWrap = /** @class */ (function (_super) {
514
514
  },
515
515
  inline: function (props, renderControl) {
516
516
  var _a;
517
- var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, remark = props.remark, labelRemark = props.labelRemark, env = props.env, hint = props.hint, renderLabel = props.renderLabel, renderDescription = props.renderDescription, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate;
517
+ var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, remark = props.remark, labelRemark = props.labelRemark, env = props.env, hint = props.hint, renderLabel = props.renderLabel, renderDescription = props.renderDescription, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate; var isStatic = props.static, staticClassName = props.staticClassName;
518
518
  var labelWidth = props.labelWidth || props.formLabelWidth;
519
519
  description = description || desc;
520
- return (React.createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--inline", className, (_a = {
520
+ return (React.createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--inline", isStatic && staticClassName ? staticClassName : className, (_a = {
521
521
  'is-error': model && !model.valid
522
522
  },
523
523
  _a["is-required"] = required,
@@ -580,10 +580,10 @@ var FormItemWrap = /** @class */ (function (_super) {
580
580
  },
581
581
  row: function (props, renderControl) {
582
582
  var _a;
583
- var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, renderLabel = props.renderLabel, renderDescription = props.renderDescription, hint = props.hint, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate;
583
+ var className = props.className, style = props.style, cx = props.classnames, desc = props.desc, description = props.description, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, model = props.formItem, renderLabel = props.renderLabel, renderDescription = props.renderDescription, hint = props.hint, data = props.data, showErrorMsg = props.showErrorMsg, useMobileUI = props.useMobileUI; props.translate; var isStatic = props.static, staticClassName = props.staticClassName;
584
584
  var labelWidth = props.labelWidth || props.formLabelWidth;
585
585
  description = description || desc;
586
- return (React.createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--row", className, (_a = {
586
+ return (React.createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--row", isStatic && staticClassName ? staticClassName : className, (_a = {
587
587
  'is-error': model && !model.valid
588
588
  },
589
589
  _a["is-required"] = required,
@@ -695,6 +695,7 @@ var detectProps = [
695
695
  'addOn',
696
696
  'btnClassName',
697
697
  'btnLabel',
698
+ 'style',
698
699
  'btnDisabled',
699
700
  'className',
700
701
  'clearable',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
package/esm/store/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
package/esm/store/crud.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.5.4-alpha.4
2
+ * amis-core v2.6.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5