amis 1.3.5-beta.3 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/lib/components/Badge.d.ts +15 -2
  2. package/lib/components/Badge.js +47 -4
  3. package/lib/components/Badge.js.map +2 -2
  4. package/lib/components/Button.d.ts +24 -22
  5. package/lib/components/Button.js +13 -7
  6. package/lib/components/Button.js.map +2 -2
  7. package/lib/components/Checkbox.d.ts +1 -1
  8. package/lib/components/Checkbox.js +1 -1
  9. package/lib/components/Checkbox.js.map +2 -2
  10. package/lib/components/Drawer.js +1 -1
  11. package/lib/components/Drawer.js.map +2 -2
  12. package/lib/components/Modal.js +1 -1
  13. package/lib/components/Modal.js.map +2 -2
  14. package/lib/components/RichText.d.ts +6 -4
  15. package/lib/components/RichText.js +241 -27
  16. package/lib/components/RichText.js.map +2 -2
  17. package/lib/components/Select.d.ts +7 -0
  18. package/lib/components/Select.js.map +2 -2
  19. package/lib/components/Steps.d.ts +3 -3
  20. package/lib/components/Steps.js.map +1 -1
  21. package/lib/components/WithRemoteConfig.d.ts +8 -0
  22. package/lib/components/WithRemoteConfig.js +28 -2
  23. package/lib/components/WithRemoteConfig.js.map +2 -2
  24. package/lib/components/calendar/DaysView.js +2 -2
  25. package/lib/components/calendar/DaysView.js.map +2 -2
  26. package/lib/components/condition-builder/Field.js +0 -1
  27. package/lib/components/condition-builder/Field.js.map +2 -2
  28. package/lib/components/condition-builder/Value.js +2 -1
  29. package/lib/components/condition-builder/Value.js.map +2 -2
  30. package/lib/components/condition-builder/types.d.ts +5 -0
  31. package/lib/components/condition-builder/types.js.map +1 -1
  32. package/lib/components/icons.js +2 -0
  33. package/lib/components/icons.js.map +2 -2
  34. package/lib/factory.d.ts +5 -1
  35. package/lib/factory.js +9 -4
  36. package/lib/factory.js.map +2 -2
  37. package/lib/helper.css.map +1 -1
  38. package/lib/icons/loading-outline.js +7 -0
  39. package/lib/index.d.ts +1 -0
  40. package/lib/index.js +2 -1
  41. package/lib/index.js.map +2 -2
  42. package/lib/locale/de-DE.js +1 -0
  43. package/lib/locale/de-DE.js.map +2 -2
  44. package/lib/locale/en-US.js +2 -1
  45. package/lib/locale/en-US.js.map +2 -2
  46. package/lib/locale/zh-CN.js +2 -1
  47. package/lib/locale/zh-CN.js.map +2 -2
  48. package/lib/renderers/Action.d.ts +15 -1
  49. package/lib/renderers/Action.js +13 -6
  50. package/lib/renderers/Action.js.map +2 -2
  51. package/lib/renderers/CRUD.d.ts +2 -2
  52. package/lib/renderers/CRUD.js +11 -20
  53. package/lib/renderers/CRUD.js.map +2 -2
  54. package/lib/renderers/Card.js +11 -11
  55. package/lib/renderers/Card.js.map +2 -2
  56. package/lib/renderers/Collapse.d.ts +1 -1
  57. package/lib/renderers/Collapse.js +5 -1
  58. package/lib/renderers/Collapse.js.map +2 -2
  59. package/lib/renderers/Dialog.d.ts +0 -252
  60. package/lib/renderers/Dialog.js +3 -2
  61. package/lib/renderers/Dialog.js.map +2 -2
  62. package/lib/renderers/Drawer.js +2 -1
  63. package/lib/renderers/Drawer.js.map +2 -2
  64. package/lib/renderers/DropDownButton.d.ts +8 -0
  65. package/lib/renderers/DropDownButton.js +6 -4
  66. package/lib/renderers/DropDownButton.js.map +2 -2
  67. package/lib/renderers/Form/ButtonGroupSelect.js +3 -0
  68. package/lib/renderers/Form/ButtonGroupSelect.js.map +2 -2
  69. package/lib/renderers/Form/Combo.d.ts +2 -0
  70. package/lib/renderers/Form/Combo.js +16 -1
  71. package/lib/renderers/Form/Combo.js.map +2 -2
  72. package/lib/renderers/Form/DiffEditor.d.ts +0 -2
  73. package/lib/renderers/Form/Editor.d.ts +0 -2
  74. package/lib/renderers/Form/Editor.js +1 -1
  75. package/lib/renderers/Form/Editor.js.map +2 -2
  76. package/lib/renderers/Form/InputExcel.d.ts +5 -0
  77. package/lib/renderers/Form/InputExcel.js +24 -3
  78. package/lib/renderers/Form/InputExcel.js.map +2 -2
  79. package/lib/renderers/Form/InputImage.d.ts +8 -0
  80. package/lib/renderers/Form/InputImage.js +2 -1
  81. package/lib/renderers/Form/InputImage.js.map +2 -2
  82. package/lib/renderers/Form/InputNumber.d.ts +19 -5
  83. package/lib/renderers/Form/InputNumber.js +69 -7
  84. package/lib/renderers/Form/InputNumber.js.map +2 -2
  85. package/lib/renderers/Form/InputRange.js +7 -2
  86. package/lib/renderers/Form/InputRange.js.map +2 -2
  87. package/lib/renderers/Form/InputTable.d.ts +23 -5
  88. package/lib/renderers/Form/InputTable.js +32 -3
  89. package/lib/renderers/Form/InputTable.js.map +2 -2
  90. package/lib/renderers/Form/Options.js +3 -1
  91. package/lib/renderers/Form/Options.js.map +2 -2
  92. package/lib/renderers/Form/index.js +0 -10
  93. package/lib/renderers/Form/index.js.map +2 -2
  94. package/lib/renderers/Form/wrapControl.js +3 -3
  95. package/lib/renderers/Form/wrapControl.js.map +2 -2
  96. package/lib/renderers/Json.js +5 -1
  97. package/lib/renderers/Json.js.map +2 -2
  98. package/lib/renderers/List.d.ts +5 -0
  99. package/lib/renderers/List.js +20 -14
  100. package/lib/renderers/List.js.map +2 -2
  101. package/lib/renderers/Nav.d.ts +52 -22
  102. package/lib/renderers/Nav.js +100 -15
  103. package/lib/renderers/Nav.js.map +2 -2
  104. package/lib/renderers/Page.d.ts +6 -0
  105. package/lib/renderers/Page.js +11 -3
  106. package/lib/renderers/Page.js.map +2 -2
  107. package/lib/renderers/Service.d.ts +10 -1
  108. package/lib/renderers/Service.js +85 -3
  109. package/lib/renderers/Service.js.map +2 -2
  110. package/lib/renderers/Steps.d.ts +4 -4
  111. package/lib/renderers/Steps.js +5 -2
  112. package/lib/renderers/Steps.js.map +2 -2
  113. package/lib/renderers/Table/TableBody.d.ts +5 -3
  114. package/lib/renderers/Table/TableBody.js +17 -11
  115. package/lib/renderers/Table/TableBody.js.map +2 -2
  116. package/lib/renderers/Table/TableCell.js +6 -2
  117. package/lib/renderers/Table/TableCell.js.map +2 -2
  118. package/lib/renderers/Table/TableContent.d.ts +3 -1
  119. package/lib/renderers/Table/TableContent.js +6 -2
  120. package/lib/renderers/Table/TableContent.js.map +2 -2
  121. package/lib/renderers/Table/TableRow.d.ts +1 -1
  122. package/lib/renderers/Table/TableRow.js +14 -13
  123. package/lib/renderers/Table/TableRow.js.map +2 -2
  124. package/lib/renderers/Table/index.d.ts +28 -3
  125. package/lib/renderers/Table/index.js +92 -52
  126. package/lib/renderers/Table/index.js.map +2 -2
  127. package/lib/schemaExtend.d.ts +1 -0
  128. package/lib/schemaExtend.js +59 -0
  129. package/lib/schemaExtend.js.map +13 -0
  130. package/lib/store/app.d.ts +0 -1
  131. package/lib/store/combo.d.ts +0 -2
  132. package/lib/store/crud.d.ts +3 -3
  133. package/lib/store/crud.js +41 -36
  134. package/lib/store/crud.js.map +2 -2
  135. package/lib/store/form.d.ts +0 -1
  136. package/lib/store/formItem.js +10 -6
  137. package/lib/store/formItem.js.map +2 -2
  138. package/lib/store/modal.d.ts +1 -1
  139. package/lib/store/modal.js +4 -0
  140. package/lib/store/modal.js.map +2 -2
  141. package/lib/store/root.d.ts +0 -1
  142. package/lib/store/service.d.ts +0 -1
  143. package/lib/store/service.js +0 -13
  144. package/lib/store/service.js.map +2 -2
  145. package/lib/store/table.d.ts +1 -2
  146. package/lib/store/table.js +44 -3
  147. package/lib/store/table.js.map +2 -2
  148. package/lib/themes/ang-ie11.css +624 -71
  149. package/lib/themes/ang.css +624 -71
  150. package/lib/themes/ang.css.map +1 -1
  151. package/lib/themes/antd-ie11.css +624 -71
  152. package/lib/themes/antd.css +624 -71
  153. package/lib/themes/antd.css.map +1 -1
  154. package/lib/themes/cxd-ie11.css +732 -191
  155. package/lib/themes/cxd.css +732 -191
  156. package/lib/themes/cxd.css.map +1 -1
  157. package/lib/themes/dark-ie11.css +624 -71
  158. package/lib/themes/dark.css +624 -71
  159. package/lib/themes/dark.css.map +1 -1
  160. package/lib/themes/default.css +732 -191
  161. package/lib/themes/default.css.map +1 -1
  162. package/lib/utils/api.js +12 -0
  163. package/lib/utils/api.js.map +2 -2
  164. package/lib/utils/attachmentAdpator.d.ts +7 -0
  165. package/lib/utils/attachmentAdpator.js +82 -0
  166. package/lib/utils/attachmentAdpator.js.map +13 -0
  167. package/lib/utils/helper.d.ts +2 -0
  168. package/lib/utils/helper.js +14 -1
  169. package/lib/utils/helper.js.map +2 -2
  170. package/lib/utils/resize-sensor.js +6 -0
  171. package/lib/utils/resize-sensor.js.map +2 -2
  172. package/lib/utils/tpl-builtin.d.ts +1 -0
  173. package/lib/utils/tpl-builtin.js +24 -8
  174. package/lib/utils/tpl-builtin.js.map +2 -2
  175. package/lib/utils/validations.js +62 -5
  176. package/lib/utils/validations.js.map +2 -2
  177. package/package.json +1 -2
  178. package/schema.json +561 -171
  179. package/scss/_mixins.scss +29 -0
  180. package/scss/_properties.scss +29 -11
  181. package/scss/components/_badge.scss +67 -2
  182. package/scss/components/_button.scss +35 -3
  183. package/scss/components/_image-gallery.scss +1 -1
  184. package/scss/components/_list.scss +8 -0
  185. package/scss/components/_markdown.scss +266 -0
  186. package/scss/components/_nav.scss +109 -35
  187. package/scss/components/_spinner.scss +6 -2
  188. package/scss/components/_table.scss +4 -0
  189. package/scss/components/form/_form.scss +3 -17
  190. package/scss/components/form/_group.scss +4 -0
  191. package/scss/components/form/_number.scss +12 -1
  192. package/scss/themes/_common.scss +1 -0
  193. package/scss/themes/_cxd-variables.scss +20 -20
  194. package/sdk/ang-ie11.css +769 -76
  195. package/sdk/ang.css +785 -76
  196. package/sdk/antd-ie11.css +759 -68
  197. package/sdk/antd.css +785 -76
  198. package/sdk/charts.js +13 -13
  199. package/sdk/color-picker.js +67 -67
  200. package/sdk/cropperjs.js +2 -2
  201. package/sdk/cxd-ie11.css +1243 -552
  202. package/sdk/cxd.css +893 -196
  203. package/sdk/dark-ie11.css +769 -76
  204. package/sdk/dark.css +785 -76
  205. package/sdk/exceljs.js +1 -1
  206. package/sdk/helper.css.map +1 -1
  207. package/sdk/locale/de-DE.js +1 -0
  208. package/sdk/markdown.js +69 -69
  209. package/sdk/papaparse.js +1 -1
  210. package/sdk/renderers/Form/CityDB.js +1 -1
  211. package/sdk/rest.js +22 -24
  212. package/sdk/rich-text.js +62 -64
  213. package/sdk/sdk-ie11.css +1243 -552
  214. package/sdk/sdk.css +893 -196
  215. package/sdk/sdk.js +1123 -1111
  216. package/sdk/thirds/hls.js/hls.js +1 -1
  217. package/sdk/thirds/mpegts.js/mpegts.js +1 -1
  218. package/sdk/tinymce.js +57 -57
  219. package/sdk.zip +0 -0
  220. package/src/components/Badge.tsx +111 -20
  221. package/src/components/Button.tsx +23 -7
  222. package/src/components/Checkbox.tsx +5 -2
  223. package/src/components/Drawer.tsx +3 -2
  224. package/src/components/Modal.tsx +3 -2
  225. package/src/components/RichText.tsx +280 -24
  226. package/src/components/Select.tsx +1 -0
  227. package/src/components/Steps.tsx +3 -3
  228. package/src/components/WithRemoteConfig.tsx +37 -2
  229. package/src/components/calendar/DaysView.tsx +2 -2
  230. package/src/components/condition-builder/Field.tsx +1 -2
  231. package/src/components/condition-builder/Value.tsx +3 -0
  232. package/src/components/condition-builder/types.ts +6 -0
  233. package/src/components/icons.tsx +2 -0
  234. package/src/factory.tsx +13 -3
  235. package/src/icons/loading-outline.svg +4 -0
  236. package/src/index.tsx +2 -0
  237. package/src/locale/de-DE.ts +1 -0
  238. package/src/locale/en-US.ts +2 -1
  239. package/src/locale/zh-CN.ts +2 -1
  240. package/src/renderers/Action.tsx +84 -14
  241. package/src/renderers/CRUD.tsx +13 -33
  242. package/src/renderers/Card.tsx +21 -15
  243. package/src/renderers/Collapse.tsx +5 -1
  244. package/src/renderers/Dialog.tsx +3 -2
  245. package/src/renderers/Drawer.tsx +2 -1
  246. package/src/renderers/DropDownButton.tsx +21 -4
  247. package/src/renderers/Form/ButtonGroupSelect.tsx +3 -0
  248. package/src/renderers/Form/Combo.tsx +7 -0
  249. package/src/renderers/Form/Editor.tsx +19 -20
  250. package/src/renderers/Form/InputExcel.tsx +28 -3
  251. package/src/renderers/Form/InputImage.tsx +23 -8
  252. package/src/renderers/Form/InputNumber.tsx +113 -18
  253. package/src/renderers/Form/InputRange.tsx +5 -2
  254. package/src/renderers/Form/InputTable.tsx +88 -9
  255. package/src/renderers/Form/Options.tsx +3 -1
  256. package/src/renderers/Form/index.tsx +0 -15
  257. package/src/renderers/Form/wrapControl.tsx +2 -2
  258. package/src/renderers/Json.tsx +10 -1
  259. package/src/renderers/List.tsx +32 -19
  260. package/src/renderers/Nav.tsx +165 -36
  261. package/src/renderers/Page.tsx +20 -1
  262. package/src/renderers/Service.tsx +101 -3
  263. package/src/renderers/Steps.tsx +12 -9
  264. package/src/renderers/Table/TableBody.tsx +29 -10
  265. package/src/renderers/Table/TableCell.tsx +15 -1
  266. package/src/renderers/Table/TableContent.tsx +7 -1
  267. package/src/renderers/Table/TableRow.tsx +18 -17
  268. package/src/renderers/Table/index.tsx +112 -27
  269. package/src/schemaExtend.ts +66 -0
  270. package/src/store/crud.ts +34 -38
  271. package/src/store/formItem.ts +10 -6
  272. package/src/store/modal.ts +4 -0
  273. package/src/store/service.ts +0 -19
  274. package/src/store/table.ts +48 -0
  275. package/src/utils/api.ts +11 -0
  276. package/src/utils/attachmentAdpator.ts +90 -0
  277. package/src/utils/helper.ts +16 -0
  278. package/src/utils/resize-sensor.ts +7 -0
  279. package/src/utils/tpl-builtin.ts +36 -17
  280. package/src/utils/validations.ts +80 -12
@@ -6,8 +6,8 @@
6
6
  "/src/renderers/Form/Editor.tsx"
7
7
  ],
8
8
  "names": [],
9
- "mappings": ";;;;AAAA,6DAA0B;AAC1B,+BAAmE;AACnE,8FAA2D;AAE3D,gFAA6C;AAC7C,6CAA4C;AAC5C,uDAGiC;AA2GjC;IAA2C,8CAAiC;IAsB1E,uBAAY,KAAkB;QAA9B,YACE,kBAAM,KAAK,CAAC,SAKb;QAZD,WAAK,GAAG;YACN,OAAO,EAAE,KAAK;SACf,CAAC;QAEF,eAAS,GAAoB,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ClB,kCAAY,mDACd,aAAa,CAAC,YAAY,KAC7B,QAAQ,EAAE,IAAI,IACd;QARE,qBAAqB;YAJ1B,IAAA,eAAQ,EAAC;gBACR,IAAI,EAAK,IAAI,YAAS;gBACtB,WAAW,EAAE,KAAK;aACnB,CAAC;WACI,qBAAqB,CAS1B;QAAD,4BAAC;KAAA,AATD,CAAoC,aAAa,GAShD;IAED,OAAO,qBAAqB,CAAC;AAC/B,CAAC,CAAC,CAAC;AAML;IAA8C,gEAAa;IAA3D;;IAKA,CAAC;IAJQ,4CAAY,mDACd,aAAa,CAAC,YAAY,KAC7B,QAAQ,EAAE,YAAY,IACtB;IAJE,+BAA+B;QAJpC,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,KAAK;SACnB,CAAC;OACI,+BAA+B,CAKpC;IAAD,sCAAC;CAAA,AALD,CAA8C,aAAa,GAK1D;AAMD;IAA8C,gEAAa;IAA3D;;IAKA,CAAC;IAJQ,4CAAY,mDACd,aAAa,CAAC,YAAY,KAC7B,QAAQ,EAAE,YAAY,IACtB;IAJE,+BAA+B;QAJpC,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,KAAK;SACnB,CAAC;OACI,+BAA+B,CAKpC;IAAD,sCAAC;CAAA,AALD,CAA8C,aAAa,GAK1D;AAMD;IAA2C,sDAAa;IAAxD;;IAKA,CAAC;IAJQ,kCAAY,mDACd,aAAa,CAAC,YAAY,KAC7B,QAAQ,EAAE,YAAY,IACtB;IAJS,qBAAqB;QAJjC,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,KAAK;SACnB,CAAC;OACW,qBAAqB,CAKjC;IAAD,4BAAC;CAAA,AALD,CAA2C,aAAa,GAKvD;AALY,sDAAqB",
10
10
  "sourcesContent": [
11
- "import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport LazyComponent from '../../components/LazyComponent';\nimport debouce from 'lodash/debounce';\nimport Editor from '../../components/Editor';\nimport {autobind} from '../../utils/helper';\nimport {\n isPureVariable,\n resolveVariableAndFilter\n} from '../../utils/tpl-builtin';\n\n/**\n * Editor 代码编辑器\n * 文档:https://baidu.gitee.io/amis/docs/components/form/editor\n */\nexport interface EditorControlSchema extends Omit<FormBaseControl, 'size'> {\n type:\n | 'editor'\n | 'bat-editor'\n | 'c-editor'\n | 'coffeescript-editor'\n | 'cpp-editor'\n | 'csharp-editor'\n | 'css-editor'\n | 'dockerfile-editor'\n | 'fsharp-editor'\n | 'go-editor'\n | 'handlebars-editor'\n | 'html-editor'\n | 'ini-editor'\n | 'java-editor'\n | 'javascript-editor'\n | 'json-editor'\n | 'less-editor'\n | 'lua-editor'\n | 'markdown-editor'\n | 'msdax-editor'\n | 'objective-c-editor'\n | 'php-editor'\n | 'plaintext-editor'\n | 'postiats-editor'\n | 'powershell-editor'\n | 'pug-editor'\n | 'python-editor'\n | 'r-editor'\n | 'razor-editor'\n | 'ruby-editor'\n | 'sb-editor'\n | 'scss-editor'\n | 'sol-editor'\n | 'sql-editor'\n | 'swift-editor'\n | 'typescript-editor'\n | 'vb-editor'\n | 'xml-editor'\n | 'yaml-editor';\n\n /**\n * 语言类型\n */\n language?:\n | 'bat'\n | 'c'\n | 'coffeescript'\n | 'cpp'\n | 'csharp'\n | 'css'\n | 'dockerfile'\n | 'fsharp'\n | 'go'\n | 'handlebars'\n | 'html'\n | 'ini'\n | 'java'\n | 'javascript'\n | 'json'\n | 'less'\n | 'lua'\n | 'markdown'\n | 'msdax'\n | 'objective-c'\n | 'php'\n | 'plaintext'\n | 'postiats'\n | 'powershell'\n | 'pug'\n | 'python'\n | 'r'\n | 'razor'\n | 'ruby'\n | 'sb'\n | 'scss'\n | 'shell'\n | 'sol'\n | 'sql'\n | 'swift'\n | 'typescript'\n | 'vb'\n | 'xml'\n | 'yaml';\n\n /**\n * 编辑器大小\n */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';\n\n /**\n * 是否展示全屏模式开关\n */\n allowFullscreen?: boolean;\n}\n\nexport interface EditorProps extends FormControlProps {\n options?: object;\n}\n\nexport default class EditorControl extends React.Component<EditorProps, any> {\n static defaultProps: Partial<EditorProps> = {\n language: 'javascript',\n editorTheme: 'vs',\n allowFullscreen: false,\n options: {\n automaticLayout: true,\n selectOnLineNumbers: true,\n scrollBeyondLastLine: false,\n folding: true,\n minimap: {\n enabled: false\n }\n }\n };\n\n state = {\n focused: false\n };\n editor: any;\n toDispose: Array<Function> = [];\n divRef = React.createRef<HTMLDivElement>();\n constructor(props: EditorProps) {\n super(props);\n\n this.handleFocus = this.handleFocus.bind(this);\n this.handleBlur = this.handleBlur.bind(this);\n this.handleEditorMounted = this.handleEditorMounted.bind(this);\n }\n\n componentWillUnmount() {\n this.toDispose.forEach(fn => fn());\n }\n\n handleFocus() {\n this.setState({\n focused: true\n });\n }\n\n handleBlur() {\n this.setState({\n focused: false\n });\n }\n\n handleEditorMounted(editor: any, monaco: any) {\n this.editor = editor;\n this.toDispose.push(\n editor.onDidChangeModelDecorations(() => {\n this.updateContainerSize(editor, monaco); // typing\n requestAnimationFrame(\n this.updateContainerSize.bind(this, editor, monaco)\n ); // folding\n }).dispose\n );\n this.props.editorDidMount && this.props.editorDidMount(editor, monaco);\n }\n\n prevHeight = 0;\n @autobind\n updateContainerSize(editor: any, monaco: any) {\n if (!this.divRef.current) {\n return;\n }\n\n const lineHeight = editor.getOption(monaco.editor.EditorOption.lineHeight);\n const lineCount = editor.getModel()?.getLineCount() || 1;\n const height = editor.getTopForLineNumber(lineCount + 1) + lineHeight;\n\n if (this.prevHeight !== height) {\n this.prevHeight = height;\n this.divRef.current.style.height = `${height}px`;\n editor.layout();\n }\n }\n\n render() {\n const {\n className,\n classPrefix: ns,\n classnames: cx,\n value,\n onChange,\n disabled,\n options,\n editorTheme,\n size,\n data,\n allowFullscreen\n } = this.props;\n\n let language = this.props.language;\n\n let finnalValue = value;\n\n if (finnalValue && typeof finnalValue !== 'string') {\n finnalValue = JSON.stringify(finnalValue, null, 2);\n }\n\n if (isPureVariable(language)) {\n language = resolveVariableAndFilter(language, data);\n }\n\n return (\n <div\n ref={this.divRef}\n className={cx(\n `EditorControl`,\n {\n 'is-focused': this.state.focused,\n [`EditorControl--${size}`]: size\n },\n className\n )}\n >\n <LazyComponent\n classPrefix={ns}\n component={Editor}\n allowFullscreen={allowFullscreen}\n value={finnalValue}\n onChange={onChange}\n disabled={disabled}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n language={language}\n editorTheme={editorTheme}\n editorDidMount={this.handleEditorMounted}\n options={{\n ...options,\n readOnly: disabled\n }}\n />\n </div>\n );\n }\n}\n\nexport const availableLanguages = [\n 'bat',\n 'c',\n 'coffeescript',\n 'cpp',\n 'csharp',\n 'css',\n 'dockerfile',\n 'fsharp',\n 'go',\n 'handlebars',\n 'html',\n 'ini',\n 'java',\n 'javascript',\n 'json',\n 'less',\n 'lua',\n 'markdown',\n 'msdax',\n 'objective-c',\n 'php',\n 'plaintext',\n 'postiats',\n 'powershell',\n 'pug',\n 'python',\n 'r',\n 'razor',\n 'ruby',\n 'sb',\n 'scss',\n 'sol',\n 'shell',\n 'sql',\n 'swift',\n 'typescript',\n 'vb',\n 'xml',\n 'yaml'\n];\n\nexport const EditorControls: Array<\n typeof EditorControl\n> = availableLanguages.map((lang: string) => {\n @FormItem({\n type: `${lang}-editor`,\n sizeMutable: false\n })\n class EditorControlRenderer extends EditorControl {\n static lang = lang;\n static displayName = `${lang[0].toUpperCase()}${lang.substring(\n 1\n )}EditorControlRenderer`;\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: lang\n };\n }\n\n return EditorControlRenderer;\n});\n\n@FormItem({\n type: 'js-editor',\n sizeMutable: false\n})\nclass JavascriptEditorControlRenderer extends EditorControl {\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: 'javascript'\n };\n}\n\n@FormItem({\n type: 'ts-editor',\n sizeMutable: false\n})\nclass TypescriptEditorControlRenderer extends EditorControl {\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: 'typescript'\n };\n}\n\n@FormItem({\n type: `editor`,\n sizeMutable: false\n})\nexport class EditorControlRenderer extends EditorControl {\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: 'javascript'\n };\n}\n"
11
+ "import React from 'react';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\nimport LazyComponent from '../../components/LazyComponent';\nimport debouce from 'lodash/debounce';\nimport Editor from '../../components/Editor';\nimport {autobind} from '../../utils/helper';\nimport {\n isPureVariable,\n resolveVariableAndFilter\n} from '../../utils/tpl-builtin';\n\n/**\n * Editor 代码编辑器\n * 文档:https://baidu.gitee.io/amis/docs/components/form/editor\n */\nexport interface EditorControlSchema extends Omit<FormBaseControl, 'size'> {\n type:\n | 'editor'\n | 'bat-editor'\n | 'c-editor'\n | 'coffeescript-editor'\n | 'cpp-editor'\n | 'csharp-editor'\n | 'css-editor'\n | 'dockerfile-editor'\n | 'fsharp-editor'\n | 'go-editor'\n | 'handlebars-editor'\n | 'html-editor'\n | 'ini-editor'\n | 'java-editor'\n | 'javascript-editor'\n | 'json-editor'\n | 'less-editor'\n | 'lua-editor'\n | 'markdown-editor'\n | 'msdax-editor'\n | 'objective-c-editor'\n | 'php-editor'\n | 'plaintext-editor'\n | 'postiats-editor'\n | 'powershell-editor'\n | 'pug-editor'\n | 'python-editor'\n | 'r-editor'\n | 'razor-editor'\n | 'ruby-editor'\n | 'sb-editor'\n | 'scss-editor'\n | 'sol-editor'\n | 'sql-editor'\n | 'swift-editor'\n | 'typescript-editor'\n | 'vb-editor'\n | 'xml-editor'\n | 'yaml-editor';\n\n /**\n * 语言类型\n */\n language?:\n | 'bat'\n | 'c'\n | 'coffeescript'\n | 'cpp'\n | 'csharp'\n | 'css'\n | 'dockerfile'\n | 'fsharp'\n | 'go'\n | 'handlebars'\n | 'html'\n | 'ini'\n | 'java'\n | 'javascript'\n | 'json'\n | 'less'\n | 'lua'\n | 'markdown'\n | 'msdax'\n | 'objective-c'\n | 'php'\n | 'plaintext'\n | 'postiats'\n | 'powershell'\n | 'pug'\n | 'python'\n | 'r'\n | 'razor'\n | 'ruby'\n | 'sb'\n | 'scss'\n | 'shell'\n | 'sol'\n | 'sql'\n | 'swift'\n | 'typescript'\n | 'vb'\n | 'xml'\n | 'yaml';\n\n /**\n * 编辑器大小\n */\n size?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';\n\n /**\n * 是否展示全屏模式开关\n */\n allowFullscreen?: boolean;\n}\n\nexport interface EditorProps extends FormControlProps {\n options?: object;\n}\n\nexport default class EditorControl extends React.Component<EditorProps, any> {\n static defaultProps: Partial<EditorProps> = {\n language: 'javascript',\n editorTheme: 'vs',\n allowFullscreen: true,\n options: {\n automaticLayout: true,\n selectOnLineNumbers: true,\n scrollBeyondLastLine: false,\n folding: true,\n minimap: {\n enabled: false\n }\n }\n };\n\n state = {\n focused: false\n };\n editor: any;\n toDispose: Array<Function> = [];\n divRef = React.createRef<HTMLDivElement>();\n constructor(props: EditorProps) {\n super(props);\n\n this.handleFocus = this.handleFocus.bind(this);\n this.handleBlur = this.handleBlur.bind(this);\n this.handleEditorMounted = this.handleEditorMounted.bind(this);\n }\n\n componentWillUnmount() {\n this.toDispose.forEach(fn => fn());\n }\n\n handleFocus() {\n this.setState({\n focused: true\n });\n }\n\n handleBlur() {\n this.setState({\n focused: false\n });\n }\n\n handleEditorMounted(editor: any, monaco: any) {\n this.editor = editor;\n this.toDispose.push(\n editor.onDidChangeModelDecorations(() => {\n this.updateContainerSize(editor, monaco); // typing\n requestAnimationFrame(\n this.updateContainerSize.bind(this, editor, monaco)\n ); // folding\n }).dispose\n );\n this.props.editorDidMount && this.props.editorDidMount(editor, monaco);\n }\n\n prevHeight = 0;\n @autobind\n updateContainerSize(editor: any, monaco: any) {\n if (!this.divRef.current) {\n return;\n }\n\n const lineHeight = editor.getOption(monaco.editor.EditorOption.lineHeight);\n const lineCount = editor.getModel()?.getLineCount() || 1;\n const height = editor.getTopForLineNumber(lineCount + 1) + lineHeight;\n\n if (this.prevHeight !== height) {\n this.prevHeight = height;\n this.divRef.current.style.height = `${height}px`;\n editor.layout();\n }\n }\n\n render() {\n const {\n className,\n classPrefix: ns,\n classnames: cx,\n value,\n onChange,\n disabled,\n options,\n editorTheme,\n size,\n data,\n allowFullscreen\n } = this.props;\n\n let language = this.props.language;\n\n let finnalValue = value;\n\n if (finnalValue && typeof finnalValue !== 'string') {\n finnalValue = JSON.stringify(finnalValue, null, 2);\n }\n\n if (isPureVariable(language)) {\n language = resolveVariableAndFilter(language, data);\n }\n\n return (\n <div\n ref={this.divRef}\n className={cx(\n `EditorControl`,\n {\n 'is-focused': this.state.focused,\n [`EditorControl--${size}`]: size\n },\n className\n )}\n >\n <LazyComponent\n classPrefix={ns}\n component={Editor}\n allowFullscreen={allowFullscreen}\n value={finnalValue}\n onChange={onChange}\n disabled={disabled}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n language={language}\n editorTheme={editorTheme}\n editorDidMount={this.handleEditorMounted}\n options={{\n ...options,\n readOnly: disabled\n }}\n />\n </div>\n );\n }\n}\n\nexport const availableLanguages = [\n 'bat',\n 'c',\n 'coffeescript',\n 'cpp',\n 'csharp',\n 'css',\n 'dockerfile',\n 'fsharp',\n 'go',\n 'handlebars',\n 'html',\n 'ini',\n 'java',\n 'javascript',\n 'json',\n 'less',\n 'lua',\n 'markdown',\n 'msdax',\n 'objective-c',\n 'php',\n 'plaintext',\n 'postiats',\n 'powershell',\n 'pug',\n 'python',\n 'r',\n 'razor',\n 'ruby',\n 'sb',\n 'scss',\n 'sol',\n 'shell',\n 'sql',\n 'swift',\n 'typescript',\n 'vb',\n 'xml',\n 'yaml'\n];\n\nexport const EditorControls: Array<typeof EditorControl> =\n availableLanguages.map((lang: string) => {\n @FormItem({\n type: `${lang}-editor`,\n sizeMutable: false\n })\n class EditorControlRenderer extends EditorControl {\n static lang = lang;\n static displayName = `${lang[0].toUpperCase()}${lang.substring(\n 1\n )}EditorControlRenderer`;\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: lang\n };\n }\n\n return EditorControlRenderer;\n });\n\n@FormItem({\n type: 'js-editor',\n sizeMutable: false\n})\nclass JavascriptEditorControlRenderer extends EditorControl {\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: 'javascript'\n };\n}\n\n@FormItem({\n type: 'ts-editor',\n sizeMutable: false\n})\nclass TypescriptEditorControlRenderer extends EditorControl {\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: 'typescript'\n };\n}\n\n@FormItem({\n type: `editor`,\n sizeMutable: false\n})\nexport class EditorControlRenderer extends EditorControl {\n static defaultProps = {\n ...EditorControl.defaultProps,\n language: 'javascript'\n };\n}\n"
12
12
  ]
13
13
  }
@@ -21,6 +21,10 @@ export interface InputExcelControlSchema extends FormBaseControl {
21
21
  * 是否包含空内容,主要用于二维数组模式
22
22
  */
23
23
  includeEmpty: boolean;
24
+ /**
25
+ * 纯文本模式
26
+ */
27
+ plainText: boolean;
24
28
  }
25
29
  export interface ExcelProps extends FormControlProps, Omit<InputExcelControlSchema, 'type' | 'className' | 'descriptionClassName' | 'inputClassName'> {
26
30
  }
@@ -30,6 +34,7 @@ export interface ExcelControlState {
30
34
  export default class ExcelControl extends React.PureComponent<ExcelProps, ExcelControlState> {
31
35
  static defaultProps: Partial<ExcelProps>;
32
36
  state: ExcelControlState;
37
+ ExcelJS: any;
33
38
  handleDrop(files: File[]): void;
34
39
  /**
35
40
  * 读取单个 sheet 的内容
@@ -31,6 +31,7 @@ var ExcelControl = /** @class */ (function (_super) {
31
31
  return (0, tslib_1.__generator)(this, function (_a) {
32
32
  switch (_a.label) {
33
33
  case 0:
34
+ this.ExcelJS = ExcelJS;
34
35
  workbook = new ExcelJS.Workbook();
35
36
  return [4 /*yield*/, workbook.xlsx.load(reader.result)];
36
37
  case 1:
@@ -62,8 +63,9 @@ var ExcelControl = /** @class */ (function (_super) {
62
63
  * 读取单个 sheet 的内容
63
64
  */
64
65
  ExcelControl.prototype.readWorksheet = function (worksheet) {
66
+ var _this = this;
65
67
  var result = [];
66
- var parseMode = this.props.parseMode;
68
+ var _a = this.props, parseMode = _a.parseMode, plainText = _a.plainText;
67
69
  if (parseMode === 'array') {
68
70
  worksheet.eachRow(function (row, rowNumber) {
69
71
  var values = row.values;
@@ -83,7 +85,25 @@ var ExcelControl = /** @class */ (function (_super) {
83
85
  var data_1 = {};
84
86
  row.eachCell(function (cell, colNumber) {
85
87
  if (firstRowValues_1[colNumber]) {
86
- data_1[firstRowValues_1[colNumber]] = cell.value;
88
+ var value = cell.value;
89
+ if (plainText) {
90
+ var ExcelValueType = _this.ExcelJS.ValueType;
91
+ if (cell.type === ExcelValueType.Hyperlink) {
92
+ value = cell.value.hyperlink;
93
+ }
94
+ else if (cell.type === ExcelValueType.Formula) {
95
+ value = cell.value.result;
96
+ }
97
+ else if (cell.type === ExcelValueType.RichText) {
98
+ value = cell.value.richText
99
+ .map(function (item) { return item.text; })
100
+ .join('');
101
+ }
102
+ else if (cell.type === ExcelValueType.Error) {
103
+ value = '';
104
+ }
105
+ }
106
+ data_1[firstRowValues_1[colNumber]] = value;
87
107
  }
88
108
  });
89
109
  result.push(data_1);
@@ -106,7 +126,8 @@ var ExcelControl = /** @class */ (function (_super) {
106
126
  ExcelControl.defaultProps = {
107
127
  allSheets: false,
108
128
  parseMode: 'object',
109
- includeEmpty: true
129
+ includeEmpty: true,
130
+ plainText: true
110
131
  };
111
132
  (0, tslib_1.__decorate)([
112
133
  helper_1.autobind,
@@ -6,8 +6,8 @@
6
6
  "/src/renderers/Form/InputExcel.tsx"
7
7
  ],
8
8
  "names": [],
9
- "mappings": ";;;;AAAA,6DAAsC;AACtC,+EAAsC;AAEtC,6CAA4C;AAC5C,+BAAmE;AAuCnE;IAA0C,6CAGzC;IAHD;QAAA,qEA2GC;QAlGC,WAAK,GAAsB;YACzB,IAAI,EAAE,KAAK;SACZ,CAAC;;IAgGJ,CAAC;IA7FC,i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C;IAA5C,oBAAoB;QAHhC,IAAA,eAAQ,EAAC;YACR,IAAI,EAAE,aAAa;SACpB,CAAC;OACW,oBAAoB,CAAwB;IAAD,2BAAC;CAAA,AAAzD,CAA0C,YAAY,GAAG;AAA5C,oDAAoB",
10
10
  "sourcesContent": [
11
- "import React, {Suspense} from 'react';\nimport Dropzone from 'react-dropzone';\nimport {FileRejection} from 'react-dropzone';\nimport {autobind} from '../../utils/helper';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\n\n/**\n * Excel 解析\n * 文档:https://baidu.gitee.io/amis/docs/components/form/input-excel\n */\nexport interface InputExcelControlSchema extends FormBaseControl {\n /**\n * 指定为 Excel 解析\n */\n type: 'input-excel';\n\n /**\n * 是否解析所有 sheet,默认情况下只解析第一个\n */\n allSheets: boolean;\n\n /**\n * 解析模式,array 是解析成二维数组,object 是将第一列作为字段名,解析为对象数组\n */\n parseMode: 'array' | 'object';\n\n /**\n * 是否包含空内容,主要用于二维数组模式\n */\n includeEmpty: boolean;\n}\n\nexport interface ExcelProps\n extends FormControlProps,\n Omit<\n InputExcelControlSchema,\n 'type' | 'className' | 'descriptionClassName' | 'inputClassName'\n > {}\n\nexport interface ExcelControlState {\n open: boolean;\n}\n\nexport default class ExcelControl extends React.PureComponent<\n ExcelProps,\n ExcelControlState\n> {\n static defaultProps: Partial<ExcelProps> = {\n allSheets: false,\n parseMode: 'object',\n includeEmpty: true\n };\n state: ExcelControlState = {\n open: false\n };\n\n @autobind\n handleDrop(files: File[]) {\n const {allSheets, onChange} = this.props;\n const excel = files[0];\n const reader = new FileReader();\n reader.readAsArrayBuffer(excel);\n reader.onload = async () => {\n if (reader.result) {\n import('exceljs').then(async (ExcelJS: any) => {\n const workbook = new ExcelJS.Workbook();\n await workbook.xlsx.load(reader.result);\n if (allSheets) {\n const sheetsResult: any[] = [];\n workbook.eachSheet((worksheet: any) => {\n sheetsResult.push({\n sheetName: worksheet.name,\n data: this.readWorksheet(worksheet)\n });\n onChange(sheetsResult);\n });\n } else {\n const worksheet = workbook.worksheets[0];\n onChange(this.readWorksheet(worksheet));\n }\n });\n }\n };\n }\n\n /**\n * 读取单个 sheet 的内容\n */\n readWorksheet(worksheet: any) {\n const result: any[] = [];\n const {parseMode} = this.props;\n\n if (parseMode === 'array') {\n worksheet.eachRow((row: any, rowNumber: number) => {\n const values = row.values;\n values.shift(); // excel 返回的值是从 1 开始的,0 节点永远是 null\n result.push(values);\n });\n return result;\n } else {\n let firstRowValues: any[] = [];\n worksheet.eachRow((row: any, rowNumber: number) => {\n // 将第一列作为字段名\n if (rowNumber == 1) {\n firstRowValues = row.values;\n } else {\n const data: any = {};\n row.eachCell((cell: any, colNumber: any) => {\n if (firstRowValues[colNumber]) {\n data[firstRowValues[colNumber]] = cell.value;\n }\n });\n result.push(data);\n }\n });\n return result;\n }\n }\n\n render() {\n const {\n className,\n classnames: cx,\n classPrefix: ns,\n value,\n disabled,\n translate: __\n } = this.props;\n\n return (\n <div className={cx('ExcelControl', className)}>\n <Dropzone\n key=\"drop-zone\"\n onDrop={this.handleDrop}\n accept=\".xlsx\"\n multiple={false}\n disabled={disabled}\n >\n {({getRootProps, getInputProps}) => (\n <section className={cx('ExcelControl-container', className)}>\n <div {...getRootProps({className: cx('ExcelControl-dropzone')})}>\n <input {...getInputProps()} />\n <p>{__('Excel.placeholder')}</p>\n </div>\n </section>\n )}\n </Dropzone>\n </div>\n );\n }\n}\n\n@FormItem({\n type: 'input-excel'\n})\nexport class ExcelControlRenderer extends ExcelControl {}\n"
11
+ "import React, {Suspense} from 'react';\nimport Dropzone from 'react-dropzone';\nimport {FileRejection} from 'react-dropzone';\nimport {autobind} from '../../utils/helper';\nimport {FormItem, FormControlProps, FormBaseControl} from './Item';\n\n/**\n * Excel 解析\n * 文档:https://baidu.gitee.io/amis/docs/components/form/input-excel\n */\nexport interface InputExcelControlSchema extends FormBaseControl {\n /**\n * 指定为 Excel 解析\n */\n type: 'input-excel';\n\n /**\n * 是否解析所有 sheet,默认情况下只解析第一个\n */\n allSheets: boolean;\n\n /**\n * 解析模式,array 是解析成二维数组,object 是将第一列作为字段名,解析为对象数组\n */\n parseMode: 'array' | 'object';\n\n /**\n * 是否包含空内容,主要用于二维数组模式\n */\n includeEmpty: boolean;\n\n /**\n * 纯文本模式\n */\n plainText: boolean;\n}\n\nexport interface ExcelProps\n extends FormControlProps,\n Omit<\n InputExcelControlSchema,\n 'type' | 'className' | 'descriptionClassName' | 'inputClassName'\n > {}\n\nexport interface ExcelControlState {\n open: boolean;\n}\n\nexport default class ExcelControl extends React.PureComponent<\n ExcelProps,\n ExcelControlState\n> {\n static defaultProps: Partial<ExcelProps> = {\n allSheets: false,\n parseMode: 'object',\n includeEmpty: true,\n plainText: true\n };\n state: ExcelControlState = {\n open: false\n };\n\n ExcelJS: any;\n\n @autobind\n handleDrop(files: File[]) {\n const {allSheets, onChange} = this.props;\n const excel = files[0];\n const reader = new FileReader();\n reader.readAsArrayBuffer(excel);\n reader.onload = async () => {\n if (reader.result) {\n import('exceljs').then(async (ExcelJS: any) => {\n this.ExcelJS = ExcelJS;\n const workbook = new ExcelJS.Workbook();\n await workbook.xlsx.load(reader.result);\n if (allSheets) {\n const sheetsResult: any[] = [];\n workbook.eachSheet((worksheet: any) => {\n sheetsResult.push({\n sheetName: worksheet.name,\n data: this.readWorksheet(worksheet)\n });\n onChange(sheetsResult);\n });\n } else {\n const worksheet = workbook.worksheets[0];\n onChange(this.readWorksheet(worksheet));\n }\n });\n }\n };\n }\n\n /**\n * 读取单个 sheet 的内容\n */\n readWorksheet(worksheet: any) {\n const result: any[] = [];\n const {parseMode, plainText} = this.props;\n\n if (parseMode === 'array') {\n worksheet.eachRow((row: any, rowNumber: number) => {\n const values = row.values;\n values.shift(); // excel 返回的值是从 1 开始的,0 节点永远是 null\n result.push(values);\n });\n return result;\n } else {\n let firstRowValues: any[] = [];\n worksheet.eachRow((row: any, rowNumber: number) => {\n // 将第一列作为字段名\n if (rowNumber == 1) {\n firstRowValues = row.values;\n } else {\n const data: any = {};\n row.eachCell((cell: any, colNumber: any) => {\n if (firstRowValues[colNumber]) {\n let value = cell.value;\n if (plainText) {\n const ExcelValueType = this.ExcelJS.ValueType;\n if (cell.type === ExcelValueType.Hyperlink) {\n value = cell.value.hyperlink;\n } else if (cell.type === ExcelValueType.Formula) {\n value = cell.value.result;\n } else if (cell.type === ExcelValueType.RichText) {\n value = cell.value.richText\n .map((item: any) => item.text)\n .join('');\n } else if (cell.type === ExcelValueType.Error) {\n value = '';\n }\n }\n\n data[firstRowValues[colNumber]] = value;\n }\n });\n result.push(data);\n }\n });\n return result;\n }\n }\n\n render() {\n const {\n className,\n classnames: cx,\n classPrefix: ns,\n value,\n disabled,\n translate: __\n } = this.props;\n\n return (\n <div className={cx('ExcelControl', className)}>\n <Dropzone\n key=\"drop-zone\"\n onDrop={this.handleDrop}\n accept=\".xlsx\"\n multiple={false}\n disabled={disabled}\n >\n {({getRootProps, getInputProps}) => (\n <section className={cx('ExcelControl-container', className)}>\n <div {...getRootProps({className: cx('ExcelControl-dropzone')})}>\n <input {...getInputProps()} />\n <p>{__('Excel.placeholder')}</p>\n </div>\n </section>\n )}\n </Dropzone>\n </div>\n );\n }\n}\n\n@FormItem({\n type: 'input-excel'\n})\nexport class ExcelControlRenderer extends ExcelControl {}\n"
12
12
  ]
13
13
  }
@@ -73,6 +73,14 @@ export interface ImageControlSchema extends FormBaseControl {
73
73
  rotatable?: boolean;
74
74
  scalable?: boolean;
75
75
  };
76
+ /**
77
+ * 裁剪后的图片类型
78
+ */
79
+ cropFormat?: string;
80
+ /**
81
+ * 裁剪后的质量
82
+ */
83
+ cropQuality?: number;
76
84
  /**
77
85
  * 是否允许二次裁剪。
78
86
  */
@@ -397,6 +397,7 @@ var ImageControl = /** @class */ (function (_super) {
397
397
  };
398
398
  ImageControl.prototype.handleCrop = function () {
399
399
  var _this_1 = this;
400
+ var _a = this.props, cropFormat = _a.cropFormat, cropQuality = _a.cropQuality;
400
401
  this.cropper.getCroppedCanvas().toBlob(function (file) {
401
402
  _this_1.addFiles([file]);
402
403
  _this_1.setState({
@@ -404,7 +405,7 @@ var ImageControl = /** @class */ (function (_super) {
404
405
  locked: false,
405
406
  lockedReason: ''
406
407
  });
407
- });
408
+ }, cropFormat || 'image/png', cropQuality || 1);
408
409
  };
409
410
  ImageControl.prototype.cancelCrop = function () {
410
411
  this.setState({