amis-editor 4.2.0-beta.0 → 5.2.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (552) hide show
  1. package/lib/component/BaseControl.d.ts +1831 -0
  2. package/lib/component/BaseControl.js +366 -0
  3. package/{dist/component/base → lib/component}/InputComponentName.d.ts +0 -0
  4. package/lib/component/InputComponentName.js +44 -0
  5. package/{dist → lib}/component/TableViewEditor.d.ts +2 -2
  6. package/lib/component/TableViewEditor.js +528 -0
  7. package/lib/event-action/actions.d.ts +3 -0
  8. package/lib/event-action/actions.js +188 -0
  9. package/lib/event-action/schema.d.ts +13 -0
  10. package/lib/event-action/schema.js +134 -0
  11. package/{dist → lib}/index.d.ts +26 -33
  12. package/lib/index.js +181 -0
  13. package/{dist → lib}/plugin/Alert.d.ts +4 -2
  14. package/lib/plugin/Alert.js +113 -0
  15. package/lib/plugin/AnchorNav.d.ts +48 -0
  16. package/lib/plugin/AnchorNav.js +297 -0
  17. package/{dist → lib}/plugin/Audio.d.ts +1 -1
  18. package/lib/plugin/Audio.js +157 -0
  19. package/{dist → lib}/plugin/Avatar.d.ts +11 -2
  20. package/lib/plugin/Avatar.js +305 -0
  21. package/{dist → lib}/plugin/Breadcrumb.d.ts +1 -1
  22. package/lib/plugin/Breadcrumb.js +116 -0
  23. package/{dist → lib}/plugin/Button.d.ts +6 -2
  24. package/lib/plugin/Button.js +297 -0
  25. package/lib/plugin/ButtonGroup.d.ts +39 -0
  26. package/lib/plugin/ButtonGroup.js +139 -0
  27. package/{dist → lib}/plugin/ButtonToolbar.d.ts +5 -11
  28. package/lib/plugin/ButtonToolbar.js +89 -0
  29. package/{dist → lib}/plugin/CRUD.d.ts +3 -1
  30. package/lib/plugin/CRUD.js +1528 -0
  31. package/{dist → lib}/plugin/Card.d.ts +1 -1
  32. package/lib/plugin/Card.js +233 -0
  33. package/{dist → lib}/plugin/Cards.d.ts +1 -1
  34. package/lib/plugin/Cards.js +254 -0
  35. package/{dist → lib}/plugin/Carousel.d.ts +1 -1
  36. package/lib/plugin/Carousel.js +358 -0
  37. package/{dist → lib}/plugin/Chart.d.ts +3 -1
  38. package/lib/plugin/Chart.js +192 -0
  39. package/{dist → lib}/plugin/CodeView.d.ts +1 -1
  40. package/lib/plugin/CodeView.js +68 -0
  41. package/{dist → lib}/plugin/Collapse.d.ts +2 -1
  42. package/lib/plugin/Collapse.js +138 -0
  43. package/{dist → lib}/plugin/CollapseGroup.d.ts +29 -5
  44. package/lib/plugin/CollapseGroup.js +237 -0
  45. package/{dist → lib}/plugin/Container.d.ts +3 -2
  46. package/lib/plugin/Container.js +100 -0
  47. package/{dist → lib}/plugin/Custom.d.ts +1 -1
  48. package/lib/plugin/Custom.js +109 -0
  49. package/{dist → lib}/plugin/CustomRegion.d.ts +1 -1
  50. package/lib/plugin/CustomRegion.js +154 -0
  51. package/{dist → lib}/plugin/Date.d.ts +1 -1
  52. package/lib/plugin/Date.js +82 -0
  53. package/{dist → lib}/plugin/Datetime.d.ts +1 -1
  54. package/lib/plugin/Datetime.js +77 -0
  55. package/{dist → lib}/plugin/Dialog.d.ts +12 -2
  56. package/lib/plugin/Dialog.js +214 -0
  57. package/{dist → lib}/plugin/Divider.d.ts +1 -1
  58. package/lib/plugin/Divider.js +49 -0
  59. package/{dist → lib}/plugin/Drawer.d.ts +12 -2
  60. package/lib/plugin/Drawer.js +240 -0
  61. package/{dist → lib}/plugin/DropDownButton.d.ts +12 -11
  62. package/lib/plugin/DropDownButton.js +229 -0
  63. package/{dist → lib}/plugin/Each.d.ts +1 -1
  64. package/lib/plugin/Each.js +131 -0
  65. package/{dist → lib}/plugin/Flex.d.ts +1 -1
  66. package/lib/plugin/Flex.js +203 -0
  67. package/{dist → lib}/plugin/Form/ButtonGroupSelect.d.ts +7 -2
  68. package/lib/plugin/Form/ButtonGroupSelect.js +161 -0
  69. package/{dist → lib}/plugin/Form/ButtonToolbar.d.ts +8 -7
  70. package/lib/plugin/Form/ButtonToolbar.js +107 -0
  71. package/{dist → lib}/plugin/Form/ChainedSelect.d.ts +8 -2
  72. package/lib/plugin/Form/ChainedSelect.js +183 -0
  73. package/{dist → lib}/plugin/Form/Checkbox.d.ts +7 -2
  74. package/lib/plugin/Form/Checkbox.js +174 -0
  75. package/{dist → lib}/plugin/Form/Checkboxes.d.ts +8 -2
  76. package/lib/plugin/Form/Checkboxes.js +213 -0
  77. package/lib/plugin/Form/CodeEditor.d.ts +25 -0
  78. package/lib/plugin/Form/CodeEditor.js +201 -0
  79. package/{dist → lib}/plugin/Form/Combo.d.ts +4 -1
  80. package/lib/plugin/Form/Combo.js +546 -0
  81. package/{dist → lib}/plugin/Form/ConditionBuilder.d.ts +1 -1
  82. package/lib/plugin/Form/ConditionBuilder.js +302 -0
  83. package/{dist → lib}/plugin/Form/Control.d.ts +6 -2
  84. package/lib/plugin/Form/Control.js +88 -0
  85. package/{dist → lib}/plugin/Form/DiffEditor.d.ts +8 -2
  86. package/lib/plugin/Form/DiffEditor.js +204 -0
  87. package/{dist → lib}/plugin/Form/FieldSet.d.ts +1 -1
  88. package/lib/plugin/Form/FieldSet.js +152 -0
  89. package/{dist → lib}/plugin/Form/Form.d.ts +7 -1
  90. package/lib/plugin/Form/Form.js +846 -0
  91. package/{dist → lib}/plugin/Form/Formula.d.ts +2 -26
  92. package/lib/plugin/Form/Formula.js +82 -0
  93. package/{dist → lib}/plugin/Form/Group.d.ts +1 -1
  94. package/lib/plugin/Form/Group.js +252 -0
  95. package/{dist → lib}/plugin/Form/Hidden.d.ts +1 -1
  96. package/lib/plugin/Form/Hidden.js +58 -0
  97. package/{dist → lib}/plugin/Form/InputArray.d.ts +1 -1
  98. package/lib/plugin/Form/InputArray.js +181 -0
  99. package/{dist → lib}/plugin/Form/InputCity.d.ts +6 -2
  100. package/lib/plugin/Form/InputCity.js +139 -0
  101. package/{dist → lib}/plugin/Form/InputColor.d.ts +20 -18
  102. package/lib/plugin/Form/InputColor.js +295 -0
  103. package/lib/plugin/Form/InputDate.d.ts +26 -0
  104. package/lib/plugin/Form/InputDate.js +357 -0
  105. package/lib/plugin/Form/InputDateRange.d.ts +26 -0
  106. package/lib/plugin/Form/InputDateRange.js +350 -0
  107. package/{dist → lib}/plugin/Form/InputDateTime.d.ts +4 -4
  108. package/lib/plugin/Form/InputDateTime.js +50 -0
  109. package/lib/plugin/Form/InputDateTimeRange.d.ts +20 -0
  110. package/lib/plugin/Form/InputDateTimeRange.js +51 -0
  111. package/{dist → lib}/plugin/Form/InputEmail.d.ts +1 -0
  112. package/lib/plugin/Form/InputEmail.js +45 -0
  113. package/lib/plugin/Form/InputExcel.d.ts +23 -0
  114. package/lib/plugin/Form/InputExcel.js +121 -0
  115. package/{dist → lib}/plugin/Form/InputFile.d.ts +7 -3
  116. package/lib/plugin/Form/InputFile.js +354 -0
  117. package/{dist → lib}/plugin/Form/InputGroup.d.ts +1 -1
  118. package/lib/plugin/Form/InputGroup.js +100 -0
  119. package/{dist → lib}/plugin/Form/InputImage.d.ts +6 -2
  120. package/lib/plugin/Form/InputImage.js +271 -0
  121. package/{dist → lib}/plugin/Form/InputKV.d.ts +7 -1
  122. package/lib/plugin/Form/InputKV.js +129 -0
  123. package/{dist → lib}/plugin/Form/InputMonth.d.ts +1 -0
  124. package/lib/plugin/Form/InputMonth.js +48 -0
  125. package/{dist → lib}/plugin/Form/InputMonthRange.d.ts +4 -4
  126. package/lib/plugin/Form/InputMonthRange.js +51 -0
  127. package/{dist → lib}/plugin/Form/InputNumber.d.ts +7 -2
  128. package/lib/plugin/Form/InputNumber.js +263 -0
  129. package/{dist → lib}/plugin/Form/InputPassword.d.ts +1 -0
  130. package/lib/plugin/Form/InputPassword.js +45 -0
  131. package/{dist → lib}/plugin/Form/InputQuarter.d.ts +1 -0
  132. package/lib/plugin/Form/InputQuarter.js +48 -0
  133. package/{dist → lib}/plugin/Form/InputQuarterRange.d.ts +4 -4
  134. package/lib/plugin/Form/InputQuarterRange.js +51 -0
  135. package/{dist → lib}/plugin/Form/InputRange.d.ts +7 -2
  136. package/lib/plugin/Form/InputRange.js +292 -0
  137. package/lib/plugin/Form/InputRating.d.ts +25 -0
  138. package/lib/plugin/Form/InputRating.js +357 -0
  139. package/{dist → lib}/plugin/Form/InputRepeat.d.ts +1 -1
  140. package/lib/plugin/Form/InputRepeat.js +65 -0
  141. package/{dist → lib}/plugin/Form/InputRichText.d.ts +1 -1
  142. package/lib/plugin/Form/InputRichText.js +193 -0
  143. package/{dist → lib}/plugin/Form/InputSubForm.d.ts +1 -1
  144. package/lib/plugin/Form/InputSubForm.js +160 -0
  145. package/{dist → lib}/plugin/Form/InputTable.d.ts +1 -1
  146. package/lib/plugin/Form/InputTable.js +400 -0
  147. package/{dist → lib}/plugin/Form/InputTag.d.ts +6 -2
  148. package/lib/plugin/Form/InputTag.js +155 -0
  149. package/lib/plugin/Form/InputText.d.ts +42 -0
  150. package/lib/plugin/Form/InputText.js +328 -0
  151. package/{dist → lib}/plugin/Form/InputTime.d.ts +3 -3
  152. package/lib/plugin/Form/InputTime.js +48 -0
  153. package/{dist/plugin/Form/InputDateTimeRange.d.ts → lib/plugin/Form/InputTimeRange.d.ts} +4 -4
  154. package/lib/plugin/Form/InputTimeRange.js +51 -0
  155. package/{dist → lib}/plugin/Form/InputTree.d.ts +6 -2
  156. package/lib/plugin/Form/InputTree.js +375 -0
  157. package/{dist → lib}/plugin/Form/InputURL.d.ts +1 -0
  158. package/lib/plugin/Form/InputURL.js +46 -0
  159. package/{dist → lib}/plugin/Form/InputYear.d.ts +1 -0
  160. package/lib/plugin/Form/InputYear.js +48 -0
  161. package/{dist/plugin/Form/InputDate.d.ts → lib/plugin/Form/InputYearRange.d.ts} +4 -4
  162. package/lib/plugin/Form/InputYearRange.js +51 -0
  163. package/{dist → lib}/plugin/Form/Item.d.ts +2 -2
  164. package/lib/plugin/Form/Item.js +265 -0
  165. package/{dist → lib}/plugin/Form/ListSelect.d.ts +6 -2
  166. package/lib/plugin/Form/ListSelect.js +130 -0
  167. package/{dist/plugin/Form/InputDateRange.d.ts → lib/plugin/Form/LocationPicker.d.ts} +5 -6
  168. package/lib/plugin/Form/LocationPicker.js +74 -0
  169. package/{dist → lib}/plugin/Form/MatrixCheckboxes.d.ts +7 -2
  170. package/lib/plugin/Form/MatrixCheckboxes.js +234 -0
  171. package/{dist → lib}/plugin/Form/NestedSelect.d.ts +8 -2
  172. package/lib/plugin/Form/NestedSelect.js +328 -0
  173. package/{dist → lib}/plugin/Form/Picker.d.ts +1 -1
  174. package/lib/plugin/Form/Picker.js +169 -0
  175. package/{dist → lib}/plugin/Form/Radios.d.ts +7 -2
  176. package/lib/plugin/Form/Radios.js +189 -0
  177. package/{dist → lib}/plugin/Form/Select.d.ts +7 -2
  178. package/lib/plugin/Form/Select.js +304 -0
  179. package/{dist → lib}/plugin/Form/Static.d.ts +4 -3
  180. package/lib/plugin/Form/Static.js +312 -0
  181. package/{dist → lib}/plugin/Form/Switch.d.ts +7 -2
  182. package/lib/plugin/Form/Switch.js +219 -0
  183. package/{dist → lib}/plugin/Form/TabsTransfer.d.ts +5 -2
  184. package/lib/plugin/Form/TabsTransfer.js +348 -0
  185. package/{dist → lib}/plugin/Form/Textarea.d.ts +8 -2
  186. package/lib/plugin/Form/Textarea.js +190 -0
  187. package/{dist → lib}/plugin/Form/Transfer.d.ts +5 -2
  188. package/lib/plugin/Form/Transfer.js +414 -0
  189. package/{dist → lib}/plugin/Form/TreeSelect.d.ts +6 -2
  190. package/lib/plugin/Form/TreeSelect.js +375 -0
  191. package/{dist → lib}/plugin/Form/UUID.d.ts +1 -1
  192. package/lib/plugin/Form/UUID.js +55 -0
  193. package/{dist → lib}/plugin/Grid.d.ts +2 -2
  194. package/lib/plugin/Grid.js +680 -0
  195. package/{dist → lib}/plugin/HBox.d.ts +2 -2
  196. package/lib/plugin/HBox.js +594 -0
  197. package/{dist → lib}/plugin/IFrame.d.ts +3 -2
  198. package/lib/plugin/IFrame.js +94 -0
  199. package/{dist → lib}/plugin/Image.d.ts +1 -1
  200. package/lib/plugin/Image.js +264 -0
  201. package/{dist → lib}/plugin/Images.d.ts +1 -1
  202. package/lib/plugin/Images.js +214 -0
  203. package/{dist → lib}/plugin/Json.d.ts +1 -1
  204. package/lib/plugin/Json.js +82 -0
  205. package/{dist → lib}/plugin/Link.d.ts +2 -1
  206. package/lib/plugin/Link.js +120 -0
  207. package/{dist → lib}/plugin/List.d.ts +1 -1
  208. package/lib/plugin/List.js +220 -0
  209. package/{dist → lib}/plugin/ListItem.d.ts +1 -1
  210. package/lib/plugin/ListItem.js +195 -0
  211. package/{dist → lib}/plugin/Log.d.ts +1 -1
  212. package/lib/plugin/Log.js +62 -0
  213. package/{dist → lib}/plugin/Mapping.d.ts +1 -1
  214. package/lib/plugin/Mapping.js +149 -0
  215. package/{dist → lib}/plugin/Markdown.d.ts +1 -1
  216. package/lib/plugin/Markdown.js +58 -0
  217. package/lib/plugin/Nav.d.ts +48 -0
  218. package/lib/plugin/Nav.js +181 -0
  219. package/{dist → lib}/plugin/Operation.d.ts +1 -1
  220. package/lib/plugin/Operation.js +84 -0
  221. package/{dist → lib}/plugin/Others/Action.d.ts +6 -2
  222. package/lib/plugin/Others/Action.js +350 -0
  223. package/{dist → lib}/plugin/Others/TableCell.d.ts +1 -1
  224. package/lib/plugin/Others/TableCell.js +393 -0
  225. package/{dist → lib}/plugin/Page.d.ts +6 -3
  226. package/lib/plugin/Page.js +363 -0
  227. package/lib/plugin/Pagination.d.ts +51 -0
  228. package/lib/plugin/Pagination.js +247 -0
  229. package/{dist → lib}/plugin/Panel.d.ts +1 -1
  230. package/lib/plugin/Panel.js +222 -0
  231. package/{dist → lib}/plugin/Plain.d.ts +1 -1
  232. package/lib/plugin/Plain.js +88 -0
  233. package/{dist → lib}/plugin/Progress.d.ts +6 -2
  234. package/lib/plugin/Progress.js +258 -0
  235. package/{dist → lib}/plugin/Property.d.ts +1 -1
  236. package/lib/plugin/Property.js +147 -0
  237. package/{dist → lib}/plugin/QRCode.d.ts +1 -1
  238. package/lib/plugin/QRCode.js +107 -0
  239. package/{dist → lib}/plugin/Reset.d.ts +0 -0
  240. package/lib/plugin/Reset.js +38 -0
  241. package/{dist → lib}/plugin/Service.d.ts +4 -1
  242. package/lib/plugin/Service.js +217 -0
  243. package/{dist → lib}/plugin/Sparkline.d.ts +1 -1
  244. package/lib/plugin/Sparkline.js +50 -0
  245. package/{dist → lib}/plugin/Status.d.ts +1 -1
  246. package/lib/plugin/Status.js +86 -0
  247. package/{dist → lib}/plugin/Steps.d.ts +1 -1
  248. package/lib/plugin/Steps.js +136 -0
  249. package/{dist → lib}/plugin/Submit.d.ts +0 -0
  250. package/lib/plugin/Submit.js +38 -0
  251. package/{dist → lib}/plugin/Table.d.ts +6 -1
  252. package/lib/plugin/Table.js +594 -0
  253. package/{dist → lib}/plugin/TableView.d.ts +1 -1
  254. package/lib/plugin/TableView.js +744 -0
  255. package/{dist → lib}/plugin/Tabs.d.ts +33 -2
  256. package/lib/plugin/Tabs.js +429 -0
  257. package/{dist → lib}/plugin/Tasks.d.ts +1 -1
  258. package/lib/plugin/Tasks.js +263 -0
  259. package/{dist → lib}/plugin/Time.d.ts +1 -1
  260. package/lib/plugin/Time.js +77 -0
  261. package/{dist → lib}/plugin/TooltipWrapper.d.ts +11 -1
  262. package/lib/plugin/TooltipWrapper.js +281 -0
  263. package/{dist → lib}/plugin/Tpl.d.ts +3 -2
  264. package/lib/plugin/Tpl.js +183 -0
  265. package/{dist → lib}/plugin/Video.d.ts +1 -1
  266. package/lib/plugin/Video.js +140 -0
  267. package/{dist → lib}/plugin/WebComponent.d.ts +1 -1
  268. package/lib/plugin/WebComponent.js +70 -0
  269. package/{dist → lib}/plugin/Wizard.d.ts +5 -2
  270. package/lib/plugin/Wizard.js +799 -0
  271. package/{dist → lib}/plugin/Wrapper.d.ts +1 -1
  272. package/lib/plugin/Wrapper.js +136 -0
  273. package/lib/renderer/APIControl.d.ts +7526 -0
  274. package/lib/renderer/APIControl.js +791 -0
  275. package/lib/renderer/BadgeControl.d.ts +133 -0
  276. package/lib/renderer/BadgeControl.js +290 -0
  277. package/lib/renderer/DataBindingControl.d.ts +14 -0
  278. package/lib/renderer/DataBindingControl.js +91 -0
  279. package/lib/renderer/DataMappingControl.d.ts +11 -0
  280. package/lib/renderer/DataMappingControl.js +73 -0
  281. package/lib/renderer/DataPickerControl.d.ts +13 -0
  282. package/lib/renderer/DataPickerControl.js +83 -0
  283. package/lib/renderer/DateShortCutControl.d.ts +83 -0
  284. package/lib/renderer/DateShortCutControl.js +254 -0
  285. package/lib/renderer/FormulaControl.d.ts +96 -0
  286. package/lib/renderer/FormulaControl.js +324 -0
  287. package/{dist/component/Control → lib/renderer}/OptionControl.d.ts +23 -34
  288. package/lib/renderer/OptionControl.js +672 -0
  289. package/{dist/component/Control → lib/renderer}/PopoverEdit.d.ts +0 -0
  290. package/lib/renderer/RangePartsControl.d.ts +91 -0
  291. package/lib/renderer/RangePartsControl.js +392 -0
  292. package/lib/renderer/StatusControl.d.ts +39 -0
  293. package/lib/renderer/StatusControl.js +171 -0
  294. package/lib/renderer/SwitchMoreControl.d.ts +222 -0
  295. package/lib/renderer/SwitchMoreControl.js +302 -0
  296. package/lib/renderer/ValidationControl.d.ts +65 -0
  297. package/lib/renderer/ValidationControl.js +279 -0
  298. package/lib/renderer/ValidationItem.d.ts +46 -0
  299. package/lib/renderer/ValidationItem.js +147 -0
  300. package/lib/renderer/style-control/Background.d.ts +17 -0
  301. package/lib/renderer/style-control/Background.js +493 -0
  302. package/lib/renderer/style-control/Border.d.ts +18 -0
  303. package/lib/renderer/style-control/Border.js +191 -0
  304. package/lib/renderer/style-control/BoxModel.d.ts +17 -0
  305. package/lib/renderer/style-control/BoxModel.js +73 -0
  306. package/lib/renderer/style-control/BoxShadow.d.ts +18 -0
  307. package/lib/renderer/style-control/BoxShadow.js +125 -0
  308. package/lib/renderer/style-control/Display.d.ts +14 -0
  309. package/lib/renderer/style-control/Display.js +233 -0
  310. package/lib/renderer/style-control/Font.d.ts +16 -0
  311. package/lib/renderer/style-control/Font.js +239 -0
  312. package/lib/renderer/style-control/font-family.d.ts +11 -0
  313. package/lib/renderer/style-control/font-family.js +149 -0
  314. package/lib/renderer/style-control/transformation.d.ts +29 -0
  315. package/lib/renderer/style-control/transformation.js +84 -0
  316. package/lib/renderer/style-control/types.d.ts +8 -0
  317. package/lib/tpl/api.d.ts +1 -0
  318. package/lib/tpl/api.js +378 -0
  319. package/lib/tpl/common.d.ts +1 -0
  320. package/lib/tpl/common.js +808 -0
  321. package/lib/tpl/horizontal.d.ts +1 -0
  322. package/lib/tpl/horizontal.js +260 -0
  323. package/lib/tpl/index.d.ts +7 -0
  324. package/lib/tpl/options.d.ts +1 -0
  325. package/lib/tpl/options.js +265 -0
  326. package/{dist/component/schemaTpl.d.ts → lib/tpl/style.d.ts} +0 -4
  327. package/lib/tpl/style.js +372 -0
  328. package/lib/tpl/validations.d.ts +1 -0
  329. package/lib/tpl/validations.js +568 -0
  330. package/lib/util.d.ts +23 -0
  331. package/lib/util.js +64 -0
  332. package/lib/validator.d.ts +62 -0
  333. package/lib/validator.js +417 -0
  334. package/package.json +36 -32
  335. package/dist/cebfe0bc5a1dbde02da1.svg +0 -10
  336. package/dist/compat.d.ts +0 -30
  337. package/dist/component/Breadcrumb.d.ts +0 -33
  338. package/dist/component/ClassNameControl.d.ts +0 -31
  339. package/dist/component/CommonConfigWrapper.d.ts +0 -6
  340. package/dist/component/ContainerWrapper.d.ts +0 -12
  341. package/dist/component/Control/APIControl.d.ts +0 -504
  342. package/dist/component/Control/ValidationControl.d.ts +0 -30
  343. package/dist/component/Editor.d.ts +0 -81
  344. package/dist/component/HighlightBox.d.ts +0 -29
  345. package/dist/component/IFrameBridge.d.ts +0 -32
  346. package/dist/component/IFramePreview.d.ts +0 -38
  347. package/dist/component/MiniEditor.d.ts +0 -9
  348. package/dist/component/NodeWrapper.d.ts +0 -20
  349. package/dist/component/Panel/AMisCodeEditor.d.ts +0 -37
  350. package/dist/component/Panel/AvailableRenderersPanel.d.ts +0 -10
  351. package/dist/component/Panel/CodeEditorPanel.d.ts +0 -6
  352. package/dist/component/Panel/ContextMenuPanel.d.ts +0 -8
  353. package/dist/component/Panel/DrawerPanel.d.ts +0 -15
  354. package/dist/component/Panel/DrawerRendererPanel.d.ts +0 -15
  355. package/dist/component/Panel/InsertSubRendererPanel.d.ts +0 -11
  356. package/dist/component/Panel/LeftPanels.d.ts +0 -20
  357. package/dist/component/Panel/Outline.d.ts +0 -18
  358. package/dist/component/Panel/RenderersPanel.d.ts +0 -31
  359. package/dist/component/Panel/RightPanels.d.ts +0 -21
  360. package/dist/component/Panel/TargetNamePanel.d.ts +0 -7
  361. package/dist/component/PopOverForm.d.ts +0 -22
  362. package/dist/component/Preview.d.ts +0 -67
  363. package/dist/component/RegionHLBox.d.ts +0 -20
  364. package/dist/component/RegionWrapper.d.ts +0 -196
  365. package/dist/component/RendererThumb.d.ts +0 -22
  366. package/dist/component/ScaffoldModal.d.ts +0 -24
  367. package/dist/component/SubEditor.d.ts +0 -67
  368. package/dist/component/VRenderer.d.ts +0 -181
  369. package/dist/component/base/BackTop.d.ts +0 -26
  370. package/dist/component/base/ErrorRenderer.d.ts +0 -4
  371. package/dist/component/base/SearchCustomRendererPanel.d.ts +0 -15
  372. package/dist/component/base/SearchPanel.d.ts +0 -83
  373. package/dist/component/base/SearchRendererPanel.d.ts +0 -19
  374. package/dist/component/base/WidthDraggableBtn.d.ts +0 -16
  375. package/dist/component/base/WidthDraggableContainer.d.ts +0 -2
  376. package/dist/component/remarkTpl.d.ts +0 -150
  377. package/dist/dnd/default.d.ts +0 -47
  378. package/dist/dnd/index.d.ts +0 -119
  379. package/dist/dnd/interface.d.ts +0 -14
  380. package/dist/dnd/position-h.d.ts +0 -7
  381. package/dist/env.d.ts +0 -5
  382. package/dist/exports.d.ts +0 -8
  383. package/dist/exports.min.js +0 -1
  384. package/dist/icons/index.d.ts +0 -2
  385. package/dist/index.min.js +0 -1
  386. package/dist/manager.d.ts +0 -457
  387. package/dist/mocker.d.ts +0 -1
  388. package/dist/plugin/AnchorNav.d.ts +0 -67
  389. package/dist/plugin/ButtonGroup.d.ts +0 -60
  390. package/dist/plugin/ErrorRenderer.d.ts +0 -7
  391. package/dist/plugin/Form/CodeEditor.d.ts +0 -40
  392. package/dist/plugin/Form/InputExcel.d.ts +0 -58
  393. package/dist/plugin/Form/InputRating.d.ts +0 -19
  394. package/dist/plugin/Form/InputText.d.ts +0 -20
  395. package/dist/plugin/Form/LocationPicker.d.ts +0 -48
  396. package/dist/plugin/Nav.d.ts +0 -163
  397. package/dist/plugin/Others/BasicToolbar.d.ts +0 -11
  398. package/dist/plugin/Others/DataDebug.d.ts +0 -19
  399. package/dist/plugin/Others/Unknown.d.ts +0 -5
  400. package/dist/plugin/Panel/AvailableRenderers.d.ts +0 -8
  401. package/dist/plugin/Panel/Code.d.ts +0 -9
  402. package/dist/plugin/Panel/Name.d.ts +0 -8
  403. package/dist/plugin/Panel/Outline.d.ts +0 -8
  404. package/dist/plugin.d.ts +0 -601
  405. package/dist/store/editor.d.ts +0 -1021
  406. package/dist/store/node.d.ts +0 -265
  407. package/dist/style.css +0 -1
  408. package/dist/util.d.ts +0 -72
  409. package/src/component/schemaTpl.tsx +0 -2157
  410. package/src/plugin/Alert.tsx +0 -87
  411. package/src/plugin/AnchorNav.tsx +0 -233
  412. package/src/plugin/Audio.tsx +0 -154
  413. package/src/plugin/Avatar.tsx +0 -77
  414. package/src/plugin/Breadcrumb.tsx +0 -107
  415. package/src/plugin/Button.tsx +0 -281
  416. package/src/plugin/ButtonGroup.tsx +0 -85
  417. package/src/plugin/ButtonToolbar.tsx +0 -87
  418. package/src/plugin/CRUD.tsx +0 -1835
  419. package/src/plugin/Card.tsx +0 -290
  420. package/src/plugin/Cards.tsx +0 -318
  421. package/src/plugin/Carousel.tsx +0 -377
  422. package/src/plugin/Chart.tsx +0 -218
  423. package/src/plugin/CodeView.tsx +0 -60
  424. package/src/plugin/Collapse.tsx +0 -136
  425. package/src/plugin/CollapseGroup.tsx +0 -167
  426. package/src/plugin/Container.tsx +0 -40
  427. package/src/plugin/Custom.tsx +0 -128
  428. package/src/plugin/CustomRegion.tsx +0 -156
  429. package/src/plugin/Date.tsx +0 -74
  430. package/src/plugin/Datetime.tsx +0 -68
  431. package/src/plugin/Dialog.tsx +0 -176
  432. package/src/plugin/Divider.tsx +0 -36
  433. package/src/plugin/Drawer.tsx +0 -214
  434. package/src/plugin/DropDownButton.tsx +0 -235
  435. package/src/plugin/Each.tsx +0 -150
  436. package/src/plugin/ErrorRenderer.tsx +0 -15
  437. package/src/plugin/Flex.tsx +0 -151
  438. package/src/plugin/Form/ButtonGroupSelect.tsx +0 -75
  439. package/src/plugin/Form/ButtonToolbar.tsx +0 -110
  440. package/src/plugin/Form/ChainedSelect.tsx +0 -70
  441. package/src/plugin/Form/Checkbox.tsx +0 -87
  442. package/src/plugin/Form/Checkboxes.tsx +0 -167
  443. package/src/plugin/Form/CodeEditor.tsx +0 -81
  444. package/src/plugin/Form/Combo.tsx +0 -582
  445. package/src/plugin/Form/ConditionBuilder.tsx +0 -315
  446. package/src/plugin/Form/Control.tsx +0 -139
  447. package/src/plugin/Form/DiffEditor.tsx +0 -111
  448. package/src/plugin/Form/FieldSet.tsx +0 -163
  449. package/src/plugin/Form/Form.tsx +0 -687
  450. package/src/plugin/Form/Formula.tsx +0 -79
  451. package/src/plugin/Form/Group.tsx +0 -295
  452. package/src/plugin/Form/Hidden.tsx +0 -44
  453. package/src/plugin/Form/InputArray.tsx +0 -228
  454. package/src/plugin/Form/InputCity.tsx +0 -93
  455. package/src/plugin/Form/InputColor.tsx +0 -123
  456. package/src/plugin/Form/InputDate.tsx +0 -175
  457. package/src/plugin/Form/InputDateRange.tsx +0 -225
  458. package/src/plugin/Form/InputDateTime.tsx +0 -183
  459. package/src/plugin/Form/InputDateTimeRange.tsx +0 -221
  460. package/src/plugin/Form/InputEmail.tsx +0 -33
  461. package/src/plugin/Form/InputExcel.tsx +0 -85
  462. package/src/plugin/Form/InputFile.tsx +0 -221
  463. package/src/plugin/Form/InputGroup.tsx +0 -96
  464. package/src/plugin/Form/InputImage.tsx +0 -266
  465. package/src/plugin/Form/InputKV.tsx +0 -72
  466. package/src/plugin/Form/InputMonth.tsx +0 -35
  467. package/src/plugin/Form/InputMonthRange.tsx +0 -195
  468. package/src/plugin/Form/InputNumber.tsx +0 -89
  469. package/src/plugin/Form/InputPassword.tsx +0 -33
  470. package/src/plugin/Form/InputQuarter.tsx +0 -35
  471. package/src/plugin/Form/InputQuarterRange.tsx +0 -195
  472. package/src/plugin/Form/InputRange.tsx +0 -121
  473. package/src/plugin/Form/InputRating.tsx +0 -78
  474. package/src/plugin/Form/InputRepeat.tsx +0 -57
  475. package/src/plugin/Form/InputRichText.tsx +0 -186
  476. package/src/plugin/Form/InputSubForm.tsx +0 -189
  477. package/src/plugin/Form/InputTable.tsx +0 -434
  478. package/src/plugin/Form/InputTag.tsx +0 -70
  479. package/src/plugin/Form/InputText.tsx +0 -186
  480. package/src/plugin/Form/InputTime.tsx +0 -85
  481. package/src/plugin/Form/InputTree.tsx +0 -229
  482. package/src/plugin/Form/InputURL.tsx +0 -34
  483. package/src/plugin/Form/InputYear.tsx +0 -35
  484. package/src/plugin/Form/Item.tsx +0 -327
  485. package/src/plugin/Form/ListSelect.tsx +0 -73
  486. package/src/plugin/Form/LocationPicker.tsx +0 -62
  487. package/src/plugin/Form/MatrixCheckboxes.tsx +0 -136
  488. package/src/plugin/Form/NestedSelect.tsx +0 -211
  489. package/src/plugin/Form/Picker.tsx +0 -209
  490. package/src/plugin/Form/Radios.tsx +0 -119
  491. package/src/plugin/Form/Select.tsx +0 -233
  492. package/src/plugin/Form/Static.tsx +0 -322
  493. package/src/plugin/Form/Switch.tsx +0 -107
  494. package/src/plugin/Form/TabsTransfer.tsx +0 -259
  495. package/src/plugin/Form/Textarea.tsx +0 -83
  496. package/src/plugin/Form/Transfer.tsx +0 -368
  497. package/src/plugin/Form/TreeSelect.tsx +0 -263
  498. package/src/plugin/Form/UUID.tsx +0 -48
  499. package/src/plugin/Grid.tsx +0 -798
  500. package/src/plugin/HBox.tsx +0 -727
  501. package/src/plugin/IFrame.tsx +0 -70
  502. package/src/plugin/Image.tsx +0 -314
  503. package/src/plugin/Images.tsx +0 -231
  504. package/src/plugin/Json.tsx +0 -69
  505. package/src/plugin/Link.tsx +0 -93
  506. package/src/plugin/List.tsx +0 -278
  507. package/src/plugin/ListItem.tsx +0 -229
  508. package/src/plugin/Log.tsx +0 -52
  509. package/src/plugin/Mapping.tsx +0 -149
  510. package/src/plugin/Markdown.tsx +0 -47
  511. package/src/plugin/Nav.tsx +0 -184
  512. package/src/plugin/Operation.tsx +0 -95
  513. package/src/plugin/Others/Action.tsx +0 -426
  514. package/src/plugin/Others/BasicToolbar.tsx +0 -585
  515. package/src/plugin/Others/DataDebug.tsx +0 -134
  516. package/src/plugin/Others/TableCell.tsx +0 -480
  517. package/src/plugin/Others/Unknown.tsx +0 -37
  518. package/src/plugin/Page.tsx +0 -306
  519. package/src/plugin/Panel/AvailableRenderers.tsx +0 -41
  520. package/src/plugin/Panel/Code.tsx +0 -44
  521. package/src/plugin/Panel/Name.tsx +0 -26
  522. package/src/plugin/Panel/Outline.tsx +0 -40
  523. package/src/plugin/Panel.tsx +0 -243
  524. package/src/plugin/Plain.tsx +0 -84
  525. package/src/plugin/Progress.tsx +0 -125
  526. package/src/plugin/Property.tsx +0 -139
  527. package/src/plugin/QRCode.tsx +0 -96
  528. package/src/plugin/Reset.tsx +0 -23
  529. package/src/plugin/Service.tsx +0 -162
  530. package/src/plugin/Sparkline.tsx +0 -40
  531. package/src/plugin/Status.tsx +0 -76
  532. package/src/plugin/Steps.tsx +0 -128
  533. package/src/plugin/Submit.tsx +0 -23
  534. package/src/plugin/Table.tsx +0 -428
  535. package/src/plugin/TableView.tsx +0 -709
  536. package/src/plugin/Tabs.tsx +0 -362
  537. package/src/plugin/Tasks.tsx +0 -274
  538. package/src/plugin/Time.tsx +0 -68
  539. package/src/plugin/TooltipWrapper.tsx +0 -193
  540. package/src/plugin/Tpl.tsx +0 -158
  541. package/src/plugin/Video.tsx +0 -158
  542. package/src/plugin/WebComponent.tsx +0 -53
  543. package/src/plugin/Wizard.tsx +0 -740
  544. package/src/plugin/Wrapper.tsx +0 -107
  545. package/src/plugin.ts +0 -1050
  546. package/static/Code-hover.png +0 -0
  547. package/static/Code.png +0 -0
  548. package/static/Outline-hover.png +0 -0
  549. package/static/Outline.png +0 -0
  550. package/static/Renderers-hover.png +0 -0
  551. package/static/Renderers.png +0 -0
  552. package/static/side_hide_left.svg +0 -10
package/src/plugin.ts DELETED
@@ -1,1050 +0,0 @@
1
- /**
2
- * @file 定义插件的 interface,以及提供一个 BasePlugin 基类,把一些通用的方法放在这。
3
- */
4
-
5
- import {RegionWrapperProps} from './component/RegionWrapper';
6
- import {EditorManager} from './manager';
7
- import {EditorStoreType} from './store/editor';
8
- import {EditorNodeType} from './store/node';
9
- import {DNDModeInterface} from './dnd/interface';
10
- import {EditorDNDManager} from './dnd';
11
- import React from 'react';
12
- import {DiffChange} from './util';
13
- import find from 'lodash/find';
14
- import type {RendererConfig} from 'amis-core/lib/factory';
15
- import type {MenuDivider, MenuItem} from 'amis-ui/lib/components/ContextMenu';
16
- import type {BaseSchema} from 'amis/lib/Schema';
17
-
18
- /**
19
- * 区域的定义,容器渲染器都需要定义区域信息。
20
- */
21
- export interface RegionConfig {
22
- /**
23
- * 简单情况,如果区域直接用的 render('region', subSchema)
24
- * 这种只需要配置 key 就能简单插入 Region 节点。
25
- */
26
- key: string;
27
-
28
- /**
29
- * 区域用来显示的名字。
30
- */
31
- label: string;
32
-
33
- /**
34
- * 区域占位字符,用于提示
35
- */
36
- placeholder?: string;
37
-
38
- /**
39
- * 对于复杂的控件需要用到这个配置。
40
- * 如果配置了,则遍历 react dom 直到目标节点调换成 Region 节点
41
- *
42
- * 如果没有配置这个,但是又配置了 renderMethod 方法,
43
- * 那就直接将 renderMethod 里面返回的 react dom 直接包一层 Region
44
- */
45
- matchRegion?: (
46
- elem: JSX.Element | undefined | null,
47
- component: JSX.Element
48
- ) => boolean;
49
-
50
- /**
51
- * 指定要覆盖哪个方法。
52
- */
53
- renderMethod?: string;
54
-
55
- /**
56
- * 通常是hack 当前渲染器,单有时候当前渲染器其实是组合的别的渲染器。
57
- */
58
- rendererName?: string;
59
-
60
- /**
61
- * 当配置 renderMethod 的时候会自动把 Region 插入进去。
62
- * 默认是 outter 模式,有时候可能需要配置成 inner,
63
- * 比如 renderMethod 为 render 的时候。
64
- */
65
- insertPosition?: 'outter' | 'inner';
66
-
67
- /**
68
- * 是否为可选容器,如果是可选容器,不会强制自动创建成员
69
- */
70
- optional?: boolean;
71
-
72
- /**
73
- * 有时候有些包括是需要其他条件的,所以要自己写包裹逻辑。
74
- * 比如 Panel 里面的 renderBody
75
- */
76
- renderMethodOverride?: (
77
- regions: Array<RegionConfig>,
78
- insertRegion: (
79
- component: JSX.Element,
80
- dom: JSX.Element,
81
- regions: Array<RegionConfig>,
82
- info: RendererInfo,
83
- manager: EditorManager
84
- ) => JSX.Element
85
- ) => Function;
86
-
87
- /**
88
- * 偏好什么类型的组件?比如表单里面,controls 容器偏向表单项。
89
- */
90
- preferTag?: string;
91
-
92
- /**
93
- * 用来指定用什么组件包裹,默认是 RegionWrapper
94
- */
95
- wrapper?: React.ComponentType<RegionWrapperProps>;
96
-
97
- /**
98
- * 返回需要添加 data-region 的 dom 节点。
99
- */
100
- wrapperResolve?: (dom: HTMLElement) => HTMLElement;
101
-
102
- /**
103
- * 当拖入到这个容器时,是否需要修改一下 ghost 结构?
104
- */
105
- modifyGhost?: (ghost: HTMLElement, schema?: any) => void;
106
-
107
- /**
108
- * dnd 拖拽模式。比如 table 那种需要配置成 position-h
109
- */
110
- dndMode?:
111
- | 'default'
112
- | 'position-h'
113
- | 'position-v'
114
- | (new (dnd: EditorDNDManager) => DNDModeInterface);
115
-
116
- /**
117
- * 可以用来判断是否允许拖入当前节点。
118
- */
119
- accept?: (json: any) => boolean;
120
- }
121
-
122
- export interface VRendererConfig {
123
- /**
124
- * 配置了这些会自动创建编辑面板。
125
- */
126
- panelIcon?: string;
127
- panelTitle?: string;
128
- /**
129
- * @deprecated 用 panelBody 代替
130
- */
131
- panelControls?: Array<any>;
132
- panelDefinitions?: any;
133
- /**
134
- * @deprecated 用panelBodyCreator 代替
135
- */
136
- panelControlsCreator?: (context: BaseEventContext) => Array<any>;
137
- panelBody?: Array<any>;
138
- panelBodyCreator?: (context: BaseEventContext) => Array<any>;
139
-
140
- /**
141
- * 配置了,要是不在 overides 里面使用也是没用的。
142
- */
143
- regions?: {
144
- [propName: string]: RegionConfig;
145
- };
146
- }
147
-
148
- export interface RendererScaffoldInfo {
149
- /**
150
- * 组件名称
151
- */
152
- name: string;
153
-
154
- // 图标
155
- icon?: string;
156
-
157
- // 组件描述信息
158
- description?: string;
159
-
160
- // 文档链接
161
- docLink?: string;
162
-
163
- // 用来生成预览图
164
- previewSchema?: any;
165
-
166
- // 分类
167
- tags?: string | Array<string>;
168
-
169
- // type 和 scaffold 二选一
170
- type?: string;
171
- scaffold?: any;
172
- }
173
-
174
- /**
175
- * 渲染器信息。
176
- */
177
- export interface RendererInfo extends RendererScaffoldInfo {
178
- scaffolds?: Array<Partial<RendererScaffoldInfo>>;
179
-
180
- rendererName?: string;
181
-
182
- /**
183
- * json schema 协议
184
- */
185
- $schema?: string;
186
-
187
- isBaseComponent?: boolean;
188
-
189
- disabledRendererPlugin?: boolean;
190
-
191
- /**
192
- * 配置区域。
193
- */
194
- regions?: Array<RegionConfig>;
195
-
196
- /**
197
- * 哪些容器属性需要自动转成数组的。如果不配置默认就从 regions 里面读取。
198
- */
199
- patchContainers?: Array<string>;
200
-
201
- /**
202
- * 覆盖的目标渲染器名称
203
- */
204
- overrideTargetRendererName?: string;
205
-
206
- /**
207
- * 覆写某些方法,一般用来插入虚拟的渲染器编辑器。
208
- */
209
- overrides?: {
210
- [propName: string]: Function;
211
- };
212
-
213
- /**
214
- * 虚拟渲染器的配置项,有时候需要给那些并不是渲染器的组件添加点选编辑功能。
215
- * 比如: Tabs 下面的 Tab, 这个并不是个渲染器,但是需要可以点选修改内容。
216
- */
217
- vRendererConfig?: VRendererConfig;
218
-
219
- /**
220
- * 默认为 BaseWrapper, 容器类的指定为 BaseContainerWrapper 或者再实现一个
221
- * 暂时没有需要配置的所以注释掉。
222
- * wrapper?: React.ComponentType<NodeWrapperProps>;
223
- *
224
- * 返回哪些 dom 节点,需要自动加上 data-editor-id 属性
225
- * 目前只有 TableCell 里面用到了,就它需要同时给某一列下所有 td 都加上那个属性。
226
- */
227
- wrapperResolve?: (dom: HTMLElement) => HTMLElement | Array<HTMLElement>;
228
-
229
- /**
230
- * 默认下发哪些属性,如果要动态下发,请使用 filterProps
231
- */
232
- wrapperProps?: any;
233
-
234
- /**
235
- * 修改一些属性,一般用来干掉 $$id
236
- * 这样它的孩子节点就不能直接点选编辑了,比如 Combo。
237
- */
238
- filterProps?: (props: any, node: EditorNodeType) => any;
239
-
240
- /**
241
- * 有些没有视图的组件,可以自己输出点内容,否则没办法点选编辑。
242
- */
243
- renderRenderer?: (props: any, info: RendererInfo) => JSX.Element;
244
-
245
- /**
246
- * 是否有多重身份?
247
- * 比如 CRUD 即是 CRUD 又可能是 Table
248
- *
249
- * 表格的列,即是表格列,也可能是其他文本框。
250
- *
251
- * 配置了这个后会自动添加多个 Panel 面板来编辑。
252
- */
253
- multifactor?: boolean;
254
-
255
- /**
256
- * 右键的时候是否出现重新构建,靠这个。
257
- */
258
- scaffoldForm?: ScaffoldForm;
259
-
260
- // 自动填入,不用配置
261
- id: string;
262
- plugin: PluginInterface;
263
- extraPlugin?: PluginInterface; // 辅助插件,看需求。
264
- renderer: RendererConfig;
265
- schemaPath: string;
266
-
267
- // 给 subEditor 用的,别直接配置
268
- editable?: boolean; // 是否可编辑。
269
- removable?: boolean; // 是否可被删除
270
- draggable?: boolean; // 是否可被拖动
271
- movable?: boolean; // 是否可被移动
272
- replaceable?: boolean; // 是否可被替换
273
- duplicatable?: boolean; // 是否可以重复一份
274
- memberImmutable?: boolean | Array<string>; // 成员节点固定,意味着不能新增成员
275
- typeMutable?: boolean; // 类型是否可被修改
276
-
277
- // 如果是虚拟的渲染器
278
- hostId?: string;
279
- memberIndex?: number;
280
- }
281
-
282
- export type BasicRendererInfo = Omit<
283
- RendererInfo,
284
- 'id' | 'plugin' | 'renderer' | 'schemaPath'
285
- >;
286
-
287
- export interface PopOverForm {
288
- title?: string;
289
-
290
- /**
291
- * 脚手架配置项。
292
- */
293
- body: Array<any>;
294
-
295
- /**
296
- * @deprecated 改用 body 代替
297
- */
298
- controls?: Array<any>;
299
- }
300
-
301
- export interface ScaffoldForm extends PopOverForm {
302
- mode?: 'normal' | 'horizontal' | 'inline';
303
-
304
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
305
- initApi?: any;
306
- api?: any;
307
-
308
- /**
309
- * 整体验证脚手架配置,如果有错误返回错误对象。
310
- * key 是配置的字段名。
311
- * value 是具体错误信息。
312
- */
313
- validate?: (
314
- values: any
315
- ) =>
316
- | void
317
- | {[propName: string]: string}
318
- | Promise<void | {[propName: string]: string}>;
319
-
320
- /**
321
- * schema 配置转脚手架配置
322
- */
323
- pipeIn?: (value: any) => any;
324
-
325
- /**
326
- * 脚手架配置转 schema 配置。
327
- */
328
- pipeOut?: (value: any) => any;
329
-
330
- /**
331
- * 是否允许重新构建;
332
- */
333
- canRebuild?: boolean;
334
- }
335
-
336
- /**
337
- * 子渲染器信息
338
- */
339
- export interface SubRendererInfo extends RendererScaffoldInfo {
340
- /**
341
- * 用于判断是否是平台预置组件,平台预置组件为true。
342
- */
343
- isBaseComponent?: boolean;
344
-
345
- rendererName?: string;
346
- /**
347
- * 首次拖入的时候可以用来配置个表单。
348
- */
349
- scaffoldForm?: ScaffoldForm;
350
- /**
351
- * 新增属性,用于判断是否出现在组件面板中,默认为false,为ture则不展示
352
- */
353
- disabledRendererPlugin?: boolean;
354
-
355
- // 自动填入,不用配置
356
- plugin: PluginInterface;
357
- parent: RendererInfo;
358
- id: string;
359
- order: number;
360
- }
361
-
362
- export type BasicSubRenderInfo = Omit<
363
- SubRendererInfo,
364
- 'plugin' | 'parent' | 'id' | 'order'
365
- > &
366
- Partial<Pick<SubRendererInfo, 'order'>>;
367
-
368
- /**
369
- * 工具按钮信息。
370
- */
371
- export interface ToolbarItem {
372
- label?: string;
373
- id?: string;
374
- order: number;
375
- level?: 'primary' | 'secondary' | 'special';
376
- className?: string;
377
- draggable?: boolean;
378
- onDragStart?: (e: any) => void;
379
- icon?: string;
380
- iconSvg?: string; // 自定义icon(svg格式)
381
- onClick?: (e: any) => void;
382
- tooltip?: string;
383
- placement?: 'top' | 'bottom' | 'right' | 'left';
384
- }
385
-
386
- export type BasicToolbarItem = Partial<ToolbarItem>;
387
-
388
- export type ContextMenuItem = MenuItem | MenuDivider;
389
-
390
- /**
391
- * 面板的属性定义
392
- */
393
- export interface PanelProps {
394
- id?: string;
395
- info?: RendererInfo;
396
- path?: string;
397
- node?: EditorNodeType;
398
- value: BaseSchema;
399
- onChange: (value: BaseSchema, diff?: Array<DiffChange>) => void;
400
- store: EditorStoreType;
401
- manager: EditorManager;
402
- popOverContainer?: () => HTMLElement | void;
403
- }
404
-
405
- /**
406
- * 面板信息定义
407
- */
408
- export interface PanelItem {
409
- nodeId?: string;
410
- key: string;
411
- icon: string;
412
- title: string | JSX.Element; // 标题
413
- component?: React.ComponentType<PanelProps | any>;
414
- order: number;
415
- position?: 'left' | 'right';
416
- render?: (props: PanelProps) => JSX.Element;
417
- menus?: Array<any>;
418
- }
419
-
420
- export type BasicPanelItem = Omit<PanelItem, 'order'> &
421
- Partial<Pick<PanelItem, 'order'>>;
422
-
423
- export interface EventContext {
424
- data?: any;
425
- [propName: string]: any;
426
- }
427
-
428
- /**
429
- * 事件上下文
430
- */
431
- export interface BaseEventContext extends EventContext {
432
- node: EditorNodeType;
433
- id: string;
434
- info: RendererInfo;
435
- path: string;
436
- schema: any;
437
- schemaPath: string;
438
- secondFactor?: boolean;
439
- }
440
-
441
- export interface RendererInfoResolveEventContext extends EventContext {
442
- renderer: RendererConfig;
443
- path: string;
444
- schema: any;
445
- schemaPath: string;
446
- data?: RendererInfo;
447
- }
448
-
449
- export interface RendererJSONSchemaResolveEventContext
450
- extends BaseEventContext {
451
- data: string;
452
- }
453
-
454
- /**
455
- * 右键菜单事件的上下文。
456
- */
457
- export interface ContextMenuEventContext extends BaseEventContext {
458
- region: string;
459
- selections: Array<BaseEventContext>;
460
- data: Array<ContextMenuItem>;
461
- }
462
-
463
- export interface SelectionEventContext extends BaseEventContext {
464
- selections: Array<BaseEventContext>;
465
- data: Array<string>;
466
- }
467
-
468
- export interface RendererEventContext extends BaseEventContext {
469
- region?: string;
470
- }
471
-
472
- export interface ActiveEventContext extends Partial<BaseEventContext> {
473
- active?: boolean;
474
- }
475
-
476
- export interface DeleteEventContext extends BaseEventContext {
477
- data?: Array<string>;
478
- }
479
-
480
- /**
481
- * 插入节点的事件上下文信息
482
- */
483
- export interface InsertEventContext extends BaseEventContext {
484
- region: string;
485
- beforeId?: string;
486
- index: number;
487
- data: any;
488
- subRenderer?: SubRendererInfo;
489
- dragInfo?: {
490
- id: string;
491
- type: string;
492
- data: any;
493
- };
494
- }
495
-
496
- export interface ReplaceEventContext extends BaseEventContext {
497
- data: any;
498
- subRenderer?: SubRendererInfo;
499
- region?: string;
500
- }
501
-
502
- export interface MoveEventContext extends BaseEventContext {
503
- region: string;
504
- sourceId: string;
505
- beforeId?: string;
506
- direction?: 'up' | 'down';
507
- }
508
-
509
- /**
510
- * 更新节点的事件上下文
511
- */
512
- export interface ChangeEventContext extends BaseEventContext {
513
- value: any;
514
- readonly diff: Array<DiffChange>;
515
- }
516
-
517
- export interface DragEventContext extends EventContext {
518
- mode: 'move' | 'copy';
519
- sourceType: 'schema' | 'subrenderer' | string;
520
- sourceId: string;
521
- data: any;
522
-
523
- targetId?: string;
524
- targetRegion?: string;
525
- }
526
-
527
- export interface BuildPanelEventContext extends BaseEventContext {
528
- data: Array<BasicPanelItem>;
529
- selections: Array<BaseEventContext>;
530
- }
531
-
532
- export interface PreventClickEventContext extends EventContext {
533
- data: MouseEvent;
534
- }
535
-
536
- export interface ResizeMoveEventContext extends EventContext {
537
- data: Object;
538
- nativeEvent: MouseEvent;
539
- dom: HTMLElement;
540
- resizer: HTMLElement;
541
- node: EditorNodeType;
542
- }
543
-
544
- /**
545
- * 将事件上下文转成事件对象。
546
- */
547
- export type PluginEvent<T, P = any> = {
548
- context: T;
549
- type: string;
550
- preventDefault: () => void;
551
- stopPropagation: () => void;
552
- setData: (data: P) => void;
553
-
554
- // 是否被阻止?
555
- prevented?: boolean;
556
- stoped?: boolean;
557
-
558
- // 当前值
559
- data?: P;
560
- };
561
-
562
- export type PluginEventFn = (e: PluginEvent<EventContext>) => false | void;
563
-
564
- /**
565
- * 创建事件。
566
- * @param type
567
- * @param context
568
- */
569
- export function createEvent<T extends EventContext>(
570
- type: string,
571
- context: T
572
- ): PluginEvent<T> {
573
- const event = {
574
- context,
575
- type,
576
- prevented: false,
577
- stoped: false,
578
- preventDefault() {
579
- event.prevented = true;
580
- },
581
- stopPropagation() {
582
- event.stoped = true;
583
- },
584
- get data() {
585
- return event.context.data;
586
- },
587
- setData(data: any) {
588
- event.context.data = data;
589
- }
590
- };
591
-
592
- return event;
593
- }
594
-
595
- export interface PluginEventListener {
596
- onActive?: (event: PluginEvent<ActiveEventContext>) => void;
597
-
598
- /**
599
- * 事件,当有配置项插入前调用。通过 event.preventDefault() 可以干预。
600
- */
601
- beforeInsert?: (event: PluginEvent<InsertEventContext>) => false | void;
602
- afterInsert?: (event: PluginEvent<InsertEventContext>) => void;
603
-
604
- /**
605
- * 面板里面编辑修改的事件。
606
- */
607
- beforeUpdate?: (event: PluginEvent<ChangeEventContext>) => false | void;
608
- afterUpdate?: (event: PluginEvent<ChangeEventContext>) => void;
609
-
610
- /**
611
- * 更新渲染器,或者右键粘贴配置。
612
- */
613
- beforeReplace?: (event: PluginEvent<ReplaceEventContext>) => false | void;
614
- afterReplace?: (event: PluginEvent<ReplaceEventContext>) => void;
615
-
616
- /**
617
- * 移动节点的时候触发,包括上移,下移
618
- */
619
- beforeMove?: (event: PluginEvent<MoveEventContext>) => false | void;
620
- aftterMove?: (event: PluginEvent<MoveEventContext>) => void;
621
-
622
- /**
623
- * 删除的时候触发
624
- */
625
- beforeDelete?: (event: PluginEvent<DeleteEventContext>) => false | void;
626
- afterDelete?: (event: PluginEvent<DeleteEventContext>) => void;
627
-
628
- beforeResolveEditorInfo?: (
629
- event: PluginEvent<RendererInfoResolveEventContext>
630
- ) => false | void;
631
- afterResolveEditorInfo?: (
632
- event: PluginEvent<RendererInfoResolveEventContext>
633
- ) => void;
634
-
635
- beforeResolveJsonSchema?: (
636
- event: PluginEvent<RendererJSONSchemaResolveEventContext>
637
- ) => false | void;
638
- afterResolveJsonSchema?: (
639
- event: PluginEvent<RendererJSONSchemaResolveEventContext>
640
- ) => void;
641
-
642
- onDndAccept?: (event: PluginEvent<DragEventContext>) => false | void;
643
-
644
- onBuildPanels?: (event: PluginEvent<BuildPanelEventContext>) => void;
645
-
646
- onBuildContextMenus?: (event: PluginEvent<ContextMenuEventContext>) => void;
647
-
648
- onBuildToolbars?: (event: PluginEvent<BaseEventContext>) => void;
649
-
650
- onSelectionChange?: (event: PluginEvent<SelectionEventContext>) => void;
651
-
652
- onPreventClick?: (
653
- event: PluginEvent<PreventClickEventContext>
654
- ) => false | void;
655
-
656
- onWidthChangeStart?: (
657
- event: PluginEvent<
658
- ResizeMoveEventContext,
659
- {
660
- onMove(e: MouseEvent): void;
661
- onEnd(e: MouseEvent): void;
662
- }
663
- >
664
- ) => void;
665
-
666
- onHeightChangeStart?: (
667
- event: PluginEvent<
668
- ResizeMoveEventContext,
669
- {
670
- onMove(e: MouseEvent): void;
671
- onEnd(e: MouseEvent): void;
672
- }
673
- >
674
- ) => void;
675
-
676
- onSizeChangeStart?: (
677
- event: PluginEvent<
678
- ResizeMoveEventContext,
679
- {
680
- onMove(e: MouseEvent): void;
681
- onEnd(e: MouseEvent): void;
682
- }
683
- >
684
- ) => void;
685
- }
686
-
687
- /**
688
- * 插件的 interface 定义
689
- */
690
- export interface PluginInterface
691
- extends Partial<BasicRendererInfo>,
692
- Partial<BasicSubRenderInfo>,
693
- PluginEventListener {
694
- readonly manager: EditorManager;
695
-
696
- order?: number;
697
-
698
- /**
699
- * 渲染器的名字,关联后不用自己实现 getRendererInfo 了。
700
- */
701
- rendererName?: string;
702
-
703
- /**
704
- * 默认的配置面板信息
705
- */
706
- panelIcon?: string;
707
- panelTitle?: string;
708
-
709
- /**
710
- * 新增属性,用于判断是否出现在组件面板中,默认为false,为ture则不展示
711
- */
712
- disabledRendererPlugin?: boolean;
713
-
714
- /**
715
- * @deprecated 用 panelBody
716
- */
717
- panelControls?: Array<any>;
718
- panelBody?: Array<any>;
719
- panelDefinitions?: any;
720
- panelApi?: any;
721
- panelSubmitOnChange?: boolean;
722
-
723
- /**
724
- * @deprecated 用 panelBodyCreator
725
- */
726
- panelControlsCreator?: (context: BaseEventContext) => Array<any>;
727
- panelBodyCreator?: (context: BaseEventContext) => Array<any>;
728
-
729
- popOverBody?: Array<any>;
730
- popOverBodyCreator?: (context: BaseEventContext) => Array<any>;
731
-
732
- /**
733
- * 返回渲染器信息。不是每个插件都需要。
734
- */
735
- getRendererInfo?: (
736
- context: RendererInfoResolveEventContext
737
- ) => BasicRendererInfo | void;
738
-
739
- /**
740
- * 生成节点的 JSON Schema 的 uri 地址。
741
- */
742
- buildJSONSchema?: (
743
- context: RendererJSONSchemaResolveEventContext
744
- ) => void | string;
745
-
746
- /**
747
- * 构建右上角功能按钮集合
748
- */
749
- buildEditorToolbar?: (
750
- context: BaseEventContext,
751
- toolbars: Array<BasicToolbarItem>
752
- ) => void;
753
-
754
- /**
755
- * 构建右键菜单项
756
- */
757
- buildEditorContextMenu?: (
758
- context: ContextMenuEventContext,
759
- menus: Array<ContextMenuItem>
760
- ) => void;
761
-
762
- /**
763
- * 构建编辑器面板。
764
- */
765
- buildEditorPanel?: (
766
- context: BuildPanelEventContext,
767
- panels: Array<BasicPanelItem>
768
- ) => void;
769
-
770
- /**
771
- * 构建子渲染器信息集合。
772
- */
773
- buildSubRenderers?: (
774
- context: RendererEventContext,
775
- subRenderers: Array<SubRendererInfo>,
776
- renderers: Array<RendererConfig>
777
- ) => BasicSubRenderInfo | Array<BasicSubRenderInfo> | void;
778
-
779
- /**
780
- * 更新NPM自定义组件分类和排序[异步方法]
781
- * 备注:目前主要在npm自定义组件的分类和排序更新中使用
782
- */
783
- asyncUpdateCustomSubRenderersInfo?: (
784
- context: RendererEventContext,
785
- subRenderers: Array<SubRendererInfo>,
786
- renderers: Array<RendererConfig>
787
- ) => void;
788
-
789
- markDom?: (dom: HTMLElement | Array<HTMLElement>, props: any) => void;
790
- }
791
-
792
- /**
793
- * 基类,所有插件都继承这个好了,可以少写些逻辑。
794
- */
795
- export abstract class BasePlugin implements PluginInterface {
796
- constructor(readonly manager: EditorManager) {}
797
-
798
- /**
799
- * 如果配置里面有 rendererName 自动返回渲染器信息。
800
- * @param renderer
801
- */
802
- getRendererInfo({
803
- renderer,
804
- schema
805
- }: RendererInfoResolveEventContext): BasicRendererInfo | void {
806
- const plugin: PluginInterface = this;
807
-
808
- if (
809
- schema.$$id &&
810
- plugin.name &&
811
- plugin.rendererName &&
812
- plugin.rendererName === renderer.name // renderer.name 会从 renderer.type 中取值
813
- ) {
814
- // 复制部分信息出去
815
- return {
816
- name: plugin.name,
817
- regions: plugin.regions,
818
- patchContainers: plugin.patchContainers,
819
- // wrapper: plugin.wrapper,
820
- vRendererConfig: plugin.vRendererConfig,
821
- wrapperProps: plugin.wrapperProps,
822
- wrapperResolve: plugin.wrapperResolve,
823
- filterProps: plugin.filterProps,
824
- $schema: plugin.$schema,
825
- renderRenderer: plugin.renderRenderer,
826
- multifactor: plugin.multifactor,
827
- scaffoldForm: plugin.scaffoldForm,
828
- disabledRendererPlugin: plugin.disabledRendererPlugin,
829
- isBaseComponent: plugin.isBaseComponent,
830
- rendererName: plugin.rendererName
831
- };
832
- }
833
- }
834
-
835
- /**
836
- * 配置了 panelControls 自动生成配置面板
837
- * @param context
838
- * @param panels
839
- */
840
- buildEditorPanel(
841
- context: BuildPanelEventContext,
842
- panels: Array<BasicPanelItem>
843
- ) {
844
- const plugin: PluginInterface = this;
845
- const store = this.manager.store;
846
-
847
- // 没有选中元素 或者 多选时不处理
848
- if (!store.activeId || context.selections.length) {
849
- return;
850
- }
851
-
852
- if (
853
- !context.info.hostId &&
854
- (plugin.panelControls ||
855
- plugin.panelControlsCreator ||
856
- plugin.panelBody ||
857
- plugin.panelBodyCreator) &&
858
- context.info.plugin === this
859
- ) {
860
- panels.push({
861
- key: 'config',
862
- icon: plugin.panelIcon || plugin.icon || 'fa fa-cog',
863
- title: plugin.panelTitle || '设置',
864
- render: this.manager.makeSchemaFormRender({
865
- definitions: plugin.panelDefinitions,
866
- submitOnChange: plugin.panelSubmitOnChange,
867
- api: plugin.panelApi,
868
- body: plugin.panelBodyCreator
869
- ? plugin.panelBodyCreator(context)
870
- : plugin.panelBody!,
871
- controls: plugin.panelControlsCreator
872
- ? plugin.panelControlsCreator(context)
873
- : plugin.panelControls!
874
- })
875
- });
876
- } else if (
877
- context.info.plugin === this &&
878
- context.info.hostId &&
879
- (plugin.vRendererConfig?.panelControls ||
880
- plugin.vRendererConfig?.panelControlsCreator ||
881
- plugin.vRendererConfig?.panelBody ||
882
- plugin.vRendererConfig?.panelBodyCreator)
883
- ) {
884
- panels.push({
885
- key: context.info.multifactor ? 'vconfig' : 'config',
886
- icon: plugin.vRendererConfig.panelIcon || 'fa fa-cog',
887
- title: plugin.vRendererConfig.panelTitle || '设置',
888
- render: this.manager.makeSchemaFormRender({
889
- submitOnChange: plugin.panelSubmitOnChange,
890
- api: plugin.panelApi,
891
- definitions: plugin.vRendererConfig.panelDefinitions,
892
- controls: plugin.vRendererConfig.panelControlsCreator
893
- ? plugin.vRendererConfig.panelControlsCreator(context)
894
- : plugin.vRendererConfig.panelControls!,
895
- body: plugin.vRendererConfig.panelBodyCreator
896
- ? plugin.vRendererConfig.panelBodyCreator(context)
897
- : plugin.vRendererConfig.panelBody!
898
- })
899
- });
900
- }
901
-
902
- // 如果是个多重身份证
903
- if (context.info.plugin === this && context.info.multifactor) {
904
- const sameIdChild: EditorNodeType = context.node.sameIdChild;
905
-
906
- if (sameIdChild) {
907
- const subPanels = this.manager.collectPanels(sameIdChild, false, true);
908
- subPanels.forEach(panel => {
909
- if (panel.key === 'code') {
910
- const exists = panels.some(panel => panel.key === 'code');
911
- exists || panels.push(panel);
912
- } else if (panel.key === 'renderers') {
913
- const exists = panels.some(panel => panel.key === 'renderers');
914
- exists || panels.push(panel);
915
- } else if (
916
- panel.key === 'outline' ||
917
- panel.key === 'commonConfig' ||
918
- panel.key === 'name-list'
919
- ) {
920
- // do nothing
921
- } else {
922
- panels.push({
923
- ...panel,
924
- key: `sub-${panel.key}`,
925
- icon: sameIdChild.info?.plugin?.icon || panel.icon
926
- });
927
- }
928
- });
929
- }
930
- }
931
- }
932
-
933
- /**
934
- * 默认什么组件都加入的子组件里面,子类里面可以复写这个改变行为。
935
- * @param context
936
- * @param subRenderers
937
- */
938
- buildSubRenderers(
939
- context: RendererEventContext,
940
- subRenderers: Array<SubRendererInfo>,
941
- renderers: Array<RendererConfig>
942
- ): BasicSubRenderInfo | Array<BasicSubRenderInfo> | void {
943
- const plugin: PluginInterface = this;
944
-
945
- if (Array.isArray(plugin.scaffolds)) {
946
- return plugin.scaffolds.map(scaffold => ({
947
- name: (scaffold.name ?? plugin.name)!,
948
- icon: scaffold.icon ?? plugin.icon,
949
- description: scaffold.description ?? plugin.description,
950
- previewSchema: scaffold.previewSchema ?? plugin.previewSchema,
951
- tags: scaffold.tags ?? plugin.tags,
952
- docLink: scaffold.docLink ?? plugin.docLink,
953
- type: scaffold.type ?? plugin.type,
954
- scaffold: scaffold.scaffold ?? plugin.scaffold,
955
- scaffoldForm: plugin.scaffoldForm,
956
- disabledRendererPlugin: plugin.disabledRendererPlugin,
957
- isBaseComponent: plugin.isBaseComponent,
958
- rendererName: plugin.rendererName
959
- }));
960
- } else if (plugin.name && plugin.description) {
961
- return {
962
- name: plugin.name,
963
- icon: plugin.icon,
964
- description: plugin.description,
965
- previewSchema: plugin.previewSchema,
966
- tags: plugin.tags,
967
- docLink: plugin.docLink,
968
- type: plugin.type,
969
- scaffold: plugin.scaffold,
970
- scaffoldForm: plugin.scaffoldForm,
971
- disabledRendererPlugin: plugin.disabledRendererPlugin,
972
- isBaseComponent: plugin.isBaseComponent,
973
- rendererName: plugin.rendererName
974
- };
975
- }
976
- }
977
-
978
- /**
979
- * 构建当前选中组件的右键菜单
980
- * @param id
981
- * @param schema
982
- * @param region
983
- * @param info
984
- * @param menus
985
- */
986
- buildEditorContextMenu(
987
- {id, schema, region, info, selections}: ContextMenuEventContext,
988
- menus: Array<ContextMenuItem>
989
- ) {
990
- const plugin: PluginInterface = this;
991
- if (
992
- info.plugin === plugin &&
993
- !selections.length &&
994
- (plugin.scaffoldForm?.canRebuild || info.scaffoldForm?.canRebuild)
995
- ) {
996
- menus.push({
997
- label: `快速构建「${info.plugin.name}」`,
998
- disabled: schema.$$commonSchema,
999
- onSelect: () =>
1000
- this.manager.reScaffold(
1001
- id,
1002
- info.scaffoldForm || plugin.scaffoldForm!,
1003
- schema
1004
- )
1005
- });
1006
- }
1007
- }
1008
-
1009
- buildEditorToolbar(
1010
- {id, schema, info}: BaseEventContext,
1011
- toolbars: Array<BasicToolbarItem>
1012
- ) {
1013
- const plugin: PluginInterface = this;
1014
- if (
1015
- info.plugin === plugin &&
1016
- (plugin.scaffoldForm?.canRebuild || info.scaffoldForm?.canRebuild)
1017
- ) {
1018
- toolbars.push({
1019
- iconSvg: 'harmmer',
1020
- tooltip: `快速构建「${info.plugin.name}」`,
1021
- placement: 'bottom',
1022
- onClick: () =>
1023
- this.manager.reScaffold(
1024
- id,
1025
- info.scaffoldForm || plugin.scaffoldForm!,
1026
- schema
1027
- )
1028
- });
1029
- }
1030
- }
1031
-
1032
- renderPlaceholder(text: string, key?: any) {
1033
- return React.createElement('div', {
1034
- key,
1035
- className: 'wrapper-sm b-a b-light m-b-sm',
1036
- children: React.createElement('span', {
1037
- className: 'text-muted',
1038
- children: text
1039
- })
1040
- });
1041
- }
1042
-
1043
- getPlugin(rendererNameOrKlass: string | typeof BasePlugin) {
1044
- return find(this.manager.plugins, plugin =>
1045
- typeof rendererNameOrKlass === 'string'
1046
- ? plugin.rendererName === rendererNameOrKlass
1047
- : plugin instanceof rendererNameOrKlass
1048
- );
1049
- }
1050
- }