util-helpers 4.21.4 → 4.21.6
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/README.md +33 -33
- package/dist/util-helpers.js +75 -48
- 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 +6 -4
- package/esm/download.js +2 -2
- package/esm/fileReader.js +4 -3
- package/esm/index.js +1 -1
- package/esm/isChinese.js +2 -2
- package/esm/node_modules/.pnpm/emitter-pro@1.2.1/node_modules/emitter-pro/dist/emitter-pro.esm.js +98 -0
- package/esm/safeDate.js +4 -3
- package/esm/utils/Cache.js +1 -1
- package/esm/utils/native.js +2 -1
- package/lib/VERSION.js +1 -1
- package/lib/compressImage.js +6 -4
- package/lib/download.js +1 -1
- package/lib/fileReader.js +4 -3
- package/lib/index.js +1 -1
- package/lib/isChinese.js +1 -1
- package/lib/node_modules/.pnpm/emitter-pro@1.2.1/node_modules/emitter-pro/dist/emitter-pro.esm.js +100 -0
- package/lib/safeDate.js +4 -3
- package/lib/utils/Cache.js +1 -1
- package/lib/utils/native.js +1 -0
- package/package.json +9 -9
- package/types/compressImage.d.ts +66 -4
- package/types/fileReader.d.ts +31 -2
- package/types/safeDate.d.ts +29 -3
- package/types/utils/native.d.ts +1 -0
- package/esm/node_modules/.pnpm/emitter-pro@1.0.3/node_modules/emitter-pro/dist/emitter-pro.esm.js +0 -72
- package/lib/node_modules/.pnpm/emitter-pro@1.0.3/node_modules/emitter-pro/dist/emitter-pro.esm.js +0 -74
package/README.md
CHANGED
|
@@ -44,20 +44,32 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
44
44
|
> 数学计算,修正了浮点数计算问题,适用于金额计算。参考:[JS 浮点数计算测试](https://2zbuy.csb.app/)
|
|
45
45
|
|
|
46
46
|
- 数学计算
|
|
47
|
-
- [plus](https://doly-dev.github.io/util-helpers/module-Math.html#.plus) - 加
|
|
48
|
-
- [minus](https://doly-dev.github.io/util-helpers/module-Math.html#.minus) - 减
|
|
49
|
-
- [times](https://doly-dev.github.io/util-helpers/module-Math.html#.times) - 乘
|
|
50
47
|
- [divide](https://doly-dev.github.io/util-helpers/module-Math.html#.divide) - 除
|
|
51
|
-
- [round](https://doly-dev.github.io/util-helpers/module-Math.html#.round) - 四舍五入
|
|
52
48
|
- [gcd](https://doly-dev.github.io/util-helpers/module-Math.html#.gcd) - 最大公约数
|
|
53
49
|
- [lcm](https://doly-dev.github.io/util-helpers/module-Math.html#.lcm) - 最小公倍数
|
|
50
|
+
- [minus](https://doly-dev.github.io/util-helpers/module-Math.html#.minus) - 减
|
|
51
|
+
- [plus](https://doly-dev.github.io/util-helpers/module-Math.html#.plus) - 加
|
|
52
|
+
- [round](https://doly-dev.github.io/util-helpers/module-Math.html#.round) - 四舍五入
|
|
53
|
+
- [times](https://doly-dev.github.io/util-helpers/module-Math.html#.times) - 乘
|
|
54
|
+
- 其他
|
|
55
|
+
- [ajax](https://doly-dev.github.io/util-helpers/module-Other.html#.ajax) - 请求
|
|
56
|
+
- [calculateCursorPosition](https://doly-dev.github.io/util-helpers/module-Other.html#.calculateCursorPosition) - 计算光标位置
|
|
57
|
+
- [compressImage](https://doly-dev.github.io/util-helpers/module-Other.html#.compressImage) - 压缩图片
|
|
58
|
+
- [download](https://doly-dev.github.io/util-helpers/module-Other.html#.download) - 下载
|
|
59
|
+
- [getFileBlob](https://doly-dev.github.io/util-helpers/module-Other.html#.getFileBlob) - 获取文件 Blob
|
|
60
|
+
- [getImageInfo](https://doly-dev.github.io/util-helpers/module-Other.html#.getImageInfo) - 获取图片信息
|
|
61
|
+
- [loadImage](https://doly-dev.github.io/util-helpers/module-Other.html#.loadImage) - 加载图片
|
|
62
|
+
- [loadImageWithBlob](https://doly-dev.github.io/util-helpers/module-Other.html#.loadImageWithBlob) - 加载图片和 blob 对象
|
|
63
|
+
- [loadScript](https://doly-dev.github.io/util-helpers/module-Other.html#.loadScript) - 加载 js 文件
|
|
64
|
+
- [randomString](https://doly-dev.github.io/util-helpers/module-Other.html#.randomString) - 随机字符串
|
|
65
|
+
- [strlen](https://doly-dev.github.io/util-helpers/module-Other.html#.strlen) - 字符长度
|
|
54
66
|
- 数据处理
|
|
55
67
|
- [bytesToSize](https://doly-dev.github.io/util-helpers/module-Processor.html#.bytesToSize) - 字节转换为存储单位
|
|
56
68
|
- [dataURLToBlob](https://doly-dev.github.io/util-helpers/module-Processor.html#.dataURLToBlob) - 将 DataURL 转为 Blob 对象
|
|
57
69
|
- [fileReader](https://doly-dev.github.io/util-helpers/module-Processor.html#.fileReader) - 读取 Blob 或 File 对象,转为 Base64/String/ArrayBuffer
|
|
58
|
-
- [formatMoney](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMoney) - 格式化金额
|
|
59
|
-
- [formatMobile](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMobile) - 格式化手机号码
|
|
60
70
|
- [formatBankCard](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatBankCard) - 格式化银行卡
|
|
71
|
+
- [formatMobile](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMobile) - 格式化手机号码
|
|
72
|
+
- [formatMoney](https://doly-dev.github.io/util-helpers/module-Processor.html#.formatMoney) - 格式化金额
|
|
61
73
|
- [numberToChinese](https://doly-dev.github.io/util-helpers/module-Processor.html#.numberToChinese) - 数字转中文数字
|
|
62
74
|
- [padZero](https://doly-dev.github.io/util-helpers/module-Processor.html#.padZero) - 前置补零
|
|
63
75
|
- [parseIdCard](https://doly-dev.github.io/util-helpers/module-Processor.html#.parseIdCard) - 解析身份证号码
|
|
@@ -65,48 +77,36 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
65
77
|
- [safeDate](https://doly-dev.github.io/util-helpers/module-Processor.html#.safeDate) - 创建一个 Date 实例,同 new Date
|
|
66
78
|
- [setDataURLPrefix](https://doly-dev.github.io/util-helpers/module-Processor.html#.setDataURLPrefix) - 设置 DataURL 前缀、MIME 类型、base64 标识
|
|
67
79
|
- 树结构数据操作
|
|
80
|
+
- [filterTree](https://doly-dev.github.io/util-helpers/module-Processor.html#.filterTree) - 过滤树节点
|
|
68
81
|
- [findTreeNode](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeNode) - 查找树结构数据节点
|
|
69
82
|
- [findTreeNodes](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeNodes) - 查找树结构数据多个节点
|
|
70
83
|
- [findTreeSelect](https://doly-dev.github.io/util-helpers/module-Other.html#.findTreeSelect) - 查找包含当前节点的所有父级节点
|
|
71
|
-
- [filterTree](https://doly-dev.github.io/util-helpers/module-Processor.html#.filterTree) - 过滤树节点
|
|
72
84
|
- [listToTree](https://doly-dev.github.io/util-helpers/module-Processor.html#.listToTree) - 列表数据转树结构
|
|
73
85
|
- [transformFieldNames](https://doly-dev.github.io/util-helpers/module-Processor.html#.transformFieldNames) - 转换字段名
|
|
74
86
|
- [treeToList](https://doly-dev.github.io/util-helpers/module-Processor.html#.treeToList) - 树结构转列表数据
|
|
75
87
|
- 数据验证
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
88
|
+
- [isBankCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isBankCard) - 银行卡
|
|
89
|
+
- [isBusinessLicense](https://doly-dev.github.io/util-helpers/module-Validator.html#.isBusinessLicense) - 营业执照,也叫工商注册号
|
|
90
|
+
- [isChinese](https://doly-dev.github.io/util-helpers/module-Validator.html#.isChinese) - 中文
|
|
91
|
+
- [isEmail](https://doly-dev.github.io/util-helpers/module-Validator.html#.isEmail) - 邮箱
|
|
79
92
|
- [isHMCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isHMCard) - 港澳居民来往内地通行证,俗称回乡证或回乡卡
|
|
80
|
-
- [
|
|
93
|
+
- [isIPv4](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv4) - IPv4
|
|
94
|
+
- [isIPv6](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv6) - IPv6
|
|
81
95
|
- [isIdCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIdCard) - 身份证号
|
|
82
|
-
- [
|
|
96
|
+
- [isMobile](https://doly-dev.github.io/util-helpers/module-Validator.html#.isMobile) - 手机号码
|
|
97
|
+
- [isPassport](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPassport) - 护照号
|
|
98
|
+
- [isPassword](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPassword) 密码强度
|
|
99
|
+
- [isPostcode](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPostcode) - 邮政编码
|
|
83
100
|
- [isQQ](https://doly-dev.github.io/util-helpers/module-Validator.html#.isQQ) - QQ 号
|
|
84
|
-
- [isWX](https://doly-dev.github.io/util-helpers/module-Validator.html#.isWX) - 微信号
|
|
85
|
-
- [isVehicle](https://doly-dev.github.io/util-helpers/module-Validator.html#.isVehicle) - 车牌号
|
|
86
|
-
- [isBankCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isBankCard) - 银行卡
|
|
87
101
|
- [isSocialCreditCode](https://doly-dev.github.io/util-helpers/module-Validator.html#.isSocialCreditCode) - 统一社会信用代码,也叫三证合一组织代码
|
|
88
102
|
- [isSwiftCode](https://doly-dev.github.io/util-helpers/module-Validator.html#.isSwiftCode) - Swift Code
|
|
89
|
-
- [
|
|
90
|
-
- [
|
|
91
|
-
- [isChinese](https://doly-dev.github.io/util-helpers/module-Validator.html#.isChinese) - 中文
|
|
92
|
-
- [isIPv4](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv4) - IPv4
|
|
93
|
-
- [isIPv6](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv6) - IPv6
|
|
103
|
+
- [isTWCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isTWCard) - 台湾居民来往大陆通行证,俗称台胞证
|
|
104
|
+
- [isTelephone](https://doly-dev.github.io/util-helpers/module-Validator.html#.isTelephone) - 固定电话
|
|
94
105
|
- [isUrl](https://doly-dev.github.io/util-helpers/module-Validator.html#.isUrl) - URL
|
|
95
106
|
- [isValidNumber](https://doly-dev.github.io/util-helpers/module-Validator.html#.isValidNumber) - 有效数字
|
|
96
|
-
- [
|
|
107
|
+
- [isVehicle](https://doly-dev.github.io/util-helpers/module-Validator.html#.isVehicle) - 车牌号
|
|
108
|
+
- [isWX](https://doly-dev.github.io/util-helpers/module-Validator.html#.isWX) - 微信号
|
|
97
109
|
- [validatePassword](https://doly-dev.github.io/util-helpers/module-Validator.html#.validatePassword) - 验证密码
|
|
98
|
-
- 其他
|
|
99
|
-
- [ajax](https://doly-dev.github.io/util-helpers/module-Other.html#.ajax) - 请求
|
|
100
|
-
- [calculateCursorPosition](https://doly-dev.github.io/util-helpers/module-Other.html#.calculateCursorPosition) - 计算光标位置
|
|
101
|
-
- [compressImage](https://doly-dev.github.io/util-helpers/module-Other.html#.compressImage) - 压缩图片
|
|
102
|
-
- [download](https://doly-dev.github.io/util-helpers/module-Other.html#.download) - 下载
|
|
103
|
-
- [getFileBlob](https://doly-dev.github.io/util-helpers/module-Other.html#.getFileBlob) - 获取文件 Blob
|
|
104
|
-
- [getImageInfo](https://doly-dev.github.io/util-helpers/module-Other.html#.getImageInfo) - 获取图片信息
|
|
105
|
-
- [loadImage](https://doly-dev.github.io/util-helpers/module-Other.html#.loadImage) - 加载图片
|
|
106
|
-
- [loadImageWithBlob](https://doly-dev.github.io/util-helpers/module-Other.html#.loadImageWithBlob) - 加载图片和 blob 对象
|
|
107
|
-
- [loadScript](https://doly-dev.github.io/util-helpers/module-Other.html#.loadScript) - 加载 js 文件
|
|
108
|
-
- [randomString](https://doly-dev.github.io/util-helpers/module-Other.html#.randomString) - 随机字符串
|
|
109
|
-
- [strlen](https://doly-dev.github.io/util-helpers/module-Other.html#.strlen) - 字符长度
|
|
110
110
|
|
|
111
111
|
## 精选第三方工具库
|
|
112
112
|
|
package/dist/util-helpers.js
CHANGED
|
@@ -477,6 +477,7 @@
|
|
|
477
477
|
|
|
478
478
|
var URLExisted = typeof URL !== 'undefined';
|
|
479
479
|
|
|
480
|
+
var nativeUndefined = void 0;
|
|
480
481
|
var objectKeys = Object.keys;
|
|
481
482
|
var objectValues = Object.values;
|
|
482
483
|
var createObjectURL = URLExisted ? URL.createObjectURL : constant('');
|
|
@@ -510,7 +511,7 @@
|
|
|
510
511
|
var extendRegExp = loose ? looseChineseExtendRegExp : chineseExtendRegExp;
|
|
511
512
|
var hasExtend = useExtend && supportRegExpUnicode;
|
|
512
513
|
var resultRegExp = hasExtend ? extendRegExp : basicRegExp;
|
|
513
|
-
var flag = hasExtend ? 'u' :
|
|
514
|
+
var flag = hasExtend ? 'u' : nativeUndefined;
|
|
514
515
|
var reg = new RegExp(resultRegExp, flag);
|
|
515
516
|
return reg.test(valueStr);
|
|
516
517
|
}
|
|
@@ -1152,7 +1153,7 @@
|
|
|
1152
1153
|
dataURL: 'readAsDataURL',
|
|
1153
1154
|
text: 'readAsText'
|
|
1154
1155
|
};
|
|
1155
|
-
function
|
|
1156
|
+
var fileReader = function (blob, type) {
|
|
1156
1157
|
if (type === void 0) { type = 'dataURL'; }
|
|
1157
1158
|
var method = FileReaderMethodMap[type];
|
|
1158
1159
|
if (!method) {
|
|
@@ -1164,7 +1165,7 @@
|
|
|
1164
1165
|
reader.onload = function () { return resolve(reader.result); };
|
|
1165
1166
|
reader.onerror = function (error) { return reject(error); };
|
|
1166
1167
|
});
|
|
1167
|
-
}
|
|
1168
|
+
};
|
|
1168
1169
|
|
|
1169
1170
|
function blobToDataURL(blob) {
|
|
1170
1171
|
return fileReader(blob);
|
|
@@ -1194,7 +1195,7 @@
|
|
|
1194
1195
|
return toString(value);
|
|
1195
1196
|
}
|
|
1196
1197
|
|
|
1197
|
-
function
|
|
1198
|
+
var safeDate = function (value) {
|
|
1198
1199
|
var args = [];
|
|
1199
1200
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1200
1201
|
args[_i - 1] = arguments[_i];
|
|
@@ -1204,7 +1205,7 @@
|
|
|
1204
1205
|
return new (Date.bind.apply(Date, __spreadArray([void 0, safeValue], __read(args), false)))();
|
|
1205
1206
|
}
|
|
1206
1207
|
return typeof safeValue === 'undefined' ? new Date() : new Date(safeValue);
|
|
1207
|
-
}
|
|
1208
|
+
};
|
|
1208
1209
|
|
|
1209
1210
|
function formatMobile(mobileNo, options) {
|
|
1210
1211
|
if (mobileNo === void 0) { mobileNo = ''; }
|
|
@@ -1490,72 +1491,98 @@
|
|
|
1490
1491
|
|
|
1491
1492
|
var EmitterPro = /** @class */ (function () {
|
|
1492
1493
|
function EmitterPro() {
|
|
1493
|
-
this.
|
|
1494
|
+
this.handlers = {};
|
|
1494
1495
|
}
|
|
1495
1496
|
EmitterPro.prototype.eventNames = function () {
|
|
1496
|
-
|
|
1497
|
+
var _a;
|
|
1498
|
+
var symbols = ((_a = Object.getOwnPropertySymbols) === null || _a === void 0 ? void 0 : _a.call(Object, this.handlers)) || [];
|
|
1499
|
+
var keys = Object.keys(this.handlers);
|
|
1500
|
+
return keys.concat(symbols);
|
|
1501
|
+
};
|
|
1502
|
+
EmitterPro.prototype.rawListeners = function (eventName) {
|
|
1503
|
+
var handler = this.handlers[eventName];
|
|
1504
|
+
return handler ? handler.map(function (item) { return item.raw; }) : [];
|
|
1497
1505
|
};
|
|
1498
1506
|
EmitterPro.prototype.listeners = function (eventName) {
|
|
1499
|
-
|
|
1507
|
+
var handler = this.handlers[eventName];
|
|
1508
|
+
return handler ? handler.map(function (item) { return item.wrap; }) : [];
|
|
1500
1509
|
};
|
|
1501
1510
|
EmitterPro.prototype.hasListener = function (eventName, listener) {
|
|
1502
|
-
return this.
|
|
1511
|
+
return this.rawListeners(eventName).some(function (item) { return item === listener; });
|
|
1503
1512
|
};
|
|
1504
|
-
EmitterPro.prototype.
|
|
1505
|
-
if (
|
|
1506
|
-
|
|
1513
|
+
EmitterPro.prototype._on = function (eventName, raw, wrap, context, dir) {
|
|
1514
|
+
if (context === void 0) { context = null; }
|
|
1515
|
+
if (dir === void 0) { dir = 1; }
|
|
1516
|
+
var currentListener = { raw: raw, wrap: wrap, context: context };
|
|
1517
|
+
if (!this.handlers[eventName]) {
|
|
1518
|
+
this.handlers[eventName] = [currentListener];
|
|
1507
1519
|
}
|
|
1508
1520
|
else {
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
this.handler[eventName].push(listener);
|
|
1512
|
-
}
|
|
1521
|
+
var appendMethod = dir === 1 ? 'push' : 'unshift';
|
|
1522
|
+
this.handlers[eventName][appendMethod](currentListener);
|
|
1513
1523
|
}
|
|
1514
1524
|
return this;
|
|
1515
1525
|
};
|
|
1526
|
+
EmitterPro.prototype.prependListener = function (eventName, listener, context) {
|
|
1527
|
+
return this._on(eventName, listener, listener, context, 0);
|
|
1528
|
+
};
|
|
1529
|
+
EmitterPro.prototype.on = function (eventName, listener, context) {
|
|
1530
|
+
return this._on(eventName, listener, listener, context);
|
|
1531
|
+
};
|
|
1532
|
+
EmitterPro.prototype._wrapOnce = function (eventName, listener, context) {
|
|
1533
|
+
var _this = this;
|
|
1534
|
+
if (context === void 0) { context = null; }
|
|
1535
|
+
var wrap = (function () {
|
|
1536
|
+
var args = [];
|
|
1537
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1538
|
+
args[_i] = arguments[_i];
|
|
1539
|
+
}
|
|
1540
|
+
listener.apply(context, args);
|
|
1541
|
+
_this.off(eventName, wrap);
|
|
1542
|
+
});
|
|
1543
|
+
return wrap;
|
|
1544
|
+
};
|
|
1545
|
+
EmitterPro.prototype.once = function (eventName, listener, context) {
|
|
1546
|
+
var wrap = this._wrapOnce(eventName, listener, context);
|
|
1547
|
+
return this._on(eventName, listener, wrap, context);
|
|
1548
|
+
};
|
|
1549
|
+
EmitterPro.prototype.prependOnceListener = function (eventName, listener, context) {
|
|
1550
|
+
var wrap = this._wrapOnce(eventName, listener, context);
|
|
1551
|
+
return this._on(eventName, listener, wrap, context, 0);
|
|
1552
|
+
};
|
|
1516
1553
|
EmitterPro.prototype.off = function (eventName, listener) {
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1554
|
+
var handler = this.handlers[eventName];
|
|
1555
|
+
if (handler) {
|
|
1556
|
+
if (listener) {
|
|
1557
|
+
var index = handler.findIndex(function (item) { return item.wrap === listener || item.raw === listener; });
|
|
1558
|
+
if (index !== -1) {
|
|
1559
|
+
handler.splice(index, 1);
|
|
1560
|
+
}
|
|
1520
1561
|
}
|
|
1521
1562
|
else {
|
|
1522
|
-
delete this.
|
|
1563
|
+
delete this.handlers[eventName];
|
|
1523
1564
|
}
|
|
1524
1565
|
}
|
|
1525
1566
|
return this;
|
|
1526
1567
|
};
|
|
1568
|
+
EmitterPro.prototype.offAll = function () {
|
|
1569
|
+
this.handlers = {};
|
|
1570
|
+
return this;
|
|
1571
|
+
};
|
|
1527
1572
|
EmitterPro.prototype.emit = function (eventName) {
|
|
1528
1573
|
var args = [];
|
|
1529
1574
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
1530
1575
|
args[_i - 1] = arguments[_i];
|
|
1531
1576
|
}
|
|
1532
|
-
var
|
|
1533
|
-
if (
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
listener.apply(void 0, args);
|
|
1577
|
+
var handler = this.handlers[eventName];
|
|
1578
|
+
if (handler && handler.length > 0) {
|
|
1579
|
+
handler.forEach(function (listener) {
|
|
1580
|
+
listener.wrap.apply(listener.context, args);
|
|
1537
1581
|
});
|
|
1538
1582
|
return true;
|
|
1539
1583
|
}
|
|
1540
1584
|
return false;
|
|
1541
1585
|
};
|
|
1542
|
-
EmitterPro.prototype.once = function (eventName, listener) {
|
|
1543
|
-
var _this = this;
|
|
1544
|
-
var wrap = function () {
|
|
1545
|
-
var args = [];
|
|
1546
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1547
|
-
args[_i] = arguments[_i];
|
|
1548
|
-
}
|
|
1549
|
-
// eslint-disable-next-line prefer-spread
|
|
1550
|
-
listener.apply(void 0, args);
|
|
1551
|
-
_this.off(eventName, wrap);
|
|
1552
|
-
};
|
|
1553
|
-
return this.on(eventName, wrap);
|
|
1554
|
-
};
|
|
1555
|
-
EmitterPro.prototype.offAll = function () {
|
|
1556
|
-
this.handler = {};
|
|
1557
|
-
return this;
|
|
1558
|
-
};
|
|
1559
1586
|
return EmitterPro;
|
|
1560
1587
|
}());
|
|
1561
1588
|
|
|
@@ -1654,7 +1681,7 @@
|
|
|
1654
1681
|
}, type, quality);
|
|
1655
1682
|
});
|
|
1656
1683
|
}
|
|
1657
|
-
function
|
|
1684
|
+
var compressImage = function (img, options) {
|
|
1658
1685
|
if (options === void 0) { options = {}; }
|
|
1659
1686
|
return new Promise(function (resolve, reject) {
|
|
1660
1687
|
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;
|
|
@@ -1687,7 +1714,7 @@
|
|
|
1687
1714
|
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
1688
1715
|
}
|
|
1689
1716
|
var internalOffset = [0, 0];
|
|
1690
|
-
if (rotate !==
|
|
1717
|
+
if (rotate !== nativeUndefined) {
|
|
1691
1718
|
ctx.translate(image.width / 2, image.height / 2);
|
|
1692
1719
|
internalOffset = [-image.width / 2, -image.height / 2];
|
|
1693
1720
|
ctx.rotate((rotate * Math.PI) / 180);
|
|
@@ -1711,7 +1738,7 @@
|
|
|
1711
1738
|
})
|
|
1712
1739
|
.catch(reject);
|
|
1713
1740
|
});
|
|
1714
|
-
}
|
|
1741
|
+
};
|
|
1715
1742
|
|
|
1716
1743
|
function saver(blobUrl, fileName) {
|
|
1717
1744
|
if (fileName === void 0) { fileName = ''; }
|
|
@@ -1767,7 +1794,7 @@
|
|
|
1767
1794
|
case 5:
|
|
1768
1795
|
res = _a.sent();
|
|
1769
1796
|
currentFileName = fileName || data.split('?')[0].split('#')[0].split('/').pop();
|
|
1770
|
-
return [2, download(res, { fileName: currentFileName, type: type || (isBlob(res) ? res.type :
|
|
1797
|
+
return [2, download(res, { fileName: currentFileName, type: type || (isBlob(res) ? res.type : nativeUndefined) })];
|
|
1771
1798
|
case 6:
|
|
1772
1799
|
payload = new Blob([data], { type: type || 'text/plain' });
|
|
1773
1800
|
_a.label = 7;
|
|
@@ -2231,9 +2258,9 @@
|
|
|
2231
2258
|
return internalFindTreeSelect(tree, predicate, childrenField);
|
|
2232
2259
|
}
|
|
2233
2260
|
|
|
2234
|
-
var VERSION = "4.21.
|
|
2261
|
+
var VERSION = "4.21.6";
|
|
2235
2262
|
|
|
2236
|
-
var version = "4.21.
|
|
2263
|
+
var version = "4.21.6";
|
|
2237
2264
|
|
|
2238
2265
|
exports.VERSION = VERSION;
|
|
2239
2266
|
exports.ajax = ajax;
|