@netless/telebox-insider 0.3.0-beta.11 → 0.3.0-beta.13
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 +33 -6
- package/dist/telebox-insider.cjs.js +114 -13
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +114 -13
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/TeleBox/constants.ts +2 -0
- package/src/TeleBox/index.ts +34 -1
- package/src/TeleBox/typings.ts +8 -0
- package/src/TeleBoxManager/MaxTitleBar/index.ts +2 -2
- package/src/TeleBoxManager/index.ts +86 -8
- package/src/TeleBoxManager/typings.ts +4 -1
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +26 -17
- package/src/TeleTitleBar/typings.ts +3 -0
package/package.json
CHANGED
package/src/TeleBox/constants.ts
CHANGED
package/src/TeleBox/index.ts
CHANGED
|
@@ -72,6 +72,12 @@ type ValConfig = {
|
|
|
72
72
|
$userContent: Val<HTMLElement | undefined>;
|
|
73
73
|
$userFooter: Val<HTMLElement | undefined>;
|
|
74
74
|
$userStyles: Val<HTMLStyleElement | undefined>;
|
|
75
|
+
/** Force top. */
|
|
76
|
+
forceTop: Val<boolean, boolean>;
|
|
77
|
+
/** Force normal. */
|
|
78
|
+
forceNormal: Val<boolean, boolean>;
|
|
79
|
+
/** Drag content. */
|
|
80
|
+
isDragContent: Val<boolean, boolean>;
|
|
75
81
|
};
|
|
76
82
|
export interface TeleBox extends ValEnhancedResult<ValConfig> {}
|
|
77
83
|
|
|
@@ -110,7 +116,10 @@ export class TeleBox {
|
|
|
110
116
|
},
|
|
111
117
|
collectorRect,
|
|
112
118
|
boxStatus,
|
|
113
|
-
lastNotMinimizedBoxStatus
|
|
119
|
+
lastNotMinimizedBoxStatus,
|
|
120
|
+
forceTop = false,
|
|
121
|
+
forceNormal = false,
|
|
122
|
+
isDragContent = false,
|
|
114
123
|
}: TeleBoxConfig = {}) {
|
|
115
124
|
this._sideEffect = new SideEffectManager();
|
|
116
125
|
this._valSideEffectBinder = createSideEffectBinder(this._sideEffect);
|
|
@@ -182,6 +191,21 @@ export class TeleBox {
|
|
|
182
191
|
const containerRect$ = createVal(containerRect, shallowequal);
|
|
183
192
|
const collectorRect$ = createVal(collectorRect, shallowequal);
|
|
184
193
|
|
|
194
|
+
const forceTop$ = createVal(forceTop);
|
|
195
|
+
forceTop$.reaction((forceTop, _, skipUpdate) => {
|
|
196
|
+
if (!skipUpdate) {
|
|
197
|
+
this.events.emit(TELE_BOX_EVENT.ForceTop, forceTop || false);
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const forceNormal$ = createVal(forceNormal);
|
|
202
|
+
forceNormal$.reaction((forceNormal, _, skipUpdate) => {
|
|
203
|
+
if (!skipUpdate) {
|
|
204
|
+
this.events.emit(TELE_BOX_EVENT.ForceNormal, forceNormal || false);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
const isDragContent$ = createVal(isDragContent);
|
|
208
|
+
|
|
185
209
|
const title$ = createVal(title);
|
|
186
210
|
title$.reaction((title, _, skipUpdate) => {
|
|
187
211
|
if (!skipUpdate) {
|
|
@@ -400,6 +424,8 @@ export class TeleBox {
|
|
|
400
424
|
title: title$.value,
|
|
401
425
|
namespace: this.namespace,
|
|
402
426
|
boxStatus: boxStatus$.value,
|
|
427
|
+
forceTop: forceTop$.value,
|
|
428
|
+
forceNormal: forceNormal$.value,
|
|
403
429
|
onDragStart: (event) => this._handleTrackStart?.(event),
|
|
404
430
|
onEvent: (event): void => {
|
|
405
431
|
if (this._delegateEvents.listeners.length > 0) {
|
|
@@ -463,6 +489,9 @@ export class TeleBox {
|
|
|
463
489
|
$userContent: $userContent$,
|
|
464
490
|
$userFooter: $userFooter$,
|
|
465
491
|
$userStyles: $userStyles$,
|
|
492
|
+
forceTop: forceTop$,
|
|
493
|
+
forceNormal: forceNormal$,
|
|
494
|
+
isDragContent: isDragContent$,
|
|
466
495
|
};
|
|
467
496
|
|
|
468
497
|
withValueEnhancer(this, valConfig);
|
|
@@ -989,6 +1018,7 @@ export class TeleBox {
|
|
|
989
1018
|
$titleBar.appendChild(this.titleBar.render());
|
|
990
1019
|
this.$titleBar = $titleBar;
|
|
991
1020
|
|
|
1021
|
+
|
|
992
1022
|
const $contentWrap = document.createElement("div");
|
|
993
1023
|
$contentWrap.className = this.wrapClassName("content-wrap");
|
|
994
1024
|
|
|
@@ -996,6 +1026,9 @@ export class TeleBox {
|
|
|
996
1026
|
$content.className =
|
|
997
1027
|
this.wrapClassName("content") + " tele-fancy-scrollbar";
|
|
998
1028
|
this.$content = $content;
|
|
1029
|
+
if (this.isDragContent) {
|
|
1030
|
+
this.$content.appendChild(this.titleBar.$dragArea);
|
|
1031
|
+
}
|
|
999
1032
|
|
|
1000
1033
|
this._renderSideEffect.add(() => {
|
|
1001
1034
|
let last$userStyles: HTMLStyleElement | undefined;
|
package/src/TeleBox/typings.ts
CHANGED
|
@@ -87,6 +87,12 @@ export interface TeleBoxConfig {
|
|
|
87
87
|
readonly boxStatus?: TeleBoxState;
|
|
88
88
|
/** Last not minimized box status. */
|
|
89
89
|
readonly lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
|
|
90
|
+
/** Force top. */
|
|
91
|
+
readonly forceTop?: boolean;
|
|
92
|
+
/** Force normal. */
|
|
93
|
+
readonly forceNormal?: boolean;
|
|
94
|
+
/** Is drag content. */
|
|
95
|
+
readonly isDragContent?: boolean;
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
|
|
@@ -110,6 +116,8 @@ export type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
|
110
116
|
destroyed: void;
|
|
111
117
|
box_status: { id: string; boxStatus: TeleBoxState };
|
|
112
118
|
last_not_minimized_box_status: { id: string; lastNotMinimizedBoxStatus?: NotMinimizedBoxState };
|
|
119
|
+
force_normal: boolean;
|
|
120
|
+
force_top: boolean;
|
|
113
121
|
}>;
|
|
114
122
|
|
|
115
123
|
export type TeleBoxEvent = keyof TeleBoxEventConfig;
|
|
@@ -5,7 +5,7 @@ import { DefaultTitleBar, DefaultTitleBarConfig } from "../../TeleTitleBar";
|
|
|
5
5
|
import { TELE_BOX_STATE } from "../../TeleBox/constants";
|
|
6
6
|
import { TeleBoxRect, TeleBoxState } from "../../TeleBox/typings";
|
|
7
7
|
|
|
8
|
-
export type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box">;
|
|
8
|
+
export type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box" | "forceTop" | "forceNormal">;
|
|
9
9
|
|
|
10
10
|
export interface MaxTitleBarConfig extends DefaultTitleBarConfig {
|
|
11
11
|
darkMode: boolean;
|
|
@@ -45,7 +45,7 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
45
45
|
if (this.getBoxesStatus) {
|
|
46
46
|
const boxesStatus = this.getBoxesStatus();
|
|
47
47
|
if (boxesStatus) {
|
|
48
|
-
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
|
|
48
|
+
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized && !box.forceTop);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
return [];
|
|
@@ -92,6 +92,9 @@ export class TeleBoxManager {
|
|
|
92
92
|
if (boxes.length > 0) {
|
|
93
93
|
let currentTopBox: TeleBox | undefined = undefined;
|
|
94
94
|
const topBox = boxes.reduce((topBox, box) => {
|
|
95
|
+
if (box.forceTop) {
|
|
96
|
+
return topBox;
|
|
97
|
+
}
|
|
95
98
|
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
96
99
|
return topBox;
|
|
97
100
|
}
|
|
@@ -487,6 +490,23 @@ export class TeleBoxManager {
|
|
|
487
490
|
return this.topBox$.value;
|
|
488
491
|
}
|
|
489
492
|
|
|
493
|
+
public get forceTopBoxes(): TeleBox | undefined {
|
|
494
|
+
return this.boxes.find((box) => box.forceTop);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
public get maxForceTopBox(): TeleBox | undefined {
|
|
498
|
+
return this.boxes.reduce<TeleBox | undefined>((maxTopBox, box) => {
|
|
499
|
+
if (box.forceTop && box.zIndex > (maxTopBox?.zIndex ?? 0)) {
|
|
500
|
+
return box;
|
|
501
|
+
}
|
|
502
|
+
return maxTopBox;
|
|
503
|
+
}, undefined);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
public get forceNormalBoxes(): TeleBox | undefined {
|
|
507
|
+
return this.boxes.find((box) => box.forceNormal);
|
|
508
|
+
}
|
|
509
|
+
|
|
490
510
|
public readonly events = new EventEmitter() as TeleBoxManagerEvents;
|
|
491
511
|
|
|
492
512
|
protected _sideEffect: SideEffectManager;
|
|
@@ -599,7 +619,7 @@ export class TeleBoxManager {
|
|
|
599
619
|
this.boxes.forEach((box) => {
|
|
600
620
|
const boxStatus = this.boxesStatus$.get(box.id);
|
|
601
621
|
if (boxStatus) {
|
|
602
|
-
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > (newTopBox?.zIndex ?? 0)) {
|
|
622
|
+
if (boxStatus !== TELE_BOX_STATE.Minimized && !this.isForceTop(box) && box.zIndex > (newTopBox?.zIndex ?? 0)) {
|
|
603
623
|
newTopBox = box;
|
|
604
624
|
}
|
|
605
625
|
box.setBoxStatus(boxStatus, skipUpdate);
|
|
@@ -803,7 +823,7 @@ export class TeleBoxManager {
|
|
|
803
823
|
return this.getUnabledBoxesStatusZIndex();
|
|
804
824
|
}
|
|
805
825
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
806
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
826
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized && !this.isForceTop(box)) {
|
|
807
827
|
return Math.max(maxZIndex, box.zIndex);
|
|
808
828
|
}
|
|
809
829
|
return maxZIndex;
|
|
@@ -816,19 +836,39 @@ export class TeleBoxManager {
|
|
|
816
836
|
return this.getUnabledBoxesStatusZIndex();
|
|
817
837
|
}
|
|
818
838
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
819
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
839
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal && !this.isForceTop(box)) {
|
|
820
840
|
return Math.max(maxZIndex, box.zIndex);
|
|
821
841
|
}
|
|
822
842
|
return maxZIndex;
|
|
823
843
|
}, 299);
|
|
824
844
|
}
|
|
825
845
|
|
|
846
|
+
public getMaxForceTopBoxZIndex(): number {
|
|
847
|
+
if (!this.useBoxesStatus) {
|
|
848
|
+
return this.getUnabledBoxesStatusZIndex();
|
|
849
|
+
}
|
|
850
|
+
return this.boxes.reduce((maxZIndex, box) => {
|
|
851
|
+
if (box.boxStatus && this.isForceTop(box)) {
|
|
852
|
+
return Math.max(maxZIndex, box.zIndex);
|
|
853
|
+
}
|
|
854
|
+
return maxZIndex;
|
|
855
|
+
}, 699);
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
public isForceNormal(box: TeleBox): boolean {
|
|
859
|
+
return box._forceNormal$.value;
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
public isForceTop(box: TeleBox): boolean {
|
|
863
|
+
return box._forceTop$.value;
|
|
864
|
+
}
|
|
865
|
+
|
|
826
866
|
public create(
|
|
827
867
|
config: TeleBoxManagerCreateConfig = {},
|
|
828
868
|
smartPosition = true
|
|
829
869
|
): ReadonlyTeleBox {
|
|
830
870
|
const box = new TeleBox({
|
|
831
|
-
zIndex: this.getMaxNormalBoxZIndex() + 1,
|
|
871
|
+
zIndex: config.forceTop ? this.getMaxForceTopBoxZIndex() + 1 : this.getMaxNormalBoxZIndex() + 1,
|
|
832
872
|
...(smartPosition ? this.smartPosition(config) : config),
|
|
833
873
|
darkMode: this.darkMode,
|
|
834
874
|
prefersColorScheme: this.prefersColorScheme,
|
|
@@ -861,6 +901,9 @@ export class TeleBoxManager {
|
|
|
861
901
|
|
|
862
902
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
863
903
|
if (this.useBoxesStatus && box.boxStatus) {
|
|
904
|
+
if (box._forceNormal$.value) {
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
864
907
|
if (box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
865
908
|
this.setBox(box.id, {
|
|
866
909
|
status: TELE_BOX_STATE.Normal,
|
|
@@ -868,7 +911,7 @@ export class TeleBoxManager {
|
|
|
868
911
|
}, false);
|
|
869
912
|
} else {
|
|
870
913
|
// 所有normal box都最大化
|
|
871
|
-
[...this.boxes].filter((box) => box.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box) => {
|
|
914
|
+
[...this.boxes].filter((box) => box.boxStatus === TELE_BOX_STATE.Normal && !this.isForceNormal(box)).sort((a, b) => a.zIndex - b.zIndex).forEach((box) => {
|
|
872
915
|
if (box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
873
916
|
this.setBox(box.id, {
|
|
874
917
|
status: TELE_BOX_STATE.Maximized,
|
|
@@ -885,6 +928,9 @@ export class TeleBoxManager {
|
|
|
885
928
|
});
|
|
886
929
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
|
|
887
930
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
931
|
+
if (box._forceNormal$.value) {
|
|
932
|
+
return;
|
|
933
|
+
}
|
|
888
934
|
if(box.focus) {
|
|
889
935
|
this.blurBox(box);
|
|
890
936
|
}
|
|
@@ -935,6 +981,9 @@ export class TeleBoxManager {
|
|
|
935
981
|
if (this.boxes.length > 0) {
|
|
936
982
|
let currentTopBox: TeleBox | undefined = undefined;
|
|
937
983
|
const topBox = this.boxes.reduce((topBox, box) => {
|
|
984
|
+
if (this.isForceTop(box)) {
|
|
985
|
+
return topBox;
|
|
986
|
+
}
|
|
938
987
|
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
939
988
|
return topBox;
|
|
940
989
|
}
|
|
@@ -1218,6 +1267,12 @@ export class TeleBoxManager {
|
|
|
1218
1267
|
lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
|
|
1219
1268
|
}, skipUpdate);
|
|
1220
1269
|
}
|
|
1270
|
+
if (config.forceTop != null) {
|
|
1271
|
+
box.setForceTop(config.forceTop, skipUpdate);
|
|
1272
|
+
}
|
|
1273
|
+
if (config.forceNormal != null) {
|
|
1274
|
+
box.setForceNormal(config.forceNormal, skipUpdate);
|
|
1275
|
+
}
|
|
1221
1276
|
}
|
|
1222
1277
|
|
|
1223
1278
|
protected smartPosition(config: TeleBoxConfig = {}): TeleBoxConfig {
|
|
@@ -1226,7 +1281,18 @@ export class TeleBoxManager {
|
|
|
1226
1281
|
|
|
1227
1282
|
if (x == null) {
|
|
1228
1283
|
let vx = 20;
|
|
1229
|
-
if (
|
|
1284
|
+
if (config.forceTop) {
|
|
1285
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
1286
|
+
if (forceTopBox) {
|
|
1287
|
+
vx = forceTopBox.intrinsicX * this.containerRect.width + 20;
|
|
1288
|
+
if (
|
|
1289
|
+
vx >
|
|
1290
|
+
this.containerRect.width - width * this.containerRect.width
|
|
1291
|
+
) {
|
|
1292
|
+
vx = 20;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
} else if (this.topBox) {
|
|
1230
1296
|
vx = this.topBox.intrinsicX * this.containerRect.width + 20;
|
|
1231
1297
|
if (
|
|
1232
1298
|
vx >
|
|
@@ -1245,8 +1311,20 @@ export class TeleBoxManager {
|
|
|
1245
1311
|
|
|
1246
1312
|
if (y == null) {
|
|
1247
1313
|
let vy = 20;
|
|
1248
|
-
|
|
1249
|
-
|
|
1314
|
+
if (config.forceTop) {
|
|
1315
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
1316
|
+
if (forceTopBox) {
|
|
1317
|
+
vy = forceTopBox.intrinsicY * this.containerRect.height + 20;
|
|
1318
|
+
|
|
1319
|
+
if (
|
|
1320
|
+
vy >
|
|
1321
|
+
this.containerRect.height -
|
|
1322
|
+
height * this.containerRect.height
|
|
1323
|
+
) {
|
|
1324
|
+
vy = 20;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
} else if (this.topBox) {
|
|
1250
1328
|
vy = this.topBox.intrinsicY * this.containerRect.height + 20;
|
|
1251
1329
|
|
|
1252
1330
|
if (
|
|
@@ -38,7 +38,10 @@ type TeleBoxManagerBoxConfigBaseProps =
|
|
|
38
38
|
| "fixRatio"
|
|
39
39
|
| "zIndex"
|
|
40
40
|
| "boxStatus"
|
|
41
|
-
| "lastNotMinimizedBoxStatus"
|
|
41
|
+
| "lastNotMinimizedBoxStatus"
|
|
42
|
+
| "forceTop"
|
|
43
|
+
| "forceNormal"
|
|
44
|
+
| "isDragContent";
|
|
42
45
|
|
|
43
46
|
export type TeleBoxManagerCreateConfig = Pick<
|
|
44
47
|
TeleBoxConfig,
|
|
@@ -27,6 +27,8 @@ export interface DefaultTitleBarConfig extends TeleTitleBarConfig {
|
|
|
27
27
|
|
|
28
28
|
export class DefaultTitleBar implements TeleTitleBar {
|
|
29
29
|
protected boxStatus?: TeleBoxState;
|
|
30
|
+
protected forceTop?: boolean;
|
|
31
|
+
protected forceNormal?: boolean;
|
|
30
32
|
public constructor({
|
|
31
33
|
readonly = false,
|
|
32
34
|
title,
|
|
@@ -36,7 +38,9 @@ export class DefaultTitleBar implements TeleTitleBar {
|
|
|
36
38
|
namespace = "telebox",
|
|
37
39
|
state = TELE_BOX_STATE.Normal,
|
|
38
40
|
boxStatus,
|
|
39
|
-
|
|
41
|
+
forceTop = false,
|
|
42
|
+
forceNormal = false,
|
|
43
|
+
}: DefaultTitleBarConfig = {}) {
|
|
40
44
|
this.readonly = readonly;
|
|
41
45
|
this.onEvent = onEvent;
|
|
42
46
|
this.onDragStart = onDragStart;
|
|
@@ -44,23 +48,29 @@ export class DefaultTitleBar implements TeleTitleBar {
|
|
|
44
48
|
this.title = title;
|
|
45
49
|
this.state = state;
|
|
46
50
|
this.boxStatus = boxStatus;
|
|
51
|
+
this.forceTop = forceTop;
|
|
52
|
+
this.forceNormal = forceNormal;
|
|
47
53
|
|
|
48
|
-
this.buttons = buttons ||
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
iconClassName: this.wrapClassName("titlebar-icon-minimize"),
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
type: TELE_BOX_DELEGATE_EVENT.Maximize,
|
|
55
|
-
iconClassName: this.wrapClassName("titlebar-icon-maximize"),
|
|
56
|
-
isActive: (state) => state === TELE_BOX_STATE.Maximized,
|
|
57
|
-
},
|
|
58
|
-
{
|
|
54
|
+
this.buttons = buttons || (
|
|
55
|
+
forceNormal ? [
|
|
56
|
+
{
|
|
59
57
|
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
60
58
|
iconClassName: this.wrapClassName("titlebar-icon-close"),
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
}] : [
|
|
60
|
+
{
|
|
61
|
+
type: TELE_BOX_DELEGATE_EVENT.Minimize,
|
|
62
|
+
iconClassName: this.wrapClassName("titlebar-icon-minimize"),
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
type: TELE_BOX_DELEGATE_EVENT.Maximize,
|
|
66
|
+
iconClassName: this.wrapClassName("titlebar-icon-maximize"),
|
|
67
|
+
isActive: (state) => state === TELE_BOX_STATE.Maximized,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
71
|
+
iconClassName: this.wrapClassName("titlebar-icon-close"),
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
64
74
|
this.$dragArea = this.renderDragArea();
|
|
65
75
|
}
|
|
66
76
|
|
|
@@ -70,7 +80,7 @@ export class DefaultTitleBar implements TeleTitleBar {
|
|
|
70
80
|
|
|
71
81
|
public $title: HTMLElement | undefined;
|
|
72
82
|
|
|
73
|
-
public $dragArea: HTMLElement;
|
|
83
|
+
public readonly $dragArea: HTMLElement;
|
|
74
84
|
|
|
75
85
|
public setTitle(title: string): void {
|
|
76
86
|
this.title = title;
|
|
@@ -137,7 +147,6 @@ export class DefaultTitleBar implements TeleTitleBar {
|
|
|
137
147
|
|
|
138
148
|
$titleArea.appendChild(this.$title);
|
|
139
149
|
$titleArea.appendChild(this.$dragArea);
|
|
140
|
-
|
|
141
150
|
const $buttonsContainer = document.createElement("div");
|
|
142
151
|
$buttonsContainer.className = this.wrapClassName("titlebar-btns");
|
|
143
152
|
|
|
@@ -12,11 +12,14 @@ export interface TeleTitleBarConfig {
|
|
|
12
12
|
title?: string;
|
|
13
13
|
state?: TeleBoxState;
|
|
14
14
|
namespace?: string;
|
|
15
|
+
forceTop?: boolean;
|
|
16
|
+
forceNormal?: boolean;
|
|
15
17
|
onEvent?: (event: TeleTitleBarEvent) => void;
|
|
16
18
|
onDragStart?: (event: MouseEvent | TouchEvent) => void;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export interface TeleTitleBar {
|
|
22
|
+
readonly $dragArea: HTMLElement;
|
|
20
23
|
setTitle(title: string): void;
|
|
21
24
|
|
|
22
25
|
setState(state: TeleBoxState): void;
|