util-helpers 4.20.2 → 4.20.3
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/dist/util-helpers.js +10 -10
- package/dist/util-helpers.js.map +1 -1
- package/dist/util-helpers.min.js +1 -1
- package/dist/util-helpers.min.js.map +1 -1
- package/esm/VERSION.js +1 -1
- package/esm/compressImage.js +2 -2
- package/esm/getImageInfo.js +2 -2
- package/esm/index.js +1 -1
- package/esm/loadImageWithBlob.js +5 -4
- package/lib/VERSION.js +1 -1
- package/lib/compressImage.js +2 -2
- package/lib/getImageInfo.js +2 -2
- package/lib/index.js +1 -1
- package/lib/loadImageWithBlob.js +5 -4
- package/package.json +1 -1
- package/types/compressImage.d.ts +3 -1
- package/types/getImageInfo.d.ts +3 -1
- package/types/loadImageWithBlob.d.ts +3 -1
package/dist/util-helpers.js
CHANGED
|
@@ -1371,13 +1371,13 @@
|
|
|
1371
1371
|
}
|
|
1372
1372
|
|
|
1373
1373
|
var SuccessResponseStatus = [200, 304];
|
|
1374
|
-
function getBlob(img) {
|
|
1374
|
+
function getBlob(img, ajaxOptions) {
|
|
1375
1375
|
return new Promise(function (resolve, reject) {
|
|
1376
1376
|
if (isBlob(img)) {
|
|
1377
1377
|
resolve(img);
|
|
1378
1378
|
}
|
|
1379
1379
|
else {
|
|
1380
|
-
ajax(img, { responseType: 'blob' })
|
|
1380
|
+
ajax(img, __assign({ responseType: 'blob', headers: { 'sec-fetch-site': 'none' } }, ajaxOptions))
|
|
1381
1381
|
.then(function (ev) {
|
|
1382
1382
|
var responseStatus = ev.target.status;
|
|
1383
1383
|
if (SuccessResponseStatus.indexOf(responseStatus) !== -1) {
|
|
@@ -1393,14 +1393,14 @@
|
|
|
1393
1393
|
}
|
|
1394
1394
|
var cacheImage$2;
|
|
1395
1395
|
var cacheResult$2;
|
|
1396
|
-
function loadImageWithBlob(img, useCache) {
|
|
1396
|
+
function loadImageWithBlob(img, useCache, ajaxOptions) {
|
|
1397
1397
|
if (useCache === void 0) { useCache = true; }
|
|
1398
1398
|
return new Promise(function (resolve, reject) {
|
|
1399
1399
|
if (useCache && cacheImage$2 === img && cacheResult$2) {
|
|
1400
1400
|
resolve(cacheResult$2);
|
|
1401
1401
|
}
|
|
1402
1402
|
else {
|
|
1403
|
-
getBlob(img)
|
|
1403
|
+
getBlob(img, ajaxOptions)
|
|
1404
1404
|
.then(function (blob) {
|
|
1405
1405
|
var url = createObjectURL(blob);
|
|
1406
1406
|
var image = new Image();
|
|
@@ -1435,8 +1435,8 @@
|
|
|
1435
1435
|
function compressImage(img, options) {
|
|
1436
1436
|
if (options === void 0) { options = {}; }
|
|
1437
1437
|
return new Promise(function (resolve, reject) {
|
|
1438
|
-
var width = options.width, height = options.height, rotate = options.rotate, _a = options.offset, offset = _a === void 0 ? [0, 0] : _a, _b = options.cacheImage, cacheImage = _b === void 0 ? true : _b, _c = options.background, background = _c === void 0 ? '#fff' : _c, canvasWidth = options.canvasWidth, canvasHeight = options.canvasHeight, _d = options.format, format = _d === void 0 ? 'blob' : _d, _e = options.type, type = _e === void 0 ? 'image/jpeg' : _e, _f = options.quality, quality = _f === void 0 ? 0.8 : _f, beforeCompress = options.beforeCompress, beforeDraw = options.beforeDraw, afterDraw = options.afterDraw;
|
|
1439
|
-
loadImageWithBlob(img, cacheImage)
|
|
1438
|
+
var width = options.width, height = options.height, rotate = options.rotate, _a = options.offset, offset = _a === void 0 ? [0, 0] : _a, _b = options.cacheImage, cacheImage = _b === void 0 ? true : _b, _c = options.background, background = _c === void 0 ? '#fff' : _c, canvasWidth = options.canvasWidth, canvasHeight = options.canvasHeight, _d = options.format, format = _d === void 0 ? 'blob' : _d, _e = options.type, type = _e === void 0 ? 'image/jpeg' : _e, _f = options.quality, quality = _f === void 0 ? 0.8 : _f, beforeCompress = options.beforeCompress, beforeDraw = options.beforeDraw, afterDraw = options.afterDraw, ajaxOptions = options.ajaxOptions;
|
|
1439
|
+
loadImageWithBlob(img, cacheImage, ajaxOptions)
|
|
1440
1440
|
.then(function (_a) {
|
|
1441
1441
|
var image = _a.image, blob = _a.blob;
|
|
1442
1442
|
var numWidth = toNumber(width);
|
|
@@ -1569,14 +1569,14 @@
|
|
|
1569
1569
|
}
|
|
1570
1570
|
var cacheImage$1;
|
|
1571
1571
|
var cacheResult$1;
|
|
1572
|
-
function getImageInfo(img, useCache) {
|
|
1572
|
+
function getImageInfo(img, useCache, ajaxOptions) {
|
|
1573
1573
|
if (useCache === void 0) { useCache = true; }
|
|
1574
1574
|
return new Promise(function (resolve, reject) {
|
|
1575
1575
|
if (useCache && cacheImage$1 === img && cacheResult$1) {
|
|
1576
1576
|
resolve(cacheResult$1);
|
|
1577
1577
|
}
|
|
1578
1578
|
else {
|
|
1579
|
-
loadImageWithBlob(img, false)
|
|
1579
|
+
loadImageWithBlob(img, false, ajaxOptions)
|
|
1580
1580
|
.then(function (_a) {
|
|
1581
1581
|
var image = _a.image, blob = _a.blob;
|
|
1582
1582
|
var width = image.width, height = image.height;
|
|
@@ -1971,9 +1971,9 @@
|
|
|
1971
1971
|
return internalFindTreeSelect(tree, predicate, childrenField);
|
|
1972
1972
|
}
|
|
1973
1973
|
|
|
1974
|
-
var VERSION = "4.20.
|
|
1974
|
+
var VERSION = "4.20.3";
|
|
1975
1975
|
|
|
1976
|
-
var version = "4.20.
|
|
1976
|
+
var version = "4.20.3";
|
|
1977
1977
|
|
|
1978
1978
|
exports.VERSION = VERSION;
|
|
1979
1979
|
exports.ajax = ajax;
|