amis 1.9.0-beta.12 → 1.9.0-beta.15

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 (365) hide show
  1. package/lib/Schema.d.ts +4 -2
  2. package/lib/Schema.js.map +1 -1
  3. package/lib/SchemaRenderer.d.ts +2 -2
  4. package/lib/SchemaRenderer.js +3 -3
  5. package/lib/SchemaRenderer.js.map +2 -2
  6. package/lib/actions/Action.d.ts +8 -6
  7. package/lib/actions/Action.js.map +2 -2
  8. package/lib/actions/AjaxAction.d.ts +10 -7
  9. package/lib/actions/AjaxAction.js +27 -21
  10. package/lib/actions/AjaxAction.js.map +2 -2
  11. package/lib/actions/BreakAction.d.ts +2 -2
  12. package/lib/actions/BreakAction.js.map +1 -1
  13. package/lib/actions/BroadcastAction.d.ts +3 -3
  14. package/lib/actions/BroadcastAction.js +3 -2
  15. package/lib/actions/BroadcastAction.js.map +2 -2
  16. package/lib/actions/CmptAction.d.ts +2 -2
  17. package/lib/actions/CmptAction.js +7 -9
  18. package/lib/actions/CmptAction.js.map +2 -2
  19. package/lib/actions/ContinueAction.d.ts +2 -2
  20. package/lib/actions/ContinueAction.js.map +1 -1
  21. package/lib/actions/CopyAction.d.ts +7 -4
  22. package/lib/actions/CopyAction.js +8 -6
  23. package/lib/actions/CopyAction.js.map +2 -2
  24. package/lib/actions/CustomAction.d.ts +2 -2
  25. package/lib/actions/CustomAction.js.map +1 -1
  26. package/lib/actions/DialogAction.d.ts +14 -8
  27. package/lib/actions/DialogAction.js +6 -6
  28. package/lib/actions/DialogAction.js.map +2 -2
  29. package/lib/actions/DrawerAction.d.ts +3 -3
  30. package/lib/actions/DrawerAction.js.map +1 -1
  31. package/lib/actions/EmailAction.d.ts +10 -7
  32. package/lib/actions/EmailAction.js +4 -5
  33. package/lib/actions/EmailAction.js.map +2 -2
  34. package/lib/actions/LinkAction.d.ts +19 -11
  35. package/lib/actions/LinkAction.js +6 -5
  36. package/lib/actions/LinkAction.js.map +2 -2
  37. package/lib/actions/LoopAction.d.ts +6 -3
  38. package/lib/actions/LoopAction.js +22 -20
  39. package/lib/actions/LoopAction.js.map +2 -2
  40. package/lib/actions/PageAction.d.ts +8 -5
  41. package/lib/actions/PageAction.js +3 -2
  42. package/lib/actions/PageAction.js.map +2 -2
  43. package/lib/actions/ParallelAction.d.ts +2 -2
  44. package/lib/actions/ParallelAction.js.map +1 -1
  45. package/lib/actions/SwitchAction.d.ts +2 -2
  46. package/lib/actions/SwitchAction.js.map +1 -1
  47. package/lib/actions/ToastAction.d.ts +2 -2
  48. package/lib/actions/ToastAction.js +6 -4
  49. package/lib/actions/ToastAction.js.map +2 -2
  50. package/lib/components/Editor.d.ts +84 -84
  51. package/lib/components/InputBox.js +1 -1
  52. package/lib/components/InputBox.js.map +2 -2
  53. package/lib/components/Pagination.d.ts +1175 -0
  54. package/lib/components/Pagination.js +274 -0
  55. package/lib/components/Pagination.js.map +13 -0
  56. package/lib/components/PickerContainer.d.ts +1 -0
  57. package/lib/components/PickerContainer.js +3 -2
  58. package/lib/components/PickerContainer.js.map +2 -2
  59. package/lib/components/Rating.js +11 -9
  60. package/lib/components/Rating.js.map +2 -2
  61. package/lib/components/Select.js +3 -3
  62. package/lib/components/Select.js.map +2 -2
  63. package/lib/components/Tag.d.ts +148 -0
  64. package/lib/components/Tag.js +96 -0
  65. package/lib/components/Tag.js.map +13 -0
  66. package/lib/components/TooltipWrapper.d.ts +25 -21
  67. package/lib/components/TooltipWrapper.js +11 -1
  68. package/lib/components/TooltipWrapper.js.map +2 -2
  69. package/lib/components/TransferDropDown.d.ts +85 -84
  70. package/lib/components/TransferDropDown.js +2 -2
  71. package/lib/components/TransferDropDown.js.map +2 -2
  72. package/lib/components/Tree.d.ts +84 -84
  73. package/lib/components/formula/VariableList.d.ts +1 -0
  74. package/lib/components/formula/VariableList.js.map +2 -2
  75. package/lib/components/icons.js +2 -0
  76. package/lib/components/icons.js.map +2 -2
  77. package/lib/components/index.d.ts +4 -1
  78. package/lib/components/index.js +7 -1
  79. package/lib/components/index.js.map +2 -2
  80. package/lib/components/schema-editor/Array.d.ts +11 -0
  81. package/lib/components/schema-editor/Array.js +66 -0
  82. package/lib/components/schema-editor/Array.js.map +13 -0
  83. package/lib/components/schema-editor/Common.d.ts +29 -0
  84. package/lib/components/schema-editor/Common.js +69 -0
  85. package/lib/components/schema-editor/Common.js.map +13 -0
  86. package/lib/components/schema-editor/Item.d.ts +9 -0
  87. package/lib/components/schema-editor/Item.js +31 -0
  88. package/lib/components/schema-editor/Item.js.map +13 -0
  89. package/lib/components/schema-editor/Object.d.ts +44 -0
  90. package/lib/components/schema-editor/Object.js +191 -0
  91. package/lib/components/schema-editor/Object.js.map +13 -0
  92. package/lib/components/schema-editor/SchemaVariableList.d.ts +316 -0
  93. package/lib/components/schema-editor/SchemaVariableList.js +74 -0
  94. package/lib/components/schema-editor/SchemaVariableList.js.map +13 -0
  95. package/lib/components/schema-editor/SchemaVariableListPicker.d.ts +305 -0
  96. package/lib/components/schema-editor/SchemaVariableListPicker.js +32 -0
  97. package/lib/components/schema-editor/SchemaVariableListPicker.js.map +13 -0
  98. package/lib/components/schema-editor/index.d.ts +520 -0
  99. package/lib/components/schema-editor/index.js +118 -0
  100. package/lib/components/schema-editor/index.js.map +13 -0
  101. package/lib/components/table/Cell.d.ts +930 -0
  102. package/lib/components/table/Cell.js +36 -0
  103. package/lib/components/table/Cell.js.map +13 -0
  104. package/lib/components/table/HeadCellDropDown.d.ts +514 -0
  105. package/lib/components/table/HeadCellDropDown.js +52 -0
  106. package/lib/components/table/HeadCellDropDown.js.map +13 -0
  107. package/lib/components/table/HeadCellFilter.d.ts +771 -0
  108. package/lib/components/table/HeadCellFilter.js +106 -0
  109. package/lib/components/table/HeadCellFilter.js.map +13 -0
  110. package/lib/components/table/HeadCellSelect.d.ts +672 -0
  111. package/lib/components/table/HeadCellSelect.js +46 -0
  112. package/lib/components/table/HeadCellSelect.js.map +13 -0
  113. package/lib/components/table/HeadCellSort.d.ts +498 -0
  114. package/lib/components/table/HeadCellSort.js +67 -0
  115. package/lib/components/table/HeadCellSort.js.map +13 -0
  116. package/lib/components/table/index.d.ts +1355 -0
  117. package/lib/components/table/index.js +1095 -0
  118. package/lib/components/table/index.js.map +13 -0
  119. package/lib/env.d.ts +2 -4
  120. package/lib/env.js.map +2 -2
  121. package/lib/factory.js +0 -95
  122. package/lib/factory.js.map +2 -2
  123. package/lib/icons/dot.js +11 -0
  124. package/lib/index.d.ts +6 -1
  125. package/lib/index.js +9 -2
  126. package/lib/index.js.map +2 -2
  127. package/lib/locale/de-DE.js +18 -1
  128. package/lib/locale/de-DE.js.map +2 -2
  129. package/lib/locale/en-US.js +18 -1
  130. package/lib/locale/en-US.js.map +2 -2
  131. package/lib/locale/zh-CN.js +20 -1
  132. package/lib/locale/zh-CN.js.map +2 -2
  133. package/lib/renderers/Action.js +0 -2
  134. package/lib/renderers/Action.js.map +2 -2
  135. package/lib/renderers/Carousel.d.ts +5 -1
  136. package/lib/renderers/Carousel.js +18 -5
  137. package/lib/renderers/Carousel.js.map +2 -2
  138. package/lib/renderers/Form/ButtonGroupSelect.d.ts +2 -0
  139. package/lib/renderers/Form/ButtonGroupSelect.js +7 -0
  140. package/lib/renderers/Form/ButtonGroupSelect.js.map +2 -2
  141. package/lib/renderers/Form/Checkbox.js +3 -4
  142. package/lib/renderers/Form/Checkbox.js.map +2 -2
  143. package/lib/renderers/Form/Checkboxes.d.ts +2 -1
  144. package/lib/renderers/Form/Checkboxes.js +19 -14
  145. package/lib/renderers/Form/Checkboxes.js.map +2 -2
  146. package/lib/renderers/Form/Combo.js +23 -4
  147. package/lib/renderers/Form/Combo.js.map +2 -2
  148. package/lib/renderers/Form/DiffEditor.d.ts +126 -18
  149. package/lib/renderers/Form/Editor.d.ts +412 -112
  150. package/lib/renderers/Form/Editor.js +10 -1
  151. package/lib/renderers/Form/Editor.js.map +2 -2
  152. package/lib/renderers/Form/InputExcel.js +6 -1
  153. package/lib/renderers/Form/InputExcel.js.map +2 -2
  154. package/lib/renderers/Form/InputFile.js +1 -2
  155. package/lib/renderers/Form/InputFile.js.map +2 -2
  156. package/lib/renderers/Form/InputTree.js +1 -1
  157. package/lib/renderers/Form/InputTree.js.map +2 -2
  158. package/lib/renderers/Form/Item.d.ts +0 -6
  159. package/lib/renderers/Form/JSONSchemaEditor.d.ts +41 -0
  160. package/lib/renderers/Form/JSONSchemaEditor.js +33 -0
  161. package/lib/renderers/Form/JSONSchemaEditor.js.map +13 -0
  162. package/lib/renderers/Form/ListSelect.d.ts +2 -0
  163. package/lib/renderers/Form/ListSelect.js +7 -0
  164. package/lib/renderers/Form/ListSelect.js.map +2 -2
  165. package/lib/renderers/Form/Options.js +1 -0
  166. package/lib/renderers/Form/Options.js.map +2 -2
  167. package/lib/renderers/Form/Select.js +12 -1
  168. package/lib/renderers/Form/Select.js.map +2 -2
  169. package/lib/renderers/Form/TabsTransfer.d.ts +1 -1
  170. package/lib/renderers/Form/TabsTransfer.js +2 -2
  171. package/lib/renderers/Form/TabsTransfer.js.map +2 -2
  172. package/lib/renderers/Form/TreeSelect.d.ts +4 -0
  173. package/lib/renderers/Form/TreeSelect.js +2 -2
  174. package/lib/renderers/Form/TreeSelect.js.map +2 -2
  175. package/lib/renderers/Form/wrapControl.js +10 -5
  176. package/lib/renderers/Form/wrapControl.js.map +2 -2
  177. package/lib/renderers/Pagination.d.ts +49 -30
  178. package/lib/renderers/Pagination.js +3 -132
  179. package/lib/renderers/Pagination.js.map +2 -2
  180. package/lib/renderers/Table/HeadCellSearchDropdown.js +0 -1
  181. package/lib/renderers/Table/HeadCellSearchDropdown.js.map +2 -2
  182. package/lib/renderers/Table-v2/HeadCellSearchDropdown.d.ts +29 -0
  183. package/lib/renderers/Table-v2/HeadCellSearchDropdown.js +158 -0
  184. package/lib/renderers/Table-v2/HeadCellSearchDropdown.js.map +13 -0
  185. package/lib/renderers/Table-v2/TableCell.d.ts +6 -0
  186. package/lib/renderers/Table-v2/TableCell.js +28 -0
  187. package/lib/renderers/Table-v2/TableCell.js.map +13 -0
  188. package/lib/renderers/Table-v2/index.d.ts +256 -0
  189. package/lib/renderers/Table-v2/index.js +548 -0
  190. package/lib/renderers/Table-v2/index.js.map +13 -0
  191. package/lib/renderers/Tabs.js +1 -1
  192. package/lib/renderers/Tabs.js.map +2 -2
  193. package/lib/renderers/Tag.d.ts +66 -0
  194. package/lib/renderers/Tag.js +53 -0
  195. package/lib/renderers/Tag.js.map +13 -0
  196. package/lib/renderers/Wizard.js +3 -3
  197. package/lib/renderers/Wizard.js.map +2 -2
  198. package/lib/schemaExtend.js +24 -30
  199. package/lib/schemaExtend.js.map +2 -2
  200. package/lib/store/combo.d.ts +140 -20
  201. package/lib/store/form.d.ts +56 -8
  202. package/lib/store/formItem.d.ts +3 -1
  203. package/lib/store/formItem.js +3 -1
  204. package/lib/store/formItem.js.map +2 -2
  205. package/lib/store/index.js +2 -0
  206. package/lib/store/index.js.map +2 -2
  207. package/lib/store/table-v2.d.ts +308 -0
  208. package/lib/store/table-v2.js +452 -0
  209. package/lib/store/table-v2.js.map +13 -0
  210. package/lib/store/table.d.ts +112 -16
  211. package/lib/store/table.js +1 -1
  212. package/lib/store/table.js.map +2 -2
  213. package/lib/themes/ang-ie11.css +1686 -120
  214. package/lib/themes/ang.css +1807 -208
  215. package/lib/themes/ang.css.map +1 -1
  216. package/lib/themes/antd-ie11.css +1667 -101
  217. package/lib/themes/antd.css +1789 -201
  218. package/lib/themes/antd.css.map +1 -1
  219. package/lib/themes/cxd-ie11.css +1662 -97
  220. package/lib/themes/cxd.css +1983 -394
  221. package/lib/themes/cxd.css.map +1 -1
  222. package/lib/themes/dark-ie11.css +1667 -101
  223. package/lib/themes/dark.css +1789 -201
  224. package/lib/themes/dark.css.map +1 -1
  225. package/lib/themes/default-ie11.css +1662 -97
  226. package/lib/themes/default.css +1983 -394
  227. package/lib/themes/default.css.map +1 -1
  228. package/lib/utils/DataSchema.d.ts +25 -0
  229. package/lib/utils/DataSchema.js +104 -0
  230. package/lib/utils/DataSchema.js.map +13 -0
  231. package/lib/utils/DataScope.d.ts +23 -0
  232. package/lib/utils/DataScope.js +140 -0
  233. package/lib/utils/DataScope.js.map +13 -0
  234. package/lib/utils/handleAction.js +1 -1
  235. package/lib/utils/handleAction.js.map +2 -2
  236. package/lib/utils/renderer-event.d.ts +8 -2
  237. package/lib/utils/renderer-event.js +102 -1
  238. package/lib/utils/renderer-event.js.map +2 -2
  239. package/package.json +3 -2
  240. package/schema.json +1476 -469
  241. package/scss/_properties.scss +69 -0
  242. package/scss/components/_button.scss +37 -39
  243. package/scss/components/_context-menu.scss +3 -18
  244. package/scss/components/_json-schema-editor.scss +126 -0
  245. package/scss/components/_pagination.scss +104 -23
  246. package/scss/components/_result-box.scss +2 -2
  247. package/scss/components/_table-v2.scss +912 -0
  248. package/scss/components/_tag.scss +177 -0
  249. package/scss/components/form/_selection.scss +1 -14
  250. package/scss/components/form/_text.scss +1 -1
  251. package/scss/themes/_antd-variables.scss +0 -13
  252. package/scss/themes/_common.scss +3 -0
  253. package/scss/themes/_cxd-variables.scss +7 -17
  254. package/scss/themes/_dark-variables.scss +0 -13
  255. package/scss/themes/cxd.scss +1 -1
  256. package/sdk/ang-ie11.css +2240 -227
  257. package/sdk/ang.css +2905 -859
  258. package/sdk/antd-ie11.css +2233 -220
  259. package/sdk/antd.css +2905 -870
  260. package/sdk/barcode.js +51 -51
  261. package/sdk/charts.js +14 -14
  262. package/sdk/codemirror.js +7 -7
  263. package/sdk/color-picker.js +65 -65
  264. package/sdk/cropperjs.js +2 -2
  265. package/sdk/cxd-ie11.css +2223 -211
  266. package/sdk/cxd.css +2911 -875
  267. package/sdk/dark-ie11.css +2233 -220
  268. package/sdk/dark.css +2905 -870
  269. package/sdk/exceljs.js +1 -1
  270. package/sdk/locale/de-DE.js +18 -1
  271. package/sdk/markdown.js +69 -69
  272. package/sdk/papaparse.js +1 -1
  273. package/sdk/renderers/Form/CityDB.js +1 -1
  274. package/sdk/rest.js +16 -16
  275. package/sdk/rich-text.js +62 -62
  276. package/sdk/sdk-ie11.css +2223 -211
  277. package/sdk/sdk.css +2911 -875
  278. package/sdk/sdk.js +1326 -1270
  279. package/sdk/thirds/hls.js/hls.js +1 -1
  280. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  281. package/sdk/tinymce.js +57 -57
  282. package/src/Schema.ts +7 -0
  283. package/src/SchemaRenderer.tsx +4 -5
  284. package/src/actions/Action.ts +7 -6
  285. package/src/actions/AjaxAction.ts +33 -24
  286. package/src/actions/BreakAction.ts +2 -2
  287. package/src/actions/BroadcastAction.ts +6 -5
  288. package/src/actions/CmptAction.ts +5 -6
  289. package/src/actions/ContinueAction.ts +2 -2
  290. package/src/actions/CopyAction.ts +14 -8
  291. package/src/actions/CustomAction.ts +2 -2
  292. package/src/actions/DialogAction.ts +16 -10
  293. package/src/actions/DrawerAction.ts +3 -3
  294. package/src/actions/EmailAction.ts +12 -12
  295. package/src/actions/LinkAction.ts +34 -14
  296. package/src/actions/LoopAction.ts +13 -8
  297. package/src/actions/PageAction.ts +9 -6
  298. package/src/actions/ParallelAction.ts +2 -2
  299. package/src/actions/SwitchAction.ts +2 -2
  300. package/src/actions/ToastAction.ts +9 -5
  301. package/src/components/InputBox.tsx +1 -0
  302. package/src/components/Pagination.tsx +446 -0
  303. package/src/components/PickerContainer.tsx +8 -5
  304. package/src/components/Rating.tsx +16 -9
  305. package/src/components/Select.tsx +3 -3
  306. package/src/components/Tag.tsx +179 -0
  307. package/src/components/TooltipWrapper.tsx +14 -1
  308. package/src/components/TransferDropDown.tsx +3 -0
  309. package/src/components/formula/VariableList.tsx +1 -0
  310. package/src/components/icons.tsx +2 -0
  311. package/src/components/index.tsx +7 -1
  312. package/src/components/schema-editor/Array.tsx +95 -0
  313. package/src/components/schema-editor/Common.tsx +138 -0
  314. package/src/components/schema-editor/Item.tsx +36 -0
  315. package/src/components/schema-editor/Object.tsx +299 -0
  316. package/src/components/schema-editor/SchemaVariableList.tsx +97 -0
  317. package/src/components/schema-editor/SchemaVariableListPicker.tsx +66 -0
  318. package/src/components/schema-editor/index.tsx +211 -0
  319. package/src/components/table/Cell.tsx +70 -0
  320. package/src/components/table/HeadCellDropDown.tsx +115 -0
  321. package/src/components/table/HeadCellFilter.tsx +193 -0
  322. package/src/components/table/HeadCellSelect.tsx +86 -0
  323. package/src/components/table/HeadCellSort.tsx +102 -0
  324. package/src/components/table/index.tsx +1681 -0
  325. package/src/env.tsx +7 -14
  326. package/src/factory.tsx +3 -106
  327. package/src/icons/dot.svg +11 -0
  328. package/src/index.tsx +8 -1
  329. package/src/locale/de-DE.ts +18 -1
  330. package/src/locale/en-US.ts +18 -1
  331. package/src/locale/zh-CN.ts +20 -1
  332. package/src/renderers/Action.tsx +1 -1
  333. package/src/renderers/Carousel.tsx +21 -6
  334. package/src/renderers/Form/ButtonGroupSelect.tsx +10 -1
  335. package/src/renderers/Form/Checkbox.tsx +4 -4
  336. package/src/renderers/Form/Checkboxes.tsx +31 -25
  337. package/src/renderers/Form/Combo.tsx +20 -4
  338. package/src/renderers/Form/Editor.tsx +15 -1
  339. package/src/renderers/Form/InputExcel.tsx +6 -1
  340. package/src/renderers/Form/InputFile.tsx +1 -2
  341. package/src/renderers/Form/InputTree.tsx +1 -1
  342. package/src/renderers/Form/JSONSchemaEditor.tsx +67 -0
  343. package/src/renderers/Form/ListSelect.tsx +9 -1
  344. package/src/renderers/Form/Options.tsx +1 -1
  345. package/src/renderers/Form/Select.tsx +7 -0
  346. package/src/renderers/Form/TabsTransfer.tsx +2 -2
  347. package/src/renderers/Form/TreeSelect.tsx +8 -1
  348. package/src/renderers/Form/wrapControl.tsx +11 -5
  349. package/src/renderers/Pagination.tsx +65 -253
  350. package/src/renderers/Table/HeadCellSearchDropdown.tsx +0 -1
  351. package/src/renderers/Table-v2/HeadCellSearchDropdown.tsx +244 -0
  352. package/src/renderers/Table-v2/TableCell.tsx +19 -0
  353. package/src/renderers/Table-v2/index.tsx +1140 -0
  354. package/src/renderers/Tabs.tsx +1 -1
  355. package/src/renderers/Tag.tsx +128 -0
  356. package/src/renderers/Wizard.tsx +3 -3
  357. package/src/schemaExtend.ts +24 -28
  358. package/src/store/formItem.ts +5 -1
  359. package/src/store/index.ts +2 -0
  360. package/src/store/table-v2.ts +646 -0
  361. package/src/store/table.ts +1 -1
  362. package/src/utils/DataSchema.ts +131 -0
  363. package/src/utils/DataScope.ts +190 -0
  364. package/src/utils/handleAction.ts +1 -1
  365. package/src/utils/renderer-event.ts +113 -2
package/src/Schema.ts CHANGED
@@ -117,6 +117,8 @@ import {UUIDControlSchema} from './renderers/Form/UUID';
117
117
  import {FormControlSchema} from './renderers/Form/Control';
118
118
  import {TransferPickerControlSchema} from './renderers/Form/TransferPicker';
119
119
  import {TabsTransferPickerControlSchema} from './renderers/Form/TabsTransferPicker';
120
+ import {JSONSchemaEditorControlSchema} from './renderers/Form/JSONSchemaEditor';
121
+ import {TableSchemaV2} from './renderers/Table-v2';
120
122
 
121
123
  // 每加个类型,这补充一下。
122
124
  export type SchemaType =
@@ -168,6 +170,7 @@ export type SchemaType =
168
170
  | 'static-image' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
169
171
  | 'images'
170
172
  | 'static-images' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
173
+ | 'json-schema-editor'
171
174
  | 'json'
172
175
  | 'static-json' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
173
176
  | 'link'
@@ -198,6 +201,7 @@ export type SchemaType =
198
201
  | 'switch'
199
202
  | 'table'
200
203
  | 'static-table' // 这个几个跟表单项同名,再form下面用必须带前缀 static-
204
+ | 'table-v2'
201
205
  | 'tabs'
202
206
  | 'html'
203
207
  | 'tpl'
@@ -330,6 +334,7 @@ export type SchemaType =
330
334
  | 'table-view'
331
335
  | 'portlet'
332
336
  | 'grid-nav'
337
+ | 'tag'
333
338
 
334
339
  // 原生 input 类型
335
340
  | 'native-date'
@@ -389,6 +394,7 @@ export type SchemaObject =
389
394
  | StatusSchema
390
395
  | SpinnerSchema
391
396
  | TableSchema
397
+ | TableSchemaV2
392
398
  | TabsSchema
393
399
  | TasksSchema
394
400
  | VBoxSchema
@@ -432,6 +438,7 @@ export type SchemaObject =
432
438
  | ImageControlSchema
433
439
  | InputGroupControlSchema
434
440
  | ListControlSchema
441
+ | JSONSchemaEditorControlSchema
435
442
  | LocationControlSchema
436
443
  | UUIDControlSchema
437
444
  | MatrixControlSchema
@@ -20,7 +20,7 @@ import getExprProperties from './utils/filter-schema';
20
20
  import {anyChanged, chainEvents, autobind} from './utils/helper';
21
21
  import {SimpleMap} from './utils/SimpleMap';
22
22
 
23
- import type {RendererEvent} from './utils/renderer-event';
23
+ import {bindEvent, dispatchEvent, RendererEvent} from './utils/renderer-event';
24
24
  import {isAlive} from 'mobx-state-tree';
25
25
  import {reaction} from 'mobx';
26
26
  import {resolveVariableAndFilter} from './utils/tpl-builtin';
@@ -93,9 +93,8 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
93
93
  }
94
94
 
95
95
  componentDidMount() {
96
- const {env} = this.props;
97
96
  // 这里无法区分监听的是不是广播,所以又bind一下,主要是为了绑广播
98
- this.unbindEvent = env.bindEvent(this.cRef);
97
+ this.unbindEvent = bindEvent(this.cRef);
99
98
  }
100
99
 
101
100
  componentWillUnmount() {
@@ -206,8 +205,8 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
206
205
  async dispatchEvent(
207
206
  e: React.MouseEvent<any>,
208
207
  data: any
209
- ): Promise<RendererEvent<any> | undefined> {
210
- return await this.props.env.dispatchEvent(e, this.cRef, this.context, data);
208
+ ): Promise<RendererEvent<any> | void> {
209
+ return await dispatchEvent(e, this.cRef, this.context, data);
211
210
  }
212
211
 
213
212
  renderChild(
@@ -1,3 +1,4 @@
1
+ import {RendererProps} from '../factory';
1
2
  import {extendObject} from '../utils/helper';
2
3
  import {RendererEvent} from '../utils/renderer-event';
3
4
  import {evalExpression} from '../utils/tpl';
@@ -29,26 +30,26 @@ export interface LogicAction extends ListenerAction {
29
30
  children?: ListenerAction[]; // 子动作
30
31
  }
31
32
 
32
- export interface ListenerContext {
33
+ export interface ListenerContext extends React.Component<RendererProps> {
33
34
  [propName: string]: any;
34
35
  }
35
36
 
36
37
  // Action 基础接口
37
- export interface Action {
38
+ export interface RendererAction {
38
39
  // 运行这个 Action,每个类型的 Action 都只有一个实例,run 函数是个可重入的函数
39
40
  run: (
40
41
  action: ListenerAction,
41
42
  renderer: ListenerContext,
42
43
  event: RendererEvent<any>,
43
44
  mergeData?: any // 有些Action内部需要通过上下文数据处理专有逻辑,这里的数据是事件数据+渲染器数据
44
- ) => Promise<void>;
45
+ ) => Promise<RendererEvent<any> | void>;
45
46
  }
46
47
 
47
48
  // 存储 Action 和类型的映射关系,用于后续查找
48
- const ActionTypeMap: {[key: string]: Action} = {};
49
+ const ActionTypeMap: {[key: string]: RendererAction} = {};
49
50
 
50
51
  // 注册 Action
51
- export const registerAction = (type: string, action: Action) => {
52
+ export const registerAction = (type: string, action: RendererAction) => {
52
53
  ActionTypeMap[type] = action;
53
54
  };
54
55
 
@@ -97,7 +98,7 @@ export const runActions = async (
97
98
 
98
99
  // 执行动作,与原有动作处理打通
99
100
  export const runAction = async (
100
- actionInstrance: Action,
101
+ actionInstrance: RendererAction,
101
102
  actionConfig: ListenerAction,
102
103
  renderer: ListenerContext,
103
104
  event: any
@@ -1,23 +1,26 @@
1
+ import omit from 'lodash/omit';
1
2
  import {Api} from '../types';
2
3
  import {normalizeApiResponseData} from '../utils/api';
3
4
  import {ServerError} from '../utils/errors';
4
- import {createObject, isEmpty, isVisible} from '../utils/helper';
5
+ import {createObject, isEmpty} from '../utils/helper';
5
6
  import {RendererEvent} from '../utils/renderer-event';
6
- import {filter} from '../utils/tpl';
7
7
  import {
8
- Action,
8
+ RendererAction,
9
9
  ListenerAction,
10
10
  ListenerContext,
11
11
  registerAction
12
12
  } from './Action';
13
13
 
14
14
  export interface IAjaxAction extends ListenerAction {
15
- api: Api;
16
- messages: {
17
- success: string;
18
- failed: string;
15
+ args: {
16
+ api: Api;
17
+ messages: {
18
+ success: string;
19
+ failed: string;
20
+ };
21
+ options: object;
22
+ [propName: string]: any;
19
23
  };
20
- options: object;
21
24
  }
22
25
 
23
26
  /**
@@ -27,23 +30,27 @@ export interface IAjaxAction extends ListenerAction {
27
30
  * @class AjaxAction
28
31
  * @implements {Action}
29
32
  */
30
- export class AjaxAction implements Action {
33
+ export class AjaxAction implements RendererAction {
31
34
  async run(
32
35
  action: IAjaxAction,
33
36
  renderer: ListenerContext,
34
37
  event: RendererEvent<any>
35
38
  ) {
39
+ if (!renderer.props.env?.fetcher) {
40
+ throw new Error('env.fetcher is required!');
41
+ }
42
+
36
43
  const env = event.context.env;
37
44
  try {
38
45
  const result = await env.fetcher(
39
- action.api as string,
40
- action.args,
41
- action.options ?? {}
46
+ action.args?.api as string,
47
+ omit(action.args ?? {}, ['api', 'options', 'messages']),
48
+ action.args?.options ?? {}
42
49
  );
43
50
 
44
51
  if (!isEmpty(result.data) || result.ok) {
45
52
  const responseData = normalizeApiResponseData(result.data);
46
- // 记录请求返回的数据
53
+ // 记录请求返回的数据
47
54
  event.setData(
48
55
  createObject(
49
56
  event.data,
@@ -58,20 +65,22 @@ export class AjaxAction implements Action {
58
65
 
59
66
  if (!result.ok) {
60
67
  throw new ServerError(
61
- (action.messages && action.messages.failed) ?? result.msg,
68
+ action.args?.messages?.failed ?? result.msg,
62
69
  result
63
70
  );
64
71
  } else {
65
- env.notify(
66
- 'success',
67
- (action.messages && action.messages.success) ?? result.msg,
68
- result.msgTimeout !== undefined
69
- ? {
70
- closeButton: true,
71
- timeout: result.msgTimeout
72
- }
73
- : undefined
74
- );
72
+ const msg = action.args?.messages?.success ?? result.msg;
73
+ msg &&
74
+ env.notify(
75
+ 'success',
76
+ msg,
77
+ result.msgTimeout !== undefined
78
+ ? {
79
+ closeButton: true,
80
+ timeout: result.msgTimeout
81
+ }
82
+ : undefined
83
+ );
75
84
  }
76
85
 
77
86
  return result.data;
@@ -1,6 +1,6 @@
1
1
  import {RendererEvent} from '../utils/renderer-event';
2
2
  import {
3
- Action,
3
+ RendererAction,
4
4
  ListenerAction,
5
5
  ListenerContext,
6
6
  LoopStatus,
@@ -14,7 +14,7 @@ import {
14
14
  * @class BreakAction
15
15
  * @implements {Action}
16
16
  */
17
- export class BreakAction implements Action {
17
+ export class BreakAction implements RendererAction {
18
18
  async run(
19
19
  action: ListenerAction,
20
20
  renderer: ListenerContext,
@@ -1,7 +1,8 @@
1
+ import {RendererProps} from '../factory';
1
2
  import {createObject} from '../utils/helper';
2
- import {RendererEvent} from '../utils/renderer-event';
3
+ import {RendererEvent, dispatchEvent} from '../utils/renderer-event';
3
4
  import {
4
- Action,
5
+ RendererAction,
5
6
  ListenerAction,
6
7
  ListenerContext,
7
8
  registerAction
@@ -18,14 +19,14 @@ export interface IBroadcastAction extends ListenerAction {
18
19
  * @class BroadcastAction
19
20
  * @implements {Action}
20
21
  */
21
- export class BroadcastAction implements Action {
22
+ export class BroadcastAction implements RendererAction {
22
23
  async run(
23
24
  action: IBroadcastAction,
24
25
  renderer: ListenerContext,
25
26
  event: RendererEvent<any>
26
27
  ) {
27
28
  if (!action.eventName) {
28
- console.warn('eventName 未定义,请定义事件名称');
29
+ console.error('eventName 未定义,请定义事件名称');
29
30
  return;
30
31
  }
31
32
 
@@ -33,7 +34,7 @@ export class BroadcastAction implements Action {
33
34
  event.setData(createObject(event.data, action.args));
34
35
 
35
36
  // 直接触发对应的动作
36
- return await event.context.env.dispatchEvent(
37
+ return await dispatchEvent(
37
38
  action.eventName,
38
39
  renderer,
39
40
  event.context.scoped,
@@ -1,7 +1,7 @@
1
1
  import {RendererEvent} from '../utils/renderer-event';
2
2
  import {dataMapping} from '../utils/tpl-builtin';
3
3
  import {
4
- Action,
4
+ RendererAction,
5
5
  ListenerAction,
6
6
  ListenerContext,
7
7
  LoopStatus,
@@ -19,7 +19,7 @@ export interface ICmptAction extends ListenerAction {
19
19
  * @class CmptAction
20
20
  * @implements {Action}
21
21
  */
22
- export class CmptAction implements Action {
22
+ export class CmptAction implements RendererAction {
23
23
  async run(
24
24
  action: ICmptAction,
25
25
  renderer: ListenerContext,
@@ -49,11 +49,10 @@ export class CmptAction implements Action {
49
49
 
50
50
  // 数据更新
51
51
  if (action.actionType === 'setValue') {
52
- const value = dataMapping(action.value, event.data);
53
52
  if (component.setData) {
54
- return component.setData(value);
53
+ return component.setData(action.args?.value);
55
54
  } else {
56
- return component.props.onChange?.(value);
55
+ return component.props.onChange?.(action.args?.value);
57
56
  }
58
57
  }
59
58
 
@@ -63,7 +62,7 @@ export class CmptAction implements Action {
63
62
  }
64
63
 
65
64
  // 执行组件动作
66
- return component.doAction?.(action, action.args);
65
+ return component?.doAction?.(action, action.args);
67
66
  }
68
67
  }
69
68
 
@@ -1,6 +1,6 @@
1
1
  import {RendererEvent} from '../utils/renderer-event';
2
2
  import {
3
- Action,
3
+ RendererAction,
4
4
  ListenerAction,
5
5
  ListenerContext,
6
6
  LoopStatus,
@@ -14,7 +14,7 @@ import {
14
14
  * @class ContinueAction
15
15
  * @implements {Action}
16
16
  */
17
- export class ContinueAction implements Action {
17
+ export class ContinueAction implements RendererAction {
18
18
  async run(
19
19
  action: ListenerAction,
20
20
  renderer: ListenerContext,
@@ -1,16 +1,18 @@
1
1
  import {RendererEvent} from '../utils/renderer-event';
2
2
  import {filter} from '../utils/tpl';
3
3
  import {
4
- Action,
4
+ RendererAction,
5
5
  ListenerAction,
6
6
  ListenerContext,
7
- LoopStatus,
8
7
  registerAction
9
8
  } from './Action';
10
9
 
11
10
  export interface ICopyAction extends ListenerAction {
12
- content: string;
13
- copyFormat?: string;
11
+ args: {
12
+ content: string;
13
+ copyFormat?: string;
14
+ [propName: string]: any;
15
+ };
14
16
  }
15
17
 
16
18
  /**
@@ -20,15 +22,19 @@ export interface ICopyAction extends ListenerAction {
20
22
  * @class CopyAction
21
23
  * @implements {Action}
22
24
  */
23
- export class CopyAction implements Action {
25
+ export class CopyAction implements RendererAction {
24
26
  async run(
25
27
  action: ICopyAction,
26
28
  renderer: ListenerContext,
27
29
  event: RendererEvent<any>
28
30
  ) {
29
- if (action.content) {
30
- renderer.props.env.copy?.(filter(action.content, action.args, '| raw'), {
31
- format: action.copyFormat
31
+ if (!renderer.props.env?.copy) {
32
+ throw new Error('env.copy is required!');
33
+ }
34
+
35
+ if (action.args?.content) {
36
+ renderer.props.env.copy?.(action.args.content, {
37
+ format: action.args?.copyFormat ?? 'text/html'
32
38
  });
33
39
  }
34
40
  }
@@ -1,6 +1,6 @@
1
1
  import {RendererEvent} from '../utils/renderer-event';
2
2
  import {
3
- Action,
3
+ RendererAction,
4
4
  ListenerAction,
5
5
  ListenerContext,
6
6
  LoopStatus,
@@ -18,7 +18,7 @@ export interface ICustomAction extends ListenerAction {
18
18
  * @class CustomAction
19
19
  * @implements {Action}
20
20
  */
21
- export class CustomAction implements Action {
21
+ export class CustomAction implements RendererAction {
22
22
  async run(
23
23
  action: ICustomAction,
24
24
  renderer: ListenerContext,
@@ -1,19 +1,25 @@
1
1
  import {SchemaNode} from '../types';
2
2
  import {RendererEvent} from '../utils/renderer-event';
3
3
  import {
4
- Action,
4
+ RendererAction,
5
5
  ListenerAction,
6
6
  ListenerContext,
7
7
  registerAction
8
8
  } from './Action';
9
9
 
10
10
  export interface IAlertAction extends ListenerAction {
11
- msg: string;
11
+ args: {
12
+ msg: string;
13
+ [propName: string]: any;
14
+ };
12
15
  }
13
16
 
14
17
  export interface IConfirmAction extends ListenerAction {
15
- title: string;
16
- msg: string;
18
+ args: {
19
+ title: string;
20
+ msg: string;
21
+ [propName: string]: any;
22
+ };
17
23
  }
18
24
 
19
25
  export interface IDialogAction extends ListenerAction {
@@ -27,7 +33,7 @@ export interface IDialogAction extends ListenerAction {
27
33
  * @class DialogAction
28
34
  * @implements {Action}
29
35
  */
30
- export class DialogAction implements Action {
36
+ export class DialogAction implements RendererAction {
31
37
  async run(
32
38
  action: IDialogAction,
33
39
  renderer: ListenerContext,
@@ -44,7 +50,7 @@ export class DialogAction implements Action {
44
50
  * @class CloseDialogAction
45
51
  * @implements {Action}
46
52
  */
47
- export class CloseDialogAction implements Action {
53
+ export class CloseDialogAction implements RendererAction {
48
54
  async run(
49
55
  action: ListenerAction,
50
56
  renderer: ListenerContext,
@@ -70,26 +76,26 @@ export class CloseDialogAction implements Action {
70
76
  /**
71
77
  * alert提示动作
72
78
  */
73
- export class AlertAction implements Action {
79
+ export class AlertAction implements RendererAction {
74
80
  async run(
75
81
  action: IAlertAction,
76
82
  renderer: ListenerContext,
77
83
  event: RendererEvent<any>
78
84
  ) {
79
- event.context.env.alert?.(action.msg);
85
+ event.context.env.alert?.(action.args?.msg);
80
86
  }
81
87
  }
82
88
 
83
89
  /**
84
90
  * confirm确认提示动作
85
91
  */
86
- export class ConfirmAction implements Action {
92
+ export class ConfirmAction implements RendererAction {
87
93
  async run(
88
94
  action: IConfirmAction,
89
95
  renderer: ListenerContext,
90
96
  event: RendererEvent<any>
91
97
  ) {
92
- event.context.env.confirm?.(action.msg, action.title);
98
+ event.context.env.confirm?.(action.args?.msg, action.args?.title);
93
99
  }
94
100
  }
95
101
 
@@ -1,7 +1,7 @@
1
1
  import {SchemaNode} from '../types';
2
2
  import {RendererEvent} from '../utils/renderer-event';
3
3
  import {
4
- Action,
4
+ RendererAction,
5
5
  ListenerAction,
6
6
  ListenerContext,
7
7
  registerAction
@@ -18,7 +18,7 @@ export interface IDrawerAction extends ListenerAction {
18
18
  * @class DrawerAction
19
19
  * @implements {Action}
20
20
  */
21
- export class DrawerAction implements Action {
21
+ export class DrawerAction implements RendererAction {
22
22
  async run(
23
23
  action: IDrawerAction,
24
24
  renderer: ListenerContext,
@@ -35,7 +35,7 @@ export class DrawerAction implements Action {
35
35
  * @class CloseDrawerAction
36
36
  * @implements {Action}
37
37
  */
38
- export class CloseDrawerAction implements Action {
38
+ export class CloseDrawerAction implements RendererAction {
39
39
  async run(
40
40
  action: ListenerAction,
41
41
  renderer: ListenerContext,
@@ -4,18 +4,21 @@ import pick from 'lodash/pick';
4
4
  import mapValues from 'lodash/mapValues';
5
5
  import qs from 'qs';
6
6
  import {
7
- Action,
7
+ RendererAction,
8
8
  ListenerAction,
9
9
  ListenerContext,
10
10
  registerAction
11
11
  } from './Action';
12
12
 
13
13
  export interface IEmailAction extends ListenerAction {
14
- to: string;
15
- cc: string;
16
- bcc: string;
17
- subject: string;
18
- body: string;
14
+ args: {
15
+ to: string;
16
+ cc: string;
17
+ bcc: string;
18
+ subject: string;
19
+ body: string;
20
+ [propName: string]: any;
21
+ };
19
22
  }
20
23
 
21
24
  /**
@@ -25,17 +28,14 @@ export interface IEmailAction extends ListenerAction {
25
28
  * @class EmailAction
26
29
  * @implements {Action}
27
30
  */
28
- export class EmailAction implements Action {
31
+ export class EmailAction implements RendererAction {
29
32
  async run(
30
33
  action: IEmailAction,
31
34
  renderer: ListenerContext,
32
35
  event: RendererEvent<any>
33
36
  ) {
34
- const mailTo = filter(action.to, action.args);
35
- const mailInfo = mapValues(
36
- pick(action, 'cc', 'bcc', 'subject', 'body'),
37
- val => filter(val, action.args)
38
- );
37
+ const mailTo = action.args?.to;
38
+ const mailInfo = pick(action.args ?? {}, 'cc', 'bcc', 'subject', 'body');
39
39
  const mailStr = qs.stringify(mailInfo);
40
40
  const mailto = `mailto:${mailTo}?${mailStr}`;
41
41
 
@@ -1,27 +1,37 @@
1
+ import {Action} from '../types';
1
2
  import {buildApi} from '../utils/api';
2
3
  import {isEmpty, isObject, qsstringify} from '../utils/helper';
3
4
  import {RendererEvent} from '../utils/renderer-event';
4
5
  import {filter} from '../utils/tpl';
6
+ import omit from 'lodash/omit';
5
7
  import {
6
- Action,
8
+ RendererAction,
7
9
  ListenerAction,
8
10
  ListenerContext,
9
11
  registerAction
10
12
  } from './Action';
11
13
 
12
14
  export interface ILinkAction extends ListenerAction {
13
- link: string;
14
- url?: never;
15
- params?: {
16
- [key: string]: string;
15
+ args: {
16
+ link: string;
17
+ url?: never;
18
+ blank?: boolean;
19
+ params?: {
20
+ [key: string]: string;
21
+ };
22
+ [propName: string]: any;
17
23
  };
18
24
  }
19
25
 
20
26
  export interface IUrlAction extends ListenerAction {
21
- url: string;
22
- link?: never;
23
- params?: {
24
- [key: string]: string;
27
+ args: {
28
+ url: string;
29
+ link?: never;
30
+ blank?: boolean;
31
+ params?: {
32
+ [key: string]: string;
33
+ };
34
+ [propName: string]: any;
25
35
  };
26
36
  }
27
37
 
@@ -32,9 +42,9 @@ export interface IUrlAction extends ListenerAction {
32
42
  * @class LinkAction
33
43
  * @implements {Action}
34
44
  */
35
- export class LinkAction implements Action {
45
+ export class LinkAction implements RendererAction {
36
46
  async run(
37
- action: ILinkAction | IUrlAction,
47
+ action: ListenerAction,
38
48
  renderer: ListenerContext,
39
49
  event: RendererEvent<any>
40
50
  ) {
@@ -45,16 +55,26 @@ export class LinkAction implements Action {
45
55
  // 通过buildApi兼容较复杂的url情况
46
56
  let urlObj = buildApi(
47
57
  {
48
- url: (action.url || action.link) as string,
58
+ url: (action.args?.url || action.args?.link) as string,
49
59
  method: 'get'
50
60
  },
51
- {...action.params, ...action.args},
61
+ {
62
+ ...(action.args?.params ?? {}),
63
+ ...omit(action.args ?? {}, ['params', 'blank', 'url', 'link'])
64
+ },
52
65
  {
53
66
  autoAppend: true
54
67
  }
55
68
  );
56
69
 
57
- renderer.props.env.jumpTo(urlObj.url, action, action.args);
70
+ renderer.props.env.jumpTo(
71
+ urlObj.url,
72
+ {
73
+ actionType: action.actionType,
74
+ ...action.args
75
+ },
76
+ action.args
77
+ );
58
78
  }
59
79
  }
60
80