@yelon/util 12.0.12 → 12.0.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,17 +11,14 @@ function notRecorded(...args) {
11
11
  }
12
12
  }
13
13
  function consoleCommonBehavior(consoleFunc, ...args) {
14
- if (ngDevMode && notRecorded(...args)) {
14
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) && notRecorded(...args)) {
15
15
  consoleFunc(...args);
16
16
  }
17
17
  }
18
18
  // Warning should only be printed in dev mode and only once.
19
19
  export const warn = (...args) => consoleCommonBehavior((...arg) => console.warn(PREFIX, ...arg), ...args);
20
- export const deprecation11 = (comp, from, to) => {
21
- warnDeprecation(`${comp} => '${from}' is going to be removed in 11.0.0${to ? `, Please use '${to}' instead` : ``}.`);
22
- };
23
20
  export const warnDeprecation = (...args) => {
24
- if (ngDevMode) {
21
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
25
22
  return () => { };
26
23
  }
27
24
  const stack = new Error().stack;
@@ -29,8 +26,8 @@ export const warnDeprecation = (...args) => {
29
26
  };
30
27
  // Log should only be printed in dev mode.
31
28
  export const log = (...args) => {
32
- if (ngDevMode) {
29
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
33
30
  console.log(PREFIX, ...args);
34
31
  }
35
32
  };
36
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9vdGhlci9sb2dnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsTUFBTSxNQUFNLEdBQTRCLEVBQUUsQ0FBQztBQUUzQyxNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsV0FBVyxDQUFDO0FBRWxDLFNBQVMsV0FBVyxDQUFDLEdBQUcsSUFBaUI7SUFDdkMsTUFBTSxRQUFRLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFD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iAgICBjb25zb2xlRnVuYyguLi5hcmdzKTtcbiAgfVxufVxuXG4vLyBXYXJuaW5nIHNob3VsZCBvbmx5IGJlIHByaW50ZWQgaW4gZGV2IG1vZGUgYW5kIG9ubHkgb25jZS5cbmV4cG9ydCBjb25zdCB3YXJuID0gKC4uLmFyZ3M6IE56U2FmZUFueVtdKTogdm9pZCA9PlxuICBjb25zb2xlQ29tbW9uQmVoYXZpb3IoKC4uLmFyZzogTnpTYWZlQW55W10pID0+IGNvbnNvbGUud2FybihQUkVGSVgsIC4uLmFyZyksIC4uLmFyZ3MpO1xuXG5leHBvcnQgY29uc3Qgd2FybkRlcHJlY2F0aW9uID0gKC4uLmFyZ3M6IE56U2FmZUFueVtdKTogTnpTYWZlQW55ID0+IHtcbiAgaWYgKHR5cGVvZiBuZ0Rldk1vZGUgPT09ICd1bmRlZmluZWQnIHx8IG5nRGV2TW9kZSkge1xuICAgIHJldHVybiAoKSA9PiB7fTtcbiAgfVxuICBjb25zdCBzdGFjayA9IG5ldyBFcnJvcigpLnN0YWNrO1xuICByZXR1cm4gY29uc29sZUNvbW1vbkJlaGF2aW9yKCguLi5hcmc6IE56U2FmZUFueVtdKSA9PiBjb25zb2xlLndhcm4oUFJFRklYLCAnZGVwcmVjYXRlZDonLCAuLi5hcmcsIHN0YWNrKSwgLi4uYXJncyk7XG59O1xuXG4vLyBMb2cgc2hvdWxkIG9ubHkgYmUgcHJpbnRlZCBpbiBkZXYgbW9kZS5cbmV4cG9ydCBjb25zdCBsb2cgPSAoLi4uYXJnczogTnpTYWZlQW55W10pOiB2b2lkID0+IHtcbiAgaWYgKHR5cGVvZiBuZ0Rldk1vZGUgPT09ICd1bmRlZmluZWQnIHx8IG5nRGV2TW9kZSkge1xuICAgIGNvbnNvbGUubG9nKFBSRUZJWCwgLi4uYXJncyk7XG4gIH1cbn07XG4iXX0=
@@ -1,8 +1,8 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable } from '@angular/core';
3
- import { NzTreeNode } from 'ng-zorro-antd/core/tree';
4
3
  import * as i1 from '@yelon/util/config';
5
4
  import { YunzaiConfigService } from '@yelon/util/config';
5
+ import { NzTreeNode } from 'ng-zorro-antd/core/tree';
6
6
 
7
7
  /* eslint-disable @typescript-eslint/no-explicit-any */
8
8
  class ArrayService {
@@ -1 +1 @@
1
- {"version":3,"file":"yelon-util-array.js","sources":["../../../../packages/util/array/array.service.ts","../../../../packages/util/array/yelon-util-array.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Injectable } from '@angular/core';\n\nimport { NzTreeNode } from 'ng-zorro-antd/core/tree';\n\nimport { YunzaiConfigService, YunzaiUtilArrayConfig } from '@yelon/util/config';\n\nimport {\n ArrayServiceArrToTreeNodeOptions,\n ArrayServiceArrToTreeOptions,\n ArrayServiceGetKeysByTreeNodeOptions,\n ArrayServiceGroupByResult,\n ArrayServiceTreeToArrOptions\n} from './array-type.service';\n\n@Injectable({ providedIn: 'root' })\nexport class ArrayService {\n private c: YunzaiUtilArrayConfig;\n\n constructor(cog: YunzaiConfigService) {\n this.c = cog.merge('utilArray', {\n deepMapName: 'deep',\n parentMapName: 'parent',\n idMapName: 'id',\n parentIdMapName: 'parent_id',\n childrenMapName: 'children',\n titleMapName: 'title',\n checkedMapname: 'checked',\n selectedMapname: 'selected',\n expandedMapname: 'expanded',\n disabledMapname: 'disabled'\n })!;\n }\n\n /**\n * Convert tree structure to array structure\n *\n * 将树结构转换成数组结构\n */\n treeToArr<T extends object = any>(tree: readonly T[], options?: ArrayServiceTreeToArrOptions<T>): T[] {\n const opt = {\n deepMapName: this.c.deepMapName,\n parentMapName: this.c.parentMapName,\n childrenMapName: this.c.childrenMapName,\n clearChildren: true,\n cb: null,\n ...options\n } as ArrayServiceTreeToArrOptions;\n const result: Array<{ [key: string]: any }> = [];\n const inFn = (list: ReadonlyArray<{ [key: string]: any }>, parent: T | null, deep: number = 0) => {\n for (const i of list) {\n i[opt.deepMapName!] = deep;\n i[opt.parentMapName!] = parent;\n if (opt.cb) {\n opt.cb(i, parent, deep);\n }\n result.push(i);\n const children = i[opt.childrenMapName!];\n if (children != null && Array.isArray(children) && children.length > 0) {\n inFn(children, i as T, deep + 1);\n }\n if (opt.clearChildren) {\n delete i[opt.childrenMapName!];\n }\n }\n };\n inFn(tree, null);\n return result as T[];\n }\n\n /**\n * Convert array structure to tree structure\n *\n * 数组转换成树数据\n */\n arrToTree<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeOptions<T>): T[] {\n if (!Array.isArray(arr) || arr.length === 0) {\n return [];\n }\n\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n childrenMapName: this.c.childrenMapName,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeOptions<T>;\n const tree: T[] = [];\n const childrenOf: { [key: string]: T[] } = {};\n let rootPid = opt.rootParentIdValue;\n const arrType = arr as ReadonlyArray<{ [key: string]: any }>;\n if (!rootPid) {\n const pids = arrType.map(i => i[opt.parentIdMapName!]);\n const emptyPid = pids.findIndex(w => w == null);\n rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];\n }\n for (const item of arrType) {\n const id = item[opt.idMapName!];\n const pid = item[opt.parentIdMapName!];\n childrenOf[id] = childrenOf[id] || [];\n item[opt.childrenMapName!] = childrenOf[id];\n if (opt.cb) {\n opt.cb(item as T);\n }\n if (pid !== rootPid) {\n childrenOf[pid] = childrenOf[pid] || [];\n childrenOf[pid].push(item as T);\n } else {\n tree.push(item as T);\n }\n }\n return tree;\n }\n\n /**\n * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项\n */\n arrToTreeNode<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeNodeOptions): NzTreeNode[] {\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n titleMapName: this.c.titleMapName,\n isLeafMapName: 'isLeaf',\n checkedMapname: this.c.checkedMapname,\n selectedMapname: this.c.selectedMapname,\n expandedMapname: this.c.expandedMapname,\n disabledMapname: this.c.disabledMapname,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeNodeOptions<T>;\n const tree = this.arrToTree<T>(arr, {\n idMapName: opt.idMapName,\n parentIdMapName: opt.parentIdMapName,\n childrenMapName: 'children'\n });\n this.visitTree<T>(tree, (item: { [key: string]: any }, parent, deep) => {\n item.key = item[opt.idMapName!];\n item.title = item[opt.titleMapName!];\n item.checked = item[opt.checkedMapname!];\n item.selected = item[opt.selectedMapname!];\n item.expanded = item[opt.expandedMapname!];\n item.disabled = item[opt.disabledMapname!];\n if (item[opt.isLeafMapName!] == null) {\n item.isLeaf = item.children.length === 0;\n } else {\n item.isLeaf = item[opt.isLeafMapName!];\n }\n if (opt.cb) {\n opt.cb(item as any, parent, deep);\n }\n });\n return tree.map(node => new NzTreeNode(node as any));\n }\n\n /**\n * 递归访问整个树\n */\n visitTree<T extends object = any>(\n tree: readonly T[],\n cb: (item: T, parent: T | null, deep: number) => void,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): void {\n options = {\n childrenMapName: this.c.childrenMapName,\n ...options\n };\n const inFn = (data: readonly T[], parent: T | null, deep: number) => {\n for (const item of data) {\n cb(item, parent, deep);\n const childrenVal = (item as { [key: string]: any })[options!.childrenMapName!];\n if (Array.isArray(childrenVal) && childrenVal.length > 0) {\n inFn(childrenVal, item, deep + 1);\n }\n }\n };\n inFn(tree, null, 1);\n }\n\n /**\n * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise\n *\n * 根据条件返回树的第一个值,否则返回 `undefined`\n */\n findTree<T extends object = any>(\n tree: readonly T[],\n predicate: (item: T) => boolean,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): T | undefined {\n let res: T | undefined;\n this.visitTree<T>(\n tree,\n item => {\n if (res === undefined && predicate(item)) {\n res = item;\n }\n },\n options\n );\n return res;\n }\n\n /**\n * 获取所有已经选中的 `key` 值\n */\n getKeysByTreeNode(tree: NzTreeNode[], options?: ArrayServiceGetKeysByTreeNodeOptions): any[] {\n const opt = {\n includeHalfChecked: true,\n ...options\n } as ArrayServiceGetKeysByTreeNodeOptions;\n const keys: any[] = [];\n this.visitTree<NzTreeNode>(tree, (item, parent, deep) => {\n if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {\n keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);\n }\n });\n return keys;\n }\n private baseFlat(array: any[], depth: number, result: any[] = []): any[] {\n let index = -1;\n while (++index < array.length) {\n const value = array[index];\n if (depth > 0 && Array.isArray(value)) {\n if (depth > 1) {\n this.baseFlat(value, depth - 1, result);\n } else {\n let pushIndex = -1;\n const offset = result.length;\n\n while (++pushIndex < value.length) {\n result[offset + pushIndex] = value[pushIndex];\n }\n }\n } else {\n result[result.length] = value;\n }\n }\n return result;\n }\n /**\n * Recursively flattens array\n *\n * 递归扁平数组\n * ```ts\n * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]\n * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]\n * ```\n */\n flat<T>(array: readonly T[], depth: number = 1 / 0): T[] {\n return Array.isArray(array) ? this.baseFlat(array as any[], depth) : (array as T[]);\n }\n /**\n * Group the array\n *\n * 对数组进行分组\n * ```ts\n * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {\"4\":[4.2],\"6\":[6.1,6.3]}\n * srv.groupBy(['one', 'two', 'three'], v => v.length) => {\"3\":[\"one\",\"two\"],\"5\":[\"three\"]}\n * ```\n */\n groupBy<T>(array: readonly T[], iteratee: (value: T) => string | number): ArrayServiceGroupByResult {\n if (!Array.isArray(array)) {\n return {};\n }\n return array.reduce((result, value) => {\n const key = iteratee(value);\n if (Object.prototype.hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n return result;\n }, {} as ArrayServiceGroupByResult);\n }\n /**\n * Creates a duplicate-free version of an array\n *\n * 创建去重后的数组\n * ```ts\n * uniq([1, 2, 2, 3, 1]) => [1,2,3]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{\"a\":1},{\"a\":2}]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{\"a\":1},{\"a\":2}]\n * ```\n */\n uniq<T>(array: readonly T[], predicate?: string | ((value: T) => string | number | boolean)): T[] {\n return Array.from(\n array\n .reduce((map, value) => {\n const key = predicate\n ? typeof predicate === 'string'\n ? (value as any)[predicate]\n : predicate!(value)\n : value;\n if (!map.has(key)) {\n map.set(key, value);\n }\n return map;\n }, new Map<string | number | boolean, T>())\n .values()\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;MAgBa,YAAY;IAGvB,YAAY,GAAwB;QAClC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9B,WAAW,EAAE,MAAM;YACnB,aAAa,EAAE,QAAQ;YACvB,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,WAAW;YAC5B,eAAe,EAAE,UAAU;YAC3B,YAAY,EAAE,OAAO;YACrB,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;SAC5B,CAAE,CAAC;KACL;;;;;;IAOD,SAAS,CAAyB,IAAkB,EAAE,OAAyC;QAC7F,MAAM,GAAG,GAAG,gBACV,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW,EAC/B,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa,EACnC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe,EACvC,aAAa,EAAE,IAAI,EACnB,EAAE,EAAE,IAAI,IACL,OAAO,CACqB,CAAC;QAClC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AK,QAAQ;sBAC1B,KAAa,CAAC,SAAS,CAAC;sBACzB,SAAU,CAAC,KAAK,CAAC;kBACnB,KAAK,CAAC;YACV,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBACjB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACrB;YACD,OAAO,GAAG,CAAC;SACZ,EAAE,IAAI,GAAG,EAAgC,CAAC;aAC1C,MAAM,EAAE,CACZ,CAAC;KACH;;;;YAlSF,UAAU,SAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;YAVzB,mBAAmB;;;ACL5B;;;;;;"}
1
+ {"version":3,"file":"yelon-util-array.js","sources":["../../../../packages/util/array/array.service.ts","../../../../packages/util/array/yelon-util-array.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { Injectable } from '@angular/core';\n\nimport { YunzaiConfigService, YunzaiUtilArrayConfig } from '@yelon/util/config';\nimport { NzTreeNode } from 'ng-zorro-antd/core/tree';\n\nimport {\n ArrayServiceArrToTreeNodeOptions,\n ArrayServiceArrToTreeOptions,\n ArrayServiceGetKeysByTreeNodeOptions,\n ArrayServiceGroupByResult,\n ArrayServiceTreeToArrOptions\n} from './array-type.service';\n\n@Injectable({ providedIn: 'root' })\nexport class ArrayService {\n private c: YunzaiUtilArrayConfig;\n\n constructor(cog: YunzaiConfigService) {\n this.c = cog.merge('utilArray', {\n deepMapName: 'deep',\n parentMapName: 'parent',\n idMapName: 'id',\n parentIdMapName: 'parent_id',\n childrenMapName: 'children',\n titleMapName: 'title',\n checkedMapname: 'checked',\n selectedMapname: 'selected',\n expandedMapname: 'expanded',\n disabledMapname: 'disabled'\n })!;\n }\n\n /**\n * Convert tree structure to array structure\n *\n * 将树结构转换成数组结构\n */\n treeToArr<T extends object = any>(tree: readonly T[], options?: ArrayServiceTreeToArrOptions<T>): T[] {\n const opt = {\n deepMapName: this.c.deepMapName,\n parentMapName: this.c.parentMapName,\n childrenMapName: this.c.childrenMapName,\n clearChildren: true,\n cb: null,\n ...options\n } as ArrayServiceTreeToArrOptions;\n const result: Array<{ [key: string]: any }> = [];\n const inFn = (list: ReadonlyArray<{ [key: string]: any }>, parent: T | null, deep: number = 0): void => {\n for (const i of list) {\n i[opt.deepMapName!] = deep;\n i[opt.parentMapName!] = parent;\n if (opt.cb) {\n opt.cb(i, parent, deep);\n }\n result.push(i);\n const children = i[opt.childrenMapName!];\n if (children != null && Array.isArray(children) && children.length > 0) {\n inFn(children, i as T, deep + 1);\n }\n if (opt.clearChildren) {\n delete i[opt.childrenMapName!];\n }\n }\n };\n inFn(tree, null);\n return result as T[];\n }\n\n /**\n * Convert array structure to tree structure\n *\n * 数组转换成树数据\n */\n arrToTree<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeOptions<T>): T[] {\n if (!Array.isArray(arr) || arr.length === 0) {\n return [];\n }\n\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n childrenMapName: this.c.childrenMapName,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeOptions<T>;\n const tree: T[] = [];\n const childrenOf: { [key: string]: T[] } = {};\n let rootPid = opt.rootParentIdValue;\n const arrType = arr as ReadonlyArray<{ [key: string]: any }>;\n if (!rootPid) {\n const pids = arrType.map(i => i[opt.parentIdMapName!]);\n const emptyPid = pids.findIndex(w => w == null);\n rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];\n }\n for (const item of arrType) {\n const id = item[opt.idMapName!];\n const pid = item[opt.parentIdMapName!];\n childrenOf[id] = childrenOf[id] || [];\n item[opt.childrenMapName!] = childrenOf[id];\n if (opt.cb) {\n opt.cb(item as T);\n }\n if (pid !== rootPid) {\n childrenOf[pid] = childrenOf[pid] || [];\n childrenOf[pid].push(item as T);\n } else {\n tree.push(item as T);\n }\n }\n return tree;\n }\n\n /**\n * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项\n */\n arrToTreeNode<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeNodeOptions): NzTreeNode[] {\n const opt = {\n idMapName: this.c.idMapName,\n parentIdMapName: this.c.parentIdMapName,\n titleMapName: this.c.titleMapName,\n isLeafMapName: 'isLeaf',\n checkedMapname: this.c.checkedMapname,\n selectedMapname: this.c.selectedMapname,\n expandedMapname: this.c.expandedMapname,\n disabledMapname: this.c.disabledMapname,\n cb: null,\n ...options\n } as ArrayServiceArrToTreeNodeOptions<T>;\n const tree = this.arrToTree<T>(arr, {\n idMapName: opt.idMapName,\n parentIdMapName: opt.parentIdMapName,\n childrenMapName: 'children'\n });\n this.visitTree<T>(tree, (item: { [key: string]: any }, parent, deep) => {\n item.key = item[opt.idMapName!];\n item.title = item[opt.titleMapName!];\n item.checked = item[opt.checkedMapname!];\n item.selected = item[opt.selectedMapname!];\n item.expanded = item[opt.expandedMapname!];\n item.disabled = item[opt.disabledMapname!];\n if (item[opt.isLeafMapName!] == null) {\n item.isLeaf = item.children.length === 0;\n } else {\n item.isLeaf = item[opt.isLeafMapName!];\n }\n if (opt.cb) {\n opt.cb(item as any, parent, deep);\n }\n });\n return tree.map(node => new NzTreeNode(node as any));\n }\n\n /**\n * 递归访问整个树\n */\n visitTree<T extends object = any>(\n tree: readonly T[],\n cb: (item: T, parent: T | null, deep: number) => void,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): void {\n options = {\n childrenMapName: this.c.childrenMapName,\n ...options\n };\n const inFn = (data: readonly T[], parent: T | null, deep: number): void => {\n for (const item of data) {\n cb(item, parent, deep);\n const childrenVal = (item as { [key: string]: any })[options!.childrenMapName!];\n if (Array.isArray(childrenVal) && childrenVal.length > 0) {\n inFn(childrenVal, item, deep + 1);\n }\n }\n };\n inFn(tree, null, 1);\n }\n\n /**\n * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise\n *\n * 根据条件返回树的第一个值,否则返回 `undefined`\n */\n findTree<T extends object = any>(\n tree: readonly T[],\n predicate: (item: T) => boolean,\n options?: {\n /** 子项名,默认:`'children'` */\n childrenMapName?: string;\n }\n ): T | undefined {\n let res: T | undefined;\n this.visitTree<T>(\n tree,\n item => {\n if (res === undefined && predicate(item)) {\n res = item;\n }\n },\n options\n );\n return res;\n }\n\n /**\n * 获取所有已经选中的 `key` 值\n */\n getKeysByTreeNode(tree: NzTreeNode[], options?: ArrayServiceGetKeysByTreeNodeOptions): any[] {\n const opt = {\n includeHalfChecked: true,\n ...options\n } as ArrayServiceGetKeysByTreeNodeOptions;\n const keys: any[] = [];\n this.visitTree<NzTreeNode>(tree, (item, parent, deep) => {\n if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {\n keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);\n }\n });\n return keys;\n }\n private baseFlat(array: any[], depth: number, result: any[] = []): any[] {\n let index = -1;\n while (++index < array.length) {\n const value = array[index];\n if (depth > 0 && Array.isArray(value)) {\n if (depth > 1) {\n this.baseFlat(value, depth - 1, result);\n } else {\n let pushIndex = -1;\n const offset = result.length;\n\n while (++pushIndex < value.length) {\n result[offset + pushIndex] = value[pushIndex];\n }\n }\n } else {\n result[result.length] = value;\n }\n }\n return result;\n }\n /**\n * Recursively flattens array\n *\n * 递归扁平数组\n * ```ts\n * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]\n * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]\n * ```\n */\n flat<T>(array: readonly T[], depth: number = 1 / 0): T[] {\n return Array.isArray(array) ? this.baseFlat(array as any[], depth) : (array as T[]);\n }\n /**\n * Group the array\n *\n * 对数组进行分组\n * ```ts\n * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {\"4\":[4.2],\"6\":[6.1,6.3]}\n * srv.groupBy(['one', 'two', 'three'], v => v.length) => {\"3\":[\"one\",\"two\"],\"5\":[\"three\"]}\n * ```\n */\n groupBy<T>(array: readonly T[], iteratee: (value: T) => string | number): ArrayServiceGroupByResult {\n if (!Array.isArray(array)) {\n return {};\n }\n return array.reduce((result, value) => {\n const key = iteratee(value);\n if (Object.prototype.hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n return result;\n }, {} as ArrayServiceGroupByResult);\n }\n /**\n * Creates a duplicate-free version of an array\n *\n * 创建去重后的数组\n * ```ts\n * uniq([1, 2, 2, 3, 1]) => [1,2,3]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{\"a\":1},{\"a\":2}]\n * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{\"a\":1},{\"a\":2}]\n * ```\n */\n uniq<T>(array: readonly T[], predicate?: string | ((value: T) => string | number | boolean)): T[] {\n return Array.from(\n array\n .reduce((map, value) => {\n const key = predicate\n ? typeof predicate === 'string'\n ? (value as any)[predicate]\n : predicate!(value)\n : value;\n if (!map.has(key)) {\n map.set(key, value);\n }\n return map;\n }, new Map<string | number | boolean, T>())\n .values()\n );\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;MAea,YAAY;IAGvB,YAAY,GAAwB;QAClC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9B,WAAW,EAAE,MAAM;YACnB,aAAa,EAAE,QAAQ;YACvB,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,WAAW;YAC5B,eAAe,EAAE,UAAU;YAC3B,YAAY,EAAE,OAAO;YACrB,cAAc,EAAE,SAAS;YACzB,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;YAC3B,eAAe,EAAE,UAAU;SAC5B,CAAE,CAAC;KACL;;;;;;IAOD,SAAS,CAAyB,IAAkB,EAAE,OAAyC;QAC7F,MAAM,GAAG,GAAG,gBACV,WAAW,EAAE,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,CAAC,CAAC;KACrC;;;;;;;;;;;IAWD,IAAI,CAAI,KAAmB,EAAE,SAA8D;QACzF,OAAO,KAAK,CAAC,IAAI,CACf,KAAK;aACF,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK;YACjB,MAAM,GAAG,GAAG,SAAS;kBACjB,OAAO,SAAS,KAAK,QAAQ;sBAC1B,KAAa,CAAC,SAAS,CAAC;sBACzB,SAAU,CAAC,KAAK,CAAC;kBACnB,KAAK,CAAC;YACV,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;gBACjB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;aACrB;YACD,OAAO,GAAG,CAAC;SACZ,EAAE,IAAI,GAAG,EAAgC,CAAC;aAC1C,MAAM,EAAE,CACZ,CAAC;KACH;;;;YAlSF,UAAU,SAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;YAXzB,mBAAmB;;;ACH5B;;;;;;"}
@@ -94,17 +94,14 @@ function notRecorded(...args) {
94
94
  }
95
95
  }
96
96
  function consoleCommonBehavior(consoleFunc, ...args) {
97
- if (ngDevMode && notRecorded(...args)) {
97
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) && notRecorded(...args)) {
98
98
  consoleFunc(...args);
99
99
  }
100
100
  }
101
101
  // Warning should only be printed in dev mode and only once.
102
102
  const warn = (...args) => consoleCommonBehavior((...arg) => console.warn(PREFIX, ...arg), ...args);
103
- const deprecation11 = (comp, from, to) => {
104
- warnDeprecation(`${comp} => '${from}' is going to be removed in 11.0.0${to ? `, Please use '${to}' instead` : ``}.`);
105
- };
106
103
  const warnDeprecation = (...args) => {
107
- if (ngDevMode) {
104
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
108
105
  return () => { };
109
106
  }
110
107
  const stack = new Error().stack;
@@ -112,7 +109,7 @@ const warnDeprecation = (...args) => {
112
109
  };
113
110
  // Log should only be printed in dev mode.
114
111
  const log = (...args) => {
115
- if (ngDevMode) {
112
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
116
113
  console.log(PREFIX, ...args);
117
114
  }
118
115
  };
@@ -299,5 +296,5 @@ function assertObservable(obj, msg) {
299
296
  * Generated bundle index. Do not edit.
300
297
  */
301
298
 
302
- export { LazyService, PREFIX, assert, assertArray, assertEmpty, assertNumber, assertObservable, assertString, deepCopy, deepGet, deepMerge, deepMergeKey, deprecation11, log, warn, warnDeprecation };
299
+ export { LazyService, PREFIX, assert, assertArray, assertEmpty, assertNumber, assertObservable, assertString, deepCopy, deepGet, deepMerge, deepMergeKey, log, warn, warnDeprecation };
303
300
  //# sourceMappingURL=yelon-util-other.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"yelon-util-other.js","sources":["../../../../packages/util/other/deep.ts","../../../../packages/util/other/logger.ts","../../../../packages/util/other/lazy.service.ts","../../../../packages/util/other/assert.ts","../../../../packages/util/other/yelon-util-other.ts"],"sourcesContent":["import extend from 'extend';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/**\n * Gets the value at `path` of `object`, like `_.get` in lodash.\n *\n * 类似 `_.get`,根据 `path` 获取安全值\n */\nexport function deepGet(obj: NzSafeAny, path: string | string[] | null | undefined, defaultValue?: unknown): NzSafeAny {\n if (!obj || path == null || path.length === 0) return defaultValue;\n if (!Array.isArray(path)) {\n path = ~path.indexOf('.') ? path.split('.') : [path];\n }\n if (path.length === 1) {\n const checkObj = obj[path[0]];\n return typeof checkObj === 'undefined' ? defaultValue : checkObj;\n }\n const res = path.reduce((o, k) => (o || {})[k], obj);\n return typeof res === 'undefined' ? defaultValue : res;\n}\n\n/**\n * Base on [extend](https://github.com/justmoon/node-extend) deep copy.\n *\n * 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝\n */\nexport function deepCopy<T extends { [key: string]: NzSafeAny } = NzSafeAny>(obj: T | null | undefined): T {\n const result = extend(true, {}, { _: obj });\n return result._ as T;\n}\n\n/**\n * Deep merge object.\n *\n * 深度合并对象\n *\n * @param original 原始对象\n * @param arrayProcessMethod 数组处理方式\n * - `true` 表示替换新值,不管新值为哪种类型\n * - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)\n * @param objects 要合并的对象\n */\nexport function deepMergeKey(original: unknown, arrayProcessMethod: boolean, ...objects: NzSafeAny[]): NzSafeAny {\n if (Array.isArray(original) || typeof original !== 'object') return original;\n\n const isObject = (v: unknown) => typeof v === 'object';\n\n const merge = (target: NzSafeAny, obj: NzSafeAny) => {\n Object.keys(obj)\n .filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))\n .forEach(key => {\n const fromValue = obj[key];\n const toValue = target[key];\n if (Array.isArray(toValue)) {\n target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];\n } else if (typeof fromValue === 'function') {\n target[key] = fromValue;\n } else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {\n target[key] = merge(toValue, fromValue);\n } else {\n target[key] = deepCopy(fromValue);\n }\n });\n return target;\n };\n\n objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));\n\n return original;\n}\n\n/**\n * Deep merge object.\n *\n * 深度合并对象\n */\nexport function deepMerge(original: unknown, ...objects: unknown[]): NzSafeAny {\n return deepMergeKey(original, false, ...objects);\n}\n","import type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\ndeclare const ngDevMode: boolean;\n\nconst record: Record<string, boolean> = {};\n\nexport const PREFIX = '[@YELON]:';\n\nfunction notRecorded(...args: NzSafeAny[]): boolean {\n const asRecord = args.reduce((acc, c) => acc + c.toString(), '');\n\n if (record[asRecord]) {\n return false;\n } else {\n record[asRecord] = true;\n return true;\n }\n}\n\nfunction consoleCommonBehavior(consoleFunc: (...args: NzSafeAny) => void, ...args: NzSafeAny[]): void {\n if (ngDevMode && notRecorded(...args)) {\n consoleFunc(...args);\n }\n}\n\n// Warning should only be printed in dev mode and only once.\nexport const warn = (...args: NzSafeAny[]) =>\n consoleCommonBehavior((...arg: NzSafeAny[]) => console.warn(PREFIX, ...arg), ...args);\n\nexport const deprecation11 = (comp: string, from: string, to?: string) => {\n warnDeprecation(`${comp} => '${from}' is going to be removed in 11.0.0${to ? `, Please use '${to}' instead` : ``}.`);\n};\n\nexport const warnDeprecation = (...args: NzSafeAny[]) => {\n if (ngDevMode) {\n return () => {};\n }\n const stack = new Error().stack;\n return consoleCommonBehavior((...arg: NzSafeAny[]) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);\n};\n\n// Log should only be printed in dev mode.\nexport const log = (...args: NzSafeAny[]) => {\n if (ngDevMode) {\n console.log(PREFIX, ...args);\n }\n};\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { filter, share } from 'rxjs/operators';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport interface LazyResult {\n path: string;\n status: 'ok' | 'error' | 'loading';\n error?: NzSafeAny;\n}\n\n/**\n * 延迟加载资源(js 或 css)服务\n */\n@Injectable({ providedIn: 'root' })\nexport class LazyService {\n private list: { [key: string]: boolean } = {};\n private cached: { [key: string]: LazyResult } = {};\n private _notify: BehaviorSubject<LazyResult[]> = new BehaviorSubject<LazyResult[]>([]);\n\n constructor(@Inject(DOCUMENT) private doc: NzSafeAny) {}\n\n get change(): Observable<LazyResult[]> {\n return this._notify.asObservable().pipe(\n share(),\n filter(ls => ls.length !== 0)\n );\n }\n\n clear(): void {\n this.list = {};\n this.cached = {};\n }\n\n load(paths: string | string[]): Promise<LazyResult[]> {\n if (!Array.isArray(paths)) {\n paths = [paths];\n }\n\n const promises: Array<Promise<LazyResult>> = [];\n paths.forEach(path => {\n if (path.endsWith('.js')) {\n promises.push(this.loadScript(path));\n } else {\n promises.push(this.loadStyle(path));\n }\n });\n\n return Promise.all(promises).then(res => {\n this._notify.next(res);\n return Promise.resolve(res);\n });\n }\n\n loadScript(path: string, innerContent?: string): Promise<LazyResult> {\n return new Promise(resolve => {\n if (this.list[path] === true) {\n resolve({ ...this.cached[path], status: 'loading' });\n return;\n }\n\n this.list[path] = true;\n const onSuccess = (item: LazyResult) => {\n this.cached[path] = item;\n resolve(item);\n this._notify.next([item]);\n };\n\n const node = this.doc.createElement('script') as NzSafeAny;\n node.type = 'text/javascript';\n node.src = path;\n node.charset = 'utf-8';\n if (innerContent) {\n node.innerHTML = innerContent;\n }\n if (node.readyState) {\n // IE\n node.onreadystatechange = () => {\n if (node.readyState === 'loaded' || node.readyState === 'complete') {\n node.onreadystatechange = null;\n onSuccess({\n path,\n status: 'ok'\n });\n }\n };\n } else {\n node.onload = () =>\n onSuccess({\n path,\n status: 'ok'\n });\n }\n node.onerror = (error: NzSafeAny) =>\n onSuccess({\n path,\n status: 'error',\n error\n });\n this.doc.getElementsByTagName('head')[0].appendChild(node);\n });\n }\n\n loadStyle(path: string, rel: string = 'stylesheet', innerContent?: string): Promise<LazyResult> {\n return new Promise(resolve => {\n if (this.list[path] === true) {\n resolve(this.cached[path]);\n return;\n }\n\n this.list[path] = true;\n\n const node = this.doc.createElement('link') as HTMLLinkElement;\n node.rel = rel;\n node.type = 'text/css';\n node.href = path;\n if (innerContent) {\n node.innerHTML = innerContent;\n }\n this.doc.getElementsByTagName('head')[0].appendChild(node);\n const item: LazyResult = {\n path,\n status: 'ok'\n };\n this.cached[path] = item;\n resolve(item);\n });\n }\n}\n","import { isObservable } from 'rxjs';\n\ndeclare const ngDevMode: boolean;\n\nfunction throwError(msg: string | null | undefined): void;\nfunction throwError(msg: string | null | undefined, actual: unknown, expected: unknown, comparison: string): void;\nfunction throwError(msg: string | null | undefined, actual?: unknown, expected?: unknown, comparison?: string): void {\n if (ngDevMode) {\n throw new Error(\n `ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`\n );\n }\n}\n\n/**\n * Assert whether the expression and throw an error into console in dev mode\n *\n * 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误\n */\nexport function assert(expression: boolean, msg?: string): void {\n if (!expression) {\n throwError(msg);\n }\n}\n\n/**\n * Assert whether empty (`null` or `undefined`)\n *\n * 断言是否空值(`null` 或 `undefined`)\n */\nexport function assertEmpty(actual: unknown, msg?: string): void {\n if (actual == null) {\n throwError(msg, typeof actual, 'NULL', '==');\n }\n}\n\n/**\n * Assert whether `number` type\n *\n * 断言是否 `number` 类型\n */\nexport function assertNumber(actual: unknown, msg?: string): void {\n if (!(typeof actual === 'number')) {\n throwError(msg, typeof actual, 'number', '===');\n }\n}\n\n/**\n * Assert whether `string` type\n *\n * 断言是否 `string` 类型\n */\nexport function assertString(actual: unknown, msg?: string): void {\n if (!(typeof actual === 'string')) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');\n }\n}\n\n/**\n * Assert whether `array` type\n *\n * 断言是否 `array` 类型\n */\nexport function assertArray(actual: unknown, msg?: string): void {\n if (!Array.isArray(actual)) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');\n }\n}\n\n/**\n * Assert whether `Observable` type\n *\n * 断言是否 `Observable` 类型\n */\nexport function assertObservable(obj: unknown, msg?: string): void {\n if (!isObservable(obj)) {\n throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAIA;;;;;SAKgB,OAAO,CAAC,GAAc,EAAE,IAA0C,EAAE,YAAsB;IACxG,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACxB,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACtD;IACD,IAAI,IAAI,CAAC,M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AK,CAAC,CAAC;KAC1E;AACH;;AC9EA;;;;;;"}
1
+ {"version":3,"file":"yelon-util-other.js","sources":["../../../../packages/util/other/deep.ts","../../../../packages/util/other/logger.ts","../../../../packages/util/other/lazy.service.ts","../../../../packages/util/other/assert.ts","../../../../packages/util/other/yelon-util-other.ts"],"sourcesContent":["import extend from 'extend';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\n/**\n * Gets the value at `path` of `object`, like `_.get` in lodash.\n *\n * 类似 `_.get`,根据 `path` 获取安全值\n */\nexport function deepGet(obj: NzSafeAny, path: string | string[] | null | undefined, defaultValue?: unknown): NzSafeAny {\n if (!obj || path == null || path.length === 0) return defaultValue;\n if (!Array.isArray(path)) {\n path = ~path.indexOf('.') ? path.split('.') : [path];\n }\n if (path.length === 1) {\n const checkObj = obj[path[0]];\n return typeof checkObj === 'undefined' ? defaultValue : checkObj;\n }\n const res = path.reduce((o, k) => (o || {})[k], obj);\n return typeof res === 'undefined' ? defaultValue : res;\n}\n\n/**\n * Base on [extend](https://github.com/justmoon/node-extend) deep copy.\n *\n * 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝\n */\nexport function deepCopy<T extends { [key: string]: NzSafeAny } = NzSafeAny>(obj: T | null | undefined): T {\n const result = extend(true, {}, { _: obj });\n return result._ as T;\n}\n\n/**\n * Deep merge object.\n *\n * 深度合并对象\n *\n * @param original 原始对象\n * @param arrayProcessMethod 数组处理方式\n * - `true` 表示替换新值,不管新值为哪种类型\n * - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)\n * @param objects 要合并的对象\n */\nexport function deepMergeKey(original: unknown, arrayProcessMethod: boolean, ...objects: NzSafeAny[]): NzSafeAny {\n if (Array.isArray(original) || typeof original !== 'object') return original;\n\n const isObject = (v: unknown): boolean => typeof v === 'object';\n\n const merge = (target: NzSafeAny, obj: NzSafeAny): NzSafeAny => {\n Object.keys(obj)\n .filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))\n .forEach(key => {\n const fromValue = obj[key];\n const toValue = target[key];\n if (Array.isArray(toValue)) {\n target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];\n } else if (typeof fromValue === 'function') {\n target[key] = fromValue;\n } else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {\n target[key] = merge(toValue, fromValue);\n } else {\n target[key] = deepCopy(fromValue);\n }\n });\n return target;\n };\n\n objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));\n\n return original;\n}\n\n/**\n * Deep merge object.\n *\n * 深度合并对象\n */\nexport function deepMerge(original: unknown, ...objects: unknown[]): NzSafeAny {\n return deepMergeKey(original, false, ...objects);\n}\n","import type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\ndeclare const ngDevMode: boolean;\n\nconst record: Record<string, boolean> = {};\n\nexport const PREFIX = '[@YELON]:';\n\nfunction notRecorded(...args: NzSafeAny[]): boolean {\n const asRecord = args.reduce((acc, c) => acc + c.toString(), '');\n\n if (record[asRecord]) {\n return false;\n } else {\n record[asRecord] = true;\n return true;\n }\n}\n\nfunction consoleCommonBehavior(consoleFunc: (...args: NzSafeAny) => void, ...args: NzSafeAny[]): void {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && notRecorded(...args)) {\n consoleFunc(...args);\n }\n}\n\n// Warning should only be printed in dev mode and only once.\nexport const warn = (...args: NzSafeAny[]): void =>\n consoleCommonBehavior((...arg: NzSafeAny[]) => console.warn(PREFIX, ...arg), ...args);\n\nexport const warnDeprecation = (...args: NzSafeAny[]): NzSafeAny => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n return () => {};\n }\n const stack = new Error().stack;\n return consoleCommonBehavior((...arg: NzSafeAny[]) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);\n};\n\n// Log should only be printed in dev mode.\nexport const log = (...args: NzSafeAny[]): void => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n console.log(PREFIX, ...args);\n }\n};\n","import { DOCUMENT } from '@angular/common';\nimport { Inject, Injectable } from '@angular/core';\nimport { BehaviorSubject, Observable } from 'rxjs';\nimport { filter, share } from 'rxjs/operators';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport interface LazyResult {\n path: string;\n status: 'ok' | 'error' | 'loading';\n error?: NzSafeAny;\n}\n\n/**\n * 延迟加载资源(js 或 css)服务\n */\n@Injectable({ providedIn: 'root' })\nexport class LazyService {\n private list: { [key: string]: boolean } = {};\n private cached: { [key: string]: LazyResult } = {};\n private _notify: BehaviorSubject<LazyResult[]> = new BehaviorSubject<LazyResult[]>([]);\n\n constructor(@Inject(DOCUMENT) private doc: NzSafeAny) {}\n\n get change(): Observable<LazyResult[]> {\n return this._notify.asObservable().pipe(\n share(),\n filter(ls => ls.length !== 0)\n );\n }\n\n clear(): void {\n this.list = {};\n this.cached = {};\n }\n\n load(paths: string | string[]): Promise<LazyResult[]> {\n if (!Array.isArray(paths)) {\n paths = [paths];\n }\n\n const promises: Array<Promise<LazyResult>> = [];\n paths.forEach(path => {\n if (path.endsWith('.js')) {\n promises.push(this.loadScript(path));\n } else {\n promises.push(this.loadStyle(path));\n }\n });\n\n return Promise.all(promises).then(res => {\n this._notify.next(res);\n return Promise.resolve(res);\n });\n }\n\n loadScript(path: string, innerContent?: string): Promise<LazyResult> {\n return new Promise(resolve => {\n if (this.list[path] === true) {\n resolve({ ...this.cached[path], status: 'loading' });\n return;\n }\n\n this.list[path] = true;\n const onSuccess = (item: LazyResult): void => {\n this.cached[path] = item;\n resolve(item);\n this._notify.next([item]);\n };\n\n const node = this.doc.createElement('script') as NzSafeAny;\n node.type = 'text/javascript';\n node.src = path;\n node.charset = 'utf-8';\n if (innerContent) {\n node.innerHTML = innerContent;\n }\n if (node.readyState) {\n // IE\n node.onreadystatechange = () => {\n if (node.readyState === 'loaded' || node.readyState === 'complete') {\n node.onreadystatechange = null;\n onSuccess({\n path,\n status: 'ok'\n });\n }\n };\n } else {\n node.onload = () =>\n onSuccess({\n path,\n status: 'ok'\n });\n }\n node.onerror = (error: NzSafeAny) =>\n onSuccess({\n path,\n status: 'error',\n error\n });\n this.doc.getElementsByTagName('head')[0].appendChild(node);\n });\n }\n\n loadStyle(path: string, rel: string = 'stylesheet', innerContent?: string): Promise<LazyResult> {\n return new Promise(resolve => {\n if (this.list[path] === true) {\n resolve(this.cached[path]);\n return;\n }\n\n this.list[path] = true;\n\n const node = this.doc.createElement('link') as HTMLLinkElement;\n node.rel = rel;\n node.type = 'text/css';\n node.href = path;\n if (innerContent) {\n node.innerHTML = innerContent;\n }\n this.doc.getElementsByTagName('head')[0].appendChild(node);\n const item: LazyResult = {\n path,\n status: 'ok'\n };\n this.cached[path] = item;\n resolve(item);\n });\n }\n}\n","import { isObservable } from 'rxjs';\n\ndeclare const ngDevMode: boolean;\n\nfunction throwError(msg: string | null | undefined): void;\nfunction throwError(msg: string | null | undefined, actual: unknown, expected: unknown, comparison: string): void;\nfunction throwError(msg: string | null | undefined, actual?: unknown, expected?: unknown, comparison?: string): void {\n if (ngDevMode) {\n throw new Error(\n `ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`\n );\n }\n}\n\n/**\n * Assert whether the expression and throw an error into console in dev mode\n *\n * 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误\n */\nexport function assert(expression: boolean, msg?: string): void {\n if (!expression) {\n throwError(msg);\n }\n}\n\n/**\n * Assert whether empty (`null` or `undefined`)\n *\n * 断言是否空值(`null` 或 `undefined`)\n */\nexport function assertEmpty(actual: unknown, msg?: string): void {\n if (actual == null) {\n throwError(msg, typeof actual, 'NULL', '==');\n }\n}\n\n/**\n * Assert whether `number` type\n *\n * 断言是否 `number` 类型\n */\nexport function assertNumber(actual: unknown, msg?: string): void {\n if (!(typeof actual === 'number')) {\n throwError(msg, typeof actual, 'number', '===');\n }\n}\n\n/**\n * Assert whether `string` type\n *\n * 断言是否 `string` 类型\n */\nexport function assertString(actual: unknown, msg?: string): void {\n if (!(typeof actual === 'string')) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');\n }\n}\n\n/**\n * Assert whether `array` type\n *\n * 断言是否 `array` 类型\n */\nexport function assertArray(actual: unknown, msg?: string): void {\n if (!Array.isArray(actual)) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');\n }\n}\n\n/**\n * Assert whether `Observable` type\n *\n * 断言是否 `Observable` 类型\n */\nexport function assertObservable(obj: unknown, msg?: string): void {\n if (!isObservable(obj)) {\n throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAIA;;;;;SAKgB,OAAO,CAAC,GAAc,EAAE,IAA0C,EAAE,YAAsB;IACxG,IAAI,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IACnE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACxB,IAAI,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACtD;IACD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9B,OAAO,OAAO,QAAQ,KAAK,WAAW,GAAG,YAAY,GAAG,QAAQ,CAAC;KAClE;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACrD,OAAO,OAAO,GAAG,KAAK,WAAW,GAAG,YAAY,GAAG,GAAG,CAAC;AACzD,CAAC;AAED;;;;;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AG,EAAE,OAAO,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;KACjD;AACH,CAAC;AAED;;;;;SAKgB,YAAY,CAAC,MAAe,EAAE,GAAY;IACxD,IAAI,EAAE,OAAO,MAAM,KAAK,QAAQ,CAAC,EAAE;QACjC,UAAU,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;KAC5E;AACH,CAAC;AAED;;;;;SAKgB,WAAW,CAAC,MAAe,EAAE,GAAY;IACvD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC1B,UAAU,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;KAC3E;AACH,CAAC;AAED;;;;;SAKgB,gBAAgB,CAAC,GAAY,EAAE,GAAY;IACzD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE;QACtB,UAAU,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;KAC1E;AACH;;AC9EA;;;;;;"}
package/other/logger.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import type { NzSafeAny } from 'ng-zorro-antd/core/types';
2
2
  export declare const PREFIX = "[@YELON]:";
3
3
  export declare const warn: (...args: NzSafeAny[]) => void;
4
- export declare const deprecation11: (comp: string, from: string, to?: string | undefined) => void;
5
- export declare const warnDeprecation: (...args: NzSafeAny[]) => void | (() => void);
4
+ export declare const warnDeprecation: (...args: NzSafeAny[]) => NzSafeAny;
6
5
  export declare const log: (...args: NzSafeAny[]) => void;
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"deepGet":{"__symbolic":"function"},"deepCopy":{"__symbolic":"function"},"deepMergeKey":{"__symbolic":"function"},"deepMerge":{"__symbolic":"function","parameters":["original","objects"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"deepMergeKey"},"arguments":[{"__symbolic":"reference","name":"original"},false,{"__symbolic":"spread","expression":{"__symbolic":"reference","name":"objects"}}]}},"PREFIX":"[@YELON]:","warn":{"__symbolic":"error","message":"Lambda not supported","line":26,"character":20,"module":"./logger"},"deprecation11":{"__symbolic":"error","message":"Lambda not supported","line":29,"character":29,"module":"./logger"},"warnDeprecation":{"__symbolic":"error","message":"Lambda not supported","line":33,"character":31,"module":"./logger"},"log":{"__symbolic":"error","message":"Lambda not supported","line":42,"character":19,"module":"./logger"},"LazyResult":{"__symbolic":"interface"},"LazyService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":16,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":22,"character":15},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":22,"character":22}]}]],"parameters":[{"__symbolic":"reference","module":"ng-zorro-antd/core/types","name":"NzSafeAny","line":22,"character":45}]}],"clear":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}],"loadScript":[{"__symbolic":"method"}],"loadStyle":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"assert":{"__symbolic":"function"},"assertEmpty":{"__symbolic":"function"},"assertNumber":{"__symbolic":"function"},"assertString":{"__symbolic":"function"},"assertArray":{"__symbolic":"function"},"assertObservable":{"__symbolic":"function"}},"origins":{"deepGet":"./deep","deepCopy":"./deep","deepMergeKey":"./deep","deepMerge":"./deep","PREFIX":"./logger","warn":"./logger","deprecation11":"./logger","warnDeprecation":"./logger","log":"./logger","LazyResult":"./lazy.service","LazyService":"./lazy.service","assert":"./assert","assertEmpty":"./assert","assertNumber":"./assert","assertString":"./assert","assertArray":"./assert","assertObservable":"./assert"},"importAs":"@yelon/util/other"}
1
+ {"__symbolic":"module","version":4,"metadata":{"deepGet":{"__symbolic":"function"},"deepCopy":{"__symbolic":"function"},"deepMergeKey":{"__symbolic":"function"},"deepMerge":{"__symbolic":"function","parameters":["original","objects"],"value":{"__symbolic":"call","expression":{"__symbolic":"reference","name":"deepMergeKey"},"arguments":[{"__symbolic":"reference","name":"original"},false,{"__symbolic":"spread","expression":{"__symbolic":"reference","name":"objects"}}]}},"PREFIX":"[@YELON]:","warn":{"__symbolic":"error","message":"Lambda not supported","line":26,"character":20,"module":"./logger"},"warnDeprecation":{"__symbolic":"error","message":"Lambda not supported","line":29,"character":31,"module":"./logger"},"log":{"__symbolic":"error","message":"Lambda not supported","line":38,"character":19,"module":"./logger"},"LazyResult":{"__symbolic":"interface"},"LazyService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":16,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":22,"character":15},"arguments":[{"__symbolic":"reference","module":"@angular/common","name":"DOCUMENT","line":22,"character":22}]}]],"parameters":[{"__symbolic":"reference","module":"ng-zorro-antd/core/types","name":"NzSafeAny","line":22,"character":45}]}],"clear":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}],"loadScript":[{"__symbolic":"method"}],"loadStyle":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"assert":{"__symbolic":"function"},"assertEmpty":{"__symbolic":"function"},"assertNumber":{"__symbolic":"function"},"assertString":{"__symbolic":"function"},"assertArray":{"__symbolic":"function"},"assertObservable":{"__symbolic":"function"}},"origins":{"deepGet":"./deep","deepCopy":"./deep","deepMergeKey":"./deep","deepMerge":"./deep","PREFIX":"./logger","warn":"./logger","warnDeprecation":"./logger","log":"./logger","LazyResult":"./lazy.service","LazyService":"./lazy.service","assert":"./assert","assertEmpty":"./assert","assertNumber":"./assert","assertString":"./assert","assertArray":"./assert","assertObservable":"./assert"},"importAs":"@yelon/util/other"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yelon/util",
3
- "version": "12.0.12",
3
+ "version": "12.0.16",
4
4
  "author": "devcui<devcui@outlook.com>",
5
5
  "license": "MIT",
6
6
  "dependencies": {