@ngutil/layout 0.0.3-dev.8 → 0.0.3-dev.9
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/esm2022/docking/docking-layout.component.mjs +1 -81
- package/esm2022/docking/docking-panel.component.mjs +1 -2
- package/esm2022/index.mjs +2 -1
- package/esm2022/services/slots.service.mjs +240 -0
- package/fesm2022/ngutil-layout.mjs +239 -84
- package/fesm2022/ngutil-layout.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +2 -2
- package/services/slots.service.d.ts +69 -0
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngutil/layout",
|
|
3
|
-
"version": "0.0.3-dev.
|
|
3
|
+
"version": "0.0.3-dev.9",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"directory": "../../dist/packages/layout/"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"peerDependencies": {
|
|
9
9
|
"@angular/common": "^17.1.0",
|
|
10
10
|
"@angular/core": "^17.1.0",
|
|
11
|
-
"@ngutil/common": "0.0.3-dev.
|
|
11
|
+
"@ngutil/common": "0.0.3-dev.9"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"tslib": "^2.3.0"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { EmbeddedViewRef, Injector, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from "@angular/core";
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
import { Destructible, IDisposable } from "@ngutil/common";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
type SlotOrder = `:${number}`;
|
|
6
|
+
type SlotId = ` as ${string}`;
|
|
7
|
+
export type Slot<T extends string> = `${T}${SlotOrder | ""}${SlotId | ""}`;
|
|
8
|
+
export type SlotTpl = TemplateRef<any>;
|
|
9
|
+
export type SlotViewRef = EmbeddedViewRef<any>;
|
|
10
|
+
export declare class SlotDef<T extends string> implements IDisposable {
|
|
11
|
+
readonly tpl: SlotTpl;
|
|
12
|
+
readonly slot: T;
|
|
13
|
+
readonly order: number;
|
|
14
|
+
readonly id?: string;
|
|
15
|
+
readonly viewRef?: SlotViewRef;
|
|
16
|
+
constructor(slot: Slot<T>, tpl: SlotTpl);
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface SlotEvent<T extends string> {
|
|
20
|
+
type: "add" | "del";
|
|
21
|
+
def: SlotDef<T>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @Directive({selector: "ng-template[xyzSlot]", inputs: [{name: "slot", alias: "xyzSlot"}]})
|
|
25
|
+
* class XYZSlotDirective extends SlotDirective<XYZComponentSlots> { }
|
|
26
|
+
*
|
|
27
|
+
* @Directive({selector: "ng-template[xyzSlotOutlet]", inputs: [{name: "slot", alias: "xyzSlotOutlet"}]})
|
|
28
|
+
* class XYZSlotOutletDirective extends SlotOutletDirective<XYZComponentSlots> { }
|
|
29
|
+
*
|
|
30
|
+
*
|
|
31
|
+
* @Component({provides: [SlotsService]})
|
|
32
|
+
* class XYZComponent {
|
|
33
|
+
* slots: inject(SlotsService<XYZComponentSlots>)
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export declare class SlotsService<T extends string = any> extends Destructible {
|
|
39
|
+
#private;
|
|
40
|
+
constructor();
|
|
41
|
+
addTpl(def: SlotDef<T>): void;
|
|
42
|
+
delTpl(def: SlotDef<T>): void;
|
|
43
|
+
watch(slot: T): Observable<SlotDef<T>[]>;
|
|
44
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SlotsService<any>, never>;
|
|
45
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SlotsService<any>>;
|
|
46
|
+
}
|
|
47
|
+
export declare abstract class SlotDirective<T extends string, C = any> implements OnDestroy {
|
|
48
|
+
#private;
|
|
49
|
+
protected abstract readonly slotSvc: SlotsService<T>;
|
|
50
|
+
protected readonly tpl: TemplateRef<any>;
|
|
51
|
+
set slot(slot: Slot<T>);
|
|
52
|
+
get slot(): Slot<T>;
|
|
53
|
+
ngOnDestroy(): void;
|
|
54
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SlotDirective<any, any>, never>;
|
|
55
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SlotDirective<any, any>, never, never, {}, {}, never, never, false, never>;
|
|
56
|
+
}
|
|
57
|
+
export declare abstract class SlotOutletDirective<T extends string> extends Destructible implements OnInit {
|
|
58
|
+
#private;
|
|
59
|
+
protected abstract readonly slotSvc: SlotsService<T>;
|
|
60
|
+
protected readonly vcr: ViewContainerRef;
|
|
61
|
+
protected readonly injector: Injector;
|
|
62
|
+
set slot(slot: T | null);
|
|
63
|
+
get slot(): T | null;
|
|
64
|
+
constructor();
|
|
65
|
+
ngOnInit(): void;
|
|
66
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SlotOutletDirective<any>, never>;
|
|
67
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<SlotOutletDirective<any>, never, never, {}, {}, never, never, false, never>;
|
|
68
|
+
}
|
|
69
|
+
export {};
|