amis-core 2.6.0 → 2.7.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 (451) hide show
  1. package/package.json +2 -2
  2. package/esm/Root.d.ts +0 -46
  3. package/esm/Root.js +0 -89
  4. package/esm/RootRenderer.d.ts +0 -27
  5. package/esm/RootRenderer.js +0 -279
  6. package/esm/SchemaRenderer.d.ts +0 -37
  7. package/esm/SchemaRenderer.js +0 -332
  8. package/esm/Scoped.d.ts +0 -38
  9. package/esm/Scoped.js +0 -262
  10. package/esm/WithRootStore.d.ts +0 -719
  11. package/esm/WithRootStore.js +0 -34
  12. package/esm/WithStore.d.ts +0 -5
  13. package/esm/WithStore.js +0 -181
  14. package/esm/actions/Action.d.ts +0 -40
  15. package/esm/actions/Action.js +0 -186
  16. package/esm/actions/AjaxAction.d.ts +0 -27
  17. package/esm/actions/AjaxAction.js +0 -96
  18. package/esm/actions/BreakAction.d.ts +0 -15
  19. package/esm/actions/BreakAction.js +0 -31
  20. package/esm/actions/BroadcastAction.d.ts +0 -19
  21. package/esm/actions/BroadcastAction.js +0 -46
  22. package/esm/actions/CmptAction.d.ts +0 -21
  23. package/esm/actions/CmptAction.js +0 -66
  24. package/esm/actions/ContinueAction.d.ts +0 -15
  25. package/esm/actions/ContinueAction.js +0 -31
  26. package/esm/actions/CopyAction.d.ts +0 -20
  27. package/esm/actions/CopyAction.js +0 -39
  28. package/esm/actions/CustomAction.d.ts +0 -22
  29. package/esm/actions/CustomAction.js +0 -74
  30. package/esm/actions/DialogAction.d.ts +0 -60
  31. package/esm/actions/DialogAction.js +0 -101
  32. package/esm/actions/DrawerAction.d.ts +0 -33
  33. package/esm/actions/DrawerAction.js +0 -65
  34. package/esm/actions/EmailAction.d.ts +0 -23
  35. package/esm/actions/EmailAction.js +0 -39
  36. package/esm/actions/LinkAction.d.ts +0 -24
  37. package/esm/actions/LinkAction.js +0 -43
  38. package/esm/actions/LoopAction.d.ts +0 -19
  39. package/esm/actions/LoopAction.js +0 -103
  40. package/esm/actions/PageAction.d.ts +0 -39
  41. package/esm/actions/PageAction.js +0 -74
  42. package/esm/actions/ParallelAction.d.ts +0 -8
  43. package/esm/actions/ParallelAction.js +0 -36
  44. package/esm/actions/SwitchAction.d.ts +0 -11
  45. package/esm/actions/SwitchAction.js +0 -48
  46. package/esm/actions/ToastAction.d.ts +0 -19
  47. package/esm/actions/ToastAction.js +0 -31
  48. package/esm/actions/index.d.ts +0 -20
  49. package/esm/components/LazyComponent.d.ts +0 -32
  50. package/esm/components/LazyComponent.js +0 -90
  51. package/esm/components/Overlay.d.ts +0 -44
  52. package/esm/components/Overlay.js +0 -255
  53. package/esm/components/PopOver.d.ts +0 -90
  54. package/esm/components/PopOver.js +0 -120
  55. package/esm/env.d.ts +0 -176
  56. package/esm/env.js +0 -12
  57. package/esm/envOverwrite.d.ts +0 -4
  58. package/esm/envOverwrite.js +0 -39
  59. package/esm/factory.d.ts +0 -85
  60. package/esm/factory.js +0 -301
  61. package/esm/index.d.ts +0 -44
  62. package/esm/index.js +0 -174
  63. package/esm/locale.d.ts +0 -84
  64. package/esm/locale.js +0 -117
  65. package/esm/renderers/Form.d.ts +0 -389
  66. package/esm/renderers/Form.js +0 -1221
  67. package/esm/renderers/Item.d.ts +0 -906
  68. package/esm/renderers/Item.js +0 -863
  69. package/esm/renderers/Options.d.ts +0 -158
  70. package/esm/renderers/Options.js +0 -908
  71. package/esm/renderers/Placeholder.d.ts +0 -6
  72. package/esm/renderers/Placeholder.js +0 -23
  73. package/esm/renderers/builtin.d.ts +0 -1
  74. package/esm/renderers/builtin.js +0 -25
  75. package/esm/renderers/register.d.ts +0 -6
  76. package/esm/renderers/register.js +0 -79
  77. package/esm/renderers/wrapControl.d.ts +0 -437
  78. package/esm/renderers/wrapControl.js +0 -509
  79. package/esm/store/app.d.ts +0 -92
  80. package/esm/store/app.js +0 -189
  81. package/esm/store/combo.d.ts +0 -10223
  82. package/esm/store/combo.js +0 -149
  83. package/esm/store/crud.d.ts +0 -128
  84. package/esm/store/crud.js +0 -447
  85. package/esm/store/form.d.ts +0 -4252
  86. package/esm/store/form.js +0 -650
  87. package/esm/store/formItem.d.ts +0 -133
  88. package/esm/store/formItem.js +0 -847
  89. package/esm/store/iRenderer.d.ts +0 -46
  90. package/esm/store/iRenderer.js +0 -185
  91. package/esm/store/index.d.ts +0 -125
  92. package/esm/store/index.js +0 -90
  93. package/esm/store/list.d.ts +0 -272
  94. package/esm/store/list.js +0 -246
  95. package/esm/store/manager.d.ts +0 -115
  96. package/esm/store/manager.js +0 -49
  97. package/esm/store/modal.d.ts +0 -84
  98. package/esm/store/modal.js +0 -50
  99. package/esm/store/node.d.ts +0 -22
  100. package/esm/store/node.js +0 -89
  101. package/esm/store/pagination.d.ts +0 -58
  102. package/esm/store/pagination.js +0 -56
  103. package/esm/store/root.d.ts +0 -85
  104. package/esm/store/root.js +0 -53
  105. package/esm/store/service.d.ts +0 -71
  106. package/esm/store/service.js +0 -411
  107. package/esm/store/table.d.ts +0 -10085
  108. package/esm/store/table.js +0 -1136
  109. package/esm/store/table2.d.ts +0 -474
  110. package/esm/store/table2.js +0 -560
  111. package/esm/theme.d.ts +0 -89
  112. package/esm/theme.js +0 -127
  113. package/esm/types.d.ts +0 -489
  114. package/esm/utils/Animation.d.ts +0 -22
  115. package/esm/utils/Animation.js +0 -285
  116. package/esm/utils/ColorScale.d.ts +0 -19
  117. package/esm/utils/ColorScale.js +0 -100
  118. package/esm/utils/DataSchema.d.ts +0 -25
  119. package/esm/utils/DataSchema.js +0 -112
  120. package/esm/utils/DataScope.d.ts +0 -26
  121. package/esm/utils/DataScope.js +0 -158
  122. package/esm/utils/RootClose.d.ts +0 -4
  123. package/esm/utils/RootClose.js +0 -22
  124. package/esm/utils/SimpleMap.d.ts +0 -8
  125. package/esm/utils/SimpleMap.js +0 -37
  126. package/esm/utils/api.d.ts +0 -34
  127. package/esm/utils/api.js +0 -595
  128. package/esm/utils/attachmentAdpator.d.ts +0 -8
  129. package/esm/utils/attachmentAdpator.js +0 -86
  130. package/esm/utils/autobind.d.ts +0 -7
  131. package/esm/utils/autobind.js +0 -89
  132. package/esm/utils/columnsSplit.d.ts +0 -1
  133. package/esm/utils/columnsSplit.js +0 -42
  134. package/esm/utils/dataMapping.d.ts +0 -9
  135. package/esm/utils/dataMapping.js +0 -141
  136. package/esm/utils/date.d.ts +0 -4
  137. package/esm/utils/date.js +0 -80
  138. package/esm/utils/debug.d.ts +0 -29
  139. package/esm/utils/debug.js +0 -379
  140. package/esm/utils/decodeEntity.d.ts +0 -5
  141. package/esm/utils/decodeEntity.js +0 -16
  142. package/esm/utils/dom.d.ts +0 -13
  143. package/esm/utils/dom.js +0 -188
  144. package/esm/utils/errors.d.ts +0 -6
  145. package/esm/utils/errors.js +0 -19
  146. package/esm/utils/escapeHtml.d.ts +0 -1
  147. package/esm/utils/escapeHtml.js +0 -20
  148. package/esm/utils/filter-schema.d.ts +0 -13
  149. package/esm/utils/filter-schema.js +0 -68
  150. package/esm/utils/filter.d.ts +0 -1
  151. package/esm/utils/filter.js +0 -493
  152. package/esm/utils/formatDuration.d.ts +0 -1
  153. package/esm/utils/formatDuration.js +0 -23
  154. package/esm/utils/formula.d.ts +0 -16
  155. package/esm/utils/formula.js +0 -219
  156. package/esm/utils/getVariable.d.ts +0 -3
  157. package/esm/utils/getVariable.js +0 -25
  158. package/esm/utils/grammar.d.ts +0 -4
  159. package/esm/utils/grammar.js +0 -50
  160. package/esm/utils/handleAction.d.ts +0 -7
  161. package/esm/utils/handleAction.js +0 -34
  162. package/esm/utils/helper.d.ts +0 -323
  163. package/esm/utils/helper.js +0 -1261
  164. package/esm/utils/highlight.d.ts +0 -1
  165. package/esm/utils/highlight.js +0 -44
  166. package/esm/utils/icon.d.ts +0 -16
  167. package/esm/utils/icon.js +0 -35
  168. package/esm/utils/image.d.ts +0 -18
  169. package/esm/utils/image.js +0 -47
  170. package/esm/utils/index.d.ts +0 -55
  171. package/esm/utils/isPureVariable.d.ts +0 -1
  172. package/esm/utils/isPureVariable.js +0 -22
  173. package/esm/utils/json-schema-2-amis-schema.d.ts +0 -6
  174. package/esm/utils/json-schema-2-amis-schema.js +0 -56
  175. package/esm/utils/keyToPath.d.ts +0 -6
  176. package/esm/utils/keyToPath.js +0 -30
  177. package/esm/utils/makeSorter.d.ts +0 -1
  178. package/esm/utils/makeSorter.js +0 -26
  179. package/esm/utils/normalizeLink.d.ts +0 -1
  180. package/esm/utils/normalizeLink.js +0 -43
  181. package/esm/utils/normalizeOptions.d.ts +0 -7
  182. package/esm/utils/normalizeOptions.js +0 -84
  183. package/esm/utils/object.d.ts +0 -15
  184. package/esm/utils/object.js +0 -142
  185. package/esm/utils/offset.d.ts +0 -15
  186. package/esm/utils/offset.js +0 -32
  187. package/esm/utils/offsetParent.d.ts +0 -5
  188. package/esm/utils/offsetParent.js +0 -23
  189. package/esm/utils/optionValueCompare.d.ts +0 -3
  190. package/esm/utils/optionValueCompare.js +0 -25
  191. package/esm/utils/position.d.ts +0 -26
  192. package/esm/utils/position.js +0 -54
  193. package/esm/utils/prettyBytes.d.ts +0 -1
  194. package/esm/utils/prettyBytes.js +0 -25
  195. package/esm/utils/renderer-event.d.ts +0 -62
  196. package/esm/utils/renderer-event.js +0 -206
  197. package/esm/utils/replaceText.d.ts +0 -3
  198. package/esm/utils/replaceText.js +0 -38
  199. package/esm/utils/resize-sensor.d.ts +0 -6
  200. package/esm/utils/resize-sensor.js +0 -172
  201. package/esm/utils/resolveVariable.d.ts +0 -1
  202. package/esm/utils/resolveVariable.js +0 -35
  203. package/esm/utils/resolveVariableAndFilter.d.ts +0 -1
  204. package/esm/utils/resolveVariableAndFilter.js +0 -33
  205. package/esm/utils/scrollPosition.d.ts +0 -16
  206. package/esm/utils/scrollPosition.js +0 -33
  207. package/esm/utils/string2regExp.d.ts +0 -1
  208. package/esm/utils/string2regExp.js +0 -14
  209. package/esm/utils/stripNumber.d.ts +0 -1
  210. package/esm/utils/stripNumber.js +0 -16
  211. package/esm/utils/style.d.ts +0 -10
  212. package/esm/utils/style.js +0 -58
  213. package/esm/utils/toNumber.d.ts +0 -7
  214. package/esm/utils/toNumber.js +0 -18
  215. package/esm/utils/tokenize.d.ts +0 -1
  216. package/esm/utils/tokenize.js +0 -29
  217. package/esm/utils/tpl-builtin.d.ts +0 -18
  218. package/esm/utils/tpl-builtin.js +0 -59
  219. package/esm/utils/tpl-lodash.d.ts +0 -4
  220. package/esm/utils/tpl-lodash.js +0 -62
  221. package/esm/utils/tpl.d.ts +0 -11
  222. package/esm/utils/tpl.js +0 -131
  223. package/esm/utils/uncontrollable.d.ts +0 -4
  224. package/esm/utils/uncontrollable.js +0 -14
  225. package/esm/utils/validations.d.ts +0 -39
  226. package/esm/utils/validations.js +0 -440
  227. package/lib/Root.d.ts +0 -46
  228. package/lib/Root.js +0 -102
  229. package/lib/RootRenderer.d.ts +0 -27
  230. package/lib/RootRenderer.js +0 -290
  231. package/lib/SchemaRenderer.d.ts +0 -37
  232. package/lib/SchemaRenderer.js +0 -342
  233. package/lib/Scoped.d.ts +0 -38
  234. package/lib/Scoped.js +0 -274
  235. package/lib/WithRootStore.d.ts +0 -719
  236. package/lib/WithRootStore.js +0 -44
  237. package/lib/WithStore.d.ts +0 -5
  238. package/lib/WithStore.js +0 -190
  239. package/lib/actions/Action.d.ts +0 -40
  240. package/lib/actions/Action.js +0 -197
  241. package/lib/actions/AjaxAction.d.ts +0 -27
  242. package/lib/actions/AjaxAction.js +0 -100
  243. package/lib/actions/BreakAction.d.ts +0 -15
  244. package/lib/actions/BreakAction.js +0 -35
  245. package/lib/actions/BroadcastAction.d.ts +0 -19
  246. package/lib/actions/BroadcastAction.js +0 -50
  247. package/lib/actions/CmptAction.d.ts +0 -21
  248. package/lib/actions/CmptAction.js +0 -70
  249. package/lib/actions/ContinueAction.d.ts +0 -15
  250. package/lib/actions/ContinueAction.js +0 -35
  251. package/lib/actions/CopyAction.d.ts +0 -20
  252. package/lib/actions/CopyAction.js +0 -43
  253. package/lib/actions/CustomAction.d.ts +0 -22
  254. package/lib/actions/CustomAction.js +0 -78
  255. package/lib/actions/DialogAction.d.ts +0 -60
  256. package/lib/actions/DialogAction.js +0 -108
  257. package/lib/actions/DrawerAction.d.ts +0 -33
  258. package/lib/actions/DrawerAction.js +0 -70
  259. package/lib/actions/EmailAction.d.ts +0 -23
  260. package/lib/actions/EmailAction.js +0 -48
  261. package/lib/actions/LinkAction.d.ts +0 -24
  262. package/lib/actions/LinkAction.js +0 -47
  263. package/lib/actions/LoopAction.d.ts +0 -19
  264. package/lib/actions/LoopAction.js +0 -107
  265. package/lib/actions/PageAction.d.ts +0 -39
  266. package/lib/actions/PageAction.js +0 -80
  267. package/lib/actions/ParallelAction.d.ts +0 -8
  268. package/lib/actions/ParallelAction.js +0 -40
  269. package/lib/actions/SwitchAction.d.ts +0 -11
  270. package/lib/actions/SwitchAction.js +0 -52
  271. package/lib/actions/ToastAction.d.ts +0 -19
  272. package/lib/actions/ToastAction.js +0 -35
  273. package/lib/actions/index.d.ts +0 -20
  274. package/lib/components/LazyComponent.d.ts +0 -32
  275. package/lib/components/LazyComponent.js +0 -99
  276. package/lib/components/Overlay.d.ts +0 -44
  277. package/lib/components/Overlay.js +0 -266
  278. package/lib/components/PopOver.d.ts +0 -90
  279. package/lib/components/PopOver.js +0 -129
  280. package/lib/env.d.ts +0 -176
  281. package/lib/env.js +0 -20
  282. package/lib/envOverwrite.d.ts +0 -4
  283. package/lib/envOverwrite.js +0 -43
  284. package/lib/factory.d.ts +0 -85
  285. package/lib/factory.js +0 -324
  286. package/lib/index.d.ts +0 -44
  287. package/lib/index.js +0 -460
  288. package/lib/locale.d.ts +0 -84
  289. package/lib/locale.js +0 -133
  290. package/lib/renderers/Form.d.ts +0 -389
  291. package/lib/renderers/Form.js +0 -1234
  292. package/lib/renderers/Item.d.ts +0 -906
  293. package/lib/renderers/Item.js +0 -879
  294. package/lib/renderers/Options.d.ts +0 -158
  295. package/lib/renderers/Options.js +0 -920
  296. package/lib/renderers/Placeholder.d.ts +0 -6
  297. package/lib/renderers/Placeholder.js +0 -31
  298. package/lib/renderers/builtin.d.ts +0 -1
  299. package/lib/renderers/builtin.js +0 -27
  300. package/lib/renderers/register.d.ts +0 -6
  301. package/lib/renderers/register.js +0 -83
  302. package/lib/renderers/wrapControl.d.ts +0 -437
  303. package/lib/renderers/wrapControl.js +0 -520
  304. package/lib/store/app.d.ts +0 -92
  305. package/lib/store/app.js +0 -193
  306. package/lib/store/combo.d.ts +0 -10223
  307. package/lib/store/combo.js +0 -154
  308. package/lib/store/crud.d.ts +0 -128
  309. package/lib/store/crud.js +0 -455
  310. package/lib/store/form.d.ts +0 -4252
  311. package/lib/store/form.js +0 -664
  312. package/lib/store/formItem.d.ts +0 -133
  313. package/lib/store/formItem.js +0 -858
  314. package/lib/store/iRenderer.d.ts +0 -46
  315. package/lib/store/iRenderer.js +0 -189
  316. package/lib/store/index.d.ts +0 -125
  317. package/lib/store/index.js +0 -101
  318. package/lib/store/list.d.ts +0 -272
  319. package/lib/store/list.js +0 -256
  320. package/lib/store/manager.d.ts +0 -115
  321. package/lib/store/manager.js +0 -56
  322. package/lib/store/modal.d.ts +0 -84
  323. package/lib/store/modal.js +0 -54
  324. package/lib/store/node.d.ts +0 -22
  325. package/lib/store/node.js +0 -93
  326. package/lib/store/pagination.d.ts +0 -58
  327. package/lib/store/pagination.js +0 -60
  328. package/lib/store/root.d.ts +0 -85
  329. package/lib/store/root.js +0 -57
  330. package/lib/store/service.d.ts +0 -71
  331. package/lib/store/service.js +0 -415
  332. package/lib/store/table.d.ts +0 -10085
  333. package/lib/store/table.js +0 -1148
  334. package/lib/store/table2.d.ts +0 -474
  335. package/lib/store/table2.js +0 -571
  336. package/lib/theme.d.ts +0 -89
  337. package/lib/theme.js +0 -145
  338. package/lib/types.d.ts +0 -489
  339. package/lib/utils/Animation.d.ts +0 -22
  340. package/lib/utils/Animation.js +0 -290
  341. package/lib/utils/ColorScale.d.ts +0 -19
  342. package/lib/utils/ColorScale.js +0 -105
  343. package/lib/utils/DataSchema.d.ts +0 -25
  344. package/lib/utils/DataSchema.js +0 -116
  345. package/lib/utils/DataScope.d.ts +0 -26
  346. package/lib/utils/DataScope.js +0 -162
  347. package/lib/utils/RootClose.d.ts +0 -4
  348. package/lib/utils/RootClose.js +0 -30
  349. package/lib/utils/SimpleMap.d.ts +0 -8
  350. package/lib/utils/SimpleMap.js +0 -46
  351. package/lib/utils/api.d.ts +0 -34
  352. package/lib/utils/api.js +0 -621
  353. package/lib/utils/attachmentAdpator.d.ts +0 -8
  354. package/lib/utils/attachmentAdpator.js +0 -91
  355. package/lib/utils/autobind.d.ts +0 -7
  356. package/lib/utils/autobind.js +0 -94
  357. package/lib/utils/columnsSplit.d.ts +0 -1
  358. package/lib/utils/columnsSplit.js +0 -51
  359. package/lib/utils/dataMapping.d.ts +0 -9
  360. package/lib/utils/dataMapping.js +0 -151
  361. package/lib/utils/date.d.ts +0 -4
  362. package/lib/utils/date.js +0 -90
  363. package/lib/utils/debug.d.ts +0 -29
  364. package/lib/utils/debug.js +0 -392
  365. package/lib/utils/decodeEntity.d.ts +0 -5
  366. package/lib/utils/decodeEntity.js +0 -20
  367. package/lib/utils/dom.d.ts +0 -13
  368. package/lib/utils/dom.js +0 -199
  369. package/lib/utils/errors.d.ts +0 -6
  370. package/lib/utils/errors.js +0 -23
  371. package/lib/utils/escapeHtml.d.ts +0 -1
  372. package/lib/utils/escapeHtml.js +0 -24
  373. package/lib/utils/filter-schema.d.ts +0 -13
  374. package/lib/utils/filter-schema.js +0 -78
  375. package/lib/utils/filter.d.ts +0 -1
  376. package/lib/utils/filter.js +0 -503
  377. package/lib/utils/formatDuration.d.ts +0 -1
  378. package/lib/utils/formatDuration.js +0 -27
  379. package/lib/utils/formula.d.ts +0 -16
  380. package/lib/utils/formula.js +0 -234
  381. package/lib/utils/getVariable.d.ts +0 -3
  382. package/lib/utils/getVariable.js +0 -29
  383. package/lib/utils/grammar.d.ts +0 -4
  384. package/lib/utils/grammar.js +0 -54
  385. package/lib/utils/handleAction.d.ts +0 -7
  386. package/lib/utils/handleAction.js +0 -39
  387. package/lib/utils/helper.d.ts +0 -323
  388. package/lib/utils/helper.js +0 -1361
  389. package/lib/utils/highlight.d.ts +0 -1
  390. package/lib/utils/highlight.js +0 -52
  391. package/lib/utils/icon.d.ts +0 -16
  392. package/lib/utils/icon.js +0 -43
  393. package/lib/utils/image.d.ts +0 -18
  394. package/lib/utils/image.js +0 -56
  395. package/lib/utils/index.d.ts +0 -55
  396. package/lib/utils/isPureVariable.d.ts +0 -1
  397. package/lib/utils/isPureVariable.js +0 -26
  398. package/lib/utils/json-schema-2-amis-schema.d.ts +0 -6
  399. package/lib/utils/json-schema-2-amis-schema.js +0 -60
  400. package/lib/utils/keyToPath.d.ts +0 -6
  401. package/lib/utils/keyToPath.js +0 -34
  402. package/lib/utils/makeSorter.d.ts +0 -1
  403. package/lib/utils/makeSorter.js +0 -30
  404. package/lib/utils/normalizeLink.d.ts +0 -1
  405. package/lib/utils/normalizeLink.js +0 -47
  406. package/lib/utils/normalizeOptions.d.ts +0 -7
  407. package/lib/utils/normalizeOptions.js +0 -92
  408. package/lib/utils/object.d.ts +0 -15
  409. package/lib/utils/object.js +0 -156
  410. package/lib/utils/offset.d.ts +0 -15
  411. package/lib/utils/offset.js +0 -37
  412. package/lib/utils/offsetParent.d.ts +0 -5
  413. package/lib/utils/offsetParent.js +0 -28
  414. package/lib/utils/optionValueCompare.d.ts +0 -3
  415. package/lib/utils/optionValueCompare.js +0 -30
  416. package/lib/utils/position.d.ts +0 -26
  417. package/lib/utils/position.js +0 -59
  418. package/lib/utils/prettyBytes.d.ts +0 -1
  419. package/lib/utils/prettyBytes.js +0 -29
  420. package/lib/utils/renderer-event.d.ts +0 -62
  421. package/lib/utils/renderer-event.js +0 -218
  422. package/lib/utils/replaceText.d.ts +0 -3
  423. package/lib/utils/replaceText.js +0 -46
  424. package/lib/utils/resize-sensor.d.ts +0 -6
  425. package/lib/utils/resize-sensor.js +0 -177
  426. package/lib/utils/resolveVariable.d.ts +0 -1
  427. package/lib/utils/resolveVariable.js +0 -39
  428. package/lib/utils/resolveVariableAndFilter.d.ts +0 -1
  429. package/lib/utils/resolveVariableAndFilter.js +0 -37
  430. package/lib/utils/scrollPosition.d.ts +0 -16
  431. package/lib/utils/scrollPosition.js +0 -37
  432. package/lib/utils/string2regExp.d.ts +0 -1
  433. package/lib/utils/string2regExp.js +0 -18
  434. package/lib/utils/stripNumber.d.ts +0 -1
  435. package/lib/utils/stripNumber.js +0 -20
  436. package/lib/utils/style.d.ts +0 -10
  437. package/lib/utils/style.js +0 -67
  438. package/lib/utils/toNumber.d.ts +0 -7
  439. package/lib/utils/toNumber.js +0 -22
  440. package/lib/utils/tokenize.d.ts +0 -1
  441. package/lib/utils/tokenize.js +0 -33
  442. package/lib/utils/tpl-builtin.d.ts +0 -18
  443. package/lib/utils/tpl-builtin.js +0 -75
  444. package/lib/utils/tpl-lodash.d.ts +0 -4
  445. package/lib/utils/tpl-lodash.js +0 -71
  446. package/lib/utils/tpl.d.ts +0 -11
  447. package/lib/utils/tpl.js +0 -140
  448. package/lib/utils/uncontrollable.d.ts +0 -4
  449. package/lib/utils/uncontrollable.js +0 -22
  450. package/lib/utils/validations.d.ts +0 -39
  451. package/lib/utils/validations.js +0 -455
@@ -1,879 +0,0 @@
1
- /**
2
- * amis-core v2.6.0
3
- * Copyright 2018-2022 fex
4
- */
5
-
6
- 'use strict';
7
-
8
- Object.defineProperty(exports, '__esModule', { value: true });
9
-
10
- var tslib = require('tslib');
11
- var React = require('react');
12
- var hoistNonReactStatic = require('hoist-non-react-statics');
13
- var mobx = require('mobx');
14
- var factory = require('../factory.js');
15
- var helper = require('../utils/helper.js');
16
- var mobxReact = require('mobx-react');
17
- var tpl = require('../utils/tpl.js');
18
- var WithStore = require('../WithStore.js');
19
- var wrapControl = require('./wrapControl.js');
20
- var debounce = require('lodash/debounce');
21
- var api = require('../utils/api.js');
22
- var ReactDOM = require('react-dom');
23
- require('../utils/ColorScale.js');
24
- require('lodash/chunk');
25
- var dataMapping = require('../utils/dataMapping.js');
26
- require('../utils/DataSchema.js');
27
- require('../utils/DataScope.js');
28
- require('moment');
29
- var object = require('../utils/object.js');
30
- require('amis-formula');
31
- require('../utils/debug.js');
32
- require('../utils/errors.js');
33
- require('lodash/isPlainObject');
34
- require('classnames');
35
- require('../utils/filter.js');
36
- require('lodash/isObject');
37
- require('lodash/isString');
38
- require('lodash/isBoolean');
39
- var getVariable = require('../utils/getVariable.js');
40
- require('lodash');
41
- require('../utils/image.js');
42
- require('../actions/Action.js');
43
- require('lodash/cloneDeep');
44
- require('../utils/resize-sensor.js');
45
- require('react-overlays/useRootClose');
46
- require('../utils/SimpleMap.js');
47
- require('lodash/mapValues');
48
- require('lodash/camelCase');
49
- require('uncontrollable');
50
- require('../utils/validations.js');
51
- require('../utils/Animation.js');
52
- var Overlay = require('../components/Overlay.js');
53
- var PopOver = require('../components/PopOver.js');
54
-
55
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
56
-
57
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
58
- var hoistNonReactStatic__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatic);
59
- var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
60
-
61
- var getItemLabelClassName = function (props) {
62
- var staticLabelClassName = props.staticLabelClassName, labelClassName = props.labelClassName;
63
- return props.static && staticLabelClassName
64
- ? staticLabelClassName
65
- : labelClassName;
66
- };
67
- var getItemInputClassName = function (props) {
68
- var staticInputClassName = props.staticInputClassName, inputClassName = props.inputClassName;
69
- return props.static && staticInputClassName
70
- ? staticInputClassName
71
- : inputClassName;
72
- };
73
- var FormItemWrap = /** @class */ (function (_super) {
74
- tslib.__extends(FormItemWrap, _super);
75
- function FormItemWrap(props) {
76
- var _this = _super.call(this, props) || this;
77
- _this.reaction = [];
78
- _this.syncAutoFill = debounce__default["default"](function (term, reload) {
79
- (function (term, reload) { return tslib.__awaiter(_this, void 0, void 0, function () {
80
- var _a, autoFill, onBulkChange, formItem, data, itemName, ctx, result;
81
- var _b;
82
- var _c, _d;
83
- return tslib.__generator(this, function (_e) {
84
- switch (_e.label) {
85
- case 0:
86
- _a = this.props, autoFill = _a.autoFill, onBulkChange = _a.onBulkChange, formItem = _a.formItem, data = _a.data;
87
- // 参照录入
88
- if (!autoFill || (autoFill && !(autoFill === null || autoFill === void 0 ? void 0 : autoFill.hasOwnProperty('api')))) {
89
- return [2 /*return*/];
90
- }
91
- if (!(autoFill === null || autoFill === void 0 ? void 0 : autoFill.showSuggestion)) return [3 /*break*/, 1];
92
- this.handleAutoFill('change');
93
- return [3 /*break*/, 3];
94
- case 1:
95
- itemName = formItem === null || formItem === void 0 ? void 0 : formItem.name;
96
- ctx = object.createObject(data, (_b = {},
97
- _b[itemName || ''] = term,
98
- _b));
99
- if (!((onBulkChange &&
100
- api.isEffectiveApi(autoFill.api, ctx) &&
101
- this.lastSearchTerm !== term) ||
102
- reload)) return [3 /*break*/, 3];
103
- return [4 /*yield*/, (formItem === null || formItem === void 0 ? void 0 : formItem.loadAutoUpdateData(autoFill.api, ctx, !!((_c = autoFill.api) === null || _c === void 0 ? void 0 : _c.silent)))];
104
- case 2:
105
- result = _e.sent();
106
- this.lastSearchTerm =
107
- (_d = (result && getVariable.getVariable(result, itemName))) !== null && _d !== void 0 ? _d : term;
108
- if (autoFill === null || autoFill === void 0 ? void 0 : autoFill.fillMapping) {
109
- result = dataMapping.dataMapping(autoFill.fillMapping, result);
110
- }
111
- result && (onBulkChange === null || onBulkChange === void 0 ? void 0 : onBulkChange(result));
112
- _e.label = 3;
113
- case 3: return [2 /*return*/];
114
- }
115
- });
116
- }); })(term, reload).catch(function (e) { return console.error(e); });
117
- }, 250, {
118
- trailing: true,
119
- leading: false
120
- });
121
- _this.state = {
122
- isOpened: false
123
- };
124
- var model = props.formItem;
125
- if (model) {
126
- _this.reaction.push(mobx.reaction(function () { return "".concat(model.errors.join('')).concat(model.isFocused).concat(model.dialogOpen); }, function () { return _this.forceUpdate(); }));
127
- _this.reaction.push(mobx.reaction(function () { return model === null || model === void 0 ? void 0 : model.filteredOptions; }, function () { return _this.forceUpdate(); }));
128
- _this.reaction.push(mobx.reaction(function () { return JSON.stringify(model.tmpValue); }, function () { return _this.syncAutoFill(model.tmpValue); }));
129
- }
130
- return _this;
131
- }
132
- FormItemWrap.prototype.componentDidUpdate = function (prevProps) {
133
- var _a, _b, _c;
134
- var props = this.props;
135
- var model = props.formItem;
136
- if (api.isEffectiveApi((_a = props.autoFill) === null || _a === void 0 ? void 0 : _a.api, props.data) &&
137
- api.isApiOutdated((_b = prevProps.autoFill) === null || _b === void 0 ? void 0 : _b.api, (_c = props.autoFill) === null || _c === void 0 ? void 0 : _c.api, prevProps.data, props.data)) {
138
- this.syncAutoFill(model === null || model === void 0 ? void 0 : model.tmpValue, true);
139
- }
140
- };
141
- FormItemWrap.prototype.componentDidMount = function () {
142
- this.target = ReactDOM.findDOMNode(this);
143
- };
144
- FormItemWrap.prototype.componentWillUnmount = function () {
145
- this.reaction.forEach(function (fn) { return fn(); });
146
- this.reaction = [];
147
- this.syncAutoFill.cancel();
148
- };
149
- FormItemWrap.prototype.handleFocus = function (e) {
150
- var _a = this.props, model = _a.formItem, autoFill = _a.autoFill;
151
- model && model.focus();
152
- this.props.onFocus && this.props.onFocus(e);
153
- if (!autoFill ||
154
- (autoFill && !(autoFill === null || autoFill === void 0 ? void 0 : autoFill.hasOwnProperty('showSuggestion')))) {
155
- return;
156
- }
157
- this.handleAutoFill('focus');
158
- };
159
- FormItemWrap.prototype.handleBlur = function (e) {
160
- var model = this.props.formItem;
161
- model && model.blur();
162
- this.props.onBlur && this.props.onBlur(e);
163
- };
164
- FormItemWrap.prototype.handleAutoFill = function (type) {
165
- var _this = this;
166
- var _a = this.props, autoFill = _a.autoFill; _a.onBulkChange; var formItem = _a.formItem, data = _a.data;
167
- var trigger = autoFill.trigger, mode = autoFill.mode;
168
- if (trigger === type && mode === 'popOver') {
169
- // 参照录入 popOver形式
170
- this.setState({
171
- isOpened: true
172
- });
173
- }
174
- else if (
175
- // 参照录入 dialog | drawer
176
- trigger === type &&
177
- (mode === 'dialog' || mode === 'drawer')) {
178
- formItem === null || formItem === void 0 ? void 0 : formItem.openDialog(this.buildSchema(), data, function (result) {
179
- if (!(result === null || result === void 0 ? void 0 : result.selectedItems)) {
180
- return;
181
- }
182
- _this.updateAutoFillData(result.selectedItems);
183
- });
184
- }
185
- };
186
- FormItemWrap.prototype.updateAutoFillData = function (context) {
187
- var _a = this.props, formStore = _a.formStore, autoFill = _a.autoFill, onBulkChange = _a.onBulkChange;
188
- var fillMapping = autoFill.fillMapping, multiple = autoFill.multiple;
189
- // form原始数据
190
- var data = formStore === null || formStore === void 0 ? void 0 : formStore.data;
191
- var contextData = object.createObject(tslib.__assign({ items: !multiple ? [context] : context }, data), tslib.__assign({}, context));
192
- var responseData = {};
193
- responseData = dataMapping.dataMapping(fillMapping, contextData);
194
- if (!multiple && !fillMapping) {
195
- responseData = context;
196
- }
197
- onBulkChange === null || onBulkChange === void 0 ? void 0 : onBulkChange(responseData);
198
- };
199
- FormItemWrap.prototype.buildSchema = function () {
200
- var _this = this;
201
- var _a = this.props, render = _a.render, autoFill = _a.autoFill, ns = _a.classPrefix, cx = _a.classnames, __ = _a.translate;
202
- if (!autoFill || (autoFill && !(autoFill === null || autoFill === void 0 ? void 0 : autoFill.hasOwnProperty('api')))) {
203
- return;
204
- }
205
- var api = autoFill.api, mode = autoFill.mode, size = autoFill.size, offset = autoFill.offset, position = autoFill.position, multiple = autoFill.multiple, filter = autoFill.filter, columns = autoFill.columns, labelField = autoFill.labelField, popOverContainer = autoFill.popOverContainer, popOverClassName = autoFill.popOverClassName, valueField = autoFill.valueField;
206
- var form = {
207
- type: 'form',
208
- // debug: true,
209
- title: '',
210
- className: 'suggestion-form',
211
- body: {
212
- type: 'picker',
213
- embed: true,
214
- joinValues: false,
215
- label: false,
216
- labelField: labelField,
217
- valueField: valueField || 'value',
218
- multiple: multiple,
219
- name: 'selectedItems',
220
- options: [],
221
- required: true,
222
- source: api,
223
- pickerSchema: {
224
- type: 'crud',
225
- affixHeader: false,
226
- alwaysShowPagination: true,
227
- keepItemSelectionOnPageChange: true,
228
- headerToolbar: [],
229
- footerToolbar: [
230
- {
231
- type: 'pagination',
232
- align: 'left'
233
- },
234
- {
235
- type: 'bulkActions',
236
- align: 'right',
237
- className: 'ml-2'
238
- }
239
- ],
240
- multiple: multiple,
241
- filter: filter,
242
- columns: columns || []
243
- }
244
- },
245
- actions: [
246
- {
247
- type: 'button',
248
- actionType: 'cancel',
249
- label: __('cancel')
250
- },
251
- {
252
- type: 'submit',
253
- actionType: 'submit',
254
- level: 'primary',
255
- label: __('confirm')
256
- }
257
- ]
258
- };
259
- var schema = {
260
- type: mode,
261
- className: 'auto-fill-dialog',
262
- title: __('FormItem.autoFillSuggest'),
263
- size: size,
264
- body: form,
265
- actions: [
266
- {
267
- type: 'button',
268
- actionType: 'cancel',
269
- label: __('cancel')
270
- },
271
- {
272
- type: 'submit',
273
- actionType: 'submit',
274
- level: 'primary',
275
- label: __('confirm')
276
- }
277
- ]
278
- };
279
- if (mode === 'popOver') {
280
- return (React__default["default"].createElement(Overlay["default"], { container: popOverContainer || this.target, target: function () { return _this.target; }, placement: position || 'left-bottom-left-top', show: true },
281
- React__default["default"].createElement(PopOver["default"], { classPrefix: ns, className: cx("".concat(ns, "auto-fill-popOver"), popOverClassName), style: {
282
- minWidth: this.target ? this.target.offsetWidth : undefined
283
- }, offset: offset, onHide: this.hanldeClose, overlay: true }, render('popOver-auto-fill-form', form, {
284
- onSubmit: this.hanldeSubmit
285
- }))));
286
- }
287
- else {
288
- return schema;
289
- }
290
- };
291
- // 参照录入popOver提交
292
- FormItemWrap.prototype.hanldeSubmit = function (values) {
293
- var _a = this.props; _a.onBulkChange; var autoFill = _a.autoFill;
294
- if (!autoFill || (autoFill && !(autoFill === null || autoFill === void 0 ? void 0 : autoFill.hasOwnProperty('api')))) {
295
- return;
296
- }
297
- this.updateAutoFillData(values.selectedItems);
298
- this.hanldeClose();
299
- };
300
- FormItemWrap.prototype.hanldeClose = function () {
301
- this.setState({
302
- isOpened: false
303
- });
304
- };
305
- FormItemWrap.prototype.handleOpenDialog = function (schema, data) {
306
- return tslib.__awaiter(this, void 0, void 0, function () {
307
- var model;
308
- return tslib.__generator(this, function (_a) {
309
- model = this.props.formItem;
310
- if (!model) {
311
- return [2 /*return*/];
312
- }
313
- return [2 /*return*/, new Promise(function (resolve) {
314
- return model.openDialog(schema, data, function (result) { return resolve(result); });
315
- })];
316
- });
317
- });
318
- };
319
- FormItemWrap.prototype.handleDialogConfirm = function (_a) {
320
- var values = _a[0];
321
- var model = this.props.formItem;
322
- if (!model) {
323
- return;
324
- }
325
- model.closeDialog(values);
326
- };
327
- FormItemWrap.prototype.handleDialogClose = function (confirmed) {
328
- if (confirmed === void 0) { confirmed = false; }
329
- var model = this.props.formItem;
330
- if (!model) {
331
- return;
332
- }
333
- model.closeDialog(confirmed);
334
- };
335
- FormItemWrap.prototype.renderControl = function () {
336
- var _a;
337
- var _b = this.props;
338
- // 这里解构,不可轻易删除,避免被rest传到子组件
339
- _b.inputClassName; var model = _b.formItem, cx = _b.classnames; _b.children; var type = _b.type, renderControl = _b.renderControl; _b.formItemConfig; var sizeMutable = _b.sizeMutable, size = _b.size, defaultSize = _b.defaultSize, useMobileUI = _b.useMobileUI, rest = tslib.__rest(_b, ["inputClassName", "formItem", "classnames", "children", "type", "renderControl", "formItemConfig", "sizeMutable", "size", "defaultSize", "useMobileUI"]);
340
- var mobileUI = useMobileUI && helper.isMobile();
341
- if (renderControl) {
342
- var controlSize = size || defaultSize;
343
- return renderControl(tslib.__assign(tslib.__assign({}, rest), { onOpenDialog: this.handleOpenDialog, type: type, classnames: cx, formItem: model, className: cx("Form-control", (_a = {
344
- 'is-inline': !!rest.inline && !mobileUI,
345
- 'is-error': model && !model.valid
346
- },
347
- _a["Form-control--withSize Form-control--size".concat(helper.ucFirst(controlSize))] = sizeMutable !== false &&
348
- typeof controlSize === 'string' &&
349
- !!controlSize &&
350
- controlSize !== 'full',
351
- _a), model === null || model === void 0 ? void 0 : model.errClassNames, getItemInputClassName(this.props)) }));
352
- }
353
- return null;
354
- };
355
- FormItemWrap.prototype.render = function () {
356
- var _a = this.props, formMode = _a.formMode, inputOnly = _a.inputOnly, wrap = _a.wrap, render = _a.render, model = _a.formItem;
357
- var mode = this.props.mode || formMode;
358
- if (wrap === false || inputOnly) {
359
- return this.renderControl();
360
- }
361
- var renderLayout = FormItemWrap.layoutRenderers[mode] ||
362
- FormItemWrap.layoutRenderers['normal'];
363
- return (React__default["default"].createElement(React__default["default"].Fragment, null,
364
- renderLayout(this.props, this.renderControl.bind(this)),
365
- model
366
- ? render('modal', tslib.__assign({ type: 'dialog' }, model.dialogSchema), {
367
- show: model.dialogOpen,
368
- onClose: this.handleDialogClose,
369
- onConfirm: this.handleDialogConfirm,
370
- data: model.dialogData,
371
- formStore: undefined
372
- })
373
- : null));
374
- };
375
- /**
376
- * 布局扩充点,可以自己扩充表单项的布局方式
377
- */
378
- FormItemWrap.layoutRenderers = {
379
- horizontal: function (props, renderControl) {
380
- var _a, _b, _c;
381
- var className = props.className, style = props.style, cx = props.classnames, description = props.description, descriptionClassName = props.descriptionClassName, captionClassName = props.captionClassName, desc = props.desc, label = props.label, render = props.render, required = props.required, caption = props.caption, remark = props.remark, labelRemark = props.labelRemark, env = props.env, 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;
382
- // 强制不渲染 label 的话
383
- if (renderLabel === false) {
384
- label = label === false ? false : '';
385
- }
386
- description = description || desc;
387
- var horizontal = props.horizontal || props.formHorizontal || {};
388
- var left = helper.getWidthRate(horizontal.left);
389
- var right = helper.getWidthRate(horizontal.right);
390
- var labelAlign = props.labelAlign || props.formLabelAlign;
391
- var labelWidth = props.labelWidth || props.formLabelWidth;
392
- return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--horizontal", isStatic && staticClassName ? staticClassName : className, (_a = {
393
- 'Form-item--horizontal-justify': horizontal.justify
394
- },
395
- _a["is-error"] = model && !model.valid,
396
- _a["is-required"] = required,
397
- _a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
398
- label !== false ? (React__default["default"].createElement("label", { className: cx("Form-label", (_b = {},
399
- _b["Form-itemColumn--".concat(typeof horizontal.leftFixed === 'string'
400
- ? horizontal.leftFixed
401
- : 'normal')] = horizontal.leftFixed,
402
- _b["Form-itemColumn--".concat(left)] = !horizontal.leftFixed,
403
- _b['Form-label--left'] = labelAlign === 'left',
404
- _b), getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
405
- React__default["default"].createElement("span", null,
406
- label
407
- ? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
408
- : null,
409
- required && (label || labelRemark) ? (React__default["default"].createElement("span", { className: cx("Form-star") }, "*")) : null,
410
- labelRemark
411
- ? render('label-remark', {
412
- type: 'remark',
413
- icon: labelRemark.icon || 'warning-mark',
414
- tooltip: labelRemark,
415
- useMobileUI: useMobileUI,
416
- className: cx("Form-labelRemark"),
417
- container: props.popOverContainer
418
- ? props.popOverContainer
419
- : env && env.getModalContainer
420
- ? env.getModalContainer
421
- : undefined
422
- })
423
- : null))) : null,
424
- React__default["default"].createElement("div", { className: cx("Form-value", (_c = {},
425
- // [`Form-itemColumn--offset${getWidthRate(horizontal.offset)}`]: !label && label !== false,
426
- _c["Form-itemColumn--".concat(right)] = !horizontal.leftFixed && !!right && right !== 12 - left,
427
- _c)) },
428
- renderControl(),
429
- caption
430
- ? render('caption', caption, {
431
- className: cx("Form-caption", captionClassName)
432
- })
433
- : null,
434
- remark
435
- ? render('remark', {
436
- type: 'remark',
437
- icon: remark.icon || 'warning-mark',
438
- tooltip: remark,
439
- className: cx("Form-remark"),
440
- useMobileUI: useMobileUI,
441
- container: props.popOverContainer
442
- ? props.popOverContainer
443
- : env && env.getModalContainer
444
- ? env.getModalContainer
445
- : undefined
446
- })
447
- : null,
448
- hint && model && model.isFocused
449
- ? render('hint', hint, {
450
- className: cx("Form-hint")
451
- })
452
- : null,
453
- model &&
454
- !model.valid &&
455
- showErrorMsg !== false &&
456
- Array.isArray(model.errors) ? (React__default["default"].createElement("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (React__default["default"].createElement("li", { key: key }, msg)); }))) : null,
457
- renderDescription !== false && description
458
- ? render('description', description, {
459
- className: cx("Form-description", descriptionClassName)
460
- })
461
- : null)));
462
- },
463
- normal: function (props, renderControl) {
464
- var _a;
465
- 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;
466
- description = description || desc;
467
- return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--normal", isStatic && staticClassName ? staticClassName : className, (_a = {
468
- 'is-error': model && !model.valid
469
- },
470
- _a["is-required"] = required,
471
- _a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
472
- label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label", getItemLabelClassName(props)) },
473
- React__default["default"].createElement("span", null,
474
- label
475
- ? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
476
- : null,
477
- required && (label || labelRemark) ? (React__default["default"].createElement("span", { className: cx("Form-star") }, "*")) : null,
478
- labelRemark
479
- ? render('label-remark', {
480
- type: 'remark',
481
- icon: labelRemark.icon || 'warning-mark',
482
- tooltip: labelRemark,
483
- className: cx("Form-lableRemark"),
484
- useMobileUI: useMobileUI,
485
- container: props.popOverContainer
486
- ? props.popOverContainer
487
- : env && env.getModalContainer
488
- ? env.getModalContainer
489
- : undefined
490
- })
491
- : null))) : null,
492
- renderControl(),
493
- caption
494
- ? render('caption', caption, {
495
- className: cx("Form-caption", captionClassName)
496
- })
497
- : null,
498
- remark
499
- ? render('remark', {
500
- type: 'remark',
501
- icon: remark.icon || 'warning-mark',
502
- className: cx("Form-remark"),
503
- tooltip: remark,
504
- useMobileUI: useMobileUI,
505
- container: env && env.getModalContainer
506
- ? env.getModalContainer
507
- : undefined
508
- })
509
- : null,
510
- hint && model && model.isFocused
511
- ? render('hint', hint, {
512
- className: cx("Form-hint")
513
- })
514
- : null,
515
- model &&
516
- !model.valid &&
517
- showErrorMsg !== false &&
518
- Array.isArray(model.errors) ? (React__default["default"].createElement("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (React__default["default"].createElement("li", { key: key }, msg)); }))) : null,
519
- renderDescription !== false && description
520
- ? render('description', description, {
521
- className: cx("Form-description", descriptionClassName)
522
- })
523
- : null));
524
- },
525
- inline: function (props, renderControl) {
526
- var _a;
527
- 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;
528
- var labelWidth = props.labelWidth || props.formLabelWidth;
529
- description = description || desc;
530
- return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--inline", isStatic && staticClassName ? staticClassName : className, (_a = {
531
- 'is-error': model && !model.valid
532
- },
533
- _a["is-required"] = required,
534
- _a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
535
- label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
536
- React__default["default"].createElement("span", null,
537
- label
538
- ? render('label', typeof label === 'string' ? tpl.filter(label, data) : label)
539
- : label,
540
- required && (label || labelRemark) ? (React__default["default"].createElement("span", { className: cx("Form-star") }, "*")) : null,
541
- labelRemark
542
- ? render('label-remark', {
543
- type: 'remark',
544
- icon: labelRemark.icon || 'warning-mark',
545
- tooltip: labelRemark,
546
- className: cx("Form-lableRemark"),
547
- useMobileUI: useMobileUI,
548
- container: props.popOverContainer
549
- ? props.popOverContainer
550
- : env && env.getModalContainer
551
- ? env.getModalContainer
552
- : undefined
553
- })
554
- : null))) : null,
555
- React__default["default"].createElement("div", { className: cx("Form-value") },
556
- renderControl(),
557
- caption
558
- ? render('caption', caption, {
559
- className: cx("Form-caption", captionClassName)
560
- })
561
- : null,
562
- remark
563
- ? render('remark', {
564
- type: 'remark',
565
- icon: remark.icon || 'warning-mark',
566
- className: cx("Form-remark"),
567
- tooltip: remark,
568
- useMobileUI: useMobileUI,
569
- container: props.popOverContainer
570
- ? props.popOverContainer
571
- : env && env.getModalContainer
572
- ? env.getModalContainer
573
- : undefined
574
- })
575
- : null,
576
- hint && model && model.isFocused
577
- ? render('hint', hint, {
578
- className: cx("Form-hint")
579
- })
580
- : null,
581
- model &&
582
- !model.valid &&
583
- showErrorMsg !== false &&
584
- Array.isArray(model.errors) ? (React__default["default"].createElement("ul", { className: cx("Form-feedback") }, model.errors.map(function (msg, key) { return (React__default["default"].createElement("li", { key: key }, msg)); }))) : null,
585
- renderDescription !== false && description
586
- ? render('description', description, {
587
- className: cx("Form-description", descriptionClassName)
588
- })
589
- : null)));
590
- },
591
- row: function (props, renderControl) {
592
- var _a;
593
- 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;
594
- var labelWidth = props.labelWidth || props.formLabelWidth;
595
- description = description || desc;
596
- return (React__default["default"].createElement("div", { "data-role": "form-item", className: cx("Form-item Form-item--row", isStatic && staticClassName ? staticClassName : className, (_a = {
597
- 'is-error': model && !model.valid
598
- },
599
- _a["is-required"] = required,
600
- _a), model === null || model === void 0 ? void 0 : model.errClassNames), style: style },
601
- React__default["default"].createElement("div", { className: cx('Form-rowInner') },
602
- label && renderLabel !== false ? (React__default["default"].createElement("label", { className: cx("Form-label", getItemLabelClassName(props)), style: labelWidth != null ? { width: labelWidth } : undefined },
603
- React__default["default"].createElement("span", null,
604
- render('label', typeof label === 'string' ? tpl.filter(label, data) : label),
605
- required && (label || labelRemark) ? (React__default["default"].createElement("span", { className: cx("Form-star") }, "*")) : null,
606
- labelRemark
607
- ? render('label-remark', {
608
- type: 'remark',
609
- icon: labelRemark.icon || 'warning-mark',
610
- tooltip: labelRemark,
611
- className: cx("Form-lableRemark"),
612
- useMobileUI: useMobileUI,
613
- container: props.popOverContainer
614
- ? props.popOverContainer
615
- : env && env.getModalContainer
616
- ? env.getModalContainer
617
- : undefined
618
- })
619
- : null))) : null,
620
- renderControl(),
621
- caption
622
- ? render('caption', caption, {
623
- className: cx("Form-caption", captionClassName)
624
- })
625
- : null,
626
- remark
627
- ? render('remark', {
628
- type: 'remark',
629
- icon: remark.icon || 'warning-mark',
630
- className: cx("Form-remark"),
631
- tooltip: remark,
632
- container: env && env.getModalContainer
633
- ? env.getModalContainer
634
- : undefined
635
- })
636
- : null),
637
- hint && model && model.isFocused
638
- ? render('hint', hint, {
639
- className: cx("Form-hint")
640
- })
641
- : null,
642
- model &&
643
- !model.valid &&
644
- showErrorMsg !== false &&
645
- Array.isArray(model.errors) ? (React__default["default"].createElement("ul", { className: cx('Form-feedback') }, model.errors.map(function (msg, key) { return (React__default["default"].createElement("li", { key: key }, msg)); }))) : null,
646
- description && renderDescription !== false
647
- ? render('description', description, {
648
- className: cx("Form-description", descriptionClassName)
649
- })
650
- : null));
651
- }
652
- };
653
- tslib.__decorate([
654
- helper.autobind,
655
- tslib.__metadata("design:type", Function),
656
- tslib.__metadata("design:paramtypes", [Object]),
657
- tslib.__metadata("design:returntype", void 0)
658
- ], FormItemWrap.prototype, "handleFocus", null);
659
- tslib.__decorate([
660
- helper.autobind,
661
- tslib.__metadata("design:type", Function),
662
- tslib.__metadata("design:paramtypes", [Object]),
663
- tslib.__metadata("design:returntype", void 0)
664
- ], FormItemWrap.prototype, "handleBlur", null);
665
- tslib.__decorate([
666
- helper.autobind,
667
- tslib.__metadata("design:type", Function),
668
- tslib.__metadata("design:paramtypes", [Object]),
669
- tslib.__metadata("design:returntype", void 0)
670
- ], FormItemWrap.prototype, "hanldeSubmit", null);
671
- tslib.__decorate([
672
- helper.autobind,
673
- tslib.__metadata("design:type", Function),
674
- tslib.__metadata("design:paramtypes", []),
675
- tslib.__metadata("design:returntype", void 0)
676
- ], FormItemWrap.prototype, "hanldeClose", null);
677
- tslib.__decorate([
678
- helper.autobind,
679
- tslib.__metadata("design:type", Function),
680
- tslib.__metadata("design:paramtypes", [Object, Object]),
681
- tslib.__metadata("design:returntype", Promise)
682
- ], FormItemWrap.prototype, "handleOpenDialog", null);
683
- tslib.__decorate([
684
- helper.autobind,
685
- tslib.__metadata("design:type", Function),
686
- tslib.__metadata("design:paramtypes", [Array]),
687
- tslib.__metadata("design:returntype", void 0)
688
- ], FormItemWrap.prototype, "handleDialogConfirm", null);
689
- tslib.__decorate([
690
- helper.autobind,
691
- tslib.__metadata("design:type", Function),
692
- tslib.__metadata("design:paramtypes", [Object]),
693
- tslib.__metadata("design:returntype", void 0)
694
- ], FormItemWrap.prototype, "handleDialogClose", null);
695
- return FormItemWrap;
696
- }(React__default["default"].Component));
697
- // 白名单形式,只有这些属性发生变化,才会往下更新。
698
- // 除非配置 strictMode
699
- var detectProps = [
700
- 'formPristine',
701
- 'formInited',
702
- 'addable',
703
- 'addButtonClassName',
704
- 'addButtonText',
705
- 'addOn',
706
- 'btnClassName',
707
- 'btnLabel',
708
- 'style',
709
- 'btnDisabled',
710
- 'className',
711
- 'clearable',
712
- 'columns',
713
- 'columnsCount',
714
- 'controls',
715
- 'desc',
716
- 'description',
717
- 'disabled',
718
- 'static',
719
- 'draggable',
720
- 'editable',
721
- 'editButtonClassName',
722
- 'formHorizontal',
723
- 'formMode',
724
- 'hideRoot',
725
- 'horizontal',
726
- 'icon',
727
- 'inline',
728
- 'inputClassName',
729
- 'label',
730
- 'labelClassName',
731
- 'labelField',
732
- 'language',
733
- 'level',
734
- 'max',
735
- 'maxRows',
736
- 'min',
737
- 'minRows',
738
- 'multiLine',
739
- 'multiple',
740
- 'option',
741
- 'placeholder',
742
- 'removable',
743
- 'required',
744
- 'remark',
745
- 'hint',
746
- 'rows',
747
- 'searchable',
748
- 'showCompressOptions',
749
- 'size',
750
- 'step',
751
- 'showInput',
752
- 'unit',
753
- 'value',
754
- 'diffValue',
755
- 'borderMode',
756
- 'items',
757
- 'showCounter',
758
- 'minLength',
759
- 'maxLength',
760
- 'embed',
761
- 'displayMode',
762
- 'revealPassword',
763
- 'loading'
764
- ];
765
- function asFormItem(config) {
766
- return function (Control) {
767
- var _a;
768
- var isSFC = !(Control.prototype instanceof React__default["default"].Component);
769
- // 兼容老的 FormItem 用法。
770
- if (config.validate && !Control.prototype.validate) {
771
- var fn_1 = config.validate;
772
- Control.prototype.validate = function () {
773
- var host = {
774
- input: this
775
- };
776
- return fn_1.apply(host, arguments);
777
- };
778
- }
779
- else if (config.validate) {
780
- console.error('FormItem配置中的 validate 将不起作用,因为类的成员函数中已经定义了 validate 方法,将优先使用类里面的实现。');
781
- }
782
- if (config.storeType) {
783
- Control = WithStore.HocStoreFactory({
784
- storeType: config.storeType,
785
- extendsData: config.extendsData
786
- })(mobxReact.observer(Control));
787
- delete config.storeType;
788
- }
789
- return wrapControl.wrapControl(hoistNonReactStatic__default["default"]((_a = /** @class */ (function (_super) {
790
- tslib.__extends(class_1, _super);
791
- function class_1(props) {
792
- var _this = _super.call(this, props) || this;
793
- _this.refFn = _this.refFn.bind(_this);
794
- var validations = props.validations, model = props.formItem;
795
- // 组件注册的时候可能默认指定验证器类型
796
- if (model && !validations && config.validations) {
797
- model.config({
798
- rules: config.validations
799
- });
800
- }
801
- return _this;
802
- }
803
- class_1.prototype.shouldComponentUpdate = function (nextProps) {
804
- var _a;
805
- if (((_a = config.shouldComponentUpdate) === null || _a === void 0 ? void 0 : _a.call(config, this.props, nextProps)) ||
806
- nextProps.strictMode === false ||
807
- config.strictMode === false) {
808
- return true;
809
- }
810
- // 把可能会影响视图的白名单弄出来,减少重新渲染次数。
811
- if (helper.anyChanged(detectProps.concat(config.detectProps || []), this.props, nextProps)) {
812
- return true;
813
- }
814
- return false;
815
- };
816
- class_1.prototype.getWrappedInstance = function () {
817
- return this.ref;
818
- };
819
- class_1.prototype.refFn = function (ref) {
820
- this.ref = ref;
821
- };
822
- class_1.prototype.renderControl = function () {
823
- var _a;
824
- var _b = this.props;
825
- // 这里解构,不可轻易删除,避免被rest传到子组件
826
- _b.inputClassName; var model = _b.formItem, cx = _b.classnames; _b.children; var type = _b.type, size = _b.size, defaultSize = _b.defaultSize, useMobileUI = _b.useMobileUI, rest = tslib.__rest(_b, ["inputClassName", "formItem", "classnames", "children", "type", "size", "defaultSize", "useMobileUI"]);
827
- var controlSize = size || defaultSize;
828
- var mobileUI = useMobileUI && helper.isMobile();
829
- //@ts-ignore
830
- var isOpened = this.state.isOpened;
831
- return (React__default["default"].createElement(React__default["default"].Fragment, null,
832
- React__default["default"].createElement(Control, tslib.__assign({}, rest, { useMobileUI: useMobileUI, onOpenDialog: this.handleOpenDialog, size: config.sizeMutable !== false ? undefined : size, onFocus: this.handleFocus, onBlur: this.handleBlur, type: type, classnames: cx, ref: isSFC ? undefined : this.refFn, forwardedRef: isSFC ? this.refFn : undefined, formItem: model, className: cx("Form-control", (_a = {
833
- 'is-inline': !!rest.inline && !mobileUI,
834
- 'is-error': model && !model.valid
835
- },
836
- _a["Form-control--withSize Form-control--size".concat(helper.ucFirst(controlSize))] = config.sizeMutable !== false &&
837
- typeof controlSize === 'string' &&
838
- !!controlSize &&
839
- controlSize !== 'full',
840
- _a), model === null || model === void 0 ? void 0 : model.errClassNames, getItemInputClassName(this.props)) })),
841
- isOpened ? this.buildSchema() : null));
842
- };
843
- return class_1;
844
- }(FormItemWrap)),
845
- _a.defaultProps = tslib.__assign({ className: '', renderLabel: config.renderLabel, renderDescription: config.renderDescription, sizeMutable: config.sizeMutable, wrap: config.wrap, showErrorMsg: config.showErrorMsg }, Control.defaultProps),
846
- _a.propsList = tslib.__spreadArray([
847
- 'value',
848
- 'defaultValue',
849
- 'onChange',
850
- 'setPrinstineValue',
851
- 'readOnly',
852
- 'strictMode'
853
- ], (Control.propsList || []), true),
854
- _a.displayName = "FormItem".concat(config.type ? "(".concat(config.type, ")") : ''),
855
- _a.ComposedComponent = Control,
856
- _a), Control));
857
- };
858
- }
859
- function registerFormItem(config) {
860
- var Control = asFormItem(config)(config.component);
861
- return factory.registerRenderer(tslib.__assign(tslib.__assign({}, config), { weight: typeof config.weight !== 'undefined' ? config.weight : -100, component: Control, isFormItem: true }));
862
- }
863
- function FormItem(config) {
864
- return function (component) {
865
- var renderer = registerFormItem(tslib.__assign(tslib.__assign({}, config), { component: component }));
866
- return renderer.component;
867
- };
868
- }
869
- function getFormItemByName(name) {
870
- return factory.renderersMap[name];
871
- }
872
-
873
- exports.FormItem = FormItem;
874
- exports.FormItemWrap = FormItemWrap;
875
- exports.asFormItem = asFormItem;
876
- exports["default"] = FormItem;
877
- exports.detectProps = detectProps;
878
- exports.getFormItemByName = getFormItemByName;
879
- exports.registerFormItem = registerFormItem;