@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/dist/types.d.ts CHANGED
@@ -20,17 +20,6 @@ interface ICommonOption {
20
20
  code?: any;
21
21
  }
22
22
 
23
- type PropertyKey$1 = string | number | symbol;
24
- type PartialAll<T> = {
25
- [P in keyof T]?: T[P] extends Array<any> ? Partial<T[P][number]>[] : Partial<T[P]>;
26
- };
27
- type PartialSome<T, K extends keyof T> = {
28
- [P in K]?: T[P];
29
- } & Pick<T, Exclude<keyof T, K>>;
30
- type AnyObject<T = any> = {
31
- [x: string]: T;
32
- };
33
-
34
23
  /**
35
24
  * Sorts an array of items into groups. The return value is a map where the keys are
36
25
  * the group ids the given getGroupId function produced and the value is an array of
@@ -714,12 +703,21 @@ declare function size(value: any): number;
714
703
  declare function isNil(value: any): value is null | undefined;
715
704
  declare function toString(value: any): string;
716
705
  declare function cloneDeep<T>(value: T): T | null;
717
- declare function hasOwn(obj: AnyObject, key: PropertyKey): boolean;
718
706
 
719
707
  declare function safe_json_parse<T = any>(str?: any, retOnErr?: T | null): T | null;
720
708
  declare function safe_json_stringify(obj?: any): string;
721
709
  declare function safe_json_parse_arr<T = any>(str?: any, retOnErr?: T[]): T[];
722
710
 
711
+ type PartialAll<T> = {
712
+ [P in keyof T]?: T[P] extends Array<any> ? Partial<T[P][number]>[] : Partial<T[P]>;
713
+ };
714
+ type PartialSome<T, K extends keyof T> = {
715
+ [P in K]?: T[P];
716
+ } & Pick<T, Exclude<keyof T, K>>;
717
+ type AnyObject<T = any> = {
718
+ [x: string]: T;
719
+ };
720
+
723
721
  type TCommonFileType = 'application/vnd.ms-excel' | 'text/csv;charset=utf-8' | 'application/msword';
724
722
  declare function get_global(): typeof globalThis;
725
723
  declare function getSearchParamsValue(key: string): string | null;
@@ -739,7 +737,7 @@ declare function getFilledArray(n: number): any[];
739
737
  declare function copyText(text: string): boolean;
740
738
  declare function safeExec<T extends (...args: any) => any>(fn?: T, ...args: Parameters<T>): any;
741
739
  declare function safeGetFromFuncOrData(fn: any): any;
742
- declare function numberLikeCompare(a: number | string | boolean | null, b: number | string | boolean | null): boolean;
740
+ declare function numberLikeCompare(a: number | string | boolean, b: number | string | boolean): boolean;
743
741
  declare function warpBase64Type(str: string, type: 'img' | 'pdf'): string;
744
742
  declare function safe_number_parse(value: any, defaultValue?: number): number;
745
743
  declare function expect_array<T>(value?: T[] | null, default_v?: T[]): T[];
@@ -751,17 +749,16 @@ declare function gen_encoded_char_svg(props: {
751
749
  declare function base64_to_image(base64img: string): Promise<HTMLImageElement | null>;
752
750
  declare function image_to_base64(img_el: HTMLImageElement): string | null;
753
751
  declare function filter_obj_to_url_search(obj: Object | any[]): any;
754
- declare function safe_async_call<T extends (...args: any) => any>(cb?: T, ...args: Parameters<T>): Promise<ReturnType<T> | null>;
755
- declare function cache_fetch<T = any>(key: string, cb: () => Promise<T>, deep?: boolean): Promise<T>;
752
+ declare function safe_async_call<T extends (...args: any) => any>(cb: T, ...args: Parameters<T>): Promise<ReturnType<T> | null>;
753
+ declare function cache_fetch<T = any>(key: string, cb: () => Promise<T>): Promise<T>;
756
754
  declare function speculate_on_display(value?: any): string;
757
755
  declare function getFuckTimeInterval(star_hour?: number, end_hour?: number, min_interval?: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 15 | 20 | 30): string[];
758
756
  declare function random_word(): string[];
759
757
  declare function confirm_operation(): boolean;
760
758
  declare function simple_encrypt(data: AnyObject | any[]): number[] | null;
761
759
  declare function simple_decrypt(code: number[]): AnyObject | null;
762
- declare function simple_encrypt_str(data: string, sp?: string): string | null;
763
- declare function simple_decrypt_str(code: string, sp?: string): string | null;
764
- declare function text_ellipsis(text: string, max: number): string;
760
+ declare function simple_encrypt_str(data: string): string | null;
761
+ declare function simple_decrypt_str(code: string): string | null;
765
762
 
766
763
  interface ILL {
767
764
  log?(...optionalParams: any[]): void;
@@ -851,7 +848,6 @@ declare function getMomentRange(m?: any): {
851
848
  近一月: [dayjs.Dayjs, dayjs.Dayjs];
852
849
  下月: [dayjs.Dayjs, dayjs.Dayjs];
853
850
  近一年: [dayjs.Dayjs, dayjs.Dayjs];
854
- 年初至今: [dayjs.Dayjs, dayjs.Dayjs];
855
851
  };
856
852
  declare function presets_date(): {
857
853
  label: string;
@@ -880,6 +876,8 @@ type TOptions<T extends TOptionKey | TGetOptionKey> = T extends TOptionKey ? ICo
880
876
  declare function getSimpleOptions<T extends TOptionKey | TGetOptionKey>(_arr: T, options?: ISpectialOption): TOptions<T>;
881
877
  declare function getSameOptions<T extends TOptionKey | TGetOptionKey>(_arr: T): TOptions<T>;
882
878
  declare function getDualModeOptions<T extends TOptionKey | TGetOptionKey>(arr: T, options?: ISpectialOption): readonly [TOptions<T>, TOptions<T>];
879
+ type T_FETCH_OPTIONS = () => (Promise<ICommonOption[]> | ICommonOption[]);
880
+ declare function safe_fetch_options(cb: T_FETCH_OPTIONS): Promise<ICommonOption[]>;
883
881
  declare function getPresetOptions(key: string, pure?: boolean): ICommonOption[];
884
882
  declare function getOptionLabel(k: string, value: any, defaultLabel?: string): string;
885
883
  declare function getOptionValue(k: string, label: any): any;
@@ -921,22 +919,6 @@ declare function getDictionaryLabel(type: string, value: string | number): strin
921
919
  declare function getDictionaryValue(type: string, label: string): number | null | undefined;
922
920
  declare function merge_dict(ops: AnyObject<IDictionary>): void;
923
921
 
924
- interface IOpt {
925
- id?: string;
926
- text?: string;
927
- url?: string;
928
- debug?: boolean;
929
- allowExternal?: boolean;
930
- cache?: boolean;
931
- async?: boolean;
932
- type?: 'text/css' | 'text/javascript';
933
- charset?: string;
934
- }
935
- type TMixOpt = IOpt | string;
936
- declare function create_load_src(): (items: TMixOpt | TMixOpt[], node?: HTMLHeadElement) => Promise<Element> | Promise<Element[]>;
937
- declare function load_src(items: TMixOpt, node?: HTMLHeadElement): Promise<Element>;
938
- declare function load_src(items: TMixOpt[], node?: HTMLHeadElement): Promise<Element[]>;
939
-
940
922
  type EventCallback_Old = (data: any) => void;
941
923
  declare class EventEmitter_Old {
942
924
  /**
@@ -1299,5 +1281,5 @@ declare function temp_reander(config: {
1299
1281
  exclusive?: boolean;
1300
1282
  }): () => void;
1301
1283
 
1302
- export { ARG_URS1_KEY, ARG_URS2_KEY, AggregateError, AppEnv, BaseWsService, Browser, EMPTY_PLACEHOLDER, EnumItem, EventBus, EventEmitter, EventEmitter_Old, GetAgeByBirthDay, MyLog, ROMAN_NUMERALS, Request, TOKEN_KEY, all, alphabetical, appEnv, asRequest, 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, create_load_src, 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, hasOwn, identity, image_to_base64, inRange, intersects, invert, isArray, isBoolean, isDate, isEmpty, isEqual, isFloat, isFunction, isIE, isInt, isMoment, isNil, isNull, isNumber, isObject, isObjectLike, isPrimitive, isPromise, isString, isSymbol, iterate, keys, last, list, listify, load_src, 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_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, text_ellipsis, 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 };
1303
- export type { AnyObject, Dayjs, DayjsConfigType, EventCallback_Old, ICommonOption, IGlobalEnumItem, IRequest_AxiosRequestConfig, IRequest_ResponseError, IRequest_SpawnConfig, PartialAll, PartialSome, PropertyKey$1 as PropertyKey, TCommonFileType, TEventBus, TEventStore, TRequest_PreReq, TRequest_SimpleReq };
1284
+ export { ARG_URS1_KEY, ARG_URS2_KEY, AggregateError, AppEnv, BaseWsService, Browser, EMPTY_PLACEHOLDER, EnumItem, EventBus, EventEmitter, EventEmitter_Old, GetAgeByBirthDay, MyLog, ROMAN_NUMERALS, Request, TOKEN_KEY, all, alphabetical, appEnv, asRequest, 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, 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 };
1285
+ export type { AnyObject, Dayjs, DayjsConfigType, EventCallback_Old, ICommonOption, IGlobalEnumItem, IRequest_AxiosRequestConfig, IRequest_ResponseError, IRequest_SpawnConfig, PartialAll, PartialSome, TCommonFileType, TEventBus, TEventStore, TRequest_PreReq, TRequest_SimpleReq, T_FETCH_OPTIONS };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lm_fe/utils",
3
- "version": "0.1.201",
3
+ "version": "0.1.206",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -25,7 +25,7 @@
25
25
  "rollup": "^2.70.2"
26
26
  },
27
27
  "dependencies": {
28
- "@lm_fe/static": "*",
28
+ "@lm_fe/static": "0.1.201",
29
29
  "axios": ">=0.26.1",
30
30
  "dayjs": "^1.11.13",
31
31
  "lodash": "*",
@@ -35,5 +35,5 @@
35
35
  "keywords": [],
36
36
  "author": "",
37
37
  "license": "MIT",
38
- "gitHead": "ec1dcf6e3b2d06782779a21f536300bb2536ea6b"
38
+ "gitHead": "36b944bef26adebcfaa512d6aec57446507c6ec4"
39
39
  }