@delon/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 (95) hide show
  1. package/array/index.d.ts +149 -2
  2. package/browser/index.d.ts +134 -5
  3. package/config/index.d.ts +1396 -12
  4. package/date-time/index.d.ts +116 -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 +1 -1
  13. package/fesm2022/decorator.mjs +1 -66
  14. package/fesm2022/decorator.mjs.map +1 -1
  15. package/fesm2022/format.mjs +8 -7
  16. package/fesm2022/format.mjs.map +1 -1
  17. package/fesm2022/other.mjs +3 -3
  18. package/fesm2022/pipe-currency.mjs +13 -13
  19. package/fesm2022/pipe-filter.mjs +7 -7
  20. package/fesm2022/pipe-format.mjs +7 -7
  21. package/form/index.d.ts +80 -2
  22. package/format/index.d.ts +240 -4
  23. package/math/index.d.ts +50 -2
  24. package/other/index.d.ts +124 -4
  25. package/package.json +1 -1
  26. package/pipes/currency/index.d.ts +52 -4
  27. package/pipes/filter/index.d.ts +22 -2
  28. package/pipes/format/index.d.ts +36 -2
  29. package/token/index.d.ts +18 -2
  30. package/array/array-type.service.d.ts +0 -68
  31. package/array/array.service.d.ts +0 -78
  32. package/browser/cookie.service.d.ts +0 -62
  33. package/browser/copy.d.ts +0 -6
  34. package/browser/is-empty.d.ts +0 -6
  35. package/browser/scroll.service.d.ts +0 -34
  36. package/browser/style.d.ts +0 -19
  37. package/config/abc/cell.type.d.ts +0 -118
  38. package/config/abc/date-picker.type.d.ts +0 -50
  39. package/config/abc/error-collect.type.d.ts +0 -10
  40. package/config/abc/exception.type.d.ts +0 -7
  41. package/config/abc/image.type.d.ts +0 -15
  42. package/config/abc/index.d.ts +0 -17
  43. package/config/abc/loading.type.d.ts +0 -29
  44. package/config/abc/lodop.type.d.ts +0 -33
  45. package/config/abc/media.type.d.ts +0 -11
  46. package/config/abc/onboarding.type.d.ts +0 -4
  47. package/config/abc/page-header.type.d.ts +0 -39
  48. package/config/abc/pdf.type.d.ts +0 -35
  49. package/config/abc/se.type.d.ts +0 -32
  50. package/config/abc/sg.type.d.ts +0 -10
  51. package/config/abc/st.type.d.ts +0 -464
  52. package/config/abc/sv.type.d.ts +0 -14
  53. package/config/abc/xlsx.type.d.ts +0 -12
  54. package/config/abc/zip.type.d.ts +0 -10
  55. package/config/acl/acl.type.d.ts +0 -32
  56. package/config/auth/auth.type.d.ts +0 -47
  57. package/config/cache/cache.type.d.ts +0 -66
  58. package/config/chart/chart.type.d.ts +0 -31
  59. package/config/config.service.d.ts +0 -14
  60. package/config/config.types.d.ts +0 -47
  61. package/config/mock/mock.type.d.ts +0 -14
  62. package/config/sf/sf.type.d.ts +0 -131
  63. package/config/theme/http.type.d.ts +0 -15
  64. package/config/theme/i18n.type.d.ts +0 -14
  65. package/config/theme/index.d.ts +0 -4
  66. package/config/theme/pipe.type.d.ts +0 -7
  67. package/config/theme/responsive.type.d.ts +0 -10
  68. package/config/util/array.type.d.ts +0 -22
  69. package/config/util/currency.type.d.ts +0 -39
  70. package/date-time/picker.d.ts +0 -68
  71. package/date-time/time.d.ts +0 -43
  72. package/decorator/convert.d.ts +0 -32
  73. package/decorator/zone-outside.d.ts +0 -35
  74. package/form/match-control.d.ts +0 -15
  75. package/form/validators.d.ts +0 -62
  76. package/format/currency.service.d.ts +0 -38
  77. package/format/currency.types.d.ts +0 -82
  78. package/format/string.d.ts +0 -42
  79. package/format/validate.d.ts +0 -72
  80. package/math/in-range.d.ts +0 -14
  81. package/math/round.d.ts +0 -33
  82. package/other/assert.d.ts +0 -36
  83. package/other/deep.d.ts +0 -33
  84. package/other/lazy.service.d.ts +0 -45
  85. package/other/logger.d.ts +0 -5
  86. package/pipes/currency/cny.pipe.d.ts +0 -14
  87. package/pipes/currency/mega.pipe.d.ts +0 -15
  88. package/pipes/currency/module.d.ts +0 -9
  89. package/pipes/currency/price.pipe.d.ts +0 -18
  90. package/pipes/filter/filter.pipe.d.ts +0 -13
  91. package/pipes/filter/module.d.ts +0 -7
  92. package/pipes/format/mask.pipe.d.ts +0 -27
  93. package/pipes/format/module.d.ts +0 -7
  94. package/token/page-visibility.d.ts +0 -8
  95. package/token/window.d.ts +0 -7
package/math/index.d.ts CHANGED
@@ -1,2 +1,50 @@
1
- export * from './in-range';
2
- export * from './round';
1
+ /**
2
+ * Checks if `value` is between `start` and `end` to, but not including `end`. If `end` is not specified, it's set to start with `start` then set to `0`. If `start` is greater than `end` the params are swapped to support negative ranges.
3
+ *
4
+ * 检查 `value` 是否在 `start` 与 `end` 之间,但不包括 `end`。 如果 `end` 没有指定,那么 `start` 设置为 `0`。 如果 `start` 大于 `end`,那么参数会交换以便支持负范围。
5
+ * ```ts
6
+ * inRange(3, 2, 4); // true
7
+ * inRange(4, 8); // true
8
+ * inRange(4, 2); // false
9
+ * inRange(2, 2); // false
10
+ * inRange(1.2, 2); // true
11
+ * inRange(-3, -2, -6); // true
12
+ * ```
13
+ */
14
+ declare function inRange(value: number, start: number, end?: number): boolean;
15
+
16
+ /**
17
+ * Computes `number` rounded up to `precision`.
18
+ *
19
+ * 根据 `precision`(精度) 向上舍入 `number`。
20
+ * ```ts
21
+ * ceil(4.006); // 5
22
+ * ceil(6.004, 2); // 6.01
23
+ * ceil(6040, -2); // 6100
24
+ * ```
25
+ */
26
+ declare function ceil(number: number, precision?: number): number;
27
+ /**
28
+ * Computes `number` rounded down to `precision`.
29
+ *
30
+ * 根据 `precision`(精度) 向下舍入 `number`。
31
+ * ```ts
32
+ * floor(4.006); // 4
33
+ * floor(0.046, 2); // 0.04
34
+ * floor(4060, -2); // 4000
35
+ * ```
36
+ */
37
+ declare function floor(number: number, precision?: number): number;
38
+ /**
39
+ * Computes `number` rounded to `precision`.
40
+ *
41
+ * 根据 `precision`(精度) 四舍五入 `number`。
42
+ * ```ts
43
+ * round(4.006); // 4
44
+ * round(4.006, 2); // 4.01
45
+ * round(4060, -2); // 4100
46
+ * ```
47
+ */
48
+ declare function round(number: number, precision?: number): number;
49
+
50
+ export { ceil, floor, inRange, round };
package/other/index.d.ts CHANGED
@@ -1,4 +1,124 @@
1
- export * from './deep';
2
- export * from './logger';
3
- export * from './lazy.service';
4
- export * from './assert';
1
+ import { NzSafeAny } from 'ng-zorro-antd/core/types';
2
+ import { Observable } from 'rxjs';
3
+ import * as i0 from '@angular/core';
4
+
5
+ /**
6
+ * Gets the value at `path` of `object`, like `_.get` in lodash.
7
+ *
8
+ * 类似 `_.get`,根据 `path` 获取安全值
9
+ */
10
+ declare function deepGet(obj: NzSafeAny, path: string | string[] | null | undefined, defaultValue?: unknown): NzSafeAny;
11
+ /**
12
+ * Base on [extend](https://github.com/justmoon/node-extend) deep copy.
13
+ *
14
+ * 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝
15
+ *
16
+ * NOTE: Don't a lot of recursion, maybe performance issues
17
+ */
18
+ declare function deepCopy<T extends Record<string, NzSafeAny> = NzSafeAny>(obj: T | null | undefined): T;
19
+ /**
20
+ * Deep merge object.
21
+ *
22
+ * 深度合并对象
23
+ *
24
+ * @param original 原始对象
25
+ * @param arrayProcessMethod 数组处理方式
26
+ * - `true` 表示替换新值,不管新值为哪种类型
27
+ * - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)
28
+ * @param objects 要合并的对象
29
+ */
30
+ declare function deepMergeKey(original: unknown, arrayProcessMethod: boolean, ...objects: NzSafeAny[]): NzSafeAny;
31
+ /**
32
+ * Deep merge object.
33
+ *
34
+ * 深度合并对象
35
+ */
36
+ declare function deepMerge(original: unknown, ...objects: unknown[]): NzSafeAny;
37
+
38
+ declare const PREFIX = "[@DELON]:";
39
+ declare const warn: (...args: NzSafeAny[]) => void;
40
+ declare const warnDeprecation: (...args: NzSafeAny[]) => NzSafeAny;
41
+ declare const log: (...args: NzSafeAny[]) => void;
42
+
43
+ interface LazyResult {
44
+ path: string;
45
+ status: 'ok' | 'error' | 'loading';
46
+ error?: NzSafeAny;
47
+ }
48
+ interface LazyLoadItem {
49
+ path: string;
50
+ options?: LazyLoadOptions;
51
+ }
52
+ interface LazyLoadOptions {
53
+ innerContent?: string;
54
+ attributes?: Record<string, string>;
55
+ rel?: string;
56
+ }
57
+ /**
58
+ * `LazyService` delay loading JS or CSS files.
59
+ *
60
+ * 延迟加载资源(js 或 css)服务
61
+ */
62
+ declare class LazyService {
63
+ private readonly doc;
64
+ private list;
65
+ private cached;
66
+ private _notify;
67
+ get change(): Observable<LazyResult[]>;
68
+ clear(): void;
69
+ private attachAttributes;
70
+ /**
71
+ * Load script or style files
72
+ */
73
+ load(paths: string | LazyLoadItem | Array<string | LazyLoadItem>): Promise<LazyResult[]>;
74
+ /**
75
+ * Load a script file
76
+ */
77
+ loadScript(path: string, options?: LazyLoadOptions): Promise<LazyResult>;
78
+ /**
79
+ * Load a style file
80
+ */
81
+ loadStyle(path: string, options?: LazyLoadOptions): Promise<LazyResult>;
82
+ static ɵfac: i0.ɵɵFactoryDeclaration<LazyService, never>;
83
+ static ɵprov: i0.ɵɵInjectableDeclaration<LazyService>;
84
+ }
85
+
86
+ /**
87
+ * Assert whether the expression and throw an error into console in dev mode
88
+ *
89
+ * 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误
90
+ */
91
+ declare function assert(expression: boolean, msg?: string): void;
92
+ /**
93
+ * Assert whether empty (`null` or `undefined`)
94
+ *
95
+ * 断言是否空值(`null` 或 `undefined`)
96
+ */
97
+ declare function assertEmpty(actual: unknown, msg?: string): void;
98
+ /**
99
+ * Assert whether `number` type
100
+ *
101
+ * 断言是否 `number` 类型
102
+ */
103
+ declare function assertNumber(actual: unknown, msg?: string): void;
104
+ /**
105
+ * Assert whether `string` type
106
+ *
107
+ * 断言是否 `string` 类型
108
+ */
109
+ declare function assertString(actual: unknown, msg?: string): void;
110
+ /**
111
+ * Assert whether `array` type
112
+ *
113
+ * 断言是否 `array` 类型
114
+ */
115
+ declare function assertArray(actual: unknown, msg?: string): void;
116
+ /**
117
+ * Assert whether `Observable` type
118
+ *
119
+ * 断言是否 `Observable` 类型
120
+ */
121
+ declare function assertObservable(obj: unknown, msg?: string): void;
122
+
123
+ export { LazyService, PREFIX, assert, assertArray, assertEmpty, assertNumber, assertObservable, assertString, deepCopy, deepGet, deepMerge, deepMergeKey, log, warn, warnDeprecation };
124
+ export type { LazyLoadItem, LazyLoadOptions, LazyResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delon/util",
3
- "version": "19.2.0",
3
+ "version": "20.0.0-beta.0",
4
4
  "author": "cipchk<cipchk@qq.com>",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,4 +1,52 @@
1
- export * from './mega.pipe';
2
- export * from './price.pipe';
3
- export * from './module';
4
- export * from './cny.pipe';
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform } from '@angular/core';
3
+ import { CurrencyMegaOptions, CurrencyFormatOptions, CurrencyCNYOptions } from '@delon/util/format';
4
+
5
+ /**
6
+ * Large number format filter
7
+ *
8
+ * 大数据格式化
9
+ */
10
+ declare class CurrencyMegaPipe implements PipeTransform {
11
+ private readonly srv;
12
+ private isCN;
13
+ transform(value: number | string, options?: CurrencyMegaOptions): string;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyMegaPipe, never>;
15
+ static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyMegaPipe, "mega", true>;
16
+ }
17
+
18
+ /**
19
+ * Format a number with commas as thousands separators
20
+ *
21
+ * 格式化货币,用逗号将数字格式化为千位分隔符
22
+ * ```ts
23
+ * 10000 => `10,000`
24
+ * 10000.567 => `10,000.57`
25
+ * ```
26
+ */
27
+ declare class CurrencyPricePipe implements PipeTransform {
28
+ private readonly srv;
29
+ transform(value: number | string, options?: CurrencyFormatOptions): string;
30
+ static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyPricePipe, never>;
31
+ static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyPricePipe, "price", true>;
32
+ }
33
+
34
+ /**
35
+ * Converted into RMB notation.
36
+ *
37
+ * 转化成人民币表示法
38
+ */
39
+ declare class CurrencyCNYPipe implements PipeTransform {
40
+ private readonly srv;
41
+ transform(value: number | string, options?: CurrencyCNYOptions): string;
42
+ static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyCNYPipe, never>;
43
+ static ɵpipe: i0.ɵɵPipeDeclaration<CurrencyCNYPipe, "cny", true>;
44
+ }
45
+
46
+ declare class CurrencyPipeModule {
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<CurrencyPipeModule, never>;
48
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CurrencyPipeModule, never, [typeof CurrencyMegaPipe, typeof CurrencyPricePipe, typeof CurrencyCNYPipe], [typeof CurrencyMegaPipe, typeof CurrencyPricePipe, typeof CurrencyCNYPipe]>;
49
+ static ɵinj: i0.ɵɵInjectorDeclaration<CurrencyPipeModule>;
50
+ }
51
+
52
+ export { CurrencyCNYPipe, CurrencyMegaPipe, CurrencyPipeModule, CurrencyPricePipe };
@@ -1,2 +1,22 @@
1
- export * from './filter.pipe';
2
- export * from './module';
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform } from '@angular/core';
3
+ import { NzSafeAny } from 'ng-zorro-antd/core/types';
4
+
5
+ /**
6
+ * Filter array
7
+ *
8
+ * 过滤数组
9
+ */
10
+ declare class FilterPipe implements PipeTransform {
11
+ transform<T>(array: readonly T[], matcher: (item: T, ...args: NzSafeAny[]) => boolean, ...args: NzSafeAny[]): T[];
12
+ static ɵfac: i0.ɵɵFactoryDeclaration<FilterPipe, never>;
13
+ static ɵpipe: i0.ɵɵPipeDeclaration<FilterPipe, "filter", true>;
14
+ }
15
+
16
+ declare class FilterPipeModule {
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<FilterPipeModule, never>;
18
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FilterPipeModule, never, [typeof FilterPipe], [typeof FilterPipe]>;
19
+ static ɵinj: i0.ɵɵInjectorDeclaration<FilterPipeModule>;
20
+ }
21
+
22
+ export { FilterPipe, FilterPipeModule };
@@ -1,2 +1,36 @@
1
- export * from './mask.pipe';
2
- export * from './module';
1
+ import * as i0 from '@angular/core';
2
+ import { PipeTransform } from '@angular/core';
3
+ import { FormatMaskOption } from '@delon/util/format';
4
+
5
+ /**
6
+ * Format mask
7
+ *
8
+ * 格式化掩码
9
+ *
10
+ * | 字符 | 描述 |
11
+ * | --- | --- |
12
+ * | `0` | 任意数字,若该位置字符不符合,则默认为 `0` 填充 |
13
+ * | `9` | 任意数字 |
14
+ * | `#` | 任意字符 |
15
+ * | `U` | 转换大写 |
16
+ * | `L` | 转换小写 |
17
+ * | `*` | 转换为 `*` 字符 |
18
+ *
19
+ * ```ts
20
+ * formatMask('123', '(###)') => (123)
21
+ * formatMask('15900000000', '999****9999') => 159****0000
22
+ * ```
23
+ */
24
+ declare class FormatMaskPipe implements PipeTransform {
25
+ transform(value: string, mask: string | FormatMaskOption): string;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormatMaskPipe, never>;
27
+ static ɵpipe: i0.ɵɵPipeDeclaration<FormatMaskPipe, "mask", true>;
28
+ }
29
+
30
+ declare class FormatPipeModule {
31
+ static ɵfac: i0.ɵɵFactoryDeclaration<FormatPipeModule, never>;
32
+ static ɵmod: i0.ɵɵNgModuleDeclaration<FormatPipeModule, never, [typeof FormatMaskPipe], [typeof FormatMaskPipe]>;
33
+ static ɵinj: i0.ɵɵInjectorDeclaration<FormatPipeModule>;
34
+ }
35
+
36
+ export { FormatMaskPipe, FormatPipeModule };
package/token/index.d.ts CHANGED
@@ -1,2 +1,18 @@
1
- export * from './window';
2
- export * from './page-visibility';
1
+ import { InjectionToken } from '@angular/core';
2
+ import { Observable } from 'rxjs';
3
+
4
+ /**
5
+ * Access to global `window` object
6
+ *
7
+ * 访问全局 `window` 对象
8
+ */
9
+ declare const WINDOW: InjectionToken<Window>;
10
+
11
+ /**
12
+ * Use the `visibilitychange` event to monitor whether the browser tab is visible, which is generally used when the user leaves the browser tab to temp interrupt the backend to continue sending requests
13
+ *
14
+ * 通过 `visibilitychange` 事件来监听浏览器选项卡是否可见,一般用于当用户离开应用时暂时中断后端持续发送请求时
15
+ */
16
+ declare const PAGE_VISIBILITY: InjectionToken<Observable<boolean>>;
17
+
18
+ export { PAGE_VISIBILITY, WINDOW };
@@ -1,68 +0,0 @@
1
- import type { NzTreeNode } from 'ng-zorro-antd/core/tree';
2
- export interface ArrayServiceTreeToArrOptions<T extends object = any> {
3
- /** 深度项名,默认:`'deep'` */
4
- deepMapName?: string;
5
- /** 扁平后数组的父数据项名,默认:`'parent'` */
6
- parentMapName?: string;
7
- /** 源数据子项名,默认:`'children'` */
8
- childrenMapName?: string;
9
- /** 是否移除 `children` 节点,默认:`true` */
10
- clearChildren?: boolean;
11
- /** 转换成数组结构时回调 */
12
- cb?: (item: T, parent: T | null, deep: number) => void;
13
- }
14
- export interface ArrayServiceArrToTreeOptions<T extends object = any> {
15
- /** 编号项名,默认:`'id'` */
16
- idMapName?: string;
17
- /** 父编号项名,默认:`'parent_id'` */
18
- parentIdMapName?: string;
19
- /**
20
- * 根父编号值,默认会自动计算得到最合适的根父编号值,例如:
21
- *
22
- * @example
23
- * ```ts
24
- * const res = srv.arrToTree([
25
- * { id: 2, parent_id: 'a', title: 'c1' },
26
- * { id: 4, parent_id: 2, title: 't1' },
27
- * ],
28
- * { rootParentValue: 'a' });
29
- * ```
30
- */
31
- rootParentIdValue?: any;
32
- /** 子项名,默认:`'children'` */
33
- childrenMapName?: string;
34
- /** 转换成树数据时回调 */
35
- cb?: (item: T) => void;
36
- }
37
- export interface ArrayServiceArrToTreeNodeOptions<T extends object = any> {
38
- /** 编号项名,默认:`'id'` */
39
- idMapName?: string;
40
- /** 父编号项名,默认:`'parent_id'` */
41
- parentIdMapName?: string;
42
- /** 标题项名,默认:`'title'` */
43
- titleMapName?: string;
44
- /** 设置为叶子节点项名,若数据源不存在时自动根据 `children` 值决定是否为叶子节点,默认:`'isLeaf'` */
45
- isLeafMapName?: string;
46
- /** 节点 Checkbox 是否选中项名,默认:`'checked'` */
47
- checkedMapname?: string;
48
- /** 节点本身是否选中项名,默认:`'selected'` */
49
- selectedMapname?: string;
50
- /** 节点是否展开(叶子节点无效)项名,默认:`'expanded'` */
51
- expandedMapname?: string;
52
- /** 设置是否禁用节点(不可进行任何操作)项名,默认:`'disabled'` */
53
- disabledMapname?: string;
54
- /** 转换成树数据后,执行的递归回调 */
55
- cb?: (item: T, parent: T | null, deep: number) => void;
56
- }
57
- export interface ArrayServiceGetKeysByTreeNodeOptions {
58
- /** 是否包含半选状态的值,默认:`true` */
59
- includeHalfChecked?: boolean;
60
- /** 是否重新指定 `key` 键名,若不指定表示使用 `NzTreeNode.key` 值 */
61
- keyMapName?: string;
62
- /** 回调,返回一个值 `key` 值,优先级高于其他 */
63
- cb?: (item: NzTreeNode, parent: NzTreeNode | null, deep: number) => any;
64
- }
65
- export interface ArrayServiceGroupByResult {
66
- [key: string]: any;
67
- [key: number]: any;
68
- }
@@ -1,78 +0,0 @@
1
- import { AlainConfigService } from '@delon/util/config';
2
- import { NzTreeNode } from 'ng-zorro-antd/core/tree';
3
- import { ArrayServiceArrToTreeNodeOptions, ArrayServiceArrToTreeOptions, ArrayServiceGetKeysByTreeNodeOptions, ArrayServiceGroupByResult, ArrayServiceTreeToArrOptions } from './array-type.service';
4
- import * as i0 from "@angular/core";
5
- export declare class ArrayService {
6
- private c;
7
- constructor(cog: AlainConfigService);
8
- /**
9
- * Convert tree structure to array structure
10
- *
11
- * 将树结构转换成数组结构
12
- */
13
- treeToArr<T extends object = any>(tree: readonly T[], options?: ArrayServiceTreeToArrOptions<T>): T[];
14
- /**
15
- * Convert array structure to tree structure
16
- *
17
- * 数组转换成树数据
18
- */
19
- arrToTree<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeOptions<T>): T[];
20
- /**
21
- * 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项
22
- */
23
- arrToTreeNode<T extends object = any>(arr: readonly T[], options?: ArrayServiceArrToTreeNodeOptions): NzTreeNode[];
24
- /**
25
- * 递归访问整个树
26
- */
27
- visitTree<T extends object = any>(tree: readonly T[], cb: (item: T, parent: T | null, deep: number) => void, options?: {
28
- /** 子项名,默认:`'children'` */
29
- childrenMapName?: string;
30
- }): void;
31
- /**
32
- * Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise
33
- *
34
- * 根据条件返回树的第一个值,否则返回 `undefined`
35
- */
36
- findTree<T extends object = any>(tree: readonly T[], predicate: (item: T) => boolean, options?: {
37
- /** 子项名,默认:`'children'` */
38
- childrenMapName?: string;
39
- }): T | undefined;
40
- /**
41
- * 获取所有已经选中的 `key` 值
42
- */
43
- getKeysByTreeNode(tree: NzTreeNode[], options?: ArrayServiceGetKeysByTreeNodeOptions): any[];
44
- private baseFlat;
45
- /**
46
- * Recursively flattens array
47
- *
48
- * 递归扁平数组
49
- * ```ts
50
- * srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]
51
- * srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]
52
- * ```
53
- */
54
- flat<T>(array: readonly T[], depth?: number): T[];
55
- /**
56
- * Group the array
57
- *
58
- * 对数组进行分组
59
- * ```ts
60
- * srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {"4":[4.2],"6":[6.1,6.3]}
61
- * srv.groupBy(['one', 'two', 'three'], v => v.length) => {"3":["one","two"],"5":["three"]}
62
- * ```
63
- */
64
- groupBy<T>(array: readonly T[], iteratee: (value: T) => string | number): ArrayServiceGroupByResult;
65
- /**
66
- * Creates a duplicate-free version of an array
67
- *
68
- * 创建去重后的数组
69
- * ```ts
70
- * uniq([1, 2, 2, 3, 1]) => [1,2,3]
71
- * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{"a":1},{"a":2}]
72
- * uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{"a":1},{"a":2}]
73
- * ```
74
- */
75
- uniq<T>(array: readonly T[], predicate?: string | ((value: T) => string | number | boolean)): T[];
76
- static ɵfac: i0.ɵɵFactoryDeclaration<ArrayService, never>;
77
- static ɵprov: i0.ɵɵInjectableDeclaration<ArrayService>;
78
- }
@@ -1,62 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export interface CookieOptions {
3
- path?: string;
4
- domain?: string;
5
- /**
6
- * Expiration time, `number` is seconds
7
- *
8
- * 过期时间,`number` 类型表示秒数
9
- */
10
- expires?: number | Date | string;
11
- secure?: boolean;
12
- HttpOnly?: boolean;
13
- SameSite?: boolean | 'lax' | 'strict' | 'none';
14
- }
15
- /**
16
- * A set of simple Cookie manipulation classes.
17
- *
18
- * 一组简单的 Cookie 操作类。
19
- */
20
- export declare class CookieService {
21
- private readonly _doc;
22
- private readonly platform;
23
- private get doc();
24
- /**
25
- * Original cookie value
26
- *
27
- * 原始Cookie值
28
- */
29
- get cookie(): string;
30
- /**
31
- * Get all cookie key-value pairs
32
- *
33
- * 获取所有Cookie键值对
34
- */
35
- getAll(): Record<string, string>;
36
- /**
37
- * Get the value of given cookie `key`
38
- *
39
- * 获取指定 `key` 的值
40
- */
41
- get(key: string): string | undefined;
42
- /**
43
- * Sets a value for given cookie key
44
- *
45
- * 设置指定 Cookie 键的值
46
- */
47
- put(key: string, value: string, options?: CookieOptions): void;
48
- /**
49
- * Remove given cookie
50
- *
51
- * 移除指定 Cookie
52
- */
53
- remove(key: string, options?: CookieOptions): void;
54
- /**
55
- * Remove all cookies
56
- *
57
- * 移除所有 Cookies
58
- */
59
- removeAll(): void;
60
- static ɵfac: i0.ɵɵFactoryDeclaration<CookieService, never>;
61
- static ɵprov: i0.ɵɵInjectableDeclaration<CookieService>;
62
- }
package/browser/copy.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Copy text to clipboard
3
- *
4
- * 复制字符串文档至剪贴板
5
- */
6
- export declare function copy(value: string): Promise<string>;
@@ -1,6 +0,0 @@
1
- /**
2
- * Used to verify `<ng-content />` is empty, useful for custom components.
3
- *
4
- * 用于校验 `<ng-content />` 是否为空,自定义组件时蛮有用。
5
- */
6
- export declare function isEmpty(element: HTMLElement): boolean;
@@ -1,34 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class ScrollService {
3
- private readonly _doc;
4
- private readonly platform;
5
- private _getDoc;
6
- private _getWin;
7
- /**
8
- * 获取滚动条位置
9
- *
10
- * @param element 指定元素,默认 `window`
11
- */
12
- getScrollPosition(element?: Element | Window | null): [number, number];
13
- /**
14
- * 设置滚动条位置
15
- *
16
- * @param element 指定元素
17
- */
18
- scrollToPosition(element: Element | Window | null | undefined, position: [number, number]): void;
19
- /**
20
- * 设置滚动条至指定元素
21
- *
22
- * @param element 指定元素,默认 `document.body`
23
- * @param topOffset 偏移值,默认 `0`
24
- */
25
- scrollToElement(element?: Element | null, topOffset?: number): void;
26
- /**
27
- * 滚动至顶部
28
- *
29
- * @param topOffset 偏移值,默认 `0`
30
- */
31
- scrollToTop(topOffset?: number): void;
32
- static ɵfac: i0.ɵɵFactoryDeclaration<ScrollService, never>;
33
- static ɵprov: i0.ɵɵInjectableDeclaration<ScrollService>;
34
- }
@@ -1,19 +0,0 @@
1
- import { Renderer2 } from '@angular/core';
2
- /**
3
- * Update host component style `class`
4
- *
5
- * 更新宿主组件样式 `class`
6
- *
7
- * ```ts
8
- * updateHostClass(
9
- * this.el.nativeElement,
10
- * this.renderer,
11
- * {
12
- * [ 'classname' ]: true,
13
- * [ 'classname' ]: this.type === '1',
14
- * [ this.cls ]: true,
15
- * [ `a-${this.cls}` ]: true
16
- * })
17
- * ```
18
- */
19
- export declare function updateHostClass(el: HTMLElement, renderer: Renderer2, classMap: Record<string, unknown>, preClean?: boolean): void;