@yelon/util 18.3.0 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser/cookie.service.d.ts +1 -3
- package/browser/style.d.ts +1 -3
- package/config/abc/date-picker.type.d.ts +2 -5
- package/config/abc/exception.type.d.ts +5 -7
- package/config/abc/loading.type.d.ts +1 -3
- package/config/abc/media.type.d.ts +1 -2
- package/config/abc/st.type.d.ts +11 -18
- package/config/acl/acl.type.d.ts +1 -2
- package/config/chart/chart.type.d.ts +1 -4
- package/config/config.service.d.ts +5 -4
- package/config/sf/sf.type.d.ts +3 -6
- package/config/theme/responsive.type.d.ts +8 -10
- package/date-time/time.d.ts +1 -2
- package/decorator/convert.d.ts +2 -3
- package/fesm2022/array.mjs +4 -4
- package/fesm2022/array.mjs.map +1 -1
- package/fesm2022/browser.mjs +13 -16
- package/fesm2022/browser.mjs.map +1 -1
- package/fesm2022/config.mjs +33 -18
- package/fesm2022/config.mjs.map +1 -1
- package/fesm2022/date-time.mjs +1 -1
- package/fesm2022/date-time.mjs.map +1 -1
- package/fesm2022/decorator.mjs.map +1 -1
- package/fesm2022/format.mjs +9 -7
- package/fesm2022/format.mjs.map +1 -1
- package/fesm2022/mcache.mjs.map +1 -1
- package/fesm2022/mtypes.mjs +4 -5
- package/fesm2022/mtypes.mjs.map +1 -1
- package/fesm2022/other.mjs +17 -21
- package/fesm2022/other.mjs.map +1 -1
- package/fesm2022/pipe-currency.mjs +20 -26
- package/fesm2022/pipe-currency.mjs.map +1 -1
- package/fesm2022/pipe-filter.mjs +8 -8
- package/fesm2022/pipe-filter.mjs.map +1 -1
- package/fesm2022/pipe-format.mjs +8 -8
- package/fesm2022/pipe-format.mjs.map +1 -1
- package/format/string.d.ts +3 -6
- package/mtypes/header-menu.type.d.ts +2 -3
- package/mtypes/menu.type.d.ts +5 -6
- package/mtypes/page.d.ts +1 -2
- package/other/deep.d.ts +4 -7
- package/other/lazy.service.d.ts +2 -5
- package/other/logger.d.ts +3 -4
- package/other/path-to-regexp.service.d.ts +11 -12
- package/package.json +8 -42
- package/pipes/filter/filter.pipe.d.ts +1 -2
- package/esm2022/array/array-type.service.mjs +0 -2
- package/esm2022/array/array.mjs +0 -5
- package/esm2022/array/array.service.mjs +0 -278
- package/esm2022/array/index.mjs +0 -3
- package/esm2022/browser/browser.mjs +0 -5
- package/esm2022/browser/cookie.service.mjs +0 -100
- package/esm2022/browser/copy.mjs +0 -28
- package/esm2022/browser/index.mjs +0 -6
- package/esm2022/browser/is-empty.mjs +0 -19
- package/esm2022/browser/scroll.service.mjs +0 -85
- package/esm2022/browser/style.mjs +0 -38
- package/esm2022/config/abc/cell.type.mjs +0 -2
- package/esm2022/config/abc/date-picker.type.mjs +0 -2
- package/esm2022/config/abc/error-collect.type.mjs +0 -2
- package/esm2022/config/abc/exception.type.mjs +0 -2
- package/esm2022/config/abc/image.type.mjs +0 -2
- package/esm2022/config/abc/index.mjs +0 -18
- package/esm2022/config/abc/loading.type.mjs +0 -2
- package/esm2022/config/abc/lodop.type.mjs +0 -2
- package/esm2022/config/abc/media.type.mjs +0 -2
- package/esm2022/config/abc/onboarding.type.mjs +0 -2
- package/esm2022/config/abc/page-header.type.mjs +0 -2
- package/esm2022/config/abc/pdf.type.mjs +0 -2
- package/esm2022/config/abc/se.type.mjs +0 -2
- package/esm2022/config/abc/sg.type.mjs +0 -2
- package/esm2022/config/abc/st.type.mjs +0 -2
- package/esm2022/config/abc/sv.type.mjs +0 -3
- package/esm2022/config/abc/xlsx.type.mjs +0 -2
- package/esm2022/config/abc/zip.type.mjs +0 -2
- package/esm2022/config/acl/acl.type.mjs +0 -2
- package/esm2022/config/auth/auth.type.mjs +0 -2
- package/esm2022/config/bis/bis.type.mjs +0 -2
- package/esm2022/config/cache/cache.type.mjs +0 -2
- package/esm2022/config/chart/chart.type.mjs +0 -2
- package/esm2022/config/config.mjs +0 -5
- package/esm2022/config/config.service.mjs +0 -38
- package/esm2022/config/config.types.mjs +0 -12
- package/esm2022/config/index.mjs +0 -15
- package/esm2022/config/mock/mock.type.mjs +0 -2
- package/esm2022/config/sf/sf.type.mjs +0 -2
- package/esm2022/config/socket/socket.type.mjs +0 -2
- package/esm2022/config/theme/http.type.mjs +0 -2
- package/esm2022/config/theme/i18n.type.mjs +0 -2
- package/esm2022/config/theme/index.mjs +0 -5
- package/esm2022/config/theme/pipe.type.mjs +0 -2
- package/esm2022/config/theme/responsive.type.mjs +0 -2
- package/esm2022/config/util/array.type.mjs +0 -2
- package/esm2022/config/util/currency.type.mjs +0 -2
- package/esm2022/date-time/date-time.mjs +0 -5
- package/esm2022/date-time/index.mjs +0 -3
- package/esm2022/date-time/picker.mjs +0 -116
- package/esm2022/date-time/time.mjs +0 -103
- package/esm2022/decorator/convert.mjs +0 -66
- package/esm2022/decorator/decorator.mjs +0 -5
- package/esm2022/decorator/index.mjs +0 -3
- package/esm2022/decorator/zone-outside.mjs +0 -57
- package/esm2022/form/form.mjs +0 -5
- package/esm2022/form/index.mjs +0 -3
- package/esm2022/form/match-control.mjs +0 -30
- package/esm2022/form/validators.mjs +0 -81
- package/esm2022/format/currency.service.mjs +0 -233
- package/esm2022/format/currency.types.mjs +0 -8
- package/esm2022/format/format.mjs +0 -5
- package/esm2022/format/index.mjs +0 -5
- package/esm2022/format/string.mjs +0 -85
- package/esm2022/format/validate.mjs +0 -94
- package/esm2022/index.mjs +0 -14
- package/esm2022/math/in-range.mjs +0 -25
- package/esm2022/math/index.mjs +0 -3
- package/esm2022/math/math.mjs +0 -5
- package/esm2022/math/round.mjs +0 -53
- package/esm2022/mcache/index.mjs +0 -2
- package/esm2022/mcache/localStorageUtils.mjs +0 -60
- package/esm2022/mcache/mcache.mjs +0 -5
- package/esm2022/mtypes/authority.type.mjs +0 -2
- package/esm2022/mtypes/header-menu.type.mjs +0 -2
- package/esm2022/mtypes/index.mjs +0 -10
- package/esm2022/mtypes/menu.type.mjs +0 -2
- package/esm2022/mtypes/mtypes.mjs +0 -5
- package/esm2022/mtypes/nav.types.mjs +0 -9
- package/esm2022/mtypes/page.mjs +0 -42
- package/esm2022/mtypes/project-info.types.mjs +0 -2
- package/esm2022/mtypes/response.mjs +0 -2
- package/esm2022/mtypes/role.type.mjs +0 -2
- package/esm2022/mtypes/user.types.mjs +0 -2
- package/esm2022/other/assert.mjs +0 -67
- package/esm2022/other/deep.mjs +0 -78
- package/esm2022/other/favicon.mjs +0 -29
- package/esm2022/other/index.mjs +0 -8
- package/esm2022/other/lazy.service.mjs +0 -129
- package/esm2022/other/logger.mjs +0 -33
- package/esm2022/other/other.mjs +0 -5
- package/esm2022/other/path-to-regexp.service.mjs +0 -239
- package/esm2022/other/resize.mjs +0 -4
- package/esm2022/pipes/currency/cny.pipe.mjs +0 -23
- package/esm2022/pipes/currency/index.mjs +0 -5
- package/esm2022/pipes/currency/mega.pipe.mjs +0 -25
- package/esm2022/pipes/currency/module.mjs +0 -19
- package/esm2022/pipes/currency/pipe-currency.mjs +0 -5
- package/esm2022/pipes/currency/price.pipe.mjs +0 -27
- package/esm2022/pipes/filter/filter.pipe.mjs +0 -20
- package/esm2022/pipes/filter/index.mjs +0 -3
- package/esm2022/pipes/filter/module.mjs +0 -17
- package/esm2022/pipes/filter/pipe-filter.mjs +0 -5
- package/esm2022/pipes/format/index.mjs +0 -3
- package/esm2022/pipes/format/mask.pipe.mjs +0 -34
- package/esm2022/pipes/format/module.mjs +0 -17
- package/esm2022/pipes/format/pipe-format.mjs +0 -5
- package/esm2022/pipes/index.mjs +0 -4
- package/esm2022/pipes/pipes.mjs +0 -5
- package/esm2022/token/index.mjs +0 -3
- package/esm2022/token/page-visibility.mjs +0 -15
- package/esm2022/token/token.mjs +0 -5
- package/esm2022/token/window.mjs +0 -17
- package/esm2022/yelon-util.mjs +0 -5
package/README.md
CHANGED
@@ -7,7 +7,7 @@ Universal toolset of ng-yunzai.
|
|
7
7
|
|
8
8
|
+ [Document](https://ng.yunzainfo.com/util) ([Surge Mirror](https://ng-yunzai-doc.surge.sh/util)
|
9
9
|
+ [@yelon Source](https://github.com/hbyunzai/yelon)
|
10
|
-
+ [DEMO](https://ng-yunzai.surge.sh) ([国内镜像](https://ng.
|
10
|
+
+ [DEMO](https://ng-yunzai.surge.sh) ([国内镜像](https://ng-yunzai.gitee.io/))
|
11
11
|
|
12
12
|
## Architecture
|
13
13
|
|
package/browser/style.d.ts
CHANGED
@@ -16,6 +16,4 @@ import { Renderer2 } from '@angular/core';
|
|
16
16
|
* })
|
17
17
|
* ```
|
18
18
|
*/
|
19
|
-
export declare function updateHostClass(el: HTMLElement, renderer: Renderer2, classMap:
|
20
|
-
[klass: string]: unknown;
|
21
|
-
}, preClean?: boolean): void;
|
19
|
+
export declare function updateHostClass(el: HTMLElement, renderer: Renderer2, classMap: Record<string, unknown>, preClean?: boolean): void;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
2
1
|
import type { DisabledTimeFn, NzDateMode, PresetRanges, SupportTimeOptions } from 'ng-zorro-antd/date-picker';
|
3
2
|
export interface YunzaiDateRangePickerConfig {
|
4
3
|
/**
|
@@ -21,9 +20,7 @@ export interface YunzaiDateRangePickerConfig {
|
|
21
20
|
/**
|
22
21
|
* 默认:`{ position: 'relative' }`
|
23
22
|
*/
|
24
|
-
nzPopupStyle?:
|
25
|
-
[klass: string]: unknown;
|
26
|
-
};
|
23
|
+
nzPopupStyle?: Record<string, unknown>;
|
27
24
|
nzDropdownClassName?: string;
|
28
25
|
nzRenderExtraFooter?: string;
|
29
26
|
nzShowTime?: SupportTimeOptions | boolean;
|
@@ -46,7 +43,7 @@ export interface YunzaiDateRangePickerShortcut {
|
|
46
43
|
list?: YunzaiDateRangePickerShortcutItem[];
|
47
44
|
}
|
48
45
|
export interface YunzaiDateRangePickerShortcutItem {
|
49
|
-
[key: string]:
|
46
|
+
[key: string]: any;
|
50
47
|
text: string;
|
51
48
|
fn: (value: Array<Date | null>) => [Date | null, Date | null];
|
52
49
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
2
1
|
export interface YunzaiMediaConfig {
|
3
2
|
/**
|
4
3
|
* Plyr library path, default: `["https://cdn.bootcdn.net/ajax/libs/plyr/3.5.10/plyr.min.js", "https://cdn.bootcdn.net/ajax/libs/plyr/3.5.10/plyr.css"]`
|
@@ -7,5 +6,5 @@ export interface YunzaiMediaConfig {
|
|
7
6
|
/**
|
8
7
|
* Please refer to [plyr options](https://github.com/sampotts/plyr#options)
|
9
8
|
*/
|
10
|
-
options?:
|
9
|
+
options?: any;
|
11
10
|
}
|
package/config/abc/st.type.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { HttpHeaders, HttpParams } from '@angular/common/http';
|
2
2
|
import { TemplateRef, TrackByFunction } from '@angular/core';
|
3
3
|
import { Observable } from 'rxjs';
|
4
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
5
4
|
import type { NzDrawerOptions } from 'ng-zorro-antd/drawer';
|
6
5
|
import type { ModalOptions } from 'ng-zorro-antd/modal';
|
7
6
|
import type { PaginationItemRenderContext } from 'ng-zorro-antd/pagination';
|
@@ -43,11 +42,11 @@ export interface YunzaiSTConfig {
|
|
43
42
|
*
|
44
43
|
* 是否忽略参数中 `null` 或 `undefind` 值
|
45
44
|
*/
|
46
|
-
ignoreParamNull?:
|
45
|
+
ignoreParamNull?: boolean;
|
47
46
|
/** 请求方法,默认:`GET` */
|
48
47
|
method?: string;
|
49
48
|
/** 请求体 `Header` */
|
50
|
-
headers?:
|
49
|
+
headers?: any;
|
51
50
|
/**
|
52
51
|
* 重命名参数 `pi`、`ps`,默认:`{ pi: 'pi', ps: 'ps', skip: 'skip', limit: 'limit' }`
|
53
52
|
* - `{ pi: 'Page' }` => `pi` 会被替换成 Page
|
@@ -69,7 +68,7 @@ export interface YunzaiSTConfig {
|
|
69
68
|
/**
|
70
69
|
* 请求前数据处理
|
71
70
|
*/
|
72
|
-
process?: (requestOptions:
|
71
|
+
process?: (requestOptions: any) => any;
|
73
72
|
};
|
74
73
|
/** 返回体配置 */
|
75
74
|
res?: {
|
@@ -80,18 +79,18 @@ export interface YunzaiSTConfig {
|
|
80
79
|
reName?: {
|
81
80
|
total?: string | string[];
|
82
81
|
list?: string | string[];
|
83
|
-
} | ((result:
|
82
|
+
} | ((result: any, options: {
|
84
83
|
pi: number;
|
85
84
|
ps: number;
|
86
85
|
total: number;
|
87
86
|
}) => {
|
88
87
|
total: number;
|
89
|
-
list:
|
88
|
+
list: any[];
|
90
89
|
});
|
91
90
|
/**
|
92
91
|
* 数据预处理
|
93
92
|
*/
|
94
|
-
process?: (data:
|
93
|
+
process?: (data: any[], rawData?: any) => any[];
|
95
94
|
};
|
96
95
|
/** 返回体配置 */
|
97
96
|
page?: {
|
@@ -280,9 +279,7 @@ export interface YunzaiSTConfig {
|
|
280
279
|
/**
|
281
280
|
* Style of the popover card
|
282
281
|
*/
|
283
|
-
overlayStyle?:
|
284
|
-
[key: string]: string;
|
285
|
-
};
|
282
|
+
overlayStyle?: Record<string, string>;
|
286
283
|
/**
|
287
284
|
* Text of the Cancel button
|
288
285
|
*/
|
@@ -329,7 +326,7 @@ export interface YunzaiSTConfig {
|
|
329
326
|
/**
|
330
327
|
* 表格行的类名
|
331
328
|
*/
|
332
|
-
rowClassName?: (record:
|
329
|
+
rowClassName?: (record: any, index: number) => string;
|
333
330
|
/**
|
334
331
|
* 通过点击行来展开子行,Default: `false`
|
335
332
|
*/
|
@@ -403,14 +400,10 @@ export interface YunzaiSTConfig {
|
|
403
400
|
url: string;
|
404
401
|
options: {
|
405
402
|
body?: unknown;
|
406
|
-
headers?: HttpHeaders |
|
407
|
-
|
408
|
-
};
|
409
|
-
params?: HttpParams | {
|
410
|
-
[param: string]: string | string[];
|
411
|
-
};
|
403
|
+
headers?: HttpHeaders | Record<string, string | string[]>;
|
404
|
+
params?: HttpParams | Record<string, string | string[]>;
|
412
405
|
};
|
413
|
-
}) => Observable<
|
406
|
+
}) => Observable<any>;
|
414
407
|
/**
|
415
408
|
* Date format
|
416
409
|
*
|
package/config/acl/acl.type.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
2
1
|
export interface YunzaiACLConfig {
|
3
2
|
/**
|
4
3
|
* Router URL when guard fail, default: `/403`
|
@@ -28,5 +27,5 @@ export interface YunzaiACLType {
|
|
28
27
|
* 是否取反,即结果为 `true` 时表示未授权
|
29
28
|
*/
|
30
29
|
except?: boolean;
|
31
|
-
[key: string]:
|
30
|
+
[key: string]: any;
|
32
31
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
2
1
|
export interface YunzaiChartConfig {
|
3
2
|
/**
|
4
3
|
* [G2](https://g2.antv.vision/zh/docs/manual/getting-started) library path
|
@@ -8,9 +7,7 @@ export interface YunzaiChartConfig {
|
|
8
7
|
* ]`
|
9
8
|
*/
|
10
9
|
libs?: string[];
|
11
|
-
theme?: string |
|
12
|
-
[key: string]: NzSafeAny;
|
13
|
-
};
|
10
|
+
theme?: string | Record<string, any>;
|
14
11
|
/**
|
15
12
|
* [ECharts](https://echarts.apache.org/) library path
|
16
13
|
* default: `[
|
@@ -1,13 +1,14 @@
|
|
1
1
|
import { YunzaiConfig, YunzaiConfigKey } from './config.types';
|
2
2
|
import * as i0 from "@angular/core";
|
3
3
|
export declare class YunzaiConfigService {
|
4
|
-
private config;
|
5
|
-
constructor(defaultConfig?: YunzaiConfig);
|
4
|
+
private readonly config;
|
6
5
|
get<T extends YunzaiConfigKey>(componentName: T, key?: string): YunzaiConfig[T];
|
7
6
|
merge<T extends YunzaiConfigKey>(componentName: T, ...defaultValues: Array<YunzaiConfig[T]>): YunzaiConfig[T];
|
7
|
+
/**
|
8
|
+
* 将配置附加到当前实例中,支持 Signal 信号
|
9
|
+
*/
|
8
10
|
attach<T extends YunzaiConfigKey>(componentThis: unknown, componentName: T, defaultValues: YunzaiConfig[T]): void;
|
9
|
-
attachKey<T extends YunzaiConfigKey>(componentThis: unknown, componentName: T, key: string): void;
|
10
11
|
set<T extends YunzaiConfigKey>(componentName: T, value: YunzaiConfig[T]): void;
|
11
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<YunzaiConfigService,
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<YunzaiConfigService, never>;
|
12
13
|
static ɵprov: i0.ɵɵInjectableDeclaration<YunzaiConfigService>;
|
13
14
|
}
|
package/config/sf/sf.type.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { Options as AjvOptions } from 'ajv';
|
2
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
3
2
|
export interface YunzaiSFConfigFormatMap {
|
4
3
|
'date-time': {
|
5
4
|
widget?: string;
|
@@ -81,9 +80,7 @@ export interface YunzaiSFConfig {
|
|
81
80
|
/**
|
82
81
|
* 自定义通用错误信息,默认:`{}`
|
83
82
|
*/
|
84
|
-
errors?:
|
85
|
-
[key: string]: string;
|
86
|
-
};
|
83
|
+
errors?: Record<string, string>;
|
87
84
|
/**
|
88
85
|
* 默认全局布局,类型为:`SFUISchemaItem`,使用时加上可智能提示,例如:
|
89
86
|
*
|
@@ -91,7 +88,7 @@ export interface YunzaiSFConfig {
|
|
91
88
|
* ui: {} as SFUISchemaItem
|
92
89
|
* ```
|
93
90
|
*/
|
94
|
-
ui?:
|
91
|
+
ui?: any;
|
95
92
|
/**
|
96
93
|
* 元素组件大小,用于 `nzSize` 值
|
97
94
|
*/
|
@@ -103,7 +100,7 @@ export interface YunzaiSFConfig {
|
|
103
100
|
* button: {} as SFButton
|
104
101
|
* ```
|
105
102
|
*/
|
106
|
-
button?:
|
103
|
+
button?: any;
|
107
104
|
/**
|
108
105
|
* date小部件:`type="string"` 且不指定 `schema.format` 和 `ui.format` 时日期格式,默认:`yyyy-MM-dd HH:mm:ss`
|
109
106
|
*/
|
@@ -1,12 +1,10 @@
|
|
1
1
|
export interface YunzaiThemeResponsiveConfig {
|
2
|
-
rules: {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
};
|
11
|
-
};
|
2
|
+
rules: Record<number, {
|
3
|
+
xs: number;
|
4
|
+
sm?: number;
|
5
|
+
md?: number;
|
6
|
+
lg?: number;
|
7
|
+
xl?: number;
|
8
|
+
xxl?: number;
|
9
|
+
}>;
|
12
10
|
}
|
package/date-time/time.d.ts
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { YunzaiThemePipeDateFormatCustom } from '@yelon/util/config';
|
2
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
3
2
|
import { DateLocale } from 'ng-zorro-antd/i18n';
|
4
3
|
/**
|
5
4
|
* Get the time range, return `[ Date, Date]` for the start and end dates
|
@@ -21,7 +20,7 @@ export interface ToDateOptions {
|
|
21
20
|
/** If parsing fails try to parse the date by pressing `formatString` */
|
22
21
|
formatString?: string;
|
23
22
|
/** If parsing fails returned default value, default: `new Date(NaN)` */
|
24
|
-
defaultValue?:
|
23
|
+
defaultValue?: any;
|
25
24
|
timestampSecond?: boolean;
|
26
25
|
}
|
27
26
|
/**
|
package/decorator/convert.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { NzSafeAny } from 'ng-zorro-antd/core/types';
|
2
1
|
export type BooleanInput = boolean | string | undefined | null;
|
3
2
|
export type NumberInput = number | string | undefined | null;
|
4
3
|
export declare function toBoolean(value: unknown, defaultValue?: boolean | null | undefined): boolean | null | undefined;
|
@@ -14,7 +13,7 @@ export declare function toBoolean(value: unknown, defaultValue?: boolean | null
|
|
14
13
|
* {AT}Input() {AT}InputBoolean(null) visible: boolean = false;
|
15
14
|
* ```
|
16
15
|
*/
|
17
|
-
export declare function InputBoolean(defaultValue?: boolean | null):
|
16
|
+
export declare function InputBoolean(defaultValue?: boolean | null): any;
|
18
17
|
export declare function toNumber(value: unknown): number;
|
19
18
|
export declare function toNumber<D>(value: unknown, fallback: D): number | D;
|
20
19
|
/**
|
@@ -29,4 +28,4 @@ export declare function toNumber<D>(value: unknown, fallback: D): number | D;
|
|
29
28
|
* {AT}Input() {AT}InputNumber(null) visible: number = 2;
|
30
29
|
* ```
|
31
30
|
*/
|
32
|
-
export declare function InputNumber(defaultValue?: number | null):
|
31
|
+
export declare function InputNumber(defaultValue?: number | null): any;
|
package/fesm2022/array.mjs
CHANGED
@@ -3,8 +3,8 @@ import { Injectable } from '@angular/core';
|
|
3
3
|
import { NzTreeNode } from 'ng-zorro-antd/core/tree';
|
4
4
|
import * as i1 from '@yelon/util/config';
|
5
5
|
|
6
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
7
6
|
class ArrayService {
|
7
|
+
c;
|
8
8
|
constructor(cog) {
|
9
9
|
this.c = cog.merge('utilArray', {
|
10
10
|
deepMapName: 'deep',
|
@@ -269,10 +269,10 @@ class ArrayService {
|
|
269
269
|
}, new Map())
|
270
270
|
.values());
|
271
271
|
}
|
272
|
-
static
|
273
|
-
static
|
272
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ArrayService, deps: [{ token: i1.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
273
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ArrayService, providedIn: 'root' });
|
274
274
|
}
|
275
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
275
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ArrayService, decorators: [{
|
276
276
|
type: Injectable,
|
277
277
|
args: [{ providedIn: 'root' }]
|
278
278
|
}], ctorParameters: () => [{ type: i1.YunzaiConfigService }] });
|
package/fesm2022/array.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"array.mjs","sources":["../../../../packages/util/array/array.service.ts","../../../../packages/util/array/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,CAAA;AAGvB,IAAA,WAAA,CAAY,GAAwB,EAAA;QAClC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE;AAC9B,YAAA,WAAW,EAAE,MAAM;AACnB,YAAA,aAAa,EAAE,QAAQ;AACvB,YAAA,SAAS,EAAE,IAAI;AACf,YAAA,eAAe,EAAE,WAAW;AAC5B,YAAA,eAAe,EAAE,UAAU;AAC3B,YAAA,YAAY,EAAE,OAAO;AACrB,YAAA,cAAc,EAAE,SAAS;AACzB,YAAA,eAAe,EAAE,UAAU;AAC3B,YAAA,eAAe,EAAE,UAAU;AAC3B,YAAA,eAAe,EAAE;AAClB,SAAA,CAAE;;AAGL;;;;AAIG;IACH,SAAS,CAAyB,IAAkB,EAAE,OAAyC,EAAA;AAC7F,QAAA,MAAM,GAAG,GAAG;AACV,YAAA,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,WAAW;AAC/B,YAAA,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa;AACnC,YAAA,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,eAAe;AACvC,YAAA,aAAa,EAAE,IAAI;AACnB,YAAA,EAAE,EAAE,IAAI;AACR,YAAA,GAAG;SAC4B;QACjC,MAAM,MAAM,GAAkC,EAAE;QAChD,MAAM,IAAI,GAAG,CAAC,IAA2C,EAAE,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GAAG,GAAG;AACV,kBAAE,OAAO,SAAS,KAAK;AACrB,sBAAG,KAAa,CAAC,SAAS;AAC1B,sBAAE,SAAU,CAAC,KAAK;kBAClB,KAAK;YACT,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AACjB,gBAAA,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;;AAErB,YAAA,OAAO,GAAG;AACZ,SAAC,EAAE,IAAI,GAAG,EAAgC;aACzC,MAAM,EAAE,CACZ;;+GAhSQ,YAAY,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,mBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAZ,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA,CAAA;;4FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACdlC;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"array.mjs","sources":["../../../../packages/util/array/array.service.ts","../../../../packages/util/array/array.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\nimport { YunzaiConfigService, YunzaiUtilArrayConfig } from '@yelon/util/config';\n\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<Record<string, any>> = [];\n const inFn = (list: ReadonlyArray<Record<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: Record<string, T[]> = {};\n let rootPid = opt.rootParentIdValue;\n const arrType = arr as ReadonlyArray<Record<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: Record<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 Record<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":";;;;;MAea,YAAY,CAAA;AACf,IAAA,CAAC;AAET,IAAA,WAAA,CAAY,GAAwB,EAAA;QAClC,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE;A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,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA;;2FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACdlC;;AAEG;;;;"}
|
package/fesm2022/browser.mjs
CHANGED
@@ -9,10 +9,8 @@ import { inject, Injectable } from '@angular/core';
|
|
9
9
|
* 一组简单的 Cookie 操作类。
|
10
10
|
*/
|
11
11
|
class CookieService {
|
12
|
-
|
13
|
-
|
14
|
-
this.platform = inject(Platform);
|
15
|
-
}
|
12
|
+
_doc = inject(DOCUMENT);
|
13
|
+
platform = inject(Platform);
|
16
14
|
get doc() {
|
17
15
|
return this._doc || document;
|
18
16
|
}
|
@@ -32,6 +30,7 @@ class CookieService {
|
|
32
30
|
getAll() {
|
33
31
|
const ret = {};
|
34
32
|
const arr = this.cookie.split('; ');
|
33
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
35
34
|
for (let i = 0; i < arr.length; i++) {
|
36
35
|
const cookie = arr[i];
|
37
36
|
const index = cookie.indexOf('=');
|
@@ -73,7 +72,8 @@ class CookieService {
|
|
73
72
|
.filter(k => optStr[k] && optStr[k] !== true)
|
74
73
|
.map(k => `${k}=${optStr[k].split(';')[0]}`)
|
75
74
|
.join(';');
|
76
|
-
|
75
|
+
const keyValue = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}`;
|
76
|
+
this.doc.cookie = `${keyValue}${attributes ? `; ${attributes}` : ''}`;
|
77
77
|
}
|
78
78
|
/**
|
79
79
|
* Remove given cookie
|
@@ -91,10 +91,10 @@ class CookieService {
|
|
91
91
|
removeAll() {
|
92
92
|
this.doc.cookie = '';
|
93
93
|
}
|
94
|
-
static
|
95
|
-
static
|
94
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CookieService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
95
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CookieService, providedIn: 'root' });
|
96
96
|
}
|
97
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: CookieService, decorators: [{
|
98
98
|
type: Injectable,
|
99
99
|
args: [{ providedIn: 'root' }]
|
100
100
|
}] });
|
@@ -115,7 +115,6 @@ function copy(value) {
|
|
115
115
|
document.body.appendChild(copyTextArea);
|
116
116
|
copyTextArea.value = value;
|
117
117
|
copyTextArea.select();
|
118
|
-
// eslint-disable-next-line deprecation/deprecation
|
119
118
|
document.execCommand('copy');
|
120
119
|
resolve(value);
|
121
120
|
}
|
@@ -147,10 +146,8 @@ function isEmpty(element) {
|
|
147
146
|
}
|
148
147
|
|
149
148
|
class ScrollService {
|
150
|
-
|
151
|
-
|
152
|
-
this.platform = inject(Platform);
|
153
|
-
}
|
149
|
+
_doc = inject(DOCUMENT);
|
150
|
+
platform = inject(Platform);
|
154
151
|
_getDoc() {
|
155
152
|
return this._doc || document;
|
156
153
|
}
|
@@ -219,10 +216,10 @@ class ScrollService {
|
|
219
216
|
}
|
220
217
|
this.scrollToElement(this._getDoc().body, topOffset);
|
221
218
|
}
|
222
|
-
static
|
223
|
-
static
|
219
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ScrollService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
220
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
224
221
|
}
|
225
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.5", ngImport: i0, type: ScrollService, decorators: [{
|
226
223
|
type: Injectable,
|
227
224
|
args: [{ providedIn: 'root' }]
|
228
225
|
}] });
|
package/fesm2022/browser.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"browser.mjs","sources":["../../../../packages/util/browser/cookie.service.ts","../../../../packages/util/browser/copy.ts","../../../../packages/util/browser/is-empty.ts","../../../../packages/util/browser/scroll.service.ts","../../../../packages/util/browser/style.ts","../../../../packages/util/browser/browser.ts"],"sourcesContent":["import { Platform } from '@angular/cdk/platform';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nexport interface CookieOptions {\n path?: string;\n domain?: string;\n /**\n * Expiration time, `number` is seconds\n *\n * 过期时间,`number` 类型表示秒数\n */\n expires?: number | Date | string;\n secure?: boolean;\n HttpOnly?: boolean;\n SameSite?: boolean | 'lax' | 'strict' | 'none';\n}\n\n/**\n * A set of simple Cookie manipulation classes.\n *\n * 一组简单的 Cookie 操作类。\n */\n@Injectable({ providedIn: 'root' })\nexport class CookieService {\n private readonly _doc = inject(DOCUMENT);\n private readonly platform = inject(Platform);\n\n private get doc(): Document {\n return this._doc || document;\n }\n\n /**\n * Original cookie value\n *\n * 原始Cookie值\n */\n get cookie(): string {\n return this.platform.isBrowser ? this.doc.cookie : '';\n }\n\n /**\n * Get all cookie key-value pairs\n *\n * 获取所有Cookie键值对\n */\n getAll(): { [key: string]: string } {\n const ret: { [key: string]: string } = {};\n const arr = this.cookie.split('; ');\n for (let i = 0; i < arr.length; i++) {\n const cookie = arr[i];\n const index = cookie.indexOf('=');\n if (index > 0) {\n const name = decodeURIComponent(cookie.substring(0, index));\n if (ret[name] == null) {\n ret[name] = decodeURIComponent(cookie.substring(index + 1));\n }\n }\n }\n return ret;\n }\n\n /**\n * Get the value of given cookie `key`\n *\n * 获取指定 `key` 的值\n */\n get(key: string): string | undefined {\n return this.getAll()[key];\n }\n\n /**\n * Sets a value for given cookie key\n *\n * 设置指定 Cookie 键的值\n */\n put(key: string, value: string, options?: CookieOptions): void {\n if (!this.platform.isBrowser) {\n return;\n }\n const opt = { path: '/', ...options };\n if (typeof opt.expires === 'number') {\n opt.expires = new Date(+new Date() + opt.expires * 1e3);\n }\n if (typeof opt.expires !== 'string') {\n opt.expires = opt.expires ? opt.expires.toUTCString() : '';\n }\n const optStr: { [key: string]: string | boolean } = opt as NzSafeAny;\n const attributes = Object.keys(optStr)\n .filter(k => optStr[k] && optStr[k] !== true)\n .map(k => `${k}=${(optStr[k] as string).split(';')[0]}`)\n .join(';');\n this.doc.cookie = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}${\n attributes ? `; ${attributes}` : ''\n }`;\n }\n\n /**\n * Remove given cookie\n *\n * 移除指定 Cookie\n */\n remove(key: string, options?: CookieOptions): void {\n this.put(key, '', options);\n }\n\n /**\n * Remove all cookies\n *\n * 移除所有 Cookies\n */\n removeAll(): void {\n this.doc.cookie = '';\n }\n}\n","/**\n * Copy text to clipboard\n *\n * 复制字符串文档至剪贴板\n */\nexport function copy(value: string): Promise<string> {\n return new Promise<string>((resolve): void => {\n let copyTextArea: HTMLTextAreaElement | null = null;\n try {\n copyTextArea = document.createElement('textarea');\n copyTextArea.style.height = '0px';\n copyTextArea.style.opacity = '0';\n copyTextArea.style.width = '0px';\n document.body.appendChild(copyTextArea);\n copyTextArea.value = value;\n copyTextArea.select();\n // eslint-disable-next-line deprecation/deprecation\n document.execCommand('copy');\n resolve(value);\n } finally {\n if (copyTextArea && copyTextArea.parentNode) {\n copyTextArea.parentNode.removeChild(copyTextArea);\n }\n }\n });\n}\n","/**\n * Used to verify `<ng-content />` is empty, useful for custom components.\n *\n * 用于校验 `<ng-content />` 是否为空,自定义组件时蛮有用。\n */\nexport function isEmpty(element: HTMLElement): boolean {\n const nodes = element.childNodes;\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes.item(i);\n if (node.nodeType === 1 && (node as HTMLElement).outerHTML.toString().trim().length !== 0) {\n return false;\n } else if (node.nodeType === 3 && node.textContent!.toString().trim().length !== 0) {\n return false;\n }\n }\n return true;\n}\n","import { Platform } from '@angular/cdk/platform';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\nexport class ScrollService {\n private readonly _doc = inject(DOCUMENT);\n private readonly platform = inject(Platform);\n private _getDoc(): Document {\n return this._doc || document;\n }\n\n private _getWin(): Window {\n const doc = this._getDoc();\n return doc.defaultView || window;\n }\n\n /**\n * 获取滚动条位置\n *\n * @param element 指定元素,默认 `window`\n */\n getScrollPosition(element?: Element | Window | null): [number, number] {\n if (!this.platform.isBrowser) {\n return [0, 0];\n }\n\n const win = this._getWin();\n if (element && element !== win) {\n return [(element as Element).scrollLeft, (element as Element).scrollTop];\n } else {\n return [win.scrollX, win.scrollY];\n }\n }\n\n /**\n * 设置滚动条位置\n *\n * @param element 指定元素\n */\n scrollToPosition(element: Element | Window | null | undefined, position: [number, number]): void {\n if (!this.platform.isBrowser) {\n return;\n }\n (element || this._getWin()).scrollTo(position[0], position[1]);\n }\n\n /**\n * 设置滚动条至指定元素\n *\n * @param element 指定元素,默认 `document.body`\n * @param topOffset 偏移值,默认 `0`\n */\n scrollToElement(element?: Element | null, topOffset: number = 0): void {\n if (!this.platform.isBrowser) {\n return;\n }\n if (!element) {\n element = this._getDoc().body;\n }\n\n element.scrollIntoView();\n\n const win = this._getWin();\n if (win && win.scrollBy) {\n win.scrollBy(0, element!.getBoundingClientRect().top - topOffset);\n\n if (win.scrollY < 20) {\n win.scrollBy(0, -win.scrollY);\n }\n }\n }\n\n /**\n * 滚动至顶部\n *\n * @param topOffset 偏移值,默认 `0`\n */\n scrollToTop(topOffset: number = 0): void {\n if (!this.platform.isBrowser) {\n return;\n }\n this.scrollToElement(this._getDoc().body, topOffset);\n }\n}\n","import { Renderer2 } from '@angular/core';\n\nfunction removeClass(el: HTMLElement, classMap: { [klass: string]: unknown }, renderer: Renderer2): void {\n Object.keys(classMap).forEach(key => renderer.removeClass(el, key));\n}\n\nfunction addClass(el: HTMLElement, classMap: { [klass: string]: unknown }, renderer: Renderer2): void {\n for (const i in classMap) {\n if (classMap[i]) {\n renderer.addClass(el, i);\n }\n }\n}\n\n/**\n * Update host component style `class`\n *\n * 更新宿主组件样式 `class`\n *\n * ```ts\n * updateHostClass(\n * this.el.nativeElement,\n * this.renderer,\n * {\n * [ 'classname' ]: true,\n * [ 'classname' ]: this.type === '1',\n * [ this.cls ]: true,\n * [ `a-${this.cls}` ]: true\n * })\n * ```\n */\nexport function updateHostClass(\n el: HTMLElement,\n renderer: Renderer2,\n classMap: { [klass: string]: unknown },\n preClean: boolean = false\n): void {\n if (preClean === true) {\n renderer.removeAttribute(el, 'class');\n } else {\n removeClass(el, classMap, renderer);\n }\n classMap = { ...classMap };\n addClass(el, classMap, renderer);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAoBA;;;;AAIG;MAEU,aAAa,CAAA;AAD1B,IAAA,WAAA,GAAA;AAEmB,QAAA,IAAA,CAAA,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC;AACvB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAwF7C;AAtFC,IAAA,IAAY,GAAG,GAAA;AACb,QAAA,OAAO,IAAI,CAAC,IAAI,IAAI,QAAQ;;AAG9B;;;;AAIG;AACH,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE;;AAGvD;;;;AAIG;IACH,MAAM,GAAA;QACJ,MAAM,GAAG,GAA8B,EAAE;QACzC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,K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EAAE,QAAsC,EAAE,QAAmB,EAAA;IAC/F,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;AACrE;AAEA,SAAS,QAAQ,CAAC,EAAe,EAAE,QAAsC,EAAE,QAAmB,EAAA;AAC5F,IAAA,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE;AACxB,QAAA,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;AACf,YAAA,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC;;;AAG9B;AAEA;;;;;;;;;;;;;;;;AAgBG;AACG,SAAU,eAAe,CAC7B,EAAe,EACf,QAAmB,EACnB,QAAsC,EACtC,QAAA,GAAoB,KAAK,EAAA;AAEzB,IAAA,IAAI,QAAQ,KAAK,IAAI,EAAE;AACrB,QAAA,QAAQ,CAAC,eAAe,CAAC,EAAE,EAAE,OAAO,CAAC;;SAChC;AACL,QAAA,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC;;AAErC,IAAA,QAAQ,GAAG,EAAE,GAAG,QAAQ,EAAE;AAC1B,IAAA,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC;AAClC;;AC5CA;;AAEG;;;;"}
|
1
|
+
{"version":3,"file":"browser.mjs","sources":["../../../../packages/util/browser/cookie.service.ts","../../../../packages/util/browser/copy.ts","../../../../packages/util/browser/is-empty.ts","../../../../packages/util/browser/scroll.service.ts","../../../../packages/util/browser/style.ts","../../../../packages/util/browser/browser.ts"],"sourcesContent":["import { Platform } from '@angular/cdk/platform';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\nexport interface CookieOptions {\n path?: string;\n domain?: string;\n /**\n * Expiration time, `number` is seconds\n *\n * 过期时间,`number` 类型表示秒数\n */\n expires?: number | Date | string;\n secure?: boolean;\n HttpOnly?: boolean;\n SameSite?: boolean | 'lax' | 'strict' | 'none';\n}\n\n/**\n * A set of simple Cookie manipulation classes.\n *\n * 一组简单的 Cookie 操作类。\n */\n@Injectable({ providedIn: 'root' })\nexport class CookieService {\n private readonly _doc = inject(DOCUMENT);\n private readonly platform = inject(Platform);\n\n private get doc(): Document {\n return this._doc || document;\n }\n\n /**\n * Original cookie value\n *\n * 原始Cookie值\n */\n get cookie(): string {\n return this.platform.isBrowser ? this.doc.cookie : '';\n }\n\n /**\n * Get all cookie key-value pairs\n *\n * 获取所有Cookie键值对\n */\n getAll(): Record<string, string> {\n const ret: Record<string, string> = {};\n const arr = this.cookie.split('; ');\n // eslint-disable-next-line @typescript-eslint/prefer-for-of\n for (let i = 0; i < arr.length; i++) {\n const cookie = arr[i];\n const index = cookie.indexOf('=');\n if (index > 0) {\n const name = decodeURIComponent(cookie.substring(0, index));\n if (ret[name] == null) {\n ret[name] = decodeURIComponent(cookie.substring(index + 1));\n }\n }\n }\n return ret;\n }\n\n /**\n * Get the value of given cookie `key`\n *\n * 获取指定 `key` 的值\n */\n get(key: string): string | undefined {\n return this.getAll()[key];\n }\n\n /**\n * Sets a value for given cookie key\n *\n * 设置指定 Cookie 键的值\n */\n put(key: string, value: string, options?: CookieOptions): void {\n if (!this.platform.isBrowser) {\n return;\n }\n const opt = { path: '/', ...options };\n if (typeof opt.expires === 'number') {\n opt.expires = new Date(+new Date() + opt.expires * 1e3);\n }\n if (typeof opt.expires !== 'string') {\n opt.expires = opt.expires ? opt.expires.toUTCString() : '';\n }\n const optStr: Record<string, string | boolean> = opt as any;\n const attributes = Object.keys(optStr)\n .filter(k => optStr[k] && optStr[k] !== true)\n .map(k => `${k}=${(optStr[k] as string).split(';')[0]}`)\n .join(';');\n const keyValue = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}`;\n this.doc.cookie = `${keyValue}${attributes ? `; ${attributes}` : ''}`;\n }\n\n /**\n * Remove given cookie\n *\n * 移除指定 Cookie\n */\n remove(key: string, options?: CookieOptions): void {\n this.put(key, '', options);\n }\n\n /**\n * Remove all cookies\n *\n * 移除所有 Cookies\n */\n removeAll(): void {\n this.doc.cookie = '';\n }\n}\n","/**\n * Copy text to clipboard\n *\n * 复制字符串文档至剪贴板\n */\nexport function copy(value: string): Promise<string> {\n return new Promise<string>((resolve): void => {\n let copyTextArea: HTMLTextAreaElement | null = null;\n try {\n copyTextArea = document.createElement('textarea');\n copyTextArea.style.height = '0px';\n copyTextArea.style.opacity = '0';\n copyTextArea.style.width = '0px';\n document.body.appendChild(copyTextArea);\n copyTextArea.value = value;\n copyTextArea.select();\n document.execCommand('copy');\n resolve(value);\n } finally {\n if (copyTextArea && copyTextArea.parentNode) {\n copyTextArea.parentNode.removeChild(copyTextArea);\n }\n }\n });\n}\n","/**\n * Used to verify `<ng-content />` is empty, useful for custom components.\n *\n * 用于校验 `<ng-content />` 是否为空,自定义组件时蛮有用。\n */\nexport function isEmpty(element: HTMLElement): boolean {\n const nodes = element.childNodes;\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes.item(i);\n if (node.nodeType === 1 && (node as HTMLElement).outerHTML.toString().trim().length !== 0) {\n return false;\n } else if (node.nodeType === 3 && node.textContent!.toString().trim().length !== 0) {\n return false;\n }\n }\n return true;\n}\n","import { Platform } from '@angular/cdk/platform';\nimport { DOCUMENT } from '@angular/common';\nimport { Injectable, inject } from '@angular/core';\n\n@Injectable({ providedIn: 'root' })\nexport class ScrollService {\n private readonly _doc = inject(DOCUMENT);\n private readonly platform = inject(Platform);\n private _getDoc(): Document {\n return this._doc || document;\n }\n\n private _getWin(): Window {\n const doc = this._getDoc();\n return doc.defaultView || window;\n }\n\n /**\n * 获取滚动条位置\n *\n * @param element 指定元素,默认 `window`\n */\n getScrollPosition(element?: Element | Window | null): [number, number] {\n if (!this.platform.isBrowser) {\n return [0, 0];\n }\n\n const win = this._getWin();\n if (element && element !== win) {\n return [(element as Element).scrollLeft, (element as Element).scrollTop];\n } else {\n return [win.scrollX, win.scrollY];\n }\n }\n\n /**\n * 设置滚动条位置\n *\n * @param element 指定元素\n */\n scrollToPosition(element: Element | Window | null | undefined, position: [number, number]): void {\n if (!this.platform.isBrowser) {\n return;\n }\n (element || this._getWin()).scrollTo(position[0], position[1]);\n }\n\n /**\n * 设置滚动条至指定元素\n *\n * @param element 指定元素,默认 `document.body`\n * @param topOffset 偏移值,默认 `0`\n */\n scrollToElement(element?: Element | null, topOffset: number = 0): void {\n if (!this.platform.isBrowser) {\n return;\n }\n if (!element) {\n element = this._getDoc().body;\n }\n\n element.scrollIntoView();\n\n const win = this._getWin();\n if (win && win.scrollBy) {\n win.scrollBy(0, element!.getBoundingClientRect().top - topOffset);\n\n if (win.scrollY < 20) {\n win.scrollBy(0, -win.scrollY);\n }\n }\n }\n\n /**\n * 滚动至顶部\n *\n * @param topOffset 偏移值,默认 `0`\n */\n scrollToTop(topOffset: number = 0): void {\n if (!this.platform.isBrowser) {\n return;\n }\n this.scrollToElement(this._getDoc().body, topOffset);\n }\n}\n","import { Renderer2 } from '@angular/core';\n\nfunction removeClass(el: HTMLElement, classMap: Record<string, unknown>, renderer: Renderer2): void {\n Object.keys(classMap).forEach(key => renderer.removeClass(el, key));\n}\n\nfunction addClass(el: HTMLElement, classMap: Record<string, unknown>, renderer: Renderer2): void {\n for (const i in classMap) {\n if (classMap[i]) {\n renderer.addClass(el, i);\n }\n }\n}\n\n/**\n * Update host component style `class`\n *\n * 更新宿主组件样式 `class`\n *\n * ```ts\n * updateHostClass(\n * this.el.nativeElement,\n * this.renderer,\n * {\n * [ 'classname' ]: true,\n * [ 'classname' ]: this.type === '1',\n * [ this.cls ]: true,\n * [ `a-${this.cls}` ]: true\n * })\n * ```\n */\nexport function updateHostClass(\n el: HTMLElement,\n renderer: Renderer2,\n classMap: Record<string, unknown>,\n preClean: boolean = false\n): void {\n if (preClean === true) {\n renderer.removeAttribute(el, 'class');\n } else {\n removeClass(el, classMap, renderer);\n }\n classMap = { ...classMap };\n addClass(el, classMap, renderer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