@netless/telebox-insider 0.3.0 → 0.3.1-beta.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/dist/index.d.ts +20 -9
- package/dist/style.css +3 -0
- package/dist/telebox-insider.cjs.js +269 -88
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +269 -88
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/TeleBox/index.ts +90 -21
- package/src/TeleBox/typings.ts +10 -2
- package/src/TeleBoxManager/index.ts +387 -150
- package/src/TeleBoxManager/typings.ts +6 -2
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +66 -25
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +5 -0
- package/src/TeleTitleBar/typings.ts +3 -0
|
@@ -43,6 +43,7 @@ type ValConfig = {
|
|
|
43
43
|
readonly: Val<boolean, boolean>;
|
|
44
44
|
minimized: Val<boolean, boolean>;
|
|
45
45
|
maximized: Val<boolean, boolean>;
|
|
46
|
+
forceMaximized: Val<boolean, boolean>;
|
|
46
47
|
fence: Val<boolean, boolean>;
|
|
47
48
|
};
|
|
48
49
|
export interface TeleBoxManager extends ValEnhancedResult<ValConfig> {}
|
|
@@ -57,12 +58,12 @@ export class TeleBoxManager {
|
|
|
57
58
|
skipUpdate: boolean;
|
|
58
59
|
timer: number | undefined;
|
|
59
60
|
resolve?: (skipUpdate: boolean) => void;
|
|
60
|
-
}
|
|
61
|
+
};
|
|
61
62
|
protected effectLastNotMinimizedBoxStatusTimer?: {
|
|
62
63
|
skipUpdate: boolean;
|
|
63
64
|
timer: number | undefined;
|
|
64
65
|
resolve?: (skipUpdate: boolean) => void;
|
|
65
|
-
}
|
|
66
|
+
};
|
|
66
67
|
|
|
67
68
|
public constructor({
|
|
68
69
|
root = document.body,
|
|
@@ -79,6 +80,7 @@ export class TeleBoxManager {
|
|
|
79
80
|
collector,
|
|
80
81
|
namespace = "telebox",
|
|
81
82
|
readonly = false,
|
|
83
|
+
forceMaximized = false,
|
|
82
84
|
useBoxesStatus = false,
|
|
83
85
|
}: TeleBoxManagerConfig = {}) {
|
|
84
86
|
this._sideEffect = new SideEffectManager();
|
|
@@ -96,7 +98,10 @@ export class TeleBoxManager {
|
|
|
96
98
|
if (box.forceTop) {
|
|
97
99
|
return topBox;
|
|
98
100
|
}
|
|
99
|
-
if (
|
|
101
|
+
if (
|
|
102
|
+
box.boxStatus &&
|
|
103
|
+
box.boxStatus === TELE_BOX_STATE.Minimized
|
|
104
|
+
) {
|
|
100
105
|
return topBox;
|
|
101
106
|
}
|
|
102
107
|
if (!topBox) {
|
|
@@ -104,13 +109,16 @@ export class TeleBoxManager {
|
|
|
104
109
|
return topBox;
|
|
105
110
|
}
|
|
106
111
|
return topBox.zIndex > box.zIndex ? topBox : box;
|
|
107
|
-
}, currentTopBox as
|
|
112
|
+
}, currentTopBox as TeleBox | undefined);
|
|
108
113
|
return topBox;
|
|
109
114
|
}
|
|
110
115
|
return;
|
|
111
116
|
});
|
|
112
117
|
this.boxesStatus$ = new Map<string, TeleBoxState>();
|
|
113
|
-
this.lastNotMinimizedBoxesStatus$ = new Map<
|
|
118
|
+
this.lastNotMinimizedBoxesStatus$ = new Map<
|
|
119
|
+
string,
|
|
120
|
+
NotMinimizedBoxState
|
|
121
|
+
>();
|
|
114
122
|
const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
|
|
115
123
|
const prefersDark$ = createVal(false);
|
|
116
124
|
|
|
@@ -160,6 +168,13 @@ export class TeleBoxManager {
|
|
|
160
168
|
const minimized$ = createVal(minimized);
|
|
161
169
|
|
|
162
170
|
const maximized$ = createVal(maximized);
|
|
171
|
+
const forceMaximized$ = createVal(forceMaximized);
|
|
172
|
+
forceMaximized$.reaction((forceMaximized, _, skipUpdate) => {
|
|
173
|
+
this.boxes.forEach((box) =>
|
|
174
|
+
box.setForceMaximized(forceMaximized, skipUpdate)
|
|
175
|
+
);
|
|
176
|
+
this.maxTitleBar?.setForceMaximized(forceMaximized);
|
|
177
|
+
});
|
|
163
178
|
maximized$.reaction((maximized, _, skipUpdate) => {
|
|
164
179
|
this.boxes.forEach((box) =>
|
|
165
180
|
box.setMaximized(maximized, skipUpdate)
|
|
@@ -205,7 +220,7 @@ export class TeleBoxManager {
|
|
|
205
220
|
new TeleBoxCollector({
|
|
206
221
|
visible: minimized,
|
|
207
222
|
readonly: readonly,
|
|
208
|
-
namespace
|
|
223
|
+
namespace,
|
|
209
224
|
}).mount(root)
|
|
210
225
|
);
|
|
211
226
|
collector$.subscribe((collector) => {
|
|
@@ -316,23 +331,39 @@ export class TeleBoxManager {
|
|
|
316
331
|
if (!this.useBoxesStatus) {
|
|
317
332
|
this.makeBoxTop(box);
|
|
318
333
|
} else {
|
|
319
|
-
if (
|
|
320
|
-
|
|
334
|
+
if (
|
|
335
|
+
box.boxStatus &&
|
|
336
|
+
box.boxStatus === TELE_BOX_STATE.Normal
|
|
337
|
+
) {
|
|
338
|
+
const maxNormalBoxZIndex =
|
|
339
|
+
this.getMaxNormalBoxZIndex();
|
|
321
340
|
if (maxNormalBoxZIndex > box.zIndex) {
|
|
322
|
-
this.setBox(
|
|
323
|
-
|
|
324
|
-
|
|
341
|
+
this.setBox(
|
|
342
|
+
box,
|
|
343
|
+
{
|
|
344
|
+
zIndex: maxNormalBoxZIndex + 1,
|
|
345
|
+
},
|
|
346
|
+
false
|
|
347
|
+
);
|
|
325
348
|
}
|
|
326
|
-
} else if(
|
|
327
|
-
|
|
349
|
+
} else if (
|
|
350
|
+
box.boxStatus &&
|
|
351
|
+
box.boxStatus === TELE_BOX_STATE.Maximized
|
|
352
|
+
) {
|
|
353
|
+
const maxMaximizedBoxZIndex =
|
|
354
|
+
this.getMaxMaximizedBoxZIndex();
|
|
328
355
|
if (maxMaximizedBoxZIndex > box.zIndex) {
|
|
329
|
-
this.setBox(
|
|
330
|
-
|
|
331
|
-
|
|
356
|
+
this.setBox(
|
|
357
|
+
box,
|
|
358
|
+
{
|
|
359
|
+
zIndex: maxMaximizedBoxZIndex + 1,
|
|
360
|
+
},
|
|
361
|
+
false
|
|
362
|
+
);
|
|
332
363
|
}
|
|
333
364
|
this.makeMaximizedTopBoxFocus();
|
|
334
365
|
}
|
|
335
|
-
}
|
|
366
|
+
}
|
|
336
367
|
this.focusBox(box);
|
|
337
368
|
return;
|
|
338
369
|
}
|
|
@@ -358,6 +389,7 @@ export class TeleBoxManager {
|
|
|
358
389
|
readonly: readonly$.value,
|
|
359
390
|
namespace: this.namespace,
|
|
360
391
|
state: state$.value,
|
|
392
|
+
forceMaximized: forceMaximized$.value,
|
|
361
393
|
boxes: this.boxes$.value,
|
|
362
394
|
containerRect: containerRect$.value,
|
|
363
395
|
getBoxesStatus: () => {
|
|
@@ -366,20 +398,33 @@ export class TeleBoxManager {
|
|
|
366
398
|
onEvent: (event): void => {
|
|
367
399
|
switch (event.type) {
|
|
368
400
|
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
401
|
+
if (
|
|
402
|
+
forceMaximized$.value &&
|
|
403
|
+
this.state === TELE_BOX_STATE.Maximized
|
|
404
|
+
) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
369
407
|
if (this.hasBoxesStatus()) {
|
|
370
408
|
let targetBox = this.maxTitleBar.focusedBox;
|
|
371
409
|
if (!targetBox) {
|
|
372
|
-
|
|
410
|
+
targetBox = this.getMaximizedTopBox();
|
|
373
411
|
}
|
|
374
412
|
if (targetBox?.id) {
|
|
375
413
|
const box = this.getBox(targetBox.id);
|
|
376
414
|
if (box) {
|
|
377
|
-
this.setBox(
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
415
|
+
this.setBox(
|
|
416
|
+
box,
|
|
417
|
+
{
|
|
418
|
+
status: TELE_BOX_STATE.Normal,
|
|
419
|
+
zIndex:
|
|
420
|
+
this.getMaxNormalBoxZIndex() +
|
|
421
|
+
1,
|
|
422
|
+
},
|
|
423
|
+
false,
|
|
424
|
+
() => {
|
|
425
|
+
this.makeMaximizedTopBoxFocus();
|
|
426
|
+
}
|
|
427
|
+
);
|
|
383
428
|
}
|
|
384
429
|
}
|
|
385
430
|
} else {
|
|
@@ -391,9 +436,9 @@ export class TeleBoxManager {
|
|
|
391
436
|
if (this.hasBoxesStatus()) {
|
|
392
437
|
let targetBox = this.maxTitleBar.focusedBox;
|
|
393
438
|
if (!targetBox) {
|
|
394
|
-
|
|
439
|
+
targetBox = this.getMaximizedTopBox();
|
|
395
440
|
}
|
|
396
|
-
if(targetBox?.id){
|
|
441
|
+
if (targetBox?.id) {
|
|
397
442
|
const box = this.getBox(targetBox.id);
|
|
398
443
|
if (box) {
|
|
399
444
|
let isFocusChanged = false;
|
|
@@ -401,10 +446,14 @@ export class TeleBoxManager {
|
|
|
401
446
|
this.blurBox(box);
|
|
402
447
|
isFocusChanged = true;
|
|
403
448
|
}
|
|
404
|
-
this.setBox(
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
449
|
+
this.setBox(
|
|
450
|
+
box,
|
|
451
|
+
{
|
|
452
|
+
status: TELE_BOX_STATE.Minimized,
|
|
453
|
+
zIndex: -1,
|
|
454
|
+
},
|
|
455
|
+
false
|
|
456
|
+
);
|
|
408
457
|
if (isFocusChanged) {
|
|
409
458
|
this.focusTopBox();
|
|
410
459
|
} else {
|
|
@@ -421,7 +470,7 @@ export class TeleBoxManager {
|
|
|
421
470
|
if (this.hasBoxesStatus()) {
|
|
422
471
|
let targetBox = this.maxTitleBar.focusedBox;
|
|
423
472
|
if (!targetBox) {
|
|
424
|
-
|
|
473
|
+
targetBox = this.getMaximizedTopBox();
|
|
425
474
|
}
|
|
426
475
|
if (targetBox?.id) {
|
|
427
476
|
const box = this.getBox(targetBox.id);
|
|
@@ -470,6 +519,7 @@ export class TeleBoxManager {
|
|
|
470
519
|
fence: fence$,
|
|
471
520
|
minimized: minimized$,
|
|
472
521
|
maximized: maximized$,
|
|
522
|
+
forceMaximized: forceMaximized$,
|
|
473
523
|
};
|
|
474
524
|
|
|
475
525
|
withValueEnhancer(this, valConfig);
|
|
@@ -534,6 +584,9 @@ export class TeleBoxManager {
|
|
|
534
584
|
|
|
535
585
|
/** @deprecated use setMaximized and setMinimized instead */
|
|
536
586
|
public setState(state: TeleBoxState, skipUpdate = false): this {
|
|
587
|
+
if (state === TELE_BOX_STATE.Normal && this.forceMaximized) {
|
|
588
|
+
return this;
|
|
589
|
+
}
|
|
537
590
|
switch (state) {
|
|
538
591
|
case TELE_BOX_STATE.Maximized: {
|
|
539
592
|
this.setMinimized(false, skipUpdate);
|
|
@@ -554,13 +607,27 @@ export class TeleBoxManager {
|
|
|
554
607
|
return this;
|
|
555
608
|
}
|
|
556
609
|
|
|
557
|
-
public setBoxStatus(
|
|
610
|
+
public setBoxStatus(
|
|
611
|
+
boxId: string,
|
|
612
|
+
boxStatus?: TeleBoxState,
|
|
613
|
+
skipUpdate = false
|
|
614
|
+
): void {
|
|
558
615
|
if (boxStatus) {
|
|
559
616
|
const oldBoxStatus = this.boxesStatus$.get(boxId);
|
|
560
617
|
this.boxesStatus$.set(boxId, boxStatus);
|
|
561
|
-
if (
|
|
562
|
-
|
|
563
|
-
|
|
618
|
+
if (
|
|
619
|
+
boxStatus === TELE_BOX_STATE.Minimized &&
|
|
620
|
+
oldBoxStatus !== TELE_BOX_STATE.Minimized
|
|
621
|
+
) {
|
|
622
|
+
this.setLastNotMinimizedBoxStatus(
|
|
623
|
+
boxId,
|
|
624
|
+
oldBoxStatus,
|
|
625
|
+
skipUpdate
|
|
626
|
+
);
|
|
627
|
+
} else if (
|
|
628
|
+
oldBoxStatus === TELE_BOX_STATE.Minimized &&
|
|
629
|
+
boxStatus !== TELE_BOX_STATE.Minimized
|
|
630
|
+
) {
|
|
564
631
|
this.setLastNotMinimizedBoxStatus(boxId, undefined, skipUpdate);
|
|
565
632
|
}
|
|
566
633
|
} else {
|
|
@@ -568,7 +635,10 @@ export class TeleBoxManager {
|
|
|
568
635
|
this.setLastNotMinimizedBoxStatus(boxId, undefined, skipUpdate);
|
|
569
636
|
}
|
|
570
637
|
if (!skipUpdate) {
|
|
571
|
-
this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, {
|
|
638
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, {
|
|
639
|
+
id: boxId,
|
|
640
|
+
boxStatus,
|
|
641
|
+
});
|
|
572
642
|
}
|
|
573
643
|
}
|
|
574
644
|
|
|
@@ -580,11 +650,17 @@ export class TeleBoxManager {
|
|
|
580
650
|
return this.boxesStatus$;
|
|
581
651
|
}
|
|
582
652
|
|
|
583
|
-
public get lastNotMinimizedBoxesStatus(): ReadonlyMap<
|
|
653
|
+
public get lastNotMinimizedBoxesStatus(): ReadonlyMap<
|
|
654
|
+
string,
|
|
655
|
+
NotMinimizedBoxState
|
|
656
|
+
> {
|
|
584
657
|
return this.lastNotMinimizedBoxesStatus$;
|
|
585
658
|
}
|
|
586
659
|
|
|
587
|
-
public setBoxesStatus(
|
|
660
|
+
public setBoxesStatus(
|
|
661
|
+
boxesStatus: Map<string, TeleBoxState>,
|
|
662
|
+
skipUpdate = false
|
|
663
|
+
) {
|
|
588
664
|
this.boxesStatus$ = boxesStatus;
|
|
589
665
|
this.effectBoxesStatusChange(skipUpdate);
|
|
590
666
|
}
|
|
@@ -593,13 +669,13 @@ export class TeleBoxManager {
|
|
|
593
669
|
return this.boxesStatus$;
|
|
594
670
|
}
|
|
595
671
|
|
|
596
|
-
protected effectBoxStatusChange(){
|
|
672
|
+
protected effectBoxStatusChange() {
|
|
597
673
|
if (!this.useBoxesStatus) {
|
|
598
674
|
return;
|
|
599
675
|
}
|
|
600
|
-
if(this.collector){
|
|
676
|
+
if (this.collector) {
|
|
601
677
|
this.collector.updateBoxesStatus();
|
|
602
|
-
if(this.hasMinimizedBox()){
|
|
678
|
+
if (this.hasMinimizedBox()) {
|
|
603
679
|
this._setCollectorRect(this._calcCollectorRect());
|
|
604
680
|
}
|
|
605
681
|
}
|
|
@@ -611,16 +687,20 @@ export class TeleBoxManager {
|
|
|
611
687
|
}
|
|
612
688
|
}
|
|
613
689
|
|
|
614
|
-
protected effectBoxesStatusTimerFunc(skipUpdate: boolean){
|
|
690
|
+
protected effectBoxesStatusTimerFunc(skipUpdate: boolean) {
|
|
615
691
|
if (!this.useBoxesStatus) {
|
|
616
692
|
return;
|
|
617
693
|
}
|
|
618
|
-
let newTopBox:TeleBox | undefined;
|
|
694
|
+
let newTopBox: TeleBox | undefined;
|
|
619
695
|
const curTopBox = this.topBox;
|
|
620
696
|
this.boxes.forEach((box) => {
|
|
621
697
|
const boxStatus = this.boxesStatus$.get(box.id);
|
|
622
698
|
if (boxStatus) {
|
|
623
|
-
if (
|
|
699
|
+
if (
|
|
700
|
+
boxStatus !== TELE_BOX_STATE.Minimized &&
|
|
701
|
+
!this.isForceTop(box) &&
|
|
702
|
+
box.zIndex > (newTopBox?.zIndex ?? 0)
|
|
703
|
+
) {
|
|
624
704
|
newTopBox = box;
|
|
625
705
|
}
|
|
626
706
|
box.setBoxStatus(boxStatus, skipUpdate);
|
|
@@ -637,20 +717,27 @@ export class TeleBoxManager {
|
|
|
637
717
|
|
|
638
718
|
public async effectBoxesStatusChange(skipUpdate = false): Promise<void> {
|
|
639
719
|
if (!this.useBoxesStatus) {
|
|
640
|
-
if (
|
|
720
|
+
if (
|
|
721
|
+
this.effectBoxesStatusTimer &&
|
|
722
|
+
this.effectBoxesStatusTimer.timer
|
|
723
|
+
) {
|
|
641
724
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
642
725
|
if (this.effectBoxesStatusTimer.resolve) {
|
|
643
|
-
this.effectBoxesStatusTimer.resolve(
|
|
726
|
+
this.effectBoxesStatusTimer.resolve(
|
|
727
|
+
!!this.effectBoxesStatusTimer?.skipUpdate
|
|
728
|
+
);
|
|
644
729
|
}
|
|
645
730
|
}
|
|
646
|
-
this.effectBoxesStatusTimer=undefined;
|
|
731
|
+
this.effectBoxesStatusTimer = undefined;
|
|
647
732
|
return;
|
|
648
733
|
}
|
|
649
734
|
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
|
|
650
735
|
if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
|
|
651
736
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
652
737
|
if (this.effectBoxesStatusTimer.resolve) {
|
|
653
|
-
this.effectBoxesStatusTimer.resolve(
|
|
738
|
+
this.effectBoxesStatusTimer.resolve(
|
|
739
|
+
!!this.effectBoxesStatusTimer?.skipUpdate
|
|
740
|
+
);
|
|
654
741
|
}
|
|
655
742
|
this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
|
|
656
743
|
} else {
|
|
@@ -665,22 +752,27 @@ export class TeleBoxManager {
|
|
|
665
752
|
} as {
|
|
666
753
|
skipUpdate: boolean;
|
|
667
754
|
timer: number | undefined;
|
|
668
|
-
}
|
|
755
|
+
};
|
|
669
756
|
}
|
|
670
757
|
if (this.effectBoxesStatusTimer) {
|
|
671
|
-
const _skipUpdate = await new Promise<boolean>((resolve)=>{
|
|
758
|
+
const _skipUpdate = await new Promise<boolean>((resolve) => {
|
|
672
759
|
this.effectBoxesStatusTimer!.resolve = resolve;
|
|
673
|
-
this.effectBoxesStatusTimer!.timer = setTimeout(()=>{
|
|
674
|
-
if (
|
|
675
|
-
this.effectBoxesStatusTimer
|
|
760
|
+
this.effectBoxesStatusTimer!.timer = setTimeout(() => {
|
|
761
|
+
if (
|
|
762
|
+
this.effectBoxesStatusTimer &&
|
|
763
|
+
this.effectBoxesStatusTimer.resolve
|
|
764
|
+
) {
|
|
765
|
+
this.effectBoxesStatusTimer.resolve(
|
|
766
|
+
this.effectBoxesStatusTimer!.skipUpdate
|
|
767
|
+
);
|
|
676
768
|
}
|
|
677
769
|
}, 100) as unknown as number;
|
|
678
|
-
})
|
|
679
|
-
this.effectBoxesStatusTimerFunc(_skipUpdate)
|
|
770
|
+
});
|
|
771
|
+
this.effectBoxesStatusTimerFunc(_skipUpdate);
|
|
680
772
|
this.effectBoxesStatusTimer = undefined;
|
|
681
773
|
}
|
|
682
774
|
}
|
|
683
|
-
|
|
775
|
+
|
|
684
776
|
public hasBoxesStatus(): boolean {
|
|
685
777
|
if (!this.useBoxesStatus) {
|
|
686
778
|
return false;
|
|
@@ -692,14 +784,19 @@ export class TeleBoxManager {
|
|
|
692
784
|
if (!this.useBoxesStatus) {
|
|
693
785
|
return false;
|
|
694
786
|
}
|
|
695
|
-
return this.boxes.some(
|
|
787
|
+
return this.boxes.some(
|
|
788
|
+
(box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized
|
|
789
|
+
);
|
|
696
790
|
}
|
|
697
791
|
|
|
698
792
|
public getMinimizedBoxesStatus(): Map<string, TELE_BOX_STATE.Minimized> {
|
|
699
793
|
const minimizedBoxes = new Map<string, TELE_BOX_STATE.Minimized>();
|
|
700
794
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
701
795
|
if (boxStatus === TELE_BOX_STATE.Minimized) {
|
|
702
|
-
minimizedBoxes.set(
|
|
796
|
+
minimizedBoxes.set(
|
|
797
|
+
boxId,
|
|
798
|
+
boxStatus as TELE_BOX_STATE.Minimized
|
|
799
|
+
);
|
|
703
800
|
}
|
|
704
801
|
});
|
|
705
802
|
return minimizedBoxes;
|
|
@@ -719,7 +816,10 @@ export class TeleBoxManager {
|
|
|
719
816
|
const maximizedBoxes = new Map<string, TELE_BOX_STATE.Maximized>();
|
|
720
817
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
721
818
|
if (boxStatus === TELE_BOX_STATE.Maximized) {
|
|
722
|
-
maximizedBoxes.set(
|
|
819
|
+
maximizedBoxes.set(
|
|
820
|
+
boxId,
|
|
821
|
+
boxStatus as TELE_BOX_STATE.Maximized
|
|
822
|
+
);
|
|
723
823
|
}
|
|
724
824
|
});
|
|
725
825
|
return maximizedBoxes;
|
|
@@ -735,45 +835,76 @@ export class TeleBoxManager {
|
|
|
735
835
|
return normalBoxes;
|
|
736
836
|
}
|
|
737
837
|
|
|
738
|
-
public getLastNotMinimizedBoxStatus(
|
|
838
|
+
public getLastNotMinimizedBoxStatus(
|
|
839
|
+
boxId: string
|
|
840
|
+
): NotMinimizedBoxState | undefined {
|
|
739
841
|
return this.lastNotMinimizedBoxesStatus$.get(boxId);
|
|
740
842
|
}
|
|
741
843
|
|
|
742
|
-
public setLastNotMinimizedBoxStatus(
|
|
844
|
+
public setLastNotMinimizedBoxStatus(
|
|
845
|
+
boxId: string,
|
|
846
|
+
lastNotMinimizedBoxStatus?: NotMinimizedBoxState,
|
|
847
|
+
skipUpdate = false
|
|
848
|
+
): void {
|
|
743
849
|
if (lastNotMinimizedBoxStatus) {
|
|
744
|
-
this.lastNotMinimizedBoxesStatus$.set(
|
|
850
|
+
this.lastNotMinimizedBoxesStatus$.set(
|
|
851
|
+
boxId,
|
|
852
|
+
lastNotMinimizedBoxStatus
|
|
853
|
+
);
|
|
745
854
|
} else {
|
|
746
855
|
this.lastNotMinimizedBoxesStatus$.delete(boxId);
|
|
747
856
|
}
|
|
748
857
|
if (!skipUpdate) {
|
|
749
|
-
this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, {
|
|
858
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, {
|
|
859
|
+
id: boxId,
|
|
860
|
+
boxStatus: lastNotMinimizedBoxStatus,
|
|
861
|
+
});
|
|
750
862
|
}
|
|
751
863
|
}
|
|
752
864
|
|
|
753
|
-
public setLastNotMinimizedBoxesStatus(
|
|
865
|
+
public setLastNotMinimizedBoxesStatus(
|
|
866
|
+
lastNotMinimizedBoxesStatus: Map<string, NotMinimizedBoxState>,
|
|
867
|
+
skipUpdate = false
|
|
868
|
+
): void {
|
|
754
869
|
this.lastNotMinimizedBoxesStatus$ = lastNotMinimizedBoxesStatus;
|
|
755
870
|
this.effectLastNotMinimizedBoxStatusChange(skipUpdate);
|
|
756
871
|
}
|
|
757
872
|
|
|
758
|
-
protected async effectLastNotMinimizedBoxStatusChange(
|
|
873
|
+
protected async effectLastNotMinimizedBoxStatusChange(
|
|
874
|
+
skipUpdate = false
|
|
875
|
+
): Promise<void> {
|
|
759
876
|
if (!this.useBoxesStatus) {
|
|
760
|
-
if (
|
|
877
|
+
if (
|
|
878
|
+
this.effectLastNotMinimizedBoxStatusTimer &&
|
|
879
|
+
this.effectLastNotMinimizedBoxStatusTimer.timer
|
|
880
|
+
) {
|
|
761
881
|
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
762
882
|
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
763
|
-
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
883
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
884
|
+
!!this.effectLastNotMinimizedBoxStatusTimer?.skipUpdate
|
|
885
|
+
);
|
|
764
886
|
}
|
|
765
887
|
}
|
|
766
|
-
this.effectLastNotMinimizedBoxStatusTimer=undefined;
|
|
888
|
+
this.effectLastNotMinimizedBoxStatusTimer = undefined;
|
|
767
889
|
return;
|
|
768
890
|
}
|
|
769
|
-
if (
|
|
891
|
+
if (
|
|
892
|
+
this.effectLastNotMinimizedBoxStatusTimer &&
|
|
893
|
+
this.effectLastNotMinimizedBoxStatusTimer.timer
|
|
894
|
+
) {
|
|
770
895
|
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
771
|
-
if (
|
|
896
|
+
if (
|
|
897
|
+
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !==
|
|
898
|
+
skipUpdate
|
|
899
|
+
) {
|
|
772
900
|
// this.effectLastNotMinimizedBoxStatusFunc(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate)
|
|
773
901
|
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
774
|
-
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
902
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
903
|
+
!!this.effectLastNotMinimizedBoxStatusTimer?.skipUpdate
|
|
904
|
+
);
|
|
775
905
|
}
|
|
776
|
-
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate =
|
|
906
|
+
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate =
|
|
907
|
+
skipUpdate;
|
|
777
908
|
} else {
|
|
778
909
|
return;
|
|
779
910
|
}
|
|
@@ -786,29 +917,38 @@ export class TeleBoxManager {
|
|
|
786
917
|
} as {
|
|
787
918
|
skipUpdate: boolean;
|
|
788
919
|
timer: number | undefined;
|
|
789
|
-
}
|
|
920
|
+
};
|
|
790
921
|
}
|
|
791
922
|
if (this.effectLastNotMinimizedBoxStatusTimer) {
|
|
792
|
-
const _skipUpdate = await new Promise<boolean>((resolve)=>{
|
|
923
|
+
const _skipUpdate = await new Promise<boolean>((resolve) => {
|
|
793
924
|
this.effectLastNotMinimizedBoxStatusTimer!.resolve = resolve;
|
|
794
|
-
this.effectLastNotMinimizedBoxStatusTimer!.timer = setTimeout(
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
925
|
+
this.effectLastNotMinimizedBoxStatusTimer!.timer = setTimeout(
|
|
926
|
+
() => {
|
|
927
|
+
if (
|
|
928
|
+
this.effectLastNotMinimizedBoxStatusTimer &&
|
|
929
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve
|
|
930
|
+
) {
|
|
931
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
932
|
+
this.effectLastNotMinimizedBoxStatusTimer!
|
|
933
|
+
.skipUpdate
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
},
|
|
937
|
+
100
|
|
938
|
+
) as unknown as number;
|
|
939
|
+
});
|
|
940
|
+
this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
|
|
801
941
|
this.effectLastNotMinimizedBoxStatusTimer = undefined;
|
|
802
942
|
}
|
|
803
943
|
}
|
|
804
944
|
|
|
805
|
-
protected effectLastNotMinimizedBoxStatusFunc(skipUpdate = false){
|
|
945
|
+
protected effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
|
|
806
946
|
if (!this.useBoxesStatus) {
|
|
807
947
|
return;
|
|
808
948
|
}
|
|
809
949
|
this.boxes.forEach((box) => {
|
|
810
950
|
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
811
|
-
if(boxStatus){
|
|
951
|
+
if (boxStatus) {
|
|
812
952
|
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
813
953
|
}
|
|
814
954
|
});
|
|
@@ -824,7 +964,11 @@ export class TeleBoxManager {
|
|
|
824
964
|
return this.getUnabledBoxesStatusZIndex();
|
|
825
965
|
}
|
|
826
966
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
827
|
-
if (
|
|
967
|
+
if (
|
|
968
|
+
box.boxStatus &&
|
|
969
|
+
box.boxStatus === TELE_BOX_STATE.Maximized &&
|
|
970
|
+
!this.isForceTop(box)
|
|
971
|
+
) {
|
|
828
972
|
return Math.max(maxZIndex, box.zIndex);
|
|
829
973
|
}
|
|
830
974
|
return maxZIndex;
|
|
@@ -837,7 +981,11 @@ export class TeleBoxManager {
|
|
|
837
981
|
return this.getUnabledBoxesStatusZIndex();
|
|
838
982
|
}
|
|
839
983
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
840
|
-
if (
|
|
984
|
+
if (
|
|
985
|
+
box.boxStatus &&
|
|
986
|
+
box.boxStatus === TELE_BOX_STATE.Normal &&
|
|
987
|
+
!this.isForceTop(box)
|
|
988
|
+
) {
|
|
841
989
|
return Math.max(maxZIndex, box.zIndex);
|
|
842
990
|
}
|
|
843
991
|
return maxZIndex;
|
|
@@ -869,7 +1017,9 @@ export class TeleBoxManager {
|
|
|
869
1017
|
smartPosition = true
|
|
870
1018
|
): ReadonlyTeleBox {
|
|
871
1019
|
const box = new TeleBox({
|
|
872
|
-
zIndex: config.forceTop
|
|
1020
|
+
zIndex: config.forceTop
|
|
1021
|
+
? this.getMaxForceTopBoxZIndex() + 1
|
|
1022
|
+
: this.getMaxNormalBoxZIndex() + 1,
|
|
873
1023
|
...(smartPosition ? this.smartPosition(config) : config),
|
|
874
1024
|
darkMode: this.darkMode,
|
|
875
1025
|
prefersColorScheme: this.prefersColorScheme,
|
|
@@ -879,6 +1029,7 @@ export class TeleBoxManager {
|
|
|
879
1029
|
namespace: this.namespace,
|
|
880
1030
|
containerRect: this.containerRect,
|
|
881
1031
|
readonly: this.readonly,
|
|
1032
|
+
forceMaximized: this.forceMaximized,
|
|
882
1033
|
collectorRect: this.collectorRect,
|
|
883
1034
|
});
|
|
884
1035
|
|
|
@@ -887,10 +1038,15 @@ export class TeleBoxManager {
|
|
|
887
1038
|
this.boxes$.setValue([...this.boxes, box]);
|
|
888
1039
|
|
|
889
1040
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
890
|
-
this.setBox(
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
1041
|
+
this.setBox(
|
|
1042
|
+
box,
|
|
1043
|
+
{
|
|
1044
|
+
status: box.boxStatus,
|
|
1045
|
+
lastNotMinimizedBoxStatus:
|
|
1046
|
+
box._lastNotMinimizedBoxStatus$.value,
|
|
1047
|
+
},
|
|
1048
|
+
true
|
|
1049
|
+
);
|
|
894
1050
|
}
|
|
895
1051
|
|
|
896
1052
|
if (box.focus) {
|
|
@@ -906,43 +1062,64 @@ export class TeleBoxManager {
|
|
|
906
1062
|
return;
|
|
907
1063
|
}
|
|
908
1064
|
if (box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
909
|
-
this.setBox(
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
1065
|
+
this.setBox(
|
|
1066
|
+
box.id,
|
|
1067
|
+
{
|
|
1068
|
+
status: TELE_BOX_STATE.Normal,
|
|
1069
|
+
zIndex: this.getMaxNormalBoxZIndex() + 1,
|
|
1070
|
+
},
|
|
1071
|
+
false
|
|
1072
|
+
);
|
|
913
1073
|
} else {
|
|
914
1074
|
// 所有normal box都最大化
|
|
915
|
-
[...this.boxes]
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
1075
|
+
[...this.boxes]
|
|
1076
|
+
.filter(
|
|
1077
|
+
(box) =>
|
|
1078
|
+
box.boxStatus === TELE_BOX_STATE.Normal &&
|
|
1079
|
+
!this.isForceNormal(box)
|
|
1080
|
+
)
|
|
1081
|
+
.sort((a, b) => a.zIndex - b.zIndex)
|
|
1082
|
+
.forEach((box) => {
|
|
1083
|
+
if (box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
1084
|
+
this.setBox(
|
|
1085
|
+
box.id,
|
|
1086
|
+
{
|
|
1087
|
+
status: TELE_BOX_STATE.Maximized,
|
|
1088
|
+
zIndex:
|
|
1089
|
+
this.getMaxMaximizedBoxZIndex() + 1,
|
|
1090
|
+
},
|
|
1091
|
+
false
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
923
1095
|
this.makeMaximizedTopBoxFocus();
|
|
924
1096
|
}
|
|
925
1097
|
} else {
|
|
926
|
-
|
|
1098
|
+
if (!(this.forceMaximized && this.maximized)) {
|
|
1099
|
+
this.setMaximized(!this.maximized);
|
|
1100
|
+
}
|
|
927
1101
|
}
|
|
928
|
-
|
|
929
1102
|
});
|
|
930
1103
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
|
|
931
1104
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
932
1105
|
if (box._forceNormal$.value) {
|
|
933
1106
|
return;
|
|
934
1107
|
}
|
|
935
|
-
if(box.focus) {
|
|
1108
|
+
if (box.focus) {
|
|
936
1109
|
this.blurBox(box);
|
|
937
1110
|
}
|
|
938
|
-
this.setBox(
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1111
|
+
this.setBox(
|
|
1112
|
+
box,
|
|
1113
|
+
{
|
|
1114
|
+
status: TELE_BOX_STATE.Minimized,
|
|
1115
|
+
zIndex: -1,
|
|
1116
|
+
},
|
|
1117
|
+
false,
|
|
1118
|
+
() => {
|
|
1119
|
+
this.focusTopBox();
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
} else {
|
|
946
1123
|
this.setMinimized(true);
|
|
947
1124
|
}
|
|
948
1125
|
});
|
|
@@ -985,7 +1162,10 @@ export class TeleBoxManager {
|
|
|
985
1162
|
if (this.isForceTop(box)) {
|
|
986
1163
|
return topBox;
|
|
987
1164
|
}
|
|
988
|
-
if (
|
|
1165
|
+
if (
|
|
1166
|
+
box.boxStatus &&
|
|
1167
|
+
box.boxStatus === TELE_BOX_STATE.Minimized
|
|
1168
|
+
) {
|
|
989
1169
|
return topBox;
|
|
990
1170
|
}
|
|
991
1171
|
if (!topBox) {
|
|
@@ -993,7 +1173,7 @@ export class TeleBoxManager {
|
|
|
993
1173
|
return topBox;
|
|
994
1174
|
}
|
|
995
1175
|
return topBox.zIndex > box.zIndex ? topBox : box;
|
|
996
|
-
}, currentTopBox as
|
|
1176
|
+
}, currentTopBox as TeleBox | undefined);
|
|
997
1177
|
this.topBox$.setValue(topBox);
|
|
998
1178
|
}
|
|
999
1179
|
if (!skipUpdate) {
|
|
@@ -1039,14 +1219,19 @@ export class TeleBoxManager {
|
|
|
1039
1219
|
});
|
|
1040
1220
|
}
|
|
1041
1221
|
|
|
1042
|
-
public setBox(
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1222
|
+
public setBox(
|
|
1223
|
+
boxOrID: string | TeleBox,
|
|
1224
|
+
options: {
|
|
1225
|
+
status?: TeleBoxState;
|
|
1226
|
+
lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
|
|
1227
|
+
zIndex?: number;
|
|
1228
|
+
},
|
|
1229
|
+
skipUpdate = false,
|
|
1230
|
+
effectFunc?: () => void
|
|
1231
|
+
) {
|
|
1232
|
+
const box = this.getBox(boxOrID);
|
|
1048
1233
|
if (box) {
|
|
1049
|
-
const {status, zIndex, lastNotMinimizedBoxStatus} = options;
|
|
1234
|
+
const { status, zIndex, lastNotMinimizedBoxStatus } = options;
|
|
1050
1235
|
if (status) {
|
|
1051
1236
|
this.setBoxStatus(box.id, status, skipUpdate);
|
|
1052
1237
|
box.setBoxStatus(status, skipUpdate);
|
|
@@ -1056,8 +1241,15 @@ export class TeleBoxManager {
|
|
|
1056
1241
|
box.setZIndex(zIndex, skipUpdate);
|
|
1057
1242
|
}
|
|
1058
1243
|
if (lastNotMinimizedBoxStatus) {
|
|
1059
|
-
this.setLastNotMinimizedBoxStatus(
|
|
1060
|
-
|
|
1244
|
+
this.setLastNotMinimizedBoxStatus(
|
|
1245
|
+
box.id,
|
|
1246
|
+
lastNotMinimizedBoxStatus,
|
|
1247
|
+
skipUpdate
|
|
1248
|
+
);
|
|
1249
|
+
box.setLastNotMinimizedBoxStatus(
|
|
1250
|
+
lastNotMinimizedBoxStatus,
|
|
1251
|
+
skipUpdate
|
|
1252
|
+
);
|
|
1061
1253
|
}
|
|
1062
1254
|
effectFunc && effectFunc();
|
|
1063
1255
|
}
|
|
@@ -1077,12 +1269,16 @@ export class TeleBoxManager {
|
|
|
1077
1269
|
deletedBoxes.forEach((box) => box.destroy());
|
|
1078
1270
|
if (box && this.useBoxesStatus) {
|
|
1079
1271
|
this.setBoxStatus(box.id, undefined, skipUpdate);
|
|
1080
|
-
this.setLastNotMinimizedBoxStatus(
|
|
1272
|
+
this.setLastNotMinimizedBoxStatus(
|
|
1273
|
+
box.id,
|
|
1274
|
+
undefined,
|
|
1275
|
+
skipUpdate
|
|
1276
|
+
);
|
|
1081
1277
|
this.effectBoxStatusChange();
|
|
1082
1278
|
effectFunc && effectFunc();
|
|
1083
1279
|
}
|
|
1084
1280
|
if (!skipUpdate) {
|
|
1085
|
-
if (this.boxes.length <= 0) {
|
|
1281
|
+
if (this.boxes.length <= 0 && !this.forceMaximized) {
|
|
1086
1282
|
this.setMaximized(false);
|
|
1087
1283
|
this.setMinimized(false);
|
|
1088
1284
|
}
|
|
@@ -1107,7 +1303,7 @@ export class TeleBoxManager {
|
|
|
1107
1303
|
this.boxesStatus$.clear();
|
|
1108
1304
|
this.lastNotMinimizedBoxesStatus$.clear();
|
|
1109
1305
|
if (!skipUpdate) {
|
|
1110
|
-
if (this.boxes.length <= 0) {
|
|
1306
|
+
if (this.boxes.length <= 0 && !this.forceMaximized) {
|
|
1111
1307
|
this.setMaximized(false);
|
|
1112
1308
|
this.setMinimized(false);
|
|
1113
1309
|
}
|
|
@@ -1155,7 +1351,10 @@ export class TeleBoxManager {
|
|
|
1155
1351
|
});
|
|
1156
1352
|
if (!this.useBoxesStatus) {
|
|
1157
1353
|
this.maxTitleBar.focusBox(targetBox);
|
|
1158
|
-
} else if (
|
|
1354
|
+
} else if (
|
|
1355
|
+
this.useBoxesStatus &&
|
|
1356
|
+
this.maxTitleBar.hasMaximizedBoxInStatus()
|
|
1357
|
+
) {
|
|
1159
1358
|
this.makeMaximizedTopBoxFocus();
|
|
1160
1359
|
}
|
|
1161
1360
|
}
|
|
@@ -1262,11 +1461,18 @@ export class TeleBoxManager {
|
|
|
1262
1461
|
if (config.footer != null) {
|
|
1263
1462
|
box.mountFooter(config.footer);
|
|
1264
1463
|
}
|
|
1265
|
-
if (
|
|
1266
|
-
this.
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1464
|
+
if (
|
|
1465
|
+
this.useBoxesStatus &&
|
|
1466
|
+
(config.boxStatus || config.lastNotMinimizedBoxStatus)
|
|
1467
|
+
) {
|
|
1468
|
+
this.setBox(
|
|
1469
|
+
box,
|
|
1470
|
+
{
|
|
1471
|
+
status: config.boxStatus,
|
|
1472
|
+
lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus,
|
|
1473
|
+
},
|
|
1474
|
+
skipUpdate
|
|
1475
|
+
);
|
|
1270
1476
|
}
|
|
1271
1477
|
if (config.forceTop != null) {
|
|
1272
1478
|
box.setForceTop(config.forceTop, skipUpdate);
|
|
@@ -1288,7 +1494,8 @@ export class TeleBoxManager {
|
|
|
1288
1494
|
vx = forceTopBox.intrinsicX * this.containerRect.width + 20;
|
|
1289
1495
|
if (
|
|
1290
1496
|
vx >
|
|
1291
|
-
this.containerRect.width -
|
|
1497
|
+
this.containerRect.width -
|
|
1498
|
+
width * this.containerRect.width
|
|
1292
1499
|
) {
|
|
1293
1500
|
vx = 20;
|
|
1294
1501
|
}
|
|
@@ -1303,9 +1510,21 @@ export class TeleBoxManager {
|
|
|
1303
1510
|
}
|
|
1304
1511
|
} else if (this.hasMinimizedBox()) {
|
|
1305
1512
|
// 如果都最小化,则获取lastNotMinimizedBoxesStatus中normal box的最大x
|
|
1306
|
-
vx = [...this.boxes]
|
|
1307
|
-
|
|
1308
|
-
|
|
1513
|
+
vx = [...this.boxes]
|
|
1514
|
+
.filter(
|
|
1515
|
+
(box) =>
|
|
1516
|
+
box.boxStatus &&
|
|
1517
|
+
box.boxStatus === TELE_BOX_STATE.Minimized &&
|
|
1518
|
+
box.lastNotMinimizedBoxStatus &&
|
|
1519
|
+
box.lastNotMinimizedBoxStatus ===
|
|
1520
|
+
TELE_BOX_STATE.Normal
|
|
1521
|
+
)
|
|
1522
|
+
.reduce((maxX, box) => {
|
|
1523
|
+
return Math.max(
|
|
1524
|
+
maxX,
|
|
1525
|
+
box.intrinsicX * this.containerRect.width + 20
|
|
1526
|
+
);
|
|
1527
|
+
}, vx);
|
|
1309
1528
|
}
|
|
1310
1529
|
x = vx / this.containerRect.width;
|
|
1311
1530
|
}
|
|
@@ -1315,7 +1534,8 @@ export class TeleBoxManager {
|
|
|
1315
1534
|
if (config.forceTop) {
|
|
1316
1535
|
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
1317
1536
|
if (forceTopBox) {
|
|
1318
|
-
vy =
|
|
1537
|
+
vy =
|
|
1538
|
+
forceTopBox.intrinsicY * this.containerRect.height + 20;
|
|
1319
1539
|
|
|
1320
1540
|
if (
|
|
1321
1541
|
vy >
|
|
@@ -1337,9 +1557,21 @@ export class TeleBoxManager {
|
|
|
1337
1557
|
}
|
|
1338
1558
|
} else if (this.hasMinimizedBox()) {
|
|
1339
1559
|
// 如果都最小化,则获取lastNotMinimizedBoxesStatus中normal box的最大y
|
|
1340
|
-
vy = [...this.boxes]
|
|
1341
|
-
|
|
1342
|
-
|
|
1560
|
+
vy = [...this.boxes]
|
|
1561
|
+
.filter(
|
|
1562
|
+
(box) =>
|
|
1563
|
+
box.boxStatus &&
|
|
1564
|
+
box.boxStatus === TELE_BOX_STATE.Minimized &&
|
|
1565
|
+
box.lastNotMinimizedBoxStatus &&
|
|
1566
|
+
box.lastNotMinimizedBoxStatus ===
|
|
1567
|
+
TELE_BOX_STATE.Normal
|
|
1568
|
+
)
|
|
1569
|
+
.reduce((maxY, box) => {
|
|
1570
|
+
return Math.max(
|
|
1571
|
+
maxY,
|
|
1572
|
+
box.intrinsicY * this.containerRect.height + 20
|
|
1573
|
+
);
|
|
1574
|
+
}, vy);
|
|
1343
1575
|
}
|
|
1344
1576
|
|
|
1345
1577
|
y = vy / this.containerRect.height;
|
|
@@ -1364,12 +1596,16 @@ export class TeleBoxManager {
|
|
|
1364
1596
|
}
|
|
1365
1597
|
let maximizedBox: MaxTitleBarTeleBox | undefined;
|
|
1366
1598
|
if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
|
|
1367
|
-
maximizedBox = this.maxTitleBar.MaximizedBoxes.reduce(
|
|
1368
|
-
|
|
1369
|
-
|
|
1599
|
+
maximizedBox = this.maxTitleBar.MaximizedBoxes.reduce(
|
|
1600
|
+
(topBox, currentBox) => {
|
|
1601
|
+
if (!topBox) {
|
|
1602
|
+
return currentBox;
|
|
1603
|
+
}
|
|
1604
|
+
return topBox.zIndex > currentBox.zIndex
|
|
1605
|
+
? topBox
|
|
1606
|
+
: currentBox;
|
|
1370
1607
|
}
|
|
1371
|
-
|
|
1372
|
-
}, );
|
|
1608
|
+
);
|
|
1373
1609
|
}
|
|
1374
1610
|
return maximizedBox;
|
|
1375
1611
|
}
|
|
@@ -1378,7 +1614,8 @@ export class TeleBoxManager {
|
|
|
1378
1614
|
if (!this.useBoxesStatus) {
|
|
1379
1615
|
return;
|
|
1380
1616
|
}
|
|
1381
|
-
const maximizedBox: MaxTitleBarTeleBox | undefined =
|
|
1617
|
+
const maximizedBox: MaxTitleBarTeleBox | undefined =
|
|
1618
|
+
this.getMaximizedTopBox();
|
|
1382
1619
|
this.maxTitleBar.focusBox(maximizedBox);
|
|
1383
1620
|
}
|
|
1384
1621
|
|
|
@@ -1394,15 +1631,15 @@ export class TeleBoxManager {
|
|
|
1394
1631
|
: boxOrID;
|
|
1395
1632
|
}
|
|
1396
1633
|
|
|
1397
|
-
public createMinimizedAppMenu():AppMenu | undefined {
|
|
1634
|
+
public createMinimizedAppMenu(): AppMenu | undefined {
|
|
1398
1635
|
if (this.collector?.$appMenuContainer) {
|
|
1399
1636
|
return new AppMenu({
|
|
1400
1637
|
manager: this,
|
|
1401
1638
|
container: this.collector?.$appMenuContainer,
|
|
1402
|
-
theme: this.prefersColorScheme ?
|
|
1639
|
+
theme: this.prefersColorScheme ? "dark" : "light",
|
|
1403
1640
|
getBoxesStatus: () => {
|
|
1404
1641
|
return this.boxesStatus$;
|
|
1405
|
-
}
|
|
1642
|
+
},
|
|
1406
1643
|
});
|
|
1407
1644
|
}
|
|
1408
1645
|
return;
|