@delon/abc 20.1.1 → 21.0.0-next.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/fesm2022/auto-focus.mjs +10 -10
- package/fesm2022/auto-focus.mjs.map +1 -1
- package/fesm2022/cell.mjs +23 -25
- package/fesm2022/cell.mjs.map +1 -1
- package/fesm2022/chart-observer-size.mjs +21 -34
- package/fesm2022/chart-observer-size.mjs.map +1 -1
- package/fesm2022/count-down.mjs +24 -31
- package/fesm2022/count-down.mjs.map +1 -1
- package/fesm2022/date-picker.mjs +89 -85
- package/fesm2022/date-picker.mjs.map +1 -1
- package/fesm2022/down-file.mjs +23 -43
- package/fesm2022/down-file.mjs.map +1 -1
- package/fesm2022/ellipsis.mjs +163 -104
- package/fesm2022/ellipsis.mjs.map +1 -1
- package/fesm2022/error-collect.mjs +11 -13
- package/fesm2022/error-collect.mjs.map +1 -1
- package/fesm2022/exception.mjs +9 -9
- package/fesm2022/exception.mjs.map +1 -1
- package/fesm2022/footer-toolbar.mjs +9 -9
- package/fesm2022/footer-toolbar.mjs.map +1 -1
- package/fesm2022/full-content.mjs +50 -58
- package/fesm2022/full-content.mjs.map +1 -1
- package/fesm2022/global-footer.mjs +14 -15
- package/fesm2022/global-footer.mjs.map +1 -1
- package/fesm2022/hotkey.mjs +7 -7
- package/fesm2022/hotkey.mjs.map +1 -1
- package/fesm2022/loading.mjs +61 -14
- package/fesm2022/loading.mjs.map +1 -1
- package/fesm2022/lodop.mjs +7 -7
- package/fesm2022/media.mjs +37 -61
- package/fesm2022/media.mjs.map +1 -1
- package/fesm2022/notice-icon.mjs +220 -25
- package/fesm2022/notice-icon.mjs.map +1 -1
- package/fesm2022/onboarding.mjs +160 -62
- package/fesm2022/onboarding.mjs.map +1 -1
- package/fesm2022/page-header.mjs +252 -155
- package/fesm2022/page-header.mjs.map +1 -1
- package/fesm2022/pdf.mjs +7 -7
- package/fesm2022/pdf.mjs.map +1 -1
- package/fesm2022/quick-menu.mjs +79 -71
- package/fesm2022/quick-menu.mjs.map +1 -1
- package/fesm2022/reuse-tab.mjs +257 -160
- package/fesm2022/reuse-tab.mjs.map +1 -1
- package/fesm2022/se.mjs +289 -309
- package/fesm2022/se.mjs.map +1 -1
- package/fesm2022/sg.mjs +32 -69
- package/fesm2022/sg.mjs.map +1 -1
- package/fesm2022/st.mjs +93 -84
- package/fesm2022/st.mjs.map +1 -1
- package/fesm2022/sv.mjs +185 -174
- package/fesm2022/sv.mjs.map +1 -1
- package/fesm2022/tag-select.mjs +44 -25
- package/fesm2022/tag-select.mjs.map +1 -1
- package/fesm2022/xlsx.mjs +14 -17
- package/fesm2022/xlsx.mjs.map +1 -1
- package/fesm2022/zip.mjs +4 -4
- package/fesm2022/zip.mjs.map +1 -1
- package/package.json +37 -37
- package/{auto-focus/index.d.ts → types/auto-focus.d.ts} +2 -2
- package/{cell/index.d.ts → types/cell.d.ts} +12 -13
- package/{observers/index.d.ts → types/chart-observer-size.d.ts} +5 -9
- package/{count-down/index.d.ts → types/count-down.d.ts} +6 -10
- package/{date-picker/index.d.ts → types/date-picker.d.ts} +6 -10
- package/types/down-file.d.ts +32 -0
- package/types/ellipsis.d.ts +46 -0
- package/types/error-collect.d.ts +34 -0
- package/{exception/index.d.ts → types/exception.d.ts} +13 -13
- package/{footer-toolbar/index.d.ts → types/footer-toolbar.d.ts} +2 -2
- package/{full-content/index.d.ts → types/full-content.d.ts} +8 -13
- package/{global-footer/index.d.ts → types/global-footer.d.ts} +7 -7
- package/{loading/index.d.ts → types/loading.d.ts} +1 -0
- package/{media/index.d.ts → types/media.d.ts} +10 -16
- package/{notice-icon/index.d.ts → types/notice-icon.d.ts} +15 -15
- package/{onboarding/index.d.ts → types/onboarding.d.ts} +12 -14
- package/types/page-header.d.ts +67 -0
- package/types/quick-menu.d.ts +31 -0
- package/{reuse-tab/index.d.ts → types/reuse-tab.d.ts} +46 -55
- package/types/se.d.ts +101 -0
- package/types/sg.d.ts +31 -0
- package/{st/index.d.ts → types/st.d.ts} +10 -2
- package/types/sv.d.ts +81 -0
- package/types/tag-select.d.ts +25 -0
- package/{xlsx/index.d.ts → types/xlsx.d.ts} +3 -3
- package/down-file/index.d.ts +0 -34
- package/ellipsis/index.d.ts +0 -55
- package/error-collect/index.d.ts +0 -35
- package/page-header/index.d.ts +0 -83
- package/quick-menu/index.d.ts +0 -38
- package/se/index.d.ts +0 -129
- package/sg/index.d.ts +0 -44
- package/sv/index.d.ts +0 -96
- package/tag-select/index.d.ts +0 -27
- /package/{index.d.ts → types/abc.d.ts} +0 -0
- /package/{hotkey/index.d.ts → types/hotkey.d.ts} +0 -0
- /package/{lodop/index.d.ts → types/lodop.d.ts} +0 -0
- /package/{pdf/index.d.ts → types/pdf.d.ts} +0 -0
- /package/{zip/index.d.ts → types/zip.d.ts} +0 -0
package/fesm2022/hotkey.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hotkey.mjs","sources":["../../../../packages/abc/hotkey/hotkey.directive.ts","../../../../packages/abc/hotkey/hotkey.module.ts","../../../../packages/abc/hotkey/hotkey.ts"],"sourcesContent":["import { Platform } from '@angular/cdk/platform';\nimport { Directive, ElementRef, Input, NgZone, OnDestroy, inject } from '@angular/core';\n\nimport { install, uninstall } from '@github/hotkey';\n\n@Directive({ selector: '[hotkey]' })\nexport class HotkeyDirective implements OnDestroy {\n private readonly el: HTMLElement = inject(ElementRef).nativeElement;\n private readonly ngZone = inject(NgZone);\n private readonly platform = inject(Platform);\n\n /**\n * Specify [hotkey format](https://github.com/github/hotkey#hotkey-string-format), you can get the code through [Hotkey Code](https://github.github.com/hotkey/hotkey_mapper.html)\n *\n * 指定[热键格式](https://github.com/github/hotkey#hotkey-string-format),可以通过 [Hotkey Code](https://github.github.com/hotkey/hotkey_mapper.html) 来获取代码。\n */\n @Input('hotkey')\n set hotkey(key: string) {\n if (!this.platform.isBrowser) return;\n\n this.ngZone.runOutsideAngular(() => install(this.el, key));\n }\n\n ngOnDestroy(): void {\n if (!this.platform.isBrowser) return;\n\n this.ngZone.runOutsideAngular(() => uninstall(this.el));\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { HotkeyDirective } from './hotkey.directive';\n\nconst DIRECTIVES = [HotkeyDirective];\n\n@NgModule({\n imports: DIRECTIVES,\n exports: DIRECTIVES\n})\nexport class HotkeyModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAMa,eAAe,CAAA;AACT,IAAA,EAAE,GAAgB,MAAM,CAAC,UAAU,CAAC,CAAC,aAAa;AAClD,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE5C;;;;AAIG;IACH,IACI,MAAM,CAAC,GAAW,EAAA;AACpB,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS;YAAE;AAE9B,QAAA,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5D;IAEA,WAAW,GAAA;AACT,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS;YAAE;AAE9B,QAAA,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzD;uGArBW,eAAe,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;2FAAf,eAAe,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAf,eAAe,EAAA,UAAA,EAAA,CAAA;kBAD3B,SAAS;mBAAC,EAAE,QAAQ,EAAE,UAAU,EAAE
|
|
1
|
+
{"version":3,"file":"hotkey.mjs","sources":["../../../../packages/abc/hotkey/hotkey.directive.ts","../../../../packages/abc/hotkey/hotkey.module.ts","../../../../packages/abc/hotkey/hotkey.ts"],"sourcesContent":["import { Platform } from '@angular/cdk/platform';\nimport { Directive, ElementRef, Input, NgZone, OnDestroy, inject } from '@angular/core';\n\nimport { install, uninstall } from '@github/hotkey';\n\n@Directive({ selector: '[hotkey]' })\nexport class HotkeyDirective implements OnDestroy {\n private readonly el: HTMLElement = inject(ElementRef).nativeElement;\n private readonly ngZone = inject(NgZone);\n private readonly platform = inject(Platform);\n\n /**\n * Specify [hotkey format](https://github.com/github/hotkey#hotkey-string-format), you can get the code through [Hotkey Code](https://github.github.com/hotkey/hotkey_mapper.html)\n *\n * 指定[热键格式](https://github.com/github/hotkey#hotkey-string-format),可以通过 [Hotkey Code](https://github.github.com/hotkey/hotkey_mapper.html) 来获取代码。\n */\n @Input('hotkey')\n set hotkey(key: string) {\n if (!this.platform.isBrowser) return;\n\n this.ngZone.runOutsideAngular(() => install(this.el, key));\n }\n\n ngOnDestroy(): void {\n if (!this.platform.isBrowser) return;\n\n this.ngZone.runOutsideAngular(() => uninstall(this.el));\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { HotkeyDirective } from './hotkey.directive';\n\nconst DIRECTIVES = [HotkeyDirective];\n\n@NgModule({\n imports: DIRECTIVES,\n exports: DIRECTIVES\n})\nexport class HotkeyModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAMa,eAAe,CAAA;AACT,IAAA,EAAE,GAAgB,MAAM,CAAC,UAAU,CAAC,CAAC,aAAa;AAClD,IAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AACvB,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAE5C;;;;AAIG;IACH,IACI,MAAM,CAAC,GAAW,EAAA;AACpB,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,C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
6
|
import { Overlay, OverlayModule } from '@angular/cdk/overlay';
|
|
7
7
|
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
8
8
|
import { Subject, debounce, timer } from 'rxjs';
|
|
9
|
+
import { DelonLocaleService } from '@delon/theme';
|
|
9
10
|
import { AlainConfigService } from '@delon/util/config';
|
|
10
11
|
import { CommonModule } from '@angular/common';
|
|
11
12
|
|
|
@@ -18,21 +19,67 @@ class LoadingDefaultComponent {
|
|
|
18
19
|
get custom() {
|
|
19
20
|
return this.options.custom;
|
|
20
21
|
}
|
|
21
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
22
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
22
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingDefaultComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
23
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.6", type: LoadingDefaultComponent, isStandalone: true, selector: "loading-default", host: { properties: { "class.loading-default-rtl": "dir === 'rtl'" }, classAttribute: "loading-default" }, ngImport: i0, template: `
|
|
24
|
+
@if (options.type! !== 'text') {
|
|
25
|
+
<div class="loading-default__icon">
|
|
26
|
+
@switch (options.type) {
|
|
27
|
+
@case ('spin') {
|
|
28
|
+
<nz-spin nzSimple />
|
|
29
|
+
}
|
|
30
|
+
@case ('icon') {
|
|
31
|
+
<nz-icon [nzType]="icon.type!" [nzTheme]="icon.theme!" [nzSpin]="icon.spin" />
|
|
32
|
+
}
|
|
33
|
+
@default {
|
|
34
|
+
<div class="loading-default__custom" [style]="custom.style!" [innerHTML]="custom.html"></div>
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</div>
|
|
38
|
+
}
|
|
39
|
+
@if (options.text) {
|
|
40
|
+
<div class="loading-default__text">{{ options.text }}</div>
|
|
41
|
+
}
|
|
42
|
+
`, isInline: true, dependencies: [{ kind: "component", type: NzSpinComponent, selector: "nz-spin", inputs: ["nzIndicator", "nzSize", "nzTip", "nzDelay", "nzSimple", "nzSpinning"], exportAs: ["nzSpin"] }, { kind: "directive", type: NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
23
43
|
}
|
|
24
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingDefaultComponent, decorators: [{
|
|
25
45
|
type: Component,
|
|
26
|
-
args: [{
|
|
27
|
-
|
|
46
|
+
args: [{
|
|
47
|
+
selector: 'loading-default',
|
|
48
|
+
template: `
|
|
49
|
+
@if (options.type! !== 'text') {
|
|
50
|
+
<div class="loading-default__icon">
|
|
51
|
+
@switch (options.type) {
|
|
52
|
+
@case ('spin') {
|
|
53
|
+
<nz-spin nzSimple />
|
|
54
|
+
}
|
|
55
|
+
@case ('icon') {
|
|
56
|
+
<nz-icon [nzType]="icon.type!" [nzTheme]="icon.theme!" [nzSpin]="icon.spin" />
|
|
57
|
+
}
|
|
58
|
+
@default {
|
|
59
|
+
<div class="loading-default__custom" [style]="custom.style!" [innerHTML]="custom.html"></div>
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</div>
|
|
63
|
+
}
|
|
64
|
+
@if (options.text) {
|
|
65
|
+
<div class="loading-default__text">{{ options.text }}</div>
|
|
66
|
+
}
|
|
67
|
+
`,
|
|
68
|
+
host: {
|
|
69
|
+
class: 'loading-default',
|
|
28
70
|
'[class.loading-default-rtl]': `dir === 'rtl'`
|
|
29
|
-
},
|
|
71
|
+
},
|
|
72
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
73
|
+
encapsulation: ViewEncapsulation.None,
|
|
74
|
+
imports: [NzSpinComponent, NzIconDirective]
|
|
75
|
+
}]
|
|
30
76
|
}] });
|
|
31
77
|
|
|
32
78
|
class LoadingService {
|
|
33
79
|
overlay = inject(Overlay);
|
|
34
80
|
configSrv = inject(AlainConfigService);
|
|
35
81
|
directionality = inject(Directionality);
|
|
82
|
+
locale = inject(DelonLocaleService).getData('loading');
|
|
36
83
|
_overlayRef;
|
|
37
84
|
compRef = null;
|
|
38
85
|
opt = null;
|
|
@@ -45,7 +92,7 @@ class LoadingService {
|
|
|
45
92
|
constructor() {
|
|
46
93
|
this.cog = this.configSrv.merge('loading', {
|
|
47
94
|
type: 'spin',
|
|
48
|
-
text:
|
|
95
|
+
text: this.locale.text,
|
|
49
96
|
icon: {
|
|
50
97
|
type: 'loading',
|
|
51
98
|
theme: 'outline',
|
|
@@ -104,21 +151,21 @@ class LoadingService {
|
|
|
104
151
|
ngOnDestroy() {
|
|
105
152
|
this.loading$.unsubscribe();
|
|
106
153
|
}
|
|
107
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
108
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
154
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
155
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingService, providedIn: 'root' });
|
|
109
156
|
}
|
|
110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
157
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingService, decorators: [{
|
|
111
158
|
type: Injectable,
|
|
112
159
|
args: [{ providedIn: 'root' }]
|
|
113
160
|
}], ctorParameters: () => [] });
|
|
114
161
|
|
|
115
162
|
const COMPONENTS = [LoadingDefaultComponent];
|
|
116
163
|
class LoadingModule {
|
|
117
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
118
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
119
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
164
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
165
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: LoadingModule, imports: [CommonModule, OverlayModule, PortalModule, NzIconModule, NzSpinModule, LoadingDefaultComponent], exports: [LoadingDefaultComponent] });
|
|
166
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingModule, imports: [CommonModule, OverlayModule, PortalModule, NzIconModule, NzSpinModule, COMPONENTS] });
|
|
120
167
|
}
|
|
121
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
168
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LoadingModule, decorators: [{
|
|
122
169
|
type: NgModule,
|
|
123
170
|
args: [{
|
|
124
171
|
imports: [CommonModule, OverlayModule, PortalModule, NzIconModule, NzSpinModule, ...COMPONENTS],
|
package/fesm2022/loading.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loading.mjs","sources":["../../../../packages/abc/loading/loading.component.ts","../../../../packages/abc/loading/loading.
|
|
1
|
+
{"version":3,"file":"loading.mjs","sources":["../../../../packages/abc/loading/loading.component.ts","../../../../packages/abc/loading/loading.service.ts","../../../../packages/abc/loading/loading.module.ts","../../../../packages/abc/loading/loading.ts"],"sourcesContent":["import { Direction } from '@angular/cdk/bidi';\nimport { ChangeDetectionStrategy, Component, ViewEncapsulation } from '@angular/core';\n\nimport { NzIconDirective } from 'ng-zorro-antd/icon';\nimport { NzSpinComponent } from 'ng-zorro-antd/spin';\n\nimport { LoadingCustom, LoadingIcon, LoadingShowOptions } from './loading.types';\n\n@Component({\n selector: 'loading-default',\n template: `\n @if (options.type! !== 'text') {\n <div class=\"loading-default__icon\">\n @switch (options.type) {\n @case ('spin') {\n <nz-spin nzSimple />\n }\n @case ('icon') {\n <nz-icon [nzType]=\"icon.type!\" [nzTheme]=\"icon.theme!\" [nzSpin]=\"icon.spin\" />\n }\n @default {\n <div class=\"loading-default__custom\" [style]=\"custom.style!\" [innerHTML]=\"custom.html\"></div>\n }\n }\n </div>\n }\n @if (options.text) {\n <div class=\"loading-default__text\">{{ options.text }}</div>\n }\n `,\n host: {\n class: 'loading-default',\n '[class.loading-default-rtl]': `dir === 'rtl'`\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n imports: [NzSpinComponent, NzIconDirective]\n})\nexport class LoadingDefaultComponent {\n options!: LoadingShowOptions;\n dir?: Direction = 'ltr';\n\n get icon(): LoadingIcon {\n return this.options.icon!;\n }\n\n get custom(): LoadingCustom {\n return this.options.custom!;\n }\n}\n","import { Directionality } from '@angular/cdk/bidi';\nimport { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal } from '@angular/cdk/portal';\nimport { ComponentRef, Injectable, OnDestroy, inject } from '@angular/core';\nimport { Subject, Subscription, timer, debounce } from 'rxjs';\n\nimport { DelonLocaleService } from '@delon/theme';\nimport { AlainConfigService, AlainLoadingConfig } from '@delon/util/config';\n\nimport { LoadingDefaultComponent } from './loading.component';\nimport { LoadingShowOptions } from './loading.types';\n\n@Injectable({ providedIn: 'root' })\nexport class LoadingService implements OnDestroy {\n private readonly overlay = inject(Overlay);\n private readonly configSrv = inject(AlainConfigService);\n private readonly directionality = inject(Directionality);\n private locale = inject(DelonLocaleService).getData('loading');\n\n private _overlayRef?: OverlayRef;\n private compRef: ComponentRef<LoadingDefaultComponent> | null = null;\n private opt: LoadingShowOptions | null = null;\n private cog: AlainLoadingConfig;\n private n$ = new Subject<void>();\n private loading$: Subscription;\n\n get instance(): LoadingDefaultComponent | null {\n return this.compRef != null ? this.compRef.instance : null;\n }\n\n constructor() {\n this.cog = this.configSrv.merge('loading', {\n type: 'spin',\n text: this.locale.text,\n icon: {\n type: 'loading',\n theme: 'outline',\n spin: true\n },\n delay: 0\n })!;\n this.loading$ = this.n$\n .asObservable()\n .pipe(debounce(() => timer(this.opt!.delay!)))\n .subscribe(() => this.create());\n }\n\n private create(): void {\n if (this.opt == null) return;\n\n this._close(false);\n\n this._overlayRef = this.overlay.create({\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically(),\n scrollStrategy: this.overlay.scrollStrategies.block(),\n hasBackdrop: true,\n backdropClass: 'loading-backdrop'\n });\n this.compRef = this._overlayRef.attach(new ComponentPortal(LoadingDefaultComponent));\n const dir = this.configSrv.get('loading')!.direction ?? this.directionality.value;\n if (this.instance != null) {\n this.instance!.options = this.opt;\n this.instance!.dir = dir;\n }\n this.compRef.changeDetectorRef.markForCheck();\n }\n\n /**\n * Open a new loading indicator\n *\n * 打开一个新加载指示符\n */\n open(options?: LoadingShowOptions): void {\n this.opt = { ...this.cog, ...options };\n this.n$.next();\n }\n\n private _close(cleanOpt: boolean): void {\n if (cleanOpt) this.opt = null;\n if (!this._overlayRef) return;\n this._overlayRef.detach();\n this.compRef = null;\n }\n\n /**\n * Turn off a loading indicator\n *\n * 关闭一个加载指示符\n */\n close(): void {\n this._close(true);\n }\n\n ngOnDestroy(): void {\n this.loading$.unsubscribe();\n }\n}\n","import { OverlayModule } from '@angular/cdk/overlay';\nimport { PortalModule } from '@angular/cdk/portal';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { NzIconModule } from 'ng-zorro-antd/icon';\nimport { NzSpinModule } from 'ng-zorro-antd/spin';\n\nimport { LoadingDefaultComponent } from './loading.component';\n\nconst COMPONENTS = [LoadingDefaultComponent];\n\n@NgModule({\n imports: [CommonModule, OverlayModule, PortalModule, NzIconModule, NzSpinModule, ...COMPONENTS],\n exports: COMPONENTS\n})\nexport class LoadingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;;MAsCa,uBAAuB,CAAA;AAClC,IAAA,OAAO;IACP,GAAG,GAAe,KAAK;AAEvB,IAAA,IAAI,IAAI,GAAA;AACN,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,IAAK;IAC3B;AAEA,IAAA,IAAI,MAAM,GAAA;AACR,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAO;IAC7B;uGAVW,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAvB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,uBAAuB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,2BAAA,EAAA,eAAA,EAAA,EAAA,cAAA,EAAA,iBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EA5BxB;;;;;;;;;;;;;;;;;;;GAmBT,EAAA,QAAA,EAAA,IAAA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAOS,eAAe,2JAAE,eAAe,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,CAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,SAAA,EAAA,gBAAA,EAAA,YAAA,CAAA,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AAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAb,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,EAAA,OAAA,EAAA,CAHd,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAH7D,uBAAuB,aAAvB,uBAAuB,CAAA,EAAA,CAAA;wGAM9B,aAAa,EAAA,OAAA,EAAA,CAHd,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAK,UAAU,CAAA,EAAA,CAAA;;2FAGnF,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,UAAU,CAAC;AAC/F,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACfD;;AAEG;;;;"}
|
package/fesm2022/lodop.mjs
CHANGED
|
@@ -218,20 +218,20 @@ class LodopService {
|
|
|
218
218
|
this._init.unsubscribe();
|
|
219
219
|
this._events.unsubscribe();
|
|
220
220
|
}
|
|
221
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
222
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
221
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LodopService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
222
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LodopService, providedIn: 'root' });
|
|
223
223
|
}
|
|
224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
224
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LodopService, decorators: [{
|
|
225
225
|
type: Injectable,
|
|
226
226
|
args: [{ providedIn: 'root' }]
|
|
227
227
|
}], ctorParameters: () => [] });
|
|
228
228
|
|
|
229
229
|
class LodopModule {
|
|
230
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
231
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
232
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
230
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LodopModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
231
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: LodopModule });
|
|
232
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LodopModule });
|
|
233
233
|
}
|
|
234
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: LodopModule, decorators: [{
|
|
235
235
|
type: NgModule,
|
|
236
236
|
args: [{}]
|
|
237
237
|
}] });
|
package/fesm2022/media.mjs
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
1
|
import { Platform } from '@angular/cdk/platform';
|
|
3
2
|
import * as i0 from '@angular/core';
|
|
4
|
-
import { inject, Injectable,
|
|
3
|
+
import { inject, Injectable, ElementRef, Renderer2, NgZone, input, numberAttribute, output, afterNextRender, effect, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
|
|
5
4
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
-
import { Subject, share,
|
|
7
|
-
import { ZoneOutside } from '@delon/util/decorator';
|
|
5
|
+
import { Subject, share, take, delay } from 'rxjs';
|
|
8
6
|
import { AlainConfigService } from '@delon/util/config';
|
|
9
7
|
import { LazyService } from '@delon/util/other';
|
|
10
8
|
import { CommonModule } from '@angular/common';
|
|
@@ -41,16 +39,15 @@ class MediaService {
|
|
|
41
39
|
notify() {
|
|
42
40
|
return this.notify$.asObservable().pipe(share());
|
|
43
41
|
}
|
|
44
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
45
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
43
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaService, providedIn: 'root' });
|
|
46
44
|
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaService, decorators: [{
|
|
48
46
|
type: Injectable,
|
|
49
47
|
args: [{ providedIn: 'root' }]
|
|
50
48
|
}] });
|
|
51
49
|
|
|
52
50
|
class MediaComponent {
|
|
53
|
-
destroy$ = inject(DestroyRef);
|
|
54
51
|
el = inject(ElementRef).nativeElement;
|
|
55
52
|
renderer = inject(Renderer2);
|
|
56
53
|
ngZone = inject(NgZone);
|
|
@@ -58,18 +55,29 @@ class MediaComponent {
|
|
|
58
55
|
platform = inject(Platform);
|
|
59
56
|
_p;
|
|
60
57
|
videoEl;
|
|
61
|
-
type = 'video';
|
|
62
|
-
source;
|
|
63
|
-
options;
|
|
64
|
-
delay = 0;
|
|
65
|
-
ready =
|
|
58
|
+
type = input('video', ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
59
|
+
source = input(...(ngDevMode ? [undefined, { debugName: "source" }] : []));
|
|
60
|
+
options = input(...(ngDevMode ? [undefined, { debugName: "options" }] : []));
|
|
61
|
+
delay = input(0, { ...(ngDevMode ? { debugName: "delay" } : {}), transform: numberAttribute });
|
|
62
|
+
ready = output();
|
|
66
63
|
get player() {
|
|
67
64
|
return this._p;
|
|
68
65
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.
|
|
66
|
+
constructor() {
|
|
67
|
+
this.srv
|
|
68
|
+
.notify()
|
|
69
|
+
.pipe(takeUntilDestroyed(), take(1), delay(this.delay()))
|
|
72
70
|
.subscribe(() => this.ngZone.runOutsideAngular(() => this.init()));
|
|
71
|
+
afterNextRender(() => {
|
|
72
|
+
if (!this.platform.isBrowser) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.srv.load();
|
|
76
|
+
});
|
|
77
|
+
effect(() => {
|
|
78
|
+
this.srv.cog = { options: this.options };
|
|
79
|
+
this.uploadSource();
|
|
80
|
+
});
|
|
73
81
|
}
|
|
74
82
|
init() {
|
|
75
83
|
const winPlyr = window.Plyr;
|
|
@@ -80,11 +88,11 @@ class MediaComponent {
|
|
|
80
88
|
const player = (this._p = new winPlyr(this.videoEl, {
|
|
81
89
|
...this.srv.cog.options
|
|
82
90
|
}));
|
|
83
|
-
player.on('ready', () => this.ngZone.run(() => this.ready.
|
|
91
|
+
player.on('ready', () => this.ngZone.run(() => this.ready.emit(player)));
|
|
84
92
|
this.uploadSource();
|
|
85
93
|
}
|
|
86
94
|
ensureElement() {
|
|
87
|
-
const
|
|
95
|
+
const type = this.type();
|
|
88
96
|
let el = this.el.querySelector(type);
|
|
89
97
|
if (!el) {
|
|
90
98
|
el = this.renderer.createElement(type);
|
|
@@ -94,43 +102,22 @@ class MediaComponent {
|
|
|
94
102
|
this.videoEl = el;
|
|
95
103
|
}
|
|
96
104
|
destroy() {
|
|
97
|
-
|
|
98
|
-
this._p.destroy();
|
|
99
|
-
}
|
|
105
|
+
this._p?.destroy();
|
|
100
106
|
}
|
|
101
107
|
uploadSource() {
|
|
108
|
+
const source = this.source();
|
|
109
|
+
const type = this.type();
|
|
102
110
|
if (this._p == null)
|
|
103
111
|
return;
|
|
104
|
-
const { source, type } = this;
|
|
105
112
|
this._p.source = (typeof source === 'string' ? { type, sources: [{ src: source }] } : source);
|
|
106
113
|
}
|
|
107
|
-
ngAfterViewInit() {
|
|
108
|
-
if (!this.platform.isBrowser) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
this.srv
|
|
112
|
-
.notify()
|
|
113
|
-
.pipe(takeUntilDestroyed(this.destroy$), take(1))
|
|
114
|
-
.subscribe(() => this.initDelay());
|
|
115
|
-
this.srv.load();
|
|
116
|
-
}
|
|
117
|
-
ngOnChanges(changes) {
|
|
118
|
-
this.srv.cog = { options: this.options };
|
|
119
|
-
if (changes.source) {
|
|
120
|
-
this.uploadSource();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
114
|
ngOnDestroy() {
|
|
124
115
|
this.destroy();
|
|
125
|
-
this._p = null;
|
|
126
116
|
}
|
|
127
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
128
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
117
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
118
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.0.6", type: MediaComponent, isStandalone: true, selector: "media, [media]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, delay: { classPropertyName: "delay", publicName: "delay", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { ready: "ready" }, host: { classAttribute: "d-block" }, exportAs: ["mediaComponent"], ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
129
119
|
}
|
|
130
|
-
|
|
131
|
-
ZoneOutside()
|
|
132
|
-
], MediaComponent.prototype, "initDelay", null);
|
|
133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImport: i0, type: MediaComponent, decorators: [{
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaComponent, decorators: [{
|
|
134
121
|
type: Component,
|
|
135
122
|
args: [{
|
|
136
123
|
selector: 'media, [media]',
|
|
@@ -142,26 +129,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.0", ngImpor
|
|
|
142
129
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
143
130
|
encapsulation: ViewEncapsulation.None
|
|
144
131
|
}]
|
|
145
|
-
}], propDecorators: { type: [{
|
|
146
|
-
type: Input
|
|
147
|
-
}], source: [{
|
|
148
|
-
type: Input
|
|
149
|
-
}], options: [{
|
|
150
|
-
type: Input
|
|
151
|
-
}], delay: [{
|
|
152
|
-
type: Input,
|
|
153
|
-
args: [{ transform: numberAttribute }]
|
|
154
|
-
}], ready: [{
|
|
155
|
-
type: Output
|
|
156
|
-
}], initDelay: [] } });
|
|
132
|
+
}], ctorParameters: () => [], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], delay: [{ type: i0.Input, args: [{ isSignal: true, alias: "delay", required: false }] }], ready: [{ type: i0.Output, args: ["ready"] }] } });
|
|
157
133
|
|
|
158
134
|
const COMPONENTS = [MediaComponent];
|
|
159
135
|
class MediaModule {
|
|
160
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
161
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
162
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
136
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
137
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.0.6", ngImport: i0, type: MediaModule, imports: [CommonModule, MediaComponent], exports: [MediaComponent] });
|
|
138
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaModule, imports: [CommonModule] });
|
|
163
139
|
}
|
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
140
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: MediaModule, decorators: [{
|
|
165
141
|
type: NgModule,
|
|
166
142
|
args: [{
|
|
167
143
|
imports: [CommonModule, ...COMPONENTS],
|
package/fesm2022/media.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media.mjs","sources":["../../../../packages/abc/media/media.service.ts","../../../../packages/abc/media/media.component.ts","../../../../packages/abc/media/media.module.ts","../../../../packages/abc/media/media.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { Observable, Subject, share } from 'rxjs';\n\nimport { AlainConfigService, AlainMediaConfig } from '@delon/util/config';\nimport { LazyService } from '@delon/util/other';\n\n@Injectable({ providedIn: 'root' })\nexport class MediaService {\n private readonly cogSrv = inject(AlainConfigService);\n private readonly lazySrv = inject(LazyService);\n\n private _cog!: AlainMediaConfig;\n private loading = false;\n private loaded = false;\n private notify$ = new Subject<void>();\n\n get cog(): AlainMediaConfig {\n return this._cog;\n }\n set cog(val: AlainMediaConfig) {\n this._cog = this.cogSrv.merge(\n 'media',\n {\n urls: ['https://cdn.jsdelivr.net/npm/plyr/dist/plyr.min.js', 'https://cdn.jsdelivr.net/npm/plyr/dist/plyr.css']\n },\n val\n )!;\n }\n\n load(): this {\n if (this.loading) {\n if (this.loaded) {\n this.notify$.next();\n }\n return this;\n }\n this.loading = true;\n this.lazySrv.load(this.cog.urls!).then(() => {\n this.loaded = true;\n this.notify$.next();\n });\n return this;\n }\n\n notify(): Observable<void> {\n return this.notify$.asObservable().pipe(share());\n }\n}\n","import { Platform } from '@angular/cdk/platform';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n EventEmitter,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n Output,\n Renderer2,\n SimpleChange,\n ViewEncapsulation,\n inject,\n numberAttribute\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { timer, take } from 'rxjs';\n\nimport type Plyr from 'plyr';\n\nimport { ZoneOutside } from '@delon/util/decorator';\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport { MediaService } from './media.service';\n\nexport type MediaType = 'html5' | 'youtube' | 'video' | 'audio';\n\n@Component({\n selector: 'media, [media]',\n exportAs: 'mediaComponent',\n template: `<ng-content />`,\n host: {\n class: 'd-block'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class MediaComponent implements OnChanges, AfterViewInit, OnDestroy {\n private readonly destroy$ = inject(DestroyRef);\n private readonly el: HTMLElement = inject(ElementRef).nativeElement;\n private readonly renderer = inject(Renderer2);\n private readonly ngZone = inject(NgZone);\n private readonly srv = inject(MediaService);\n private readonly platform = inject(Platform);\n\n private _p?: Plyr | null;\n private videoEl?: HTMLElement;\n\n @Input() type: MediaType = 'video';\n @Input() source?: string | Plyr.SourceInfo;\n @Input() options?: Plyr.Options;\n @Input({ transform: numberAttribute }) delay = 0;\n @Output() readonly ready = new EventEmitter<Plyr>();\n\n get player(): Plyr | undefined | null {\n return this._p;\n }\n\n @ZoneOutside()\n private initDelay(): void {\n timer(this.delay)\n .pipe(takeUntilDestroyed(this.destroy$))\n .subscribe(() => this.ngZone.runOutsideAngular(() => this.init()));\n }\n\n private init(): void {\n const winPlyr = (window as NzSafeAny).Plyr;\n if (!winPlyr) {\n throw new Error(\n `No window.Plyr found, please make sure that cdn or local path exists, the current referenced path is: ${JSON.stringify(\n this.srv.cog.urls\n )}`\n );\n }\n\n this.ensureElement();\n\n const player: Plyr = (this._p = new winPlyr(this.videoEl, {\n ...this.srv.cog.options\n }));\n\n player.on('ready', () => this.ngZone.run(() => this.ready.next(player)));\n\n this.uploadSource();\n }\n\n private ensureElement(): void {\n const { type } = this;\n let el = this.el.querySelector(type) as HTMLElement;\n if (!el) {\n el = this.renderer.createElement(type);\n (el as HTMLVideoElement).controls = true;\n this.el.appendChild(el);\n }\n this.videoEl = el;\n }\n\n private destroy(): void {\n if (this._p) {\n this._p.destroy();\n }\n }\n\n private uploadSource(): void {\n if (this._p == null) return;\n\n const { source, type } = this;\n this._p.source = (typeof source === 'string' ? { type, sources: [{ src: source }] } : source) as Plyr.SourceInfo;\n }\n\n ngAfterViewInit(): void {\n if (!this.platform.isBrowser) {\n return;\n }\n this.srv\n .notify()\n .pipe(takeUntilDestroyed(this.destroy$), take(1))\n .subscribe(() => this.initDelay());\n\n this.srv.load();\n }\n\n ngOnChanges(changes: { [p in keyof MediaComponent]?: SimpleChange }): void {\n this.srv.cog = { options: this.options };\n if (changes.source) {\n this.uploadSource();\n }\n }\n\n ngOnDestroy(): void {\n this.destroy();\n this._p = null;\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { MediaComponent } from './media.component';\n\nconst COMPONENTS = [MediaComponent];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENTS],\n exports: COMPONENTS\n})\nexport class MediaModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;;;MAOa,YAAY,CAAA;AACN,IAAA,MAAM,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACnC,IAAA,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC;AAEtC,IAAA,IAAI;IACJ,OAAO,GAAG,KAAK;IACf,MAAM,GAAG,KAAK;AACd,IAAA,OAAO,GAAG,IAAI,OAAO,EAAQ;AAErC,IAAA,IAAI,GAAG,GAAA;QACL,OAAO,IAAI,CAAC,IAAI;IAClB;IACA,IAAI,GAAG,CAAC,GAAqB,EAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAC3B,OAAO,EACP;AACE,YAAA,IAAI,EAAE,CAAC,oDAAoD,EAAE,iDAAiD;SAC/G,EACD,GAAG,CACH;IACJ;IAEA,IAAI,GAAA;AACF,QAAA,IAAI,IAAI,CAAC,OAAO,EAAE;AAChB,YAAA,IAAI,IAAI,CAAC,MAAM,EAAE;AACf,gBAAA,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;YACrB;AACA,YAAA,OAAO,IAAI;QACb;AACA,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI;AACnB,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAK,CAAC,CAAC,IAAI,CAAC,MAAK;AAC1C,YAAA,IAAI,CAAC,MAAM,GAAG,IAAI;AAClB,YAAA,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;AACrB,QAAA,CAAC,CAAC;AACF,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,GAAA;AACJ,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,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AA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,EAAA,OAAA,EAAA,CAHZ,YAAY,EAHJ,cAAc,aAAd,cAAc,CAAA,EAAA,CAAA;AAMrB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAW,YAHZ,YAAY,CAAA,EAAA,CAAA;;2FAGX,WAAW,EAAA,UAAA,EAAA,CAAA;kBAJvB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,GAAG,UAAU,CAAC;AACtC,oBAAA,OAAO,EAAE;AACV,iBAAA;;;ACVD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"media.mjs","sources":["../../../../packages/abc/media/media.service.ts","../../../../packages/abc/media/media.component.ts","../../../../packages/abc/media/media.module.ts","../../../../packages/abc/media/media.ts"],"sourcesContent":["import { Injectable, inject } from '@angular/core';\nimport { Observable, Subject, share } from 'rxjs';\n\nimport { AlainConfigService, AlainMediaConfig } from '@delon/util/config';\nimport { LazyService } from '@delon/util/other';\n\n@Injectable({ providedIn: 'root' })\nexport class MediaService {\n private readonly cogSrv = inject(AlainConfigService);\n private readonly lazySrv = inject(LazyService);\n\n private _cog!: AlainMediaConfig;\n private loading = false;\n private loaded = false;\n private notify$ = new Subject<void>();\n\n get cog(): AlainMediaConfig {\n return this._cog;\n }\n set cog(val: AlainMediaConfig) {\n this._cog = this.cogSrv.merge(\n 'media',\n {\n urls: ['https://cdn.jsdelivr.net/npm/plyr/dist/plyr.min.js', 'https://cdn.jsdelivr.net/npm/plyr/dist/plyr.css']\n },\n val\n )!;\n }\n\n load(): this {\n if (this.loading) {\n if (this.loaded) {\n this.notify$.next();\n }\n return this;\n }\n this.loading = true;\n this.lazySrv.load(this.cog.urls!).then(() => {\n this.loaded = true;\n this.notify$.next();\n });\n return this;\n }\n\n notify(): Observable<void> {\n return this.notify$.asObservable().pipe(share());\n }\n}\n","import { Platform } from '@angular/cdk/platform';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n NgZone,\n OnDestroy,\n Renderer2,\n ViewEncapsulation,\n afterNextRender,\n effect,\n inject,\n input,\n numberAttribute,\n output\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { take, delay } from 'rxjs';\n\nimport type * as Plyr from 'plyr';\n\nimport type { NzSafeAny } from 'ng-zorro-antd/core/types';\n\nimport { MediaService } from './media.service';\n\nexport type MediaType = 'html5' | 'youtube' | 'video' | 'audio';\n\n@Component({\n selector: 'media, [media]',\n exportAs: 'mediaComponent',\n template: `<ng-content />`,\n host: {\n class: 'd-block'\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class MediaComponent implements OnDestroy {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n private readonly renderer = inject(Renderer2);\n private readonly ngZone = inject(NgZone);\n private readonly srv = inject(MediaService);\n private readonly platform = inject(Platform);\n\n private _p?: Plyr | null;\n private videoEl?: HTMLElement;\n\n readonly type = input<MediaType>('video');\n readonly source = input<string | Plyr.SourceInfo>();\n readonly options = input<Plyr.Options>();\n readonly delay = input(0, { transform: numberAttribute });\n readonly ready = output<Plyr>();\n\n get player(): Plyr | undefined | null {\n return this._p;\n }\n\n constructor() {\n this.srv\n .notify()\n .pipe(takeUntilDestroyed(), take(1), delay(this.delay()))\n .subscribe(() => this.ngZone.runOutsideAngular(() => this.init()));\n\n afterNextRender(() => {\n if (!this.platform.isBrowser) {\n return;\n }\n\n this.srv.load();\n });\n\n effect(() => {\n this.srv.cog = { options: this.options };\n this.uploadSource();\n });\n }\n\n private init(): void {\n const winPlyr = (window as NzSafeAny).Plyr;\n if (!winPlyr) {\n throw new Error(\n `No window.Plyr found, please make sure that cdn or local path exists, the current referenced path is: ${JSON.stringify(\n this.srv.cog.urls\n )}`\n );\n }\n\n this.ensureElement();\n\n const player: Plyr = (this._p = new winPlyr(this.videoEl, {\n ...this.srv.cog.options\n }));\n\n player.on('ready', () => this.ngZone.run(() => this.ready.emit(player)));\n\n this.uploadSource();\n }\n\n private ensureElement(): void {\n const type = this.type();\n let el = this.el.querySelector(type) as HTMLElement;\n if (!el) {\n el = this.renderer.createElement(type);\n (el as HTMLVideoElement).controls = true;\n this.el.appendChild(el);\n }\n this.videoEl = el;\n }\n\n private destroy(): void {\n this._p?.destroy();\n }\n\n private uploadSource(): void {\n const source = this.source();\n const type = this.type();\n\n if (this._p == null) return;\n this._p.source = (typeof source === 'string' ? { type, sources: [{ src: source }] } : source) as Plyr.SourceInfo;\n }\n\n ngOnDestroy(): void {\n this.destroy();\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { MediaComponent } from './media.component';\n\nconst COMPONENTS = [MediaComponent];\n\n@NgModule({\n imports: [CommonModule, ...COMPONENTS],\n exports: COMPONENTS\n})\nexport class MediaModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;;;;MAOa,YAAY,CAAA;AACN,IAAA,MAAM,GAAG,MAAM,CAAC,kBAAkB,CAAC;AACnC,IAAA,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC;AAEtC,IAAA,IAAI;IACJ,OAAO,GAAG,KAAK;IACf,MAAM,GAAG,KAAK;AACd,IAAA,OAAO,GAAG,IAAI,OAAO,EAAQ;AAErC,IAAA,IAAI,GAAG,GAAA;QACL,OAAO,IAAI,CAAC,IAAI;IAClB;IACA,IAAI,GAAG,CAAC,GAAqB,EAAA;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAC3B,OAAO,EACP;AACE,YAAA,IAAI,EAAE,CAAC,oDAAoD,EAAE,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