amis-core 2.0.2 → 2.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 (327) hide show
  1. package/esm/Root.js +1 -1
  2. package/esm/RootRenderer.js +1 -1
  3. package/esm/SchemaRenderer.js +2 -2
  4. package/esm/Scoped.js +1 -1
  5. package/esm/WithRootStore.js +1 -1
  6. package/esm/WithStore.js +1 -1
  7. package/esm/_virtual/index.js +1 -1
  8. package/esm/_virtual/index2.js +1 -1
  9. package/esm/_virtual/react-is.development.js +1 -1
  10. package/esm/_virtual/react-is.production.min.js +1 -1
  11. package/esm/actions/Action.js +1 -1
  12. package/esm/actions/AjaxAction.js +39 -38
  13. package/esm/actions/BreakAction.js +1 -1
  14. package/esm/actions/BroadcastAction.js +1 -1
  15. package/esm/actions/CmptAction.js +1 -1
  16. package/esm/actions/ContinueAction.js +1 -1
  17. package/esm/actions/CopyAction.js +1 -1
  18. package/esm/actions/CustomAction.js +32 -6
  19. package/esm/actions/Decorators.js +1 -1
  20. package/esm/actions/DialogAction.js +1 -1
  21. package/esm/actions/DrawerAction.js +1 -1
  22. package/esm/actions/EmailAction.js +1 -1
  23. package/esm/actions/LinkAction.js +1 -1
  24. package/esm/actions/LoopAction.js +1 -1
  25. package/esm/actions/PageAction.js +1 -1
  26. package/esm/actions/ParallelAction.js +1 -1
  27. package/esm/actions/SwitchAction.js +1 -1
  28. package/esm/actions/ToastAction.js +1 -1
  29. package/esm/components/LazyComponent.js +1 -1
  30. package/esm/components/Overlay.d.ts +2 -0
  31. package/esm/components/Overlay.js +19 -2
  32. package/esm/components/PopOver.js +1 -1
  33. package/esm/env.js +1 -1
  34. package/esm/envOverwrite.js +1 -1
  35. package/esm/factory.d.ts +4 -1
  36. package/esm/factory.js +2 -2
  37. package/esm/index.d.ts +2 -2
  38. package/esm/index.js +107 -25
  39. package/esm/locale.js +3 -2
  40. package/esm/node_modules/@restart/hooks/esm/useCommittedRef.js +1 -1
  41. package/esm/node_modules/@restart/hooks/esm/useEventCallback.js +1 -1
  42. package/esm/node_modules/dom-helpers/esm/addEventListener.js +1 -1
  43. package/esm/node_modules/dom-helpers/esm/canUseDOM.js +1 -1
  44. package/esm/node_modules/dom-helpers/esm/contains.js +1 -1
  45. package/esm/node_modules/dom-helpers/esm/listen.js +1 -1
  46. package/esm/node_modules/dom-helpers/esm/ownerDocument.js +1 -1
  47. package/esm/node_modules/dom-helpers/esm/removeEventListener.js +1 -1
  48. package/esm/node_modules/object-assign/index.js +1 -1
  49. package/esm/node_modules/prop-types/checkPropTypes.js +1 -1
  50. package/esm/node_modules/prop-types/factoryWithThrowingShims.js +1 -1
  51. package/esm/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
  52. package/esm/node_modules/prop-types/index.js +1 -1
  53. package/esm/node_modules/prop-types/lib/ReactPropTypesSecret.js +1 -1
  54. package/esm/node_modules/prop-types/lib/has.js +1 -1
  55. package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +1 -1
  56. package/esm/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +1 -1
  57. package/esm/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  58. package/esm/node_modules/react-overlays/esm/Portal.js +1 -1
  59. package/esm/node_modules/react-overlays/esm/ownerDocument.js +1 -1
  60. package/esm/node_modules/react-overlays/esm/safeFindDOMNode.js +1 -1
  61. package/esm/node_modules/react-overlays/esm/useRootClose.js +1 -1
  62. package/esm/node_modules/react-overlays/esm/useWaitForDOMRef.js +1 -1
  63. package/esm/node_modules/warning/warning.js +1 -1
  64. package/esm/renderers/Form.d.ts +32 -2
  65. package/esm/renderers/Form.js +28 -10
  66. package/esm/renderers/Item.d.ts +127 -0
  67. package/esm/renderers/Item.js +8 -6
  68. package/esm/renderers/Options.d.ts +8 -0
  69. package/esm/renderers/Options.js +67 -39
  70. package/esm/renderers/Placeholder.js +1 -1
  71. package/esm/renderers/builtin.js +1 -1
  72. package/esm/renderers/wrapControl.js +11 -3
  73. package/esm/store/app.js +2 -2
  74. package/esm/store/combo.d.ts +24 -0
  75. package/esm/store/combo.js +1 -1
  76. package/esm/store/crud.d.ts +1 -0
  77. package/esm/store/crud.js +35 -20
  78. package/esm/store/form.d.ts +10 -0
  79. package/esm/store/form.js +48 -22
  80. package/esm/store/formItem.d.ts +1 -0
  81. package/esm/store/formItem.js +12 -5
  82. package/esm/store/iRenderer.js +1 -1
  83. package/esm/store/index.d.ts +2 -2
  84. package/esm/store/index.js +4 -4
  85. package/esm/store/list.js +1 -1
  86. package/esm/store/manager.js +1 -1
  87. package/esm/store/modal.js +1 -1
  88. package/esm/store/node.js +1 -1
  89. package/esm/store/pagination.js +1 -1
  90. package/esm/store/root.js +1 -1
  91. package/esm/store/service.js +11 -11
  92. package/esm/store/table.d.ts +30 -4
  93. package/esm/store/table.js +34 -25
  94. package/{lib/store/table-v2.d.ts → esm/store/table2.d.ts} +32 -32
  95. package/esm/store/{table-v2.js → table2.js} +17 -17
  96. package/esm/theme.js +1 -1
  97. package/esm/types.d.ts +3 -2
  98. package/esm/utils/Animation.js +1 -1
  99. package/esm/utils/ColorScale.js +1 -1
  100. package/esm/utils/DataSchema.js +1 -1
  101. package/esm/utils/DataScope.js +1 -1
  102. package/esm/utils/RootClose.js +1 -1
  103. package/esm/utils/SimpleMap.js +1 -1
  104. package/esm/utils/api.d.ts +7 -0
  105. package/esm/utils/api.js +49 -7
  106. package/esm/utils/attachmentAdpator.js +1 -1
  107. package/esm/utils/autobind.js +1 -1
  108. package/esm/utils/columnsSplit.js +1 -1
  109. package/esm/utils/dataMapping.d.ts +6 -0
  110. package/esm/utils/dataMapping.js +16 -2
  111. package/esm/utils/date.js +1 -1
  112. package/esm/utils/debug.js +1 -1
  113. package/esm/utils/dom.js +1 -1
  114. package/esm/utils/errors.js +1 -1
  115. package/esm/utils/escapeHtml.js +1 -1
  116. package/esm/utils/filter-schema.js +1 -1
  117. package/esm/utils/filter.js +1 -1
  118. package/esm/utils/formatDuration.js +1 -1
  119. package/esm/utils/formula.js +1 -1
  120. package/esm/utils/getVariable.js +1 -1
  121. package/esm/utils/grammar.js +1 -1
  122. package/esm/utils/handleAction.js +1 -1
  123. package/esm/utils/helper.d.ts +30 -4
  124. package/esm/utils/helper.js +45 -14
  125. package/esm/utils/highlight.js +1 -1
  126. package/esm/utils/icon.js +1 -1
  127. package/esm/utils/image.js +1 -1
  128. package/esm/utils/index.d.ts +1 -0
  129. package/esm/utils/isPureVariable.js +1 -1
  130. package/esm/utils/json-schema-2-amis-schema.js +1 -1
  131. package/esm/utils/keyToPath.js +1 -1
  132. package/esm/utils/makeSorter.js +1 -1
  133. package/esm/utils/normalizeLink.js +1 -1
  134. package/esm/utils/normalizeOptions.js +1 -1
  135. package/esm/utils/object.js +1 -1
  136. package/esm/utils/offset.js +1 -1
  137. package/esm/utils/offsetParent.js +1 -1
  138. package/esm/utils/optionValueCompare.js +1 -1
  139. package/esm/utils/position.d.ts +1 -1
  140. package/esm/utils/position.js +9 -1
  141. package/esm/utils/prettyBytes.js +1 -1
  142. package/esm/utils/renderer-event.js +1 -1
  143. package/esm/utils/replaceText.js +1 -1
  144. package/esm/utils/resize-sensor.js +1 -1
  145. package/esm/utils/resolveVariable.d.ts +1 -1
  146. package/esm/utils/resolveVariable.js +3 -3
  147. package/esm/utils/resolveVariableAndFilter.js +1 -1
  148. package/esm/utils/scrollPosition.d.ts +1 -1
  149. package/esm/utils/scrollPosition.js +1 -1
  150. package/esm/utils/string2regExp.js +1 -1
  151. package/esm/utils/stripNumber.js +2 -2
  152. package/esm/utils/style.js +1 -1
  153. package/esm/utils/toNumber.d.ts +7 -0
  154. package/esm/utils/toNumber.js +18 -0
  155. package/esm/utils/tokenize.js +1 -1
  156. package/esm/utils/tpl-builtin.d.ts +2 -2
  157. package/esm/utils/tpl-builtin.js +1 -1
  158. package/esm/utils/tpl-lodash.js +1 -1
  159. package/esm/utils/tpl.js +2 -2
  160. package/esm/utils/uncontrollable.js +1 -1
  161. package/esm/utils/validations.d.ts +1 -1
  162. package/esm/utils/validations.js +60 -3
  163. package/lib/Root.js +1 -1
  164. package/lib/RootRenderer.js +1 -1
  165. package/lib/SchemaRenderer.js +2 -2
  166. package/lib/Scoped.js +1 -1
  167. package/lib/WithRootStore.js +1 -1
  168. package/lib/WithStore.js +1 -1
  169. package/lib/_virtual/index.js +1 -1
  170. package/lib/_virtual/index2.js +1 -1
  171. package/lib/_virtual/react-is.development.js +1 -1
  172. package/lib/_virtual/react-is.production.min.js +1 -1
  173. package/lib/actions/Action.js +1 -1
  174. package/lib/actions/AjaxAction.js +38 -37
  175. package/lib/actions/BreakAction.js +1 -1
  176. package/lib/actions/BroadcastAction.js +1 -1
  177. package/lib/actions/CmptAction.js +1 -1
  178. package/lib/actions/ContinueAction.js +1 -1
  179. package/lib/actions/CopyAction.js +1 -1
  180. package/lib/actions/CustomAction.js +32 -6
  181. package/lib/actions/Decorators.js +1 -1
  182. package/lib/actions/DialogAction.js +1 -1
  183. package/lib/actions/DrawerAction.js +1 -1
  184. package/lib/actions/EmailAction.js +1 -1
  185. package/lib/actions/LinkAction.js +1 -1
  186. package/lib/actions/LoopAction.js +1 -1
  187. package/lib/actions/PageAction.js +1 -1
  188. package/lib/actions/ParallelAction.js +1 -1
  189. package/lib/actions/SwitchAction.js +1 -1
  190. package/lib/actions/ToastAction.js +1 -1
  191. package/lib/components/LazyComponent.js +1 -1
  192. package/lib/components/Overlay.d.ts +2 -0
  193. package/lib/components/Overlay.js +19 -2
  194. package/lib/components/PopOver.js +1 -1
  195. package/lib/env.js +1 -1
  196. package/lib/envOverwrite.js +1 -1
  197. package/lib/factory.d.ts +4 -1
  198. package/lib/factory.js +2 -1
  199. package/lib/index.d.ts +2 -2
  200. package/lib/index.js +191 -113
  201. package/lib/locale.js +3 -2
  202. package/lib/node_modules/@restart/hooks/esm/useCommittedRef.js +1 -1
  203. package/lib/node_modules/@restart/hooks/esm/useEventCallback.js +1 -1
  204. package/lib/node_modules/dom-helpers/esm/addEventListener.js +1 -1
  205. package/lib/node_modules/dom-helpers/esm/canUseDOM.js +1 -1
  206. package/lib/node_modules/dom-helpers/esm/contains.js +1 -1
  207. package/lib/node_modules/dom-helpers/esm/listen.js +1 -1
  208. package/lib/node_modules/dom-helpers/esm/ownerDocument.js +1 -1
  209. package/lib/node_modules/dom-helpers/esm/removeEventListener.js +1 -1
  210. package/lib/node_modules/object-assign/index.js +1 -1
  211. package/lib/node_modules/prop-types/checkPropTypes.js +1 -1
  212. package/lib/node_modules/prop-types/factoryWithThrowingShims.js +1 -1
  213. package/lib/node_modules/prop-types/factoryWithTypeCheckers.js +1 -1
  214. package/lib/node_modules/prop-types/index.js +1 -1
  215. package/lib/node_modules/prop-types/lib/ReactPropTypesSecret.js +1 -1
  216. package/lib/node_modules/prop-types/lib/has.js +1 -1
  217. package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +1 -1
  218. package/lib/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +1 -1
  219. package/lib/node_modules/prop-types/node_modules/react-is/index.js +1 -1
  220. package/lib/node_modules/react-overlays/esm/Portal.js +1 -1
  221. package/lib/node_modules/react-overlays/esm/ownerDocument.js +1 -1
  222. package/lib/node_modules/react-overlays/esm/safeFindDOMNode.js +1 -1
  223. package/lib/node_modules/react-overlays/esm/useRootClose.js +1 -1
  224. package/lib/node_modules/react-overlays/esm/useWaitForDOMRef.js +1 -1
  225. package/lib/node_modules/warning/warning.js +1 -1
  226. package/lib/renderers/Form.d.ts +32 -2
  227. package/lib/renderers/Form.js +29 -10
  228. package/lib/renderers/Item.d.ts +127 -0
  229. package/lib/renderers/Item.js +7 -4
  230. package/lib/renderers/Options.d.ts +8 -0
  231. package/lib/renderers/Options.js +67 -40
  232. package/lib/renderers/Placeholder.js +1 -1
  233. package/lib/renderers/builtin.js +1 -1
  234. package/lib/renderers/wrapControl.js +11 -3
  235. package/lib/store/app.js +1 -1
  236. package/lib/store/combo.d.ts +24 -0
  237. package/lib/store/combo.js +1 -1
  238. package/lib/store/crud.d.ts +1 -0
  239. package/lib/store/crud.js +35 -20
  240. package/lib/store/form.d.ts +10 -0
  241. package/lib/store/form.js +49 -22
  242. package/lib/store/formItem.d.ts +1 -0
  243. package/lib/store/formItem.js +13 -6
  244. package/lib/store/iRenderer.js +1 -1
  245. package/lib/store/index.d.ts +2 -2
  246. package/lib/store/index.js +4 -4
  247. package/lib/store/list.js +1 -1
  248. package/lib/store/manager.js +1 -1
  249. package/lib/store/modal.js +1 -1
  250. package/lib/store/node.js +1 -1
  251. package/lib/store/pagination.js +1 -1
  252. package/lib/store/root.js +1 -1
  253. package/lib/store/service.js +11 -11
  254. package/lib/store/table.d.ts +30 -4
  255. package/lib/store/table.js +33 -24
  256. package/{esm/store/table-v2.d.ts → lib/store/table2.d.ts} +32 -32
  257. package/lib/store/{table-v2.js → table2.js} +16 -16
  258. package/lib/theme.js +1 -1
  259. package/lib/types.d.ts +3 -2
  260. package/lib/utils/Animation.js +1 -1
  261. package/lib/utils/ColorScale.js +1 -1
  262. package/lib/utils/DataSchema.js +1 -1
  263. package/lib/utils/DataScope.js +1 -1
  264. package/lib/utils/RootClose.js +1 -1
  265. package/lib/utils/SimpleMap.js +1 -1
  266. package/lib/utils/api.d.ts +7 -0
  267. package/lib/utils/api.js +50 -6
  268. package/lib/utils/attachmentAdpator.js +1 -1
  269. package/lib/utils/autobind.js +1 -1
  270. package/lib/utils/columnsSplit.js +1 -1
  271. package/lib/utils/dataMapping.d.ts +6 -0
  272. package/lib/utils/dataMapping.js +16 -1
  273. package/lib/utils/date.js +1 -1
  274. package/lib/utils/debug.js +1 -1
  275. package/lib/utils/dom.js +1 -1
  276. package/lib/utils/errors.js +1 -1
  277. package/lib/utils/escapeHtml.js +1 -1
  278. package/lib/utils/filter-schema.js +1 -1
  279. package/lib/utils/filter.js +1 -1
  280. package/lib/utils/formatDuration.js +1 -1
  281. package/lib/utils/formula.js +1 -1
  282. package/lib/utils/getVariable.js +1 -1
  283. package/lib/utils/grammar.js +1 -1
  284. package/lib/utils/handleAction.js +1 -1
  285. package/lib/utils/helper.d.ts +30 -4
  286. package/lib/utils/helper.js +44 -12
  287. package/lib/utils/highlight.js +1 -1
  288. package/lib/utils/icon.js +1 -1
  289. package/lib/utils/image.js +1 -1
  290. package/lib/utils/index.d.ts +1 -0
  291. package/lib/utils/isPureVariable.js +1 -1
  292. package/lib/utils/json-schema-2-amis-schema.js +1 -1
  293. package/lib/utils/keyToPath.js +1 -1
  294. package/lib/utils/makeSorter.js +1 -1
  295. package/lib/utils/normalizeLink.js +1 -1
  296. package/lib/utils/normalizeOptions.js +1 -1
  297. package/lib/utils/object.js +1 -1
  298. package/lib/utils/offset.js +1 -1
  299. package/lib/utils/offsetParent.js +1 -1
  300. package/lib/utils/optionValueCompare.js +1 -1
  301. package/lib/utils/position.d.ts +1 -1
  302. package/lib/utils/position.js +9 -1
  303. package/lib/utils/prettyBytes.js +1 -1
  304. package/lib/utils/renderer-event.js +1 -1
  305. package/lib/utils/replaceText.js +1 -1
  306. package/lib/utils/resize-sensor.js +1 -1
  307. package/lib/utils/resolveVariable.d.ts +1 -1
  308. package/lib/utils/resolveVariable.js +3 -3
  309. package/lib/utils/resolveVariableAndFilter.js +1 -1
  310. package/lib/utils/scrollPosition.d.ts +1 -1
  311. package/lib/utils/scrollPosition.js +1 -1
  312. package/lib/utils/string2regExp.js +1 -1
  313. package/lib/utils/stripNumber.js +2 -2
  314. package/lib/utils/style.js +1 -1
  315. package/lib/utils/toNumber.d.ts +7 -0
  316. package/lib/utils/toNumber.js +22 -0
  317. package/lib/utils/tokenize.js +1 -1
  318. package/lib/utils/tpl-builtin.d.ts +2 -2
  319. package/lib/utils/tpl-builtin.js +1 -1
  320. package/lib/utils/tpl-lodash.js +1 -1
  321. package/lib/utils/tpl.js +1 -1
  322. package/lib/utils/uncontrollable.js +1 -1
  323. package/lib/utils/validations.d.ts +1 -1
  324. package/lib/utils/validations.js +61 -3
  325. package/package.json +9 -8
  326. package/esm/index2.js +0 -134
  327. package/lib/index2.js +0 -330
package/esm/index.js CHANGED
@@ -1,49 +1,55 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
6
- export { classPrefix, render } from './index2.js';
7
- export { FormItem, FormItemWrap, registerFormItem } from './renderers/Item.js';
8
- export { buildApi, clearApiCache, getApiCache, isApiOutdated, isEffectiveApi, isSameApi, isValidApi, jsonpFetcher, normalizeApi, normalizeApiResponseData, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher } from './utils/api.js';
6
+ import { __assign } from 'tslib';
7
+ import { stores, defaultOptions } from './factory.js';
8
+ export { Renderer, addSchemaFilter, clearStoresCache, extendDefaultEnv, filterSchema, getRendererByName, getRenderers, registerRenderer, resolveRenderer, unRegisterRenderer, updateEnv } from './factory.js';
9
+ import './renderers/builtin.js';
10
+ import { wrapFetcher } from './utils/api.js';
11
+ export { buildApi, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher } from './utils/api.js';
9
12
  export { attachmentAdpator } from './utils/attachmentAdpator.js';
10
13
  export { autobindMethod, bind } from './utils/autobind.js';
11
14
  export { ColorScale } from './utils/ColorScale.js';
12
15
  export { columnsSplit } from './utils/columnsSplit.js';
13
- export { dataMapping, resolveMapping } from './utils/dataMapping.js';
16
+ export { dataMapping, resolveMapping, resolveMappingObject } from './utils/dataMapping.js';
14
17
  export { DataSchema } from './utils/DataSchema.js';
15
18
  export { DataScope } from './utils/DataScope.js';
16
19
  export { filterDate, parseDuration, relativeValueRe } from './utils/date.js';
20
+ import { enableDebug } from './utils/debug.js';
17
21
  export { DebugWrapper, debug, enableDebug, warning } from './utils/debug.js';
18
22
  export { calculatePosition, getContainer, getStyleNumber, ownerDocument } from './utils/dom.js';
19
23
  export { ServerError } from './utils/errors.js';
20
24
  export { escapeHtml } from './utils/escapeHtml.js';
21
25
  export { getExprProperties } from './utils/filter-schema.js';
26
+ import './utils/filter.js';
22
27
  export { formatDuration } from './utils/formatDuration.js';
23
28
  export { FormulaExec, formulaExec, isExpression, isNeedFormula, registerFormulaExec, replaceExpression } from './utils/formula.js';
24
29
  export { getVariable } from './utils/getVariable.js';
25
30
  export { collectVariables } from './utils/grammar.js';
26
31
  export { handleAction } from './utils/handleAction.js';
27
- export { cloneObject, createObject, deleteVariable, extendObject, isObject, pickValues, setVariable } from './utils/object.js';
28
- export { string2regExp } from './utils/string2regExp.js';
29
- export { keyToPath } from './utils/keyToPath.js';
32
+ import { promisify } from './utils/helper.js';
30
33
  import * as helper from './utils/helper.js';
31
34
  export { helper as utils };
32
- export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeIndex, flattenTree, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
35
+ export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter } from './utils/helper.js';
33
36
  export { highlight } from './utils/highlight.js';
34
37
  export { generateIcon } from './utils/icon.js';
35
38
  export { getImageDimensions, toDataURL } from './utils/image.js';
36
39
  export { isPureVariable } from './utils/isPureVariable.js';
37
40
  export { JSONSchme2AMisSchema } from './utils/json-schema-2-amis-schema.js';
41
+ export { keyToPath } from './utils/keyToPath.js';
38
42
  export { makeSorter } from './utils/makeSorter.js';
39
43
  export { normalizeLink } from './utils/normalizeLink.js';
40
44
  export { normalizeOptions } from './utils/normalizeOptions.js';
45
+ export { cloneObject, createObject, deleteVariable, extendObject, isObject, pickValues, setVariable } from './utils/object.js';
41
46
  export { offset } from './utils/offset.js';
42
47
  export { offsetParent } from './utils/offsetParent.js';
43
48
  export { matchOptionValue, optionValueCompare } from './utils/optionValueCompare.js';
44
49
  export { position } from './utils/position.js';
45
50
  export { prettyBytes } from './utils/prettyBytes.js';
46
51
  export { bindEvent, createRendererEvent, dispatchEvent, getRendererEventListeners } from './utils/renderer-event.js';
52
+ import { replaceText } from './utils/replaceText.js';
47
53
  export { replaceText } from './utils/replaceText.js';
48
54
  export { getComputedStyle, resizeSensor } from './utils/resize-sensor.js';
49
55
  export { resolveVariable } from './utils/resolveVariable.js';
@@ -51,39 +57,115 @@ export { resolveVariableAndFilter } from './utils/resolveVariableAndFilter.js';
51
57
  export { RootClose } from './utils/RootClose.js';
52
58
  export { scrollPosition } from './utils/scrollPosition.js';
53
59
  export { SimpleMap } from './utils/SimpleMap.js';
60
+ export { string2regExp } from './utils/string2regExp.js';
54
61
  export { buildStyle } from './utils/style.js';
55
62
  export { tokenize } from './utils/tokenize.js';
56
- export { Evaluator, evaluate, extendsFilters, filters, getFilters, lexer, parse, registerFilter } from 'amis-formula';
57
- export { stripNumber } from './utils/stripNumber.js';
58
63
  export { register } from './utils/tpl-builtin.js';
59
64
  export { evalExpression, evalJS, filter, registerTplEnginer, setCustomEvalExpression, setCustomEvalJs } from './utils/tpl.js';
60
65
  export { uncontrollable } from './utils/uncontrollable.js';
61
66
  export { addRule, str2rules, validate, validateMessages, validateObject, validations } from './utils/validations.js';
67
+ export { toNumber } from './utils/toNumber.js';
62
68
  export { default as animation } from './utils/Animation.js';
69
+ import { RendererStore } from './store/index.js';
63
70
  export { RegisterStore, RendererStore } from './store/index.js';
71
+ import { getEnv } from 'mobx-state-tree';
72
+ import { getDefaultLocale, makeTranslator } from './locale.js';
73
+ export { extendLocale, getDefaultLocale, localeable, makeTranslator, register as registerLocale, setDefaultLocale } from './locale.js';
74
+ export { HocScoped as Scoped, ScopedContext } from './Scoped.js';
75
+ import { getClassPrefix, getTheme } from './theme.js';
76
+ export { classnames, getClassPrefix, getTheme, makeClassnames, setDefaultTheme, theme, themeable } from './theme.js';
77
+ import './actions/LoopAction.js';
78
+ import './actions/BreakAction.js';
79
+ import './actions/ContinueAction.js';
80
+ import './actions/SwitchAction.js';
81
+ import './actions/ParallelAction.js';
82
+ import './actions/CustomAction.js';
83
+ import './actions/BroadcastAction.js';
84
+ import './actions/CmptAction.js';
85
+ import './actions/AjaxAction.js';
86
+ import './actions/CopyAction.js';
87
+ import './actions/DialogAction.js';
88
+ import './actions/DrawerAction.js';
89
+ import './actions/EmailAction.js';
90
+ import './actions/LinkAction.js';
91
+ import './actions/ToastAction.js';
92
+ import './actions/PageAction.js';
93
+ export { bindRendererEvent, rendererEventDispatcher } from './actions/Decorators.js';
94
+ export { LoopStatus, getActionByType, registerAction, runAction, runActions } from './actions/Action.js';
95
+ export { FormItem, FormItemWrap, getFormItemByName, registerFormItem } from './renderers/Item.js';
96
+ export { OptionsControl, registerOptionsControl } from './renderers/Options.js';
97
+ import ScopedRootRenderer from './Root.js';
98
+ export { addRootWrapper } from './Root.js';
99
+ import { envOverwrite } from './envOverwrite.js';
100
+ import { EnvContext } from './env.js';
101
+ export { EnvContext } from './env.js';
102
+ import React from 'react';
103
+ export { Evaluator, evaluate, extendsFilters, filters, getFilters, lexer, parse, registerFilter } from 'amis-formula';
104
+ export { default as LazyComponent } from './components/LazyComponent.js';
105
+ export { default as Overlay } from './components/Overlay.js';
106
+ export { default as PopOver } from './components/PopOver.js';
107
+ export { FormRenderer } from './renderers/Form.js';
108
+ export { stripNumber } from './utils/stripNumber.js';
64
109
  export { iRendererStore } from './store/iRenderer.js';
65
110
  export { ServiceStore } from './store/service.js';
66
111
  export { FormStore } from './store/form.js';
67
112
  export { ComboStore } from './store/combo.js';
68
113
  export { CRUDStore } from './store/crud.js';
69
114
  export { TableStore } from './store/table.js';
70
- export { TableStoreV2 } from './store/table-v2.js';
115
+ export { TableStore2 } from './store/table2.js';
71
116
  export { ListStore } from './store/list.js';
72
117
  export { ModalStore } from './store/modal.js';
73
118
  export { FormItemStore } from './store/formItem.js';
74
119
  export { PaginationStore } from './store/pagination.js';
75
120
  export { AppStore } from './store/app.js';
76
121
  export { StoreNode } from './store/node.js';
77
- export { bindRendererEvent, rendererEventDispatcher } from './actions/Decorators.js';
78
- export { LoopStatus, getActionByType, registerAction, runAction, runActions } from './actions/Action.js';
79
- export { Renderer, addSchemaFilter, clearStoresCache, extendDefaultEnv, filterSchema, getRendererByName, getRenderers, registerRenderer, resolveRenderer, unRegisterRenderer, updateEnv } from './factory.js';
80
- export { EnvContext } from './env.js';
81
- export { OptionsControl, registerOptionsControl } from './renderers/Options.js';
82
- export { FormRenderer } from './renderers/Form.js';
83
- export { HocScoped as Scoped, ScopedContext } from './Scoped.js';
84
- export { classnames, getClassPrefix, getTheme, makeClassnames, setDefaultTheme, theme, themeable } from './theme.js';
85
- export { extendLocale, getDefaultLocale, localeable, makeTranslator, register as registerLocale, setDefaultLocale } from './locale.js';
86
- export { default as LazyComponent } from './components/LazyComponent.js';
87
- export { default as Overlay } from './components/Overlay.js';
88
- export { default as PopOver } from './components/PopOver.js';
89
- export { addRootWrapper } from './Root.js';
122
+
123
+ var classPrefix = getClassPrefix();
124
+ function render(schema, props, options, pathPrefix) {
125
+ if (props === void 0) { props = {}; }
126
+ if (options === void 0) { options = {}; }
127
+ if (pathPrefix === void 0) { pathPrefix = ''; }
128
+ var locale = props.locale || getDefaultLocale();
129
+ // 兼容 locale 的不同写法
130
+ locale = locale.replace('_', '-');
131
+ locale = locale === 'en' ? 'en-US' : locale;
132
+ locale = locale === 'zh' ? 'zh-CN' : locale;
133
+ locale = locale === 'cn' ? 'zh-CN' : locale;
134
+ var translate = props.translate || makeTranslator(locale);
135
+ var store = stores[options.session || 'global'];
136
+ // 根据环境覆盖 schema,这个要在最前面做,不然就无法覆盖 validations
137
+ envOverwrite(schema, locale);
138
+ if (!store) {
139
+ options = __assign(__assign(__assign({}, defaultOptions), options), { fetcher: options.fetcher
140
+ ? wrapFetcher(options.fetcher, options.tracker)
141
+ : defaultOptions.fetcher, confirm: promisify(options.confirm || defaultOptions.confirm || window.confirm), locale: locale, translate: translate });
142
+ if (options.enableAMISDebug) {
143
+ // 因为里面还有 render
144
+ setTimeout(function () {
145
+ enableDebug();
146
+ }, 10);
147
+ }
148
+ store = RendererStore.create({}, options);
149
+ stores[options.session || 'global'] = store;
150
+ }
151
+ window.amisStore = store; // 为了方便 debug.
152
+ var env = getEnv(store);
153
+ var theme = props.theme || options.theme || 'cxd';
154
+ if (theme === 'default') {
155
+ theme = 'cxd';
156
+ }
157
+ env.theme = getTheme(theme);
158
+ if (props.locale !== undefined) {
159
+ env.translate = translate;
160
+ env.locale = locale;
161
+ }
162
+ // 默认将开启移动端原生 UI
163
+ if (typeof options.useMobileUI) {
164
+ props.useMobileUI = true;
165
+ }
166
+ replaceText(schema, env.replaceText, env.replaceTextIgnoreKeys);
167
+ return (React.createElement(EnvContext.Provider, { value: env },
168
+ React.createElement(ScopedRootRenderer, __assign({}, props, { schema: schema, pathPrefix: pathPrefix, rootStore: store, env: env, theme: theme, locale: locale, translate: translate }))));
169
+ }
170
+
171
+ export { classPrefix, render };
package/esm/locale.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -15,7 +15,8 @@ import './utils/filter.js';
15
15
  var defaultLocale = 'zh-CN';
16
16
  var locales = {};
17
17
  function register(name, config) {
18
- locales[name] = config;
18
+ // 修改为扩展,防止已注册的语料被覆盖
19
+ extendLocale(name, config);
19
20
  }
20
21
  function extendLocale(name, config) {
21
22
  locales[name] = __assign(__assign({}, (locales[name] || {})), config);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
@@ -40,6 +40,35 @@ export interface FormSchemaBase {
40
40
  * 是否开启调试,开启后会在顶部实时显示表单项数据。
41
41
  */
42
42
  debug?: boolean;
43
+ /**
44
+ * Debug面板配置
45
+ */
46
+ debugConfig?: {
47
+ /**
48
+ * 默认展开的级别
49
+ */
50
+ levelExpand?: number;
51
+ /**
52
+ * 是否可复制
53
+ */
54
+ enableClipboard?: boolean;
55
+ /**
56
+ * 图标风格
57
+ */
58
+ iconStyle?: 'square' | 'circle' | 'triangle';
59
+ /**
60
+ * 是否显示键的引号
61
+ */
62
+ quotesOnKeys?: boolean;
63
+ /**
64
+ * 是否为键排序
65
+ */
66
+ sortKeys?: boolean;
67
+ /**
68
+ * 设置字符串的最大展示长度,超出长度阈值的字符串将被截断,点击value可切换字符串展示方式,默认为120
69
+ */
70
+ ellipsisThreshold?: number | false;
71
+ };
43
72
  /**
44
73
  * 用来初始化表单数据
45
74
  */
@@ -220,7 +249,7 @@ export interface FormProps extends RendererProps, Omit<FormSchemaBase, 'mode' |
220
249
  lazyLoad?: boolean;
221
250
  simpleMode?: boolean;
222
251
  onInit?: (values: object, props: any) => any;
223
- onReset?: (values: object) => void;
252
+ onReset?: (values: object, action?: any) => void;
224
253
  onSubmit?: (values: object, action: any) => any;
225
254
  onChange?: (values: object, diff: object, props: any) => any;
226
255
  onFailed?: (reason: string, errors: any) => any;
@@ -304,7 +333,8 @@ export default class Form extends React.Component<FormProps, object> {
304
333
  formItemDispatchEvent(dispatchEvent: any): (type: string, data: any) => void;
305
334
  emitChange(submit: boolean): Promise<void>;
306
335
  handleBulkChange(values: Object, submit: boolean): void;
307
- handleFormSubmit(e: React.UIEvent<any>): false | Promise<any>;
336
+ handleFormSubmit(e: React.UIEvent<any>): any;
337
+ handleReset(action: any): (data: any) => void;
308
338
  handleAction(e: React.UIEvent<any> | void, action: ActionObject, data: object, throwErrors?: boolean, delegate?: IScopedContext): Promise<any>;
309
339
  handleQuery(query: any): void;
310
340
  handleDialogConfirm(values: object[], action: ActionObject, ctx: any, targets: Array<any>): void;
@@ -1,10 +1,11 @@
1
1
  /**
2
- * amis-core v2.0.2
2
+ * amis-core v2.2.0
3
3
  * Copyright 2018-2022 fex
4
4
  */
5
5
 
6
6
  import { __extends, __awaiter, __generator, __assign, __decorate, __metadata } from 'tslib';
7
7
  import React from 'react';
8
+ import extend from 'lodash/extend';
8
9
  import { Renderer } from '../factory.js';
9
10
  import { FormStore } from '../store/form.js';
10
11
  import { evalExpression, filter } from '../utils/tpl.js';
@@ -414,14 +415,23 @@ var Form = /** @class */ (function (_super) {
414
415
  (formLazyChange === false ? this.emitChange : this.lazyEmitChange)(submit);
415
416
  };
416
417
  Form.prototype.handleFormSubmit = function (e) {
417
- var preventEnterSubmit = this.props.preventEnterSubmit;
418
+ var _a = this.props, preventEnterSubmit = _a.preventEnterSubmit, onActionSensor = _a.onActionSensor;
418
419
  e.preventDefault();
419
420
  if (preventEnterSubmit) {
420
421
  return false;
421
422
  }
422
- return this.handleAction(e, {
423
+ var sensor = this.handleAction(e, {
423
424
  type: 'submit'
424
425
  }, this.props.store.data);
426
+ // 让外层可以监控这个动作执行结果
427
+ onActionSensor === null || onActionSensor === void 0 ? void 0 : onActionSensor(sensor);
428
+ return sensor;
429
+ };
430
+ Form.prototype.handleReset = function (action) {
431
+ var onReset = this.props.onReset;
432
+ return function (data) {
433
+ onReset && onReset(data, action);
434
+ };
425
435
  };
426
436
  Form.prototype.handleAction = function (e, action, data, throwErrors, delegate) {
427
437
  if (throwErrors === void 0) { throwErrors = false; }
@@ -472,10 +482,10 @@ var Form = /** @class */ (function (_super) {
472
482
  action.actionType === 'clear-and-submit') {
473
483
  store.setCurrentAction(action);
474
484
  if (action.actionType === 'reset-and-submit') {
475
- store.reset(onReset);
485
+ store.reset(this.handleReset(action));
476
486
  }
477
487
  else if (action.actionType === 'clear-and-submit') {
478
- store.clear(onReset);
488
+ store.clear(this.handleReset(action));
479
489
  }
480
490
  return [2 /*return*/, this.submit(function (values) {
481
491
  var _a;
@@ -582,8 +592,8 @@ var Form = /** @class */ (function (_super) {
582
592
  if (onFinished && onFinished(values, action) === false) {
583
593
  return values;
584
594
  }
585
- resetAfterSubmit && store.reset(onReset);
586
- clearAfterSubmit && store.clear(onReset);
595
+ resetAfterSubmit && store.reset(_this.handleReset(action));
596
+ clearAfterSubmit && store.clear(_this.handleReset(action));
587
597
  clearPersistDataAfterSubmit && store.clearLocalPersistData();
588
598
  if (action.redirect || redirect) {
589
599
  var finalRedirect = filter(action.redirect || redirect, store.data);
@@ -880,7 +890,7 @@ var Form = /** @class */ (function (_super) {
880
890
  return render("".concat(region ? "".concat(region, "/") : '').concat(key), subSchema, subProps);
881
891
  };
882
892
  Form.prototype.renderBody = function () {
883
- var _a = this.props, body = _a.body, mode = _a.mode, className = _a.className, cx = _a.classnames, debug = _a.debug, $path = _a.$path, store = _a.store, columnCount = _a.columnCount, render = _a.render;
893
+ 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;
884
894
  var restError = store.restError;
885
895
  var WrapperComponent = this.props.wrapperComponent ||
886
896
  (/(?:\/|^)form\//.test($path) ? 'div' : 'form');
@@ -889,8 +899,16 @@ var Form = /** @class */ (function (_super) {
889
899
  : 0, function (index) { return (React.createElement("div", { className: cx("Form-item Form-item--".concat(mode, " is-placeholder")), key: index })); });
890
900
  return (React.createElement(WrapperComponent, { className: cx("Form", "Form--".concat(mode || 'normal'), columnCount ? "Form--column Form--column-".concat(columnCount) : null, className), onSubmit: this.handleFormSubmit, noValidate: true },
891
901
  React.createElement("input", { type: "submit", style: { display: 'none' } }),
892
- debug ? (React.createElement("pre", null,
893
- React.createElement("code", { className: cx('Form--debug') }, JSON.stringify(store.data, null, 2)))) : null,
902
+ debug
903
+ ? render('form-debug-json', extend({
904
+ type: 'json',
905
+ value: store.data,
906
+ ellipsisThreshold: 120,
907
+ className: cx('Form--debug')
908
+ },
909
+ /** 定制debug输出格式 */
910
+ isObject(debugConfig) ? debugConfig : {}))
911
+ : null,
894
912
  render('spinner', { type: 'spinner' }, {
895
913
  overlay: true,
896
914
  show: store.loading