assui 2.3.8 → 3.0.0-alpha.0
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.
- package/es/a-select/index.js +7 -22
- package/es/a-select/style/index.css +195 -743
- package/es/area-text/index.js +1 -3
- package/es/button-drawer/index.js +12 -30
- package/es/button-modal/index.js +12 -33
- package/es/color-select/index.js +10 -23
- package/es/color-select/style/index.css +195 -743
- package/es/condition-input/index.js +8 -26
- package/es/condition-input/parse2RegexOption.js +0 -11
- package/es/config-provider/index.js +1 -3
- package/es/copy-to-clipboard/index.js +11 -27
- package/es/copy-to-clipboard/style/index.css +0 -1
- package/es/highlight-textarea/HighlighedContents.js +1 -3
- package/es/highlight-textarea/extractSpansOfClasses.d.ts +1 -0
- package/es/highlight-textarea/extractSpansOfClasses.js +7 -29
- package/es/highlight-textarea/getRanges.js +3 -35
- package/es/highlight-textarea/getType.js +0 -6
- package/es/highlight-textarea/index.js +11 -30
- package/es/highlight-textarea/style/index.css +7 -21
- package/es/img-crop/EasyCrop.js +18 -34
- package/es/img-crop/getCroppedImg.js +15 -50
- package/es/img-crop/index.js +56 -145
- package/es/img-crop/style/index.css +195 -743
- package/es/json-editor/index.js +6 -20
- package/es/keep-tab/index.d.ts +7 -2
- package/es/keep-tab/index.js +34 -59
- package/es/keep-tab/style/index.css +39 -99
- package/es/label-auto-complete/index.js +14 -32
- package/es/label-auto-complete/style/index.css +195 -743
- package/es/label-condition-input/index.js +13 -29
- package/es/label-customize-range-picker/defaultRadioList.js +0 -3
- package/es/label-customize-range-picker/index.js +36 -78
- package/es/label-customize-range-picker/style/index.css +195 -743
- package/es/label-customize-range-picker/utils/index.js +5 -14
- package/es/label-date-picker/index.js +11 -28
- package/es/label-date-picker/style/index.css +195 -743
- package/es/label-input/index.js +23 -37
- package/es/label-number-input/index.js +13 -28
- package/es/label-range-picker/index.js +11 -28
- package/es/label-range-picker/style/index.css +195 -743
- package/es/label-select/index.js +11 -27
- package/es/label-select/style/index.css +195 -743
- package/es/label-text-area/index.js +13 -35
- package/es/label-tree-select/index.js +15 -32
- package/es/label-tree-select/style/index.css +195 -743
- package/es/number-format-input/index.js +1 -11
- package/es/number-input/index.js +18 -37
- package/es/number-input/utils.js +7 -15
- package/es/rc-echart/core.js +15 -27
- package/es/rc-echart/index.js +0 -6
- package/es/rc-qrcode/index.js +2 -12
- package/es/rc-qrcode/useQrcode.js +5 -12
- package/es/rich-text-editor/index.js +5 -16
- package/es/rich-text-editor/plugins/code/index.js +0 -8
- package/es/rich-text-editor/style/index.css +195 -743
- package/es/single-img-upload/index.js +36 -110
- package/es/single-img-upload/style/index.css +195 -743
- package/es/split-pane/index.js +0 -4
- package/es/step-number-input/index.js +14 -39
- package/es/step-number-input/style/index.css +195 -743
- package/es/table-col/index.js +2 -4
- package/es/text-area/index.js +8 -27
- package/es/text-input/index.js +4 -18
- package/es/text-input/style/index.css +7 -21
- package/lib/a-select/index.js +7 -27
- package/lib/a-select/style/index.css +195 -743
- package/lib/a-select/style/index.js +0 -2
- package/lib/area-text/index.js +1 -6
- package/lib/area-text/style/index.js +0 -1
- package/lib/beautiful-dnd/index.js +0 -9
- package/lib/button-drawer/index.js +12 -42
- package/lib/button-drawer/style/index.js +0 -1
- package/lib/button-modal/index.js +12 -44
- package/lib/button-modal/style/index.js +0 -1
- package/lib/color-select/index.js +10 -39
- package/lib/color-select/style/index.css +195 -743
- package/lib/color-select/style/index.js +0 -2
- package/lib/condition-input/index.js +8 -41
- package/lib/condition-input/parse2RegexOption.js +0 -16
- package/lib/condition-input/style/index.js +0 -1
- package/lib/config-provider/context.js +0 -4
- package/lib/config-provider/index.js +1 -28
- package/lib/copy-to-clipboard/index.js +11 -38
- package/lib/copy-to-clipboard/style/index.css +0 -1
- package/lib/copy-to-clipboard/style/index.js +0 -1
- package/lib/highlight-textarea/HighlighedContents.js +1 -7
- package/lib/highlight-textarea/extractSpansOfClasses.d.ts +1 -0
- package/lib/highlight-textarea/extractSpansOfClasses.js +7 -31
- package/lib/highlight-textarea/getRanges.js +3 -38
- package/lib/highlight-textarea/getType.js +0 -8
- package/lib/highlight-textarea/index.js +11 -44
- package/lib/highlight-textarea/style/index.css +7 -21
- package/lib/highlight-textarea/style/index.js +0 -1
- package/lib/highlight-words/index.js +0 -3
- package/lib/img-crop/EasyCrop.js +18 -44
- package/lib/img-crop/getCroppedImg.js +15 -51
- package/lib/img-crop/index.js +56 -159
- package/lib/img-crop/style/index.css +195 -743
- package/lib/img-crop/style/index.js +0 -3
- package/lib/index.js +0 -77
- package/lib/json-editor/index.js +6 -35
- package/lib/json-editor/style/index.js +0 -2
- package/lib/keep-tab/index.d.ts +7 -2
- package/lib/keep-tab/index.js +34 -76
- package/lib/keep-tab/style/index.css +39 -99
- package/lib/keep-tab/style/index.js +0 -2
- package/lib/label-auto-complete/index.js +14 -39
- package/lib/label-auto-complete/style/index.css +195 -743
- package/lib/label-auto-complete/style/index.js +0 -2
- package/lib/label-condition-input/index.js +13 -36
- package/lib/label-condition-input/style/index.js +0 -1
- package/lib/label-customize-range-picker/defaultRadioList.js +0 -7
- package/lib/label-customize-range-picker/index.js +36 -99
- package/lib/label-customize-range-picker/style/index.css +195 -743
- package/lib/label-customize-range-picker/style/index.js +0 -5
- package/lib/label-customize-range-picker/utils/index.js +5 -19
- package/lib/label-date-picker/index.js +11 -34
- package/lib/label-date-picker/style/index.css +195 -743
- package/lib/label-date-picker/style/index.js +0 -2
- package/lib/label-input/index.js +23 -46
- package/lib/label-input/style/index.js +0 -1
- package/lib/label-number-input/index.js +13 -36
- package/lib/label-number-input/style/index.js +0 -1
- package/lib/label-range-picker/index.js +11 -36
- package/lib/label-range-picker/style/index.css +195 -743
- package/lib/label-range-picker/style/index.js +0 -2
- package/lib/label-select/index.js +11 -36
- package/lib/label-select/style/index.css +195 -743
- package/lib/label-select/style/index.js +0 -2
- package/lib/label-text-area/index.js +13 -40
- package/lib/label-text-area/style/index.js +0 -1
- package/lib/label-tree-select/index.js +15 -38
- package/lib/label-tree-select/style/index.css +195 -743
- package/lib/label-tree-select/style/index.js +0 -2
- package/lib/messages/index.js +0 -2
- package/lib/number-format-input/index.js +1 -15
- package/lib/number-format-input/style/index.js +0 -1
- package/lib/number-input/index.js +18 -55
- package/lib/number-input/style/index.js +0 -1
- package/lib/number-input/utils.js +8 -20
- package/lib/rc-echart/core.js +15 -40
- package/lib/rc-echart/index.js +0 -17
- package/lib/rc-motion/index.js +0 -3
- package/lib/rc-qrcode/index.js +2 -25
- package/lib/rc-qrcode/useQrcode.js +5 -17
- package/lib/rc-transition-group/index.js +0 -9
- package/lib/resizable/index.js +0 -2
- package/lib/resizable/style/index.js +0 -1
- package/lib/rich-text-editor/index.js +5 -53
- package/lib/rich-text-editor/plugins/code/index.js +2 -12
- package/lib/rich-text-editor/style/index.css +195 -743
- package/lib/rich-text-editor/style/index.js +0 -1
- package/lib/single-img-upload/index.js +36 -125
- package/lib/single-img-upload/style/index.css +195 -743
- package/lib/single-img-upload/style/index.js +0 -3
- package/lib/sortable-hoc/index.js +0 -9
- package/lib/split-pane/index.js +0 -15
- package/lib/split-pane/style/index.js +0 -1
- package/lib/step-number-input/index.js +14 -55
- package/lib/step-number-input/style/index.css +195 -743
- package/lib/step-number-input/style/index.js +0 -2
- package/lib/table-col/index.js +2 -6
- package/lib/text-area/index.js +8 -38
- package/lib/text-area/style/index.js +0 -1
- package/lib/text-input/index.js +4 -23
- package/lib/text-input/style/index.css +7 -21
- package/lib/text-input/style/index.js +0 -1
- package/package.json +5 -5
|
@@ -2,39 +2,31 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
var __rest = this && this.__rest || function (s, e) {
|
|
18
14
|
var t = {};
|
|
19
|
-
|
|
20
15
|
for (var p in s) {
|
|
21
16
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
19
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
26
20
|
}
|
|
27
21
|
return t;
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
var __read = this && this.__read || function (o, n) {
|
|
31
24
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
32
25
|
if (!m) return o;
|
|
33
26
|
var i = m.call(o),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
r,
|
|
28
|
+
ar = [],
|
|
29
|
+
e;
|
|
38
30
|
try {
|
|
39
31
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
40
32
|
ar.push(r.value);
|
|
@@ -50,10 +42,8 @@ var __read = this && this.__read || function (o, n) {
|
|
|
50
42
|
if (e) throw e.error;
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
|
-
|
|
54
45
|
return ar;
|
|
55
46
|
};
|
|
56
|
-
|
|
57
47
|
import * as React from 'react';
|
|
58
48
|
import classNames from 'classnames';
|
|
59
49
|
import trimStart from 'lodash/trimStart';
|
|
@@ -61,47 +51,38 @@ import useMount from "ahooks/es/useMount";
|
|
|
61
51
|
import HighlighedContents from './HighlighedContents';
|
|
62
52
|
var HighlightWithinTextarea = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
63
53
|
var prefixCls = props.prefixCls,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
54
|
+
value = props.value,
|
|
55
|
+
onChange = props.onChange,
|
|
56
|
+
highlight = props.highlight,
|
|
57
|
+
className = props.className,
|
|
58
|
+
textAreaClassName = props.textAreaClassName,
|
|
59
|
+
textareaProps = __rest(props, ["prefixCls", "value", "onChange", "highlight", "className", "textAreaClassName"]);
|
|
71
60
|
var _a = __read(React.useState(''), 2),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
textAreaValue = _a[0],
|
|
62
|
+
setTextAreaValue = _a[1];
|
|
75
63
|
var resultValue = value || textAreaValue;
|
|
76
64
|
var containerRef = React.useRef();
|
|
77
65
|
var backdropRef = React.useRef();
|
|
78
|
-
|
|
79
66
|
var handleScroll = function handleScroll() {
|
|
80
67
|
var _a;
|
|
81
|
-
|
|
82
68
|
var textareaDom = (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.querySelector('textarea');
|
|
83
|
-
|
|
84
69
|
if (backdropRef.current && textareaDom) {
|
|
85
70
|
backdropRef.current.scrollLeft = textareaDom.scrollLeft;
|
|
86
71
|
backdropRef.current.style.height = "".concat(textareaDom.clientHeight + textareaDom.scrollTop, "px");
|
|
87
72
|
backdropRef.current.style.top = "".concat(0 - textareaDom.scrollTop, "px");
|
|
88
73
|
}
|
|
89
74
|
};
|
|
90
|
-
|
|
91
75
|
useMount(function () {
|
|
92
76
|
handleScroll();
|
|
93
77
|
});
|
|
94
|
-
|
|
95
78
|
var onTextareaChange = function onTextareaChange(e) {
|
|
96
79
|
var newValue = trimStart(e.target.value);
|
|
97
|
-
|
|
98
80
|
if (onChange) {
|
|
99
81
|
onChange(newValue, e);
|
|
100
82
|
} else {
|
|
101
83
|
setTextAreaValue(newValue);
|
|
102
84
|
}
|
|
103
85
|
};
|
|
104
|
-
|
|
105
86
|
var textareaCls = classNames("".concat(prefixCls, "-input"), 'highlight-textarea-input', 'highlight-content', textAreaClassName);
|
|
106
87
|
return /*#__PURE__*/React.createElement("div", {
|
|
107
88
|
className: classNames('highlight-textarea', className),
|
|
@@ -23,24 +23,15 @@
|
|
|
23
23
|
-moz-user-select: none;
|
|
24
24
|
user-select: none;
|
|
25
25
|
}
|
|
26
|
-
.ant-input-affix-wrapper:-ms-input-placeholder {
|
|
27
|
-
color: #bfbfbf;
|
|
28
|
-
-ms-user-select: none;
|
|
29
|
-
user-select: none;
|
|
30
|
-
}
|
|
31
26
|
.ant-input-affix-wrapper::placeholder {
|
|
32
27
|
color: #bfbfbf;
|
|
33
28
|
-webkit-user-select: none;
|
|
34
29
|
-moz-user-select: none;
|
|
35
|
-
-ms-user-select: none;
|
|
36
30
|
user-select: none;
|
|
37
31
|
}
|
|
38
32
|
.ant-input-affix-wrapper:-moz-placeholder-shown {
|
|
39
33
|
text-overflow: ellipsis;
|
|
40
34
|
}
|
|
41
|
-
.ant-input-affix-wrapper:-ms-input-placeholder {
|
|
42
|
-
text-overflow: ellipsis;
|
|
43
|
-
}
|
|
44
35
|
.ant-input-affix-wrapper:placeholder-shown {
|
|
45
36
|
text-overflow: ellipsis;
|
|
46
37
|
}
|
|
@@ -137,6 +128,7 @@ textarea.ant-input-affix-wrapper {
|
|
|
137
128
|
}
|
|
138
129
|
.ant-input-affix-wrapper > input.ant-input {
|
|
139
130
|
padding: 0;
|
|
131
|
+
font-size: inherit;
|
|
140
132
|
border: none;
|
|
141
133
|
outline: none;
|
|
142
134
|
}
|
|
@@ -305,24 +297,15 @@ textarea.ant-input-affix-wrapper {
|
|
|
305
297
|
-moz-user-select: none;
|
|
306
298
|
user-select: none;
|
|
307
299
|
}
|
|
308
|
-
.ant-input:-ms-input-placeholder {
|
|
309
|
-
color: #bfbfbf;
|
|
310
|
-
-ms-user-select: none;
|
|
311
|
-
user-select: none;
|
|
312
|
-
}
|
|
313
300
|
.ant-input::placeholder {
|
|
314
301
|
color: #bfbfbf;
|
|
315
302
|
-webkit-user-select: none;
|
|
316
303
|
-moz-user-select: none;
|
|
317
|
-
-ms-user-select: none;
|
|
318
304
|
user-select: none;
|
|
319
305
|
}
|
|
320
306
|
.ant-input:-moz-placeholder-shown {
|
|
321
307
|
text-overflow: ellipsis;
|
|
322
308
|
}
|
|
323
|
-
.ant-input:-ms-input-placeholder {
|
|
324
|
-
text-overflow: ellipsis;
|
|
325
|
-
}
|
|
326
309
|
.ant-input:placeholder-shown {
|
|
327
310
|
text-overflow: ellipsis;
|
|
328
311
|
}
|
|
@@ -835,18 +818,21 @@ textarea.ant-input {
|
|
|
835
818
|
}
|
|
836
819
|
.ant-input-search-rtl .ant-input:hover + .ant-input-group-addon .ant-input-search-button:not(.ant-btn-primary),
|
|
837
820
|
.ant-input-search-rtl .ant-input:focus + .ant-input-group-addon .ant-input-search-button:not(.ant-btn-primary) {
|
|
838
|
-
border-right-color: #40a9ff;
|
|
839
821
|
border-left-color: #d9d9d9;
|
|
840
822
|
}
|
|
823
|
+
.ant-input-search-rtl .ant-input:hover + .ant-input-group-addon .ant-input-search-button:not(.ant-btn-primary):hover,
|
|
824
|
+
.ant-input-search-rtl .ant-input:focus + .ant-input-group-addon .ant-input-search-button:not(.ant-btn-primary):hover {
|
|
825
|
+
border-left-color: #40a9ff;
|
|
826
|
+
}
|
|
841
827
|
.ant-input-search-rtl > .ant-input-group > .ant-input-affix-wrapper:hover,
|
|
842
828
|
.ant-input-search-rtl > .ant-input-group > .ant-input-affix-wrapper-focused {
|
|
843
829
|
border-right-color: #40a9ff;
|
|
844
830
|
}
|
|
845
|
-
.ant-input-search-rtl > .ant-input-group > .ant-input-group-addon {
|
|
831
|
+
.ant-input-search-rtl > .ant-input-group > .ant-input-group-addon:last-child {
|
|
846
832
|
right: -1px;
|
|
847
833
|
left: auto;
|
|
848
834
|
}
|
|
849
|
-
.ant-input-search-rtl > .ant-input-group > .ant-input-group-addon .ant-input-search-button {
|
|
835
|
+
.ant-input-search-rtl > .ant-input-group > .ant-input-group-addon:last-child .ant-input-search-button {
|
|
850
836
|
border-radius: 2px 0 0 2px;
|
|
851
837
|
}
|
|
852
838
|
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
package/es/img-crop/EasyCrop.js
CHANGED
|
@@ -2,39 +2,31 @@ var __assign = this && this.__assign || function () {
|
|
|
2
2
|
__assign = Object.assign || function (t) {
|
|
3
3
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
4
|
s = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var p in s) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
8
7
|
}
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
return t;
|
|
12
10
|
};
|
|
13
|
-
|
|
14
11
|
return __assign.apply(this, arguments);
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
var __rest = this && this.__rest || function (s, e) {
|
|
18
14
|
var t = {};
|
|
19
|
-
|
|
20
15
|
for (var p in s) {
|
|
21
16
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
19
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
26
20
|
}
|
|
27
21
|
return t;
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
var __read = this && this.__read || function (o, n) {
|
|
31
24
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
32
25
|
if (!m) return o;
|
|
33
26
|
var i = m.call(o),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
r,
|
|
28
|
+
ar = [],
|
|
29
|
+
e;
|
|
38
30
|
try {
|
|
39
31
|
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
|
40
32
|
ar.push(r.value);
|
|
@@ -50,42 +42,35 @@ var __read = this && this.__read || function (o, n) {
|
|
|
50
42
|
if (e) throw e.error;
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
|
-
|
|
54
45
|
return ar;
|
|
55
46
|
};
|
|
56
|
-
|
|
57
47
|
import * as React from 'react';
|
|
58
48
|
import Cropper from 'react-easy-crop';
|
|
59
|
-
|
|
60
49
|
var EasyCrop = function EasyCrop(props) {
|
|
61
50
|
var aspect = props.aspect,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
51
|
+
minZoom = props.minZoom,
|
|
52
|
+
maxZoom = props.maxZoom,
|
|
53
|
+
onComplete = props.onComplete,
|
|
54
|
+
restProps = __rest(props, ["aspect", "minZoom", "maxZoom", "onComplete"]);
|
|
67
55
|
var _a = __read(React.useState({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0
|
|
58
|
+
}), 2),
|
|
59
|
+
crop = _a[0],
|
|
60
|
+
setCrop = _a[1];
|
|
74
61
|
var _b = __read(React.useState({
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
62
|
+
width: 0,
|
|
63
|
+
height: 0
|
|
64
|
+
}), 2),
|
|
65
|
+
cropSize = _b[0],
|
|
66
|
+
setCropSize = _b[1];
|
|
81
67
|
var onCropComplete = React.useCallback(function (_, croppedAreaPixels) {
|
|
82
68
|
onComplete(croppedAreaPixels);
|
|
83
69
|
}, [onComplete]);
|
|
84
70
|
var onMediaLoaded = React.useCallback(function (mediaSize) {
|
|
85
71
|
var width = mediaSize.width,
|
|
86
|
-
|
|
72
|
+
height = mediaSize.height;
|
|
87
73
|
var ratioWidth = height * aspect;
|
|
88
|
-
|
|
89
74
|
if (width > ratioWidth) {
|
|
90
75
|
setCropSize({
|
|
91
76
|
width: ratioWidth,
|
|
@@ -109,5 +94,4 @@ var EasyCrop = function EasyCrop(props) {
|
|
|
109
94
|
onMediaLoaded: onMediaLoaded
|
|
110
95
|
}));
|
|
111
96
|
};
|
|
112
|
-
|
|
113
97
|
export default EasyCrop;
|
|
@@ -4,7 +4,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
4
4
|
resolve(value);
|
|
5
5
|
});
|
|
6
6
|
}
|
|
7
|
-
|
|
8
7
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
8
|
function fulfilled(value) {
|
|
10
9
|
try {
|
|
@@ -13,7 +12,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
13
12
|
reject(e);
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
function rejected(value) {
|
|
18
16
|
try {
|
|
19
17
|
step(generator["throw"](value));
|
|
@@ -21,29 +19,26 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
21
19
|
reject(e);
|
|
22
20
|
}
|
|
23
21
|
}
|
|
24
|
-
|
|
25
22
|
function step(result) {
|
|
26
23
|
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
27
24
|
}
|
|
28
|
-
|
|
29
25
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
26
|
});
|
|
31
27
|
};
|
|
32
|
-
|
|
33
28
|
var __generator = this && this.__generator || function (thisArg, body) {
|
|
34
29
|
var _ = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
30
|
+
label: 0,
|
|
31
|
+
sent: function sent() {
|
|
32
|
+
if (t[0] & 1) throw t[1];
|
|
33
|
+
return t[1];
|
|
34
|
+
},
|
|
35
|
+
trys: [],
|
|
36
|
+
ops: []
|
|
39
37
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
y,
|
|
45
|
-
t,
|
|
46
|
-
g;
|
|
38
|
+
f,
|
|
39
|
+
y,
|
|
40
|
+
t,
|
|
41
|
+
g;
|
|
47
42
|
return g = {
|
|
48
43
|
next: verb(0),
|
|
49
44
|
"throw": verb(1),
|
|
@@ -51,79 +46,60 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
51
46
|
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
52
47
|
return this;
|
|
53
48
|
}), g;
|
|
54
|
-
|
|
55
49
|
function verb(n) {
|
|
56
50
|
return function (v) {
|
|
57
51
|
return step([n, v]);
|
|
58
52
|
};
|
|
59
53
|
}
|
|
60
|
-
|
|
61
54
|
function step(op) {
|
|
62
55
|
if (f) throw new TypeError("Generator is already executing.");
|
|
63
|
-
|
|
64
56
|
while (_) {
|
|
65
57
|
try {
|
|
66
58
|
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;
|
|
67
59
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
68
|
-
|
|
69
60
|
switch (op[0]) {
|
|
70
61
|
case 0:
|
|
71
62
|
case 1:
|
|
72
63
|
t = op;
|
|
73
64
|
break;
|
|
74
|
-
|
|
75
65
|
case 4:
|
|
76
66
|
_.label++;
|
|
77
67
|
return {
|
|
78
68
|
value: op[1],
|
|
79
69
|
done: false
|
|
80
70
|
};
|
|
81
|
-
|
|
82
71
|
case 5:
|
|
83
72
|
_.label++;
|
|
84
73
|
y = op[1];
|
|
85
74
|
op = [0];
|
|
86
75
|
continue;
|
|
87
|
-
|
|
88
76
|
case 7:
|
|
89
77
|
op = _.ops.pop();
|
|
90
|
-
|
|
91
78
|
_.trys.pop();
|
|
92
|
-
|
|
93
79
|
continue;
|
|
94
|
-
|
|
95
80
|
default:
|
|
96
81
|
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
97
82
|
_ = 0;
|
|
98
83
|
continue;
|
|
99
84
|
}
|
|
100
|
-
|
|
101
85
|
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
102
86
|
_.label = op[1];
|
|
103
87
|
break;
|
|
104
88
|
}
|
|
105
|
-
|
|
106
89
|
if (op[0] === 6 && _.label < t[1]) {
|
|
107
90
|
_.label = t[1];
|
|
108
91
|
t = op;
|
|
109
92
|
break;
|
|
110
93
|
}
|
|
111
|
-
|
|
112
94
|
if (t && _.label < t[2]) {
|
|
113
95
|
_.label = t[2];
|
|
114
|
-
|
|
115
96
|
_.ops.push(op);
|
|
116
|
-
|
|
117
97
|
break;
|
|
118
98
|
}
|
|
119
|
-
|
|
120
99
|
if (t[2]) _.ops.pop();
|
|
121
|
-
|
|
122
100
|
_.trys.pop();
|
|
123
|
-
|
|
124
101
|
continue;
|
|
125
102
|
}
|
|
126
|
-
|
|
127
103
|
op = body.call(thisArg, _);
|
|
128
104
|
} catch (e) {
|
|
129
105
|
op = [6, e];
|
|
@@ -132,7 +108,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
132
108
|
f = t = 0;
|
|
133
109
|
}
|
|
134
110
|
}
|
|
135
|
-
|
|
136
111
|
if (op[0] & 5) throw op[1];
|
|
137
112
|
return {
|
|
138
113
|
value: op[0] ? op[1] : void 0,
|
|
@@ -140,7 +115,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
140
115
|
};
|
|
141
116
|
}
|
|
142
117
|
};
|
|
143
|
-
|
|
144
118
|
var createImage = function createImage(url) {
|
|
145
119
|
return new Promise(function (resolve, reject) {
|
|
146
120
|
var image = new Image();
|
|
@@ -151,23 +125,17 @@ var createImage = function createImage(url) {
|
|
|
151
125
|
return reject(error);
|
|
152
126
|
});
|
|
153
127
|
image.setAttribute('crossOrigin', 'anonymous'); // needed to avoid cross-origin issues on CodeSandbox
|
|
154
|
-
|
|
155
128
|
image.src = url;
|
|
156
129
|
});
|
|
157
130
|
};
|
|
158
|
-
|
|
159
131
|
function getCroppedImg(imageSrc, pixelCrop, name, type) {
|
|
160
132
|
return __awaiter(this, void 0, void 0, function () {
|
|
161
133
|
var _a, width, _b, height, image, bodyEl, canvas, ctx;
|
|
162
|
-
|
|
163
134
|
return __generator(this, function (_c) {
|
|
164
135
|
switch (_c.label) {
|
|
165
136
|
case 0:
|
|
166
137
|
_a = pixelCrop.width, width = _a === void 0 ? 670 : _a, _b = pixelCrop.height, height = _b === void 0 ? 280 : _b;
|
|
167
|
-
return [4
|
|
168
|
-
/*yield*/
|
|
169
|
-
, createImage(imageSrc)];
|
|
170
|
-
|
|
138
|
+
return [4 /*yield*/, createImage(imageSrc)];
|
|
171
139
|
case 1:
|
|
172
140
|
image = _c.sent();
|
|
173
141
|
bodyEl = document.querySelector('body');
|
|
@@ -177,11 +145,9 @@ function getCroppedImg(imageSrc, pixelCrop, name, type) {
|
|
|
177
145
|
canvas.width = width;
|
|
178
146
|
canvas.height = height;
|
|
179
147
|
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(image, 0, 0, width, height);
|
|
180
|
-
bodyEl.removeChild(image);
|
|
181
|
-
|
|
182
|
-
return [2
|
|
183
|
-
/*return*/
|
|
184
|
-
, new Promise(function (resolve) {
|
|
148
|
+
bodyEl.removeChild(image);
|
|
149
|
+
// As a blob
|
|
150
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
185
151
|
canvas.toBlob(function (file) {
|
|
186
152
|
resolve({
|
|
187
153
|
url: URL.createObjectURL(file),
|
|
@@ -195,5 +161,4 @@ function getCroppedImg(imageSrc, pixelCrop, name, type) {
|
|
|
195
161
|
});
|
|
196
162
|
});
|
|
197
163
|
}
|
|
198
|
-
|
|
199
164
|
export default getCroppedImg;
|