amis-editor 4.1.0-beta.28 → 5.2.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (553) 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 +1 -1
  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 +5 -3
  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 +7 -3
  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 +13 -3
  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 +13 -3
  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/lib/plugin/Form/Formula.d.ts +27 -0
  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 +6 -5
  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 +7 -4
  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 +7 -2
  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 +25 -36
  288. package/lib/renderer/OptionControl.js +672 -0
  289. package/{dist/component/Control → lib/renderer}/PopoverEdit.d.ts +4 -4
  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 -29
  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 -37
  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 -66
  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 -456
  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/Formula.d.ts +0 -51
  393. package/dist/plugin/Form/InputExcel.d.ts +0 -58
  394. package/dist/plugin/Form/InputRating.d.ts +0 -19
  395. package/dist/plugin/Form/InputText.d.ts +0 -20
  396. package/dist/plugin/Form/LocationPicker.d.ts +0 -48
  397. package/dist/plugin/Nav.d.ts +0 -163
  398. package/dist/plugin/Others/BasicToolbar.d.ts +0 -11
  399. package/dist/plugin/Others/DataDebug.d.ts +0 -19
  400. package/dist/plugin/Others/Unknown.d.ts +0 -5
  401. package/dist/plugin/Panel/AvailableRenderers.d.ts +0 -8
  402. package/dist/plugin/Panel/Code.d.ts +0 -9
  403. package/dist/plugin/Panel/Name.d.ts +0 -8
  404. package/dist/plugin/Panel/Outline.d.ts +0 -8
  405. package/dist/plugin.d.ts +0 -601
  406. package/dist/store/editor.d.ts +0 -1003
  407. package/dist/store/node.d.ts +0 -265
  408. package/dist/style.css +0 -1
  409. package/dist/util.d.ts +0 -72
  410. package/src/component/schemaTpl.tsx +0 -2157
  411. package/src/plugin/Alert.tsx +0 -87
  412. package/src/plugin/AnchorNav.tsx +0 -233
  413. package/src/plugin/Audio.tsx +0 -161
  414. package/src/plugin/Avatar.tsx +0 -77
  415. package/src/plugin/Breadcrumb.tsx +0 -107
  416. package/src/plugin/Button.tsx +0 -283
  417. package/src/plugin/ButtonGroup.tsx +0 -88
  418. package/src/plugin/ButtonToolbar.tsx +0 -89
  419. package/src/plugin/CRUD.tsx +0 -1835
  420. package/src/plugin/Card.tsx +0 -290
  421. package/src/plugin/Cards.tsx +0 -318
  422. package/src/plugin/Carousel.tsx +0 -386
  423. package/src/plugin/Chart.tsx +0 -218
  424. package/src/plugin/CodeView.tsx +0 -60
  425. package/src/plugin/Collapse.tsx +0 -143
  426. package/src/plugin/CollapseGroup.tsx +0 -167
  427. package/src/plugin/Container.tsx +0 -44
  428. package/src/plugin/Custom.tsx +0 -128
  429. package/src/plugin/CustomRegion.tsx +0 -156
  430. package/src/plugin/Date.tsx +0 -81
  431. package/src/plugin/Datetime.tsx +0 -75
  432. package/src/plugin/Dialog.tsx +0 -178
  433. package/src/plugin/Divider.tsx +0 -36
  434. package/src/plugin/Drawer.tsx +0 -217
  435. package/src/plugin/DropDownButton.tsx +0 -237
  436. package/src/plugin/Each.tsx +0 -155
  437. package/src/plugin/ErrorRenderer.tsx +0 -15
  438. package/src/plugin/Flex.tsx +0 -156
  439. package/src/plugin/Form/ButtonGroupSelect.tsx +0 -86
  440. package/src/plugin/Form/ButtonToolbar.tsx +0 -121
  441. package/src/plugin/Form/ChainedSelect.tsx +0 -70
  442. package/src/plugin/Form/Checkbox.tsx +0 -87
  443. package/src/plugin/Form/Checkboxes.tsx +0 -167
  444. package/src/plugin/Form/CodeEditor.tsx +0 -91
  445. package/src/plugin/Form/Combo.tsx +0 -582
  446. package/src/plugin/Form/ConditionBuilder.tsx +0 -324
  447. package/src/plugin/Form/Control.tsx +0 -139
  448. package/src/plugin/Form/DiffEditor.tsx +0 -117
  449. package/src/plugin/Form/FieldSet.tsx +0 -175
  450. package/src/plugin/Form/Form.tsx +0 -692
  451. package/src/plugin/Form/Formula.tsx +0 -91
  452. package/src/plugin/Form/Group.tsx +0 -300
  453. package/src/plugin/Form/Hidden.tsx +0 -56
  454. package/src/plugin/Form/InputArray.tsx +0 -228
  455. package/src/plugin/Form/InputCity.tsx +0 -93
  456. package/src/plugin/Form/InputColor.tsx +0 -123
  457. package/src/plugin/Form/InputDate.tsx +0 -175
  458. package/src/plugin/Form/InputDateRange.tsx +0 -225
  459. package/src/plugin/Form/InputDateTime.tsx +0 -183
  460. package/src/plugin/Form/InputDateTimeRange.tsx +0 -221
  461. package/src/plugin/Form/InputEmail.tsx +0 -33
  462. package/src/plugin/Form/InputExcel.tsx +0 -85
  463. package/src/plugin/Form/InputFile.tsx +0 -228
  464. package/src/plugin/Form/InputGroup.tsx +0 -105
  465. package/src/plugin/Form/InputImage.tsx +0 -277
  466. package/src/plugin/Form/InputKV.tsx +0 -72
  467. package/src/plugin/Form/InputMonth.tsx +0 -35
  468. package/src/plugin/Form/InputMonthRange.tsx +0 -195
  469. package/src/plugin/Form/InputNumber.tsx +0 -97
  470. package/src/plugin/Form/InputPassword.tsx +0 -33
  471. package/src/plugin/Form/InputQuarter.tsx +0 -35
  472. package/src/plugin/Form/InputQuarterRange.tsx +0 -195
  473. package/src/plugin/Form/InputRange.tsx +0 -121
  474. package/src/plugin/Form/InputRating.tsx +0 -78
  475. package/src/plugin/Form/InputRepeat.tsx +0 -69
  476. package/src/plugin/Form/InputRichText.tsx +0 -197
  477. package/src/plugin/Form/InputSubForm.tsx +0 -198
  478. package/src/plugin/Form/InputTable.tsx +0 -434
  479. package/src/plugin/Form/InputTag.tsx +0 -81
  480. package/src/plugin/Form/InputText.tsx +0 -186
  481. package/src/plugin/Form/InputTime.tsx +0 -95
  482. package/src/plugin/Form/InputTree.tsx +0 -240
  483. package/src/plugin/Form/InputURL.tsx +0 -34
  484. package/src/plugin/Form/InputYear.tsx +0 -35
  485. package/src/plugin/Form/Item.tsx +0 -327
  486. package/src/plugin/Form/ListSelect.tsx +0 -84
  487. package/src/plugin/Form/LocationPicker.tsx +0 -75
  488. package/src/plugin/Form/MatrixCheckboxes.tsx +0 -147
  489. package/src/plugin/Form/NestedSelect.tsx +0 -222
  490. package/src/plugin/Form/Picker.tsx +0 -217
  491. package/src/plugin/Form/Radios.tsx +0 -130
  492. package/src/plugin/Form/Select.tsx +0 -233
  493. package/src/plugin/Form/Static.tsx +0 -335
  494. package/src/plugin/Form/Switch.tsx +0 -118
  495. package/src/plugin/Form/TabsTransfer.tsx +0 -270
  496. package/src/plugin/Form/Textarea.tsx +0 -94
  497. package/src/plugin/Form/Transfer.tsx +0 -379
  498. package/src/plugin/Form/TreeSelect.tsx +0 -263
  499. package/src/plugin/Form/UUID.tsx +0 -48
  500. package/src/plugin/Grid.tsx +0 -799
  501. package/src/plugin/HBox.tsx +0 -727
  502. package/src/plugin/IFrame.tsx +0 -72
  503. package/src/plugin/Image.tsx +0 -318
  504. package/src/plugin/Images.tsx +0 -238
  505. package/src/plugin/Json.tsx +0 -76
  506. package/src/plugin/Link.tsx +0 -95
  507. package/src/plugin/List.tsx +0 -281
  508. package/src/plugin/ListItem.tsx +0 -233
  509. package/src/plugin/Log.tsx +0 -52
  510. package/src/plugin/Mapping.tsx +0 -156
  511. package/src/plugin/Markdown.tsx +0 -47
  512. package/src/plugin/Nav.tsx +0 -186
  513. package/src/plugin/Operation.tsx +0 -97
  514. package/src/plugin/Others/Action.tsx +0 -428
  515. package/src/plugin/Others/BasicToolbar.tsx +0 -591
  516. package/src/plugin/Others/DataDebug.tsx +0 -134
  517. package/src/plugin/Others/TableCell.tsx +0 -480
  518. package/src/plugin/Others/Unknown.tsx +0 -37
  519. package/src/plugin/Page.tsx +0 -308
  520. package/src/plugin/Panel/AvailableRenderers.tsx +0 -41
  521. package/src/plugin/Panel/Code.tsx +0 -44
  522. package/src/plugin/Panel/Name.tsx +0 -26
  523. package/src/plugin/Panel/Outline.tsx +0 -40
  524. package/src/plugin/Panel.tsx +0 -243
  525. package/src/plugin/Plain.tsx +0 -91
  526. package/src/plugin/Progress.tsx +0 -132
  527. package/src/plugin/Property.tsx +0 -139
  528. package/src/plugin/QRCode.tsx +0 -98
  529. package/src/plugin/Reset.tsx +0 -23
  530. package/src/plugin/Service.tsx +0 -167
  531. package/src/plugin/Sparkline.tsx +0 -40
  532. package/src/plugin/Status.tsx +0 -78
  533. package/src/plugin/Steps.tsx +0 -140
  534. package/src/plugin/Submit.tsx +0 -23
  535. package/src/plugin/Table.tsx +0 -440
  536. package/src/plugin/TableView.tsx +0 -711
  537. package/src/plugin/Tabs.tsx +0 -364
  538. package/src/plugin/Tasks.tsx +0 -276
  539. package/src/plugin/Time.tsx +0 -75
  540. package/src/plugin/TooltipWrapper.tsx +0 -193
  541. package/src/plugin/Tpl.tsx +0 -162
  542. package/src/plugin/Video.tsx +0 -160
  543. package/src/plugin/WebComponent.tsx +0 -56
  544. package/src/plugin/Wizard.tsx +0 -743
  545. package/src/plugin/Wrapper.tsx +0 -107
  546. package/src/plugin.ts +0 -1049
  547. package/static/Code-hover.png +0 -0
  548. package/static/Code.png +0 -0
  549. package/static/Outline-hover.png +0 -0
  550. package/static/Outline.png +0 -0
  551. package/static/Renderers-hover.png +0 -0
  552. package/static/Renderers.png +0 -0
  553. package/static/side_hide_left.svg +0 -10
@@ -1,2157 +0,0 @@
1
- /**
2
- * @file amis schema 配置模板,主要很多地方都要全部配置的化,
3
- * 会有很多份,而且改起来很麻烦,复用率高的放在这管理。
4
- */
5
- import {isObject} from '../util';
6
- import find = require('lodash/find');
7
- import {normalizeOptions, str2rules, buildApi, Select, Html} from 'amis';
8
- import flatten from 'lodash/flatten';
9
- import React = require('react');
10
- import {InputComponentName} from './base/InputComponentName';
11
- import remarkTpl from './remarkTpl';
12
-
13
- const tpls: {
14
- [propName: string]: any;
15
- } = {
16
- formItemName: {
17
- label: '字段名',
18
- name: 'name',
19
- type: 'input-text'
20
- // validations: {
21
- // matchRegexp: /^[a-z\$][a-z0-0\-_]*$/i
22
- // },
23
- // validationErrors: {
24
- // "matchRegexp": "请输入合法的变量名"
25
- // },
26
- // validateOnChange: false
27
- },
28
-
29
- formItemMode: {
30
- label: '表单项展示模式',
31
- name: 'mode',
32
- type: 'button-group-select',
33
- size: 'sm',
34
- option: '继承',
35
- // mode: 'inline',
36
- // className: 'w-full',
37
- pipeIn: defaultValue(''),
38
- options: [
39
- {
40
- label: '继承',
41
- value: ''
42
- },
43
-
44
- {
45
- label: '正常',
46
- value: 'normal'
47
- },
48
-
49
- {
50
- label: '内联',
51
- value: 'inline'
52
- },
53
-
54
- {
55
- label: '水平',
56
- value: 'horizontal'
57
- }
58
- ]
59
- },
60
-
61
- formItemInline: {
62
- label: '表单项内联',
63
- name: 'inline',
64
- type: 'switch',
65
- visibleOn: 'data.mode != "inline"',
66
- mode: 'inline',
67
- className: 'w-full',
68
- pipeIn: defaultValue(false)
69
- // onChange: (value:any, origin:any, item:any, form:any) => form.getValueByName('size') === "full" && form.setValueByName('')
70
- },
71
-
72
- formItemSize: {
73
- name: 'size',
74
- label: '控件尺寸',
75
- type: 'button-group-select',
76
- size: 'sm',
77
- pipeIn: defaultValue('full'),
78
- // mode: 'inline',
79
- // className: 'w-full',
80
- options: [
81
- {
82
- label: '极小',
83
- value: 'xs'
84
- },
85
-
86
- {
87
- label: '小',
88
- value: 'sm'
89
- },
90
-
91
- {
92
- label: '中',
93
- value: 'md'
94
- },
95
-
96
- {
97
- label: '大',
98
- value: 'lg'
99
- },
100
-
101
- {
102
- label: '默认',
103
- value: ''
104
- }
105
- ]
106
- },
107
-
108
- minLength: {
109
- name: 'minLength',
110
- type: 'input-number',
111
- label: '限制最小数量'
112
- },
113
-
114
- maxLength: {
115
- name: 'maxLength',
116
- type: 'input-number',
117
- label: '限制最大数量'
118
- },
119
-
120
- label: [
121
- {
122
- label: 'Label',
123
- name: 'label',
124
- type: 'input-text',
125
- hiddenOn: 'data.label === false'
126
- },
127
- {
128
- name: 'label',
129
- label: '隐藏 Label',
130
- type: 'switch',
131
- mode: 'inline',
132
- className: 'w-full',
133
- pipeIn: (value: any) => value === false,
134
- pipeOut: (value: any) => (value === true ? false : ''),
135
- visibleOn:
136
- '__props__.formMode === "horizontal" || data.mode === "horizontal" || data.label ===false',
137
- description: '当 form 为水平布局时有用,可以用来去掉间隔。'
138
- }
139
- ],
140
-
141
- placeholder: {
142
- label: '占位符',
143
- name: 'placeholder',
144
- type: 'input-text',
145
- placeholder: '占位符'
146
- },
147
-
148
- tabs: (
149
- config: Array<{
150
- title: string;
151
- body: Array<any>;
152
- }>
153
- ) => {
154
- return {
155
- type: 'tabs',
156
- tabsMode: 'line', // tiled
157
- className: 'editor-prop-config-tabs',
158
- contentClassName:
159
- 'no-border editor-prop-config-tabs-cont hoverShowScrollBar',
160
- tabs: config
161
- .filter(item => item)
162
- .map(item => ({
163
- ...item,
164
- body: flatten(item.body)
165
- }))
166
- };
167
- },
168
-
169
- collapse: (
170
- config: Array<{
171
- title: string;
172
- body: Array<any>;
173
- }>
174
- ) => {
175
- return {
176
- type: 'wrapper',
177
- className: 'editor-prop-config-collapse',
178
- body: config
179
- .filter(item => item)
180
- .map(item => ({
181
- type: 'collapse',
182
- headingClassName: 'editor-prop-config-head',
183
- bodyClassName: 'editor-prop-config-body',
184
- ...item,
185
- body: flatten(item.body)
186
- }))
187
- };
188
- },
189
-
190
- fieldSet: (config: {
191
- title: string;
192
- body: Array<any>;
193
- collapsed?: boolean;
194
- collapsable?: boolean;
195
- }) => {
196
- return {
197
- collapsable: true,
198
- collapsed: false,
199
- ...config,
200
- type: 'fieldset',
201
- title: config.title,
202
- body: flatten(config.body.filter((item: any) => item))
203
- };
204
- },
205
-
206
- clearable: {
207
- type: 'switch',
208
- name: 'clearable',
209
- mode: 'inline',
210
- className: 'w-full',
211
- label: '启用清除按钮'
212
- },
213
-
214
- hint: {
215
- label: '输入提示',
216
- type: 'input-text',
217
- name: 'hint',
218
- description: '当输入框获得焦点的时候显示,用来提示用户输入内容。'
219
- },
220
-
221
- remark: remarkTpl({name: 'remark', label: '控件提示'}),
222
-
223
- labelRemark: remarkTpl({name: 'labelRemark', label: '标题提示'}),
224
-
225
- expression: {
226
- type: 'input-text',
227
- description: '支持 JS 表达式,如:`this.xxx == 1`'
228
- },
229
-
230
- icon: {
231
- label: '图标',
232
- type: 'icon-picker',
233
- name: 'icon',
234
- placeholder: '点击选择图标',
235
- clearable: true,
236
- description: ''
237
- },
238
-
239
- size: {
240
- label: '控件尺寸',
241
- type: 'button-group-select',
242
- name: 'size',
243
- size: 'sm',
244
- clearable: true,
245
- options: [
246
- {
247
- label: '极小',
248
- value: 'xs'
249
- },
250
- {
251
- label: '小',
252
- value: 'sm'
253
- },
254
- {
255
- label: '中',
256
- value: 'md'
257
- },
258
- {
259
- label: '大',
260
- value: 'lg'
261
- }
262
- ]
263
- },
264
-
265
- name: {
266
- label: '名字',
267
- name: 'name',
268
- type: 'input-text',
269
- description: '需要联动时才需要,其他组件可以通过这个名字跟当前组件联动',
270
- placeholder: '请输入字母或者数字'
271
- },
272
-
273
- reload: {
274
- label: '刷新目标组件',
275
- name: 'reload',
276
- asFormItem: true,
277
- // type: 'input-text',
278
- component: InputComponentName,
279
- description:
280
- '可以指定操作完成后刷新目标组件,请填写目标组件的 <code>name</code> 属性,多个组件请用<code>,</code>隔开,如果目标组件为表单项,请先填写表单的名字,再用<code>.</code>连接表单项的名字如:<code>xxForm.xxControl</code>。另外如果刷新目标对象设置为 <code>window</code>,则会刷新整个页面。',
281
- labelRemark: {
282
- trigger: 'click',
283
- className: 'm-l-xs',
284
- rootClose: true,
285
- content:
286
- '设置名字后,当前组件操作完成会触发目标组件(根据设置的名字)的刷新。',
287
- placement: 'left'
288
- }
289
- },
290
-
291
- className: {
292
- label: 'CSS 类名',
293
- type: 'ae-classname',
294
- name: 'className',
295
- labelRemark: {
296
- trigger: 'click',
297
- className: 'm-l-xs',
298
- rootClose: true,
299
- content:
300
- '有哪些辅助类 CSS 类名?请前往 <a href="https://baidu.github.io/amis/docs/concepts/style" target="_blank">样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。',
301
- placement: 'left'
302
- }
303
- },
304
-
305
- apiControl: (patch: any = {}) => {
306
- const {name, label, value, description, sampleBuilder, ...rest} = patch;
307
-
308
- return {
309
- type: 'ae-apiControl',
310
- label,
311
- name,
312
- description,
313
- labelRemark: sampleBuilder
314
- ? {
315
- icon: '',
316
- label: '示例',
317
- title: '接口返回示例',
318
- tooltipClassName: 'ae-ApiSample-tooltip',
319
- render: (data: any) => (
320
- <Html
321
- className="ae-ApiSample"
322
- inline={false}
323
- html={`
324
- <pre><code>${sampleBuilder(data)}</code></pre>
325
- `}
326
- />
327
- ),
328
- trigger: 'click',
329
- className: 'm-l-xs',
330
- rootClose: true,
331
- placement: 'left'
332
- }
333
- : undefined,
334
- ...rest
335
- };
336
- },
337
-
338
- api: (patch: any = {}) => {
339
- const {name, label, value, description, sampleBuilder, ...rest} = patch;
340
-
341
- return {
342
- type: 'container',
343
- body: [
344
- {
345
- type: 'checkbox',
346
- label: label || 'API',
347
- labelRemark: sampleBuilder
348
- ? {
349
- icon: '',
350
- label: '示例',
351
- title: '接口返回示例',
352
- tooltipClassName: 'ae-ApiSample-tooltip',
353
- render: (data: any) => (
354
- <Html
355
- className="ae-ApiSample"
356
- inline={false}
357
- html={`
358
- <pre><code>${sampleBuilder(data)}</code></pre>
359
- `}
360
- />
361
- ),
362
- trigger: 'click',
363
- className: 'm-l-xs',
364
- rootClose: true,
365
- placement: 'left'
366
- }
367
- : undefined,
368
- option: `高级配置`,
369
- name: name || 'api',
370
- mode: 'inline',
371
- className: 'w-full m-b-sm',
372
- inputClassName: 'pull-right text-sm m-t-sm p-t-none',
373
- onChange: () => {},
374
- pipeIn: (value: any) => value && typeof value !== 'string',
375
- pipeOut: (value: any, originValue: any) => {
376
- const api = buildApi(originValue);
377
-
378
- return value
379
- ? {
380
- method: api.method,
381
- url: api.url
382
- }
383
- : api.url
384
- ? `${api.method ? `${api.method}:` : ''}${api.url}`
385
- : '';
386
- }
387
- },
388
-
389
- {
390
- name: name || 'api',
391
- type: 'input-text',
392
- value,
393
- placeholder: 'http://',
394
- description: description,
395
- visibleOn: `!this.${name || 'api'} || typeof this.${
396
- name || 'api'
397
- } === 'string'`,
398
- className: 'm-b-none',
399
- labelRemark: {}
400
- // disabledOn: `data.${name || 'api'} && data.${name || 'api'}.data && Object.keys(data.${name || 'api'}.data).length || data.${name || 'api'} && data.${name || 'api'}.sendOn`,
401
- },
402
-
403
- {
404
- type: 'combo',
405
- name: name || 'api',
406
- description: description,
407
- syncDefaultValue: false,
408
- multiLine: true,
409
- visibleOn: `this.${name || 'api'} && typeof this.${
410
- name || 'api'
411
- } !== 'string'`,
412
- className: 'm-b-none',
413
- messages: {
414
- validateFailed: '接口配置中存在错误,请仔细检查'
415
- },
416
- pipeIn: (value: any) => {
417
- if (typeof value === 'string') {
418
- let url = value;
419
- let method = 'get';
420
-
421
- const m =
422
- /^(raw:|external:)?(get|post|put|patch|delete):(.*)$/.exec(url);
423
- if (m) {
424
- url = m[1] + m[3];
425
- method = m[2];
426
- }
427
-
428
- return {
429
- method,
430
- url
431
- };
432
- }
433
-
434
- return value;
435
- },
436
- items: [
437
- {
438
- label: '发送方式',
439
- name: 'method',
440
- value: 'get',
441
- type: 'select',
442
- mode: 'horizontal',
443
- horizontal: {
444
- leftFixed: 'sm'
445
- },
446
- options: [
447
- {
448
- value: 'get',
449
- label: 'GET'
450
- },
451
- {
452
- value: 'post',
453
- label: 'POST'
454
- },
455
- {
456
- value: 'put',
457
- label: 'PUT'
458
- },
459
- {
460
- value: 'patch',
461
- label: 'PATCH'
462
- },
463
- {
464
- value: 'delete',
465
- label: 'DELETE'
466
- }
467
- ]
468
- },
469
-
470
- {
471
- label: '接口地址',
472
- type: 'input-text',
473
- name: 'url',
474
- placeholder: 'http://',
475
- required: true
476
- },
477
-
478
- {
479
- type: 'switch',
480
- label: '数据映射',
481
- name: 'data',
482
- mode: 'inline',
483
- className: 'w-full m-b-xs',
484
- pipeIn: (value: any) => !!value,
485
- pipeOut: (value: any) => (value ? {'&': '$$'} : null)
486
- },
487
-
488
- {
489
- type: 'tpl',
490
- visibleOn: '!this.data',
491
- inline: false,
492
- className: 'text-sm text-muted m-b',
493
- tpl: '当没开启数据映射时,发送 API 的时候会发送尽可能多的数据,如果你想自己控制发送的数据,或者需要额外的数据处理,请开启此选项'
494
- },
495
-
496
- {
497
- type: 'input-kv',
498
- syncDefaultValue: false,
499
- name: 'data',
500
- visibleOn: 'this.data',
501
- descriptionClassName: 'help-block text-xs m-b-none',
502
- description:
503
- '<p>当没开启数据映射时,发送数据自动切成白名单模式,配置啥发送啥,请绑定数据。如:<code>{"a": "\\${a}", "b": 2}</code></p><p>如果希望在默认的基础上定制,请先添加一个 Key 为 `&` Value 为 `\\$$` 作为第一行。</p><div>当值为 <code>__undefined</code>时,表示删除对应的字段,可以结合<code>{"&": "\\$$"}</code>来达到黑名单效果。</div>'
504
- },
505
-
506
- {
507
- label: '发送条件',
508
- type: 'input-text',
509
- name: 'sendOn',
510
- placeholder: '如:this.type == "123"',
511
- description: '用表达式来设置该请求的发送条件'
512
- },
513
-
514
- {
515
- type: 'switch',
516
- label: '是否设置缓存',
517
- name: 'cache',
518
- mode: 'inline',
519
- className: 'w-full m-b-xs',
520
- description: '设置该请求缓存的有效时间',
521
- pipeIn: (value: any) => !!value,
522
- pipeOut: (value: any) => (value ? 3000 : undefined)
523
- },
524
-
525
- {
526
- type: 'input-number',
527
- name: 'cache',
528
- mode: 'inline',
529
- min: 0,
530
- step: 500,
531
- visibleOn: 'this.cache',
532
- pipeIn: (value: any) => (typeof value === 'number' ? value : 0)
533
- },
534
-
535
- {
536
- label: '文件下载',
537
- type: 'switch',
538
- name: 'responseType',
539
- mode: 'inline',
540
- className: 'block',
541
- pipeIn: (value: any) => value === 'blob',
542
- pipeOut: (value: any) => (value ? 'blob' : undefined),
543
- description:
544
- '当接口为二进制文件下载时请勾选,并设置 Content-Disposition'
545
- },
546
-
547
- {
548
- label: '数据格式',
549
- type: 'button-group-select',
550
- name: 'dataType',
551
- description:
552
- '发送体格式为:<%= data.dataType === "json" ? "application/json" : data.dataType === "form-data" ? "multipart/form-data" : data.dataType === "form" ? "application/x-www-form-urlencoded" : "" %>,当发送内容中存在文件时会自动使用 form-data 格式。',
553
- size: 'sm',
554
- className: 'block',
555
- mode: 'inline',
556
- options: [
557
- {
558
- label: 'JSON',
559
- value: 'json'
560
- },
561
- {
562
- label: 'FormData',
563
- value: 'form-data'
564
- },
565
- {
566
- label: 'Form',
567
- value: 'form'
568
- }
569
- ]
570
- },
571
-
572
- {
573
- type: 'switch',
574
- label: '数据替换',
575
- name: 'replaceData',
576
- mode: 'inline',
577
- className: 'w-full',
578
- description: '默认数据都是追加方式,开启这个后是完全替换'
579
- },
580
-
581
- {
582
- type: 'switch',
583
- label: '返回结果映射',
584
- name: 'responseData',
585
- mode: 'inline',
586
- className: 'w-full m-b-xs',
587
- pipeIn: (value: any) => !!value,
588
- pipeOut: (value: any) => (value ? {'&': '$$'} : null)
589
- },
590
-
591
- {
592
- type: 'tpl',
593
- visibleOn: '!this.responseData',
594
- inline: false,
595
- className: 'text-sm text-muted m-b',
596
- tpl: '如果需要对返回结果做额外的数据处理,请开启此选项'
597
- },
598
-
599
- {
600
- type: 'input-kv',
601
- syncDefaultValue: false,
602
- name: 'responseData',
603
- visibleOn: 'this.responseData',
604
- descriptionClassName: 'help-block text-xs m-b-none'
605
- },
606
-
607
- {
608
- title: '自定义适配器',
609
- type: 'fieldSet',
610
- className: 'm-b-none',
611
- size: 'sm',
612
- collapsable: false, // 避免和最外层的属性配置面板的tabs样式重叠
613
- collapsedOn: '!this.requestAdaptor && !this.adaptor',
614
- body: [
615
- {
616
- name: 'requestAdaptor',
617
- type: 'js-editor',
618
- allowFullscreen: true,
619
- label: '发送适配器',
620
- description:
621
- '函数签名:(api) => api, 数据在 api.data 中,修改后返回 api 对象。'
622
- },
623
-
624
- {
625
- name: 'adaptor',
626
- type: 'js-editor',
627
- allowFullscreen: true,
628
- label: '接收适配器',
629
- description: '函数签名: (payload, response, api) => payload'
630
- }
631
- ]
632
- }
633
- ]
634
- }
635
- ],
636
- ...rest
637
- };
638
- },
639
-
640
- source: (patch: any = {}) => {
641
- return getSchemaTpl('api', {
642
- name: 'source',
643
- label: '获取选项接口',
644
- description: '可以通过接口获取动态选项,一次拉取全部。',
645
- sampleBuilder: (schema: any) =>
646
- JSON.stringify(
647
- {
648
- status: 0,
649
- msg: '',
650
- data: {
651
- options: [
652
- {
653
- label: '选项A',
654
- value: 'a'
655
- },
656
-
657
- {
658
- label: '选项B',
659
- value: 'b'
660
- }
661
- ]
662
- }
663
- },
664
- null,
665
- 2
666
- ),
667
- ...patch
668
- });
669
- },
670
-
671
- autoFill: {
672
- type: 'input-kv',
673
- name: 'autoFill',
674
- label: '自动填充',
675
- descriptionClassName: 'help-block text-xs m-b-none',
676
- description:
677
- '将当前已选中的选项的某个字段的值,自动填充到表单中某个表单项中,支持数据映射'
678
- },
679
-
680
- autoFillApi: {},
681
-
682
- apiString: {
683
- name: 'api',
684
- type: 'input-text',
685
- placeholder: 'http://'
686
- },
687
-
688
- required: {
689
- name: 'required',
690
- type: 'switch',
691
- mode: 'inline',
692
- className: 'w-full',
693
- label: '是否必填'
694
- },
695
-
696
- description: {
697
- name: 'description',
698
- type: 'textarea',
699
- label: '描述',
700
- pipeIn: (value: any, data: any) => value || data.desc || ''
701
- },
702
-
703
- options: {
704
- label: '选项 Options',
705
- name: 'options',
706
- type: 'combo',
707
- multiple: true,
708
- draggable: true,
709
- addButtonText: '新增选项',
710
- scaffold: {
711
- label: '',
712
- value: ''
713
- },
714
- items: [
715
- {
716
- type: 'input-text',
717
- name: 'label',
718
- placeholder: '名称',
719
- required: true
720
- },
721
- {
722
- type: 'select',
723
- name: 'value',
724
- pipeIn: (value: any) => {
725
- if (typeof value === 'string') {
726
- return 'text';
727
- }
728
- if (typeof value === 'boolean') {
729
- return 'boolean';
730
- }
731
- if (typeof value === 'number') {
732
- return 'number';
733
- }
734
- return 'text';
735
- },
736
- pipeOut: (value: any, oldValue: any) => {
737
- if (value === 'text') {
738
- return String(oldValue);
739
- }
740
- if (value === 'number') {
741
- const convertTo = Number(oldValue);
742
- if (isNaN(convertTo)) {
743
- return 0;
744
- }
745
- return convertTo;
746
- }
747
- if (value === 'boolean') {
748
- return Boolean(oldValue);
749
- }
750
- return '';
751
- },
752
- options: [
753
- {label: '文本', value: 'text'},
754
- {label: '数字', value: 'number'},
755
- {label: '布尔', value: 'boolean'}
756
- ]
757
- },
758
- {
759
- type: 'input-number',
760
- name: 'value',
761
- placeholder: '值',
762
- visibleOn: 'typeof data.value === "number"',
763
- unique: true
764
- },
765
- {
766
- type: 'switch',
767
- name: 'value',
768
- placeholder: '值',
769
- visibleOn: 'typeof data.value === "boolean"',
770
- unique: true
771
- },
772
- {
773
- type: 'input-text',
774
- name: 'value',
775
- placeholder: '值',
776
- visibleOn:
777
- 'typeof data.value === "undefined" || typeof data.value === "string"',
778
- unique: true
779
- }
780
- ]
781
- },
782
-
783
- tree: {
784
- label: '选项 Options',
785
- name: 'options',
786
- type: 'combo',
787
- multiple: true,
788
- draggable: true,
789
- addButtonText: '新增选项',
790
- description:
791
- '静态数据暂不支持多级,请切换到代码模式,或者采用 source 接口获取。',
792
- scaffold: {
793
- label: '',
794
- value: ''
795
- },
796
- items: [
797
- {
798
- type: 'input-text',
799
- name: 'label',
800
- placeholder: '名称',
801
- required: true
802
- },
803
-
804
- {
805
- type: 'input-text',
806
- name: 'value',
807
- placeholder: '值',
808
- unique: true
809
- }
810
- ]
811
- },
812
-
813
- horizontalMode: {
814
- label: '表单项左右占比设置',
815
- name: 'horizontal',
816
- type: 'switch',
817
- onText: '继承',
818
- offText: '自定义',
819
- mode: 'inline',
820
- className: 'w-full',
821
- inputClassName: 'text-sm',
822
- visibleOn: 'this.mode == "horizontal" && this.label !== false',
823
- pipeIn: (value: any) => !value,
824
- pipeOut: (value: any, originValue: any, data: any) =>
825
- value
826
- ? null
827
- : data.formHorizontal || {
828
- leftFixed: 'normal'
829
- }
830
- },
831
-
832
- horizontal: {
833
- type: 'combo',
834
- syncDefaultValue: false,
835
- name: 'horizontal',
836
- multiLine: true,
837
- visibleOn:
838
- 'data.mode == "horizontal" && data.label !== false && data.horizontal',
839
- pipeIn: (value: any) => {
840
- return {
841
- leftRate:
842
- value && typeof value.left === 'number'
843
- ? value.left
844
- : value && /\bcol\-(?:xs|sm|md|lg)\-(\d+)\b/.test(value.left)
845
- ? parseInt(RegExp.$1, 10)
846
- : 2,
847
- leftFixed: (value && value.leftFixed) || ''
848
- };
849
- },
850
- pipeOut: (value: any) => {
851
- let left = Math.min(11, Math.max(1, value.leftRate || 2));
852
-
853
- return {
854
- leftFixed: value.leftFixed || '',
855
- left: left,
856
- right: 12 - left
857
- };
858
- },
859
- inputClassName: 'no-padder',
860
- items: [
861
- {
862
- name: 'leftFixed',
863
- type: 'button-group-select',
864
- label: '左侧宽度',
865
- size: 'xs',
866
- options: [
867
- {
868
- label: '比率',
869
- value: ''
870
- },
871
-
872
- {
873
- label: '小宽度',
874
- value: 'sm',
875
- visibleOn: 'this.leftFixed'
876
- },
877
-
878
- {
879
- label: '固定宽度',
880
- value: 'normal'
881
- },
882
-
883
- {
884
- label: '大宽度',
885
- value: 'lg',
886
- visibleOn: 'this.leftFixed'
887
- }
888
- ]
889
- },
890
- {
891
- name: 'leftRate',
892
- type: 'input-range',
893
- visibleOn: '!this.leftFixed',
894
- min: 1,
895
- max: 11,
896
- step: 1,
897
- label: '左右分布调整(n/12)',
898
- labelRemark: {
899
- trigger: 'click',
900
- className: 'm-l-xs',
901
- rootClose: true,
902
- content: '一共 12 等份,这里可以设置左侧宽度占比 n/12。',
903
- placement: 'left'
904
- }
905
- }
906
- ]
907
- },
908
-
909
- subFormItemMode: {
910
- label: '子表单展示模式',
911
- name: 'subFormMode',
912
- type: 'button-group-select',
913
- size: 'sm',
914
- option: '继承',
915
- // mode: 'inline',
916
- // className: 'w-full',
917
- pipeIn: defaultValue(''),
918
- options: [
919
- {
920
- label: '继承',
921
- value: ''
922
- },
923
-
924
- {
925
- label: '正常',
926
- value: 'normal'
927
- },
928
-
929
- {
930
- label: '内联',
931
- value: 'inline'
932
- },
933
-
934
- {
935
- label: '水平',
936
- value: 'horizontal'
937
- }
938
- ]
939
- },
940
-
941
- subFormHorizontalMode: {
942
- label: '子表单水平占比设置',
943
- name: 'subFormHorizontal',
944
- type: 'switch',
945
- onText: '继承',
946
- offText: '自定义',
947
- mode: 'inline',
948
- className: 'w-full',
949
- inputClassName: 'text-sm',
950
- visibleOn: 'this.subFormMode == "horizontal"',
951
- pipeIn: (value: any) => !value,
952
- pipeOut: (value: any, originValue: any, data: any) =>
953
- value
954
- ? null
955
- : data.formHorizontal || {
956
- leftFixed: 'normal'
957
- }
958
- },
959
-
960
- subFormHorizontal: {
961
- type: 'combo',
962
- syncDefaultValue: false,
963
- visibleOn: 'data.subFormMode == "horizontal" && data.subFormHorizontal',
964
- name: 'subFormHorizontal',
965
- multiLine: true,
966
- pipeIn: (value: any) => {
967
- return {
968
- leftRate:
969
- value && typeof value.left === 'number'
970
- ? value.left
971
- : value && /\bcol\-(?:xs|sm|md|lg)\-(\d+)\b/.test(value.left)
972
- ? parseInt(RegExp.$1, 10)
973
- : 2,
974
- leftFixed: (value && value.leftFixed) || ''
975
- };
976
- },
977
- pipeOut: (value: any) => {
978
- let left = Math.min(11, Math.max(1, value.leftRate || 2));
979
-
980
- return {
981
- leftFixed: value.leftFixed || '',
982
- left: left,
983
- right: 12 - left
984
- };
985
- },
986
- inputClassName: 'no-padder',
987
- items: [
988
- {
989
- name: 'leftFixed',
990
- type: 'button-group-select',
991
- label: '左侧宽度',
992
- size: 'xs',
993
- options: [
994
- {
995
- label: '比率',
996
- value: ''
997
- },
998
-
999
- {
1000
- label: '小宽度',
1001
- value: 'sm',
1002
- visibleOn: 'this.leftFixed'
1003
- },
1004
-
1005
- {
1006
- label: '固定宽度',
1007
- value: 'normal'
1008
- },
1009
-
1010
- {
1011
- label: '大宽度',
1012
- value: 'lg',
1013
- visibleOn: 'this.leftFixed'
1014
- }
1015
- ]
1016
- },
1017
- {
1018
- name: 'leftRate',
1019
- type: 'input-range',
1020
- visibleOn: '!this.leftFixed',
1021
- min: 1,
1022
- max: 11,
1023
- step: 1,
1024
- label: '左右分布调整(n/12)',
1025
- labelRemark: {
1026
- trigger: 'click',
1027
- className: 'm-l-xs',
1028
- rootClose: true,
1029
- content: '一共 12 等份,这里可以设置左侧宽度占比 n/12。',
1030
- placement: 'left'
1031
- }
1032
- }
1033
- ]
1034
- },
1035
-
1036
- validations: (function () {
1037
- const options = [
1038
- // {
1039
- // label: '必填',
1040
- // value: 'isRequired'
1041
- // },
1042
- {
1043
- label: '邮箱格式',
1044
- value: 'isEmail'
1045
- },
1046
- {
1047
- label: 'Url格式',
1048
- value: 'isUrl'
1049
- },
1050
- {
1051
- label: '数字',
1052
- value: 'isNumeric'
1053
- },
1054
- {
1055
- label: '字母',
1056
- value: 'isAlpha'
1057
- },
1058
- {
1059
- label: '字母和数字',
1060
- value: 'isAlphanumeric'
1061
- },
1062
- {
1063
- label: '整型数字',
1064
- value: 'isInt'
1065
- },
1066
- {
1067
- label: '浮点型数字',
1068
- value: 'isFloat'
1069
- },
1070
- {
1071
- label: '固定长度',
1072
- value: 'isLength'
1073
- },
1074
- {
1075
- label: '最大长度',
1076
- value: 'maxLength'
1077
- },
1078
- {
1079
- label: '最小长度',
1080
- value: 'minLength'
1081
- },
1082
- {
1083
- label: '最大值',
1084
- value: 'maximum'
1085
- },
1086
- {
1087
- label: '最小值',
1088
- value: 'minimum'
1089
- },
1090
- {
1091
- label: '手机号码',
1092
- value: 'isPhoneNumber'
1093
- },
1094
- {
1095
- label: '电话号码',
1096
- value: 'isTelNumber'
1097
- },
1098
- {
1099
- label: '邮编号码',
1100
- value: 'isZipcode'
1101
- },
1102
- {
1103
- label: '身份证号码',
1104
- value: 'isId'
1105
- },
1106
- {
1107
- label: 'JSON格式',
1108
- value: 'isJson'
1109
- },
1110
- {
1111
- label: '与指定值相同',
1112
- value: 'equals'
1113
- },
1114
- {
1115
- label: '与指定字段值相同',
1116
- value: 'equalsField'
1117
- },
1118
- {
1119
- label: '自定义正则',
1120
- value: 'matchRegexp'
1121
- },
1122
- {
1123
- label: '自定义正则2',
1124
- value: 'matchRegexp1'
1125
- },
1126
- {
1127
- label: '自定义正则3',
1128
- value: 'matchRegexp2'
1129
- },
1130
- {
1131
- label: '自定义正则4',
1132
- value: 'matchRegexp3'
1133
- },
1134
- {
1135
- label: '自定义正则5',
1136
- value: 'matchRegexp4'
1137
- }
1138
- ];
1139
-
1140
- const trueProps = [
1141
- 'isEmail',
1142
- 'isUrl',
1143
- 'isNumeric',
1144
- 'isAlpha',
1145
- 'isAlphanumeric',
1146
- 'isInt',
1147
- 'isFloat',
1148
- 'isJson',
1149
- 'isPhoneNumber',
1150
- 'isTelNumber',
1151
- 'isZipcode',
1152
- 'isId'
1153
- ];
1154
-
1155
- function firstValue(arr: Array<any>, iterator: (item: any) => any) {
1156
- let theone = find(arr, iterator);
1157
- return theone ? theone.value : '';
1158
- }
1159
-
1160
- return {
1161
- type: 'combo',
1162
- syncDefaultValue: false,
1163
- name: 'validations',
1164
- label: '验证规则',
1165
- addButtonText: '新增规则',
1166
- multiple: true,
1167
- pipeIn: (value: any) => {
1168
- if (typeof value === 'string' && value) {
1169
- value = str2rules(value);
1170
- }
1171
- if (!isObject(value)) {
1172
- return value;
1173
- }
1174
-
1175
- let arr: Array<any> = [];
1176
-
1177
- Object.keys(value).forEach(key => {
1178
- if (/^\$\$/.test(key)) {
1179
- return;
1180
- }
1181
-
1182
- arr.push({
1183
- type: key,
1184
- [key]: Array.isArray(value[key]) ? value[key][0] : value[key]
1185
- });
1186
- });
1187
-
1188
- return arr;
1189
- },
1190
- pipeOut: (value: any) => {
1191
- if (!Array.isArray(value)) {
1192
- return value;
1193
- }
1194
- let obj: any = {};
1195
-
1196
- value.forEach((item: any) => {
1197
- let key: string =
1198
- item.type ||
1199
- firstValue(options, (item: any) => !obj[item.value]) ||
1200
- options[0].value;
1201
- obj[key] = item[key] || (~trueProps.indexOf(key) ? true : '');
1202
- });
1203
-
1204
- return obj;
1205
- },
1206
- items: [
1207
- {
1208
- type: 'select',
1209
- unique: true,
1210
- name: 'type',
1211
- options: options,
1212
- columnClassName: 'w-sm'
1213
- },
1214
- {
1215
- type: 'input-number',
1216
- name: 'isLength',
1217
- visibleOn: 'data.type == "isLength"',
1218
- placeholder: '设置长度',
1219
- value: '1'
1220
- },
1221
- {
1222
- type: 'input-number',
1223
- name: 'maximum',
1224
- visibleOn: 'data.type == "maximum"',
1225
- placeholder: '设置最大值'
1226
- },
1227
- {
1228
- type: 'input-number',
1229
- name: 'minimum',
1230
- visibleOn: 'data.type == "minimum"',
1231
- placeholder: '设置最小值'
1232
- },
1233
- {
1234
- type: 'input-number',
1235
- name: 'maxLength',
1236
- visibleOn: 'data.type == "maxLength"',
1237
- placeholder: '设置最大长度值'
1238
- },
1239
- {
1240
- type: 'input-number',
1241
- name: 'minLength',
1242
- visibleOn: 'data.type == "minLength"',
1243
- placeholder: '设置最小长度值'
1244
- },
1245
- {
1246
- type: 'input-text',
1247
- name: 'equals',
1248
- visibleOn: 'data.type == "equals"',
1249
- placeholder: '设置值',
1250
- value: ''
1251
- },
1252
- {
1253
- type: 'input-text',
1254
- name: 'equalsField',
1255
- visibleOn: 'data.type == "equalsField"',
1256
- placeholder: '设置字段名',
1257
- value: ''
1258
- },
1259
- {
1260
- type: 'input-text',
1261
- name: 'matchRegexp',
1262
- visibleOn: 'data.type == "matchRegexp"',
1263
- placeholder: '设置正则规则'
1264
- },
1265
- {
1266
- type: 'input-text',
1267
- name: 'matchRegexp1',
1268
- visibleOn: 'data.type == "matchRegexp1"',
1269
- placeholder: '设置正则规则'
1270
- },
1271
- {
1272
- type: 'input-text',
1273
- name: 'matchRegexp2',
1274
- visibleOn: 'data.type == "matchRegexp2"',
1275
- placeholder: '设置正则规则'
1276
- },
1277
- {
1278
- type: 'input-text',
1279
- name: 'matchRegexp3',
1280
- visibleOn: 'data.type == "matchRegexp3"',
1281
- placeholder: '设置正则规则'
1282
- },
1283
- {
1284
- type: 'input-text',
1285
- name: 'matchRegexp4',
1286
- visibleOn: 'data.type == "matchRegexp4"',
1287
- placeholder: '设置正则规则'
1288
- }
1289
- ]
1290
- };
1291
- })(),
1292
-
1293
- validationErrors: (function () {
1294
- const options = [
1295
- // {
1296
- // label: '必填',
1297
- // value: 'isRequired'
1298
- // },
1299
- {
1300
- label: '邮箱格式',
1301
- value: 'isEmail'
1302
- },
1303
- {
1304
- label: 'Url格式',
1305
- value: 'isUrl'
1306
- },
1307
- {
1308
- label: '数字',
1309
- value: 'isNumeric'
1310
- },
1311
- {
1312
- label: '字母',
1313
- value: 'isAlpha'
1314
- },
1315
- {
1316
- label: '字母和数字',
1317
- value: 'isAlphanumeric'
1318
- },
1319
- {
1320
- label: '整型数字',
1321
- value: 'isInt'
1322
- },
1323
- {
1324
- label: '浮点型数字',
1325
- value: 'isFloat'
1326
- },
1327
- {
1328
- label: '固定长度',
1329
- value: 'isLength'
1330
- },
1331
- {
1332
- label: '最大长度',
1333
- value: 'maxLength'
1334
- },
1335
- {
1336
- label: '最小长度',
1337
- value: 'minLength'
1338
- },
1339
- {
1340
- label: '最大值',
1341
- value: 'maximum'
1342
- },
1343
- {
1344
- label: '最小值',
1345
- value: 'minimum'
1346
- },
1347
- {
1348
- label: 'JSON格式',
1349
- value: 'isJson'
1350
- },
1351
- {
1352
- label: '手机号码',
1353
- value: 'isPhoneNumber'
1354
- },
1355
- {
1356
- label: '电话号码',
1357
- value: 'isTelNumber'
1358
- },
1359
- {
1360
- label: '邮编号码',
1361
- value: 'isZipcode'
1362
- },
1363
- {
1364
- label: '身份证号码',
1365
- value: 'isId'
1366
- },
1367
- {
1368
- label: '与指定值相同',
1369
- value: 'equals'
1370
- },
1371
- {
1372
- label: '与指定字段值相同',
1373
- value: 'equalsField'
1374
- },
1375
- {
1376
- label: '自定义正则',
1377
- value: 'matchRegexp'
1378
- },
1379
- {
1380
- label: '自定义正则2',
1381
- value: 'matchRegexp1'
1382
- },
1383
- {
1384
- label: '自定义正则3',
1385
- value: 'matchRegexp2'
1386
- },
1387
- {
1388
- label: '自定义正则4',
1389
- value: 'matchRegexp3'
1390
- },
1391
- {
1392
- label: '自定义正则5',
1393
- value: 'matchRegexp4'
1394
- }
1395
- ];
1396
-
1397
- const defaultMessages = {
1398
- isEmail: 'Email 格式不正确',
1399
- isRequired: '这是必填项',
1400
- isUrl: 'Url 格式不正确',
1401
- isInt: '请输入整形数字',
1402
- isAlpha: '请输入字母',
1403
- isNumeric: '请输入数字',
1404
- isAlphanumeric: '请输入字母或者数字',
1405
- isFloat: '请输入浮点型数值',
1406
- isWords: '请输入字母',
1407
- isUrlPath: '只能输入字母、数字、`-` 和 `_`.',
1408
- matchRegexp: '格式不正确, 请输入符合规则为 `$1` 的内容。',
1409
- minLength: '请输入更多的内容,至少输入 $1 个字符。',
1410
- maxLength: '请控制内容长度, 请不要输入 $1 个字符以上',
1411
- maximum: '当前输入值超出最大值 $1,请检查',
1412
- minimum: '当前输入值低于最小值 $1,请检查',
1413
- isJson: '请检查 Json 格式。',
1414
- isPhoneNumber: '请输入合法的手机号码',
1415
- isTelNumber: '请输入合法的电话号码',
1416
- isZipcode: '请输入合法的邮编地址',
1417
- isId: '请输入合法的身份证号',
1418
- isLength: '请输入长度为 $1 的内容',
1419
- notEmptyString: '请不要全输入空白字符',
1420
- equalsField: '输入的数据与 $1 值不一致',
1421
- equals: '输入的数据与 $1 不一致'
1422
- };
1423
-
1424
- function firstValue(arr: Array<any>, iterator: (item: any) => any) {
1425
- let theone = find(arr, iterator);
1426
- return theone ? theone.value : '';
1427
- }
1428
-
1429
- return {
1430
- type: 'combo',
1431
- syncDefaultValue: false,
1432
- name: 'validationErrors',
1433
- label: '自定义验证提示',
1434
- description: '自带提示不满足时,可以自定义。',
1435
- addButtonText: '新增提示',
1436
- multiple: true,
1437
- pipeIn: (value: any) => {
1438
- if (!isObject(value)) {
1439
- return value;
1440
- }
1441
-
1442
- let arr: Array<any> = [];
1443
-
1444
- Object.keys(value).forEach(key => {
1445
- if (/^\$\$/.test(key)) {
1446
- return;
1447
- }
1448
-
1449
- arr.push({
1450
- type: key,
1451
- msg: value[key]
1452
- });
1453
- });
1454
-
1455
- return arr;
1456
- },
1457
- pipeOut: (value: any) => {
1458
- if (!Array.isArray(value)) {
1459
- return value;
1460
- }
1461
- let obj: any = {};
1462
-
1463
- value.forEach((item: any) => {
1464
- let key: string =
1465
- item.type ||
1466
- firstValue(options, (item: any) => !obj[item.value]) ||
1467
- options[0].value;
1468
- obj[key] = item.msg || (defaultMessages as any)[key] || '';
1469
- });
1470
-
1471
- return obj;
1472
- },
1473
- items: [
1474
- {
1475
- type: 'select',
1476
- unique: true,
1477
- name: 'type',
1478
- options: options,
1479
- columnClassName: 'w-sm'
1480
- },
1481
-
1482
- {
1483
- type: 'input-text',
1484
- name: 'msg',
1485
- placeholder: '提示信息'
1486
- },
1487
-
1488
- {
1489
- type: 'formula',
1490
- name: 'msg',
1491
- initSet: false,
1492
- formula: `({
1493
- isEmail: 'Email 格式不正确',
1494
- isRequired: '这是必填项',
1495
- isUrl: 'Url 格式不正确',
1496
- isInt: '请输入整形数字',
1497
- isAlpha: '请输入字母',
1498
- isNumeric: '请输入数字',
1499
- isAlphanumeric: '请输入字母或者数字',
1500
- isFloat: '请输入浮点型数值',
1501
- isWords: '请输入字母',
1502
- isUrlPath: '只能输入字母、数字、\`-\` 和 \`_\`.',
1503
- matchRegexp: '格式不正确, 请输入符合规则为 \`$1\` 的内容。',
1504
- minLength: '请输入更多的内容,至少输入 $1 个字符。',
1505
- maxLength: '请控制内容长度, 请不要输入 $1 个字符以上',
1506
- maximum: '当前输入值超出最大值 $1,请检查',
1507
- minimum: '当前输入值低于最小值 $1,请检查',
1508
- isJson: '请检查 Json 格式。',
1509
- isLength: '请输入长度为 $1 的内容',
1510
- notEmptyString: '请不要全输入空白字符',
1511
- equalsField: '输入的数据与 $1 值不一致',
1512
- equals: '输入的数据与 $1 不一致',
1513
- isPhoneNumber: '请输入合法的手机号码',
1514
- isTelNumber: '请输入合法的电话号码',
1515
- isZipcode: '请输入合法的邮编地址',
1516
- isId: '请输入合法的身份证号',
1517
- })[data.type] || ''`
1518
- }
1519
- ]
1520
- };
1521
- })(),
1522
-
1523
- submitOnChange: {
1524
- label: '修改即提交',
1525
- type: 'switch',
1526
- name: 'submitOnChange',
1527
- mode: 'inline',
1528
- className: 'w-full',
1529
- labelRemark: {
1530
- trigger: 'click',
1531
- className: 'm-l-xs',
1532
- rootClose: true,
1533
- content: '设置后,表单中每次有修改都会触发提交',
1534
- placement: 'left'
1535
- }
1536
- },
1537
-
1538
- validateOnChange: {
1539
- type: 'button-group-select',
1540
- name: 'validateOnChange',
1541
- label: '修改即触发表单验证',
1542
- description: '默认为当表单提交过则每次修改都触发验证。',
1543
- size: 'xs',
1544
- mode: 'inline',
1545
- className: 'w-full',
1546
- options: [
1547
- {
1548
- label: '默认',
1549
- value: ''
1550
- },
1551
-
1552
- {
1553
- label: '开启',
1554
- value: true
1555
- },
1556
-
1557
- {
1558
- label: '关闭',
1559
- value: false
1560
- }
1561
- ],
1562
- pipeIn: defaultValue(''),
1563
- pipeOut: (value: any) => (value === '' ? undefined : !!value)
1564
- },
1565
-
1566
- validationControl: {
1567
- type: 'ae-validationControl',
1568
- label: '校验',
1569
- mode: 'normal'
1570
- },
1571
-
1572
- visible: {
1573
- type: 'fieldSet',
1574
- title: '显隐配置',
1575
- collapsable: false, // 避免和最外层的属性配置面板的tabs样式重叠
1576
- body: [
1577
- {
1578
- label: '设置方式',
1579
- name: 'visible',
1580
- type: 'button-group-select',
1581
- size: 'xs',
1582
- mode: 'inline',
1583
- className: 'w-full',
1584
- options: [
1585
- {
1586
- label: '静态设置',
1587
- value: 1
1588
- },
1589
-
1590
- {
1591
- label: '表达式',
1592
- value: 2
1593
- }
1594
- ],
1595
- pipeIn: (value: any) => (typeof value === 'boolean' ? 1 : 2),
1596
- pipeOut: (value: any) => (value === 1 ? true : ''),
1597
- onChange: (value: any, oldValue: boolean, model: any, form: any) => {
1598
- if (value) {
1599
- form.setValues({
1600
- __visibleOn: form.data.visibleOn,
1601
- visibleOn: '',
1602
- clearValueOnHidden: false
1603
- });
1604
- } else {
1605
- form.setValueByName('visibleOn', form.data.__visibleOn);
1606
- }
1607
- }
1608
- },
1609
-
1610
- {
1611
- type: 'switch',
1612
- label: '可见(visible)',
1613
- name: 'visible',
1614
- visibleOn: 'typeof this.visible === "boolean"',
1615
- pipeIn: (value: any, data: any) => value !== false && !data.hidden,
1616
- mode: 'inline',
1617
- className: 'w-full m-b-none',
1618
- onChange: (value: boolean, oldValue: boolean, model: any, form: any) =>
1619
- form.setValueByName('visibleOn', '')
1620
- },
1621
-
1622
- {
1623
- name: 'visibleOn',
1624
- label: '可见表达式(visibleOn)',
1625
- labelRemark: {
1626
- trigger: 'click',
1627
- className: 'm-l-xs',
1628
- rootClose: true,
1629
- content:
1630
- '纯粹的 JS 语法,this 指向当前数据层。文档:<a href="https://baidu.github.io/amis/docs/concepts/expression">表达式语法</a>',
1631
- placement: 'left'
1632
- },
1633
- placeholder: '如:this.type === 1',
1634
- type: 'input-text',
1635
- visibleOn: 'typeof this.visible !== "boolean"',
1636
- autoComplete: false,
1637
- pipeIn: (value: any, data: any) =>
1638
- value || (data.hiddenOn && `!(${data.hiddenOn})`) || '',
1639
- className: 'm-b-none'
1640
- }
1641
- ]
1642
- },
1643
-
1644
- initFetch: {
1645
- type: 'group',
1646
- label: '是否初始加载',
1647
- visibleOn: 'this.initApi',
1648
- direction: 'vertical',
1649
- className: 'm-b-none',
1650
- labelRemark: {
1651
- trigger: 'click',
1652
- rootClose: true,
1653
- className: 'm-l-xs',
1654
- content:
1655
- '当配置初始化接口后,组件初始就会拉取接口数据,可以通过以下配置修改。',
1656
- placement: 'left'
1657
- },
1658
- body: [
1659
- {
1660
- name: 'initFetch',
1661
- type: 'radios',
1662
- inline: true,
1663
- onChange: () => {},
1664
- // pipeIn: (value:any) => typeof value === 'boolean' ? value : '1'
1665
- options: [
1666
- {
1667
- label: '是',
1668
- value: true
1669
- },
1670
-
1671
- {
1672
- label: '否',
1673
- value: false
1674
- },
1675
-
1676
- {
1677
- label: '表达式',
1678
- value: ''
1679
- }
1680
- ]
1681
- },
1682
-
1683
- {
1684
- name: 'initFetchOn',
1685
- autoComplete: false,
1686
- visibleOn: 'typeof this.initFetch !== "boolean"',
1687
- type: 'input-text',
1688
- placeholder: '如:this.id 表示有 id 值时初始加载',
1689
- className: 'm-t-n-sm'
1690
- }
1691
- ]
1692
- },
1693
-
1694
- disabled: (additions: Array<any> = []) => {
1695
- return {
1696
- type: 'fieldSet',
1697
- title: '禁用配置',
1698
- collapsable: false, // 避免和最外层的属性配置面板的tabs样式重叠
1699
- body: [
1700
- ...additions,
1701
- {
1702
- label: '设置方式',
1703
- name: 'disabled',
1704
- type: 'button-group-select',
1705
- size: 'xs',
1706
- mode: 'inline',
1707
- className: 'w-full',
1708
- options: [
1709
- {
1710
- label: '静态设置',
1711
- value: 1
1712
- },
1713
-
1714
- {
1715
- label: '表达式',
1716
- value: 2
1717
- }
1718
- ],
1719
- pipeIn: (value: any) => (typeof value === 'boolean' ? 1 : 2),
1720
- pipeOut: (value: any) => (value === 1 ? false : '')
1721
- },
1722
-
1723
- {
1724
- type: 'switch',
1725
- label: '禁用(disabled)',
1726
- name: 'disabled',
1727
- visibleOn: 'typeof this.disabled === "boolean"',
1728
- pipeIn: (value: any, data: any) => value !== false && !data.hidden,
1729
- mode: 'inline',
1730
- className: 'w-full m-b-none',
1731
- onChange: (
1732
- value: boolean,
1733
- oldValue: boolean,
1734
- model: any,
1735
- form: any
1736
- ) => form.setValueByName('disabledOn', '')
1737
- },
1738
-
1739
- {
1740
- name: 'disabledOn',
1741
- label: '禁用表达式(disabledOn)',
1742
- placeholder: '如:this.type === 1',
1743
- labelRemark: {
1744
- trigger: 'click',
1745
- className: 'm-l-xs',
1746
- rootClose: true,
1747
- content:
1748
- '纯粹的 JS 语法,this 指向当前数据层。文档:<a href="https://baidu.github.io/amis/docs/concepts/expression">表达式语法</a>',
1749
- placement: 'left'
1750
- },
1751
- type: 'input-text',
1752
- visibleOn: 'typeof this.disabled !== "boolean"',
1753
- className: 'm-b-none'
1754
- }
1755
- ]
1756
- };
1757
- },
1758
-
1759
- switchDefaultValue: {
1760
- type: 'switch',
1761
- name: 'value',
1762
- label: '设置默认值',
1763
- mode: 'inline',
1764
- className: 'w-full',
1765
- pipeIn: (value: any) => typeof value !== 'undefined',
1766
- pipeOut: (value: any, origin: any, data: any) => (value ? '' : undefined),
1767
- remark: '不设置时根据 name 获取'
1768
- },
1769
-
1770
- multiple: {
1771
- label: '多选模式',
1772
- name: 'multiple',
1773
- type: 'switch',
1774
- mode: 'inline',
1775
- className: 'w-full'
1776
- },
1777
-
1778
- joinValues: {
1779
- type: 'switch',
1780
- name: 'joinValues',
1781
- mode: 'inline',
1782
- className: 'w-full',
1783
- visibleOn: 'data.multiple',
1784
- label: '是否拼接值',
1785
- value: true,
1786
- description:
1787
- '开启后将选中的选项 value 的值用连接符拼接起来,作为当前表单项的值。'
1788
- },
1789
-
1790
- delimiter: {
1791
- type: 'input-text',
1792
- name: 'delimiter',
1793
- label: '连接符',
1794
- visibleOn: 'data.multiple && data.joinValues',
1795
- pipeIn: defaultValue(',')
1796
- },
1797
-
1798
- extractValue: {
1799
- type: 'switch',
1800
- name: 'extractValue',
1801
- mode: 'inline',
1802
- className: 'w-full',
1803
- label: '是否抽取value值',
1804
- visibleOn: 'data.joinValues === false',
1805
- pipeIn: defaultValue(false),
1806
- description: '开启后将选中的选项 value 的值封装为数组,作为当前表单项的值。'
1807
- },
1808
-
1809
- creatable: {
1810
- label: '可创建选项',
1811
- name: 'creatable',
1812
- type: 'switch',
1813
- mode: 'inline',
1814
- className: 'w-full'
1815
- },
1816
-
1817
- createBtnLabel: {
1818
- label: '创建按钮文字',
1819
- name: 'createBtnLabel',
1820
- type: 'input-text',
1821
- mode: 'inline',
1822
- placeholder: '新增选项',
1823
- className: 'w-full'
1824
- },
1825
-
1826
- editable: {
1827
- label: '可编辑选项',
1828
- name: 'editable',
1829
- type: 'switch',
1830
- mode: 'inline',
1831
- className: 'w-full'
1832
- },
1833
-
1834
- removable: {
1835
- label: '可删除选项',
1836
- name: 'removable',
1837
- type: 'switch',
1838
- mode: 'inline',
1839
- className: 'w-full'
1840
- },
1841
-
1842
- ref: () => {
1843
- // {
1844
- // type: 'input-text',
1845
- // name: '$ref',
1846
- // label: '选择定义',
1847
- // labelRemark: '输入已经在page中设定好的定义'
1848
- // }
1849
- return null;
1850
- },
1851
-
1852
- imageUrl: {
1853
- type: 'input-text',
1854
- label: '图片'
1855
- },
1856
-
1857
- fileUrl: {
1858
- type: 'input-text',
1859
- label: '文件'
1860
- },
1861
-
1862
- markdownBody: {
1863
- name: 'value',
1864
- type: 'editor',
1865
- language: 'markdown',
1866
- size: 'xxl',
1867
- label: 'Markdown 内容',
1868
- options: {
1869
- lineNumbers: 'off'
1870
- }
1871
- },
1872
-
1873
- richText: {
1874
- label: '富文本',
1875
- type: 'input-rich-text',
1876
- buttons: [
1877
- 'paragraphFormat',
1878
- 'quote',
1879
- 'color',
1880
- '|',
1881
- 'bold',
1882
- 'italic',
1883
- 'underline',
1884
- 'strikeThrough',
1885
- '|',
1886
- 'formatOL',
1887
- 'formatUL',
1888
- 'align',
1889
- '|',
1890
- 'insertLink',
1891
- 'insertImage',
1892
- 'insertTable',
1893
- '|',
1894
- 'undo',
1895
- 'redo',
1896
- 'fullscreen'
1897
- ],
1898
- name: 'html',
1899
- description:
1900
- '支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target="_blank" href="/amis/zh-CN/docs/concepts/template">详情</a>',
1901
- size: 'lg'
1902
- },
1903
-
1904
- showCounter: {
1905
- label: '是否显示计数器',
1906
- name: 'showCounter',
1907
- type: 'switch',
1908
- mode: 'inline',
1909
- className: 'w-full'
1910
- },
1911
-
1912
- borderMode: {
1913
- type: 'select',
1914
- name: 'borderMode',
1915
- label: '边框模式',
1916
- options: [
1917
- {label: '全边框', value: 'full'},
1918
- {label: '半边框', value: 'half'},
1919
- {label: '无边框', value: 'none'}
1920
- ]
1921
- },
1922
-
1923
- data: {
1924
- type: 'input-kv',
1925
- name: 'data',
1926
- label: '初始静态数据'
1927
- }
1928
- };
1929
-
1930
- /**
1931
- * 样式相关的属性面板,因为预计会比较多所以拆出来
1932
- */
1933
- export const styleTpl = {
1934
- name: 'style',
1935
- type: 'combo',
1936
- label: '',
1937
- noBorder: true,
1938
- multiLine: true,
1939
- items: [
1940
- {
1941
- type: 'fieldSet',
1942
- title: '文字',
1943
- body: [
1944
- {
1945
- type: 'group',
1946
- body: [
1947
- {
1948
- label: '文字大小',
1949
- type: 'input-text',
1950
- name: 'fontSize'
1951
- },
1952
- {
1953
- label: '文字粗细',
1954
- name: 'fontWeight',
1955
- type: 'select',
1956
- options: ['normal', 'bold', 'lighter', 'bolder']
1957
- }
1958
- ]
1959
- },
1960
- {
1961
- type: 'group',
1962
- body: [
1963
- {
1964
- label: '文字颜色',
1965
- type: 'input-color',
1966
- name: 'color'
1967
- },
1968
- {
1969
- label: '对齐方式',
1970
- name: 'textAlign',
1971
- type: 'select',
1972
- options: [
1973
- 'left',
1974
- 'right',
1975
- 'center',
1976
- 'justify',
1977
- 'justify-all',
1978
- 'start',
1979
- 'end',
1980
- 'match-parent'
1981
- ]
1982
- }
1983
- ]
1984
- }
1985
- ]
1986
- },
1987
- {
1988
- type: 'fieldSet',
1989
- title: '背景',
1990
- body: [
1991
- {
1992
- label: '颜色',
1993
- name: 'backgroundColor',
1994
- type: 'input-color'
1995
- },
1996
- getSchemaTpl('imageUrl', {
1997
- name: 'backgroundImage'
1998
- })
1999
- ]
2000
- },
2001
- {
2002
- type: 'fieldSet',
2003
- title: '边距',
2004
- body: [
2005
- {
2006
- type: 'group',
2007
- label: '外边距',
2008
- body: [
2009
- {
2010
- label: '上',
2011
- name: 'marginTop',
2012
- type: 'input-text'
2013
- },
2014
- {
2015
- label: '右',
2016
- name: 'marginRight',
2017
- type: 'input-text'
2018
- },
2019
- {
2020
- label: '下',
2021
- name: 'marginBottom',
2022
- type: 'input-text'
2023
- },
2024
- {
2025
- label: '左',
2026
- name: 'marginLeft',
2027
- type: 'input-text'
2028
- }
2029
- ]
2030
- },
2031
- {
2032
- type: 'group',
2033
- label: '内边距',
2034
- body: [
2035
- {
2036
- label: '上',
2037
- name: 'paddingTop',
2038
- type: 'input-text'
2039
- },
2040
- {
2041
- label: '右',
2042
- name: 'paddingRight',
2043
- type: 'input-text'
2044
- },
2045
- {
2046
- label: '下',
2047
- name: 'paddingBottom',
2048
- type: 'input-text'
2049
- },
2050
- {
2051
- label: '左',
2052
- name: 'paddingLeft',
2053
- type: 'input-text'
2054
- }
2055
- ]
2056
- }
2057
- ]
2058
- },
2059
- {
2060
- type: 'fieldSet',
2061
- title: '边框',
2062
- body: [
2063
- {
2064
- type: 'group',
2065
- body: [
2066
- {
2067
- label: '样式',
2068
- name: 'borderStyle',
2069
- type: 'select',
2070
- options: ['none', 'solid', 'dotted', 'dashed']
2071
- },
2072
- {
2073
- label: '颜色',
2074
- name: 'borderColor',
2075
- type: 'input-color'
2076
- }
2077
- ]
2078
- },
2079
- {
2080
- type: 'group',
2081
- body: [
2082
- {
2083
- label: '宽度',
2084
- name: 'borderWidth',
2085
- type: 'input-text'
2086
- },
2087
- {
2088
- label: '圆角宽度',
2089
- name: 'borderRadius',
2090
- type: 'input-text'
2091
- }
2092
- ]
2093
- }
2094
- ]
2095
- },
2096
- {
2097
- type: 'fieldSet',
2098
- title: '特效',
2099
- body: [
2100
- {
2101
- label: '透明度',
2102
- name: 'opacity',
2103
- min: 0,
2104
- max: 1,
2105
- step: 0.05,
2106
- type: 'input-range',
2107
- pipeIn: defaultValue(1)
2108
- },
2109
- {
2110
- label: '阴影',
2111
- name: 'boxShadow',
2112
- type: 'input-text'
2113
- }
2114
- ]
2115
- }
2116
- ]
2117
- };
2118
- tpls.style = styleTpl;
2119
-
2120
- export function getSchemaTpl(name: string, patch?: object): any {
2121
- const tpl = tpls[name];
2122
-
2123
- if (typeof tpl === 'function') {
2124
- return tpl(patch);
2125
- }
2126
-
2127
- return tpl
2128
- ? patch
2129
- ? {
2130
- ...tpl,
2131
- ...patch
2132
- }
2133
- : tpl
2134
- : null;
2135
- }
2136
-
2137
- export function setSchemaTpl(name: string, value: any) {
2138
- tpls[name] = value;
2139
- }
2140
-
2141
- export function valuePipeOut(value: any) {
2142
- try {
2143
- if (value === 'undefined') {
2144
- return undefined;
2145
- }
2146
-
2147
- return JSON.parse(value);
2148
- } catch (e) {
2149
- return value;
2150
- }
2151
- }
2152
-
2153
- export function defaultValue(defaultValue: any, strictMode: boolean = true) {
2154
- return strictMode
2155
- ? (value: any) => (typeof value === 'undefined' ? defaultValue : value)
2156
- : (value: any) => value || defaultValue;
2157
- }