@ngutil/layout 0.0.3-dev.9 → 0.0.3
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/docking/docking-content.component.d.ts +1 -1
- package/docking/docking-layout.component.d.ts +1 -3
- package/docking/docking-panel.component.d.ts +10 -4
- package/esm2022/docking/docking-content.component.mjs +3 -3
- package/esm2022/docking/docking-layout.component.mjs +16 -60
- package/esm2022/docking/docking-panel.component.mjs +70 -14
- package/esm2022/index.mjs +1 -2
- package/esm2022/l9/state.mjs +1 -9
- package/fesm2022/ngutil-layout.mjs +86 -188
- package/fesm2022/ngutil-layout.mjs.map +1 -1
- package/index.d.ts +0 -1
- package/l9/state.d.ts +1 -3
- package/package.json +4 -2
- package/esm2022/util/dimension-watcher.mjs +0 -84
- package/esm2022/util/dimension.mjs +0 -2
- package/esm2022/util/index.mjs +0 -3
- package/esm2022/util/media-watcher.mjs +0 -29
- package/esm2022/util/rect.mjs +0 -2
- package/util/dimension-watcher.d.ts +0 -4
- package/util/dimension.d.ts +0 -5
- package/util/index.d.ts +0 -4
- package/util/media-watcher.d.ts +0 -5
- package/util/rect.d.ts +0 -5
|
@@ -1,115 +1,8 @@
|
|
|
1
|
+
import { BehaviorSubject, map, shareReplay, ReplaySubject, combineLatest, switchMap, of, Subject, startWith, scan, tap, distinctUntilChanged, finalize } from 'rxjs';
|
|
1
2
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import { Observable, distinctUntilChanged, shareReplay, BehaviorSubject, map, combineLatest, switchMap, of, Subject, startWith, scan, tap, finalize } from 'rxjs';
|
|
3
|
+
import { Component, inject, ElementRef, ViewChild, Input, Output, ChangeDetectionStrategy, ContentChild, ContentChildren, NgModule, Injectable, TemplateRef, Directive, ViewContainerRef, Injector } from '@angular/core';
|
|
4
4
|
import { NumberWithUnit, Destructible, coerceBoolAttr, FastDOM } from '@ngutil/common';
|
|
5
|
-
|
|
6
|
-
const WATCHES = {};
|
|
7
|
-
/**
|
|
8
|
-
* watchMedia("(display-mode: standalone)")
|
|
9
|
-
*/
|
|
10
|
-
function watchMedia(expr) {
|
|
11
|
-
const existing = WATCHES[expr];
|
|
12
|
-
if (existing == null) {
|
|
13
|
-
return (WATCHES[expr] = _createWatcher(expr));
|
|
14
|
-
}
|
|
15
|
-
return existing;
|
|
16
|
-
}
|
|
17
|
-
function _createWatcher(expr) {
|
|
18
|
-
const zone = inject(NgZone);
|
|
19
|
-
return zone.runOutsideAngular(() => new Observable((sub) => {
|
|
20
|
-
const query = window.matchMedia(expr);
|
|
21
|
-
const listener = (event) => {
|
|
22
|
-
sub.next(event.matches);
|
|
23
|
-
};
|
|
24
|
-
query.addEventListener("change", listener);
|
|
25
|
-
sub.next(query.matches);
|
|
26
|
-
return () => {
|
|
27
|
-
query.removeEventListener("change", listener);
|
|
28
|
-
delete WATCHES[expr];
|
|
29
|
-
};
|
|
30
|
-
}).pipe(distinctUntilChanged(), shareReplay(1)));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const RESIZE_WATCHES = new Map();
|
|
34
|
-
const SCROLL_WATCHES = new Map();
|
|
35
|
-
function watchDimension(el, box = "border-box") {
|
|
36
|
-
const zone = inject(NgZone);
|
|
37
|
-
return box === "scroll-box" ? _watchScroll(zone, el) : _watchResize(zone, el, box);
|
|
38
|
-
}
|
|
39
|
-
function _watchResize(zone, el, box) {
|
|
40
|
-
return _watch(zone, el, RESIZE_WATCHES, () => _createResizeWatcher(zone, el, box));
|
|
41
|
-
}
|
|
42
|
-
function _watchScroll(zone, el) {
|
|
43
|
-
return _watch(zone, el, SCROLL_WATCHES, () => _createScollWatcher(zone, el));
|
|
44
|
-
}
|
|
45
|
-
function _watch(zone, el, watches, factory) {
|
|
46
|
-
const existing = watches.get(el);
|
|
47
|
-
if (existing == null) {
|
|
48
|
-
const watcher = factory();
|
|
49
|
-
watches.set(el, watcher);
|
|
50
|
-
return watcher;
|
|
51
|
-
}
|
|
52
|
-
return existing;
|
|
53
|
-
}
|
|
54
|
-
function _createResizeWatcher(zone, el, box) {
|
|
55
|
-
if (box !== "border-box") {
|
|
56
|
-
throw new Error(`Currently not implemented box mode: ${box}`);
|
|
57
|
-
}
|
|
58
|
-
return zone.runOutsideAngular(() => new Observable((sub) => {
|
|
59
|
-
const observer = new ResizeObserver(entries => {
|
|
60
|
-
for (const entry of entries) {
|
|
61
|
-
if (entry.borderBoxSize) {
|
|
62
|
-
sub.next({
|
|
63
|
-
width: _number(entry.borderBoxSize[0].inlineSize),
|
|
64
|
-
height: _number(entry.borderBoxSize[0].blockSize)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
sub.next({
|
|
69
|
-
width: _number(el.offsetWidth),
|
|
70
|
-
height: _number(el.offsetHeight)
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
observer.observe(el, { box: box });
|
|
76
|
-
return () => {
|
|
77
|
-
observer.disconnect();
|
|
78
|
-
RESIZE_WATCHES.delete(el);
|
|
79
|
-
};
|
|
80
|
-
}).pipe(distinctUntilChanged((p, c) => p && c && p.width === c.width && p.height === c.height), shareReplay(1)));
|
|
81
|
-
}
|
|
82
|
-
function _createScollWatcher(zone, el) {
|
|
83
|
-
return zone.runOutsideAngular(() => new Observable((sub) => {
|
|
84
|
-
let lastSw = 0;
|
|
85
|
-
let lastSh = 0;
|
|
86
|
-
const emit = () => {
|
|
87
|
-
const sw = el.scrollWidth;
|
|
88
|
-
const sh = el.scrollHeight;
|
|
89
|
-
if (lastSw !== sw || lastSh !== sh) {
|
|
90
|
-
lastSw = sw;
|
|
91
|
-
lastSh = sh;
|
|
92
|
-
sub.next({ width: _number(lastSw), height: _number(lastSh) });
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const dimSum = _watchResize(zone, el, "border-box").subscribe(emit);
|
|
96
|
-
const mutation = new MutationObserver(emit);
|
|
97
|
-
mutation.observe(el, {
|
|
98
|
-
subtree: true,
|
|
99
|
-
childList: true,
|
|
100
|
-
attributes: true,
|
|
101
|
-
characterData: true
|
|
102
|
-
});
|
|
103
|
-
return () => {
|
|
104
|
-
dimSum.unsubscribe();
|
|
105
|
-
mutation.disconnect();
|
|
106
|
-
SCROLL_WATCHES.delete(el);
|
|
107
|
-
};
|
|
108
|
-
}).pipe(shareReplay(1)));
|
|
109
|
-
}
|
|
110
|
-
function _number(val) {
|
|
111
|
-
return new NumberWithUnit(val, "pk");
|
|
112
|
-
}
|
|
5
|
+
import { DimensionWatcher } from '@ngutil/style';
|
|
113
6
|
|
|
114
7
|
/**
|
|
115
8
|
* -----------------------------------------------
|
|
@@ -238,26 +131,22 @@ class L9State {
|
|
|
238
131
|
return res;
|
|
239
132
|
}), shareReplay(1));
|
|
240
133
|
}
|
|
241
|
-
update(range, dim) {
|
|
242
|
-
range = L9Range.coerce(range);
|
|
243
|
-
const dims = { ...this.#dims.value };
|
|
244
|
-
// for (const cell of range.horizontals) {
|
|
245
|
-
// dims[cell] = dim.width
|
|
246
|
-
// }
|
|
247
|
-
}
|
|
248
134
|
}
|
|
249
135
|
|
|
250
136
|
class DockingContentComponent {
|
|
251
137
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DockingContentComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
252
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: DockingContentComponent, isStandalone: true, selector: "nu-docking-content", ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":host{display:flex;flex-flow:column nowrap;align-items:stretch;box-sizing:border-box;flex:1
|
|
138
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: DockingContentComponent, isStandalone: true, selector: "nu-docking-content", exportAs: ["nuDockingContent"], ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":host{display:flex;flex-flow:column nowrap;align-items:stretch;box-sizing:border-box;flex:1}\n"] }); }
|
|
253
139
|
}
|
|
254
140
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DockingContentComponent, decorators: [{
|
|
255
141
|
type: Component,
|
|
256
|
-
args: [{ standalone: true, selector: "nu-docking-content", template: `<ng-content></ng-content>`, styles: [":host{display:flex;flex-flow:column nowrap;align-items:stretch;box-sizing:border-box;flex:1
|
|
142
|
+
args: [{ standalone: true, selector: "nu-docking-content", exportAs: "nuDockingContent", template: `<ng-content></ng-content>`, styles: [":host{display:flex;flex-flow:column nowrap;align-items:stretch;box-sizing:border-box;flex:1}\n"] }]
|
|
257
143
|
}] });
|
|
258
144
|
|
|
259
145
|
const DEFAULT_POSITION = L9Range.coerce("left");
|
|
146
|
+
const HIDDEN_SIZE = new NumberWithUnit(0, "px");
|
|
147
|
+
const AUTO_SIZE = NumberWithUnit.coerce("auto");
|
|
260
148
|
class DockingPanelComponent extends Destructible {
|
|
149
|
+
#dimWatcher;
|
|
261
150
|
set positionInput(val) {
|
|
262
151
|
const coerced = L9Range.coerce(val);
|
|
263
152
|
if (coerced.orient === "rect") {
|
|
@@ -300,19 +189,22 @@ class DockingPanelComponent extends Destructible {
|
|
|
300
189
|
}
|
|
301
190
|
#minimizable;
|
|
302
191
|
#minimizableAuto;
|
|
192
|
+
#contentSize;
|
|
303
193
|
#autoSize;
|
|
304
194
|
constructor() {
|
|
305
195
|
super();
|
|
306
196
|
this.el = inject((ElementRef));
|
|
197
|
+
this.#dimWatcher = inject(DimensionWatcher);
|
|
307
198
|
this.position = new BehaviorSubject(DEFAULT_POSITION);
|
|
308
|
-
this.state = new BehaviorSubject("
|
|
309
|
-
this.mode = new BehaviorSubject("
|
|
310
|
-
this.#fullSize = new BehaviorSubject(
|
|
311
|
-
this.#miniSize = new BehaviorSubject(
|
|
199
|
+
this.state = new BehaviorSubject("full");
|
|
200
|
+
this.mode = new BehaviorSubject("rigid");
|
|
201
|
+
this.#fullSize = new BehaviorSubject(AUTO_SIZE);
|
|
202
|
+
this.#miniSize = new BehaviorSubject(HIDDEN_SIZE);
|
|
312
203
|
this.#minimizable = false;
|
|
313
204
|
this.#minimizableAuto = true;
|
|
205
|
+
this.#contentSize = new ReplaySubject(1);
|
|
314
206
|
this.#autoSize = combineLatest({
|
|
315
|
-
dim:
|
|
207
|
+
dim: this.#contentSize,
|
|
316
208
|
pos: this.position
|
|
317
209
|
}).pipe(map(({ dim, pos }) => {
|
|
318
210
|
if (pos.orient === "horizontal") {
|
|
@@ -343,7 +235,8 @@ class DockingPanelComponent extends Destructible {
|
|
|
343
235
|
state: this.state,
|
|
344
236
|
mode: this.mode,
|
|
345
237
|
fullSize: this.fullSize,
|
|
346
|
-
miniSize: this.miniSize
|
|
238
|
+
miniSize: this.miniSize,
|
|
239
|
+
contentSize: this.#contentSize
|
|
347
240
|
});
|
|
348
241
|
this.d.sub(this.changes).subscribe(changes => {
|
|
349
242
|
if (this.#minimizableAuto) {
|
|
@@ -355,13 +248,51 @@ class DockingPanelComponent extends Destructible {
|
|
|
355
248
|
mode: changes.mode,
|
|
356
249
|
side: changes.position.orient === "horizontal" ? changes.position.cells[0].v : changes.position.cells[0].h
|
|
357
250
|
});
|
|
251
|
+
const isHorizontal = changes.position.orient === "horizontal";
|
|
252
|
+
let w = null;
|
|
253
|
+
let h = null;
|
|
254
|
+
// TODO: when change state from mini -> hidden, currently wrong behavior
|
|
255
|
+
// the good behavior is to not gain fullSize ang go to hidden
|
|
256
|
+
if (changes.state === "mini") {
|
|
257
|
+
if (isHorizontal) {
|
|
258
|
+
h = changes.miniSize.unit === "auto" ? changes.contentSize.height : changes.miniSize;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
w = changes.miniSize.unit === "auto" ? changes.contentSize.width : changes.miniSize;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
if (isHorizontal) {
|
|
266
|
+
h = changes.fullSize.unit === "auto" ? changes.contentSize.height : changes.fullSize;
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
w = changes.fullSize.unit === "auto" ? changes.contentSize.width : changes.fullSize;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
FastDOM.setStyle(this.el.nativeElement, {
|
|
273
|
+
"--docking-panel-w": w != null ? `${w}` : null,
|
|
274
|
+
"--docking-panel-h": h != null ? `${h}` : null,
|
|
275
|
+
"--docking-panel-content-w": changes.contentSize.width,
|
|
276
|
+
"--docking-panel-content-h": changes.contentSize.height
|
|
277
|
+
}, () => FastDOM.setAttributes(this.el.nativeElement, { animate: "" }));
|
|
358
278
|
});
|
|
359
279
|
}
|
|
280
|
+
ngAfterViewInit() {
|
|
281
|
+
this.d
|
|
282
|
+
.sub(this.#dimWatcher.watch(this.content, "scroll-box"))
|
|
283
|
+
.pipe(map(dim => {
|
|
284
|
+
return {
|
|
285
|
+
width: new NumberWithUnit(dim.width, "px"),
|
|
286
|
+
height: new NumberWithUnit(dim.height, "px")
|
|
287
|
+
};
|
|
288
|
+
}))
|
|
289
|
+
.subscribe(this.#contentSize);
|
|
290
|
+
}
|
|
360
291
|
open() {
|
|
361
292
|
this.state.next("full");
|
|
362
293
|
}
|
|
363
294
|
close() {
|
|
364
|
-
this.state.next("
|
|
295
|
+
this.state.next("hidden");
|
|
365
296
|
}
|
|
366
297
|
minimize() {
|
|
367
298
|
if (this.minimizable) {
|
|
@@ -369,12 +300,23 @@ class DockingPanelComponent extends Destructible {
|
|
|
369
300
|
}
|
|
370
301
|
}
|
|
371
302
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DockingPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
372
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: DockingPanelComponent, isStandalone: true, selector: "nu-docking-panel", inputs: { positionInput: ["position", "positionInput"], stateInput: ["state", "stateInput"], modeInput: ["mode", "modeInput"], fullSizeInput: ["fullSize", "fullSizeInput"], miniSizeInput: ["miniSize", "miniSizeInput"], minimizable: "minimizable" }, outputs: { state: "stateChanges" },
|
|
303
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.3", type: DockingPanelComponent, isStandalone: true, selector: "nu-docking-panel", inputs: { positionInput: ["position", "positionInput"], stateInput: ["state", "stateInput"], modeInput: ["mode", "modeInput"], fullSizeInput: ["fullSize", "fullSizeInput"], miniSizeInput: ["miniSize", "miniSizeInput"], minimizable: "minimizable" }, outputs: { state: "stateChanges" }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, read: ElementRef, static: true }], exportAs: ["nuDockingPanel"], usesInheritance: true, ngImport: i0, template: `
|
|
304
|
+
<div class="content" #content>
|
|
305
|
+
<ng-content></ng-content>
|
|
306
|
+
</div>
|
|
307
|
+
`, isInline: true, styles: [":host{---docking-panel-t: var(--docking-panel-t, auto);---docking-panel-r: var(--docking-panel-r, auto);---docking-panel-b: var(--docking-panel-b, auto);---docking-panel-l: var(--docking-panel-l, auto);---docking-panel-w: var(--docking-panel-w, auto);---docking-panel-h: var(--docking-panel-h, auto);---docking-panel-content-w: var(--docking-panel-content-w, var(---docking-panel-w));---docking-panel-content-g: var(--docking-panel-content-g, var(---docking-panel-h));display:flex;flex-flow:column nowrap;align-items:stretch;position:absolute;box-sizing:border-box;overflow:hidden;top:var(---docking-panel-t);right:var(---docking-panel-r);bottom:var(---docking-panel-b);left:var(---docking-panel-l);width:var(---docking-panel-w);height:var(---docking-panel-h)}:host[animate]{transition:transform var(---docking-layout-anim-duration) var(---docking-layout-anim-ease),width var(---docking-layout-anim-duration) var(---docking-layout-anim-ease),height var(---docking-layout-anim-duration) var(---docking-layout-anim-ease)}:host[side=top],:host[side=left]{---docking-panel-t-hide: -100%;---docking-panel-t-visible: 0%}:host[side=bottom],:host[side=right]{---docking-panel-t-hide: 100%;---docking-panel-t-visible: 0%}:host[state=hidden][orient=horizontal]{transform:translateY(var(---docking-panel-t-hide))}:host[state=hidden][orient=vertical]{transform:translate(var(---docking-panel-t-hide))}:host:not([state=hidden])[orient=horizontal]{transform:translateY(var(---docking-panel-t-visible))}:host:not([state=hidden])[orient=vertical]{transform:translate(var(---docking-panel-t-visible))}\n"] }); }
|
|
373
308
|
}
|
|
374
309
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DockingPanelComponent, decorators: [{
|
|
375
310
|
type: Component,
|
|
376
|
-
args: [{ standalone: true, selector: "nu-docking-panel", exportAs: "nuDockingPanel", template:
|
|
377
|
-
|
|
311
|
+
args: [{ standalone: true, selector: "nu-docking-panel", exportAs: "nuDockingPanel", template: `
|
|
312
|
+
<div class="content" #content>
|
|
313
|
+
<ng-content></ng-content>
|
|
314
|
+
</div>
|
|
315
|
+
`, styles: [":host{---docking-panel-t: var(--docking-panel-t, auto);---docking-panel-r: var(--docking-panel-r, auto);---docking-panel-b: var(--docking-panel-b, auto);---docking-panel-l: var(--docking-panel-l, auto);---docking-panel-w: var(--docking-panel-w, auto);---docking-panel-h: var(--docking-panel-h, auto);---docking-panel-content-w: var(--docking-panel-content-w, var(---docking-panel-w));---docking-panel-content-g: var(--docking-panel-content-g, var(---docking-panel-h));display:flex;flex-flow:column nowrap;align-items:stretch;position:absolute;box-sizing:border-box;overflow:hidden;top:var(---docking-panel-t);right:var(---docking-panel-r);bottom:var(---docking-panel-b);left:var(---docking-panel-l);width:var(---docking-panel-w);height:var(---docking-panel-h)}:host[animate]{transition:transform var(---docking-layout-anim-duration) var(---docking-layout-anim-ease),width var(---docking-layout-anim-duration) var(---docking-layout-anim-ease),height var(---docking-layout-anim-duration) var(---docking-layout-anim-ease)}:host[side=top],:host[side=left]{---docking-panel-t-hide: -100%;---docking-panel-t-visible: 0%}:host[side=bottom],:host[side=right]{---docking-panel-t-hide: 100%;---docking-panel-t-visible: 0%}:host[state=hidden][orient=horizontal]{transform:translateY(var(---docking-panel-t-hide))}:host[state=hidden][orient=vertical]{transform:translate(var(---docking-panel-t-hide))}:host:not([state=hidden])[orient=horizontal]{transform:translateY(var(---docking-panel-t-visible))}:host:not([state=hidden])[orient=vertical]{transform:translate(var(---docking-panel-t-visible))}\n"] }]
|
|
316
|
+
}], ctorParameters: () => [], propDecorators: { content: [{
|
|
317
|
+
type: ViewChild,
|
|
318
|
+
args: ["content", { read: ElementRef, static: true }]
|
|
319
|
+
}], positionInput: [{
|
|
378
320
|
type: Input,
|
|
379
321
|
args: ["position"]
|
|
380
322
|
}], stateInput: [{
|
|
@@ -397,29 +339,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
|
|
|
397
339
|
args: ["minimizable"]
|
|
398
340
|
}] } });
|
|
399
341
|
|
|
400
|
-
const
|
|
401
|
-
const
|
|
402
|
-
// interface PanelRefChanges {
|
|
403
|
-
// ref: PanelRef
|
|
404
|
-
// changes: DockingPanelChanges
|
|
405
|
-
// }
|
|
406
|
-
// class PanelRef {
|
|
407
|
-
// style: Partial<CSSStyleDeclaration> = {}
|
|
408
|
-
// readonly changes: Observable<PanelRefChanges>
|
|
409
|
-
// constructor(public readonly panel: DockingPanelDirective) {
|
|
410
|
-
// this.changes = panel.changes.pipe(
|
|
411
|
-
// map(changes => {
|
|
412
|
-
// return { ref: this, changes }
|
|
413
|
-
// })
|
|
414
|
-
// )
|
|
415
|
-
// }
|
|
416
|
-
// }
|
|
342
|
+
const RIGID_ZINDEX = 20;
|
|
343
|
+
const OVER_ZINDEX = RIGID_ZINDEX * 2;
|
|
417
344
|
class DockingLayoutComponent extends Destructible {
|
|
418
345
|
constructor() {
|
|
419
346
|
super(...arguments);
|
|
420
347
|
this.#el = inject((ElementRef));
|
|
421
348
|
this.contentOnly = false;
|
|
422
|
-
this.positionMode = "absolute";
|
|
423
349
|
this.#reflow = new Subject();
|
|
424
350
|
}
|
|
425
351
|
#el;
|
|
@@ -427,25 +353,12 @@ class DockingLayoutComponent extends Destructible {
|
|
|
427
353
|
ngAfterViewInit() {
|
|
428
354
|
// eslint-disable-next-line prettier/prettier
|
|
429
355
|
this.panels = this.dockingPanels.changes.pipe(startWith(null), map(() => this.dockingPanels.toArray()), shareReplay(1));
|
|
430
|
-
// this.panels.subscribe(panels => console.log({ panels }))
|
|
431
356
|
this.d
|
|
432
357
|
.sub(combineLatest({ panels: this.panels, reflow: this.#reflow.pipe(startWith(null)) }))
|
|
433
358
|
.pipe(switchMap(({ panels }) => combineLatest(panels.map(panel => panel.changes.pipe(map(changes => {
|
|
434
359
|
return { panel, changes };
|
|
435
360
|
}))))))
|
|
436
361
|
.subscribe(this.#layout.bind(this));
|
|
437
|
-
// this.d
|
|
438
|
-
// .sub(merge(this.dockingPanels.changes, this.#reflow))
|
|
439
|
-
// .pipe(
|
|
440
|
-
// startWith(null),
|
|
441
|
-
// map(() => this.dockingPanels.map(panel => new PanelRef(panel))),
|
|
442
|
-
// switchMap(refs => combineLatest(refs.map(ref => ref.changes))),
|
|
443
|
-
// map(changes => {
|
|
444
|
-
// this.#layout(changes)
|
|
445
|
-
// return changes.map(c => c.ref)
|
|
446
|
-
// })
|
|
447
|
-
// )
|
|
448
|
-
// .subscribe(this.panels)
|
|
449
362
|
}
|
|
450
363
|
ngOnChanges(changes) {
|
|
451
364
|
if ("contentOnly" in changes || "positionMode" in changes) {
|
|
@@ -457,8 +370,8 @@ class DockingLayoutComponent extends Destructible {
|
|
|
457
370
|
let paddingRight = 0;
|
|
458
371
|
let paddingBottom = 0;
|
|
459
372
|
let paddingLeft = 0;
|
|
460
|
-
let
|
|
461
|
-
let
|
|
373
|
+
let rigidZIndex = RIGID_ZINDEX;
|
|
374
|
+
let overZIndex = OVER_ZINDEX;
|
|
462
375
|
if (this.contentOnly) {
|
|
463
376
|
// TODO:...
|
|
464
377
|
}
|
|
@@ -471,7 +384,7 @@ class DockingLayoutComponent extends Destructible {
|
|
|
471
384
|
? panelState.miniSize.value
|
|
472
385
|
: 0;
|
|
473
386
|
const isHorizontal = panelState.position.orient === "horizontal";
|
|
474
|
-
const
|
|
387
|
+
const isRigid = panelState.mode === "rigid";
|
|
475
388
|
let panelTop = null;
|
|
476
389
|
let panelRight = null;
|
|
477
390
|
let panelBottom = null;
|
|
@@ -480,13 +393,13 @@ class DockingLayoutComponent extends Destructible {
|
|
|
480
393
|
panelLeft = 0;
|
|
481
394
|
panelRight = 0;
|
|
482
395
|
if (panelState.position.cells[0].v === "top") {
|
|
483
|
-
if (
|
|
396
|
+
if (isRigid) {
|
|
484
397
|
paddingTop = Math.max(paddingTop, panelSize);
|
|
485
398
|
}
|
|
486
399
|
panelTop = 0;
|
|
487
400
|
}
|
|
488
401
|
else if (panelState.position.cells[0].v === "bottom") {
|
|
489
|
-
if (
|
|
402
|
+
if (isRigid) {
|
|
490
403
|
paddingBottom = Math.max(paddingBottom, panelSize);
|
|
491
404
|
}
|
|
492
405
|
panelBottom = 0;
|
|
@@ -496,37 +409,24 @@ class DockingLayoutComponent extends Destructible {
|
|
|
496
409
|
panelTop = 0;
|
|
497
410
|
panelBottom = 0;
|
|
498
411
|
if (panelState.position.cells[0].h === "left") {
|
|
499
|
-
if (
|
|
412
|
+
if (isRigid) {
|
|
500
413
|
paddingLeft = Math.max(paddingLeft, panelSize);
|
|
501
414
|
}
|
|
502
415
|
panelLeft = 0;
|
|
503
416
|
}
|
|
504
417
|
else if (panelState.position.cells[0].h === "right") {
|
|
505
|
-
if (
|
|
418
|
+
if (isRigid) {
|
|
506
419
|
paddingRight = Math.max(paddingRight, panelSize);
|
|
507
420
|
}
|
|
508
421
|
panelRight = 0;
|
|
509
422
|
}
|
|
510
423
|
}
|
|
511
|
-
const panelGivenSize = panelState.state === "full"
|
|
512
|
-
? panelState.fullSize
|
|
513
|
-
: panelState.state === "mini"
|
|
514
|
-
? panelState.miniSize
|
|
515
|
-
: new NumberWithUnit(0, "px");
|
|
516
424
|
FastDOM.setStyle(entry.panel.el.nativeElement, {
|
|
517
|
-
"z-index": `${
|
|
425
|
+
"z-index": `${isRigid ? rigidZIndex++ : overZIndex++}`,
|
|
518
426
|
"--docking-panel-t": panelTop != null ? `${panelTop}px` : null,
|
|
519
427
|
"--docking-panel-r": panelRight != null ? `${panelRight}px` : null,
|
|
520
428
|
"--docking-panel-b": panelBottom != null ? `${panelBottom}px` : null,
|
|
521
|
-
"--docking-panel-l": panelLeft != null ? `${panelLeft}px` : null
|
|
522
|
-
"--docking-panel-w": !isHorizontal
|
|
523
|
-
? `${panelGivenSize.unit === "auto" ? "auto" : panelGivenSize}`
|
|
524
|
-
: null,
|
|
525
|
-
"--docking-panel-h": isHorizontal
|
|
526
|
-
? `${panelGivenSize.unit === "auto" ? "auto" : panelGivenSize}`
|
|
527
|
-
: null,
|
|
528
|
-
"--docking-panel-real-w": !isHorizontal ? `${panelSize}px` : null,
|
|
529
|
-
"--docking-panel-real-h": isHorizontal ? `${panelSize}px` : null
|
|
429
|
+
"--docking-panel-l": panelLeft != null ? `${panelLeft}px` : null
|
|
530
430
|
});
|
|
531
431
|
}
|
|
532
432
|
FastDOM.setStyle(this.#el.nativeElement, {
|
|
@@ -538,7 +438,7 @@ class DockingLayoutComponent extends Destructible {
|
|
|
538
438
|
}
|
|
539
439
|
}
|
|
540
440
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DockingLayoutComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
541
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: DockingLayoutComponent, isStandalone: true, selector: "nu-docking", inputs: { contentOnly: "contentOnly"
|
|
441
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.1.3", type: DockingLayoutComponent, isStandalone: true, selector: "nu-docking", inputs: { contentOnly: "contentOnly" }, queries: [{ propertyName: "contentComponent", first: true, predicate: DockingContentComponent, descendants: true }, { propertyName: "dockingPanels", predicate: DockingPanelComponent }], usesInheritance: true, usesOnChanges: true, ngImport: i0, template: `
|
|
542
442
|
<ng-content select="nu-docking-panel"></ng-content>
|
|
543
443
|
|
|
544
444
|
@if (!contentComponent) {
|
|
@@ -548,7 +448,7 @@ class DockingLayoutComponent extends Destructible {
|
|
|
548
448
|
} @else {
|
|
549
449
|
<ng-content select="nu-docking-content"></ng-content>
|
|
550
450
|
}
|
|
551
|
-
`, isInline: true, styles: [":host{---docking-layout-top: var(--docking-layout-top, 0px);---docking-layout-right: var(--docking-layout-right, 0px);---docking-layout-bottom: var(--docking-layout-bottom, 0px);---docking-layout-left: var(--docking-layout-left, 0px);---docking-layout-anim-duration: var(--docking-layout-anim-duration, .
|
|
451
|
+
`, isInline: true, styles: [":host{---docking-layout-top: var(--docking-layout-top, 0px);---docking-layout-right: var(--docking-layout-right, 0px);---docking-layout-bottom: var(--docking-layout-bottom, 0px);---docking-layout-left: var(--docking-layout-left, 0px);---docking-layout-anim-duration: var(--docking-layout-anim-duration, .3s);---docking-layout-anim-ease: var(--docking-layout-anim-ease, cubic-bezier(.4, 0, .2, 1));display:flex;flex-flow:column nowrap;align-items:stretch;position:relative;overflow:hidden;box-sizing:border-box;z-index:0;padding:var(---docking-layout-top) var(---docking-layout-right) var(---docking-layout-bottom) var(---docking-layout-left);transition:padding var(---docking-layout-anim-duration) var(---docking-layout-anim-ease)}\n"], dependencies: [{ kind: "component", type: DockingContentComponent, selector: "nu-docking-content", exportAs: ["nuDockingContent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
552
452
|
}
|
|
553
453
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: DockingLayoutComponent, decorators: [{
|
|
554
454
|
type: Component,
|
|
@@ -562,11 +462,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
|
|
|
562
462
|
} @else {
|
|
563
463
|
<ng-content select="nu-docking-content"></ng-content>
|
|
564
464
|
}
|
|
565
|
-
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{---docking-layout-top: var(--docking-layout-top, 0px);---docking-layout-right: var(--docking-layout-right, 0px);---docking-layout-bottom: var(--docking-layout-bottom, 0px);---docking-layout-left: var(--docking-layout-left, 0px);---docking-layout-anim-duration: var(--docking-layout-anim-duration, .
|
|
465
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{---docking-layout-top: var(--docking-layout-top, 0px);---docking-layout-right: var(--docking-layout-right, 0px);---docking-layout-bottom: var(--docking-layout-bottom, 0px);---docking-layout-left: var(--docking-layout-left, 0px);---docking-layout-anim-duration: var(--docking-layout-anim-duration, .3s);---docking-layout-anim-ease: var(--docking-layout-anim-ease, cubic-bezier(.4, 0, .2, 1));display:flex;flex-flow:column nowrap;align-items:stretch;position:relative;overflow:hidden;box-sizing:border-box;z-index:0;padding:var(---docking-layout-top) var(---docking-layout-right) var(---docking-layout-bottom) var(---docking-layout-left);transition:padding var(---docking-layout-anim-duration) var(---docking-layout-anim-ease)}\n"] }]
|
|
566
466
|
}], propDecorators: { contentOnly: [{
|
|
567
467
|
type: Input
|
|
568
|
-
}], positionMode: [{
|
|
569
|
-
type: Input
|
|
570
468
|
}], contentComponent: [{
|
|
571
469
|
type: ContentChild,
|
|
572
470
|
args: [DockingContentComponent]
|
|
@@ -829,5 +727,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
|
|
|
829
727
|
* Generated bundle index. Do not edit.
|
|
830
728
|
*/
|
|
831
729
|
|
|
832
|
-
export { DockingContentComponent, DockingLayoutComponent, DockingPanelComponent, L9Cell, L9Range, L9State, NuDockingLayout, SlotDef, SlotDirective, SlotOutletDirective, SlotsService
|
|
730
|
+
export { DockingContentComponent, DockingLayoutComponent, DockingPanelComponent, L9Cell, L9Range, L9State, NuDockingLayout, SlotDef, SlotDirective, SlotOutletDirective, SlotsService };
|
|
833
731
|
//# sourceMappingURL=ngutil-layout.mjs.map
|