@yelon/util 15.2.6 → 16.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +22 -22
- package/analysis/global-event.subject.d.ts +7 -7
- package/analysis/index.d.ts +1 -1
- package/array/array-type.service.d.ts +68 -68
- package/array/array.service.d.ts +78 -78
- package/array/index.d.ts +2 -2
- package/browser/cookie.service.d.ts +67 -67
- package/browser/copy.d.ts +6 -6
- package/browser/index.d.ts +5 -5
- package/browser/is-empty.d.ts +6 -6
- package/browser/scroll.service.d.ts +37 -37
- package/browser/style.d.ts +21 -21
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/exception.type.d.ts +9 -9
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +17 -17
- package/config/abc/loading.type.d.ts +31 -31
- package/config/abc/lodop.type.d.ts +33 -33
- package/config/abc/media.type.d.ts +11 -11
- package/config/abc/onboarding.type.d.ts +4 -4
- package/config/abc/page-header.type.d.ts +39 -39
- package/config/abc/pdf.type.d.ts +35 -35
- package/config/abc/qr.type.d.ts +25 -25
- package/config/abc/se.type.d.ts +32 -32
- package/config/abc/sg.type.d.ts +10 -10
- package/config/abc/st.type.d.ts +465 -465
- package/config/abc/sv.type.d.ts +14 -14
- package/config/abc/xlsx.type.d.ts +12 -12
- package/config/abc/zip.type.d.ts +10 -10
- package/config/acl/acl.type.d.ts +32 -32
- package/config/auth/auth.type.d.ts +55 -55
- package/config/bis/bis.type.d.ts +7 -7
- package/config/cache/cache.type.d.ts +40 -40
- package/config/chart/chart.type.d.ts +33 -33
- package/config/config.service.d.ts +13 -13
- package/config/config.types.d.ts +48 -48
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/sf/sf.type.d.ts +133 -133
- package/config/socket/socket.type.d.ts +4 -4
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +14 -14
- package/config/theme/index.d.ts +3 -3
- package/config/theme/responsive.type.d.ts +12 -12
- package/config/util/array.type.d.ts +22 -22
- package/config/util/currency.type.d.ts +39 -39
- package/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +29 -29
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/zone-outside.d.ts +35 -35
- package/{esm2020 → esm2022}/analysis/analysis.mjs +4 -4
- package/esm2022/analysis/global-event.subject.mjs +18 -0
- package/{esm2020 → esm2022}/analysis/index.mjs +2 -2
- package/{esm2020 → esm2022}/array/array-type.service.mjs +1 -1
- package/{esm2020 → esm2022}/array/array.mjs +4 -4
- package/esm2022/array/array.service.mjs +278 -0
- package/{esm2020 → esm2022}/array/index.mjs +2 -2
- package/{esm2020 → esm2022}/browser/browser.mjs +4 -4
- package/esm2022/browser/cookie.service.mjs +104 -0
- package/{esm2020 → esm2022}/browser/copy.mjs +27 -27
- package/{esm2020 → esm2022}/browser/index.mjs +5 -5
- package/{esm2020 → esm2022}/browser/is-empty.mjs +18 -18
- package/esm2022/browser/scroll.service.mjs +89 -0
- package/{esm2020 → esm2022}/browser/style.mjs +37 -37
- package/{esm2020 → esm2022}/config/abc/date-picker.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/error-collect.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/exception.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/image.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/index.mjs +17 -17
- package/{esm2020 → esm2022}/config/abc/loading.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/lodop.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/media.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/onboarding.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/page-header.type.mjs +1 -1
- package/esm2022/config/abc/pdf.type.mjs +2 -0
- package/{esm2020 → esm2022}/config/abc/qr.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/se.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/sg.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/st.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/sv.type.mjs +2 -2
- package/{esm2020 → esm2022}/config/abc/xlsx.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/zip.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/acl/acl.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/auth/auth.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/bis/bis.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/cache/cache.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/chart/chart.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/config.mjs +4 -4
- package/esm2022/config/config.service.mjs +38 -0
- package/{esm2020 → esm2022}/config/config.types.mjs +8 -8
- package/{esm2020 → esm2022}/config/index.mjs +14 -14
- package/{esm2020 → esm2022}/config/mock/mock.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/sf/sf.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/socket/socket.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/theme/http.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/theme/i18n.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/theme/index.mjs +3 -3
- package/{esm2020 → esm2022}/config/theme/responsive.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/util/array.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/util/currency.type.mjs +1 -1
- package/{esm2020 → esm2022}/date-time/date-time.mjs +4 -4
- package/{esm2020 → esm2022}/date-time/index.mjs +2 -2
- package/{esm2020 → esm2022}/date-time/picker.mjs +115 -115
- package/{esm2020 → esm2022}/date-time/time.mjs +88 -88
- package/{esm2020 → esm2022}/decorator/convert.mjs +57 -57
- package/{esm2020 → esm2022}/decorator/decorator.mjs +4 -4
- package/{esm2020 → esm2022}/decorator/index.mjs +2 -2
- package/{esm2020 → esm2022}/decorator/zone-outside.mjs +56 -56
- package/{esm2020 → esm2022}/form/form.mjs +4 -4
- package/{esm2020 → esm2022}/form/index.mjs +2 -2
- package/{esm2020 → esm2022}/form/match-control.mjs +29 -29
- package/{esm2020 → esm2022}/form/validators.mjs +80 -80
- package/esm2022/format/currency.service.mjs +239 -0
- package/{esm2020 → esm2022}/format/currency.types.mjs +7 -7
- package/{esm2020 → esm2022}/format/format.mjs +4 -4
- package/{esm2020 → esm2022}/format/index.mjs +4 -4
- package/{esm2020 → esm2022}/format/string.mjs +84 -84
- package/{esm2020 → esm2022}/format/validate.mjs +93 -93
- package/{esm2020 → esm2022}/index.mjs +12 -12
- package/{esm2020 → esm2022}/math/in-range.mjs +24 -24
- package/{esm2020 → esm2022}/math/index.mjs +2 -2
- package/{esm2020 → esm2022}/math/math.mjs +4 -4
- package/{esm2020 → esm2022}/math/round.mjs +52 -52
- package/{esm2020 → esm2022}/other/assert.mjs +66 -66
- package/{esm2020 → esm2022}/other/deep.mjs +77 -77
- package/{esm2020 → esm2022}/other/favicon.mjs +28 -28
- package/{esm2020 → esm2022}/other/index.mjs +7 -7
- package/esm2022/other/lazy.service.mjs +133 -0
- package/{esm2020 → esm2022}/other/logger.mjs +32 -32
- package/{esm2020 → esm2022}/other/other.mjs +4 -4
- package/esm2022/other/path-to-regexp.service.mjs +240 -0
- package/{esm2020 → esm2022}/other/resize.mjs +3 -3
- package/esm2022/pipes/currency/cny.pipe.mjs +24 -0
- package/{esm2020 → esm2022}/pipes/currency/index.mjs +4 -4
- package/esm2022/pipes/currency/mega.pipe.mjs +30 -0
- package/esm2022/pipes/currency/module.mjs +20 -0
- package/{esm2020 → esm2022}/pipes/currency/pipe-currency.mjs +4 -4
- package/esm2022/pipes/currency/price.pipe.mjs +28 -0
- package/esm2022/pipes/filter/filter.pipe.mjs +20 -0
- package/{esm2020 → esm2022}/pipes/filter/index.mjs +2 -2
- package/esm2022/pipes/filter/module.mjs +18 -0
- package/{esm2020 → esm2022}/pipes/filter/pipe-filter.mjs +4 -4
- package/{esm2020 → esm2022}/pipes/format/index.mjs +2 -2
- package/esm2022/pipes/format/mask.pipe.mjs +35 -0
- package/esm2022/pipes/format/module.mjs +18 -0
- package/{esm2020 → esm2022}/pipes/format/pipe-format.mjs +4 -4
- package/{esm2020 → esm2022}/pipes/index.mjs +3 -3
- package/{esm2020 → esm2022}/pipes/pipes.mjs +4 -4
- package/{esm2020 → esm2022}/token/index.mjs +2 -2
- package/{esm2020 → esm2022}/token/page-visibility.mjs +14 -14
- package/{esm2020 → esm2022}/token/token.mjs +4 -4
- package/{esm2020 → esm2022}/token/window.mjs +16 -16
- package/{esm2020 → esm2022}/yelon-util.mjs +4 -4
- package/{fesm2020 → fesm2022}/analysis.mjs +24 -24
- package/fesm2022/analysis.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/array.mjs +284 -284
- package/{fesm2015 → fesm2022}/array.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/browser.mjs +279 -279
- package/{fesm2020 → fesm2022}/browser.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/config.mjs +54 -54
- package/{fesm2020 → fesm2022}/config.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/date-time.mjs +211 -211
- package/{fesm2020 → fesm2022}/decorator.mjs +121 -121
- package/{fesm2020 → fesm2022}/form.mjs +118 -118
- package/{fesm2020 → fesm2022}/format.mjs +431 -431
- package/{fesm2020 → fesm2022}/format.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/math.mjs +85 -85
- package/{fesm2020 → fesm2022}/other.mjs +586 -586
- package/{fesm2020 → fesm2022}/other.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/pipe-currency.mjs +94 -94
- package/{fesm2020 → fesm2022}/pipe-currency.mjs.map +1 -1
- package/fesm2022/pipe-filter.mjs +40 -0
- package/{fesm2015 → fesm2022}/pipe-filter.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/pipe-format.mjs +55 -55
- package/{fesm2015 → fesm2022}/pipe-format.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/pipes.mjs +8 -8
- package/{fesm2020 → fesm2022}/token.mjs +37 -37
- package/{fesm2015 → fesm2022}/yelon-util.mjs +17 -17
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/format/currency.service.d.ts +37 -37
- package/format/currency.types.d.ts +77 -77
- package/format/index.d.ts +4 -4
- package/format/string.d.ts +44 -44
- package/format/validate.d.ts +72 -72
- package/index.d.ts +12 -12
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +35 -35
- package/other/favicon.d.ts +2 -2
- package/other/index.d.ts +7 -7
- package/other/lazy.service.d.ts +48 -48
- package/other/logger.d.ts +5 -5
- package/other/path-to-regexp.service.d.ts +26 -26
- package/other/resize.d.ts +1 -1
- package/package.json +129 -165
- package/pipes/currency/cny.pipe.d.ts +15 -15
- package/pipes/currency/index.d.ts +4 -4
- package/pipes/currency/mega.pipe.d.ts +16 -16
- package/pipes/currency/module.d.ts +9 -9
- package/pipes/currency/price.pipe.d.ts +19 -19
- package/pipes/filter/filter.pipe.d.ts +13 -13
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +7 -7
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +27 -27
- package/pipes/format/module.d.ts +7 -7
- package/pipes/index.d.ts +3 -3
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
- package/esm2020/analysis/global-event.subject.mjs +0 -17
- package/esm2020/array/array.service.mjs +0 -277
- package/esm2020/browser/cookie.service.mjs +0 -103
- package/esm2020/browser/scroll.service.mjs +0 -88
- package/esm2020/config/abc/pdf.type.mjs +0 -2
- package/esm2020/config/config.service.mjs +0 -37
- package/esm2020/format/currency.service.mjs +0 -238
- package/esm2020/other/lazy.service.mjs +0 -132
- package/esm2020/other/path-to-regexp.service.mjs +0 -239
- package/esm2020/pipes/currency/cny.pipe.mjs +0 -23
- package/esm2020/pipes/currency/mega.pipe.mjs +0 -29
- package/esm2020/pipes/currency/module.mjs +0 -19
- package/esm2020/pipes/currency/price.pipe.mjs +0 -27
- package/esm2020/pipes/filter/filter.pipe.mjs +0 -19
- package/esm2020/pipes/filter/module.mjs +0 -17
- package/esm2020/pipes/format/mask.pipe.mjs +0 -34
- package/esm2020/pipes/format/module.mjs +0 -17
- package/fesm2015/analysis.mjs +0 -24
- package/fesm2015/analysis.mjs.map +0 -1
- package/fesm2015/array.mjs +0 -254
- package/fesm2015/browser.mjs +0 -283
- package/fesm2015/browser.mjs.map +0 -1
- package/fesm2015/config.mjs +0 -56
- package/fesm2015/config.mjs.map +0 -1
- package/fesm2015/date-time.mjs +0 -207
- package/fesm2015/date-time.mjs.map +0 -1
- package/fesm2015/decorator.mjs +0 -121
- package/fesm2015/decorator.mjs.map +0 -1
- package/fesm2015/form.mjs +0 -118
- package/fesm2015/format.mjs +0 -413
- package/fesm2015/format.mjs.map +0 -1
- package/fesm2015/math.mjs +0 -85
- package/fesm2015/other.mjs +0 -589
- package/fesm2015/other.mjs.map +0 -1
- package/fesm2015/pipe-currency.mjs +0 -96
- package/fesm2015/pipe-currency.mjs.map +0 -1
- package/fesm2015/pipe-filter.mjs +0 -40
- package/fesm2015/pipe-format.mjs +0 -55
- package/fesm2015/token.mjs +0 -37
- package/fesm2020/analysis.mjs.map +0 -1
- package/fesm2020/array.mjs.map +0 -1
- package/fesm2020/form.mjs.map +0 -1
- package/fesm2020/math.mjs.map +0 -1
- package/fesm2020/pipe-filter.mjs +0 -40
- package/fesm2020/pipe-filter.mjs.map +0 -1
- package/fesm2020/pipe-format.mjs.map +0 -1
- package/fesm2020/pipes.mjs +0 -8
- package/fesm2020/pipes.mjs.map +0 -1
- package/fesm2020/token.mjs.map +0 -1
- package/fesm2020/yelon-util.mjs +0 -17
- package/fesm2020/yelon-util.mjs.map +0 -1
- /package/{fesm2020 → fesm2022}/date-time.mjs.map +0 -0
- /package/{fesm2020 → fesm2022}/decorator.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/form.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/math.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/pipes.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/token.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/yelon-util.mjs.map +0 -0
@@ -1,17 +0,0 @@
|
|
1
|
-
import { Injectable } from '@angular/core';
|
2
|
-
import { Subject } from 'rxjs';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
export class GlobalEventSubjectService {
|
5
|
-
constructor() {
|
6
|
-
this.clickEvents = new Subject();
|
7
|
-
}
|
8
|
-
}
|
9
|
-
GlobalEventSubjectService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GlobalEventSubjectService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
10
|
-
GlobalEventSubjectService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GlobalEventSubjectService, providedIn: 'root' });
|
11
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: GlobalEventSubjectService, decorators: [{
|
12
|
-
type: Injectable,
|
13
|
-
args: [{
|
14
|
-
providedIn: 'root'
|
15
|
-
}]
|
16
|
-
}] });
|
17
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2xvYmFsLWV2ZW50LnN1YmplY3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2FuYWx5c2lzL2dsb2JhbC1ldmVudC5zdWJqZWN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLE1BQU0sQ0FBQzs7QUFLL0IsTUFBTSxPQUFPLHlCQUF5QjtJQUh0QztRQUlTLGdCQUFXLEdBQUcsSUFBSSxPQUFPLEVBQVMsQ0FBQztLQUMzQzs7c0hBRlkseUJBQXlCOzBIQUF6Qix5QkFBeUIsY0FGeEIsTUFBTTsyRkFFUCx5QkFBeUI7a0JBSHJDLFVBQVU7bUJBQUM7b0JBQ1YsVUFBVSxFQUFFLE1BQU07aUJBQ25CIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgSW5qZWN0YWJsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xyXG5pbXBvcnQgeyBTdWJqZWN0IH0gZnJvbSAncnhqcyc7XHJcblxyXG5ASW5qZWN0YWJsZSh7XHJcbiAgcHJvdmlkZWRJbjogJ3Jvb3QnXHJcbn0pXHJcbmV4cG9ydCBjbGFzcyBHbG9iYWxFdmVudFN1YmplY3RTZXJ2aWNlIHtcclxuICBwdWJsaWMgY2xpY2tFdmVudHMgPSBuZXcgU3ViamVjdDxFdmVudD4oKTtcclxufVxyXG4iXX0=
|
@@ -1,277 +0,0 @@
|
|
1
|
-
import { Injectable } from '@angular/core';
|
2
|
-
import { NzTreeNode } from 'ng-zorro-antd/core/tree';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
import * as i1 from "@yelon/util/config";
|
5
|
-
export class ArrayService {
|
6
|
-
constructor(cog) {
|
7
|
-
this.c = cog.merge('utilArray', {
|
8
|
-
deepMapName: 'deep',
|
9
|
-
parentMapName: 'parent',
|
10
|
-
idMapName: 'id',
|
11
|
-
parentIdMapName: 'parent_id',
|
12
|
-
childrenMapName: 'children',
|
13
|
-
titleMapName: 'title',
|
14
|
-
checkedMapname: 'checked',
|
15
|
-
selectedMapname: 'selected',
|
16
|
-
expandedMapname: 'expanded',
|
17
|
-
disabledMapname: 'disabled'
|
18
|
-
});
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* Convert tree structure to array structure
|
22
|
-
*
|
23
|
-
* 将树结构转换成数组结构
|
24
|
-
*/
|
25
|
-
treeToArr(tree, options) {
|
26
|
-
const opt = {
|
27
|
-
deepMapName: this.c.deepMapName,
|
28
|
-
parentMapName: this.c.parentMapName,
|
29
|
-
childrenMapName: this.c.childrenMapName,
|
30
|
-
clearChildren: true,
|
31
|
-
cb: null,
|
32
|
-
...options
|
33
|
-
};
|
34
|
-
const result = [];
|
35
|
-
const inFn = (list, parent, deep = 0) => {
|
36
|
-
for (const i of list) {
|
37
|
-
i[opt.deepMapName] = deep;
|
38
|
-
i[opt.parentMapName] = parent;
|
39
|
-
if (opt.cb) {
|
40
|
-
opt.cb(i, parent, deep);
|
41
|
-
}
|
42
|
-
result.push(i);
|
43
|
-
const children = i[opt.childrenMapName];
|
44
|
-
if (children != null && Array.isArray(children) && children.length > 0) {
|
45
|
-
inFn(children, i, deep + 1);
|
46
|
-
}
|
47
|
-
if (opt.clearChildren) {
|
48
|
-
delete i[opt.childrenMapName];
|
49
|
-
}
|
50
|
-
}
|
51
|
-
};
|
52
|
-
inFn(tree, null);
|
53
|
-
return result;
|
54
|
-
}
|
55
|
-
/**
|
56
|
-
* Convert array structure to tree structure
|
57
|
-
*
|
58
|
-
* 数组转换成树数据
|
59
|
-
*/
|
60
|
-
arrToTree(arr, options) {
|
61
|
-
if (!Array.isArray(arr) || arr.length === 0) {
|
62
|
-
return [];
|
63
|
-
}
|
64
|
-
const opt = {
|
65
|
-
idMapName: this.c.idMapName,
|
66
|
-
parentIdMapName: this.c.parentIdMapName,
|
67
|
-
childrenMapName: this.c.childrenMapName,
|
68
|
-
cb: null,
|
69
|
-
...options
|
70
|
-
};
|
71
|
-
const tree = [];
|
72
|
-
const childrenOf = {};
|
73
|
-
let rootPid = opt.rootParentIdValue;
|
74
|
-
const arrType = arr;
|
75
|
-
if (!rootPid) {
|
76
|
-
const pids = arrType.map(i => i[opt.parentIdMapName]);
|
77
|
-
const emptyPid = pids.findIndex(w => w == null);
|
78
|
-
rootPid = emptyPid !== -1 ? pids[emptyPid] : pids.sort()[0];
|
79
|
-
}
|
80
|
-
for (const item of arrType) {
|
81
|
-
const id = item[opt.idMapName];
|
82
|
-
const pid = item[opt.parentIdMapName];
|
83
|
-
childrenOf[id] = childrenOf[id] || [];
|
84
|
-
item[opt.childrenMapName] = childrenOf[id];
|
85
|
-
if (opt.cb) {
|
86
|
-
opt.cb(item);
|
87
|
-
}
|
88
|
-
if (pid !== rootPid) {
|
89
|
-
childrenOf[pid] = childrenOf[pid] || [];
|
90
|
-
childrenOf[pid].push(item);
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
tree.push(item);
|
94
|
-
}
|
95
|
-
}
|
96
|
-
return tree;
|
97
|
-
}
|
98
|
-
/**
|
99
|
-
* 数组转换成 `nz-tree` 数据源,通过 `options` 转化项名,也可以使用 `options.cb` 更高级决定数据项
|
100
|
-
*/
|
101
|
-
arrToTreeNode(arr, options) {
|
102
|
-
const opt = {
|
103
|
-
idMapName: this.c.idMapName,
|
104
|
-
parentIdMapName: this.c.parentIdMapName,
|
105
|
-
titleMapName: this.c.titleMapName,
|
106
|
-
isLeafMapName: 'isLeaf',
|
107
|
-
checkedMapname: this.c.checkedMapname,
|
108
|
-
selectedMapname: this.c.selectedMapname,
|
109
|
-
expandedMapname: this.c.expandedMapname,
|
110
|
-
disabledMapname: this.c.disabledMapname,
|
111
|
-
cb: null,
|
112
|
-
...options
|
113
|
-
};
|
114
|
-
const tree = this.arrToTree(arr, {
|
115
|
-
idMapName: opt.idMapName,
|
116
|
-
parentIdMapName: opt.parentIdMapName,
|
117
|
-
childrenMapName: 'children'
|
118
|
-
});
|
119
|
-
this.visitTree(tree, (item, parent, deep) => {
|
120
|
-
item.key = item[opt.idMapName];
|
121
|
-
item.title = item[opt.titleMapName];
|
122
|
-
item.checked = item[opt.checkedMapname];
|
123
|
-
item.selected = item[opt.selectedMapname];
|
124
|
-
item.expanded = item[opt.expandedMapname];
|
125
|
-
item.disabled = item[opt.disabledMapname];
|
126
|
-
if (item[opt.isLeafMapName] == null) {
|
127
|
-
item.isLeaf = item.children.length === 0;
|
128
|
-
}
|
129
|
-
else {
|
130
|
-
item.isLeaf = item[opt.isLeafMapName];
|
131
|
-
}
|
132
|
-
if (opt.cb) {
|
133
|
-
opt.cb(item, parent, deep);
|
134
|
-
}
|
135
|
-
});
|
136
|
-
return tree.map(node => new NzTreeNode(node));
|
137
|
-
}
|
138
|
-
/**
|
139
|
-
* 递归访问整个树
|
140
|
-
*/
|
141
|
-
visitTree(tree, cb, options) {
|
142
|
-
options = {
|
143
|
-
childrenMapName: this.c.childrenMapName,
|
144
|
-
...options
|
145
|
-
};
|
146
|
-
const inFn = (data, parent, deep) => {
|
147
|
-
for (const item of data) {
|
148
|
-
cb(item, parent, deep);
|
149
|
-
const childrenVal = item[options.childrenMapName];
|
150
|
-
if (Array.isArray(childrenVal) && childrenVal.length > 0) {
|
151
|
-
inFn(childrenVal, item, deep + 1);
|
152
|
-
}
|
153
|
-
}
|
154
|
-
};
|
155
|
-
inFn(tree, null, 1);
|
156
|
-
}
|
157
|
-
/**
|
158
|
-
* Return the value of the first tree value in the tree where predicate is true, and `undefined` otherwise
|
159
|
-
*
|
160
|
-
* 根据条件返回树的第一个值,否则返回 `undefined`
|
161
|
-
*/
|
162
|
-
findTree(tree, predicate, options) {
|
163
|
-
let res;
|
164
|
-
this.visitTree(tree, item => {
|
165
|
-
if (res === undefined && predicate(item)) {
|
166
|
-
res = item;
|
167
|
-
}
|
168
|
-
}, options);
|
169
|
-
return res;
|
170
|
-
}
|
171
|
-
/**
|
172
|
-
* 获取所有已经选中的 `key` 值
|
173
|
-
*/
|
174
|
-
getKeysByTreeNode(tree, options) {
|
175
|
-
const opt = {
|
176
|
-
includeHalfChecked: true,
|
177
|
-
...options
|
178
|
-
};
|
179
|
-
const keys = [];
|
180
|
-
this.visitTree(tree, (item, parent, deep) => {
|
181
|
-
if (item.isChecked || (opt.includeHalfChecked && item.isHalfChecked)) {
|
182
|
-
keys.push(opt.cb ? opt.cb(item, parent, deep) : opt.keyMapName ? item.origin[opt.keyMapName] : item.key);
|
183
|
-
}
|
184
|
-
});
|
185
|
-
return keys;
|
186
|
-
}
|
187
|
-
baseFlat(array, depth, result = []) {
|
188
|
-
let index = -1;
|
189
|
-
while (++index < array.length) {
|
190
|
-
const value = array[index];
|
191
|
-
if (depth > 0 && Array.isArray(value)) {
|
192
|
-
if (depth > 1) {
|
193
|
-
this.baseFlat(value, depth - 1, result);
|
194
|
-
}
|
195
|
-
else {
|
196
|
-
let pushIndex = -1;
|
197
|
-
const offset = result.length;
|
198
|
-
while (++pushIndex < value.length) {
|
199
|
-
result[offset + pushIndex] = value[pushIndex];
|
200
|
-
}
|
201
|
-
}
|
202
|
-
}
|
203
|
-
else {
|
204
|
-
result[result.length] = value;
|
205
|
-
}
|
206
|
-
}
|
207
|
-
return result;
|
208
|
-
}
|
209
|
-
/**
|
210
|
-
* Recursively flattens array
|
211
|
-
*
|
212
|
-
* 递归扁平数组
|
213
|
-
* ```ts
|
214
|
-
* srv.flat([1, [2, 3, [4, 5, [6]]]]) => [1,2,3,4,5,6]
|
215
|
-
* srv.flat([1, [2, 3, [4, 5, [6]]]], 1) => [1,2,3,[4, 5, [6]]]
|
216
|
-
* ```
|
217
|
-
*/
|
218
|
-
flat(array, depth = 1 / 0) {
|
219
|
-
return Array.isArray(array) ? this.baseFlat(array, depth) : array;
|
220
|
-
}
|
221
|
-
/**
|
222
|
-
* Group the array
|
223
|
-
*
|
224
|
-
* 对数组进行分组
|
225
|
-
* ```ts
|
226
|
-
* srv.groupBy([6.1, 4.2, 6.3], Math.floor) => {"4":[4.2],"6":[6.1,6.3]}
|
227
|
-
* srv.groupBy(['one', 'two', 'three'], v => v.length) => {"3":["one","two"],"5":["three"]}
|
228
|
-
* ```
|
229
|
-
*/
|
230
|
-
groupBy(array, iteratee) {
|
231
|
-
if (!Array.isArray(array)) {
|
232
|
-
return {};
|
233
|
-
}
|
234
|
-
return array.reduce((result, value) => {
|
235
|
-
const key = iteratee(value);
|
236
|
-
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
237
|
-
result[key].push(value);
|
238
|
-
}
|
239
|
-
else {
|
240
|
-
result[key] = [value];
|
241
|
-
}
|
242
|
-
return result;
|
243
|
-
}, {});
|
244
|
-
}
|
245
|
-
/**
|
246
|
-
* Creates a duplicate-free version of an array
|
247
|
-
*
|
248
|
-
* 创建去重后的数组
|
249
|
-
* ```ts
|
250
|
-
* uniq([1, 2, 2, 3, 1]) => [1,2,3]
|
251
|
-
* uniq([{ a: 1 }, { a: 1 }, { a: 2 }], 'a') => [{"a":1},{"a":2}]
|
252
|
-
* uniq([{ a: 1 }, { a: 1 }, { a: 2 }], i => (i.a === 1 ? 'a' : 'b')) => [{"a":1},{"a":2}]
|
253
|
-
* ```
|
254
|
-
*/
|
255
|
-
uniq(array, predicate) {
|
256
|
-
return Array.from(array
|
257
|
-
.reduce((map, value) => {
|
258
|
-
const key = predicate
|
259
|
-
? typeof predicate === 'string'
|
260
|
-
? value[predicate]
|
261
|
-
: predicate(value)
|
262
|
-
: value;
|
263
|
-
if (!map.has(key)) {
|
264
|
-
map.set(key, value);
|
265
|
-
}
|
266
|
-
return map;
|
267
|
-
}, new Map())
|
268
|
-
.values());
|
269
|
-
}
|
270
|
-
}
|
271
|
-
ArrayService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ArrayService, deps: [{ token: i1.YunzaiConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
272
|
-
ArrayService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ArrayService, providedIn: 'root' });
|
273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ArrayService, decorators: [{
|
274
|
-
type: Injectable,
|
275
|
-
args: [{ providedIn: 'root' }]
|
276
|
-
}], ctorParameters: function () { return [{ type: i1.YunzaiConfigService }]; } });
|
277
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJyYXkuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvYXJyYXkvYXJyYXkuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBRzNDLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQzs7O0FBV3JELE1BQU0sT0FBTyxZQUFZO0lBR3ZCLFlBQVksR0FBd0I7UUFDbEMsSUFBSSxDQUFDLENBQUMsR0FBRyxHQUFHLENBQUMsS0FBSyxDQUFDLFdBQVcsRUFBRTtZQUM5QixXQUFXLEVBQUUsTUFBTTtZQUNuQixhQUFhLEVBQUUsUUFBUTtZQUN2QixTQUFTLEVBQUUsSUFBSTtZQUNmLGVBQWUsRUFBRSxXQUFXO1lBQzVCLGVBQWUsRUFBRSxVQUFVO1lBQzNCLFlBQVksRUFBRSxPQUFPO1lBQ3JCLGNBQWMsRUFBRSxTQUFTO1lBQ3pCLGVBQWUsRUFBRSxVQUFVO1lBQzNCLGVBQWUsRUFBRSxVQUFVO1lBQzNCLGVBQWUsRUFBRSxVQUFVO1NBQzVCLENBQUUsQ0FBQztJQUNOLENBQUM7SUFFRDs7OztPQUlHO0lBQ0gsU0FBUyxDQUF5QixJQUFrQixFQUFFLE9BQXlDO1FBQzdGLE1BQU0sR0FBRyxHQUFHO1lBQ1YsV0FBVyxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUMsV0FBVztZQUMvQixhQUFhLEVBQUUsSUFBSSxDQUFDLEN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lcygpXG4gICAgKTtcbiAgfVxufVxuIl19
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import { DOCUMENT } from '@angular/common';
|
2
|
-
import { Inject, Injectable } from '@angular/core';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
import * as i1 from "@angular/cdk/platform";
|
5
|
-
/**
|
6
|
-
* A set of simple Cookie manipulation classes.
|
7
|
-
*
|
8
|
-
* 一组简单的 Cookie 操作类。
|
9
|
-
*/
|
10
|
-
export class CookieService {
|
11
|
-
get doc() {
|
12
|
-
return this._doc || document;
|
13
|
-
}
|
14
|
-
/**
|
15
|
-
* Original cookie value
|
16
|
-
*
|
17
|
-
* 原始Cookie值
|
18
|
-
*/
|
19
|
-
get cookie() {
|
20
|
-
return this.platform.isBrowser ? this.doc.cookie : '';
|
21
|
-
}
|
22
|
-
constructor(_doc, platform) {
|
23
|
-
this._doc = _doc;
|
24
|
-
this.platform = platform;
|
25
|
-
}
|
26
|
-
/**
|
27
|
-
* Get all cookie key-value pairs
|
28
|
-
*
|
29
|
-
* 获取所有Cookie键值对
|
30
|
-
*/
|
31
|
-
getAll() {
|
32
|
-
const ret = {};
|
33
|
-
const arr = this.cookie.split('; ');
|
34
|
-
for (let i = 0; i < arr.length; i++) {
|
35
|
-
const cookie = arr[i];
|
36
|
-
const index = cookie.indexOf('=');
|
37
|
-
if (index > 0) {
|
38
|
-
const name = decodeURIComponent(cookie.substring(0, index));
|
39
|
-
if (ret[name] == null) {
|
40
|
-
ret[name] = decodeURIComponent(cookie.substring(index + 1));
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
return ret;
|
45
|
-
}
|
46
|
-
/**
|
47
|
-
* Get the value of given cookie `key`
|
48
|
-
*
|
49
|
-
* 获取指定 `key` 的值
|
50
|
-
*/
|
51
|
-
get(key) {
|
52
|
-
return this.getAll()[key];
|
53
|
-
}
|
54
|
-
/**
|
55
|
-
* Sets a value for given cookie key
|
56
|
-
*
|
57
|
-
* 设置指定 Cookie 键的值
|
58
|
-
*/
|
59
|
-
put(key, value, options) {
|
60
|
-
if (!this.platform.isBrowser) {
|
61
|
-
return;
|
62
|
-
}
|
63
|
-
const opt = { path: '/', ...options };
|
64
|
-
if (typeof opt.expires === 'number') {
|
65
|
-
opt.expires = new Date(+new Date() + opt.expires * 1e3);
|
66
|
-
}
|
67
|
-
if (typeof opt.expires !== 'string') {
|
68
|
-
opt.expires = opt.expires ? opt.expires.toUTCString() : '';
|
69
|
-
}
|
70
|
-
const optStr = opt;
|
71
|
-
const attributes = Object.keys(optStr)
|
72
|
-
.filter(k => optStr[k] && optStr[k] !== true)
|
73
|
-
.map(k => `${k}=${optStr[k].split(';')[0]}`)
|
74
|
-
.join(';');
|
75
|
-
this.doc.cookie = `${encodeURIComponent(String(key))}=${encodeURIComponent(String(value))}${attributes ? `; ${attributes}` : ''}`;
|
76
|
-
}
|
77
|
-
/**
|
78
|
-
* Remove given cookie
|
79
|
-
*
|
80
|
-
* 移除指定 Cookie
|
81
|
-
*/
|
82
|
-
remove(key, options) {
|
83
|
-
this.put(key, '', options);
|
84
|
-
}
|
85
|
-
/**
|
86
|
-
* Remove all cookies
|
87
|
-
*
|
88
|
-
* 移除所有 Cookies
|
89
|
-
*/
|
90
|
-
removeAll() {
|
91
|
-
this.doc.cookie = '';
|
92
|
-
}
|
93
|
-
}
|
94
|
-
CookieService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookieService, deps: [{ token: DOCUMENT }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
|
95
|
-
CookieService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookieService, providedIn: 'root' });
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CookieService, decorators: [{
|
97
|
-
type: Injectable,
|
98
|
-
args: [{ providedIn: 'root' }]
|
99
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
100
|
-
type: Inject,
|
101
|
-
args: [DOCUMENT]
|
102
|
-
}] }, { type: i1.Platform }]; } });
|
103
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29va2llLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2Jyb3dzZXIvY29va2llLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzNDLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOzs7QUFrQm5EOzs7O0dBSUc7QUFFSCxNQUFNLE9BQU8sYUFBYTtJQUN4QixJQUFZLEdBQUc7UUFDYixPQUFPLElBQUksQ0FBQyxJQUFJLElBQUksUUFBUSxDQUFDO0lBQy9CLENBQUM7SUFFRDs7OztPQUlHO0lBQ0gsSUFBSSxNQUFNO1FBQ1IsT0FBTyxJQUFJLENBQUMsUUFBUSxDQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQztJQUN4RCxDQUFDO0lBRUQsWUFBc0MsSUFBZSxFQUFVLFFBQWtCO1FBQTNDLFNBQUksR0FBSixJQUFJLENBQVc7UUFBVSxhQUFRLEdBQVIsUUFBUSxDQUFVO0lBQUcsQ0FBQztJQUVyRjs7OztPQUlHO0lBQ0gsTUFBTTtRQUNKLE1BQU0sR0FBRyxHQUE4QixFQUFFLENBQUM7UUFDMUMsTUFBTSxHQUFHLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDcEMsS0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OaJgOaciSBDb29raWVzXG4gICAqL1xuICByZW1vdmVBbGwoKTogdm9pZCB7XG4gICAgdGhpcy5kb2MuY29va2llID0gJyc7XG4gIH1cbn1cbiJdfQ==
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import { DOCUMENT } from '@angular/common';
|
2
|
-
import { Inject, Injectable } from '@angular/core';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
import * as i1 from "@angular/cdk/platform";
|
5
|
-
export class ScrollService {
|
6
|
-
_getDoc() {
|
7
|
-
return this._doc || document;
|
8
|
-
}
|
9
|
-
_getWin() {
|
10
|
-
const doc = this._getDoc();
|
11
|
-
return doc.defaultView || window;
|
12
|
-
}
|
13
|
-
constructor(_doc, platform) {
|
14
|
-
this._doc = _doc;
|
15
|
-
this.platform = platform;
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* 获取滚动条位置
|
19
|
-
*
|
20
|
-
* @param element 指定元素,默认 `window`
|
21
|
-
*/
|
22
|
-
getScrollPosition(element) {
|
23
|
-
if (!this.platform.isBrowser) {
|
24
|
-
return [0, 0];
|
25
|
-
}
|
26
|
-
const win = this._getWin();
|
27
|
-
if (element && element !== win) {
|
28
|
-
return [element.scrollLeft, element.scrollTop];
|
29
|
-
}
|
30
|
-
else {
|
31
|
-
return [win.scrollX, win.scrollY];
|
32
|
-
}
|
33
|
-
}
|
34
|
-
/**
|
35
|
-
* 设置滚动条位置
|
36
|
-
*
|
37
|
-
* @param element 指定元素
|
38
|
-
*/
|
39
|
-
scrollToPosition(element, position) {
|
40
|
-
if (!this.platform.isBrowser) {
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
(element || this._getWin()).scrollTo(position[0], position[1]);
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* 设置滚动条至指定元素
|
47
|
-
*
|
48
|
-
* @param element 指定元素,默认 `document.body`
|
49
|
-
* @param topOffset 偏移值,默认 `0`
|
50
|
-
*/
|
51
|
-
scrollToElement(element, topOffset = 0) {
|
52
|
-
if (!this.platform.isBrowser) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
if (!element) {
|
56
|
-
element = this._getDoc().body;
|
57
|
-
}
|
58
|
-
element.scrollIntoView();
|
59
|
-
const win = this._getWin();
|
60
|
-
if (win && win.scrollBy) {
|
61
|
-
win.scrollBy(0, element.getBoundingClientRect().top - topOffset);
|
62
|
-
if (win.scrollY < 20) {
|
63
|
-
win.scrollBy(0, -win.scrollY);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
/**
|
68
|
-
* 滚动至顶部
|
69
|
-
*
|
70
|
-
* @param topOffset 偏移值,默认 `0`
|
71
|
-
*/
|
72
|
-
scrollToTop(topOffset = 0) {
|
73
|
-
if (!this.platform.isBrowser) {
|
74
|
-
return;
|
75
|
-
}
|
76
|
-
this.scrollToElement(this._getDoc().body, topOffset);
|
77
|
-
}
|
78
|
-
}
|
79
|
-
ScrollService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScrollService, deps: [{ token: DOCUMENT }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
|
80
|
-
ScrollService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScrollService, providedIn: 'root' });
|
81
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ScrollService, decorators: [{
|
82
|
-
type: Injectable,
|
83
|
-
args: [{ providedIn: 'root' }]
|
84
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
85
|
-
type: Inject,
|
86
|
-
args: [DOCUMENT]
|
87
|
-
}] }, { type: i1.Platform }]; } });
|
88
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYW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gRGVmYXVsdDogYGZhbHNlYFxuICAgKi9cbiAgc2hvd0JvcmRlcnM/OiBib29sZWFuO1xuICAvKipcbiAgICogRGVmYXVsdDogYHRydWVgXG4gICAqIC0gaWYgc2V0IHRvIGB0cnVlYCAtIHNpemUgd2lsbCBiZSBhcyBzYW1lIGFzIG9yaWdpbmFsIGRvY3VtZW50XG4gICAqIC0gaWYgc2V0IHRvIGBmYWxzZWAgLSBzaXplIHdpbGwgYmUgYXMgc2FtZSBhcyBjb250YWluZXIgYmxvY2tcbiAgICovXG4gIG9yaWdpbmFsU2l6ZT86IGJvb2xlYW47XG4gIC8qKlxuICAgKiBZb3UgY2FuIHNob3cgeW91ciBkb2N1bWVudCBpbiBvcmlnaW5hbCBzaXplLCBhbmQgbWFrZSBzdXJlIHRoYXQgaXQncyBub3QgYmlnZ2VyIHRoZW4gY29udGFpbmVyIGJsb2NrLiBEZWZhdWx0OiBgZmFsc2VgXG4gICAqL1xuICBmaXRUb1BhZ2U/OiBib29sZWFuO1xuICAvKipcbiAgICogVHVybiBvbiBvciBvZmYgYXV0byByZXNpemUsIERlZmF1bHQ6IGB0cnVlYFxuICAgKiAqKkltcG9ydGFudCoqIFRvIG1ha2Ugd29yayAtIG1ha2Ugc3VyZSB0aGF0IGBbb3JpZ2luYWxTaXplXT1cImZhbHNlXCJgIGFuZCBwZGYtdmlld2VyIHRhZyBoYXMgYG1heC13aWR0aGAgb3IgYGRpc3BsYXlgIGFyZSBzZXQuXG4gICAqL1xuICBhdXRvUmVTaXplPzogYm9vbGVhbjtcbn1cbiJdfQ==
|
@@ -1,37 +0,0 @@
|
|
1
|
-
import { Inject, Injectable, Optional } from '@angular/core';
|
2
|
-
import { deepMergeKey } from '@yelon/util/other';
|
3
|
-
import { YUNZAI_CONFIG } from './config.types';
|
4
|
-
import * as i0 from "@angular/core";
|
5
|
-
export class YunzaiConfigService {
|
6
|
-
constructor(defaultConfig) {
|
7
|
-
this.config = { ...defaultConfig };
|
8
|
-
}
|
9
|
-
get(componentName, key) {
|
10
|
-
const res = (this.config[componentName] || {});
|
11
|
-
return key ? { [key]: res[key] } : res;
|
12
|
-
}
|
13
|
-
merge(componentName, ...defaultValues) {
|
14
|
-
return deepMergeKey({}, true, ...defaultValues, this.get(componentName));
|
15
|
-
}
|
16
|
-
attach(componentThis, componentName, defaultValues) {
|
17
|
-
Object.assign(componentThis, this.merge(componentName, defaultValues));
|
18
|
-
}
|
19
|
-
attachKey(componentThis, componentName, key) {
|
20
|
-
Object.assign(componentThis, this.get(componentName, key));
|
21
|
-
}
|
22
|
-
set(componentName, value) {
|
23
|
-
this.config[componentName] = { ...this.config[componentName], ...value };
|
24
|
-
}
|
25
|
-
}
|
26
|
-
YunzaiConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: YunzaiConfigService, deps: [{ token: YUNZAI_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
27
|
-
YunzaiConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: YunzaiConfigService, providedIn: 'root' });
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: YunzaiConfigService, decorators: [{
|
29
|
-
type: Injectable,
|
30
|
-
args: [{ providedIn: 'root' }]
|
31
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
32
|
-
type: Optional
|
33
|
-
}, {
|
34
|
-
type: Inject,
|
35
|
-
args: [YUNZAI_CONFIG]
|
36
|
-
}] }]; } });
|
37
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL2NvbmZpZy9jb25maWcuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHB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