@rxap/window-system 16.0.1-dev.7 → 16.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/CHANGELOG.md +20 -0
- package/README.md +1 -1
- package/esm2022/lib/window-config.mjs +1 -1
- package/esm2022/lib/window-container/window-container.component.mjs +24 -30
- package/esm2022/lib/window-content/window-content.component.mjs +3 -3
- package/esm2022/lib/window-system.module.mjs +6 -5
- package/esm2022/lib/window-title.directive.mjs +9 -20
- package/esm2022/lib/window.service.mjs +2 -2
- package/fesm2022/rxap-window-system.mjs +114 -127
- package/fesm2022/rxap-window-system.mjs.map +1 -1
- package/lib/window-config.d.ts +1 -0
- package/lib/window-container/window-container.component.d.ts +14 -20
- package/lib/window-title.directive.d.ts +1 -2
- package/package.json +12 -11
- package/theme.css +1 -1
|
@@ -3,21 +3,22 @@ import { OverlayConfig, Overlay } from '@angular/cdk/overlay';
|
|
|
3
3
|
import * as i2 from '@angular/cdk/portal';
|
|
4
4
|
import { TemplatePortal, ComponentPortal, CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { InjectionToken, ComponentRef, isDevMode, Component, ChangeDetectionStrategy, Inject, ViewChild, EventEmitter, Input, Output,
|
|
6
|
+
import { InjectionToken, ComponentRef, isDevMode, Component, ChangeDetectionStrategy, Inject, ViewChild, EventEmitter, Input, Output, inject, INJECTOR, runInInjectionContext, ContentChild, HostBinding, InjectFlags, Injector, ViewContainerRef, ComponentFactoryResolver, Injectable, Optional, ChangeDetectorRef, NgModule, TemplateRef, Directive } from '@angular/core';
|
|
7
7
|
import * as i1 from '@rxap/services';
|
|
8
8
|
import { LoadingIndicatorService } from '@rxap/services';
|
|
9
9
|
import { GenerateRandomString } from '@rxap/utilities';
|
|
10
|
-
import { isObservable, TimeoutError, throwError, Subscription, fromEvent, Subject, BehaviorSubject, ReplaySubject
|
|
10
|
+
import { isObservable, TimeoutError, throwError, Subscription, fromEvent, merge, Subject, BehaviorSubject, ReplaySubject } from 'rxjs';
|
|
11
11
|
import { startWith, take, tap, filter, delay, timeout, catchError, switchMap, takeUntil, map, finalize } from 'rxjs/operators';
|
|
12
12
|
import { isDefined } from '@rxap/rxjs';
|
|
13
13
|
import { CdkDrag, CdkDragHandle } from '@angular/cdk/drag-drop';
|
|
14
14
|
import { AsyncPipe, NgClass, NgIf, NgStyle, NgFor } from '@angular/common';
|
|
15
|
-
import
|
|
16
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
15
|
+
import { toSignal } from '@angular/core/rxjs-interop';
|
|
17
16
|
import * as i3 from '@angular/material/progress-bar';
|
|
18
17
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
19
18
|
import * as i1$2 from '@angular/material/toolbar';
|
|
20
19
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
20
|
+
import * as i1$1 from '@angular/material/icon';
|
|
21
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
21
22
|
import * as i4 from '@angular/material/button';
|
|
22
23
|
import { MatButtonModule } from '@angular/material/button';
|
|
23
24
|
import { IconDirective } from '@rxap/material-directives/icon';
|
|
@@ -80,11 +81,11 @@ class WindowContentComponent {
|
|
|
80
81
|
})).subscribe();
|
|
81
82
|
}
|
|
82
83
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowContentComponent, deps: [{ token: RXAP_WINDOW_CONTAINER_CONTEXT }, { token: RXAP_WINDOW_REF }, { token: i0.Injector }, { token: i0.ViewContainerRef }, { token: i1.LoadingIndicatorService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
83
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WindowContentComponent, isStandalone: true, selector: "rxap-window-content", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true }], ngImport: i0, template: "<div class=\"
|
|
84
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WindowContentComponent, isStandalone: true, selector: "rxap-window-content", viewQueries: [{ propertyName: "portalOutlet", first: true, predicate: CdkPortalOutlet, descendants: true }], ngImport: i0, template: "<div class=\"p-4\">\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n</div>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
84
85
|
}
|
|
85
86
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowContentComponent, decorators: [{
|
|
86
87
|
type: Component,
|
|
87
|
-
args: [{ selector: 'rxap-window-content', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [PortalModule], template: "<div class=\"
|
|
88
|
+
args: [{ selector: 'rxap-window-content', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [PortalModule], template: "<div class=\"p-4\">\n <ng-template [cdkPortalOutlet]=\"portal\"></ng-template>\n</div>\n" }]
|
|
88
89
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
89
90
|
type: Inject,
|
|
90
91
|
args: [RXAP_WINDOW_CONTAINER_CONTEXT]
|
|
@@ -168,6 +169,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
168
169
|
args: ['resizing']
|
|
169
170
|
}] } });
|
|
170
171
|
|
|
172
|
+
class WindowToolBarComponent {
|
|
173
|
+
constructor(context) {
|
|
174
|
+
this.windowRef = context.windowRef;
|
|
175
|
+
}
|
|
176
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowToolBarComponent, deps: [{ token: RXAP_WINDOW_CONTEXT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
177
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WindowToolBarComponent, isStandalone: true, selector: "rxap-window-tool-bar", ngImport: i0, template: "<mat-toolbar class=\"header flex flex-row items-center justify-between gap-x-4\">\n <div class=\"flex flex-row justify-end items-center gap-x-3\">\n <ng-template [ngIfElse]=\"titleFromSettings\" [ngIf]=\"windowRef.titlePortal$ | async\" let-titlePortal>\n <ng-template [cdkPortalOutlet]=\"titlePortal\"></ng-template>\n </ng-template>\n <ng-template #titleFromSettings>\n <ng-template [ngIf]=\"windowRef.settings$ | async\" let-settings>\n <mat-icon *ngIf=\"settings.icon\" [rxapIcon]=\"settings.icon\"></mat-icon>\n <h3 *ngIf=\"settings.title\">{{settings.title}}</h3>\n </ng-template>\n </ng-template>\n </div>\n <div class=\"flex flex-row justify-end items-center\">\n <button (click)=\"windowRef.minimize()\" *ngIf=\"windowRef.minimizable !== false\"\n mat-icon-button type=\"button\">\n <mat-icon>minimize</mat-icon>\n </button>\n <button (click)=\"windowRef.fullScreen()\" mat-icon-button type=\"button\">\n <mat-icon>fullscreen</mat-icon>\n </button>\n <button (click)=\"windowRef.complete()\" mat-icon-button type=\"button\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n</mat-toolbar>\n", styles: [":host{width:100%}.header{height:64px}\n"], dependencies: [{ kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i1$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
178
|
+
}
|
|
179
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowToolBarComponent, decorators: [{
|
|
180
|
+
type: Component,
|
|
181
|
+
args: [{ selector: 'rxap-window-tool-bar', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [
|
|
182
|
+
MatToolbarModule,
|
|
183
|
+
NgIf,
|
|
184
|
+
PortalModule,
|
|
185
|
+
MatIconModule,
|
|
186
|
+
IconDirective,
|
|
187
|
+
MatButtonModule,
|
|
188
|
+
AsyncPipe,
|
|
189
|
+
], template: "<mat-toolbar class=\"header flex flex-row items-center justify-between gap-x-4\">\n <div class=\"flex flex-row justify-end items-center gap-x-3\">\n <ng-template [ngIfElse]=\"titleFromSettings\" [ngIf]=\"windowRef.titlePortal$ | async\" let-titlePortal>\n <ng-template [cdkPortalOutlet]=\"titlePortal\"></ng-template>\n </ng-template>\n <ng-template #titleFromSettings>\n <ng-template [ngIf]=\"windowRef.settings$ | async\" let-settings>\n <mat-icon *ngIf=\"settings.icon\" [rxapIcon]=\"settings.icon\"></mat-icon>\n <h3 *ngIf=\"settings.title\">{{settings.title}}</h3>\n </ng-template>\n </ng-template>\n </div>\n <div class=\"flex flex-row justify-end items-center\">\n <button (click)=\"windowRef.minimize()\" *ngIf=\"windowRef.minimizable !== false\"\n mat-icon-button type=\"button\">\n <mat-icon>minimize</mat-icon>\n </button>\n <button (click)=\"windowRef.fullScreen()\" mat-icon-button type=\"button\">\n <mat-icon>fullscreen</mat-icon>\n </button>\n <button (click)=\"windowRef.complete()\" mat-icon-button type=\"button\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n</mat-toolbar>\n", styles: [":host{width:100%}.header{height:64px}\n"] }]
|
|
190
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
191
|
+
type: Inject,
|
|
192
|
+
args: [RXAP_WINDOW_CONTEXT]
|
|
193
|
+
}] }]; } });
|
|
194
|
+
|
|
195
|
+
class WindowContainerComponent {
|
|
196
|
+
constructor() {
|
|
197
|
+
this.injector = inject(INJECTOR);
|
|
198
|
+
this.context = inject(RXAP_WINDOW_CONTEXT);
|
|
199
|
+
this.windowRef = inject(RXAP_WINDOW_REF);
|
|
200
|
+
this.windowInstance = inject(LoadingIndicatorService);
|
|
201
|
+
}
|
|
202
|
+
get id() {
|
|
203
|
+
return this.context.id;
|
|
204
|
+
}
|
|
205
|
+
ngOnInit() {
|
|
206
|
+
runInInjectionContext(this.injector, () => {
|
|
207
|
+
this.width = toSignal(merge(this.windowContainerResizer.width$, this.windowRef.width$).pipe(isDefined(), filter(value => !!value?.match(/^\d+/))), { initialValue: '100%' });
|
|
208
|
+
this.height = toSignal(merge(this.windowContainerResizer.height$, this.windowRef.height$).pipe(isDefined(), filter(value => !!value?.match(/^\d+/))), { initialValue: '100%' });
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
onDragEnded($event) {
|
|
212
|
+
const nativeElement = $event.source.element.nativeElement;
|
|
213
|
+
const pos = nativeElement.getBoundingClientRect();
|
|
214
|
+
$event.source.reset();
|
|
215
|
+
this.windowRef.setPos(pos.left + 'px', pos.top + 'px');
|
|
216
|
+
}
|
|
217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
218
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WindowContainerComponent, isStandalone: true, selector: "rxap-window-container", host: { properties: { "attr.data-id": "this.id" }, classAttribute: "rxap-window-container" }, queries: [{ propertyName: "footerContent", first: true, predicate: ["[footer]"], descendants: true, static: true }], viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, static: true }, { propertyName: "windowContainerResizer", first: true, predicate: WindowResizerComponent, descendants: true, static: true }], ngImport: i0, template: "<div #container\n (cdkDragEnded)=\"onDragEnded($event)\"\n [cdkDragDisabled]=\"windowRef.draggable === false\"\n [ngStyle]=\"{\n 'width': width(),\n 'height': height(),\n 'minWidth': windowRef.minWidth,\n 'minHeight': windowRef.minHeight,\n 'maxWidth': windowRef.maxWidth,\n 'maxHeight': windowRef.maxHeight\n }\"\n cdkDrag\n cdkDragBoundary=\".cdk-overlay-container\"\n class=\"mat-elevation-z4 mat-drawer-container z-[1]\">\n <div class=\"flex flex-col h-full max-h-full\">\n\n <div cdkDragHandle class=\"grow-0 w-full h-[64px] min-h-[64px] cursor-move\">\n <rxap-window-tool-bar></rxap-window-tool-bar>\n </div>\n\n <div class=\"grow overflow-auto w-full\">\n <ng-content></ng-content>\n </div>\n\n <mat-toolbar *ngIf=\"windowRef.footerPortal$ | async as footerPortal\"\n class=\"mat-elevation-z1 grow-0 w-full h-[64px] min-h-[64px]\">\n <ng-template [cdkPortalOutlet]=\"footerPortal\"></ng-template>\n </mat-toolbar>\n\n <mat-progress-bar *ngIf=\"windowInstance.isLoading$ | async\" mode=\"indeterminate\"></mat-progress-bar>\n\n <rxap-window-resizer [containerRef]=\"containerRef\"></rxap-window-resizer>\n </div>\n</div>\n", styles: [""], dependencies: [{ kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: WindowToolBarComponent, selector: "rxap-window-tool-bar" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i1$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i3.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: WindowResizerComponent, selector: "rxap-window-resizer", inputs: ["containerRef"], outputs: ["width", "height", "resizing"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
219
|
+
}
|
|
220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowContainerComponent, decorators: [{
|
|
221
|
+
type: Component,
|
|
222
|
+
args: [{ selector: 'rxap-window-container', changeDetection: ChangeDetectionStrategy.Default, host: {
|
|
223
|
+
class: 'rxap-window-container',
|
|
224
|
+
}, standalone: true, imports: [
|
|
225
|
+
CdkDrag,
|
|
226
|
+
NgStyle,
|
|
227
|
+
CdkDragHandle,
|
|
228
|
+
WindowToolBarComponent,
|
|
229
|
+
NgIf,
|
|
230
|
+
MatToolbarModule,
|
|
231
|
+
PortalModule,
|
|
232
|
+
MatProgressBarModule,
|
|
233
|
+
WindowResizerComponent,
|
|
234
|
+
AsyncPipe,
|
|
235
|
+
], template: "<div #container\n (cdkDragEnded)=\"onDragEnded($event)\"\n [cdkDragDisabled]=\"windowRef.draggable === false\"\n [ngStyle]=\"{\n 'width': width(),\n 'height': height(),\n 'minWidth': windowRef.minWidth,\n 'minHeight': windowRef.minHeight,\n 'maxWidth': windowRef.maxWidth,\n 'maxHeight': windowRef.maxHeight\n }\"\n cdkDrag\n cdkDragBoundary=\".cdk-overlay-container\"\n class=\"mat-elevation-z4 mat-drawer-container z-[1]\">\n <div class=\"flex flex-col h-full max-h-full\">\n\n <div cdkDragHandle class=\"grow-0 w-full h-[64px] min-h-[64px] cursor-move\">\n <rxap-window-tool-bar></rxap-window-tool-bar>\n </div>\n\n <div class=\"grow overflow-auto w-full\">\n <ng-content></ng-content>\n </div>\n\n <mat-toolbar *ngIf=\"windowRef.footerPortal$ | async as footerPortal\"\n class=\"mat-elevation-z1 grow-0 w-full h-[64px] min-h-[64px]\">\n <ng-template [cdkPortalOutlet]=\"footerPortal\"></ng-template>\n </mat-toolbar>\n\n <mat-progress-bar *ngIf=\"windowInstance.isLoading$ | async\" mode=\"indeterminate\"></mat-progress-bar>\n\n <rxap-window-resizer [containerRef]=\"containerRef\"></rxap-window-resizer>\n </div>\n</div>\n" }]
|
|
236
|
+
}], propDecorators: { footerContent: [{
|
|
237
|
+
type: ContentChild,
|
|
238
|
+
args: ['[footer]', { static: true }]
|
|
239
|
+
}], containerRef: [{
|
|
240
|
+
type: ViewChild,
|
|
241
|
+
args: ['container', { static: true }]
|
|
242
|
+
}], windowContainerResizer: [{
|
|
243
|
+
type: ViewChild,
|
|
244
|
+
args: [WindowResizerComponent, { static: true }]
|
|
245
|
+
}], id: [{
|
|
246
|
+
type: HostBinding,
|
|
247
|
+
args: ['attr.data-id']
|
|
248
|
+
}] } });
|
|
249
|
+
|
|
250
|
+
class DefaultWindowComponent {
|
|
251
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultWindowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
252
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DefaultWindowComponent, isStandalone: true, selector: "rxap-default-window", ngImport: i0, template: "<rxap-window-container>\n <rxap-window-content></rxap-window-content>\n</rxap-window-container>\n", styles: [""], dependencies: [{ kind: "component", type: WindowContainerComponent, selector: "rxap-window-container" }, { kind: "component", type: WindowContentComponent, selector: "rxap-window-content" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
253
|
+
}
|
|
254
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultWindowComponent, decorators: [{
|
|
255
|
+
type: Component,
|
|
256
|
+
args: [{ selector: 'rxap-default-window', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [WindowContainerComponent, WindowContentComponent], template: "<rxap-window-container>\n <rxap-window-content></rxap-window-content>\n</rxap-window-container>\n" }]
|
|
257
|
+
}] });
|
|
258
|
+
|
|
171
259
|
function GetWindowStartPos() {
|
|
172
260
|
let top = '16px';
|
|
173
261
|
let left = '16px';
|
|
@@ -195,6 +283,18 @@ function GetWindowStartPos() {
|
|
|
195
283
|
};
|
|
196
284
|
}
|
|
197
285
|
|
|
286
|
+
const DEFAULT_WINDOW_CONFIG = {
|
|
287
|
+
resizeable: true,
|
|
288
|
+
draggable: true,
|
|
289
|
+
injector: null,
|
|
290
|
+
componentFactoryResolver: null,
|
|
291
|
+
minWidth: '384px',
|
|
292
|
+
minHeight: '192px',
|
|
293
|
+
maxWidth: '100vw',
|
|
294
|
+
maxHeight: '100vh',
|
|
295
|
+
minimizable: false,
|
|
296
|
+
};
|
|
297
|
+
|
|
198
298
|
class WindowRef extends Subject {
|
|
199
299
|
constructor(overlayRef, overlay, settings) {
|
|
200
300
|
super();
|
|
@@ -375,111 +475,6 @@ class WindowRef extends Subject {
|
|
|
375
475
|
}
|
|
376
476
|
}
|
|
377
477
|
|
|
378
|
-
class WindowToolBarComponent {
|
|
379
|
-
constructor(context) {
|
|
380
|
-
this.windowRef = context.windowRef;
|
|
381
|
-
}
|
|
382
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowToolBarComponent, deps: [{ token: RXAP_WINDOW_CONTEXT }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
383
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WindowToolBarComponent, isStandalone: true, selector: "rxap-window-tool-bar", ngImport: i0, template: "<mat-toolbar class=\"header flex flex-row items-center justify-between gap-x-4\">\n <div class=\"flex flex-row justify-end items-center gap-x-3\">\n <ng-template [ngIfElse]=\"titleFromSettings\" [ngIf]=\"windowRef.titlePortal$ | async\" let-titlePortal>\n <ng-template [cdkPortalOutlet]=\"titlePortal\"></ng-template>\n </ng-template>\n <ng-template #titleFromSettings>\n <ng-template [ngIf]=\"windowRef.settings$ | async\" let-settings>\n <mat-icon *ngIf=\"settings.icon\" [rxapIcon]=\"settings.icon\"></mat-icon>\n <h3 *ngIf=\"settings.title\">{{settings.title}}</h3>\n </ng-template>\n </ng-template>\n </div>\n <div class=\"flex flex-row justify-end items-center\">\n <button (click)=\"windowRef.minimize()\" *ngIf=\"windowRef.minimizable !== false\"\n mat-icon-button type=\"button\">\n <mat-icon>minimize</mat-icon>\n </button>\n <button (click)=\"windowRef.fullScreen()\" mat-icon-button type=\"button\">\n <mat-icon>fullscreen</mat-icon>\n </button>\n <button (click)=\"windowRef.complete()\" mat-icon-button type=\"button\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n</mat-toolbar>\n", styles: [":host{width:100%}.header{height:64px}\n"], dependencies: [{ kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i1$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: IconDirective, selector: "mat-icon[rxapIcon]", inputs: ["rxapIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
384
|
-
}
|
|
385
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowToolBarComponent, decorators: [{
|
|
386
|
-
type: Component,
|
|
387
|
-
args: [{ selector: 'rxap-window-tool-bar', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [
|
|
388
|
-
MatToolbarModule,
|
|
389
|
-
NgIf,
|
|
390
|
-
PortalModule,
|
|
391
|
-
MatIconModule,
|
|
392
|
-
IconDirective,
|
|
393
|
-
MatButtonModule,
|
|
394
|
-
AsyncPipe,
|
|
395
|
-
], template: "<mat-toolbar class=\"header flex flex-row items-center justify-between gap-x-4\">\n <div class=\"flex flex-row justify-end items-center gap-x-3\">\n <ng-template [ngIfElse]=\"titleFromSettings\" [ngIf]=\"windowRef.titlePortal$ | async\" let-titlePortal>\n <ng-template [cdkPortalOutlet]=\"titlePortal\"></ng-template>\n </ng-template>\n <ng-template #titleFromSettings>\n <ng-template [ngIf]=\"windowRef.settings$ | async\" let-settings>\n <mat-icon *ngIf=\"settings.icon\" [rxapIcon]=\"settings.icon\"></mat-icon>\n <h3 *ngIf=\"settings.title\">{{settings.title}}</h3>\n </ng-template>\n </ng-template>\n </div>\n <div class=\"flex flex-row justify-end items-center\">\n <button (click)=\"windowRef.minimize()\" *ngIf=\"windowRef.minimizable !== false\"\n mat-icon-button type=\"button\">\n <mat-icon>minimize</mat-icon>\n </button>\n <button (click)=\"windowRef.fullScreen()\" mat-icon-button type=\"button\">\n <mat-icon>fullscreen</mat-icon>\n </button>\n <button (click)=\"windowRef.complete()\" mat-icon-button type=\"button\">\n <mat-icon>close</mat-icon>\n </button>\n </div>\n</mat-toolbar>\n", styles: [":host{width:100%}.header{height:64px}\n"] }]
|
|
396
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
397
|
-
type: Inject,
|
|
398
|
-
args: [RXAP_WINDOW_CONTEXT]
|
|
399
|
-
}] }]; } });
|
|
400
|
-
|
|
401
|
-
class WindowContainerComponent {
|
|
402
|
-
constructor(context, windowRef, windowInstance) {
|
|
403
|
-
this.context = context;
|
|
404
|
-
this.windowRef = windowRef;
|
|
405
|
-
this.windowInstance = windowInstance;
|
|
406
|
-
}
|
|
407
|
-
get id() {
|
|
408
|
-
return this.context.id;
|
|
409
|
-
}
|
|
410
|
-
ngOnInit() {
|
|
411
|
-
this.width$ = merge(this.windowContainerResizer.width$, this.windowRef.width$);
|
|
412
|
-
this.height$ = merge(this.windowContainerResizer.height$, this.windowRef.height$);
|
|
413
|
-
}
|
|
414
|
-
onDragEnded($event) {
|
|
415
|
-
const nativeElement = $event.source.element.nativeElement;
|
|
416
|
-
const pos = nativeElement.getBoundingClientRect();
|
|
417
|
-
$event.source.reset();
|
|
418
|
-
this.windowRef.setPos(pos.left + 'px', pos.top + 'px');
|
|
419
|
-
}
|
|
420
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowContainerComponent, deps: [{ token: RXAP_WINDOW_CONTEXT }, { token: RXAP_WINDOW_REF }, { token: LoadingIndicatorService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
421
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: WindowContainerComponent, isStandalone: true, selector: "rxap-window-container", host: { properties: { "attr.data-id": "this.id" }, classAttribute: "rxap-window-container" }, queries: [{ propertyName: "footerContent", first: true, predicate: ["[footer]"], descendants: true, static: true }], viewQueries: [{ propertyName: "containerRef", first: true, predicate: ["container"], descendants: true, static: true }, { propertyName: "windowContainerResizer", first: true, predicate: WindowResizerComponent, descendants: true, static: true }], ngImport: i0, template: "<div #container\n (cdkDragEnded)=\"onDragEnded($event)\"\n [cdkDragDisabled]=\"windowRef.draggable === false\"\n [ngStyle]=\"{\n 'width': width$ | async,\n 'height': height$ | async,\n 'minWidth': windowRef.minWidth,\n 'minHeight': windowRef.minHeight,\n 'maxWidth': windowRef.maxWidth,\n 'maxHeight': windowRef.maxHeight\n }\"\n cdkDrag\n cdkDragBoundary=\".cdk-overlay-container\"\n class=\"window-container mat-elevation-z4 mat-drawer-container \">\n <div class=\"flex flex-col h-full max-h-full\">\n\n <div cdkDragHandle class=\"tool-bar grow-0 w-full h-[64px] min-h-[64px]\">\n <rxap-window-tool-bar></rxap-window-tool-bar>\n </div>\n\n <div class=\"content grow overflow-auto w-full\">\n <ng-content></ng-content>\n </div>\n\n <mat-toolbar *ngIf=\"windowRef.footerPortal$ | async as footerPortal\" class=\"footer mat-elevation-z1 grow-0 w-full h-[64px] min-h-[64px]\">\n <ng-template [cdkPortalOutlet]=\"footerPortal\"></ng-template>\n </mat-toolbar>\n\n <mat-progress-bar *ngIf=\"windowInstance.isLoading$ | async\" mode=\"indeterminate\"></mat-progress-bar>\n\n <rxap-window-resizer [containerRef]=\"containerRef\"></rxap-window-resizer>\n </div>\n</div>\n", styles: [".window-container{cursor:move;position:relative;z-index:1;max-height:100vh;max-width:100vw}.window-container:active{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}\n"], dependencies: [{ kind: "directive", type: CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: WindowToolBarComponent, selector: "rxap-window-tool-bar" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatToolbarModule }, { kind: "component", type: i1$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "ngmodule", type: PortalModule }, { kind: "directive", type: i2.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }, { kind: "ngmodule", type: MatProgressBarModule }, { kind: "component", type: i3.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: WindowResizerComponent, selector: "rxap-window-resizer", inputs: ["containerRef"], outputs: ["width", "height", "resizing"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
422
|
-
}
|
|
423
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowContainerComponent, decorators: [{
|
|
424
|
-
type: Component,
|
|
425
|
-
args: [{ selector: 'rxap-window-container', changeDetection: ChangeDetectionStrategy.Default, host: {
|
|
426
|
-
class: 'rxap-window-container',
|
|
427
|
-
}, standalone: true, imports: [
|
|
428
|
-
CdkDrag,
|
|
429
|
-
NgStyle,
|
|
430
|
-
CdkDragHandle,
|
|
431
|
-
WindowToolBarComponent,
|
|
432
|
-
NgIf,
|
|
433
|
-
MatToolbarModule,
|
|
434
|
-
PortalModule,
|
|
435
|
-
MatProgressBarModule,
|
|
436
|
-
WindowResizerComponent,
|
|
437
|
-
AsyncPipe,
|
|
438
|
-
], template: "<div #container\n (cdkDragEnded)=\"onDragEnded($event)\"\n [cdkDragDisabled]=\"windowRef.draggable === false\"\n [ngStyle]=\"{\n 'width': width$ | async,\n 'height': height$ | async,\n 'minWidth': windowRef.minWidth,\n 'minHeight': windowRef.minHeight,\n 'maxWidth': windowRef.maxWidth,\n 'maxHeight': windowRef.maxHeight\n }\"\n cdkDrag\n cdkDragBoundary=\".cdk-overlay-container\"\n class=\"window-container mat-elevation-z4 mat-drawer-container \">\n <div class=\"flex flex-col h-full max-h-full\">\n\n <div cdkDragHandle class=\"tool-bar grow-0 w-full h-[64px] min-h-[64px]\">\n <rxap-window-tool-bar></rxap-window-tool-bar>\n </div>\n\n <div class=\"content grow overflow-auto w-full\">\n <ng-content></ng-content>\n </div>\n\n <mat-toolbar *ngIf=\"windowRef.footerPortal$ | async as footerPortal\" class=\"footer mat-elevation-z1 grow-0 w-full h-[64px] min-h-[64px]\">\n <ng-template [cdkPortalOutlet]=\"footerPortal\"></ng-template>\n </mat-toolbar>\n\n <mat-progress-bar *ngIf=\"windowInstance.isLoading$ | async\" mode=\"indeterminate\"></mat-progress-bar>\n\n <rxap-window-resizer [containerRef]=\"containerRef\"></rxap-window-resizer>\n </div>\n</div>\n", styles: [".window-container{cursor:move;position:relative;z-index:1;max-height:100vh;max-width:100vw}.window-container:active{box-shadow:0 5px 5px -3px #0003,0 8px 10px 1px #00000024,0 3px 14px 2px #0000001f}\n"] }]
|
|
439
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
440
|
-
type: Inject,
|
|
441
|
-
args: [RXAP_WINDOW_CONTEXT]
|
|
442
|
-
}] }, { type: WindowRef, decorators: [{
|
|
443
|
-
type: Inject,
|
|
444
|
-
args: [RXAP_WINDOW_REF]
|
|
445
|
-
}] }, { type: i1.LoadingIndicatorService, decorators: [{
|
|
446
|
-
type: Inject,
|
|
447
|
-
args: [LoadingIndicatorService]
|
|
448
|
-
}] }]; }, propDecorators: { footerContent: [{
|
|
449
|
-
type: ContentChild,
|
|
450
|
-
args: ['[footer]', { static: true }]
|
|
451
|
-
}], containerRef: [{
|
|
452
|
-
type: ViewChild,
|
|
453
|
-
args: ['container', { static: true }]
|
|
454
|
-
}], windowContainerResizer: [{
|
|
455
|
-
type: ViewChild,
|
|
456
|
-
args: [WindowResizerComponent, { static: true }]
|
|
457
|
-
}], id: [{
|
|
458
|
-
type: HostBinding,
|
|
459
|
-
args: ['attr.data-id']
|
|
460
|
-
}] } });
|
|
461
|
-
|
|
462
|
-
class DefaultWindowComponent {
|
|
463
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultWindowComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
464
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DefaultWindowComponent, isStandalone: true, selector: "rxap-default-window", ngImport: i0, template: "<rxap-window-container>\n <rxap-window-content></rxap-window-content>\n</rxap-window-container>\n", styles: [""], dependencies: [{ kind: "component", type: WindowContainerComponent, selector: "rxap-window-container" }, { kind: "component", type: WindowContentComponent, selector: "rxap-window-content" }], changeDetection: i0.ChangeDetectionStrategy.Default }); }
|
|
465
|
-
}
|
|
466
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DefaultWindowComponent, decorators: [{
|
|
467
|
-
type: Component,
|
|
468
|
-
args: [{ selector: 'rxap-default-window', changeDetection: ChangeDetectionStrategy.Default, standalone: true, imports: [WindowContainerComponent, WindowContentComponent], template: "<rxap-window-container>\n <rxap-window-content></rxap-window-content>\n</rxap-window-container>\n" }]
|
|
469
|
-
}] });
|
|
470
|
-
|
|
471
|
-
const DEFAULT_WINDOW_CONFIG = {
|
|
472
|
-
resizeable: true,
|
|
473
|
-
draggable: true,
|
|
474
|
-
injector: null,
|
|
475
|
-
componentFactoryResolver: null,
|
|
476
|
-
minWidth: '384px',
|
|
477
|
-
minHeight: '192px',
|
|
478
|
-
maxWidth: '100vw',
|
|
479
|
-
maxHeight: '100vh',
|
|
480
|
-
minimizable: false,
|
|
481
|
-
};
|
|
482
|
-
|
|
483
478
|
class WindowService {
|
|
484
479
|
constructor(injector, overlay, componentFactoryResolver, defaultWindowSettings) {
|
|
485
480
|
this.injector = injector;
|
|
@@ -562,7 +557,7 @@ class WindowService {
|
|
|
562
557
|
],
|
|
563
558
|
name: windowConfig?.injectorName ?? 'WindowService',
|
|
564
559
|
});
|
|
565
|
-
const containerPortal = new ComponentPortal(DefaultWindowComponent, injector.get(ViewContainerRef, null, InjectFlags.Optional) ??
|
|
560
|
+
const containerPortal = new ComponentPortal(windowConfig.windowComponent ?? DefaultWindowComponent, injector.get(ViewContainerRef, null, InjectFlags.Optional) ??
|
|
566
561
|
windowConfig.viewContainerRef ??
|
|
567
562
|
null, injector, injector.get(ComponentFactoryResolver, null, InjectFlags.Optional) ??
|
|
568
563
|
windowConfig.componentFactoryResolver ??
|
|
@@ -771,10 +766,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
771
766
|
}] }]; } });
|
|
772
767
|
|
|
773
768
|
class WindowTitleDirective {
|
|
774
|
-
constructor(
|
|
775
|
-
this.windowRef =
|
|
776
|
-
this.template =
|
|
777
|
-
this.viewContainerRef =
|
|
769
|
+
constructor() {
|
|
770
|
+
this.windowRef = inject(RXAP_WINDOW_REF);
|
|
771
|
+
this.template = inject(TemplateRef);
|
|
772
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
778
773
|
}
|
|
779
774
|
/**
|
|
780
775
|
* Asserts the correct type of the context for the template that `NgForOf` will render.
|
|
@@ -790,7 +785,7 @@ class WindowTitleDirective {
|
|
|
790
785
|
$implicit: this.windowRef,
|
|
791
786
|
}));
|
|
792
787
|
}
|
|
793
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowTitleDirective, deps: [
|
|
788
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
794
789
|
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: WindowTitleDirective, isStandalone: true, selector: "[rxapWindowTitle]", ngImport: i0 }); }
|
|
795
790
|
}
|
|
796
791
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: WindowTitleDirective, decorators: [{
|
|
@@ -799,16 +794,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
799
794
|
selector: '[rxapWindowTitle]',
|
|
800
795
|
standalone: true,
|
|
801
796
|
}]
|
|
802
|
-
}]
|
|
803
|
-
type: Inject,
|
|
804
|
-
args: [RXAP_WINDOW_REF]
|
|
805
|
-
}] }, { type: i0.TemplateRef, decorators: [{
|
|
806
|
-
type: Inject,
|
|
807
|
-
args: [TemplateRef]
|
|
808
|
-
}] }, { type: i0.ViewContainerRef, decorators: [{
|
|
809
|
-
type: Inject,
|
|
810
|
-
args: [ViewContainerRef]
|
|
811
|
-
}] }]; } });
|
|
797
|
+
}] });
|
|
812
798
|
|
|
813
799
|
class WindowActionBarComponent {
|
|
814
800
|
constructor(context, injector) {
|
|
@@ -831,6 +817,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
831
817
|
args: [RXAP_WINDOW_CONTEXT]
|
|
832
818
|
}] }, { type: i0.Injector }]; } });
|
|
833
819
|
|
|
820
|
+
// TODO : refactor to be used without a central module
|
|
834
821
|
class RxapWindowSystemModule {
|
|
835
822
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RxapWindowSystemModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
836
823
|
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: RxapWindowSystemModule, imports: [WindowContainerComponent,
|