@lm_fe/utils 0.1.201 → 0.1.206
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 +1 -1
- package/dist/index.js +36 -206
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +19 -37
- package/package.json +3 -3
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2061,13 +2061,10 @@ function cloneDeep(value) {
|
|
|
2061
2061
|
return null;
|
|
2062
2062
|
}
|
|
2063
2063
|
}
|
|
2064
|
-
function hasOwn(obj, key) {
|
|
2065
|
-
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
2066
|
-
}
|
|
2067
2064
|
function safe_json_parse(str) {
|
|
2068
2065
|
var retOnErr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2069
2066
|
if (!str) return retOnErr;
|
|
2070
|
-
if (
|
|
2067
|
+
if (_typeof$1(str) === 'object') return str;
|
|
2071
2068
|
if (!isString(str)) return retOnErr;
|
|
2072
2069
|
try {
|
|
2073
2070
|
var v = JSON.parse(str);
|
|
@@ -2389,55 +2386,35 @@ function safe_async_call(cb) {
|
|
|
2389
2386
|
}, _callee8);
|
|
2390
2387
|
}));
|
|
2391
2388
|
}
|
|
2389
|
+
get_global().safe_async_call = safe_async_call;
|
|
2392
2390
|
var global_cache_map = {};
|
|
2393
|
-
function cache_fetch(
|
|
2394
|
-
return __awaiter(this,
|
|
2395
|
-
var deep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2396
|
-
return /*#__PURE__*/regenerator.mark(function _callee9() {
|
|
2397
|
-
var raw;
|
|
2398
|
-
return regenerator.wrap(function _callee9$(_context9) {
|
|
2399
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
2400
|
-
case 0:
|
|
2401
|
-
_context9.next = 2;
|
|
2402
|
-
return cache_fetch_inner(key, cb);
|
|
2403
|
-
case 2:
|
|
2404
|
-
raw = _context9.sent;
|
|
2405
|
-
return _context9.abrupt("return", deep ? cloneDeep(raw) : raw);
|
|
2406
|
-
case 4:
|
|
2407
|
-
case "end":
|
|
2408
|
-
return _context9.stop();
|
|
2409
|
-
}
|
|
2410
|
-
}, _callee9);
|
|
2411
|
-
})();
|
|
2412
|
-
});
|
|
2413
|
-
}
|
|
2414
|
-
function cache_fetch_inner(key, cb) {
|
|
2415
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee10() {
|
|
2391
|
+
function cache_fetch(key, cb) {
|
|
2392
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee9() {
|
|
2416
2393
|
var _a, conf;
|
|
2417
|
-
return regenerator.wrap(function
|
|
2418
|
-
while (1) switch (
|
|
2394
|
+
return regenerator.wrap(function _callee9$(_context9) {
|
|
2395
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
2419
2396
|
case 0:
|
|
2420
2397
|
conf = global_cache_map[key] = (_a = global_cache_map[key]) !== null && _a !== void 0 ? _a : {};
|
|
2421
2398
|
if (!conf.cache) {
|
|
2422
|
-
|
|
2399
|
+
_context9.next = 3;
|
|
2423
2400
|
break;
|
|
2424
2401
|
}
|
|
2425
|
-
return
|
|
2402
|
+
return _context9.abrupt("return", conf.cache);
|
|
2426
2403
|
case 3:
|
|
2427
2404
|
if (!conf.cache_promise) {
|
|
2428
|
-
|
|
2405
|
+
_context9.next = 5;
|
|
2429
2406
|
break;
|
|
2430
2407
|
}
|
|
2431
|
-
return
|
|
2408
|
+
return _context9.abrupt("return", conf.cache_promise);
|
|
2432
2409
|
case 5:
|
|
2433
|
-
return
|
|
2410
|
+
return _context9.abrupt("return", conf.cache_promise = cb().then(function (r) {
|
|
2434
2411
|
return conf.cache = r;
|
|
2435
2412
|
}));
|
|
2436
2413
|
case 6:
|
|
2437
2414
|
case "end":
|
|
2438
|
-
return
|
|
2415
|
+
return _context9.stop();
|
|
2439
2416
|
}
|
|
2440
|
-
},
|
|
2417
|
+
}, _callee9);
|
|
2441
2418
|
}));
|
|
2442
2419
|
}
|
|
2443
2420
|
function speculate_on_display(value) {
|
|
@@ -2502,34 +2479,19 @@ function simple_decrypt(code) {
|
|
|
2502
2479
|
}).join('');
|
|
2503
2480
|
return safe_json_parse(str);
|
|
2504
2481
|
}
|
|
2505
|
-
var SP = '@@';
|
|
2506
2482
|
function simple_encrypt_str(data) {
|
|
2507
|
-
var sp = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SP;
|
|
2508
2483
|
if (!data || !isString(data)) return null;
|
|
2509
2484
|
return data.split('').map(function (_, idx) {
|
|
2510
2485
|
return ~_.charCodeAt(0) + idx * 119;
|
|
2511
|
-
}).join(
|
|
2486
|
+
}).join('@@');
|
|
2512
2487
|
}
|
|
2513
2488
|
function simple_decrypt_str(code) {
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
var str = code.split(sp).map(function (_, idx) {
|
|
2489
|
+
if (!code || !isString(code)) return null;
|
|
2490
|
+
var str = code.split('@@').map(function (_, idx) {
|
|
2517
2491
|
return String.fromCharCode(~(+_ - idx * 119));
|
|
2518
2492
|
}).join('');
|
|
2519
2493
|
return str;
|
|
2520
2494
|
}
|
|
2521
|
-
function text_ellipsis(text, max) {
|
|
2522
|
-
if (!text || !isNumber(max)) return '';
|
|
2523
|
-
if (text.length <= max) return text;
|
|
2524
|
-
return text.slice(0, max) + '...';
|
|
2525
|
-
}
|
|
2526
|
-
Object.assign(get_global(), {
|
|
2527
|
-
safe_async_call: safe_async_call,
|
|
2528
|
-
simple_decrypt_str: simple_decrypt_str,
|
|
2529
|
-
simple_encrypt_str: simple_encrypt_str
|
|
2530
|
-
});
|
|
2531
|
-
// safe_check()
|
|
2532
|
-
|
|
2533
2495
|
function getFn(format) {
|
|
2534
2496
|
function f(s) {
|
|
2535
2497
|
if (isFunction(s === null || s === void 0 ? void 0 : s.format)) {
|
|
@@ -2572,8 +2534,7 @@ function getMomentRange() {
|
|
|
2572
2534
|
// 这月: [start(m).startOf('month'), end(m).endOf('month')] as DT,
|
|
2573
2535
|
近一月: [start(m).add(-1, 'month').add(1, 'day'), end(m)],
|
|
2574
2536
|
下月: [start(m).add(1, 'month').startOf('month'), end(m).add(1, 'month').endOf('month')],
|
|
2575
|
-
近一年: [start(m).add(-1, 'year').add(1, 'day'), end(m)]
|
|
2576
|
-
年初至今: [start(m).startOf('year'), end(m)]
|
|
2537
|
+
近一年: [start(m).add(-1, 'year').add(1, 'day'), end(m)]
|
|
2577
2538
|
};
|
|
2578
2539
|
}
|
|
2579
2540
|
function presets_date() {
|
|
@@ -3061,6 +3022,24 @@ function presetInput(_label) {
|
|
|
3061
3022
|
label: _label
|
|
3062
3023
|
};
|
|
3063
3024
|
}
|
|
3025
|
+
function safe_fetch_options(cb) {
|
|
3026
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/regenerator.mark(function _callee10() {
|
|
3027
|
+
var arr;
|
|
3028
|
+
return regenerator.wrap(function _callee10$(_context10) {
|
|
3029
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
3030
|
+
case 0:
|
|
3031
|
+
_context10.next = 2;
|
|
3032
|
+
return safe_async_call(cb);
|
|
3033
|
+
case 2:
|
|
3034
|
+
arr = _context10.sent;
|
|
3035
|
+
return _context10.abrupt("return", expect_array(arr));
|
|
3036
|
+
case 4:
|
|
3037
|
+
case "end":
|
|
3038
|
+
return _context10.stop();
|
|
3039
|
+
}
|
|
3040
|
+
}, _callee10);
|
|
3041
|
+
}));
|
|
3042
|
+
}
|
|
3064
3043
|
function getPresetOptions(key) {
|
|
3065
3044
|
var pure = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
3066
3045
|
var _a, _b;
|
|
@@ -3144,155 +3123,6 @@ function getDictionaryValue(type, label) {
|
|
|
3144
3123
|
function merge_dict(ops) {
|
|
3145
3124
|
Object.assign(dic_map, ops);
|
|
3146
3125
|
}
|
|
3147
|
-
function create_load_src() {
|
|
3148
|
-
var cache = {};
|
|
3149
|
-
var head_el = document.getElementsByTagName("head")[0] || document.documentElement;
|
|
3150
|
-
function exec(options, node) {
|
|
3151
|
-
var opt;
|
|
3152
|
-
if (typeof options === "string") {
|
|
3153
|
-
opt = {
|
|
3154
|
-
url: options,
|
|
3155
|
-
debug: false
|
|
3156
|
-
};
|
|
3157
|
-
} else {
|
|
3158
|
-
opt = options;
|
|
3159
|
-
}
|
|
3160
|
-
var cacheId = opt.id || opt.url;
|
|
3161
|
-
var cacheEntry = cache[cacheId];
|
|
3162
|
-
if (cacheEntry) {
|
|
3163
|
-
if (!!opt.debug) {
|
|
3164
|
-
console.log("load-js: cache hit", cacheId);
|
|
3165
|
-
}
|
|
3166
|
-
return cacheEntry;
|
|
3167
|
-
} else if (opt.allowExternal !== false) {
|
|
3168
|
-
var el = getScriptById(opt.id) || getScriptByUrl(opt.url);
|
|
3169
|
-
if (el) {
|
|
3170
|
-
var promise = Promise.resolve(el);
|
|
3171
|
-
if (cacheId) {
|
|
3172
|
-
cache[cacheId] = promise;
|
|
3173
|
-
}
|
|
3174
|
-
return promise;
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
if (!opt.url && !opt.text) {
|
|
3178
|
-
throw new Error("load-js: must provide a url or text to load");
|
|
3179
|
-
}
|
|
3180
|
-
var pending = (opt.url ? loadScript : runScript)(node, createEl(opt));
|
|
3181
|
-
if (cacheId && opt.cache !== false) {
|
|
3182
|
-
cache[cacheId] = pending;
|
|
3183
|
-
}
|
|
3184
|
-
return pending;
|
|
3185
|
-
}
|
|
3186
|
-
function runScript(head, el) {
|
|
3187
|
-
head.appendChild(el);
|
|
3188
|
-
return Promise.resolve(el);
|
|
3189
|
-
}
|
|
3190
|
-
function loadScript(head, el) {
|
|
3191
|
-
return new Promise(function (resolve, reject) {
|
|
3192
|
-
// Handle Script loading
|
|
3193
|
-
var done = false;
|
|
3194
|
-
// Attach handlers for all browsers.
|
|
3195
|
-
//
|
|
3196
|
-
// References:
|
|
3197
|
-
// http://stackoverflow.com/questions/4845762/onload-handler-for-script-tag-in-internet-explorer
|
|
3198
|
-
// http://stevesouders.com/efws/script-onload.php
|
|
3199
|
-
// https://www.html5rocks.com/en/tutorials/speed/script-loading/
|
|
3200
|
-
//
|
|
3201
|
-
//@ts-ignore
|
|
3202
|
-
el.onload = el.onreadystatechange = function () {
|
|
3203
|
-
//@ts-ignore
|
|
3204
|
-
if (!done && (!el.readyState || el.readyState === "loaded" || el.readyState === "complete")) {
|
|
3205
|
-
done = true;
|
|
3206
|
-
// Handle memory leak in IE
|
|
3207
|
-
//@ts-ignore
|
|
3208
|
-
el.onload = el.onreadystatechange = null;
|
|
3209
|
-
resolve(el);
|
|
3210
|
-
}
|
|
3211
|
-
};
|
|
3212
|
-
el.onerror = reject;
|
|
3213
|
-
head.appendChild(el);
|
|
3214
|
-
});
|
|
3215
|
-
}
|
|
3216
|
-
function createEl(opt) {
|
|
3217
|
-
var _a;
|
|
3218
|
-
if ((_a = opt.url) === null || _a === void 0 ? void 0 : _a.endsWith('css')) {
|
|
3219
|
-
return createLink(opt);
|
|
3220
|
-
}
|
|
3221
|
-
if (opt.type === 'text/css') {
|
|
3222
|
-
return createStyle(opt);
|
|
3223
|
-
}
|
|
3224
|
-
return createScript(opt);
|
|
3225
|
-
}
|
|
3226
|
-
function createScript(options) {
|
|
3227
|
-
var el = document.createElement("script");
|
|
3228
|
-
el.charset = options.charset || "utf-8";
|
|
3229
|
-
el.type = options.type || "text/javascript";
|
|
3230
|
-
el.async = !!options.async;
|
|
3231
|
-
el.id = options.id || options.url;
|
|
3232
|
-
//@ts-ignore
|
|
3233
|
-
el.loadJS = "watermark";
|
|
3234
|
-
if (options.url) {
|
|
3235
|
-
el.src = options.url;
|
|
3236
|
-
}
|
|
3237
|
-
if (options.text) {
|
|
3238
|
-
el.text = options.text;
|
|
3239
|
-
}
|
|
3240
|
-
return el;
|
|
3241
|
-
}
|
|
3242
|
-
function createLink(options) {
|
|
3243
|
-
var el = document.createElement("link");
|
|
3244
|
-
el.charset = options.charset || "utf-8";
|
|
3245
|
-
el.type = options.type || "text/css";
|
|
3246
|
-
el.id = options.id || options.url;
|
|
3247
|
-
el.rel = 'stylesheet';
|
|
3248
|
-
//@ts-ignore
|
|
3249
|
-
el.loadJS = "watermark";
|
|
3250
|
-
if (options.url) {
|
|
3251
|
-
el.href = options.url;
|
|
3252
|
-
}
|
|
3253
|
-
console.log('createLink', {
|
|
3254
|
-
options: options,
|
|
3255
|
-
el: el
|
|
3256
|
-
});
|
|
3257
|
-
return el;
|
|
3258
|
-
}
|
|
3259
|
-
function createStyle(options) {
|
|
3260
|
-
var el = document.createElement("style");
|
|
3261
|
-
el.id = options.id || options.text;
|
|
3262
|
-
//@ts-ignore
|
|
3263
|
-
el.loadJS = "watermark";
|
|
3264
|
-
if (options.text) {
|
|
3265
|
-
el.textContent = options.text;
|
|
3266
|
-
}
|
|
3267
|
-
return el;
|
|
3268
|
-
}
|
|
3269
|
-
function getScriptById(id) {
|
|
3270
|
-
var el = id && document.getElementById(id);
|
|
3271
|
-
//@ts-ignore
|
|
3272
|
-
if (el && el.loadJS !== "watermark") {
|
|
3273
|
-
console.warn("load-js: duplicate script with id:", id);
|
|
3274
|
-
return el;
|
|
3275
|
-
}
|
|
3276
|
-
}
|
|
3277
|
-
function getScriptByUrl(url) {
|
|
3278
|
-
var el = url && document.querySelector("script[src='" + url + "']");
|
|
3279
|
-
//@ts-ignore
|
|
3280
|
-
if (el && el.loadJS !== "watermark") {
|
|
3281
|
-
console.warn("load-js: duplicate script with url:", url);
|
|
3282
|
-
return el;
|
|
3283
|
-
}
|
|
3284
|
-
}
|
|
3285
|
-
return function load(items) {
|
|
3286
|
-
var node = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : head_el;
|
|
3287
|
-
return items instanceof Array ? Promise.all(items.map(function (_) {
|
|
3288
|
-
return exec(_, node);
|
|
3289
|
-
})) : exec(items, node);
|
|
3290
|
-
};
|
|
3291
|
-
}
|
|
3292
|
-
var load_src_ = create_load_src();
|
|
3293
|
-
function load_src(items, node) {
|
|
3294
|
-
return load_src_(items, node);
|
|
3295
|
-
}
|
|
3296
3126
|
|
|
3297
3127
|
// legacy
|
|
3298
3128
|
var EventEmitter_Old = /*#__PURE__*/function () {
|
|
@@ -4694,5 +4524,5 @@ function TempNode(props) {
|
|
|
4694
4524
|
fallback: /*#__PURE__*/React.createElement("div", null)
|
|
4695
4525
|
}, /*#__PURE__*/React.createElement(Comp, null));
|
|
4696
4526
|
}
|
|
4697
|
-
export { ARG_URS1_KEY$1 as ARG_URS1_KEY, ARG_URS2_KEY$1 as ARG_URS2_KEY, AppEnv, BaseWsService, Browser, EMPTY_PLACEHOLDER$1 as EMPTY_PLACEHOLDER, EnumItem, EventBus, EventEmitter, EventEmitter_Old, GetAgeByBirthDay, MyLog, ROMAN_NUMERALS, Request, TOKEN_KEY$1 as TOKEN_KEY, all, alphabetical, appEnv, asRequest, _assign as assign, base64ToBinary, base64_to_image, boil, cache_fetch, calEddByLmp, calGestationalWeekByLmp, calGestationalWeekBySureEdd, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, codeMessage, compose, confirm_operation, construct, copyText, counting,
|
|
4527
|
+
export { ARG_URS1_KEY$1 as ARG_URS1_KEY, ARG_URS2_KEY$1 as ARG_URS2_KEY, AppEnv, BaseWsService, Browser, EMPTY_PLACEHOLDER$1 as EMPTY_PLACEHOLDER, EnumItem, EventBus, EventEmitter, EventEmitter_Old, GetAgeByBirthDay, MyLog, ROMAN_NUMERALS, Request, TOKEN_KEY$1 as TOKEN_KEY, all, alphabetical, appEnv, asRequest, _assign as assign, base64ToBinary, base64_to_image, boil, cache_fetch, calEddByLmp, calGestationalWeekByLmp, calGestationalWeekBySureEdd, callable, camel, capitalize, chain, charToUTF8, charToUnicode, clone, cloneDeep, cluster, codeMessage, compose, confirm_operation, construct, copyText, counting, crush, dash, dayjs_quarter, debounce, defer, diff, diff_between, downloadFile, draw, event, expect_array, filter_obj_to_url_search, first, flat, fork, formatDate, formatDateTime, formatDateTimeNoSecond, formatRangeDate, formatRangeDateTime, formatTime, format_gp, fubaoRequest, genEnum, genHappyPath, gen_encoded_char_svg, gen_id_form_item_config, get, getBMI, getChromeVersion, getDataSource, getDays, getDictionaries, getDictionariesEnumerations, getDictionaryLabel, getDictionaryValue, getDiffYears, getDualModeOptions, getExpected, getFilledArray, getFuckTimeInterval, getFutureDate, getGesWeek, getGestationalDays, getGestationalWeekBySureEdd, getHappyConfig, getMomentObj, getMomentRange, getOptionLabel, getOptionValue, getOrderTime, getPresetOptions, getSameOptions, getSearchParamsAll, getSearchParamsValue, getSimpleOptions, getTimeSlice, get_global, get_global_happy_arg, group, guard, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, _isEqual as isEqual, isFloat, isFunction, isIE, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, lowerize, makeEventStore, map, mapEntries, mapKeys, mapValues, marshalGestationWeek, max, memo, menopauseWeek, merge, merge_dict, merge_preset_options, min, noop, numberLikeCompare, objectify, omit, optionKey不详, optionKey其他, optionKey否, parallel, partial, partob, pascal, pick, presets_date, protocolCheck, proxied, random, randomHex, random_word, range, rawRequest, reduce, replace, replaceOrAppend, request, retry, safeExec, safeGetFromFuncOrData, safe_async_call, safe_fetch_options, safe_json_parse, safe_json_parse_arr, safe_json_stringify, safe_number_parse, scrollIntoView, select, series, set, setSearchParamsAll, setSearchParamsValue, shake, shift, shuffle, sift, simple_decrypt, simple_decrypt_str, simple_encrypt, simple_encrypt_str, size, sleep, snake, sort, speculate_on_display, sum, temp_reander, template, throttle, title, toFloat, toInt, toString, toggle, transmit_happy, transmit_happy_pre, trim, tryit as try, tryit, uid, unicodeToChar, unicode_to_UTF8, unique, unmarshalGestationWeek, upperize, uuid, warpBase64Type, zip, zipToObject };
|
|
4698
4528
|
//# sourceMappingURL=index.js.map
|