@memberjunction/ng-base-application 5.51.0 → 6.1.0-edge.0
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/LICENSE +7 -0
- package/dist/lib/__tests__/base-application.test.js +163 -0
- package/dist/lib/__tests__/base-application.test.js.map +1 -1
- package/dist/lib/__tests__/layout-transforms.test.d.ts +2 -0
- package/dist/lib/__tests__/layout-transforms.test.d.ts.map +1 -0
- package/dist/lib/__tests__/layout-transforms.test.js +188 -0
- package/dist/lib/__tests__/layout-transforms.test.js.map +1 -0
- package/dist/lib/application-manager.d.ts +13 -0
- package/dist/lib/application-manager.d.ts.map +1 -1
- package/dist/lib/application-manager.js +23 -0
- package/dist/lib/application-manager.js.map +1 -1
- package/dist/lib/base-application.d.ts +3 -1
- package/dist/lib/base-application.d.ts.map +1 -1
- package/dist/lib/base-application.js +4 -2
- package/dist/lib/base-application.js.map +1 -1
- package/dist/lib/golden-layout-manager.d.ts +65 -3
- package/dist/lib/golden-layout-manager.d.ts.map +1 -1
- package/dist/lib/golden-layout-manager.js +276 -65
- package/dist/lib/golden-layout-manager.js.map +1 -1
- package/dist/lib/interfaces/tab-request.interface.d.ts +9 -0
- package/dist/lib/interfaces/tab-request.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/tab-request.interface.js.map +1 -1
- package/dist/lib/interfaces/workspace-configuration.interface.d.ts +7 -0
- package/dist/lib/interfaces/workspace-configuration.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/workspace-configuration.interface.js.map +1 -1
- package/dist/lib/layout-transforms.d.ts +40 -0
- package/dist/lib/layout-transforms.d.ts.map +1 -0
- package/dist/lib/layout-transforms.js +91 -0
- package/dist/lib/layout-transforms.js.map +1 -0
- package/dist/lib/workspace-state-manager.d.ts +33 -0
- package/dist/lib/workspace-state-manager.d.ts.map +1 -1
- package/dist/lib/workspace-state-manager.js +71 -7
- package/dist/lib/workspace-state-manager.js.map +1 -1
- package/dist/public-api.d.ts +1 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +1 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +11 -10
|
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
|
|
|
2
2
|
import { BehaviorSubject, Subject } from 'rxjs';
|
|
3
3
|
import { LogError } from '@memberjunction/core';
|
|
4
4
|
import { VirtualLayout } from 'golden-layout';
|
|
5
|
+
import { SanitizeLayoutNodeForLoad } from './layout-transforms';
|
|
5
6
|
import * as i0 from "@angular/core";
|
|
6
7
|
/**
|
|
7
8
|
* Manages Golden Layout instance and provides Angular integration.
|
|
@@ -16,6 +17,88 @@ import * as i0 from "@angular/core";
|
|
|
16
17
|
export class GoldenLayoutManager {
|
|
17
18
|
layout = null;
|
|
18
19
|
containerElement = null;
|
|
20
|
+
/** Render all layouts headerless (see GoldenLayoutInitOptions.HideHeaders) */
|
|
21
|
+
hideHeaders = false;
|
|
22
|
+
/**
|
|
23
|
+
* Vertical wheel over a tab strip scrolls it horizontally. Delegated from
|
|
24
|
+
* the container (strips are created/destroyed by GL as stacks come and
|
|
25
|
+
* go); bound field so Destroy can remove it from the persistent container.
|
|
26
|
+
*/
|
|
27
|
+
onStripWheel = (e) => {
|
|
28
|
+
const strip = e.target?.closest?.('.lm_tabs');
|
|
29
|
+
if (!strip || strip.scrollWidth <= strip.clientWidth) {
|
|
30
|
+
return; // not over a strip, or nothing to scroll
|
|
31
|
+
}
|
|
32
|
+
const delta = Math.abs(e.deltaY) > Math.abs(e.deltaX) ? e.deltaY : e.deltaX;
|
|
33
|
+
if (delta !== 0) {
|
|
34
|
+
strip.scrollLeft += delta;
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Strip scroll events (capture phase — scroll doesn't bubble) keep the
|
|
40
|
+
* nudge arrows' visibility in sync while the user scrolls.
|
|
41
|
+
*/
|
|
42
|
+
onStripScroll = (e) => {
|
|
43
|
+
const target = e.target;
|
|
44
|
+
if (target?.classList?.contains('lm_tabs')) {
|
|
45
|
+
this.updateStripNudges();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* VISIBLE overflow affordance for the scrolling tab strip (Matt's call —
|
|
50
|
+
* hidden-scrollbar-plus-wheel alone is power-user-only): ‹ › nudge buttons
|
|
51
|
+
* at the strip's edges, shown only in the direction(s) with more tabs.
|
|
52
|
+
* One pair per header (splits have a strip per stack), created lazily and
|
|
53
|
+
* kept in sync by the same coalesced pass that styles tabs.
|
|
54
|
+
*/
|
|
55
|
+
updateStripNudges() {
|
|
56
|
+
if (!this.containerElement) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const headers = this.containerElement.querySelectorAll('.lm_header');
|
|
60
|
+
headers.forEach(header => {
|
|
61
|
+
const strip = header.querySelector('.lm_tabs');
|
|
62
|
+
if (!strip) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
let left = header.querySelector('.mj-strip-nudge--left');
|
|
66
|
+
let right = header.querySelector('.mj-strip-nudge--right');
|
|
67
|
+
if (!left || !right) {
|
|
68
|
+
left = this.createStripNudge(header, strip, 'left');
|
|
69
|
+
right = this.createStripNudge(header, strip, 'right');
|
|
70
|
+
}
|
|
71
|
+
const overflowing = strip.scrollWidth > strip.clientWidth + 1;
|
|
72
|
+
const canLeft = overflowing && strip.scrollLeft > 1;
|
|
73
|
+
const canRight = overflowing && strip.scrollLeft + strip.clientWidth < strip.scrollWidth - 1;
|
|
74
|
+
left.hidden = !canLeft;
|
|
75
|
+
right.hidden = !canRight;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
createStripNudge(header, strip, direction) {
|
|
79
|
+
const button = document.createElement('button');
|
|
80
|
+
button.type = 'button';
|
|
81
|
+
button.className = `mj-strip-nudge mj-strip-nudge--${direction}`;
|
|
82
|
+
button.setAttribute('aria-label', direction === 'left' ? 'Scroll tabs left' : 'Scroll tabs right');
|
|
83
|
+
button.hidden = true;
|
|
84
|
+
const icon = document.createElement('i');
|
|
85
|
+
icon.className = `fa-solid fa-chevron-${direction}`;
|
|
86
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
87
|
+
button.appendChild(icon);
|
|
88
|
+
button.addEventListener('click', (e) => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
e.stopPropagation();
|
|
91
|
+
const step = Math.max(120, Math.floor(strip.clientWidth * 0.6));
|
|
92
|
+
const reduceMotion = typeof window !== 'undefined'
|
|
93
|
+
&& typeof window.matchMedia === 'function'
|
|
94
|
+
&& window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
95
|
+
strip.scrollBy({ left: direction === 'left' ? -step : step, behavior: reduceMotion ? 'auto' : 'smooth' });
|
|
96
|
+
});
|
|
97
|
+
// Keep GL's header mousedown handlers (drag/select) away from the button
|
|
98
|
+
button.addEventListener('mousedown', (e) => e.stopPropagation());
|
|
99
|
+
header.appendChild(button);
|
|
100
|
+
return button;
|
|
101
|
+
}
|
|
19
102
|
/**
|
|
20
103
|
* True when Golden Layout has been initialized and not yet destroyed.
|
|
21
104
|
* Use this from external callers (e.g. tab-container) to avoid issuing
|
|
@@ -74,20 +157,17 @@ export class GoldenLayoutManager {
|
|
|
74
157
|
/**
|
|
75
158
|
* Initialize Golden Layout in the specified container element
|
|
76
159
|
*/
|
|
77
|
-
Initialize(element) {
|
|
160
|
+
Initialize(element, options) {
|
|
78
161
|
this.containerElement = element;
|
|
162
|
+
this.hideHeaders = options?.HideHeaders === true;
|
|
79
163
|
// Create layout with empty config
|
|
80
164
|
const config = {
|
|
81
165
|
root: {
|
|
82
166
|
type: 'row',
|
|
83
167
|
content: []
|
|
84
168
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
popout: false,
|
|
88
|
-
maximise: false,
|
|
89
|
-
close: 'tab'
|
|
90
|
-
}
|
|
169
|
+
settings: this.settingsConfig(),
|
|
170
|
+
header: this.headerConfig()
|
|
91
171
|
};
|
|
92
172
|
this.layout = new VirtualLayout(this.containerElement, this.bindComponentEventListener.bind(this), this.unbindComponentEventListener.bind(this));
|
|
93
173
|
// Enable automatic resize when container size changes
|
|
@@ -108,7 +188,20 @@ export class GoldenLayoutManager {
|
|
|
108
188
|
if (state?.tabId) {
|
|
109
189
|
this.activeTab$.next(state.tabId);
|
|
110
190
|
}
|
|
191
|
+
// Scrolling strip: keep the newly-active tab in view (no-op when the
|
|
192
|
+
// strip isn't overflowing; guarded for test DOMs without the API)
|
|
193
|
+
const tabElement = typedItem?.container?.tab?.element;
|
|
194
|
+
if (tabElement && typeof tabElement.scrollIntoView === 'function') {
|
|
195
|
+
tabElement.scrollIntoView({ inline: 'nearest', block: 'nearest' });
|
|
196
|
+
}
|
|
111
197
|
});
|
|
198
|
+
// Scrolling strip: translate vertical wheel/trackpad input over the tab
|
|
199
|
+
// strip into horizontal scroll (browser-tab convention — the strip hides
|
|
200
|
+
// its scrollbar, so the wheel is the mouse user's only scroll input).
|
|
201
|
+
this.containerElement.addEventListener('wheel', this.onStripWheel, { passive: false });
|
|
202
|
+
// Capture phase: scroll doesn't bubble — this keeps the nudge arrows'
|
|
203
|
+
// visibility in sync with user scrolling on any strip in the container.
|
|
204
|
+
this.containerElement.addEventListener('scroll', this.onStripScroll, true);
|
|
112
205
|
// Load the empty config to establish root structure
|
|
113
206
|
// This MUST be done before adding any components
|
|
114
207
|
this.layout.loadLayout(config);
|
|
@@ -140,12 +233,18 @@ export class GoldenLayoutManager {
|
|
|
140
233
|
if (rect.width > 0 && rect.height > 0) {
|
|
141
234
|
this.layout.setSize(rect.width, rect.height);
|
|
142
235
|
}
|
|
236
|
+
this.updateStripNudges();
|
|
143
237
|
}
|
|
144
238
|
}
|
|
145
239
|
/**
|
|
146
240
|
* Destroy the Golden Layout instance
|
|
147
241
|
*/
|
|
148
242
|
Destroy() {
|
|
243
|
+
// The container element PERSISTS across Destroy/Initialize cycles
|
|
244
|
+
// (breakpoint rebuilds) — release the delegated listeners or each
|
|
245
|
+
// cycle stacks another set.
|
|
246
|
+
this.containerElement?.removeEventListener('wheel', this.onStripWheel);
|
|
247
|
+
this.containerElement?.removeEventListener('scroll', this.onStripScroll, true);
|
|
149
248
|
if (this.layout) {
|
|
150
249
|
this.layout.destroy();
|
|
151
250
|
this.layout = null;
|
|
@@ -297,13 +396,23 @@ export class GoldenLayoutManager {
|
|
|
297
396
|
element.style.height = '100%';
|
|
298
397
|
element.style.overflow = 'hidden';
|
|
299
398
|
element.style.padding = '0';
|
|
300
|
-
// Temporary placeholder content
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
399
|
+
// Temporary placeholder content. textContent, never innerHTML — the
|
|
400
|
+
// title is USER DATA (entity display names) and round-trips through
|
|
401
|
+
// persisted layout state; interpolating it as markup is an injection
|
|
402
|
+
// vector on layout restore.
|
|
403
|
+
element.replaceChildren();
|
|
404
|
+
const heading = document.createElement('h2');
|
|
405
|
+
heading.textContent = state?.title || 'Tab Content';
|
|
406
|
+
element.appendChild(heading);
|
|
407
|
+
for (const line of [
|
|
408
|
+
`Tab ID: ${state?.tabId || 'unknown'}`,
|
|
409
|
+
`Route: ${state?.route || 'none'}`,
|
|
410
|
+
`App ID: ${state?.appId || 'none'}`
|
|
411
|
+
]) {
|
|
412
|
+
const para = document.createElement('p');
|
|
413
|
+
para.textContent = line;
|
|
414
|
+
element.appendChild(para);
|
|
415
|
+
}
|
|
307
416
|
if (state?.tabId) {
|
|
308
417
|
this.containerMap.set(state.tabId, container);
|
|
309
418
|
// Apply initial styles
|
|
@@ -357,6 +466,29 @@ export class GoldenLayoutManager {
|
|
|
357
466
|
if (titleElement) {
|
|
358
467
|
titleElement.style.fontStyle = state.isPinned ? 'normal' : 'italic';
|
|
359
468
|
}
|
|
469
|
+
// Type-icon slot: the tab's type icon (app-colored) that swaps to an
|
|
470
|
+
// ellipsis on tab hover — clicking it opens the tab-actions menu. This
|
|
471
|
+
// slot is the DEFAULT visible affordance for every tab (Matt's design);
|
|
472
|
+
// the CSS driving the swap lives with the tab styles in tab-container.
|
|
473
|
+
this.applyTypeIconSlot(tabElement, titleElement, state);
|
|
474
|
+
// GL's close control is a bare div — give it button semantics, an
|
|
475
|
+
// accessible name that tracks the title, and keyboard activation.
|
|
476
|
+
const closeEl = tabElement.querySelector('.lm_close_tab');
|
|
477
|
+
if (closeEl) {
|
|
478
|
+
closeEl.setAttribute('role', 'button');
|
|
479
|
+
closeEl.setAttribute('tabindex', '0');
|
|
480
|
+
closeEl.setAttribute('aria-label', `Close ${state.title}`);
|
|
481
|
+
if (!closeEl.hasAttribute('data-key-attached')) {
|
|
482
|
+
closeEl.setAttribute('data-key-attached', 'true');
|
|
483
|
+
closeEl.addEventListener('keydown', (e) => {
|
|
484
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
485
|
+
e.preventDefault();
|
|
486
|
+
e.stopPropagation();
|
|
487
|
+
closeEl.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true }));
|
|
488
|
+
}
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
}
|
|
360
492
|
// Add event listeners if not already added (use data attribute to track)
|
|
361
493
|
if (!tabElement.hasAttribute('data-events-attached')) {
|
|
362
494
|
tabElement.setAttribute('data-events-attached', 'true');
|
|
@@ -374,29 +506,47 @@ export class GoldenLayoutManager {
|
|
|
374
506
|
}
|
|
375
507
|
// Handle pin icon
|
|
376
508
|
if (state.isPinned) {
|
|
509
|
+
// Keep the accessible name tracking the (mutable) title, like the
|
|
510
|
+
// close button and type slot do.
|
|
511
|
+
const existingPin = tabElement.querySelector('.pin-icon');
|
|
512
|
+
if (existingPin) {
|
|
513
|
+
existingPin.setAttribute('aria-label', `Unpin ${state.title}`);
|
|
514
|
+
}
|
|
377
515
|
// Add pin icon if not present
|
|
378
516
|
if (!tabElement.querySelector('.pin-icon')) {
|
|
379
517
|
const pinIcon = document.createElement('i');
|
|
380
518
|
pinIcon.className = 'fa-solid fa-thumbtack pin-icon';
|
|
519
|
+
pinIcon.setAttribute('role', 'button');
|
|
520
|
+
pinIcon.setAttribute('tabindex', '0');
|
|
521
|
+
pinIcon.setAttribute('aria-label', `Unpin ${state.title}`);
|
|
522
|
+
// In-flow flex sibling (tab is a flex row); order slots it between
|
|
523
|
+
// the title and the close button. 24px box = WCAG 2.5.8 target.
|
|
381
524
|
pinIcon.style.cssText = `
|
|
382
|
-
position:
|
|
383
|
-
|
|
384
|
-
top: 50%;
|
|
385
|
-
transform: translateY(-50%) rotate(45deg);
|
|
525
|
+
position: static;
|
|
526
|
+
transform: rotate(45deg);
|
|
386
527
|
font-size: 9px;
|
|
387
528
|
color: var(--mj-text-muted);
|
|
388
|
-
width:
|
|
389
|
-
height:
|
|
529
|
+
width: 24px;
|
|
530
|
+
height: 24px;
|
|
390
531
|
display: flex;
|
|
391
532
|
align-items: center;
|
|
392
533
|
justify-content: center;
|
|
393
534
|
cursor: pointer;
|
|
535
|
+
flex-shrink: 0;
|
|
536
|
+
order: 9;
|
|
394
537
|
`;
|
|
395
538
|
// Click on pin to unpin
|
|
396
539
|
pinIcon.addEventListener('click', (e) => {
|
|
397
540
|
e.stopPropagation();
|
|
398
541
|
this.tabDoubleClicked.next(state.tabId);
|
|
399
542
|
});
|
|
543
|
+
pinIcon.addEventListener('keydown', (e) => {
|
|
544
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
545
|
+
e.preventDefault();
|
|
546
|
+
e.stopPropagation();
|
|
547
|
+
this.tabDoubleClicked.next(state.tabId);
|
|
548
|
+
}
|
|
549
|
+
});
|
|
400
550
|
tabElement.appendChild(pinIcon);
|
|
401
551
|
}
|
|
402
552
|
}
|
|
@@ -408,17 +558,96 @@ export class GoldenLayoutManager {
|
|
|
408
558
|
}
|
|
409
559
|
}
|
|
410
560
|
}
|
|
561
|
+
/**
|
|
562
|
+
* Create/update the type-icon slot inside a tab element. Idempotent: the
|
|
563
|
+
* slot is created once, its icon classes are updated in place on later
|
|
564
|
+
* style passes (e.g. a nav tab whose icon resolves asynchronously). No
|
|
565
|
+
* typeIcon = no slot (and removal if one existed from a previous state).
|
|
566
|
+
*/
|
|
567
|
+
applyTypeIconSlot(tabElement, titleElement, state) {
|
|
568
|
+
let slot = tabElement.querySelector('.mj-tab-type-slot');
|
|
569
|
+
if (!state.typeIcon) {
|
|
570
|
+
slot?.remove();
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (!slot) {
|
|
574
|
+
// A REAL button: tab-focusable, Enter/Space for free, announced with an
|
|
575
|
+
// accessible name — the slot is the keyboard door to the tab-actions
|
|
576
|
+
// menu, not just a hover ornament.
|
|
577
|
+
slot = document.createElement('button');
|
|
578
|
+
slot.type = 'button';
|
|
579
|
+
slot.className = 'mj-tab-type-slot';
|
|
580
|
+
slot.title = 'Tab actions';
|
|
581
|
+
slot.setAttribute('aria-label', `Tab actions — ${state.title}`);
|
|
582
|
+
slot.setAttribute('aria-haspopup', 'menu');
|
|
583
|
+
const icon = document.createElement('i');
|
|
584
|
+
icon.className = `mj-tab-type-ico ${state.typeIcon}`;
|
|
585
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
586
|
+
const dots = document.createElement('i');
|
|
587
|
+
dots.className = 'mj-tab-dots fa-solid fa-ellipsis';
|
|
588
|
+
dots.setAttribute('aria-hidden', 'true');
|
|
589
|
+
slot.appendChild(icon);
|
|
590
|
+
slot.appendChild(dots);
|
|
591
|
+
// The dots ARE the menu affordance: open the same tab-actions menu the
|
|
592
|
+
// right-click path uses, anchored under the slot. The slot passes
|
|
593
|
+
// itself as the anchor so the menu can return focus on close.
|
|
594
|
+
slot.addEventListener('click', (e) => {
|
|
595
|
+
e.preventDefault();
|
|
596
|
+
e.stopPropagation();
|
|
597
|
+
// Anchor the menu under the slot — EXCEPT when the slot lives in a
|
|
598
|
+
// row of the tab-overflow dropdown: GL's document-mouseup listener
|
|
599
|
+
// hides that list before this click handler runs, so the rect
|
|
600
|
+
// measures 0x0 at the origin (the menu "floats to the top left").
|
|
601
|
+
// A hidden anchor's coordinates are garbage — fall back to the
|
|
602
|
+
// pointer position (keyboard activation still has a live rect).
|
|
603
|
+
const rect = slot.getBoundingClientRect();
|
|
604
|
+
const anchorVisible = rect.width > 0 || rect.height > 0;
|
|
605
|
+
const x = anchorVisible ? rect.left : e.clientX;
|
|
606
|
+
const y = anchorVisible ? rect.bottom + 2 : e.clientY;
|
|
607
|
+
this.tabRightClicked.next({ tabId: state.tabId, x, y, anchorEl: anchorVisible ? slot : undefined });
|
|
608
|
+
});
|
|
609
|
+
// GL's own tab handlers listen for keydown/mousedown on the tab — keep
|
|
610
|
+
// keyboard activation of the slot from leaking into tab drag/select.
|
|
611
|
+
slot.addEventListener('keydown', (e) => e.stopPropagation());
|
|
612
|
+
if (titleElement) {
|
|
613
|
+
tabElement.insertBefore(slot, titleElement);
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
tabElement.prepend(slot);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
const icon = slot.querySelector('.mj-tab-type-ico');
|
|
621
|
+
const expected = `mj-tab-type-ico ${state.typeIcon}`;
|
|
622
|
+
if (icon && icon.className !== expected) {
|
|
623
|
+
icon.className = expected;
|
|
624
|
+
}
|
|
625
|
+
const expectedLabel = `Tab actions — ${state.title}`;
|
|
626
|
+
if (slot.getAttribute('aria-label') !== expectedLabel) {
|
|
627
|
+
slot.setAttribute('aria-label', expectedLabel);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
411
631
|
/**
|
|
412
632
|
* Refresh styles for all tabs (after drag/drop)
|
|
413
633
|
*/
|
|
634
|
+
refreshAllTabStylesTimer = null;
|
|
414
635
|
refreshAllTabStyles() {
|
|
415
|
-
|
|
636
|
+
// COALESCED: stateChanged fires in bursts (drags emit dozens) — one
|
|
637
|
+
// trailing pass instead of a queued pass per event.
|
|
638
|
+
if (this.refreshAllTabStylesTimer !== null) {
|
|
639
|
+
clearTimeout(this.refreshAllTabStylesTimer);
|
|
640
|
+
}
|
|
641
|
+
this.refreshAllTabStylesTimer = setTimeout(() => {
|
|
642
|
+
this.refreshAllTabStylesTimer = null;
|
|
416
643
|
this.containerMap.forEach((container, tabId) => {
|
|
417
644
|
const state = container.state;
|
|
418
645
|
if (state) {
|
|
419
646
|
this.applyTabStyles(container, state);
|
|
420
647
|
}
|
|
421
648
|
});
|
|
649
|
+
// Tab set / widths may have changed — re-resolve nudge visibility
|
|
650
|
+
this.updateStripNudges();
|
|
422
651
|
}, 50);
|
|
423
652
|
}
|
|
424
653
|
/**
|
|
@@ -446,57 +675,39 @@ export class GoldenLayoutManager {
|
|
|
446
675
|
* Convert workspace layout config to Golden Layout config
|
|
447
676
|
*/
|
|
448
677
|
convertToGoldenLayoutConfig(config) {
|
|
449
|
-
//
|
|
450
|
-
|
|
678
|
+
// Normalize GL-serialized fields AND deep-clone componentState so GL's
|
|
679
|
+
// runtime never holds references into the persisted workspace config —
|
|
680
|
+
// see SanitizeLayoutNodeForLoad (unit-tested in layout-transforms)
|
|
681
|
+
const sanitizedRoot = SanitizeLayoutNodeForLoad(config.root);
|
|
451
682
|
return {
|
|
452
683
|
root: sanitizedRoot,
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
popout: false,
|
|
456
|
-
maximise: false,
|
|
457
|
-
close: 'tab'
|
|
458
|
-
}
|
|
684
|
+
settings: this.settingsConfig(),
|
|
685
|
+
header: this.headerConfig()
|
|
459
686
|
};
|
|
460
687
|
}
|
|
461
688
|
/**
|
|
462
|
-
*
|
|
689
|
+
* Layout-level settings for every config this manager loads. The huge
|
|
690
|
+
* tabOverlapAllowance is what makes the scrolling tab strip possible —
|
|
691
|
+
* see the GLLayoutConfig.settings doc comment.
|
|
463
692
|
*/
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
693
|
+
settingsConfig() {
|
|
694
|
+
return {
|
|
695
|
+
tabOverlapAllowance: 1_000_000_000
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* The header config for every layout this manager loads — the single place
|
|
700
|
+
* the HideHeaders init option is honored (Initialize's empty config AND
|
|
701
|
+
* LoadLayout's restored config must agree, or a restore would resurrect
|
|
702
|
+
* the strip on the mobile records surface).
|
|
703
|
+
*/
|
|
704
|
+
headerConfig() {
|
|
705
|
+
return {
|
|
706
|
+
show: this.hideHeaders ? false : 'top',
|
|
707
|
+
popout: false,
|
|
708
|
+
maximise: false,
|
|
709
|
+
close: 'tab'
|
|
467
710
|
};
|
|
468
|
-
// Cast to any to work with dynamic properties
|
|
469
|
-
const sanitizedAny = sanitized;
|
|
470
|
-
// Convert size from number + sizeUnit to Golden Layout format
|
|
471
|
-
// Golden Layout expects strings like "100%" or "1fr", not separate fields
|
|
472
|
-
if (sanitizedAny.size !== undefined && sanitizedAny.sizeUnit !== undefined) {
|
|
473
|
-
if (typeof sanitizedAny.size === 'number') {
|
|
474
|
-
// Combine size and sizeUnit into a single string
|
|
475
|
-
sanitizedAny.size = `${sanitizedAny.size}${sanitizedAny.sizeUnit}`;
|
|
476
|
-
// Remove sizeUnit as it's now part of size
|
|
477
|
-
delete sanitizedAny.sizeUnit;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
// Remove width/height if they exist and are not valid
|
|
481
|
-
// Golden Layout expects strings like "50%" or numbers (pixels)
|
|
482
|
-
// But JSON parsing might give us non-string objects
|
|
483
|
-
if (sanitized.width !== undefined) {
|
|
484
|
-
if (typeof sanitized.width !== 'number' && typeof sanitized.width !== 'string') {
|
|
485
|
-
delete sanitized.width;
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
if (sanitized.height !== undefined) {
|
|
489
|
-
if (typeof sanitized.height !== 'number' && typeof sanitized.height !== 'string') {
|
|
490
|
-
delete sanitized.height;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
// Remove other Golden Layout internal fields that shouldn't be in saved config
|
|
494
|
-
delete sanitizedAny.minSizeUnit;
|
|
495
|
-
// Recursively sanitize child nodes
|
|
496
|
-
if (sanitized.content) {
|
|
497
|
-
sanitized.content = sanitized.content.map(child => this.sanitizeLayoutNode(child));
|
|
498
|
-
}
|
|
499
|
-
return sanitized;
|
|
500
711
|
}
|
|
501
712
|
/**
|
|
502
713
|
* Convert Golden Layout config to workspace layout config
|