@yelon/util 19.2.0 → 20.0.0-beta.0

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.
Files changed (121) hide show
  1. package/array/index.d.ts +149 -2
  2. package/browser/index.d.ts +134 -5
  3. package/config/index.d.ts +1423 -14
  4. package/date-time/index.d.ts +115 -2
  5. package/decorator/index.d.ts +37 -2
  6. package/fesm2022/array.mjs +9 -8
  7. package/fesm2022/array.mjs.map +1 -1
  8. package/fesm2022/browser.mjs +7 -6
  9. package/fesm2022/browser.mjs.map +1 -1
  10. package/fesm2022/config.mjs +3 -3
  11. package/fesm2022/config.mjs.map +1 -1
  12. package/fesm2022/date-time.mjs.map +1 -1
  13. package/fesm2022/decorator.mjs +1 -66
  14. package/fesm2022/decorator.mjs.map +1 -1
  15. package/fesm2022/form.mjs.map +1 -1
  16. package/fesm2022/format.mjs +8 -7
  17. package/fesm2022/format.mjs.map +1 -1
  18. package/fesm2022/math.mjs.map +1 -1
  19. package/fesm2022/mcache.mjs.map +1 -1
  20. package/fesm2022/mtypes.mjs.map +1 -1
  21. package/fesm2022/other.mjs +6 -6
  22. package/fesm2022/other.mjs.map +1 -1
  23. package/fesm2022/pipe-currency.mjs +13 -13
  24. package/fesm2022/pipe-currency.mjs.map +1 -1
  25. package/fesm2022/pipe-filter.mjs +7 -7
  26. package/fesm2022/pipe-filter.mjs.map +1 -1
  27. package/fesm2022/pipe-format.mjs +7 -7
  28. package/fesm2022/pipe-format.mjs.map +1 -1
  29. package/fesm2022/token.mjs.map +1 -1
  30. package/form/index.d.ts +80 -2
  31. package/format/index.d.ts +239 -4
  32. package/math/index.d.ts +50 -2
  33. package/mcache/index.d.ts +21 -1
  34. package/mtypes/index.d.ts +197 -9
  35. package/other/index.d.ts +154 -7
  36. package/package.json +12 -12
  37. package/pipes/currency/index.d.ts +52 -4
  38. package/pipes/filter/index.d.ts +21 -2
  39. package/pipes/format/index.d.ts +36 -2
  40. package/token/index.d.ts +18 -2
  41. package/array/array-type.service.d.ts +0 -68
  42. package/array/array.service.d.ts +0 -78
  43. package/browser/cookie.service.d.ts +0 -62
  44. package/browser/copy.d.ts +0 -6
  45. package/browser/is-empty.d.ts +0 -6
  46. package/browser/scroll.service.d.ts +0 -34
  47. package/browser/style.d.ts +0 -19
  48. package/config/abc/cell.type.d.ts +0 -118
  49. package/config/abc/date-picker.type.d.ts +0 -49
  50. package/config/abc/error-collect.type.d.ts +0 -10
  51. package/config/abc/exception.type.d.ts +0 -7
  52. package/config/abc/image.type.d.ts +0 -15
  53. package/config/abc/index.d.ts +0 -17
  54. package/config/abc/loading.type.d.ts +0 -29
  55. package/config/abc/lodop.type.d.ts +0 -33
  56. package/config/abc/media.type.d.ts +0 -10
  57. package/config/abc/onboarding.type.d.ts +0 -4
  58. package/config/abc/page-header.type.d.ts +0 -39
  59. package/config/abc/pdf.type.d.ts +0 -35
  60. package/config/abc/se.type.d.ts +0 -32
  61. package/config/abc/sg.type.d.ts +0 -10
  62. package/config/abc/st.type.d.ts +0 -464
  63. package/config/abc/sv.type.d.ts +0 -14
  64. package/config/abc/xlsx.type.d.ts +0 -12
  65. package/config/abc/zip.type.d.ts +0 -10
  66. package/config/acl/acl.type.d.ts +0 -31
  67. package/config/auth/auth.type.d.ts +0 -55
  68. package/config/bis/bis.type.d.ts +0 -11
  69. package/config/cache/cache.type.d.ts +0 -66
  70. package/config/chart/chart.type.d.ts +0 -30
  71. package/config/config.service.d.ts +0 -14
  72. package/config/config.types.d.ts +0 -51
  73. package/config/mock/mock.type.d.ts +0 -14
  74. package/config/sf/sf.type.d.ts +0 -130
  75. package/config/socket/socket.type.d.ts +0 -4
  76. package/config/theme/http.type.d.ts +0 -15
  77. package/config/theme/i18n.type.d.ts +0 -14
  78. package/config/theme/index.d.ts +0 -4
  79. package/config/theme/pipe.type.d.ts +0 -7
  80. package/config/theme/responsive.type.d.ts +0 -10
  81. package/config/util/array.type.d.ts +0 -22
  82. package/config/util/currency.type.d.ts +0 -39
  83. package/date-time/picker.d.ts +0 -68
  84. package/date-time/time.d.ts +0 -42
  85. package/decorator/convert.d.ts +0 -31
  86. package/decorator/zone-outside.d.ts +0 -35
  87. package/form/match-control.d.ts +0 -15
  88. package/form/validators.d.ts +0 -62
  89. package/format/currency.service.d.ts +0 -38
  90. package/format/currency.types.d.ts +0 -82
  91. package/format/string.d.ts +0 -41
  92. package/format/validate.d.ts +0 -72
  93. package/math/in-range.d.ts +0 -14
  94. package/math/round.d.ts +0 -33
  95. package/mcache/localStorageUtils.d.ts +0 -19
  96. package/mtypes/authority.type.d.ts +0 -3
  97. package/mtypes/header-menu.type.d.ts +0 -12
  98. package/mtypes/menu.type.d.ts +0 -40
  99. package/mtypes/nav.types.d.ts +0 -29
  100. package/mtypes/page.d.ts +0 -46
  101. package/mtypes/project-info.types.d.ts +0 -22
  102. package/mtypes/response.d.ts +0 -7
  103. package/mtypes/role.type.d.ts +0 -10
  104. package/mtypes/user.types.d.ts +0 -22
  105. package/other/assert.d.ts +0 -36
  106. package/other/deep.d.ts +0 -32
  107. package/other/favicon.d.ts +0 -2
  108. package/other/lazy.service.d.ts +0 -44
  109. package/other/logger.d.ts +0 -4
  110. package/other/path-to-regexp.service.d.ts +0 -26
  111. package/other/resize.d.ts +0 -1
  112. package/pipes/currency/cny.pipe.d.ts +0 -14
  113. package/pipes/currency/mega.pipe.d.ts +0 -15
  114. package/pipes/currency/module.d.ts +0 -9
  115. package/pipes/currency/price.pipe.d.ts +0 -18
  116. package/pipes/filter/filter.pipe.d.ts +0 -12
  117. package/pipes/filter/module.d.ts +0 -7
  118. package/pipes/format/mask.pipe.d.ts +0 -27
  119. package/pipes/format/module.d.ts +0 -7
  120. package/token/page-visibility.d.ts +0 -8
  121. package/token/window.d.ts +0 -7
package/array/index.d.ts CHANGED
@@ -1,2 +1,149 @@
1
- export * from './array.service';
2
- export * from './array-type.service';
1
+ import { NzTreeNode } from 'ng-zorro-antd/core/tree';
2
+ import * as i0 from '@angular/core';
3
+
4
+ interface ArrayServiceTreeToArrOptions<T extends object = any> {
5
+ /** 深度项名,默认:`'deep'` */
6
+ deepMapName?: string;
7
+ /** 扁平后数组的父数据项名,默认:`'parent'` */
8
+ parentMapName?: string;
9
+ /** 源数据子项名,默认:`'children'` */
10
+ childrenMapName?: string;
11
+ /** 是否移除 `children` 节点,默认:`true` */
12
+ clearChildren?: boolean;
13
+ /** 转换成数组结构时回调 */
14
+ cb?: (item: T, parent: T | null, deep: number) => void;
15
+ }
16
+ interface ArrayServiceArrToTreeOptions<T extends object = any> {
17
+ /** 编号项名,默认:`'id'` */
18
+ idMapName?: string;
19
+ /** 父编号项名,默认:`'parent_id'` */
20
+ parentIdMapName?: string;
21
+ /**
22
+ * 根父编号值,默认会自动计算得到最合适的根父编号值,例如:
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const res = srv.arrToTree([
27
+ * { id: 2, parent_id: 'a', title: 'c1' },
28
+ * { id: 4, parent_id: 2, title: 't1' },
29
+ * ],
30
+ * { rootParentValue: 'a' });
31
+ * ```
32
+ */
33
+ rootParentIdValue?: any;
34
+ /** 子项名,默认:`'children'` */
35
+ childrenMapName?: string;
36
+ /** 转换成树数据时回调 */
37
+ cb?: (item: T) => void;
38
+ }
39
+ interface ArrayServiceArrToTreeNodeOptions<T extends object = any> {
40
+ /** 编号项名,默认:`'id'` */
41
+ idMapName?: string;
42
+ /** 父编号项名,默认:`'parent_id'` */
43
+ parentIdMapName?: string;
44
+ /** 标题项名,默认:`'title'` */
45
+ titleMapName?: string;
46
+ /** 设置为叶子节点项名,若数据源不存在时自动根据 `children` 值决定是否为叶子节点,默认:`'isLeaf'` */
47
+ isLeafMapName?: string;
48
+ /** 节点 Checkbox 是否选中项名,默认:`'checked'` */
49
+ checkedMapname?: string;
50
+ /** 节点本身是否选中项名,默认:`'selected'` */
51
+ selectedMapname?: string;
52
+ /** 节点是否展开(叶子节点无效)项名,默认:`'expanded'` */
53
+ expandedMapname?: string;
54
+ /** 设置是否禁用节点(不可进行任何操作)项名,默认:`'disabled'` */
55
+ disabledMapname?: string;
56
+ /** 转换成树数据后,执行的递归回调 */
57
+ cb?: (item: T, parent: T | null, deep: number) => void;
58
+ }
59
+ interface ArrayServiceGetKeysByTreeNodeOptions {
60
+ /** 是否包含半选状态的值,默认:`true` */
61
+ includeHalfChecked?: boolean;
62
+ /** 是否重新指定 `key` 键名,若不指定表示使用 `NzTreeNode.key` 值 */
63
+ keyMapName?: string;
64
+ /** 回调,返回一个值 `key` 值,优先级高于其他 */
65
+ cb?: (item: NzTreeNode, parent: NzTreeNode | null, deep: number) => any;
66
+ }
67
+ interface ArrayServiceGroupByResult {
68
+ [key: string]: any;
69
+ [key: number]: any;
70
+ }
71
+
72
+ declare class ArrayService {
73
+ private readonly cogSrv;
74
+ private c;
75
+ constructor();
76
+ /**
77
+ * Convert tree structure to array structure
78
+ *
79
+ * 将树结构转换成数组结构
80
+ */
81
+ treeToArr<T extends object = any>(tree: readonly T[], options?: ArrayServiceTreeToArrOptions<T>): T[];
82
+ /**
83
+ * Convert array structure to tree structure
84
+ *
85
+ * 数组转换成树数据
86
+ */
87
+ arrToTree<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeOptions<T>): T[];
88
+ /**
89
+ * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项
90
+ */
91
+ arrToTreeNode<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeNodeOptions): NzTreeNode[];
92
+ /**
93
+ * 递归访问整个树
94
+ */
95
+ visitTree<T extends object = any>(tree: readonly T[], cb: (item: T, parent: T | null, deep: number) => void, options?: {
96
+ /** 子项名,默认:`'children'` */
97
+ childrenMapName?: string;
98
+ }): void;
99
+ /**
100
+ * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise
101
+ *
102
+ * 根据条件返回树的第一个值,否则返回 `undefined`
103
+ */
104
+ findTree<T extends object = any>(tree: readonly T[], predicate: (item: T) => boolean, options?: {
105
+ /** 子项名,默认:`'children'` */
106
+ childrenMapName?: string;
107
+ }): T | undefined;
108
+ /**
109
+ * 获取所有已经选中的 `key` 值
110
+ */
111
+ getKeysByTreeNode(tree: NzTreeNode[], options?: ArrayServiceGetKeysByTreeNodeOptions): any[];
112
+ private baseFlat;
113
+ /**
114
+ * Recursively flattens array
115
+ *
116
+ * 递归扁平数组
117
+ * ```ts
118
+ * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]
119
+ * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]
120
+ * ```
121
+ */
122
+ flat<T>(array: readonly T[], depth?: number): T[];
123
+ /**
124
+ * Group the array
125
+ *
126
+ * 对数组进行分组
127
+ * ```ts
128
+ * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {"4":[4.2],"6":[6.1,6.3]}
129
+ * srv.groupBy(['one', 'two', 'three'], v => v.length) => {"3":["one","two"],"5":["three"]}
130
+ * ```
131
+ */
132
+ groupBy<T>(array: readonly T[], iteratee: (value: T) => string | number): ArrayServiceGroupByResult;
133
+ /**
134
+ * Creates a duplicate-free version of an array
135
+ *
136
+ * 创建去重后的数组
137
+ * ```ts
138
+ * uniq([1, 2, 2, 3, 1]) => [1,2,3]
139
+ * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{"a":1},{"a":2}]
140
+ * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{"a":1},{"a":2}]
141
+ * ```
142
+ */
143
+ uniq<T>(array: readonly T[], predicate?: string | ((value: T) => string | number | boolean)): T[];
144
+ static ɵfac: i0.ɵɵFactoryDeclaration<ArrayService, never>;
145
+ static ɵprov: i0.ɵɵInjectableDeclaration<ArrayService>;
146
+ }
147
+
148
+ export { ArrayService };
149
+ export type { ArrayServiceArrToTreeNodeOptions, ArrayServiceArrToTreeOptions, ArrayServiceGetKeysByTreeNodeOptions, ArrayServiceGroupByResult, ArrayServiceTreeToArrOptions };
@@ -1,5 +1,134 @@
1
- export * from './cookie.service';
2
- export * from './copy';
3
- export * from './is-empty';
4
- export * from './scroll.service';
5
- export * from './style';
1
+ import * as i0 from '@angular/core';
2
+ import { Renderer2 } from '@angular/core';
3
+
4
+ interface CookieOptions {
5
+ path?: string;
6
+ domain?: string;
7
+ /**
8
+ * Expiration time, `number` is seconds
9
+ *
10
+ * 过期时间,`number` 类型表示秒数
11
+ */
12
+ expires?: number | Date | string;
13
+ secure?: boolean;
14
+ HttpOnly?: boolean;
15
+ SameSite?: boolean | 'lax' | 'strict' | 'none';
16
+ }
17
+ /**
18
+ * A set of simple Cookie manipulation classes.
19
+ *
20
+ * 一组简单的 Cookie 操作类。
21
+ */
22
+ declare class CookieService {
23
+ private readonly _doc;
24
+ private readonly platform;
25
+ private get doc();
26
+ /**
27
+ * Original cookie value
28
+ *
29
+ * 原始Cookie值
30
+ */
31
+ get cookie(): string;
32
+ /**
33
+ * Get all cookie key-value pairs
34
+ *
35
+ * 获取所有Cookie键值对
36
+ */
37
+ getAll(): Record<string, string>;
38
+ /**
39
+ * Get the value of given cookie `key`
40
+ *
41
+ * 获取指定 `key` 的值
42
+ */
43
+ get(key: string): string | undefined;
44
+ /**
45
+ * Sets a value for given cookie key
46
+ *
47
+ * 设置指定 Cookie 键的值
48
+ */
49
+ put(key: string, value: string, options?: CookieOptions): void;
50
+ /**
51
+ * Remove given cookie
52
+ *
53
+ * 移除指定 Cookie
54
+ */
55
+ remove(key: string, options?: CookieOptions): void;
56
+ /**
57
+ * Remove all cookies
58
+ *
59
+ * 移除所有 Cookies
60
+ */
61
+ removeAll(): void;
62
+ static ɵfac: i0.ɵɵFactoryDeclaration<CookieService, never>;
63
+ static ɵprov: i0.ɵɵInjectableDeclaration<CookieService>;
64
+ }
65
+
66
+ /**
67
+ * Copy text to clipboard
68
+ *
69
+ * 复制字符串文档至剪贴板
70
+ */
71
+ declare function copy(value: string): Promise<string>;
72
+
73
+ /**
74
+ * Used to verify `<ng-content />` is empty, useful for custom components.
75
+ *
76
+ * 用于校验 `<ng-content />` 是否为空,自定义组件时蛮有用。
77
+ */
78
+ declare function isEmpty(element: HTMLElement): boolean;
79
+
80
+ declare class ScrollService {
81
+ private readonly _doc;
82
+ private readonly platform;
83
+ private _getDoc;
84
+ private _getWin;
85
+ /**
86
+ * 获取滚动条位置
87
+ *
88
+ * @param element 指定元素,默认 `window`
89
+ */
90
+ getScrollPosition(element?: Element | Window | null): [number, number];
91
+ /**
92
+ * 设置滚动条位置
93
+ *
94
+ * @param element 指定元素
95
+ */
96
+ scrollToPosition(element: Element | Window | null | undefined, position: [number, number]): void;
97
+ /**
98
+ * 设置滚动条至指定元素
99
+ *
100
+ * @param element 指定元素,默认 `document.body`
101
+ * @param topOffset 偏移值,默认 `0`
102
+ */
103
+ scrollToElement(element?: Element | null, topOffset?: number): void;
104
+ /**
105
+ * 滚动至顶部
106
+ *
107
+ * @param topOffset 偏移值,默认 `0`
108
+ */
109
+ scrollToTop(topOffset?: number): void;
110
+ static ɵfac: i0.ɵɵFactoryDeclaration<ScrollService, never>;
111
+ static ɵprov: i0.ɵɵInjectableDeclaration<ScrollService>;
112
+ }
113
+
114
+ /**
115
+ * Update host component style `class`
116
+ *
117
+ * 更新宿主组件样式 `class`
118
+ *
119
+ * ```ts
120
+ * updateHostClass(
121
+ * this.el.nativeElement,
122
+ * this.renderer,
123
+ * {
124
+ * [ 'classname' ]: true,
125
+ * [ 'classname' ]: this.type === '1',
126
+ * [ this.cls ]: true,
127
+ * [ `a-${this.cls}` ]: true
128
+ * })
129
+ * ```
130
+ */
131
+ declare function updateHostClass(el: HTMLElement, renderer: Renderer2, classMap: Record<string, unknown>, preClean?: boolean): void;
132
+
133
+ export { CookieService, ScrollService, copy, isEmpty, updateHostClass };
134
+ export type { CookieOptions };