fan-standard-comp 3.1.2 → 3.1.4

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 (244) hide show
  1. package/package.json +1 -1
  2. package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
  3. package/dist/fan-standard-comp.umd.js +0 -597
  4. package/dist/fonts/iconfont.eot +0 -0
  5. package/dist/fonts/iconfont.ttf +0 -0
  6. package/dist/fonts/iconfont.woff +0 -0
  7. package/es/ButtonGroup/ButtonList.d.ts +0 -2
  8. package/es/ButtonGroup/ButtonList.js +0 -37
  9. package/es/ButtonGroup/ButtonMenu.d.ts +0 -2
  10. package/es/ButtonGroup/ButtonMenu.js +0 -38
  11. package/es/ButtonGroup/PopConfirmTitle.d.ts +0 -9
  12. package/es/ButtonGroup/PopConfirmTitle.js +0 -37
  13. package/es/ButtonGroup/index.d.ts +0 -30
  14. package/es/ButtonGroup/index.js +0 -374
  15. package/es/ButtonGroup/style/index.less +0 -36
  16. package/es/DragContent/DragBar.js +0 -21
  17. package/es/DragContent/index.d.ts +0 -14
  18. package/es/DragContent/index.js +0 -173
  19. package/es/DragContent/index.less +0 -44
  20. package/es/FormComp/ChunkUploader/api.js +0 -76
  21. package/es/FormComp/ChunkUploader/index.js +0 -391
  22. package/es/FormComp/ChunkUploader/lib.js +0 -96
  23. package/es/FormComp/ChunkUploader/style/style.less +0 -3
  24. package/es/FormComp/ChunkUploader/upload-queue.class.js +0 -167
  25. package/es/FormComp/ChunkUploader/worker.js +0 -23
  26. package/es/FormComp/EditButton/index.d.ts +0 -26
  27. package/es/FormComp/EditButton/index.js +0 -140
  28. package/es/FormComp/FieldComponent/ReUpload.d.ts +0 -3
  29. package/es/FormComp/FieldComponent/ReUpload.js +0 -131
  30. package/es/FormComp/FieldComponent/RefactorTreeSelect.js +0 -245
  31. package/es/FormComp/FieldComponent/TitleNode.d.ts +0 -6
  32. package/es/FormComp/FieldComponent/TitleNode.js +0 -9
  33. package/es/FormComp/FieldComponent/index.d.ts +0 -38
  34. package/es/FormComp/FieldComponent/index.js +0 -413
  35. package/es/FormComp/FieldComponent/setReadonlyValues.js +0 -236
  36. package/es/FormComp/FieldComponent/style/index.less +0 -116
  37. package/es/FormComp/RenderItemGroup/index.d.ts +0 -37
  38. package/es/FormComp/RenderItemGroup/index.js +0 -234
  39. package/es/FormComp/Uploader/index.d.ts +0 -19
  40. package/es/FormComp/Uploader/index.js +0 -275
  41. package/es/FormComp/Uploader/style/index.less +0 -14
  42. package/es/FormComp/Uploader/util.d.ts +0 -8
  43. package/es/FormComp/Uploader/util.js +0 -38
  44. package/es/FormComp/VarTemplate/index.js +0 -293
  45. package/es/FormComp/index.d.ts +0 -1
  46. package/es/FormComp/index.js +0 -1
  47. package/es/NavLeafScroll/index.js +0 -379
  48. package/es/NavLeafScroll/style/index.less +0 -119
  49. package/es/RefactorTree/data.d.ts +0 -7
  50. package/es/RefactorTree/index.d.ts +0 -40
  51. package/es/RefactorTree/index.js +0 -167
  52. package/es/RefactorTree/indexTreeNode.d.ts +0 -39
  53. package/es/RefactorTree/indexTreeNode.js +0 -237
  54. package/es/RefactorTree/style/index.d.ts +0 -1
  55. package/es/RefactorTree/style/index.js +0 -1
  56. package/es/RefactorTree/style/index.less +0 -22
  57. package/es/RefactorTree/util.d.ts +0 -42
  58. package/es/RefactorTree/util.js +0 -187
  59. package/es/SpecIcon/fonts/demo.css +0 -539
  60. package/es/SpecIcon/fonts/demo_index.html +0 -1315
  61. package/es/SpecIcon/fonts/iconfont.css +0 -211
  62. package/es/SpecIcon/fonts/iconfont.eot +0 -0
  63. package/es/SpecIcon/fonts/iconfont.js +0 -41
  64. package/es/SpecIcon/fonts/iconfont.json +0 -352
  65. package/es/SpecIcon/fonts/iconfont.svg +0 -173
  66. package/es/SpecIcon/fonts/iconfont.ttf +0 -0
  67. package/es/SpecIcon/fonts/iconfont.woff +0 -0
  68. package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
  69. package/es/SpecIcon/index.d.ts +0 -17
  70. package/es/SpecIcon/index.js +0 -77
  71. package/es/SpecIcon/style/iconfont.less +0 -213
  72. package/es/SpecIcon/style/index.less +0 -98
  73. package/es/SplitterLayout/Pane.d.ts +0 -13
  74. package/es/SplitterLayout/Pane.js +0 -36
  75. package/es/SplitterLayout/index.js +0 -375
  76. package/es/SplitterLayout/index.less +0 -58
  77. package/es/StandardContent/SplitterLayout/Pane.js +0 -50
  78. package/es/StandardContent/SplitterLayout/index.js +0 -374
  79. package/es/StandardContent/SplitterLayout/index.less +0 -58
  80. package/es/StandardContent/SubfieldContent.d.ts +0 -17
  81. package/es/StandardContent/SubfieldContent.js +0 -41
  82. package/es/StandardContent/WrapperContent.d.ts +0 -13
  83. package/es/StandardContent/WrapperContent.js +0 -29
  84. package/es/StandardContent/data.d.ts +0 -101
  85. package/es/StandardContent/style/index.less +0 -80
  86. package/es/StandardDragModal/index.d.ts +0 -11
  87. package/es/StandardDragModal/index.js +0 -30
  88. package/es/StandardFilter/index.d.ts +0 -35
  89. package/es/StandardFilter/index.js +0 -253
  90. package/es/StandardFilter/style/index.less +0 -62
  91. package/es/StandardForm/ActionList.js +0 -44
  92. package/es/StandardForm/StepForm.d.ts +0 -19
  93. package/es/StandardForm/StepForm.js +0 -267
  94. package/es/StandardForm/TabForm.d.ts +0 -19
  95. package/es/StandardForm/TabForm.js +0 -122
  96. package/es/StandardForm/index.d.ts +0 -32
  97. package/es/StandardForm/index.js +0 -170
  98. package/es/StandardForm/style/index.less +0 -58
  99. package/es/StandardModal/UpdateFormRef.js +0 -18
  100. package/es/StandardModal/index.d.ts +0 -44
  101. package/es/StandardModal/index.js +0 -495
  102. package/es/StandardModal/style/index.less +0 -50
  103. package/es/StandardPanel/index.d.ts +0 -28
  104. package/es/StandardPanel/index.js +0 -134
  105. package/es/StandardPanel/style/index.less +0 -135
  106. package/es/StandardTable/index.d.ts +0 -22
  107. package/es/StandardTable/index.js +0 -126
  108. package/es/StandardTable/style/index.d.ts +0 -1
  109. package/es/StandardTable/style/index.js +0 -1
  110. package/es/StandardTable/style/index.less +0 -206
  111. package/es/components/IconNode/index.d.ts +0 -16
  112. package/es/components/IconNode/index.js +0 -28
  113. package/es/components/index.d.ts +0 -2
  114. package/es/components/index.js +0 -2
  115. package/es/data/func.code.js +0 -112
  116. package/es/data/general.config.js +0 -172
  117. package/es/data/index.js +0 -3
  118. package/es/index.d.ts +0 -24
  119. package/es/index.js +0 -31
  120. package/es/styles/index.less +0 -0
  121. package/es/theme/spec-variable.less +0 -48
  122. package/es/utils/ValueFormat.js +0 -50
  123. package/es/utils/filterPermission.js +0 -111
  124. package/es/utils/getParentNodes.js +0 -215
  125. package/es/utils/index.js +0 -3
  126. package/lib/ButtonGroup/ButtonList.d.ts +0 -2
  127. package/lib/ButtonGroup/ButtonList.js +0 -55
  128. package/lib/ButtonGroup/ButtonMenu.d.ts +0 -2
  129. package/lib/ButtonGroup/ButtonMenu.js +0 -51
  130. package/lib/ButtonGroup/PopConfirmTitle.d.ts +0 -9
  131. package/lib/ButtonGroup/PopConfirmTitle.js +0 -48
  132. package/lib/ButtonGroup/index.d.ts +0 -30
  133. package/lib/ButtonGroup/index.js +0 -405
  134. package/lib/ButtonGroup/style/index.less +0 -36
  135. package/lib/DragContent/DragBar.js +0 -33
  136. package/lib/DragContent/index.d.ts +0 -14
  137. package/lib/DragContent/index.js +0 -191
  138. package/lib/DragContent/index.less +0 -44
  139. package/lib/FormComp/ChunkUploader/api.js +0 -89
  140. package/lib/FormComp/ChunkUploader/index.js +0 -410
  141. package/lib/FormComp/ChunkUploader/lib.js +0 -113
  142. package/lib/FormComp/ChunkUploader/style/style.less +0 -3
  143. package/lib/FormComp/ChunkUploader/upload-queue.class.js +0 -174
  144. package/lib/FormComp/ChunkUploader/worker.js +0 -28
  145. package/lib/FormComp/EditButton/index.d.ts +0 -26
  146. package/lib/FormComp/EditButton/index.js +0 -159
  147. package/lib/FormComp/FieldComponent/ReUpload.d.ts +0 -3
  148. package/lib/FormComp/FieldComponent/ReUpload.js +0 -151
  149. package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +0 -268
  150. package/lib/FormComp/FieldComponent/TitleNode.d.ts +0 -6
  151. package/lib/FormComp/FieldComponent/TitleNode.js +0 -19
  152. package/lib/FormComp/FieldComponent/index.d.ts +0 -38
  153. package/lib/FormComp/FieldComponent/index.js +0 -457
  154. package/lib/FormComp/FieldComponent/setReadonlyValues.js +0 -263
  155. package/lib/FormComp/FieldComponent/style/index.less +0 -116
  156. package/lib/FormComp/RenderItemGroup/index.d.ts +0 -37
  157. package/lib/FormComp/RenderItemGroup/index.js +0 -255
  158. package/lib/FormComp/Uploader/index.d.ts +0 -19
  159. package/lib/FormComp/Uploader/index.js +0 -301
  160. package/lib/FormComp/Uploader/style/index.less +0 -14
  161. package/lib/FormComp/Uploader/util.d.ts +0 -8
  162. package/lib/FormComp/Uploader/util.js +0 -47
  163. package/lib/FormComp/VarTemplate/index.js +0 -308
  164. package/lib/FormComp/index.d.ts +0 -1
  165. package/lib/FormComp/index.js +0 -15
  166. package/lib/NavLeafScroll/index.js +0 -397
  167. package/lib/NavLeafScroll/style/index.less +0 -119
  168. package/lib/RefactorTree/data.d.ts +0 -7
  169. package/lib/RefactorTree/index.d.ts +0 -40
  170. package/lib/RefactorTree/index.js +0 -190
  171. package/lib/RefactorTree/indexTreeNode.d.ts +0 -39
  172. package/lib/RefactorTree/indexTreeNode.js +0 -260
  173. package/lib/RefactorTree/style/index.d.ts +0 -1
  174. package/lib/RefactorTree/style/index.js +0 -3
  175. package/lib/RefactorTree/style/index.less +0 -22
  176. package/lib/RefactorTree/util.d.ts +0 -42
  177. package/lib/RefactorTree/util.js +0 -195
  178. package/lib/SpecIcon/fonts/demo.css +0 -539
  179. package/lib/SpecIcon/fonts/demo_index.html +0 -1315
  180. package/lib/SpecIcon/fonts/iconfont.css +0 -211
  181. package/lib/SpecIcon/fonts/iconfont.eot +0 -0
  182. package/lib/SpecIcon/fonts/iconfont.js +0 -43
  183. package/lib/SpecIcon/fonts/iconfont.json +0 -352
  184. package/lib/SpecIcon/fonts/iconfont.svg +0 -173
  185. package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
  186. package/lib/SpecIcon/fonts/iconfont.woff +0 -0
  187. package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
  188. package/lib/SpecIcon/index.d.ts +0 -17
  189. package/lib/SpecIcon/index.js +0 -90
  190. package/lib/SpecIcon/style/iconfont.less +0 -213
  191. package/lib/SpecIcon/style/index.less +0 -98
  192. package/lib/SplitterLayout/Pane.d.ts +0 -13
  193. package/lib/SplitterLayout/Pane.js +0 -48
  194. package/lib/SplitterLayout/index.js +0 -386
  195. package/lib/SplitterLayout/index.less +0 -58
  196. package/lib/StandardContent/SplitterLayout/Pane.js +0 -62
  197. package/lib/StandardContent/SplitterLayout/index.js +0 -387
  198. package/lib/StandardContent/SplitterLayout/index.less +0 -58
  199. package/lib/StandardContent/SubfieldContent.d.ts +0 -17
  200. package/lib/StandardContent/SubfieldContent.js +0 -56
  201. package/lib/StandardContent/WrapperContent.d.ts +0 -13
  202. package/lib/StandardContent/WrapperContent.js +0 -43
  203. package/lib/StandardContent/data.d.ts +0 -101
  204. package/lib/StandardContent/style/index.less +0 -80
  205. package/lib/StandardDragModal/index.d.ts +0 -11
  206. package/lib/StandardDragModal/index.js +0 -43
  207. package/lib/StandardFilter/index.d.ts +0 -35
  208. package/lib/StandardFilter/index.js +0 -272
  209. package/lib/StandardFilter/style/index.less +0 -62
  210. package/lib/StandardForm/ActionList.js +0 -57
  211. package/lib/StandardForm/StepForm.d.ts +0 -19
  212. package/lib/StandardForm/StepForm.js +0 -295
  213. package/lib/StandardForm/TabForm.d.ts +0 -19
  214. package/lib/StandardForm/TabForm.js +0 -148
  215. package/lib/StandardForm/index.d.ts +0 -32
  216. package/lib/StandardForm/index.js +0 -197
  217. package/lib/StandardForm/style/index.less +0 -58
  218. package/lib/StandardModal/UpdateFormRef.js +0 -32
  219. package/lib/StandardModal/index.d.ts +0 -44
  220. package/lib/StandardModal/index.js +0 -525
  221. package/lib/StandardModal/style/index.less +0 -50
  222. package/lib/StandardPanel/index.d.ts +0 -28
  223. package/lib/StandardPanel/index.js +0 -155
  224. package/lib/StandardPanel/style/index.less +0 -135
  225. package/lib/StandardTable/index.d.ts +0 -22
  226. package/lib/StandardTable/index.js +0 -143
  227. package/lib/StandardTable/style/index.d.ts +0 -1
  228. package/lib/StandardTable/style/index.js +0 -3
  229. package/lib/StandardTable/style/index.less +0 -206
  230. package/lib/components/IconNode/index.d.ts +0 -16
  231. package/lib/components/IconNode/index.js +0 -39
  232. package/lib/components/index.d.ts +0 -2
  233. package/lib/components/index.js +0 -15
  234. package/lib/data/func.code.js +0 -119
  235. package/lib/data/general.config.js +0 -179
  236. package/lib/data/index.js +0 -23
  237. package/lib/index.d.ts +0 -24
  238. package/lib/index.js +0 -236
  239. package/lib/styles/index.less +0 -0
  240. package/lib/theme/spec-variable.less +0 -48
  241. package/lib/utils/ValueFormat.js +0 -58
  242. package/lib/utils/filterPermission.js +0 -127
  243. package/lib/utils/getParentNodes.js +0 -226
  244. package/lib/utils/index.js +0 -35
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- interface UploaderProps {
3
- extraExt?: string;
4
- accept?: string;
5
- fileList?: any[];
6
- fileType?: string;
7
- className?: string;
8
- isOnly?: boolean;
9
- children?: React.ReactNode;
10
- onChange?: (file?: any) => void;
11
- value?: any;
12
- size?: number;
13
- modalSize?: string;
14
- onPreview?: (file?: any) => any;
15
- beforeUpload?: (file: any, fileList: any) => any;
16
- limit?: number;
17
- }
18
- declare const Uploader: React.ForwardRefExoticComponent<UploaderProps & React.RefAttributes<unknown>>;
19
- export default Uploader;
@@ -1,301 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- require("antd/es/upload/style");
11
-
12
- var _upload = _interopRequireDefault(require("antd/es/upload"));
13
-
14
- require("antd/es/button/style");
15
-
16
- var _button = _interopRequireDefault(require("antd/es/button"));
17
-
18
- require("antd/es/message/style");
19
-
20
- var _message2 = _interopRequireDefault(require("antd/es/message"));
21
-
22
- var _tslib = require("tslib");
23
-
24
- var _react = _interopRequireWildcard(require("react"));
25
-
26
- var _icons = require("@ant-design/icons");
27
-
28
- var _util = require("./util");
29
-
30
- var _StandardModal = _interopRequireDefault(require("../../StandardModal"));
31
-
32
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
33
-
34
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
-
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
39
-
40
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
41
-
42
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
43
-
44
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
45
-
46
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
47
-
48
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
49
-
50
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
51
-
52
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
53
-
54
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
55
-
56
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
57
-
58
- var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
59
- var accept = props.accept,
60
- extraExt = props.extraExt,
61
- fileType = props.fileType,
62
- className = props.className,
63
- isOnly = props.isOnly,
64
- children = props.children,
65
- onChange = props.onChange,
66
- value = props.value,
67
- _props$size = props.size,
68
- size = _props$size === void 0 ? 2 * 1024 * 1024 : _props$size,
69
- _props$modalSize = props.modalSize,
70
- modalSize = _props$modalSize === void 0 ? 'md' : _props$modalSize,
71
- onPreview = props.onPreview,
72
- beforeUpload = props.beforeUpload,
73
- limit = props.limit; // 图片预览数据
74
-
75
- var _useState = (0, _react.useState)({
76
- visible: false,
77
- url: ''
78
- }),
79
- _useState2 = _slicedToArray(_useState, 2),
80
- showConfig = _useState2[0],
81
- setShowConfig = _useState2[1]; // 用于展示的缩略图
82
-
83
-
84
- var _useState3 = (0, _react.useState)([]),
85
- _useState4 = _slicedToArray(_useState3, 2),
86
- fileList = _useState4[0],
87
- setFileList = _useState4[1];
88
-
89
- (0, _react.useEffect)(function () {
90
- if (!value) {
91
- setFileList([]);
92
- return;
93
- }
94
-
95
- var S4 = function S4() {
96
- return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
97
- };
98
-
99
- if (Object.prototype.toString.call(value) === '[object Array]') {
100
- setFileList(value.map(function (file, index) {
101
- file.uid = file.uid || "".concat(S4(), "-").concat(S4());
102
- file.url = file.downloadUrl || file.url;
103
- file.status = 'done';
104
- return file;
105
- }));
106
- return;
107
- }
108
-
109
- if (Object.prototype.toString.call(value) === '[object Object]') {
110
- setFileList([Object.assign({
111
- uid: "".concat(S4(), "-").concat(S4()),
112
- url: value.downloadUrl || value.url,
113
- status: 'done'
114
- }, value)]);
115
- return;
116
- }
117
-
118
- if (Object.prototype.toString.call(value) === '[object String]') {
119
- setFileList([{
120
- uid: "".concat(S4(), "-").concat(S4()),
121
- url: value,
122
- name: '附件',
123
- status: 'done'
124
- }]);
125
- return;
126
- }
127
- }, [value]);
128
- var splitAccept = (0, _react.useMemo)(function () {
129
- var res = (0, _util.getAccept)(fileType);
130
-
131
- if (extraExt) {
132
- res = res + ',' + extraExt;
133
- }
134
-
135
- if (accept) {
136
- res = res + ',' + accept;
137
- }
138
-
139
- return res;
140
- }, [fileType, extraExt]); // 点击文件链接或预览图标时的回调
141
-
142
- var handlePreview = (0, _react.useCallback)(function (file) {
143
- return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
144
- var res;
145
- return regeneratorRuntime.wrap(function _callee$(_context) {
146
- while (1) {
147
- switch (_context.prev = _context.next) {
148
- case 0:
149
- if (!(!file.url && !file.preview)) {
150
- _context.next = 5;
151
- break;
152
- }
153
-
154
- _context.next = 3;
155
- return (0, _util.getBase64)(file.originFileObj);
156
-
157
- case 3:
158
- res = _context.sent;
159
-
160
- if (res && res.status === 'success') {
161
- file.preview = res.url;
162
- }
163
-
164
- case 5:
165
- setShowConfig({
166
- visible: true,
167
- url: file.url || file.preview
168
- });
169
-
170
- case 6:
171
- case "end":
172
- return _context.stop();
173
- }
174
- }
175
- }, _callee);
176
- }));
177
- }, [setShowConfig]); // 检查文件是否规范
178
-
179
- var handleCheck = (0, _react.useCallback)(function (file) {
180
- var isLtSize = file.size < size;
181
-
182
- if (!isLtSize) {
183
- _message2.default.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(Math.round(size / 1024 / 1024 * 100) / 100, "MB!"));
184
-
185
- return false;
186
- }
187
-
188
- return true;
189
- }, [fileType, size]);
190
- var handleChange = (0, _react.useCallback)(function (res) {
191
- return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
192
- var isOk, result, list;
193
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
194
- while (1) {
195
- switch (_context2.prev = _context2.next) {
196
- case 0:
197
- if (!(res.file.status === 'removed')) {
198
- _context2.next = 4;
199
- break;
200
- }
201
-
202
- setFileList(res.fileList);
203
- onChange && onChange(isOnly ? res.fileList[0] && res.fileList[0].originFileObj : res.fileList);
204
- return _context2.abrupt("return");
205
-
206
- case 4:
207
- isOk = handleCheck(res.file);
208
-
209
- if (isOk) {
210
- list = res.fileList.map(function (file) {
211
- if (!file.url) {
212
- file.url = file.thumbUrl;
213
- }
214
-
215
- return file;
216
- });
217
- result = _toConsumableArray(list);
218
- setFileList(list);
219
- onChange && onChange(isOnly ? result[0] && result[0].originFileObj : result);
220
- }
221
-
222
- case 6:
223
- case "end":
224
- return _context2.stop();
225
- }
226
- }
227
- }, _callee2);
228
- }));
229
- }, [isOnly, handleCheck]); // 渲染预览窗口
230
-
231
- var renderPreviewComponent = (0, _react.useMemo)(function () {
232
- if (fileType === 'image' || fileType === 'svg') {
233
- var visible = showConfig.visible,
234
- url = showConfig.url;
235
- return /*#__PURE__*/_react.default.createElement(_StandardModal.default, {
236
- visible: visible,
237
- hideFooter: true,
238
- onCancel: function onCancel() {
239
- return setShowConfig({
240
- visible: false,
241
- url: ''
242
- });
243
- },
244
- size: modalSize
245
- }, /*#__PURE__*/_react.default.createElement("div", {
246
- style: {
247
- textAlign: 'center'
248
- }
249
- }, /*#__PURE__*/_react.default.createElement("img", {
250
- style: {
251
- maxWidth: '100%'
252
- },
253
- src: url,
254
- alt: ""
255
- })));
256
- }
257
-
258
- return null;
259
- }, [fileType, showConfig]);
260
- var renderChildrenComponent = (0, _react.useMemo)(function () {
261
- var renderButton = function renderButton() {
262
- if (fileType === 'image' || fileType === 'svg') {
263
- return /*#__PURE__*/_react.default.createElement("div", {
264
- className: 'spec-uploader-control'
265
- }, /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null), /*#__PURE__*/_react.default.createElement("div", {
266
- className: "ant-upload-text"
267
- }, "\u70B9\u51FB\u9009\u62E9"));
268
- }
269
-
270
- return /*#__PURE__*/_react.default.createElement(_button.default, {
271
- className: 'spec-uploader-button'
272
- }, /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null), "\u70B9\u51FB\u9009\u62E9");
273
- };
274
-
275
- if (children) {
276
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", children, " ");
277
- }
278
-
279
- if (isOnly && fileList.length === 1 || limit && fileList.length === limit) {
280
- return null;
281
- }
282
-
283
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderButton());
284
- }, [fileType, isOnly, children, fileList, limit]);
285
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_upload.default, Object.assign({}, props, {
286
- ref: ref,
287
- accept: splitAccept,
288
- fileList: fileList,
289
- listType: fileType === 'image' || fileType === 'svg' ? 'picture-card' : 'text',
290
- className: "spec-uploader ".concat(className),
291
- onPreview: onPreview ? onPreview : fileType === 'image' || fileType === 'svg' ? handlePreview : function () {},
292
- beforeUpload: beforeUpload ? beforeUpload : function () {
293
- return false;
294
- },
295
- onChange: handleChange
296
- }), renderChildrenComponent), renderPreviewComponent);
297
- }); // as IUploader
298
-
299
-
300
- var _default = Uploader;
301
- exports.default = _default;
@@ -1,14 +0,0 @@
1
- @root-entry-name: default;
2
- @import (reference) '~antd/es/style/themes/index';
3
- .spec-uploader {
4
-
5
- }
6
-
7
- .ant-form-item-has-error {
8
- .spec-uploader {
9
- .ant-upload-list .ant-upload-list-picture-card,
10
- .ant-upload-list-picture .ant-upload-list-item, .ant-upload-list-picture-card .ant-upload-list-item {
11
- border-color: @error-color;
12
- }
13
- }
14
- }
@@ -1,8 +0,0 @@
1
- interface baseResolveProps {
2
- status?: string;
3
- url?: any;
4
- error?: any;
5
- }
6
- export declare function getBase64(file: any): Promise<baseResolveProps>;
7
- export declare function getAccept(fileType: string): ".jpg,.png" | ".svg" | ".doc,.docx,.pdf,.xls,.xlsx" | ".rar,.zip" | ".rar,.zip,.doc,.docx,.pdf,.jpg,.png";
8
- export {};
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getBase64 = getBase64;
7
- exports.getAccept = getAccept;
8
-
9
- function getBase64(file) {
10
- return new Promise(function (resolve) {
11
- var reader = new FileReader();
12
- reader.readAsDataURL(file);
13
-
14
- reader.onload = function () {
15
- return resolve({
16
- status: 'success',
17
- url: reader.result
18
- });
19
- };
20
-
21
- reader.onerror = function (error) {
22
- return resolve({
23
- status: 'error',
24
- error: error
25
- });
26
- };
27
- });
28
- }
29
-
30
- function getAccept(fileType) {
31
- switch (fileType) {
32
- case 'image':
33
- return '.jpg,.png';
34
-
35
- case 'svg':
36
- return '.svg';
37
-
38
- case 'office':
39
- return '.doc,.docx,.pdf,.xls,.xlsx';
40
-
41
- case 'zip':
42
- return '.rar,.zip';
43
-
44
- default:
45
- return '.rar,.zip,.doc,.docx,.pdf,.jpg,.png';
46
- }
47
- }