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
@@ -1,7 +1,7 @@
1
1
  import {RendererEvent} from '../utils/renderer-event';
2
2
  import {createObject} from '../utils/helper';
3
3
  import {
4
- Action,
4
+ RendererAction,
5
5
  ListenerAction,
6
6
  ListenerContext,
7
7
  LogicAction,
@@ -13,7 +13,10 @@ import {
13
13
  import {resolveVariable} from '../utils/tpl-builtin';
14
14
 
15
15
  export interface ILoopAction extends ListenerAction, LogicAction {
16
- loopName: string;
16
+ args: {
17
+ loopName: string;
18
+ [propName: string]: any;
19
+ };
17
20
  }
18
21
 
19
22
  /**
@@ -23,25 +26,26 @@ export interface ILoopAction extends ListenerAction, LogicAction {
23
26
  * @class LoopAction
24
27
  * @implements {Action}
25
28
  */
26
- export class LoopAction implements Action {
29
+ export class LoopAction implements RendererAction {
27
30
  async run(
28
31
  action: ILoopAction,
29
32
  renderer: ListenerContext,
30
33
  event: RendererEvent<any>,
31
34
  mergeData: any
32
35
  ) {
33
- if (typeof action.loopName !== 'string') {
34
- console.warn('loopName 必须是字符串类型');
36
+ const loopName = action.args?.loopName;
37
+ if (typeof loopName !== 'string') {
38
+ console.error('loopName 必须是字符串类型');
35
39
  return;
36
40
  }
37
41
 
38
- const loopData = resolveVariable(action.loopName, mergeData) || [];
42
+ const loopData = resolveVariable(loopName, mergeData) || [];
39
43
 
40
44
  // 必须是数组
41
45
  if (!loopData) {
42
- console.warn(`没有找到数据 ${action.loopName}`);
46
+ console.error(`没有找到数据 ${loopName}`);
43
47
  } else if (!Array.isArray(loopData)) {
44
- console.warn(`${action.loopName} 数据不是数组`);
48
+ console.error(`${loopName} 数据不是数组`);
45
49
  } else if (action.children?.length) {
46
50
  // 暂存一下
47
51
  const protoData = event.data;
@@ -62,6 +66,7 @@ export class LoopAction implements Action {
62
66
  if (renderer.loopStatus === LoopStatus.BREAK || event.stoped) {
63
67
  // 还原事件数据
64
68
  event.setData(protoData);
69
+ event.stopPropagation();
65
70
  break;
66
71
  }
67
72
  }
@@ -1,13 +1,16 @@
1
1
  import {RendererEvent} from '../utils/renderer-event';
2
2
  import {
3
- Action,
3
+ RendererAction,
4
4
  ListenerAction,
5
5
  ListenerContext,
6
6
  registerAction
7
7
  } from './Action';
8
8
 
9
9
  export interface IPageGoAction extends ListenerAction {
10
- delta?: number;
10
+ args: {
11
+ delta?: number;
12
+ [propName: string]: any;
13
+ };
11
14
  }
12
15
 
13
16
  /**
@@ -17,7 +20,7 @@ export interface IPageGoAction extends ListenerAction {
17
20
  * @class PageGoBackAction
18
21
  * @implements {Action}
19
22
  */
20
- export class PageGoBackAction implements Action {
23
+ export class PageGoBackAction implements RendererAction {
21
24
  async run(
22
25
  action: ListenerAction,
23
26
  renderer: ListenerContext,
@@ -34,13 +37,13 @@ export class PageGoBackAction implements Action {
34
37
  * @class PageGoAction
35
38
  * @implements {Action}
36
39
  */
37
- export class PageGoAction implements Action {
40
+ export class PageGoAction implements RendererAction {
38
41
  async run(
39
42
  action: IPageGoAction,
40
43
  renderer: ListenerContext,
41
44
  event: RendererEvent<any>
42
45
  ) {
43
- window.history.go(action.delta || 0);
46
+ window.history.go(action.args?.delta || 0);
44
47
  }
45
48
  }
46
49
 
@@ -51,7 +54,7 @@ export class PageGoAction implements Action {
51
54
  * @class PageRefreshAction
52
55
  * @implements {Action}
53
56
  */
54
- export class PageRefreshAction implements Action {
57
+ export class PageRefreshAction implements RendererAction {
55
58
  async run(
56
59
  action: ListenerAction,
57
60
  renderer: ListenerContext,
@@ -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
  LogicAction,
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  export interface IParallelAction extends ListenerAction, LogicAction {}
12
12
 
13
- export class ParallelAction implements Action {
13
+ export class ParallelAction implements RendererAction {
14
14
  async run(
15
15
  action: IParallelAction,
16
16
  renderer: ListenerContext,
@@ -2,7 +2,7 @@ import {inflate} from 'zlib';
2
2
  import {RendererEvent} from '../utils/renderer-event';
3
3
  import {evalExpression} from '../utils/tpl';
4
4
  import {
5
- Action,
5
+ RendererAction,
6
6
  ListenerAction,
7
7
  ListenerContext,
8
8
  LogicAction,
@@ -15,7 +15,7 @@ export interface ISwitchAction extends ListenerAction, LogicAction {}
15
15
  /**
16
16
  * 排他动作
17
17
  */
18
- export class SwitchAction implements Action {
18
+ export class SwitchAction implements RendererAction {
19
19
  async run(
20
20
  action: ISwitchAction,
21
21
  renderer: ListenerContext,
@@ -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
  registerAction
@@ -26,16 +26,20 @@ export interface IToastAction extends ListenerAction {
26
26
  /**
27
27
  * 全局toast
28
28
  */
29
- export class ToastAction implements Action {
29
+ export class ToastAction implements RendererAction {
30
30
  async run(
31
31
  action: IToastAction,
32
32
  renderer: ListenerContext,
33
33
  event: RendererEvent<any>
34
34
  ) {
35
+ if (!renderer.props.env?.notify) {
36
+ throw new Error('env.notify is required!');
37
+ }
38
+
35
39
  event.context.env.notify?.(
36
- action.msgType || 'info',
37
- resolveVariableAndFilter(action.msg, event?.data, '| raw'),
38
- action
40
+ action.args?.msgType || 'info',
41
+ String(action.args?.msg),
42
+ action.args
39
43
  );
40
44
  }
41
45
  }
@@ -105,6 +105,7 @@ export class InputBox extends React.Component<InputBoxProps, InputBoxState> {
105
105
  onFocus={this.handleFocus}
106
106
  onBlur={this.handleBlur}
107
107
  size={12}
108
+ disabled={disabled}
108
109
  />
109
110
 
110
111
  {children}
@@ -0,0 +1,446 @@
1
+ /*
2
+ * @Description: Pagination分页组件
3
+ * @Author: wangfeilong02@baidu.com
4
+ * @Date: 2021-11-01 16:57:38
5
+ */
6
+ import React from 'react';
7
+ import {localeable, LocaleProps} from '../locale';
8
+ import {themeable, ThemeProps} from '../theme';
9
+ import {autobind} from '../utils/helper';
10
+ import {Icon} from './icons';
11
+ import Select from './Select';
12
+
13
+ export type MODE_TYPE = 'simple' | 'normal';
14
+ export interface BasicPaginationProps {
15
+
16
+ /**
17
+ * 通过控制layout属性的顺序,调整分页结构 total,perPage,pager,go
18
+ * @default 'pager'
19
+ */
20
+ layout?: string | Array<string>;
21
+
22
+ /**
23
+ * 最多显示多少个分页按钮。
24
+ *
25
+ * @default 5
26
+ */
27
+ maxButtons: number;
28
+
29
+ /**
30
+ * 模式,默认normal,如果只想简单显示可以配置成 `simple`。
31
+ * @default 'normal'
32
+ */
33
+ mode?: MODE_TYPE;
34
+
35
+ /**
36
+ * 当前页数
37
+ */
38
+ activePage: number;
39
+
40
+ /**
41
+ * 总条数
42
+ */
43
+ total?: number;
44
+
45
+ /**
46
+ * 最后一页,总页数(如果传入了total,会重新计算lastPage)
47
+ */
48
+ lastPage?: number;
49
+
50
+ /**
51
+ * 每页显示条数
52
+ * @default 10
53
+ */
54
+ perPage?: number;
55
+
56
+ /**
57
+ * 是否展示分页切换,也同时受layout控制
58
+ * @default false
59
+ */
60
+ showPerPage?: boolean;
61
+
62
+ /**
63
+ * 指定每页可以显示多少条
64
+ * @default [10, 20, 50, 100]
65
+ */
66
+ perPageAvailable?: Array<number>;
67
+
68
+ /**
69
+ * 是否显示快速跳转输入框
70
+ * @default false
71
+ */
72
+ showPageInput?: boolean;
73
+
74
+ /**
75
+ * 是否禁用
76
+ * @default false
77
+ */
78
+ disabled?: boolean;
79
+
80
+
81
+ hasNext?: boolean;
82
+ onPageChange?: (page: number, perPage?: number) => void;
83
+ }
84
+ export interface PaginationProps extends BasicPaginationProps, ThemeProps, LocaleProps {
85
+ }
86
+ export interface PaginationState {
87
+ pageNum: string;
88
+ perPage: number;
89
+ }
90
+ export class Pagination extends React.Component<
91
+ PaginationProps,
92
+ PaginationState
93
+ > {
94
+ static defaultProps = {
95
+ layout: ['pager'],
96
+ maxButtons: 5,
97
+ mode: 'normal' as MODE_TYPE,
98
+ activePage: 1,
99
+ perPage: 10,
100
+ perPageAvailable: [10, 20, 50, 100]
101
+ };
102
+
103
+ state = {
104
+ pageNum: '',
105
+ perPage: Number(this.props.perPage)
106
+ };
107
+
108
+ constructor(props: PaginationProps) {
109
+ super(props);
110
+
111
+ this.handlePageNumChange = this.handlePageNumChange.bind(this);
112
+ this.renderPageItem = this.renderPageItem.bind(this);
113
+ this.renderEllipsis = this.renderEllipsis.bind(this);
114
+ this.handlePageNums = this.handlePageNums.bind(this);
115
+ }
116
+
117
+ handlePageNumChange(page: number, perPage?: number) {
118
+ const props = this.props;
119
+ if (props.disabled) {
120
+ return;
121
+ }
122
+ props.onPageChange && props.onPageChange(page, perPage);
123
+ }
124
+
125
+ /**
126
+ * 渲染每个页码li
127
+ *
128
+ * @param page 页码
129
+ */
130
+ renderPageItem(page: number) {
131
+ const {classnames: cx, activePage} = this.props;
132
+ const {perPage} = this.state;
133
+
134
+ return (<li
135
+ onClick={() => this.handlePageNumChange(page, perPage)}
136
+ key={page}
137
+ className={cx('Pagination-pager-item', {
138
+ 'is-active': page === activePage
139
+ })}
140
+ >
141
+ <a role="button">{page}</a>
142
+ </li>);
143
+ }
144
+
145
+ /**
146
+ * 渲染...
147
+ *
148
+ * @param key 类型 'prev-ellipsis' | 'next-ellipsis'
149
+ * @param page 页码
150
+ */
151
+ renderEllipsis(key: string) {
152
+ const {classnames: cx} = this.props;
153
+ return (<li key={key} className={cx('ellipsis')}><a role="button">...</a></li>);
154
+ }
155
+
156
+ /**
157
+ * 渲染器事件方法装饰器
158
+ *
159
+ * @param cur 当前页数
160
+ * @param counts 总共页码按钮数
161
+ * @param min 最小页码
162
+ * @param max 最大页码
163
+ */
164
+ handlePageNums(cur: number, counts: number, min: number, max: number): Array<any> {
165
+ const pageButtons: Array<any> = [];
166
+ if (counts === 0) {
167
+ return pageButtons;
168
+ }
169
+
170
+ let step = 0;
171
+ let page = cur;
172
+ while (true) {
173
+ if (pageButtons.length >= counts) {
174
+ return pageButtons;
175
+ }
176
+ if ((cur - step) < min && (cur + step) > max) {
177
+ return pageButtons;
178
+ }
179
+ page = cur - step;
180
+ if (pageButtons.length < counts && page >= min) {
181
+ pageButtons.unshift(this.renderPageItem(page));
182
+ }
183
+ page = cur + step;
184
+ if (step !== 0 && pageButtons.length < counts && page <= max) {
185
+ pageButtons.push(this.renderPageItem(page));
186
+ }
187
+ step++;
188
+ }
189
+ }
190
+
191
+ getLastPage() {
192
+ const {total, perPage, lastPage, activePage, hasNext} = this.props;
193
+ // 输入total,重新计算lastPage
194
+ if (total || total === 0) {
195
+ return Math.ceil(total / (perPage as number));
196
+ }
197
+ if (lastPage) {
198
+ return Number(lastPage);
199
+ }
200
+ if (hasNext) {
201
+ return Number(activePage + 1);
202
+ }
203
+ return Number(activePage);
204
+ }
205
+
206
+
207
+ @autobind
208
+ handlePageChange(e: React.ChangeEvent<any>) {
209
+ const lastPage = this.getLastPage();
210
+ let value = e.currentTarget.value;
211
+
212
+ if (/^\d+$/.test(value) && parseInt(value, 10) > lastPage) {
213
+ value = String(lastPage);
214
+ }
215
+
216
+ this.setState({pageNum: value});
217
+ }
218
+
219
+ render() {
220
+ const {
221
+ layout,
222
+ maxButtons,
223
+ mode,
224
+ activePage,
225
+ total,
226
+ showPerPage,
227
+ perPageAvailable,
228
+ classnames: cx,
229
+ showPageInput,
230
+ className,
231
+ disabled,
232
+ hasNext,
233
+ translate: __
234
+ } = this.props;
235
+ const {pageNum, perPage} = this.state;
236
+ const lastPage = this.getLastPage();
237
+
238
+ // 简易模式
239
+ if (mode === 'simple') {
240
+ return (
241
+ <div className={cx('Pagination-wrap', 'Pagination-simple', {'disabled': disabled}, className)}>
242
+ <ul key="pager-items" className={cx('Pagination', 'Pagination--sm', 'Pagination-pager-items', 'Pagination-item')}>
243
+ <li
244
+ className={cx('Pagination-prev', {
245
+ 'is-disabled': activePage < 2
246
+ })}
247
+ onClick={(e: any) => {
248
+ if (activePage < 2) {
249
+ return e.preventDefault();
250
+ }
251
+ return this.handlePageNumChange(activePage - 1)
252
+ }}
253
+ key="prev"
254
+ >
255
+ <span>
256
+ <Icon icon="left-arrow" className="icon" />
257
+ </span>
258
+ </li>
259
+ <li
260
+ className={cx('Pagination-next', {
261
+ 'is-disabled': !hasNext
262
+ })}
263
+ onClick={(e: any) => {
264
+ if (!hasNext) {
265
+ return e.preventDefault();
266
+ }
267
+ return this.handlePageNumChange(activePage + 1, perPage)
268
+ }}
269
+ key="next"
270
+ >
271
+ <span>
272
+ <Icon icon="right-arrow" className="icon" />
273
+ </span>
274
+ </li>
275
+ </ul>
276
+ </div>
277
+ );
278
+ }
279
+
280
+ let pageButtons: any = [];
281
+ let layoutList: Array<string> = [];
282
+ if (Array.isArray(layout)) {
283
+ layoutList = layout;
284
+ }
285
+ else if (typeof layout === 'string') {
286
+ layoutList = (layout as string).split(',');
287
+ }
288
+ layoutList = layoutList.map(v => v.trim());
289
+
290
+ // 兼容历史showPageInput
291
+ if ((showPageInput || lastPage > 9) && !layoutList.includes('go')) {
292
+ layoutList.push('go');
293
+ }
294
+ if (showPerPage && !layoutList.includes('perPage')) {
295
+ layoutList.unshift('perPage');
296
+ }
297
+
298
+
299
+ // 页码全部显示 [1, 2, 3, 4]
300
+ if (lastPage <= maxButtons) {
301
+ pageButtons = this.handlePageNums(activePage, maxButtons, 1, Math.min(maxButtons, lastPage));
302
+ }
303
+ //当前为1234页时, [1, 2, 3, 4, 5, ... 12]
304
+ else if (activePage <= maxButtons - 3) {
305
+ pageButtons = this.handlePageNums(activePage, maxButtons - 2, 1, Math.min(maxButtons - 2, lastPage));
306
+ pageButtons.push(this.renderEllipsis('next-ellipsis'));
307
+ pageButtons.push(this.renderPageItem(lastPage));
308
+ }
309
+ // [1, ..., 5, 6, 7, 8, 9]
310
+ else if (activePage > (lastPage - (maxButtons- 3))) {
311
+ const min = lastPage - (maxButtons- 3);
312
+ pageButtons = this.handlePageNums(activePage, maxButtons - 2, min, lastPage);
313
+ pageButtons.unshift(this.renderEllipsis('prev-ellipsis'));
314
+ pageButtons.unshift(this.renderPageItem(1));
315
+ }
316
+ // [1, ... 4, 5, 6, ... 10]
317
+ else {
318
+ pageButtons = this.handlePageNums(activePage, maxButtons - 2, 3, lastPage - 3);
319
+ pageButtons.unshift(this.renderEllipsis('prev-ellipsis'));
320
+ pageButtons.unshift(this.renderPageItem(1));
321
+ pageButtons.push(this.renderEllipsis('next-ellipsis'));
322
+ pageButtons.push(this.renderPageItem(lastPage));
323
+ }
324
+
325
+ pageButtons.unshift(
326
+ <li
327
+ className={cx('Pagination-prev', {
328
+ 'is-disabled': activePage < 2
329
+ })}
330
+ onClick={(e: any) => {
331
+ if (activePage < 2) {
332
+ return e.preventDefault();
333
+ }
334
+ return this.handlePageNumChange(activePage - 1, perPage)
335
+ }}
336
+ key="prev"
337
+ >
338
+ <span>
339
+ <Icon icon="left-arrow" className="icon" />
340
+ </span>
341
+ </li>
342
+ );
343
+
344
+ pageButtons.push(
345
+ <li
346
+ className={cx('Pagination-next', {
347
+ 'is-disabled': activePage === lastPage
348
+ })}
349
+ onClick={(e: any) => {
350
+ if (activePage === lastPage) {
351
+ return e.preventDefault();
352
+ }
353
+ return this.handlePageNumChange(activePage + 1, perPage)
354
+ }}
355
+ key="next"
356
+ >
357
+ <span>
358
+ <Icon icon="right-arrow" className="icon" />
359
+ </span>
360
+ </li>
361
+ );
362
+
363
+ const go = <div className={cx('Pagination-inputGroup Pagination-item')} key="go">
364
+ <span className={cx('Pagination-inputGroup-left')} key="go-left">{__('Pagination.goto')}</span>
365
+ <input
366
+ className={cx('Pagination-inputGroup-input')} key="go-input"
367
+ type="text"
368
+ disabled={disabled}
369
+ onChange={this.handlePageChange}
370
+ onFocus={(e: any) => e.currentTarget.select()}
371
+ onKeyUp={(e: any) =>{
372
+ const v: number = parseInt(e.currentTarget.value, 10);
373
+ if (!v || e.code != 'Enter') {
374
+ return;
375
+ }
376
+ this.setState({pageNum: ''});
377
+ this.handlePageNumChange(v, perPage);
378
+ }}
379
+ value={pageNum}
380
+ />
381
+ <span
382
+ className={cx('Pagination-inputGroup-right')}
383
+ key="go-right"
384
+ onClick={(e: any) => {
385
+ if (!pageNum) {
386
+ return;
387
+ }
388
+ this.setState({pageNum: ''});
389
+ this.handlePageNumChange(+pageNum, perPage);
390
+ }}
391
+ >{__('Pagination.go')}</span>
392
+ </div>;
393
+ const selection = (perPageAvailable as Array<number>).filter(v => !!v).map(v => ({label: __('Pagination.select', {count: v}), value: v}));
394
+ const perPageEle =
395
+ <Select
396
+ key="perpage"
397
+ className={cx('Pagination-perpage', 'Pagination-item')}
398
+ overlayPlacement="right-bottom-right-top"
399
+ clearable={false}
400
+ disabled={disabled}
401
+ value={perPage}
402
+ options={selection}
403
+ onChange={(p: any) => {
404
+ this.setState({
405
+ perPage: p.value,
406
+ pageNum: ''
407
+ });
408
+ this.handlePageNumChange(1, p.value);
409
+ }}
410
+ />;
411
+ // total或者lastpage不存在,不渲染总数
412
+ const totalPage = !(total || lastPage) ? null : <div className={cx('Pagination-total Pagination-item')} key="total">{
413
+ total || total === 0
414
+ ? __('Pagination.totalCount', {total})
415
+ : __('Pagination.totalPage', {lastPage})
416
+ }</div>;
417
+ return (
418
+ <div className={cx('Pagination-wrap', {'disabled': disabled}, className)}>
419
+ {
420
+ layoutList.map((layoutItem) => {
421
+ if (layoutItem === 'pager') {
422
+ return <ul key="pager-items" className={cx('Pagination', 'Pagination--sm','Pagination-item')}>{pageButtons}</ul>;
423
+ }
424
+ else if (layoutItem === 'go') {
425
+ return go;
426
+ }
427
+ else if (layoutItem === 'perPage') {
428
+ return perPageEle;
429
+ }
430
+ else if (layoutItem === 'total') {
431
+ return totalPage;
432
+ }
433
+ else {
434
+ return null;
435
+ }
436
+ })
437
+ }
438
+
439
+ </div>
440
+ );
441
+ }
442
+
443
+ }
444
+
445
+
446
+ export default themeable(localeable(Pagination));
@@ -14,6 +14,7 @@ export interface PickerContainerProps extends ThemeProps, LocaleProps {
14
14
  headerClassName?: string;
15
15
  children: (props: {
16
16
  onClick: (e: React.MouseEvent) => void;
17
+ setState: (state: any) => void;
17
18
  isOpened: boolean;
18
19
  }) => JSX.Element;
19
20
  bodyRender: (props: {
@@ -62,8 +63,8 @@ export class PickerContainer extends React.Component<
62
63
  this.setState(
63
64
  {
64
65
  isOpened: true
65
- },
66
- (() => this.props.onFocus?.())
66
+ },
67
+ () => this.props.onFocus?.()
67
68
  );
68
69
  }
69
70
 
@@ -77,10 +78,11 @@ export class PickerContainer extends React.Component<
77
78
  this.props.onClose?.();
78
79
  if (callback) {
79
80
  callback();
80
- return
81
+ return;
81
82
  }
82
83
  this.props.onCancel?.();
83
- })
84
+ }
85
+ );
84
86
  }
85
87
 
86
88
  @autobind
@@ -120,7 +122,8 @@ export class PickerContainer extends React.Component<
120
122
  <>
121
123
  {children({
122
124
  isOpened: this.state.isOpened,
123
- onClick: this.handleClick
125
+ onClick: this.handleClick,
126
+ setState: this.updateState
124
127
  })}
125
128
 
126
129
  <Modal