@fast-china/utils 1.0.4 → 1.0.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/dist/index.global.js +147 -119
- package/dist/index.global.js.map +1 -1
- package/dist/index.global.min.js +5 -5
- package/dist/index.global.min.js.map +1 -1
- package/es/array/index.d.ts +19 -0
- package/es/array/index.mjs +33 -0
- package/es/array/index.mjs.map +1 -0
- package/es/base64/index.d.ts +9 -0
- package/es/base64/index.mjs +7 -1
- package/es/base64/index.mjs.map +1 -1
- package/es/click/index.d.ts +3 -0
- package/es/click/index.mjs.map +1 -1
- package/es/color/index.d.ts +3 -0
- package/es/color/index.mjs +8 -7
- package/es/color/index.mjs.map +1 -1
- package/es/console/index.mjs.map +1 -1
- package/es/date/index.d.ts +17 -0
- package/es/date/index.mjs +17 -0
- package/es/date/index.mjs.map +1 -1
- package/es/env/index.d.ts +25 -0
- package/es/env/index.mjs +38 -0
- package/es/env/index.mjs.map +1 -0
- package/es/identity/index.mjs +1 -1
- package/es/identity/index.mjs.map +1 -1
- package/es/index.d.ts +2 -0
- package/es/index.mjs +4 -0
- package/es/index.mjs.map +1 -1
- package/es/object/index.d.ts +0 -12
- package/es/object/index.mjs +0 -97
- package/es/object/index.mjs.map +1 -1
- package/es/storage/index.mjs +3 -2
- package/es/storage/index.mjs.map +1 -1
- package/es/string/index.d.ts +21 -0
- package/es/string/index.mjs +40 -3
- package/es/string/index.mjs.map +1 -1
- package/es/vue/props.mjs.map +1 -1
- package/es/vue/useRender.mjs +2 -1
- package/es/vue/useRender.mjs.map +1 -1
- package/lib/array/index.d.ts +19 -0
- package/lib/array/index.js +2 -0
- package/lib/array/index.js.map +1 -0
- package/lib/base64/index.d.ts +9 -0
- package/lib/base64/index.js +1 -1
- package/lib/base64/index.js.map +1 -1
- package/lib/click/index.d.ts +3 -0
- package/lib/click/index.js.map +1 -1
- package/lib/color/index.d.ts +3 -0
- package/lib/color/index.js +1 -1
- package/lib/color/index.js.map +1 -1
- package/lib/console/index.js.map +1 -1
- package/lib/date/index.d.ts +17 -0
- package/lib/date/index.js.map +1 -1
- package/lib/env/index.d.ts +25 -0
- package/lib/env/index.js +2 -0
- package/lib/env/index.js.map +1 -0
- package/lib/identity/index.js +1 -1
- package/lib/identity/index.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -1
- package/lib/object/index.d.ts +0 -12
- package/lib/object/index.js +1 -1
- package/lib/object/index.js.map +1 -1
- package/lib/storage/index.js +1 -1
- package/lib/storage/index.js.map +1 -1
- package/lib/string/index.d.ts +21 -0
- package/lib/string/index.js +1 -1
- package/lib/string/index.js.map +1 -1
- package/lib/vue/props.js.map +1 -1
- package/lib/vue/useRender.js +1 -1
- package/lib/vue/useRender.js.map +1 -1
- package/package.json +9 -8
package/dist/index.global.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
var FastUtils = function(exports, vue) {
|
|
2
2
|
"use strict";
|
|
3
|
+
const arrayUtil = {
|
|
4
|
+
/**
|
|
5
|
+
* 是否存在重复值
|
|
6
|
+
* @param arr 数组
|
|
7
|
+
* @param prop 属性
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
hasDuplicateProperty(arr, prop) {
|
|
11
|
+
const values2 = arr.map((obj) => obj[prop]);
|
|
12
|
+
const uniqueValues = new Set(values2);
|
|
13
|
+
return values2.length !== uniqueValues.size;
|
|
14
|
+
},
|
|
15
|
+
/**
|
|
16
|
+
* 是否存在非重复值
|
|
17
|
+
* @param arr 数组
|
|
18
|
+
* @param prop 属性
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
hasDifferentProperty(arr, prop) {
|
|
22
|
+
const valueSet = /* @__PURE__ */ new Set();
|
|
23
|
+
for (const obj of arr) {
|
|
24
|
+
valueSet.add(obj[prop]);
|
|
25
|
+
if (valueSet.size > 1) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
3
32
|
const b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
|
4
|
-
const b64re = /^(?:[A-
|
|
33
|
+
const b64re = /^(?:[A-Z\d+/]{4})*?(?:[A-Z\d+/]{2}(?:==)?|[A-Z\d+/]{3}=?)?$/i;
|
|
5
34
|
const base64PwdDic = [
|
|
6
35
|
{ index: 977, randomIndex: 188 },
|
|
7
36
|
{ index: 926, randomIndex: 201 },
|
|
@@ -74,6 +103,9 @@ var FastUtils = function(exports, vue) {
|
|
|
74
103
|
return result2;
|
|
75
104
|
}
|
|
76
105
|
const base64Util = {
|
|
106
|
+
/**
|
|
107
|
+
* 将字符串编码为Base64格式
|
|
108
|
+
*/
|
|
77
109
|
bota(string2) {
|
|
78
110
|
string2 = String(string2);
|
|
79
111
|
let bitmap, a, b, c, result2 = "", i = 0, rest2 = string2.length % 3;
|
|
@@ -87,6 +119,9 @@ var FastUtils = function(exports, vue) {
|
|
|
87
119
|
}
|
|
88
120
|
return rest2 ? result2.slice(0, rest2 - 3) + "===".substring(rest2) : result2;
|
|
89
121
|
},
|
|
122
|
+
/**
|
|
123
|
+
* 将Base64编码的字符串解码回其原始格式。
|
|
124
|
+
*/
|
|
90
125
|
atob(string2) {
|
|
91
126
|
string2 = String(string2).replace(/[\t\n\f\r ]+/g, "");
|
|
92
127
|
if (!b64re.test(string2)) throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
|
|
@@ -206,6 +241,12 @@ var FastUtils = function(exports, vue) {
|
|
|
206
241
|
});
|
|
207
242
|
}
|
|
208
243
|
};
|
|
244
|
+
class FastError extends Error {
|
|
245
|
+
constructor(m) {
|
|
246
|
+
super(m);
|
|
247
|
+
this.name = "FastError";
|
|
248
|
+
}
|
|
249
|
+
}
|
|
209
250
|
const colorUtil = {
|
|
210
251
|
/**
|
|
211
252
|
* hex颜色转rgb颜色
|
|
@@ -214,8 +255,8 @@ var FastUtils = function(exports, vue) {
|
|
|
214
255
|
*/
|
|
215
256
|
hexToRgb(str) {
|
|
216
257
|
let hex = "";
|
|
217
|
-
const reg = /^#?[0-9A-
|
|
218
|
-
if (!reg.test(str)) throw new
|
|
258
|
+
const reg = /^#?[0-9A-F]{6}$/i;
|
|
259
|
+
if (!reg.test(str)) throw new FastError("输入错误的hex");
|
|
219
260
|
str = str.replace("#", "");
|
|
220
261
|
hex = str.match(/../g);
|
|
221
262
|
for (let i = 0; i < 3; i++) hex[i] = parseInt(hex[i], 16);
|
|
@@ -230,7 +271,7 @@ var FastUtils = function(exports, vue) {
|
|
|
230
271
|
*/
|
|
231
272
|
rgbToHex(r, g, b) {
|
|
232
273
|
const reg = /^\d{1,3}$/;
|
|
233
|
-
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) throw new
|
|
274
|
+
if (!reg.test(r) || !reg.test(g) || !reg.test(b)) throw new FastError("输入错误的rgb颜色值");
|
|
234
275
|
const hex = [r.toString(16), g.toString(16), b.toString(16)];
|
|
235
276
|
for (let i = 0; i < 3; i++) if (hex[i].length === 1) hex[i] = `0${hex[i]}`;
|
|
236
277
|
return `#${hex.join("")}`;
|
|
@@ -242,8 +283,8 @@ var FastUtils = function(exports, vue) {
|
|
|
242
283
|
* @returns 返回处理后的颜色值
|
|
243
284
|
*/
|
|
244
285
|
getDarkColor(color, level) {
|
|
245
|
-
const reg = /^#?[0-9A-
|
|
246
|
-
if (!reg.test(color)) throw new
|
|
286
|
+
const reg = /^#?[0-9A-F]{6}$/i;
|
|
287
|
+
if (!reg.test(color)) throw new FastError("输入错误的hex颜色值");
|
|
247
288
|
const rgb = this.hexToRgb(color);
|
|
248
289
|
for (let i = 0; i < 3; i++) rgb[i] = Math.round(20.5 * level + rgb[i] * (1 - level));
|
|
249
290
|
return this.rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
@@ -255,8 +296,8 @@ var FastUtils = function(exports, vue) {
|
|
|
255
296
|
* @returns 返回处理后的颜色值
|
|
256
297
|
*/
|
|
257
298
|
getLightColor(color, level) {
|
|
258
|
-
const reg = /^#?[0-9A-
|
|
259
|
-
if (!reg.test(color)) throw new
|
|
299
|
+
const reg = /^#?[0-9A-F]{6}$/i;
|
|
300
|
+
if (!reg.test(color)) throw new FastError("输入错误的hex颜色值");
|
|
260
301
|
const rgb = this.hexToRgb(color);
|
|
261
302
|
for (let i = 0; i < 3; i++) rgb[i] = Math.round(255 * level + rgb[i] * (1 - level));
|
|
262
303
|
return this.rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
@@ -6287,12 +6328,6 @@ var FastUtils = function(exports, vue) {
|
|
|
6287
6328
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
6288
6329
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
6289
6330
|
*/
|
|
6290
|
-
class FastError extends Error {
|
|
6291
|
-
constructor(m) {
|
|
6292
|
-
super(m);
|
|
6293
|
-
this.name = "FastError";
|
|
6294
|
-
}
|
|
6295
|
-
}
|
|
6296
6331
|
const consoleLog = (name, message, error) => {
|
|
6297
6332
|
if (error) {
|
|
6298
6333
|
console.log(`[Fast-Log-${name}]${message ? ` ${message}` : ""}`, error);
|
|
@@ -6338,7 +6373,7 @@ var FastUtils = function(exports, vue) {
|
|
|
6338
6373
|
return n && Object.prototype.hasOwnProperty.call(n, "default") && Object.keys(n).length === 1 ? n["default"] : n;
|
|
6339
6374
|
}
|
|
6340
6375
|
function getAugmentedNamespace(n) {
|
|
6341
|
-
if (n
|
|
6376
|
+
if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
|
|
6342
6377
|
var f = n.default;
|
|
6343
6378
|
if (typeof f == "function") {
|
|
6344
6379
|
var a = function a2() {
|
|
@@ -13319,6 +13354,10 @@ var FastUtils = function(exports, vue) {
|
|
|
13319
13354
|
return "";
|
|
13320
13355
|
}
|
|
13321
13356
|
},
|
|
13357
|
+
/**
|
|
13358
|
+
* 获取默认时间
|
|
13359
|
+
* @returns [00:00:00, 23:59:59]
|
|
13360
|
+
*/
|
|
13322
13361
|
getDefaultTime() {
|
|
13323
13362
|
const end = /* @__PURE__ */ new Date();
|
|
13324
13363
|
const start = /* @__PURE__ */ new Date();
|
|
@@ -13327,11 +13366,18 @@ var FastUtils = function(exports, vue) {
|
|
|
13327
13366
|
end.setHours(23, 59, 59);
|
|
13328
13367
|
return [start, end];
|
|
13329
13368
|
},
|
|
13369
|
+
/**
|
|
13370
|
+
* 获取简单的日期时间
|
|
13371
|
+
* @returns xxxx-xx-xx 00:00:00
|
|
13372
|
+
*/
|
|
13330
13373
|
getSimpleTime() {
|
|
13331
13374
|
const start = /* @__PURE__ */ new Date();
|
|
13332
13375
|
start.setHours(0, 0, 0);
|
|
13333
13376
|
return start;
|
|
13334
13377
|
},
|
|
13378
|
+
/**
|
|
13379
|
+
* 获取简单的日期时间范围
|
|
13380
|
+
*/
|
|
13335
13381
|
getSimpleShortcuts() {
|
|
13336
13382
|
return [
|
|
13337
13383
|
{
|
|
@@ -13380,6 +13426,9 @@ var FastUtils = function(exports, vue) {
|
|
|
13380
13426
|
}
|
|
13381
13427
|
];
|
|
13382
13428
|
},
|
|
13429
|
+
/**
|
|
13430
|
+
* 获取日期范围
|
|
13431
|
+
*/
|
|
13383
13432
|
getShortcuts() {
|
|
13384
13433
|
return [
|
|
13385
13434
|
{
|
|
@@ -13461,6 +13510,9 @@ var FastUtils = function(exports, vue) {
|
|
|
13461
13510
|
}
|
|
13462
13511
|
];
|
|
13463
13512
|
},
|
|
13513
|
+
/**
|
|
13514
|
+
* 判断传入的时间是否大于当前时间
|
|
13515
|
+
*/
|
|
13464
13516
|
getDisabledDate(time) {
|
|
13465
13517
|
return time.getTime() > Date.now();
|
|
13466
13518
|
}
|
|
@@ -13480,6 +13532,40 @@ var FastUtils = function(exports, vue) {
|
|
|
13480
13532
|
}
|
|
13481
13533
|
consoleWarn("document", "binding value must be a string or number");
|
|
13482
13534
|
};
|
|
13535
|
+
const envUtil = {
|
|
13536
|
+
/**
|
|
13537
|
+
* 是否为 Uni 环境
|
|
13538
|
+
* @returns
|
|
13539
|
+
*/
|
|
13540
|
+
isUni() {
|
|
13541
|
+
return typeof uni !== "undefined";
|
|
13542
|
+
},
|
|
13543
|
+
/**
|
|
13544
|
+
* 是否为 Web 环境(浏览器环境)
|
|
13545
|
+
* @returns
|
|
13546
|
+
*/
|
|
13547
|
+
isWeb() {
|
|
13548
|
+
return typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
13549
|
+
},
|
|
13550
|
+
/**
|
|
13551
|
+
* 是否为手机设备
|
|
13552
|
+
* @returns
|
|
13553
|
+
*/
|
|
13554
|
+
isMobile() {
|
|
13555
|
+
if (!this.isWeb()) return false;
|
|
13556
|
+
const ua = navigator.userAgent || "";
|
|
13557
|
+
return /Mobile|iPhone|Android.*Mobile|Windows Phone/i.test(ua);
|
|
13558
|
+
},
|
|
13559
|
+
/**
|
|
13560
|
+
* 是否为平板设备
|
|
13561
|
+
* @returns
|
|
13562
|
+
*/
|
|
13563
|
+
isIpad() {
|
|
13564
|
+
if (!this.isWeb()) return false;
|
|
13565
|
+
const ua = navigator.userAgent || "";
|
|
13566
|
+
return /iPad|Android(?!.*Mobile)|Tablet/i.test(ua);
|
|
13567
|
+
}
|
|
13568
|
+
};
|
|
13483
13569
|
const state$1 = vue.reactive({
|
|
13484
13570
|
prefix: "fast__",
|
|
13485
13571
|
expireSuffix: "__Expire",
|
|
@@ -13562,7 +13648,7 @@ var FastUtils = function(exports, vue) {
|
|
|
13562
13648
|
encrypt ?? (encrypt = state$1.crypto);
|
|
13563
13649
|
if (expire) {
|
|
13564
13650
|
if (isNaN(expire) || expire < 1) {
|
|
13565
|
-
throw new
|
|
13651
|
+
throw new FastError("有效期应为一个有效数值");
|
|
13566
13652
|
}
|
|
13567
13653
|
const expireData = {
|
|
13568
13654
|
time: Date.now(),
|
|
@@ -13669,7 +13755,7 @@ var FastUtils = function(exports, vue) {
|
|
|
13669
13755
|
encrypt ?? (encrypt = state$1.crypto);
|
|
13670
13756
|
if (expire) {
|
|
13671
13757
|
if (isNaN(expire) || expire < 1) {
|
|
13672
|
-
throw new
|
|
13758
|
+
throw new FastError("有效期应为一个有效数值");
|
|
13673
13759
|
}
|
|
13674
13760
|
const expireData = {
|
|
13675
13761
|
time: Date.now(),
|
|
@@ -13795,9 +13881,9 @@ var FastUtils = function(exports, vue) {
|
|
|
13795
13881
|
isJson(value) {
|
|
13796
13882
|
if (!isString(value)) return false;
|
|
13797
13883
|
value = value.replace(/\s/g, "").replace(/\n|\r/, "");
|
|
13798
|
-
if (/^\{
|
|
13799
|
-
if (/^\[
|
|
13800
|
-
return value.replace(/^\[/, "").replace(/\]$/, "").replace(
|
|
13884
|
+
if (/^\{.*?\}$/.test(value)) return /".*?":/.test(value);
|
|
13885
|
+
if (/^\[.*?\]$/.test(value)) {
|
|
13886
|
+
return value.replace(/^\[/, "").replace(/\]$/, "").replace(/\},\{/g, "}\n{").split(/\n/).map((s) => {
|
|
13801
13887
|
return stringUtil.isJson(s);
|
|
13802
13888
|
}).reduce((prev, curr) => {
|
|
13803
13889
|
return !!curr;
|
|
@@ -13805,6 +13891,43 @@ var FastUtils = function(exports, vue) {
|
|
|
13805
13891
|
}
|
|
13806
13892
|
return false;
|
|
13807
13893
|
},
|
|
13894
|
+
/**
|
|
13895
|
+
* 切割骆驼命名式字符串
|
|
13896
|
+
*/
|
|
13897
|
+
splitCamelCase(value) {
|
|
13898
|
+
if (!value) return [];
|
|
13899
|
+
if (value.length === 1) return [value];
|
|
13900
|
+
return value.split(new RegExp("(?=\\p{Lu}\\p{Ll})|(?<=\\p{Ll})(?=\\p{Lu})", "u")).filter((token) => token.length > 0);
|
|
13901
|
+
},
|
|
13902
|
+
/**
|
|
13903
|
+
* 将字符串转为 camelCase 格式,支持 - 或 _ 分隔的字符串
|
|
13904
|
+
* 例如:'hello-world' 或 'hello_world' => 'helloWorld'
|
|
13905
|
+
*/
|
|
13906
|
+
toCamelCase(value) {
|
|
13907
|
+
if (!value) return "";
|
|
13908
|
+
return value.replace(/[-_](\w)/g, (_, c) => c ? c.toUpperCase() : "");
|
|
13909
|
+
},
|
|
13910
|
+
/**
|
|
13911
|
+
* 字符串首字母大写
|
|
13912
|
+
*/
|
|
13913
|
+
firstCharToUpper(value) {
|
|
13914
|
+
if (!value) return "";
|
|
13915
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
13916
|
+
},
|
|
13917
|
+
/**
|
|
13918
|
+
* 字符串首字母小写
|
|
13919
|
+
*/
|
|
13920
|
+
firstCharToLower(value) {
|
|
13921
|
+
if (!value) return "";
|
|
13922
|
+
return value.charAt(0).toLowerCase() + value.slice(1);
|
|
13923
|
+
},
|
|
13924
|
+
/**
|
|
13925
|
+
* 截取指定长度的字符串
|
|
13926
|
+
*/
|
|
13927
|
+
subStringWithEllipsis(value, length, suffix = "...") {
|
|
13928
|
+
if (!value) return "";
|
|
13929
|
+
return value.length > length ? value.substring(0, length) + suffix : value;
|
|
13930
|
+
},
|
|
13808
13931
|
/**
|
|
13809
13932
|
* 生成随机字符串
|
|
13810
13933
|
*/
|
|
@@ -13868,7 +13991,7 @@ var FastUtils = function(exports, vue) {
|
|
|
13868
13991
|
cacheKey: "__DEVICE_ID",
|
|
13869
13992
|
deviceId: ""
|
|
13870
13993
|
});
|
|
13871
|
-
const uuidRegExp = /^[0-9a-
|
|
13994
|
+
const uuidRegExp = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
13872
13995
|
const makeIdentity = () => {
|
|
13873
13996
|
if (state.deviceId && uuidRegExp.test(state.deviceId)) {
|
|
13874
13997
|
Local.set(state.cacheKey, state.deviceId);
|
|
@@ -13905,103 +14028,6 @@ var FastUtils = function(exports, vue) {
|
|
|
13905
14028
|
}
|
|
13906
14029
|
}
|
|
13907
14030
|
return params;
|
|
13908
|
-
},
|
|
13909
|
-
/**
|
|
13910
|
-
* 是否存在重复值
|
|
13911
|
-
*/
|
|
13912
|
-
hasDuplicateProperty(arr, prop) {
|
|
13913
|
-
const values2 = arr.map((obj) => obj[prop]);
|
|
13914
|
-
const uniqueValues = new Set(values2);
|
|
13915
|
-
return values2.length !== uniqueValues.size;
|
|
13916
|
-
},
|
|
13917
|
-
/**
|
|
13918
|
-
* 是否存在非重复值
|
|
13919
|
-
*/
|
|
13920
|
-
hasDifferentProperty(arr, prop) {
|
|
13921
|
-
const valueSet = /* @__PURE__ */ new Set();
|
|
13922
|
-
for (const obj of arr) {
|
|
13923
|
-
valueSet.add(obj[prop]);
|
|
13924
|
-
if (valueSet.size > 1) {
|
|
13925
|
-
return true;
|
|
13926
|
-
}
|
|
13927
|
-
}
|
|
13928
|
-
return false;
|
|
13929
|
-
},
|
|
13930
|
-
/**
|
|
13931
|
-
* 时间处理翻译
|
|
13932
|
-
*/
|
|
13933
|
-
dateTimeFix(date2) {
|
|
13934
|
-
if (date2 !== null && date2 !== void 0 && date2) {
|
|
13935
|
-
if (typeof date2 === "string") {
|
|
13936
|
-
date2 = new Date(date2);
|
|
13937
|
-
}
|
|
13938
|
-
let timestamp = date2.getTime();
|
|
13939
|
-
if (timestamp.toString().length < 13) {
|
|
13940
|
-
const arrTimestamp = timestamp.toString().split("");
|
|
13941
|
-
for (let start = 0; start < 13; start++) {
|
|
13942
|
-
if (!arrTimestamp[start]) {
|
|
13943
|
-
arrTimestamp[start] = "0";
|
|
13944
|
-
}
|
|
13945
|
-
}
|
|
13946
|
-
timestamp = parseInt(arrTimestamp.join(""));
|
|
13947
|
-
}
|
|
13948
|
-
const minute = 1e3 * 60;
|
|
13949
|
-
const hour = minute * 60;
|
|
13950
|
-
const day = hour * 24;
|
|
13951
|
-
const month = day * 30;
|
|
13952
|
-
const curTime = (/* @__PURE__ */ new Date()).getTime();
|
|
13953
|
-
const diffValue = curTime - timestamp;
|
|
13954
|
-
const monthC = diffValue / month;
|
|
13955
|
-
const weekC = diffValue / (7 * day);
|
|
13956
|
-
const dayC = diffValue / day;
|
|
13957
|
-
const hourC = diffValue / hour;
|
|
13958
|
-
const minC = diffValue / minute;
|
|
13959
|
-
if (diffValue < 0) {
|
|
13960
|
-
const monthC1 = Math.abs(monthC);
|
|
13961
|
-
const weekC1 = Math.abs(weekC);
|
|
13962
|
-
const dayC1 = Math.abs(dayC);
|
|
13963
|
-
const hourC1 = Math.abs(hourC);
|
|
13964
|
-
const minC1 = Math.abs(minC);
|
|
13965
|
-
if (monthC1 > 12) {
|
|
13966
|
-
return `${parseInt(`${monthC1 / 12}`)}年后`;
|
|
13967
|
-
} else if (monthC1 >= 6) {
|
|
13968
|
-
return "半年后";
|
|
13969
|
-
} else if (monthC1 >= 1) {
|
|
13970
|
-
return `${parseInt(`${monthC1}`)}月后`;
|
|
13971
|
-
} else if (weekC1 > 2) {
|
|
13972
|
-
return "半月后";
|
|
13973
|
-
} else if (weekC1 >= 1) {
|
|
13974
|
-
return `${parseInt(`${weekC1}`)}周后`;
|
|
13975
|
-
} else if (dayC1 >= 1) {
|
|
13976
|
-
return `${parseInt(`${dayC1}`)}天后`;
|
|
13977
|
-
} else if (hourC1 >= 1) {
|
|
13978
|
-
return `${parseInt(`${hourC1}`)}小时后`;
|
|
13979
|
-
} else if (minC1 >= 1) {
|
|
13980
|
-
return `${parseInt(`${minC1}`)}分钟后`;
|
|
13981
|
-
}
|
|
13982
|
-
return "刚刚";
|
|
13983
|
-
}
|
|
13984
|
-
if (monthC > 12) {
|
|
13985
|
-
return `${parseInt(`${monthC / 12}`)}年前`;
|
|
13986
|
-
} else if (monthC >= 6) {
|
|
13987
|
-
return "半年前";
|
|
13988
|
-
} else if (monthC >= 1) {
|
|
13989
|
-
return `${parseInt(`${monthC}`)}月前`;
|
|
13990
|
-
} else if (weekC > 2) {
|
|
13991
|
-
return "半月前";
|
|
13992
|
-
} else if (weekC >= 1) {
|
|
13993
|
-
return `${parseInt(`${weekC}`)}周前`;
|
|
13994
|
-
} else if (dayC >= 1) {
|
|
13995
|
-
return `${parseInt(`${dayC}`)}天前`;
|
|
13996
|
-
} else if (hourC >= 1) {
|
|
13997
|
-
return `${parseInt(`${hourC}`)}小时前`;
|
|
13998
|
-
} else if (minC >= 1) {
|
|
13999
|
-
return `${parseInt(`${minC}`)}分钟前`;
|
|
14000
|
-
}
|
|
14001
|
-
return "刚刚";
|
|
14002
|
-
} else {
|
|
14003
|
-
return "";
|
|
14004
|
-
}
|
|
14005
14031
|
}
|
|
14006
14032
|
};
|
|
14007
14033
|
const useExpose = (expose, exposed) => {
|
|
@@ -14068,7 +14094,7 @@ var FastUtils = function(exports, vue) {
|
|
|
14068
14094
|
const useRender = (render) => {
|
|
14069
14095
|
const vm = vue.getCurrentInstance();
|
|
14070
14096
|
if (!vm) {
|
|
14071
|
-
throw new
|
|
14097
|
+
throw new FastError("useRender must be called from inside a setup function");
|
|
14072
14098
|
}
|
|
14073
14099
|
vm.render = render;
|
|
14074
14100
|
};
|
|
@@ -14081,6 +14107,7 @@ var FastUtils = function(exports, vue) {
|
|
|
14081
14107
|
exports.Local = Local;
|
|
14082
14108
|
exports.Session = Session;
|
|
14083
14109
|
exports.addUnit = addUnit;
|
|
14110
|
+
exports.arrayUtil = arrayUtil;
|
|
14084
14111
|
exports.base64Util = base64Util;
|
|
14085
14112
|
exports.clickUtil = clickUtil;
|
|
14086
14113
|
exports.colorUtil = colorUtil;
|
|
@@ -14091,6 +14118,7 @@ var FastUtils = function(exports, vue) {
|
|
|
14091
14118
|
exports.cryptoUtil = cryptoUtil;
|
|
14092
14119
|
exports.dateUtil = dateUtil;
|
|
14093
14120
|
exports.definePropType = definePropType;
|
|
14121
|
+
exports.envUtil = envUtil;
|
|
14094
14122
|
exports.execFunction = execFunction;
|
|
14095
14123
|
exports.makeSlots = makeSlots;
|
|
14096
14124
|
exports.objectUtil = objectUtil;
|