amis 1.5.7 → 1.6.1

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 (533) hide show
  1. package/.husky/pre-commit +1 -1
  2. package/README.md +1 -0
  3. package/lib/RootRenderer.d.ts +2 -0
  4. package/lib/RootRenderer.js +19 -1
  5. package/lib/RootRenderer.js.map +2 -2
  6. package/lib/Schema.d.ts +3 -2
  7. package/lib/Schema.js.map +1 -1
  8. package/lib/SchemaRenderer.js +52 -1
  9. package/lib/SchemaRenderer.js.map +2 -2
  10. package/lib/Scoped.d.ts +2 -0
  11. package/lib/Scoped.js +27 -1
  12. package/lib/Scoped.js.map +2 -2
  13. package/lib/actions/Action.d.ts +33 -0
  14. package/lib/actions/Action.js +100 -0
  15. package/lib/actions/Action.js.map +13 -0
  16. package/lib/actions/AjaxAction.d.ts +14 -0
  17. package/lib/actions/AjaxAction.js +68 -0
  18. package/lib/actions/AjaxAction.js.map +13 -0
  19. package/lib/actions/BreakAction.d.ts +12 -0
  20. package/lib/actions/BreakAction.js +28 -0
  21. package/lib/actions/BreakAction.js.map +13 -0
  22. package/lib/actions/BroadcastAction.d.ts +12 -0
  23. package/lib/actions/BroadcastAction.js +40 -0
  24. package/lib/actions/BroadcastAction.js.map +13 -0
  25. package/lib/actions/CmptAction.d.ts +12 -0
  26. package/lib/actions/CmptAction.js +40 -0
  27. package/lib/actions/CmptAction.js.map +13 -0
  28. package/lib/actions/ContinueAction.d.ts +12 -0
  29. package/lib/actions/ContinueAction.js +28 -0
  30. package/lib/actions/ContinueAction.js.map +13 -0
  31. package/lib/actions/CopyAction.d.ts +12 -0
  32. package/lib/actions/CopyAction.js +35 -0
  33. package/lib/actions/CopyAction.js.map +13 -0
  34. package/lib/actions/CustomAction.d.ts +12 -0
  35. package/lib/actions/CustomAction.js +43 -0
  36. package/lib/actions/CustomAction.js.map +13 -0
  37. package/lib/actions/DialogAction.d.ts +12 -0
  38. package/lib/actions/DialogAction.js +31 -0
  39. package/lib/actions/DialogAction.js.map +13 -0
  40. package/lib/actions/DrawerAction.d.ts +12 -0
  41. package/lib/actions/DrawerAction.js +31 -0
  42. package/lib/actions/DrawerAction.js.map +13 -0
  43. package/lib/actions/EmailAction.d.ts +12 -0
  44. package/lib/actions/EmailAction.js +37 -0
  45. package/lib/actions/EmailAction.js.map +13 -0
  46. package/lib/actions/LoopAction.d.ts +12 -0
  47. package/lib/actions/LoopAction.js +93 -0
  48. package/lib/actions/LoopAction.js.map +13 -0
  49. package/lib/actions/OpenPageAction.d.ts +12 -0
  50. package/lib/actions/OpenPageAction.js +33 -0
  51. package/lib/actions/OpenPageAction.js.map +13 -0
  52. package/lib/actions/ParallelAction.d.ts +5 -0
  53. package/lib/actions/ParallelAction.js +33 -0
  54. package/lib/actions/ParallelAction.js.map +13 -0
  55. package/lib/actions/SwitchAction.d.ts +8 -0
  56. package/lib/actions/SwitchAction.js +45 -0
  57. package/lib/actions/SwitchAction.js.map +13 -0
  58. package/lib/actions/index.d.ts +18 -0
  59. package/lib/actions/index.js +22 -0
  60. package/lib/actions/index.js.map +13 -0
  61. package/lib/components/AnchorNav.d.ts +20 -20
  62. package/lib/components/AssociatedSelection.d.ts +84 -84
  63. package/lib/components/AssociatedSelection.js +2 -2
  64. package/lib/components/AssociatedSelection.js.map +2 -2
  65. package/lib/components/Avatar.d.ts +135 -0
  66. package/lib/components/Avatar.js +120 -0
  67. package/lib/components/Avatar.js.map +13 -0
  68. package/lib/components/BaiduMapPicker.js.map +2 -2
  69. package/lib/components/Button.d.ts +20 -20
  70. package/lib/components/CalendarMobile.d.ts +573 -0
  71. package/lib/components/CalendarMobile.js +486 -0
  72. package/lib/components/CalendarMobile.js.map +13 -0
  73. package/lib/components/Cascader.d.ts +123 -0
  74. package/lib/components/Cascader.js +487 -0
  75. package/lib/components/Cascader.js.map +13 -0
  76. package/lib/components/ChainedSelection.d.ts +84 -84
  77. package/lib/components/ChainedSelection.js +15 -3
  78. package/lib/components/ChainedSelection.js.map +2 -2
  79. package/lib/components/CityArea.d.ts +527 -0
  80. package/lib/components/CityArea.js +177 -0
  81. package/lib/components/CityArea.js.map +13 -0
  82. package/lib/components/Collapse.d.ts +20 -20
  83. package/lib/components/ColorPicker.d.ts +84 -84
  84. package/lib/components/ColorPicker.js +4 -3
  85. package/lib/components/ColorPicker.js.map +2 -2
  86. package/lib/components/DatePicker.d.ts +85 -84
  87. package/lib/components/DatePicker.js +21 -8
  88. package/lib/components/DatePicker.js.map +2 -2
  89. package/lib/components/DateRangePicker.d.ts +85 -84
  90. package/lib/components/DateRangePicker.js +19 -6
  91. package/lib/components/DateRangePicker.js.map +2 -2
  92. package/lib/components/GroupedSelection.d.ts +84 -84
  93. package/lib/components/GroupedSelection.js +14 -2
  94. package/lib/components/GroupedSelection.js.map +2 -2
  95. package/lib/components/InputBox.d.ts +21 -21
  96. package/lib/components/ListGroup.d.ts +21 -21
  97. package/lib/components/ListMenu.d.ts +84 -84
  98. package/lib/components/MonthRangePicker.d.ts +85 -84
  99. package/lib/components/MonthRangePicker.js +18 -7
  100. package/lib/components/MonthRangePicker.js.map +2 -2
  101. package/lib/components/Overlay.d.ts +1 -1
  102. package/lib/components/Overlay.js.map +1 -1
  103. package/lib/components/Picker.d.ts +1 -0
  104. package/lib/components/Picker.js +16 -7
  105. package/lib/components/Picker.js.map +2 -2
  106. package/lib/components/PickerColumn.d.ts +1 -0
  107. package/lib/components/PickerColumn.js +21 -18
  108. package/lib/components/PickerColumn.js.map +2 -2
  109. package/lib/components/PickerContainer.d.ts +3 -0
  110. package/lib/components/PickerContainer.js +12 -5
  111. package/lib/components/PickerContainer.js.map +2 -2
  112. package/lib/components/PopOverContainer.d.ts +1 -0
  113. package/lib/components/PopOverContainer.js +5 -3
  114. package/lib/components/PopOverContainer.js.map +2 -2
  115. package/lib/components/PopUp.d.ts +1041 -28
  116. package/lib/components/PopUp.js +32 -8
  117. package/lib/components/PopUp.js.map +2 -2
  118. package/lib/components/Radios.d.ts +21 -21
  119. package/lib/components/Rating.d.ts +21 -21
  120. package/lib/components/ResultBox.d.ts +85 -84
  121. package/lib/components/ResultBox.js +9 -4
  122. package/lib/components/ResultBox.js.map +2 -2
  123. package/lib/components/ResultList.d.ts +9 -2
  124. package/lib/components/ResultList.js +22 -2
  125. package/lib/components/ResultList.js.map +2 -2
  126. package/lib/components/Select.d.ts +238 -238
  127. package/lib/components/Select.js +13 -9
  128. package/lib/components/Select.js.map +2 -2
  129. package/lib/components/Selection.d.ts +94 -86
  130. package/lib/components/Selection.js +11 -2
  131. package/lib/components/Selection.js.map +2 -2
  132. package/lib/components/Steps.js.map +2 -2
  133. package/lib/components/TableSelection.d.ts +85 -85
  134. package/lib/components/TableSelection.js +1 -9
  135. package/lib/components/TableSelection.js.map +2 -2
  136. package/lib/components/Tabs.js +31 -33
  137. package/lib/components/Tabs.js.map +2 -2
  138. package/lib/components/TabsTransfer.d.ts +87 -256
  139. package/lib/components/TabsTransfer.js +52 -9
  140. package/lib/components/TabsTransfer.js.map +2 -2
  141. package/lib/components/TabsTransferPicker.d.ts +1 -1
  142. package/lib/components/TabsTransferPicker.js +20 -18
  143. package/lib/components/TabsTransferPicker.js.map +2 -2
  144. package/lib/components/Timeline.d.ts +69 -0
  145. package/lib/components/Timeline.js +16 -0
  146. package/lib/components/Timeline.js.map +13 -0
  147. package/lib/components/TimelineItem.d.ts +517 -0
  148. package/lib/components/TimelineItem.js +40 -0
  149. package/lib/components/TimelineItem.js.map +13 -0
  150. package/lib/components/Transfer.d.ts +100 -98
  151. package/lib/components/Transfer.js +2 -3
  152. package/lib/components/Transfer.js.map +2 -2
  153. package/lib/components/TransferDropDown.d.ts +85 -84
  154. package/lib/components/TransferDropDown.js +9 -10
  155. package/lib/components/TransferDropDown.js.map +2 -2
  156. package/lib/components/TransferPicker.d.ts +1 -0
  157. package/lib/components/TransferPicker.js +19 -4
  158. package/lib/components/TransferPicker.js.map +2 -2
  159. package/lib/components/Tree.d.ts +84 -84
  160. package/lib/components/TreeSelection.d.ts +85 -85
  161. package/lib/components/TreeSelection.js +7 -1
  162. package/lib/components/TreeSelection.js.map +2 -2
  163. package/lib/components/calendar/Calendar.d.ts +19 -0
  164. package/lib/components/calendar/Calendar.js +71 -1
  165. package/lib/components/calendar/Calendar.js.map +2 -2
  166. package/lib/components/calendar/DaysView.d.ts +21 -0
  167. package/lib/components/calendar/DaysView.js +76 -17
  168. package/lib/components/calendar/DaysView.js.map +2 -2
  169. package/lib/components/calendar/MonthsView.d.ts +34 -0
  170. package/lib/components/calendar/MonthsView.js +68 -3
  171. package/lib/components/calendar/MonthsView.js.map +2 -2
  172. package/lib/components/calendar/QuartersView.d.ts +1 -0
  173. package/lib/components/calendar/QuartersView.js +2 -2
  174. package/lib/components/calendar/QuartersView.js.map +2 -2
  175. package/lib/components/calendar/TimeView.d.ts +30 -18
  176. package/lib/components/calendar/TimeView.js +47 -8
  177. package/lib/components/calendar/TimeView.js.map +2 -2
  178. package/lib/components/calendar/YearsView.d.ts +6 -0
  179. package/lib/components/calendar/YearsView.js +21 -10
  180. package/lib/components/calendar/YearsView.js.map +2 -2
  181. package/lib/components/condition-builder/Field.js +1 -4
  182. package/lib/components/condition-builder/Field.js.map +2 -2
  183. package/lib/components/condition-builder/Func.js +1 -1
  184. package/lib/components/condition-builder/Func.js.map +2 -2
  185. package/lib/components/formula/Editor.d.ts +3 -0
  186. package/lib/components/formula/Editor.js +3 -2
  187. package/lib/components/formula/Editor.js.map +2 -2
  188. package/lib/components/formula/FuncList.js +2 -1
  189. package/lib/components/formula/FuncList.js.map +2 -2
  190. package/lib/components/formula/Picker.js +1 -1
  191. package/lib/components/formula/Picker.js.map +2 -2
  192. package/lib/components/formula/plugin.js +0 -1
  193. package/lib/components/formula/plugin.js.map +2 -2
  194. package/lib/components/icons.js +2 -0
  195. package/lib/components/icons.js.map +2 -2
  196. package/lib/components/index.d.ts +2 -1
  197. package/lib/components/index.js +4 -2
  198. package/lib/components/index.js.map +2 -2
  199. package/lib/components/virtual-list/SizeAndPositionManager.js.map +2 -2
  200. package/lib/components/virtual-list/index.js +1 -2
  201. package/lib/components/virtual-list/index.js.map +2 -2
  202. package/lib/env.d.ts +4 -0
  203. package/lib/env.js.map +2 -2
  204. package/lib/factory.d.ts +2 -1
  205. package/lib/factory.js +83 -0
  206. package/lib/factory.js.map +2 -2
  207. package/lib/helper.css.map +1 -1
  208. package/lib/icons/tree-down.js +7 -0
  209. package/lib/index.d.ts +3 -0
  210. package/lib/index.js +4 -1
  211. package/lib/index.js.map +2 -2
  212. package/lib/locale/de-DE.js +17 -2
  213. package/lib/locale/de-DE.js.map +2 -2
  214. package/lib/locale/en-US.js +17 -2
  215. package/lib/locale/en-US.js.map +2 -2
  216. package/lib/locale/zh-CN.js +16 -1
  217. package/lib/locale/zh-CN.js.map +2 -2
  218. package/lib/renderers/Action.d.ts +1 -1
  219. package/lib/renderers/Action.js +26 -10
  220. package/lib/renderers/Action.js.map +2 -2
  221. package/lib/renderers/Avatar.d.ts +35 -26
  222. package/lib/renderers/Avatar.js +14 -19
  223. package/lib/renderers/Avatar.js.map +2 -2
  224. package/lib/renderers/Card.js +6 -5
  225. package/lib/renderers/Card.js.map +2 -2
  226. package/lib/renderers/Custom.d.ts +1 -1
  227. package/lib/renderers/Custom.js +1 -1
  228. package/lib/renderers/Custom.js.map +2 -2
  229. package/lib/renderers/DropDownButton.d.ts +11 -2
  230. package/lib/renderers/DropDownButton.js +30 -12
  231. package/lib/renderers/DropDownButton.js.map +2 -2
  232. package/lib/renderers/Each.js +5 -2
  233. package/lib/renderers/Each.js.map +2 -2
  234. package/lib/renderers/Flex.js +1 -5
  235. package/lib/renderers/Flex.js.map +2 -2
  236. package/lib/renderers/Form/ChartRadios.js.map +2 -2
  237. package/lib/renderers/Form/Checkboxes.js.map +2 -2
  238. package/lib/renderers/Form/CityDB.js +526 -2
  239. package/lib/renderers/Form/CityDB.js.map +2 -2
  240. package/lib/renderers/Form/DiffEditor.d.ts +6 -0
  241. package/lib/renderers/Form/DiffEditor.js +2 -1
  242. package/lib/renderers/Form/DiffEditor.js.map +2 -2
  243. package/lib/renderers/Form/Editor.d.ts +6 -0
  244. package/lib/renderers/Form/InputCity.d.ts +85 -84
  245. package/lib/renderers/Form/InputCity.js +4 -2
  246. package/lib/renderers/Form/InputCity.js.map +2 -2
  247. package/lib/renderers/Form/InputColor.d.ts +84 -84
  248. package/lib/renderers/Form/InputColor.js +6 -2
  249. package/lib/renderers/Form/InputColor.js.map +2 -2
  250. package/lib/renderers/Form/InputDate.js +10 -5
  251. package/lib/renderers/Form/InputDate.js.map +2 -2
  252. package/lib/renderers/Form/InputDateRange.js +6 -2
  253. package/lib/renderers/Form/InputDateRange.js.map +2 -2
  254. package/lib/renderers/Form/InputFormula.d.ts +4 -1
  255. package/lib/renderers/Form/InputFormula.js +2 -2
  256. package/lib/renderers/Form/InputFormula.js.map +2 -2
  257. package/lib/renderers/Form/InputImage.d.ts +1 -0
  258. package/lib/renderers/Form/InputImage.js +8 -4
  259. package/lib/renderers/Form/InputImage.js.map +2 -2
  260. package/lib/renderers/Form/InputMonthRange.js +1 -1
  261. package/lib/renderers/Form/InputMonthRange.js.map +2 -2
  262. package/lib/renderers/Form/InputQuarterRange.js +1 -1
  263. package/lib/renderers/Form/InputQuarterRange.js.map +2 -2
  264. package/lib/renderers/Form/InputRichText.d.ts +4 -0
  265. package/lib/renderers/Form/InputRichText.js +2 -1
  266. package/lib/renderers/Form/InputRichText.js.map +2 -2
  267. package/lib/renderers/Form/InputYearRange.js +1 -1
  268. package/lib/renderers/Form/InputYearRange.js.map +2 -2
  269. package/lib/renderers/Form/Item.d.ts +10 -14
  270. package/lib/renderers/Form/Item.js +18 -9
  271. package/lib/renderers/Form/Item.js.map +2 -2
  272. package/lib/renderers/Form/NestedSelect.d.ts +1 -0
  273. package/lib/renderers/Form/NestedSelect.js +8 -4
  274. package/lib/renderers/Form/NestedSelect.js.map +2 -2
  275. package/lib/renderers/Form/Options.js +9 -7
  276. package/lib/renderers/Form/Options.js.map +2 -2
  277. package/lib/renderers/Form/Select.d.ts +2 -0
  278. package/lib/renderers/Form/Select.js +9 -6
  279. package/lib/renderers/Form/Select.js.map +2 -2
  280. package/lib/renderers/Form/TabsTransfer.d.ts +5 -32
  281. package/lib/renderers/Form/TabsTransfer.js +20 -1
  282. package/lib/renderers/Form/TabsTransfer.js.map +2 -2
  283. package/lib/renderers/Form/TabsTransferPicker.d.ts +5 -35
  284. package/lib/renderers/Form/TabsTransferPicker.js +21 -2
  285. package/lib/renderers/Form/TabsTransferPicker.js.map +2 -2
  286. package/lib/renderers/Form/Transfer.d.ts +15 -4
  287. package/lib/renderers/Form/Transfer.js +55 -18
  288. package/lib/renderers/Form/Transfer.js.map +2 -2
  289. package/lib/renderers/Form/TransferPicker.d.ts +3 -32
  290. package/lib/renderers/Form/TransferPicker.js +1 -1
  291. package/lib/renderers/Form/TransferPicker.js.map +2 -2
  292. package/lib/renderers/Form/TreeSelect.js +4 -4
  293. package/lib/renderers/Form/TreeSelect.js.map +2 -2
  294. package/lib/renderers/Form/index.js +8 -1
  295. package/lib/renderers/Form/index.js.map +2 -2
  296. package/lib/renderers/IFrame.js +0 -2
  297. package/lib/renderers/IFrame.js.map +2 -2
  298. package/lib/renderers/Link.d.ts +1 -1
  299. package/lib/renderers/Link.js +27 -6
  300. package/lib/renderers/Link.js.map +2 -2
  301. package/lib/renderers/Log.js +15 -10
  302. package/lib/renderers/Log.js.map +2 -2
  303. package/lib/renderers/Nav.d.ts +21 -21
  304. package/lib/renderers/Remark.d.ts +5 -1
  305. package/lib/renderers/Remark.js +39 -7
  306. package/lib/renderers/Remark.js.map +2 -2
  307. package/lib/renderers/Steps.js +5 -5
  308. package/lib/renderers/Steps.js.map +2 -2
  309. package/lib/renderers/Table/index.js +4 -1
  310. package/lib/renderers/Table/index.js.map +2 -2
  311. package/lib/renderers/Tabs.js +1 -1
  312. package/lib/renderers/Tabs.js.map +2 -2
  313. package/lib/renderers/Timeline.d.ts +65 -0
  314. package/lib/renderers/Timeline.js +54 -0
  315. package/lib/renderers/Timeline.js.map +13 -0
  316. package/lib/renderers/Video.js.map +2 -2
  317. package/lib/schemaExtend.js +23 -9
  318. package/lib/schemaExtend.js.map +2 -2
  319. package/lib/store/combo.js.map +2 -2
  320. package/lib/store/formItem.js +1 -1
  321. package/lib/store/formItem.js.map +2 -2
  322. package/lib/themes/ang-ie11.css +1149 -53
  323. package/lib/themes/ang.css +1149 -53
  324. package/lib/themes/ang.css.map +1 -1
  325. package/lib/themes/antd-ie11.css +1187 -53
  326. package/lib/themes/antd.css +1187 -53
  327. package/lib/themes/antd.css.map +1 -1
  328. package/lib/themes/cxd-ie11.css +1189 -70
  329. package/lib/themes/cxd.css +1189 -70
  330. package/lib/themes/cxd.css.map +1 -1
  331. package/lib/themes/dark-ie11.css +1152 -53
  332. package/lib/themes/dark.css +1152 -53
  333. package/lib/themes/dark.css.map +1 -1
  334. package/lib/themes/default.css +1189 -70
  335. package/lib/themes/default.css.map +1 -1
  336. package/lib/utils/RootClose.js +3 -1
  337. package/lib/utils/RootClose.js.map +2 -2
  338. package/lib/utils/api.js +14 -3
  339. package/lib/utils/api.js.map +2 -2
  340. package/lib/utils/debug.d.ts +26 -0
  341. package/lib/utils/debug.js +351 -0
  342. package/lib/utils/debug.js.map +13 -0
  343. package/lib/utils/helper.d.ts +1 -6
  344. package/lib/utils/helper.js +6 -17
  345. package/lib/utils/helper.js.map +2 -2
  346. package/lib/utils/renderer-event.d.ts +38 -0
  347. package/lib/utils/renderer-event.js +28 -0
  348. package/lib/utils/renderer-event.js.map +13 -0
  349. package/package.json +12 -6
  350. package/schema.json +3516 -839
  351. package/scss/_properties.scss +20 -6
  352. package/scss/_variables.scss +1 -0
  353. package/scss/components/_avatar.scss +27 -9
  354. package/scss/components/_calendar.scss +291 -0
  355. package/scss/components/_card.scss +1 -1
  356. package/scss/components/_cascader.scss +102 -0
  357. package/scss/components/_city-area.scss +27 -0
  358. package/scss/components/_collapse-group.scss +1 -3
  359. package/scss/components/_debug.scss +167 -0
  360. package/scss/components/_dropdown.scss +39 -9
  361. package/scss/components/_formula.scss +30 -6
  362. package/scss/components/_modal.scss +18 -0
  363. package/scss/components/_panel.scss +45 -0
  364. package/scss/components/_picker-columns.scss +15 -5
  365. package/scss/components/_popup.scss +43 -16
  366. package/scss/components/_result-box.scss +31 -0
  367. package/scss/components/_timeline.scss +198 -0
  368. package/scss/components/form/_checks.scss +2 -0
  369. package/scss/components/form/_color.scss +2 -2
  370. package/scss/components/form/_date-range.scss +34 -1
  371. package/scss/components/form/_date.scss +46 -1
  372. package/scss/components/form/_form.scss +170 -0
  373. package/scss/components/form/_nested-select.scss +3 -0
  374. package/scss/components/form/_result-list.scss +2 -0
  375. package/scss/components/form/_select.scss +32 -3
  376. package/scss/components/form/_selection.scss +5 -4
  377. package/scss/components/form/_transfer.scss +3 -0
  378. package/scss/components/form/_tree-select.scss +1 -1
  379. package/scss/themes/_antd-variables.scss +45 -0
  380. package/scss/themes/_common.scss +5 -0
  381. package/scss/themes/_cxd-variables.scss +50 -1
  382. package/scss/themes/_dark-variables.scss +4 -0
  383. package/scss/themes/cxd.scss +0 -19
  384. package/sdk/ang-ie11.css +1450 -142
  385. package/sdk/ang.css +1473 -159
  386. package/sdk/antd-ie11.css +1451 -142
  387. package/sdk/antd.css +1511 -159
  388. package/sdk/charts.js +15 -15
  389. package/sdk/codemirror.js +7 -7
  390. package/sdk/color-picker.js +65 -65
  391. package/sdk/cropperjs.js +2 -2
  392. package/sdk/cxd-ie11.css +1448 -158
  393. package/sdk/cxd.css +1513 -178
  394. package/sdk/dark-ie11.css +1450 -142
  395. package/sdk/dark.css +1476 -159
  396. package/sdk/exceljs.js +1 -1
  397. package/sdk/helper.css.map +1 -1
  398. package/sdk/locale/de-DE.js +17 -2
  399. package/sdk/markdown.js +69 -69
  400. package/sdk/papaparse.js +1 -1
  401. package/sdk/renderers/Form/CityDB.js +1 -1
  402. package/sdk/rest.js +18 -18
  403. package/sdk/rich-text.js +62 -62
  404. package/sdk/sdk-ie11.css +1448 -158
  405. package/sdk/sdk.css +1513 -178
  406. package/sdk/sdk.js +1309 -1251
  407. package/sdk/thirds/hls.js/hls.js +1 -1
  408. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  409. package/sdk/tinymce.js +57 -57
  410. package/src/RootRenderer.tsx +27 -1
  411. package/src/Schema.ts +3 -0
  412. package/src/SchemaRenderer.tsx +70 -4
  413. package/src/Scoped.tsx +46 -4
  414. package/src/actions/Action.ts +138 -0
  415. package/src/actions/AjaxAction.ts +58 -0
  416. package/src/actions/BreakAction.ts +27 -0
  417. package/src/actions/BroadcastAction.ts +41 -0
  418. package/src/actions/CmptAction.ts +36 -0
  419. package/src/actions/ContinueAction.ts +27 -0
  420. package/src/actions/CopyAction.ts +41 -0
  421. package/src/actions/CustomAction.ts +46 -0
  422. package/src/actions/DialogAction.ts +28 -0
  423. package/src/actions/DrawerAction.ts +28 -0
  424. package/src/actions/EmailAction.ts +38 -0
  425. package/src/actions/LoopAction.ts +77 -0
  426. package/src/actions/OpenPageAction.ts +39 -0
  427. package/src/actions/ParallelAction.ts +26 -0
  428. package/src/actions/SwitchAction.ts +35 -0
  429. package/src/actions/index.ts +20 -0
  430. package/src/components/AssociatedSelection.tsx +5 -1
  431. package/src/components/Avatar.tsx +253 -0
  432. package/src/components/BaiduMapPicker.tsx +19 -14
  433. package/src/components/CalendarMobile.tsx +658 -0
  434. package/src/components/Cascader.tsx +564 -0
  435. package/src/components/ChainedSelection.tsx +16 -3
  436. package/src/components/CityArea.tsx +315 -0
  437. package/src/components/ColorPicker.tsx +41 -40
  438. package/src/components/DatePicker.tsx +80 -34
  439. package/src/components/DateRangePicker.tsx +85 -30
  440. package/src/components/GroupedSelection.tsx +14 -2
  441. package/src/components/MonthRangePicker.tsx +78 -31
  442. package/src/components/Overlay.tsx +1 -1
  443. package/src/components/Picker.tsx +55 -35
  444. package/src/components/PickerColumn.tsx +43 -36
  445. package/src/components/PickerContainer.tsx +13 -1
  446. package/src/components/PopOverContainer.tsx +31 -17
  447. package/src/components/PopUp.tsx +84 -57
  448. package/src/components/ResultBox.tsx +14 -2
  449. package/src/components/ResultList.tsx +36 -6
  450. package/src/components/Select.tsx +24 -26
  451. package/src/components/Selection.tsx +21 -3
  452. package/src/components/Steps.tsx +23 -10
  453. package/src/components/TableSelection.tsx +1 -44
  454. package/src/components/Tabs.tsx +65 -54
  455. package/src/components/TabsTransfer.tsx +78 -9
  456. package/src/components/TabsTransferPicker.tsx +25 -13
  457. package/src/components/Timeline.tsx +36 -0
  458. package/src/components/TimelineItem.tsx +140 -0
  459. package/src/components/Transfer.tsx +11 -8
  460. package/src/components/TransferDropDown.tsx +20 -12
  461. package/src/components/TransferPicker.tsx +25 -4
  462. package/src/components/TreeSelection.tsx +7 -1
  463. package/src/components/calendar/Calendar.tsx +101 -4
  464. package/src/components/calendar/DaysView.tsx +165 -33
  465. package/src/components/calendar/MonthsView.tsx +108 -1
  466. package/src/components/calendar/QuartersView.tsx +3 -2
  467. package/src/components/calendar/TimeView.tsx +104 -41
  468. package/src/components/calendar/YearsView.tsx +34 -17
  469. package/src/components/condition-builder/Field.tsx +1 -3
  470. package/src/components/condition-builder/Func.tsx +1 -1
  471. package/src/components/formula/Editor.tsx +16 -11
  472. package/src/components/formula/FuncList.tsx +3 -1
  473. package/src/components/formula/Picker.tsx +2 -1
  474. package/src/components/formula/plugin.ts +0 -2
  475. package/src/components/icons.tsx +2 -0
  476. package/src/components/index.tsx +2 -0
  477. package/src/components/virtual-list/SizeAndPositionManager.ts +6 -3
  478. package/src/components/virtual-list/index.tsx +4 -6
  479. package/src/env.tsx +22 -0
  480. package/src/factory.tsx +93 -1
  481. package/src/icons/tree-down.svg +5 -0
  482. package/src/index.tsx +5 -0
  483. package/src/locale/de-DE.ts +17 -2
  484. package/src/locale/en-US.ts +17 -2
  485. package/src/locale/zh-CN.ts +16 -1
  486. package/src/renderers/Action.tsx +11 -2
  487. package/src/renderers/Avatar.tsx +83 -74
  488. package/src/renderers/Card.tsx +10 -6
  489. package/src/renderers/Custom.tsx +7 -4
  490. package/src/renderers/DropDownButton.tsx +69 -35
  491. package/src/renderers/Each.tsx +4 -4
  492. package/src/renderers/Flex.tsx +3 -7
  493. package/src/renderers/Form/ChartRadios.tsx +2 -7
  494. package/src/renderers/Form/Checkboxes.tsx +1 -1
  495. package/src/renderers/Form/CityDB.ts +526 -2
  496. package/src/renderers/Form/DiffEditor.tsx +2 -3
  497. package/src/renderers/Form/InputCity.tsx +23 -3
  498. package/src/renderers/Form/InputColor.tsx +21 -2
  499. package/src/renderers/Form/InputDate.tsx +48 -20
  500. package/src/renderers/Form/InputDateRange.tsx +9 -2
  501. package/src/renderers/Form/InputFormula.tsx +9 -4
  502. package/src/renderers/Form/InputImage.tsx +9 -4
  503. package/src/renderers/Form/InputMonthRange.tsx +0 -1
  504. package/src/renderers/Form/InputQuarterRange.tsx +0 -1
  505. package/src/renderers/Form/InputRichText.tsx +11 -1
  506. package/src/renderers/Form/InputYearRange.tsx +0 -1
  507. package/src/renderers/Form/Item.tsx +29 -8
  508. package/src/renderers/Form/NestedSelect.tsx +32 -4
  509. package/src/renderers/Form/Options.tsx +15 -7
  510. package/src/renderers/Form/Select.tsx +21 -5
  511. package/src/renderers/Form/TabsTransfer.tsx +28 -38
  512. package/src/renderers/Form/TabsTransferPicker.tsx +28 -46
  513. package/src/renderers/Form/Transfer.tsx +75 -24
  514. package/src/renderers/Form/TransferPicker.tsx +6 -38
  515. package/src/renderers/Form/TreeSelect.tsx +18 -16
  516. package/src/renderers/Form/index.tsx +7 -1
  517. package/src/renderers/IFrame.tsx +0 -2
  518. package/src/renderers/Link.tsx +18 -3
  519. package/src/renderers/Log.tsx +5 -1
  520. package/src/renderers/Remark.tsx +68 -18
  521. package/src/renderers/Steps.tsx +11 -13
  522. package/src/renderers/Table/index.tsx +7 -1
  523. package/src/renderers/Tabs.tsx +6 -2
  524. package/src/renderers/Timeline.tsx +141 -0
  525. package/src/renderers/Video.tsx +4 -20
  526. package/src/schemaExtend.ts +22 -10
  527. package/src/store/combo.ts +1 -3
  528. package/src/store/formItem.ts +1 -1
  529. package/src/utils/RootClose.ts +5 -1
  530. package/src/utils/api.ts +15 -2
  531. package/src/utils/debug.tsx +438 -0
  532. package/src/utils/helper.ts +6 -16
  533. package/src/utils/renderer-event.ts +75 -0
@@ -1,4 +1,5 @@
1
1
  import {observer} from 'mobx-react';
2
+ import {getEnv} from 'mobx-state-tree';
2
3
  import React from 'react';
3
4
  import Alert from './components/Alert2';
4
5
  import Spinner from './components/Spinner';
@@ -39,10 +40,18 @@ export class RootRenderer extends React.Component<RootRendererProps> {
39
40
  'handleDialogConfirm',
40
41
  'handleDialogClose',
41
42
  'handleDrawerConfirm',
42
- 'handleDrawerClose'
43
+ 'handleDrawerClose',
44
+ 'handlePageVisibilityChange'
43
45
  ]);
44
46
  }
45
47
 
48
+ componentDidMount() {
49
+ document.addEventListener(
50
+ 'visibilitychange',
51
+ this.handlePageVisibilityChange
52
+ );
53
+ }
54
+
46
55
  componentDidUpdate(prevProps: RootRendererProps) {
47
56
  const props = this.props;
48
57
 
@@ -61,6 +70,23 @@ export class RootRenderer extends React.Component<RootRendererProps> {
61
70
 
62
71
  componentWillUnmount() {
63
72
  this.props.rootStore.removeStore(this.store);
73
+ document.removeEventListener(
74
+ 'visibilitychange',
75
+ this.handlePageVisibilityChange
76
+ );
77
+ }
78
+
79
+ handlePageVisibilityChange() {
80
+ const env = this.props.env;
81
+ if (document.visibilityState === 'hidden') {
82
+ env?.tracker({
83
+ eventType: 'pageHidden'
84
+ });
85
+ } else if (document.visibilityState === 'visible') {
86
+ env?.tracker({
87
+ eventType: 'pageVisible'
88
+ });
89
+ }
64
90
  }
65
91
 
66
92
  handleAction(
package/src/Schema.ts CHANGED
@@ -56,6 +56,7 @@ import {PaginationSchema} from './renderers/Pagination';
56
56
  import {AnchorNavSchema} from './renderers/AnchorNav';
57
57
  import {AvatarSchema} from './renderers/Avatar';
58
58
  import {StepsSchema} from './renderers/Steps';
59
+ import {TimelineSchema} from './renderers/Timeline';
59
60
  import {ArrayControlSchema} from './renderers/Form/InputArray';
60
61
  import {ButtonGroupControlSchema} from './renderers/Form/ButtonGroupSelect';
61
62
  import {ChainedSelectControlSchema} from './renderers/Form/ChainedSelect';
@@ -201,6 +202,7 @@ export type SchemaType =
201
202
  | 'web-component'
202
203
  | 'anchor-nav'
203
204
  | 'steps'
205
+ | 'timeline'
204
206
  | 'control'
205
207
  | 'input-array'
206
208
  | 'button'
@@ -387,6 +389,7 @@ export type SchemaObject =
387
389
  | AnchorNavSchema
388
390
  | StepsSchema
389
391
  | PortletSchema
392
+ | TimelineSchema
390
393
 
391
394
  // 表单项
392
395
  | FormControlSchema
@@ -5,6 +5,7 @@ import LazyComponent from './components/LazyComponent';
5
5
  import {
6
6
  filterSchema,
7
7
  loadRenderer,
8
+ RendererComponent,
8
9
  RendererConfig,
9
10
  RendererEnv,
10
11
  RendererProps,
@@ -12,9 +13,12 @@ import {
12
13
  } from './factory';
13
14
  import {asFormItem} from './renderers/Form/Item';
14
15
  import {renderChild, renderChildren} from './Root';
16
+ import {IScopedContext, ScopedContext} from './Scoped';
15
17
  import {Schema, SchemaNode} from './types';
18
+ import {DebugWrapper, enableAMISDebug} from './utils/debug';
16
19
  import getExprProperties from './utils/filter-schema';
17
- import {anyChanged, chainEvents} from './utils/helper';
20
+ import {anyChanged, chainEvents, autobind} from './utils/helper';
21
+ import {RendererEvent} from './utils/renderer-event';
18
22
  import {SimpleMap} from './utils/SimpleMap';
19
23
 
20
24
  interface SchemaRendererProps extends Partial<RendererProps> {
@@ -23,6 +27,10 @@ interface SchemaRendererProps extends Partial<RendererProps> {
23
27
  env: RendererEnv;
24
28
  }
25
29
 
30
+ interface BroadcastCmptProps extends RendererProps {
31
+ component: RendererComponent;
32
+ }
33
+
26
34
  const defaultOmitList = [
27
35
  'type',
28
36
  'name',
@@ -50,6 +58,58 @@ const defaultOmitList = [
50
58
 
51
59
  const componentCache: SimpleMap = new SimpleMap();
52
60
 
61
+ class BroadcastCmpt extends React.Component<BroadcastCmptProps> {
62
+ ref: any;
63
+ unbindEvent: (() => void) | undefined = undefined;
64
+ static contextType = ScopedContext;
65
+
66
+ constructor(props: BroadcastCmptProps, context: IScopedContext) {
67
+ super(props);
68
+ this.triggerEvent = this.triggerEvent.bind(this);
69
+ }
70
+
71
+ componentDidMount() {
72
+ const {env} = this.props;
73
+ this.unbindEvent = env.bindEvent(this.ref);
74
+ }
75
+
76
+ componentWillUnmount() {
77
+ this.unbindEvent?.();
78
+ }
79
+
80
+ getWrappedInstance() {
81
+ return this.ref;
82
+ }
83
+
84
+ async triggerEvent(
85
+ e: React.MouseEvent<any>,
86
+ data: any
87
+ ): Promise<RendererEvent<any> | undefined> {
88
+ return await this.props.env.dispatchEvent(e, this.ref, data);
89
+ }
90
+
91
+ @autobind
92
+ childRef(ref: any) {
93
+ while (ref && ref.getWrappedInstance) {
94
+ ref = ref.getWrappedInstance();
95
+ }
96
+
97
+ this.ref = ref;
98
+ }
99
+
100
+ render() {
101
+ const {component: Component, ...rest} = this.props;
102
+ return (
103
+ <Component
104
+ ref={this.childRef}
105
+ {...rest}
106
+ scoped={this.context}
107
+ dispatchEvent={this.triggerEvent}
108
+ />
109
+ );
110
+ }
111
+ }
112
+
53
113
  export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
54
114
  static displayName: string = 'Renderer';
55
115
 
@@ -300,7 +360,6 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
300
360
  ...restSchema
301
361
  } = schema;
302
362
  const Component = renderer.component;
303
-
304
363
  // 原来表单项的 visible: false 和 hidden: true 表单项的值和验证是有效的
305
364
  // 而 visibleOn 和 hiddenOn 是无效的,
306
365
  // 这个本来就是个bug,但是已经被广泛使用了
@@ -315,8 +374,8 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
315
374
  return null;
316
375
  }
317
376
 
318
- return (
319
- <Component
377
+ const component = (
378
+ <BroadcastCmpt
320
379
  {...theme.getRendererConfig(renderer.name)}
321
380
  {...restSchema}
322
381
  {...chainEvents(rest, restSchema)}
@@ -329,8 +388,15 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
329
388
  $schema={{...schema, ...exprProps}}
330
389
  ref={this.refFn}
331
390
  render={this.renderChild}
391
+ component={Component}
332
392
  />
333
393
  );
394
+
395
+ return enableAMISDebug ? (
396
+ <DebugWrapper renderer={renderer}>{component}</DebugWrapper>
397
+ ) : (
398
+ component
399
+ );
334
400
  }
335
401
  }
336
402
 
package/src/Scoped.tsx CHANGED
@@ -8,7 +8,15 @@ import find from 'lodash/find';
8
8
  import hoistNonReactStatic from 'hoist-non-react-statics';
9
9
  import {dataMapping} from './utils/tpl-builtin';
10
10
  import {RendererEnv, RendererProps} from './factory';
11
- import {noop, autobind, qsstringify, qsparse} from './utils/helper';
11
+ import {
12
+ noop,
13
+ autobind,
14
+ qsstringify,
15
+ qsparse,
16
+ createObject,
17
+ findTree,
18
+ TreeItem
19
+ } from './utils/helper';
12
20
  import {RendererData, Action} from './types';
13
21
 
14
22
  export interface ScopedComponentType extends React.Component<RendererProps> {
@@ -29,9 +37,11 @@ export interface ScopedComponentType extends React.Component<RendererProps> {
29
37
 
30
38
  export interface IScopedContext {
31
39
  parent?: AliasIScopedContext;
40
+ children?: AliasIScopedContext[];
32
41
  registerComponent: (component: ScopedComponentType) => void;
33
42
  unRegisterComponent: (component: ScopedComponentType) => void;
34
43
  getComponentByName: (name: string) => ScopedComponentType;
44
+ getComponentById: (id: string) => ScopedComponentType | undefined;
35
45
  getComponents: () => Array<ScopedComponentType>;
36
46
  reload: (target: string, ctx: RendererData) => void;
37
47
  send: (target: string, ctx: RendererData) => void;
@@ -46,8 +56,7 @@ function createScopedTools(
46
56
  env?: RendererEnv
47
57
  ): IScopedContext {
48
58
  const components: Array<ScopedComponentType> = [];
49
-
50
- return {
59
+ const self = {
51
60
  parent,
52
61
  registerComponent(component: ScopedComponentType) {
53
62
  // 不要把自己注册在自己的 Scoped 上,自己的 Scoped 是给子节点们注册的。
@@ -80,7 +89,7 @@ function createScopedTools(
80
89
 
81
90
  return paths.reduce((scope, name, idx) => {
82
91
  if (scope && scope.getComponentByName) {
83
- const result = scope.getComponentByName(name);
92
+ const result: ScopedComponentType = scope.getComponentByName(name);
84
93
  return result && idx < len - 1 ? result.context : result;
85
94
  }
86
95
 
@@ -96,6 +105,27 @@ function createScopedTools(
96
105
  return resolved || (parent && parent.getComponentByName(name));
97
106
  },
98
107
 
108
+ getComponentById(id: string) {
109
+ let root: AliasIScopedContext = this;
110
+ // 找到顶端scoped
111
+ while (root.parent) {
112
+ root = root.parent;
113
+ }
114
+
115
+ // 向下查找
116
+ let component = undefined;
117
+ findTree([root], (item: TreeItem) =>
118
+ item.getComponents().find((cmpt: ScopedComponentType) => {
119
+ if (cmpt.props.id === id) {
120
+ component = cmpt;
121
+ return true;
122
+ }
123
+ return false;
124
+ })
125
+ ) as ScopedComponentType | undefined;
126
+ return component;
127
+ },
128
+
99
129
  getComponents() {
100
130
  return components.concat();
101
131
  },
@@ -208,6 +238,17 @@ function createScopedTools(
208
238
  }
209
239
  }
210
240
  };
241
+
242
+ if (!parent) {
243
+ return self;
244
+ }
245
+
246
+ !parent.children && (parent.children = []);
247
+
248
+ // 把孩子带上
249
+ parent.children!.push(self);
250
+
251
+ return self;
211
252
  }
212
253
 
213
254
  function closeDialog(component: ScopedComponentType) {
@@ -257,6 +298,7 @@ export function HocScoped<
257
298
  context,
258
299
  this.props.env
259
300
  );
301
+
260
302
  const scopeRef = props.scopeRef;
261
303
  scopeRef && scopeRef(this.scoped);
262
304
  }
@@ -0,0 +1,138 @@
1
+ import {extendObject} from '../utils/helper';
2
+ import {RendererEvent} from '../utils/renderer-event';
3
+ import {evalExpression} from '../utils/tpl';
4
+ import {dataMapping} from '../utils/tpl-builtin';
5
+
6
+ // 逻辑动作类型,支持并行、排他(switch)、循环(支持continue和break)
7
+ type LogicActionType = 'parallel' | 'switch' | 'loop' | 'continue' | 'break';
8
+
9
+ // 循环动作执行状态
10
+ export enum LoopStatus {
11
+ NORMAL,
12
+ BREAK,
13
+ CONTINUE
14
+ }
15
+
16
+ // 监听器动作定义
17
+ export interface ListenerAction {
18
+ actionType: 'broadcast' | LogicActionType | 'custom' | string; // 动作类型 逻辑动作|自定义(脚本支撑)|reload|url|ajax|dialog|drawer 其他扩充的组件动作
19
+ eventName?: string; // 事件名称,actionType: broadcast
20
+ description?: string; // 事件描述,actionType: broadcast
21
+ componentId?: string; // 组件ID,用于直接执行指定组件的动作
22
+ args?: any; // 参数,可以配置数据映射
23
+ preventDefault?: boolean; // 阻止原有组件的动作行为
24
+ stopPropagation?: boolean; // 阻止后续的事件处理器执行
25
+ execOn?: string; // 执行条件
26
+ script?: string; // 自定义JS,actionType: custom
27
+ [propName: string]: any; // 扩展各种Action
28
+ }
29
+
30
+ export interface LogicAction extends ListenerAction {
31
+ children?: ListenerAction[]; // 子动作
32
+ }
33
+
34
+ export interface ListenerContext {
35
+ [propName: string]: any;
36
+ }
37
+
38
+ // Action 基础接口
39
+ export interface Action {
40
+ // 运行这个 Action,每个类型的 Action 都只有一个实例,run 函数是个可重入的函数
41
+ run: (
42
+ action: ListenerAction,
43
+ renderer: ListenerContext,
44
+ event: RendererEvent<any>,
45
+ mergeData?: any // 有些Action内部需要通过上下文数据处理专有逻辑,这里的数据是事件数据+渲染器数据
46
+ ) => Promise<void>;
47
+ }
48
+
49
+ // 存储 Action 和类型的映射关系,用于后续查找
50
+ const ActionTypeMap: {[key: string]: Action} = {};
51
+
52
+ // 注册 Action
53
+ export const registerAction = (type: string, action: Action) => {
54
+ ActionTypeMap[type] = action;
55
+ };
56
+
57
+ // 通过类型获取 Action 实例
58
+ export const getActionByType = (type: string) => {
59
+ return ActionTypeMap[type];
60
+ };
61
+
62
+ export const runActions = async (
63
+ actions: ListenerAction | ListenerAction[],
64
+ renderer: ListenerContext,
65
+ event: any
66
+ ) => {
67
+ if (!Array.isArray(actions)) {
68
+ actions = [actions];
69
+ }
70
+
71
+ for (const actionConfig of actions) {
72
+ let actionInstrance = getActionByType(actionConfig.actionType);
73
+
74
+ // 如果存在指定组件ID,说明是组件专有动作
75
+ if (actionConfig.componentId) {
76
+ actionInstrance = getActionByType('component');
77
+ } else if (
78
+ actionConfig.actionType === 'url' ||
79
+ actionConfig.actionType === 'link' ||
80
+ actionConfig.actionType === 'jump'
81
+ ) {
82
+ // 打开页面动作
83
+ actionInstrance = getActionByType('openpage');
84
+ }
85
+
86
+ // 找不到就通过组件专有动作完成
87
+ if (!actionInstrance) {
88
+ actionInstrance = getActionByType('component');
89
+ }
90
+
91
+ // 这些节点的子节点运行逻辑由节点内部实现
92
+ await runAction(actionInstrance, actionConfig, renderer, event);
93
+
94
+ if (event.stoped) {
95
+ break;
96
+ }
97
+ }
98
+ };
99
+
100
+ // 执行动作,与原有动作处理打通
101
+ export const runAction = async (
102
+ actionInstrance: Action,
103
+ actionConfig: ListenerAction,
104
+ renderer: ListenerContext,
105
+ event: any
106
+ ) => {
107
+ // 用户可能,需要用到事件数据和当前域的数据,因此merge事件数据和当前渲染器数据
108
+ // 需要保持渲染器数据链完整
109
+ const mergeData = extendObject(renderer.props.data, {
110
+ event
111
+ });
112
+
113
+ if (actionConfig.execOn && !evalExpression(actionConfig.execOn, mergeData)) {
114
+ return;
115
+ }
116
+
117
+ // 修正参数,处理数据映射
118
+ let args = event.data;
119
+
120
+ if (actionConfig.args) {
121
+ args = dataMapping(actionConfig.args, mergeData);
122
+ }
123
+
124
+ await actionInstrance.run(
125
+ {
126
+ ...actionConfig,
127
+ args
128
+ },
129
+ renderer,
130
+ event,
131
+ mergeData
132
+ );
133
+
134
+ // 阻止原有动作执行
135
+ actionConfig.preventDefault && event.preventDefault();
136
+ // 阻止后续动作执行
137
+ actionConfig.stopPropagation && event.stopPropagation();
138
+ };
@@ -0,0 +1,58 @@
1
+ import {IRootStore} from '../store/root';
2
+ import {isVisible} from '../utils/helper';
3
+ import {RendererEvent} from '../utils/renderer-event';
4
+ import {filter} from '../utils/tpl';
5
+ import {
6
+ Action,
7
+ ListenerAction,
8
+ ListenerContext,
9
+ registerAction
10
+ } from './Action';
11
+
12
+ /**
13
+ * 发送请求动作
14
+ *
15
+ * @export
16
+ * @class AjaxAction
17
+ * @implements {Action}
18
+ */
19
+ export class AjaxAction implements Action {
20
+ async run(
21
+ action: ListenerAction,
22
+ renderer: ListenerContext,
23
+ event: RendererEvent<any>
24
+ ) {
25
+ const store = renderer.props.store;
26
+
27
+ store.setCurrentAction(action);
28
+ store
29
+ .saveRemote(action.api as string, action.args, {
30
+ successMessage: action.messages && action.messages.success,
31
+ errorMessage: action.messages && action.messages.failed
32
+ })
33
+ .then(async () => {
34
+ if (action.feedback && isVisible(action.feedback, store.data)) {
35
+ await this.openFeedback(action.feedback, store);
36
+ }
37
+
38
+ const redirect = action.redirect && filter(action.redirect, store.data);
39
+ redirect && renderer.env.jumpTo(redirect, action);
40
+ })
41
+ .catch(() => {});
42
+ }
43
+
44
+ openFeedback(dialog: any, store: IRootStore) {
45
+ return new Promise(resolve => {
46
+ store.setCurrentAction({
47
+ type: 'button',
48
+ actionType: 'dialog',
49
+ dialog: dialog
50
+ });
51
+ store.openDialog(store.data, undefined, confirmed => {
52
+ resolve(confirmed);
53
+ });
54
+ });
55
+ }
56
+ }
57
+
58
+ registerAction('ajax', new AjaxAction());
@@ -0,0 +1,27 @@
1
+ import {RendererEvent} from '../utils/renderer-event';
2
+ import {
3
+ Action,
4
+ ListenerAction,
5
+ ListenerContext,
6
+ LoopStatus,
7
+ registerAction
8
+ } from './Action';
9
+
10
+ /**
11
+ * breach
12
+ *
13
+ * @export
14
+ * @class BreakAction
15
+ * @implements {Action}
16
+ */
17
+ export class BreakAction implements Action {
18
+ async run(
19
+ action: ListenerAction,
20
+ renderer: ListenerContext,
21
+ event: RendererEvent<any>
22
+ ) {
23
+ renderer.loopStatus = LoopStatus.BREAK;
24
+ }
25
+ }
26
+
27
+ registerAction('break', new BreakAction());
@@ -0,0 +1,41 @@
1
+ import {createObject} from '../utils/helper';
2
+ import {RendererEvent} from '../utils/renderer-event';
3
+ import {
4
+ Action,
5
+ ListenerAction,
6
+ ListenerContext,
7
+ registerAction
8
+ } from './Action';
9
+
10
+ /**
11
+ * broadcast
12
+ *
13
+ * @export
14
+ * @class BroadcastAction
15
+ * @implements {Action}
16
+ */
17
+ export class BroadcastAction implements Action {
18
+ async run(
19
+ action: ListenerAction,
20
+ renderer: ListenerContext,
21
+ event: RendererEvent<any>
22
+ ) {
23
+ if (!action.eventName) {
24
+ console.warn('eventName 未定义,请定义事件名称');
25
+ return;
26
+ }
27
+
28
+ // 作为一个新的事件,需要把广播动作的args参数追加到事件数据中
29
+ event.setData(createObject(event.data, action.args));
30
+
31
+ // 直接触发对应的动作
32
+ return await event.context.env.dispatchEvent(
33
+ action.eventName,
34
+ renderer,
35
+ action.args,
36
+ event
37
+ );
38
+ }
39
+ }
40
+
41
+ registerAction('broadcast', new BroadcastAction());
@@ -0,0 +1,36 @@
1
+ import {RendererEvent} from '../utils/renderer-event';
2
+ import {dataMapping} from '../utils/tpl-builtin';
3
+ import {
4
+ Action,
5
+ ListenerAction,
6
+ ListenerContext,
7
+ LoopStatus,
8
+ registerAction
9
+ } from './Action';
10
+
11
+ /**
12
+ * 组件动作
13
+ *
14
+ * @export
15
+ * @class CmptAction
16
+ * @implements {Action}
17
+ */
18
+ export class CmptAction implements Action {
19
+ async run(
20
+ action: ListenerAction,
21
+ renderer: ListenerContext,
22
+ event: RendererEvent<any>
23
+ ) {
24
+ // 根据唯一ID查找指定组件
25
+ const component =
26
+ renderer.props.$schema.id !== action.componentId
27
+ ? renderer.props.scoped?.getComponentById(action.componentId)
28
+ : renderer;
29
+
30
+ // 执行组件动作
31
+ (await component.props.onAction?.(event, action, action.args)) ||
32
+ component.doAction?.(action, action.args);
33
+ }
34
+ }
35
+
36
+ registerAction('component', new CmptAction());
@@ -0,0 +1,27 @@
1
+ import {RendererEvent} from '../utils/renderer-event';
2
+ import {
3
+ Action,
4
+ ListenerAction,
5
+ ListenerContext,
6
+ LoopStatus,
7
+ registerAction
8
+ } from './Action';
9
+
10
+ /**
11
+ * continue
12
+ *
13
+ * @export
14
+ * @class ContinueAction
15
+ * @implements {Action}
16
+ */
17
+ export class ContinueAction implements Action {
18
+ async run(
19
+ action: ListenerAction,
20
+ renderer: ListenerContext,
21
+ event: RendererEvent<any>
22
+ ) {
23
+ renderer.loopStatus = LoopStatus.CONTINUE;
24
+ }
25
+ }
26
+
27
+ registerAction('continue', new ContinueAction());
@@ -0,0 +1,41 @@
1
+ import {RendererEvent} from '../utils/renderer-event';
2
+ import {dataMapping} from '../utils/tpl-builtin';
3
+ import {filter} from '../utils/tpl';
4
+ import pick from 'lodash/pick';
5
+ import mapValues from 'lodash/mapValues';
6
+ import qs from 'qs';
7
+ import {
8
+ Action,
9
+ ListenerAction,
10
+ ListenerContext,
11
+ LoopStatus,
12
+ registerAction
13
+ } from './Action';
14
+ import {isVisible} from '../utils/helper';
15
+
16
+ /**
17
+ * 复制动作
18
+ *
19
+ * @export
20
+ * @class CopyAction
21
+ * @implements {Action}
22
+ */
23
+ export class CopyAction implements Action {
24
+ async run(
25
+ action: ListenerAction,
26
+ renderer: ListenerContext,
27
+ event: RendererEvent<any>
28
+ ) {
29
+ debugger;
30
+ if (action.content || action.copy) {
31
+ renderer.props.env.copy?.(
32
+ filter(action.content || action.copy, action.args, '| raw'),
33
+ {
34
+ format: action.copyFormat
35
+ }
36
+ );
37
+ }
38
+ }
39
+ }
40
+
41
+ registerAction('copy', new CopyAction());