assui 2.3.9 → 3.0.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 (168) hide show
  1. package/es/a-select/index.js +7 -22
  2. package/es/a-select/style/index.css +195 -743
  3. package/es/area-text/index.js +1 -3
  4. package/es/button-drawer/index.js +12 -30
  5. package/es/button-modal/index.js +12 -33
  6. package/es/color-select/index.js +10 -23
  7. package/es/color-select/style/index.css +195 -743
  8. package/es/condition-input/index.js +8 -26
  9. package/es/condition-input/parse2RegexOption.js +0 -11
  10. package/es/config-provider/index.js +1 -3
  11. package/es/copy-to-clipboard/index.js +11 -27
  12. package/es/copy-to-clipboard/style/index.css +0 -1
  13. package/es/highlight-textarea/HighlighedContents.js +1 -3
  14. package/es/highlight-textarea/extractSpansOfClasses.d.ts +1 -0
  15. package/es/highlight-textarea/extractSpansOfClasses.js +7 -29
  16. package/es/highlight-textarea/getRanges.js +3 -35
  17. package/es/highlight-textarea/getType.js +0 -6
  18. package/es/highlight-textarea/index.js +11 -30
  19. package/es/highlight-textarea/style/index.css +7 -21
  20. package/es/img-crop/EasyCrop.js +18 -34
  21. package/es/img-crop/getCroppedImg.js +15 -50
  22. package/es/img-crop/index.js +56 -145
  23. package/es/img-crop/style/index.css +195 -743
  24. package/es/json-editor/index.js +6 -20
  25. package/es/keep-tab/index.d.ts +7 -4
  26. package/es/keep-tab/index.js +34 -59
  27. package/es/keep-tab/style/index.css +39 -99
  28. package/es/label-auto-complete/index.js +14 -32
  29. package/es/label-auto-complete/style/index.css +195 -743
  30. package/es/label-condition-input/index.js +13 -29
  31. package/es/label-customize-range-picker/defaultRadioList.js +0 -3
  32. package/es/label-customize-range-picker/index.js +36 -78
  33. package/es/label-customize-range-picker/style/index.css +195 -743
  34. package/es/label-customize-range-picker/utils/index.js +5 -14
  35. package/es/label-date-picker/index.js +11 -28
  36. package/es/label-date-picker/style/index.css +195 -743
  37. package/es/label-input/index.js +23 -37
  38. package/es/label-number-input/index.js +13 -28
  39. package/es/label-range-picker/index.js +11 -28
  40. package/es/label-range-picker/style/index.css +195 -743
  41. package/es/label-select/index.js +11 -27
  42. package/es/label-select/style/index.css +195 -743
  43. package/es/label-text-area/index.js +13 -35
  44. package/es/label-tree-select/index.js +15 -32
  45. package/es/label-tree-select/style/index.css +195 -743
  46. package/es/number-format-input/index.js +1 -11
  47. package/es/number-input/index.js +18 -37
  48. package/es/number-input/utils.js +7 -15
  49. package/es/rc-echart/core.js +15 -27
  50. package/es/rc-echart/index.js +0 -6
  51. package/es/rc-qrcode/index.js +2 -12
  52. package/es/rc-qrcode/useQrcode.js +5 -12
  53. package/es/rich-text-editor/index.js +5 -16
  54. package/es/rich-text-editor/plugins/code/index.js +0 -8
  55. package/es/rich-text-editor/style/index.css +195 -743
  56. package/es/single-img-upload/index.js +36 -110
  57. package/es/single-img-upload/style/index.css +195 -743
  58. package/es/split-pane/index.js +0 -4
  59. package/es/step-number-input/index.js +14 -39
  60. package/es/step-number-input/style/index.css +195 -743
  61. package/es/table-col/index.js +2 -4
  62. package/es/text-area/index.js +8 -27
  63. package/es/text-input/index.js +4 -18
  64. package/es/text-input/style/index.css +7 -21
  65. package/lib/a-select/index.js +7 -27
  66. package/lib/a-select/style/index.css +195 -743
  67. package/lib/a-select/style/index.js +0 -2
  68. package/lib/area-text/index.js +1 -6
  69. package/lib/area-text/style/index.js +0 -1
  70. package/lib/beautiful-dnd/index.js +0 -9
  71. package/lib/button-drawer/index.js +12 -42
  72. package/lib/button-drawer/style/index.js +0 -1
  73. package/lib/button-modal/index.js +12 -44
  74. package/lib/button-modal/style/index.js +0 -1
  75. package/lib/color-select/index.js +10 -39
  76. package/lib/color-select/style/index.css +195 -743
  77. package/lib/color-select/style/index.js +0 -2
  78. package/lib/condition-input/index.js +8 -41
  79. package/lib/condition-input/parse2RegexOption.js +0 -16
  80. package/lib/condition-input/style/index.js +0 -1
  81. package/lib/config-provider/context.js +0 -4
  82. package/lib/config-provider/index.js +1 -28
  83. package/lib/copy-to-clipboard/index.js +11 -38
  84. package/lib/copy-to-clipboard/style/index.css +0 -1
  85. package/lib/copy-to-clipboard/style/index.js +0 -1
  86. package/lib/highlight-textarea/HighlighedContents.js +1 -7
  87. package/lib/highlight-textarea/extractSpansOfClasses.d.ts +1 -0
  88. package/lib/highlight-textarea/extractSpansOfClasses.js +7 -31
  89. package/lib/highlight-textarea/getRanges.js +3 -38
  90. package/lib/highlight-textarea/getType.js +0 -8
  91. package/lib/highlight-textarea/index.js +11 -44
  92. package/lib/highlight-textarea/style/index.css +7 -21
  93. package/lib/highlight-textarea/style/index.js +0 -1
  94. package/lib/highlight-words/index.js +0 -3
  95. package/lib/img-crop/EasyCrop.js +18 -44
  96. package/lib/img-crop/getCroppedImg.js +15 -51
  97. package/lib/img-crop/index.js +56 -159
  98. package/lib/img-crop/style/index.css +195 -743
  99. package/lib/img-crop/style/index.js +0 -3
  100. package/lib/index.js +0 -77
  101. package/lib/json-editor/index.js +6 -35
  102. package/lib/json-editor/style/index.js +0 -2
  103. package/lib/keep-tab/index.d.ts +7 -4
  104. package/lib/keep-tab/index.js +34 -76
  105. package/lib/keep-tab/style/index.css +39 -99
  106. package/lib/keep-tab/style/index.js +0 -2
  107. package/lib/label-auto-complete/index.js +14 -39
  108. package/lib/label-auto-complete/style/index.css +195 -743
  109. package/lib/label-auto-complete/style/index.js +0 -2
  110. package/lib/label-condition-input/index.js +13 -36
  111. package/lib/label-condition-input/style/index.js +0 -1
  112. package/lib/label-customize-range-picker/defaultRadioList.js +0 -7
  113. package/lib/label-customize-range-picker/index.js +36 -99
  114. package/lib/label-customize-range-picker/style/index.css +195 -743
  115. package/lib/label-customize-range-picker/style/index.js +0 -5
  116. package/lib/label-customize-range-picker/utils/index.js +5 -19
  117. package/lib/label-date-picker/index.js +11 -34
  118. package/lib/label-date-picker/style/index.css +195 -743
  119. package/lib/label-date-picker/style/index.js +0 -2
  120. package/lib/label-input/index.js +23 -46
  121. package/lib/label-input/style/index.js +0 -1
  122. package/lib/label-number-input/index.js +13 -36
  123. package/lib/label-number-input/style/index.js +0 -1
  124. package/lib/label-range-picker/index.js +11 -36
  125. package/lib/label-range-picker/style/index.css +195 -743
  126. package/lib/label-range-picker/style/index.js +0 -2
  127. package/lib/label-select/index.js +11 -36
  128. package/lib/label-select/style/index.css +195 -743
  129. package/lib/label-select/style/index.js +0 -2
  130. package/lib/label-text-area/index.js +13 -40
  131. package/lib/label-text-area/style/index.js +0 -1
  132. package/lib/label-tree-select/index.js +15 -38
  133. package/lib/label-tree-select/style/index.css +195 -743
  134. package/lib/label-tree-select/style/index.js +0 -2
  135. package/lib/messages/index.js +0 -2
  136. package/lib/number-format-input/index.js +1 -15
  137. package/lib/number-format-input/style/index.js +0 -1
  138. package/lib/number-input/index.js +18 -55
  139. package/lib/number-input/style/index.js +0 -1
  140. package/lib/number-input/utils.js +8 -20
  141. package/lib/rc-echart/core.js +15 -40
  142. package/lib/rc-echart/index.js +0 -17
  143. package/lib/rc-motion/index.js +0 -3
  144. package/lib/rc-qrcode/index.js +2 -25
  145. package/lib/rc-qrcode/useQrcode.js +5 -17
  146. package/lib/rc-transition-group/index.js +0 -9
  147. package/lib/resizable/index.js +0 -2
  148. package/lib/resizable/style/index.js +0 -1
  149. package/lib/rich-text-editor/index.js +5 -53
  150. package/lib/rich-text-editor/plugins/code/index.js +2 -12
  151. package/lib/rich-text-editor/style/index.css +195 -743
  152. package/lib/rich-text-editor/style/index.js +0 -1
  153. package/lib/single-img-upload/index.js +36 -125
  154. package/lib/single-img-upload/style/index.css +195 -743
  155. package/lib/single-img-upload/style/index.js +0 -3
  156. package/lib/sortable-hoc/index.js +0 -9
  157. package/lib/split-pane/index.js +0 -15
  158. package/lib/split-pane/style/index.js +0 -1
  159. package/lib/step-number-input/index.js +14 -55
  160. package/lib/step-number-input/style/index.css +195 -743
  161. package/lib/step-number-input/style/index.js +0 -2
  162. package/lib/table-col/index.js +2 -6
  163. package/lib/text-area/index.js +8 -38
  164. package/lib/text-area/style/index.js +0 -1
  165. package/lib/text-input/index.js +4 -23
  166. package/lib/text-input/style/index.css +7 -21
  167. package/lib/text-input/style/index.js +0 -1
  168. package/package.json +6 -6
@@ -4,22 +4,17 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) {
9
8
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
10
9
  }
11
10
  }
12
-
13
11
  return t;
14
12
  };
15
-
16
13
  return __assign.apply(this, arguments);
17
14
  };
18
-
19
15
  var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
20
16
  if (k2 === undefined) k2 = k;
21
17
  var desc = Object.getOwnPropertyDescriptor(m, k);
22
-
23
18
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
19
  desc = {
25
20
  enumerable: true,
@@ -28,13 +23,11 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
28
23
  }
29
24
  };
30
25
  }
31
-
32
26
  Object.defineProperty(o, k2, desc);
33
27
  } : function (o, m, k, k2) {
34
28
  if (k2 === undefined) k2 = k;
35
29
  o[k2] = m[k];
36
30
  });
37
-
38
31
  var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
39
32
  Object.defineProperty(o, "default", {
40
33
  enumerable: true,
@@ -43,26 +36,21 @@ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? fun
43
36
  } : function (o, v) {
44
37
  o["default"] = v;
45
38
  });
46
-
47
39
  var __importStar = this && this.__importStar || function (mod) {
48
40
  if (mod && mod.__esModule) return mod;
49
41
  var result = {};
50
42
  if (mod != null) for (var k in mod) {
51
43
  if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
52
44
  }
53
-
54
45
  __setModuleDefault(result, mod);
55
-
56
46
  return result;
57
47
  };
58
-
59
48
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
60
49
  function adopt(value) {
61
50
  return value instanceof P ? value : new P(function (resolve) {
62
51
  resolve(value);
63
52
  });
64
53
  }
65
-
66
54
  return new (P || (P = Promise))(function (resolve, reject) {
67
55
  function fulfilled(value) {
68
56
  try {
@@ -71,7 +59,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
71
59
  reject(e);
72
60
  }
73
61
  }
74
-
75
62
  function rejected(value) {
76
63
  try {
77
64
  step(generator["throw"](value));
@@ -79,29 +66,26 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
79
66
  reject(e);
80
67
  }
81
68
  }
82
-
83
69
  function step(result) {
84
70
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
85
71
  }
86
-
87
72
  step((generator = generator.apply(thisArg, _arguments || [])).next());
88
73
  });
89
74
  };
90
-
91
75
  var __generator = this && this.__generator || function (thisArg, body) {
92
76
  var _ = {
93
- label: 0,
94
- sent: function sent() {
95
- if (t[0] & 1) throw t[1];
96
- return t[1];
77
+ label: 0,
78
+ sent: function sent() {
79
+ if (t[0] & 1) throw t[1];
80
+ return t[1];
81
+ },
82
+ trys: [],
83
+ ops: []
97
84
  },
98
- trys: [],
99
- ops: []
100
- },
101
- f,
102
- y,
103
- t,
104
- g;
85
+ f,
86
+ y,
87
+ t,
88
+ g;
105
89
  return g = {
106
90
  next: verb(0),
107
91
  "throw": verb(1),
@@ -109,79 +93,60 @@ var __generator = this && this.__generator || function (thisArg, body) {
109
93
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
110
94
  return this;
111
95
  }), g;
112
-
113
96
  function verb(n) {
114
97
  return function (v) {
115
98
  return step([n, v]);
116
99
  };
117
100
  }
118
-
119
101
  function step(op) {
120
102
  if (f) throw new TypeError("Generator is already executing.");
121
-
122
103
  while (_) {
123
104
  try {
124
105
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
125
106
  if (y = 0, t) op = [op[0] & 2, t.value];
126
-
127
107
  switch (op[0]) {
128
108
  case 0:
129
109
  case 1:
130
110
  t = op;
131
111
  break;
132
-
133
112
  case 4:
134
113
  _.label++;
135
114
  return {
136
115
  value: op[1],
137
116
  done: false
138
117
  };
139
-
140
118
  case 5:
141
119
  _.label++;
142
120
  y = op[1];
143
121
  op = [0];
144
122
  continue;
145
-
146
123
  case 7:
147
124
  op = _.ops.pop();
148
-
149
125
  _.trys.pop();
150
-
151
126
  continue;
152
-
153
127
  default:
154
128
  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
155
129
  _ = 0;
156
130
  continue;
157
131
  }
158
-
159
132
  if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
160
133
  _.label = op[1];
161
134
  break;
162
135
  }
163
-
164
136
  if (op[0] === 6 && _.label < t[1]) {
165
137
  _.label = t[1];
166
138
  t = op;
167
139
  break;
168
140
  }
169
-
170
141
  if (t && _.label < t[2]) {
171
142
  _.label = t[2];
172
-
173
143
  _.ops.push(op);
174
-
175
144
  break;
176
145
  }
177
-
178
146
  if (t[2]) _.ops.pop();
179
-
180
147
  _.trys.pop();
181
-
182
148
  continue;
183
149
  }
184
-
185
150
  op = body.call(thisArg, _);
186
151
  } catch (e) {
187
152
  op = [6, e];
@@ -190,7 +155,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
190
155
  f = t = 0;
191
156
  }
192
157
  }
193
-
194
158
  if (op[0] & 5) throw op[1];
195
159
  return {
196
160
  value: op[0] ? op[1] : void 0,
@@ -198,28 +162,23 @@ var __generator = this && this.__generator || function (thisArg, body) {
198
162
  };
199
163
  }
200
164
  };
201
-
202
165
  var __rest = this && this.__rest || function (s, e) {
203
166
  var t = {};
204
-
205
167
  for (var p in s) {
206
168
  if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
207
169
  }
208
-
209
170
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
210
171
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
211
172
  }
212
173
  return t;
213
174
  };
214
-
215
175
  var __read = this && this.__read || function (o, n) {
216
176
  var m = typeof Symbol === "function" && o[Symbol.iterator];
217
177
  if (!m) return o;
218
178
  var i = m.call(o),
219
- r,
220
- ar = [],
221
- e;
222
-
179
+ r,
180
+ ar = [],
181
+ e;
223
182
  try {
224
183
  while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
225
184
  ar.push(r.value);
@@ -235,75 +194,59 @@ var __read = this && this.__read || function (o, n) {
235
194
  if (e) throw e.error;
236
195
  }
237
196
  }
238
-
239
197
  return ar;
240
198
  };
241
-
242
199
  var __importDefault = this && this.__importDefault || function (mod) {
243
200
  return mod && mod.__esModule ? mod : {
244
201
  "default": mod
245
202
  };
246
203
  };
247
-
248
204
  Object.defineProperty(exports, "__esModule", {
249
205
  value: true
250
206
  });
251
-
252
207
  var React = __importStar(require("react"));
253
-
254
208
  var modal_1 = __importDefault(require("antd/lib/modal"));
255
-
256
209
  var slider_1 = __importDefault(require("antd/lib/slider"));
257
-
258
210
  var getCroppedImg_1 = __importDefault(require("./getCroppedImg"));
259
-
260
211
  var EasyCrop_1 = __importDefault(require("./EasyCrop"));
261
-
262
212
  require("./style/index.less");
263
-
264
213
  var noop = function noop() {};
265
-
266
214
  var ZOOM_STEP = 0.1;
267
215
  var MIN_ROTATE = 0;
268
216
  var MAX_ROTATE = 360;
269
217
  var ROTATE_STEP = 1;
270
-
271
218
  var ImgCrop = function ImgCrop(props) {
272
219
  var aspect = props.aspect,
273
- shape = props.shape,
274
- grid = props.grid,
275
- quality = props.quality,
276
- zoom = props.zoom,
277
- rotate = props.rotate,
278
- minZoom = props.minZoom,
279
- maxZoom = props.maxZoom,
280
- fillColor = props.fillColor,
281
- prefix = props.prefix,
282
- modalTitle = props.modalTitle,
283
- modalWidth = props.modalWidth,
284
- modalOk = props.modalOk,
285
- modalCancel = props.modalCancel,
286
- beforeCrop = props.beforeCrop,
287
- zipImg = props.zipImg,
288
- children = props.children,
289
- cropperProps = props.cropperProps;
220
+ shape = props.shape,
221
+ grid = props.grid,
222
+ quality = props.quality,
223
+ zoom = props.zoom,
224
+ rotate = props.rotate,
225
+ minZoom = props.minZoom,
226
+ maxZoom = props.maxZoom,
227
+ fillColor = props.fillColor,
228
+ prefix = props.prefix,
229
+ modalTitle = props.modalTitle,
230
+ modalWidth = props.modalWidth,
231
+ modalOk = props.modalOk,
232
+ modalCancel = props.modalCancel,
233
+ beforeCrop = props.beforeCrop,
234
+ zipImg = props.zipImg,
235
+ children = props.children,
236
+ cropperProps = props.cropperProps;
290
237
  var pkg = "".concat(prefix, "-img-crop");
291
238
  var MEDIA_CLASS = "".concat(pkg, "-media");
292
239
  var hasZoom = zoom === true;
293
240
  var hasRotate = rotate === true;
294
-
295
241
  var _a = __read(React.useState(''), 2),
296
- src = _a[0],
297
- setSrc = _a[1];
298
-
242
+ src = _a[0],
243
+ setSrc = _a[1];
299
244
  var _b = __read(React.useState(1), 2),
300
- zoomVal = _b[0],
301
- setZoomVal = _b[1];
302
-
245
+ zoomVal = _b[0],
246
+ setZoomVal = _b[1];
303
247
  var _c = __read(React.useState(0), 2),
304
- rotateVal = _c[0],
305
- setRotateVal = _c[1];
306
-
248
+ rotateVal = _c[0],
249
+ setRotateVal = _c[1];
307
250
  var beforeUploadRef = React.useRef();
308
251
  var fileRef = React.useRef();
309
252
  var resolveRef = React.useRef(noop);
@@ -312,15 +255,12 @@ var ImgCrop = function ImgCrop(props) {
312
255
  /**
313
256
  * Upload
314
257
  */
315
-
316
258
  var renderUpload = React.useCallback(function () {
317
259
  var upload = Array.isArray(children) ? children[0] : children;
318
-
319
260
  var _a = upload.props,
320
- beforeUpload = _a.beforeUpload,
321
- accept = _a.accept,
322
- restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
323
-
261
+ beforeUpload = _a.beforeUpload,
262
+ accept = _a.accept,
263
+ restUploadProps = __rest(_a, ["beforeUpload", "accept"]);
324
264
  beforeUploadRef.current = beforeUpload;
325
265
  return __assign(__assign({}, upload), {
326
266
  props: __assign(__assign({}, restUploadProps), {
@@ -331,7 +271,6 @@ var ImgCrop = function ImgCrop(props) {
331
271
  reject();
332
272
  return;
333
273
  }
334
-
335
274
  fileRef.current = file;
336
275
  resolveRef.current = resolve;
337
276
  rejectRef.current = reject;
@@ -348,14 +287,12 @@ var ImgCrop = function ImgCrop(props) {
348
287
  /**
349
288
  * EasyCrop
350
289
  */
351
-
352
290
  var onComplete = React.useCallback(function (croppedAreaPixels) {
353
291
  cropPixelsRef.current = croppedAreaPixels;
354
292
  }, []);
355
293
  /**
356
294
  * Controls
357
295
  */
358
-
359
296
  var isMinZoom = zoomVal - ZOOM_STEP < minZoom;
360
297
  var isMaxZoom = zoomVal + ZOOM_STEP > maxZoom;
361
298
  var isMinRotate = rotateVal === MIN_ROTATE;
@@ -375,7 +312,6 @@ var ImgCrop = function ImgCrop(props) {
375
312
  /**
376
313
  * Modal
377
314
  */
378
-
379
315
  var modalProps = React.useMemo(function () {
380
316
  var obj = {
381
317
  width: modalWidth,
@@ -392,7 +328,6 @@ var ImgCrop = function ImgCrop(props) {
392
328
  var onOk = React.useCallback(function () {
393
329
  return __awaiter(void 0, void 0, void 0, function () {
394
330
  var naturalImg, naturalWidth, naturalHeight, canvas, ctx, maxLen, halfMax, left, top, maxImgData, _a, width, height, x, y, _b, type, name, uid;
395
-
396
331
  return __generator(this, function (_c) {
397
332
  onClose();
398
333
  naturalImg = document.querySelector(".".concat(MEDIA_CLASS));
@@ -401,15 +336,14 @@ var ImgCrop = function ImgCrop(props) {
401
336
  ctx = canvas.getContext('2d');
402
337
  maxLen = Math.sqrt(Math.pow(naturalWidth, 2) + Math.pow(naturalHeight, 2));
403
338
  canvas.width = maxLen;
404
- canvas.height = maxLen; // rotate the image
405
-
339
+ canvas.height = maxLen;
340
+ // rotate the image
406
341
  if (hasRotate && rotateVal > 0 && rotateVal < 360) {
407
342
  halfMax = maxLen / 2;
408
343
  ctx === null || ctx === void 0 ? void 0 : ctx.translate(halfMax, halfMax);
409
344
  ctx === null || ctx === void 0 ? void 0 : ctx.rotate(rotateVal * Math.PI / 180);
410
345
  ctx === null || ctx === void 0 ? void 0 : ctx.translate(-halfMax, -halfMax);
411
346
  }
412
-
413
347
  ctx.fillStyle = fillColor;
414
348
  ctx === null || ctx === void 0 ? void 0 : ctx.fillRect(0, 0, canvas.width, canvas.height);
415
349
  left = (maxLen - naturalWidth) / 2;
@@ -430,87 +364,52 @@ var ImgCrop = function ImgCrop(props) {
430
364
  newFile = new File([blob], name, {
431
365
  type: type
432
366
  });
433
- if (!zipImg) return [3
434
- /*break*/
435
- , 2];
367
+ if (!zipImg) return [3 /*break*/, 2];
436
368
  url = window.URL || window.webkitURL;
437
369
  imgUrl = url.createObjectURL(newFile);
438
- return [4
439
- /*yield*/
440
- , (0, getCroppedImg_1["default"])(imgUrl, zipImg, name, type)];
441
-
370
+ return [4 /*yield*/, (0, getCroppedImg_1["default"])(imgUrl, zipImg, name, type)];
442
371
  case 1:
443
372
  fileObj = _a.sent().fileObj;
444
373
  newFile = fileObj;
445
374
  _a.label = 2;
446
-
447
375
  case 2:
448
376
  newFile.uid = uid;
449
- if (typeof beforeUploadRef.current !== 'function') return [2
450
- /*return*/
451
- , resolveRef.current(newFile)];
377
+ if (typeof beforeUploadRef.current !== 'function') return [2 /*return*/, resolveRef.current(newFile)];
452
378
  res = beforeUploadRef.current(newFile, [newFile]);
453
- if (!(typeof res !== 'boolean' && !res)) return [3
454
- /*break*/
455
- , 3];
379
+ if (!(typeof res !== 'boolean' && !res)) return [3 /*break*/, 3];
456
380
  console.error('beforeUpload must return a boolean or Promise');
457
- return [3
458
- /*break*/
459
- , 7];
460
-
381
+ return [3 /*break*/, 7];
461
382
  case 3:
462
- if (res === true) return [2
463
- /*return*/
464
- , resolveRef.current(newFile)];
465
- if (res === false) return [2
466
- /*return*/
467
- , rejectRef.current('not upload')];
468
- if (!(res && typeof res.then === 'function')) return [3
469
- /*break*/
470
- , 7];
383
+ if (res === true) return [2 /*return*/, resolveRef.current(newFile)];
384
+ if (res === false) return [2 /*return*/, rejectRef.current('not upload')];
385
+ if (!(res && typeof res.then === 'function')) return [3 /*break*/, 7];
471
386
  _a.label = 4;
472
-
473
387
  case 4:
474
388
  _a.trys.push([4, 6,, 7]);
475
-
476
- return [4
477
- /*yield*/
478
- , res];
479
-
389
+ return [4 /*yield*/, res];
480
390
  case 5:
481
391
  passedFile = _a.sent();
482
392
  fileType = Object.prototype.toString.call(passedFile);
483
393
  if (fileType === '[object File]' || fileType === '[object Blob]') newFile = passedFile;
484
394
  resolveRef.current(newFile);
485
- return [3
486
- /*break*/
487
- , 7];
488
-
395
+ return [3 /*break*/, 7];
489
396
  case 6:
490
397
  err_1 = _a.sent();
491
398
  rejectRef.current(err_1);
492
- return [3
493
- /*break*/
494
- , 7];
495
-
399
+ return [3 /*break*/, 7];
496
400
  case 7:
497
- return [2
498
- /*return*/
499
- , null];
401
+ return [2 /*return*/, null];
500
402
  }
501
403
  });
502
404
  });
503
405
  }, type, quality);
504
- return [2
505
- /*return*/
506
- ];
406
+ return [2 /*return*/];
507
407
  });
508
408
  });
509
409
  }, [hasRotate, onClose, quality, rotateVal]);
510
-
511
410
  var renderComponent = function renderComponent(titleOfModal) {
512
411
  return React.createElement(React.Fragment, null, renderUpload(), src && React.createElement(modal_1["default"], __assign({
513
- visible: true,
412
+ open: true,
514
413
  wrapClassName: "".concat(pkg, "-modal"),
515
414
  title: titleOfModal,
516
415
  onOk: onOk,
@@ -568,10 +467,8 @@ var ImgCrop = function ImgCrop(props) {
568
467
  disabled: isMaxRotate
569
468
  }, "\u21BB"))));
570
469
  };
571
-
572
470
  return renderComponent(modalTitle);
573
471
  };
574
-
575
472
  ImgCrop.defaultProps = {
576
473
  prefix: 'ant',
577
474
  aspect: 1,