@netless/telebox-insider 0.3.0-beta.9 → 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 +73 -25
- package/dist/style.css +4 -1
- package/dist/telebox-insider.cjs.js +382 -122
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +382 -122
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/AppMenu/index.ts +0 -1
- package/src/TeleBox/constants.ts +2 -0
- package/src/TeleBox/index.ts +122 -20
- package/src/TeleBox/typings.ts +18 -2
- package/src/TeleBoxCollector/index.ts +2 -1
- package/src/TeleBoxManager/MaxTitleBar/index.ts +2 -2
- package/src/TeleBoxManager/MaxTitleBar/style.scss +1 -1
- package/src/TeleBoxManager/index.ts +475 -190
- package/src/TeleBoxManager/typings.ts +10 -3
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +72 -22
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +5 -0
- package/src/TeleTitleBar/typings.ts +6 -0
|
@@ -1185,6 +1185,8 @@ var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
|
|
|
1185
1185
|
TELE_BOX_EVENT2["Destroyed"] = "destroyed";
|
|
1186
1186
|
TELE_BOX_EVENT2["BoxStatus"] = "box_status";
|
|
1187
1187
|
TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
|
|
1188
|
+
TELE_BOX_EVENT2["ForceTop"] = "force_top";
|
|
1189
|
+
TELE_BOX_EVENT2["ForceNormal"] = "force_normal";
|
|
1188
1190
|
return TELE_BOX_EVENT2;
|
|
1189
1191
|
})(TELE_BOX_EVENT || {});
|
|
1190
1192
|
var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
|
|
@@ -1239,7 +1241,10 @@ class DefaultTitleBar {
|
|
|
1239
1241
|
onDragStart,
|
|
1240
1242
|
namespace = "telebox",
|
|
1241
1243
|
state = TELE_BOX_STATE.Normal,
|
|
1242
|
-
boxStatus
|
|
1244
|
+
boxStatus,
|
|
1245
|
+
forceTop = false,
|
|
1246
|
+
forceNormal = false,
|
|
1247
|
+
forceMaximized = false
|
|
1243
1248
|
} = {}) {
|
|
1244
1249
|
this.$btns = [];
|
|
1245
1250
|
this.sideEffect = new o();
|
|
@@ -1263,7 +1268,7 @@ class DefaultTitleBar {
|
|
|
1263
1268
|
const now = Date.now();
|
|
1264
1269
|
if (now - this.lastTitleBarClick.timestamp <= 500) {
|
|
1265
1270
|
if (Math.abs(ev.clientX - this.lastTitleBarClick.clientX) <= 5 && Math.abs(ev.clientY - this.lastTitleBarClick.clientY) <= 5) {
|
|
1266
|
-
if (this.onEvent) {
|
|
1271
|
+
if (this.onEvent && !this.forceMaximized) {
|
|
1267
1272
|
this.onEvent({ type: TELE_BOX_DELEGATE_EVENT.Maximize });
|
|
1268
1273
|
}
|
|
1269
1274
|
}
|
|
@@ -1295,7 +1300,7 @@ class DefaultTitleBar {
|
|
|
1295
1300
|
} = ev.touches[0] || {};
|
|
1296
1301
|
if (now - this.lastTitleBarTouch.timestamp <= 500) {
|
|
1297
1302
|
if (Math.abs(clientX - this.lastTitleBarTouch.clientX) <= 10 && Math.abs(clientY - this.lastTitleBarTouch.clientY) <= 10) {
|
|
1298
|
-
if (this.onEvent) {
|
|
1303
|
+
if (this.onEvent && !this.forceMaximized) {
|
|
1299
1304
|
this.onEvent({ type: TELE_BOX_DELEGATE_EVENT.Maximize });
|
|
1300
1305
|
}
|
|
1301
1306
|
}
|
|
@@ -1313,21 +1318,37 @@ class DefaultTitleBar {
|
|
|
1313
1318
|
this.title = title;
|
|
1314
1319
|
this.state = state;
|
|
1315
1320
|
this.boxStatus = boxStatus;
|
|
1316
|
-
this.
|
|
1321
|
+
this.forceTop = forceTop;
|
|
1322
|
+
this.forceNormal = forceNormal;
|
|
1323
|
+
this.forceMaximized = forceMaximized;
|
|
1324
|
+
this.buttons = buttons || (forceNormal ? [
|
|
1325
|
+
{
|
|
1326
|
+
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
1327
|
+
iconClassName: this.wrapClassName(
|
|
1328
|
+
"titlebar-icon-close"
|
|
1329
|
+
)
|
|
1330
|
+
}
|
|
1331
|
+
] : [
|
|
1317
1332
|
{
|
|
1318
1333
|
type: TELE_BOX_DELEGATE_EVENT.Minimize,
|
|
1319
|
-
iconClassName: this.wrapClassName(
|
|
1334
|
+
iconClassName: this.wrapClassName(
|
|
1335
|
+
"titlebar-icon-minimize"
|
|
1336
|
+
)
|
|
1320
1337
|
},
|
|
1321
1338
|
{
|
|
1322
1339
|
type: TELE_BOX_DELEGATE_EVENT.Maximize,
|
|
1323
|
-
iconClassName: this.wrapClassName(
|
|
1340
|
+
iconClassName: this.wrapClassName(
|
|
1341
|
+
"titlebar-icon-maximize"
|
|
1342
|
+
),
|
|
1324
1343
|
isActive: (state2) => state2 === TELE_BOX_STATE.Maximized
|
|
1325
1344
|
},
|
|
1326
1345
|
{
|
|
1327
1346
|
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
1328
|
-
iconClassName: this.wrapClassName(
|
|
1347
|
+
iconClassName: this.wrapClassName(
|
|
1348
|
+
"titlebar-icon-close"
|
|
1349
|
+
)
|
|
1329
1350
|
}
|
|
1330
|
-
];
|
|
1351
|
+
]);
|
|
1331
1352
|
this.$dragArea = this.renderDragArea();
|
|
1332
1353
|
}
|
|
1333
1354
|
setTitle(title) {
|
|
@@ -1370,6 +1391,20 @@ class DefaultTitleBar {
|
|
|
1370
1391
|
this.readonly = readonly;
|
|
1371
1392
|
}
|
|
1372
1393
|
}
|
|
1394
|
+
setForceMaximized(forceMaximized) {
|
|
1395
|
+
this.forceMaximized = forceMaximized;
|
|
1396
|
+
this.$btns.forEach((button, index2) => {
|
|
1397
|
+
var _a;
|
|
1398
|
+
if (((_a = this.buttons[index2]) == null ? void 0 : _a.type) === TELE_BOX_DELEGATE_EVENT.Maximize) {
|
|
1399
|
+
button.disabled = forceMaximized;
|
|
1400
|
+
button.setAttribute("aria-disabled", String(forceMaximized));
|
|
1401
|
+
button.classList.toggle(
|
|
1402
|
+
this.wrapClassName("disabled"),
|
|
1403
|
+
forceMaximized
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1373
1408
|
render() {
|
|
1374
1409
|
if (!this.$titleBar) {
|
|
1375
1410
|
this.$titleBar = document.createElement("div");
|
|
@@ -1397,7 +1432,10 @@ class DefaultTitleBar {
|
|
|
1397
1432
|
$btn.dataset.teleTitleBarBtnIndex = teleTitleBarBtnIndex;
|
|
1398
1433
|
$btn.dataset.teleTitleBarNoDblClick = "true";
|
|
1399
1434
|
if (isActive) {
|
|
1400
|
-
$btn.classList.toggle(
|
|
1435
|
+
$btn.classList.toggle(
|
|
1436
|
+
"is-active",
|
|
1437
|
+
isActive(this.boxStatus || this.state)
|
|
1438
|
+
);
|
|
1401
1439
|
}
|
|
1402
1440
|
this.$btns.push($btn);
|
|
1403
1441
|
$buttonsContainer.appendChild($btn);
|
|
@@ -1417,6 +1455,9 @@ class DefaultTitleBar {
|
|
|
1417
1455
|
if (!Number.isNaN(teleTitleBarBtnIndex) && teleTitleBarBtnIndex < this.buttons.length) {
|
|
1418
1456
|
preventEvent(ev);
|
|
1419
1457
|
const btn = this.buttons[teleTitleBarBtnIndex];
|
|
1458
|
+
if (this.forceMaximized && btn.type === TELE_BOX_DELEGATE_EVENT.Maximize) {
|
|
1459
|
+
return;
|
|
1460
|
+
}
|
|
1420
1461
|
if (this.onEvent) {
|
|
1421
1462
|
this.onEvent({
|
|
1422
1463
|
type: btn.type,
|
|
@@ -1428,6 +1469,7 @@ class DefaultTitleBar {
|
|
|
1428
1469
|
);
|
|
1429
1470
|
this.$titleBar.appendChild($titleArea);
|
|
1430
1471
|
this.$titleBar.appendChild($buttonsContainer);
|
|
1472
|
+
this.setForceMaximized(Boolean(this.forceMaximized));
|
|
1431
1473
|
}
|
|
1432
1474
|
return this.$titleBar;
|
|
1433
1475
|
}
|
|
@@ -1500,7 +1542,11 @@ class TeleBox {
|
|
|
1500
1542
|
},
|
|
1501
1543
|
collectorRect,
|
|
1502
1544
|
boxStatus,
|
|
1503
|
-
lastNotMinimizedBoxStatus
|
|
1545
|
+
lastNotMinimizedBoxStatus,
|
|
1546
|
+
forceTop = false,
|
|
1547
|
+
forceNormal = false,
|
|
1548
|
+
forceMaximized = false,
|
|
1549
|
+
isDragContent = false
|
|
1504
1550
|
} = {}) {
|
|
1505
1551
|
this._renderSideEffect = new o();
|
|
1506
1552
|
this.handleTrackStart = (ev) => {
|
|
@@ -1514,7 +1560,9 @@ class TeleBox {
|
|
|
1514
1560
|
this.namespace = namespace;
|
|
1515
1561
|
this.events = new EventEmitter();
|
|
1516
1562
|
this._delegateEvents = new EventEmitter();
|
|
1517
|
-
const boxStatus$ = createVal(
|
|
1563
|
+
const boxStatus$ = createVal(
|
|
1564
|
+
boxStatus
|
|
1565
|
+
);
|
|
1518
1566
|
const lastNotMinimizedBoxStatus$ = createVal(lastNotMinimizedBoxStatus);
|
|
1519
1567
|
const prefersColorScheme$ = createVal(
|
|
1520
1568
|
prefersColorScheme
|
|
@@ -1567,6 +1615,23 @@ class TeleBox {
|
|
|
1567
1615
|
});
|
|
1568
1616
|
const containerRect$ = createVal(containerRect, shallowequal);
|
|
1569
1617
|
const collectorRect$ = createVal(collectorRect, shallowequal);
|
|
1618
|
+
const forceTop$ = createVal(forceTop);
|
|
1619
|
+
forceTop$.reaction((forceTop2, _, skipUpdate) => {
|
|
1620
|
+
if (!skipUpdate) {
|
|
1621
|
+
this.events.emit(TELE_BOX_EVENT.ForceTop, forceTop2 || false);
|
|
1622
|
+
}
|
|
1623
|
+
});
|
|
1624
|
+
const forceNormal$ = createVal(forceNormal);
|
|
1625
|
+
const forceMaximized$ = createVal(forceMaximized);
|
|
1626
|
+
forceNormal$.reaction((forceNormal2, _, skipUpdate) => {
|
|
1627
|
+
if (!skipUpdate) {
|
|
1628
|
+
this.events.emit(
|
|
1629
|
+
TELE_BOX_EVENT.ForceNormal,
|
|
1630
|
+
forceNormal2 || false
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
});
|
|
1634
|
+
const isDragContent$ = createVal(isDragContent);
|
|
1570
1635
|
const title$ = createVal(title);
|
|
1571
1636
|
title$.reaction((title2, _, skipUpdate) => {
|
|
1572
1637
|
if (!skipUpdate) {
|
|
@@ -1744,6 +1809,9 @@ class TeleBox {
|
|
|
1744
1809
|
title: title$.value,
|
|
1745
1810
|
namespace: this.namespace,
|
|
1746
1811
|
boxStatus: boxStatus$.value,
|
|
1812
|
+
forceTop: forceTop$.value,
|
|
1813
|
+
forceNormal: forceNormal$.value,
|
|
1814
|
+
forceMaximized: forceMaximized$.value,
|
|
1747
1815
|
onDragStart: (event) => {
|
|
1748
1816
|
var _a;
|
|
1749
1817
|
return (_a = this._handleTrackStart) == null ? void 0 : _a.call(this, event);
|
|
@@ -1754,7 +1822,7 @@ class TeleBox {
|
|
|
1754
1822
|
} else {
|
|
1755
1823
|
switch (event.type) {
|
|
1756
1824
|
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
1757
|
-
if (!boxStatus$.value) {
|
|
1825
|
+
if (!boxStatus$.value && !(forceMaximized$.value && maximized$.value)) {
|
|
1758
1826
|
maximized$.setValue(!maximized$.value);
|
|
1759
1827
|
}
|
|
1760
1828
|
break;
|
|
@@ -1783,6 +1851,9 @@ class TeleBox {
|
|
|
1783
1851
|
readonly$.reaction((readonly2) => {
|
|
1784
1852
|
this.titleBar.setReadonly(readonly2);
|
|
1785
1853
|
});
|
|
1854
|
+
forceMaximized$.reaction((forceMaximized2) => {
|
|
1855
|
+
this.titleBar.setForceMaximized(forceMaximized2);
|
|
1856
|
+
});
|
|
1786
1857
|
boxStatus$.reaction((boxStatus2) => {
|
|
1787
1858
|
this.titleBar.setBoxStatus(boxStatus2);
|
|
1788
1859
|
});
|
|
@@ -1807,7 +1878,11 @@ class TeleBox {
|
|
|
1807
1878
|
maximized: maximized$,
|
|
1808
1879
|
$userContent: $userContent$,
|
|
1809
1880
|
$userFooter: $userFooter$,
|
|
1810
|
-
$userStyles: $userStyles
|
|
1881
|
+
$userStyles: $userStyles$,
|
|
1882
|
+
forceTop: forceTop$,
|
|
1883
|
+
forceNormal: forceNormal$,
|
|
1884
|
+
forceMaximized: forceMaximized$,
|
|
1885
|
+
isDragContent: isDragContent$
|
|
1811
1886
|
};
|
|
1812
1887
|
i(this, valConfig);
|
|
1813
1888
|
this._state$ = state$;
|
|
@@ -1868,21 +1943,33 @@ class TeleBox {
|
|
|
1868
1943
|
setBoxStatus(boxStatus, skipUpdate = false) {
|
|
1869
1944
|
if (boxStatus === TELE_BOX_STATE.Minimized) {
|
|
1870
1945
|
if (this._boxStatus$.value && this._boxStatus$.value !== TELE_BOX_STATE.Minimized) {
|
|
1871
|
-
this.setLastNotMinimizedBoxStatus(
|
|
1946
|
+
this.setLastNotMinimizedBoxStatus(
|
|
1947
|
+
this._boxStatus$.value,
|
|
1948
|
+
skipUpdate
|
|
1949
|
+
);
|
|
1872
1950
|
}
|
|
1873
1951
|
} else {
|
|
1874
1952
|
this.setLastNotMinimizedBoxStatus(void 0, skipUpdate);
|
|
1875
1953
|
}
|
|
1876
1954
|
this._boxStatus$.setValue(boxStatus, skipUpdate);
|
|
1877
1955
|
if (!skipUpdate) {
|
|
1878
|
-
this.events.emit(TELE_BOX_EVENT.BoxStatus, {
|
|
1956
|
+
this.events.emit(TELE_BOX_EVENT.BoxStatus, {
|
|
1957
|
+
id: this.id,
|
|
1958
|
+
boxStatus
|
|
1959
|
+
});
|
|
1879
1960
|
}
|
|
1880
1961
|
return this;
|
|
1881
1962
|
}
|
|
1882
1963
|
setLastNotMinimizedBoxStatus(lastNotMinimizedBoxStatus, skipUpdate = false) {
|
|
1883
|
-
this._lastNotMinimizedBoxStatus$.setValue(
|
|
1964
|
+
this._lastNotMinimizedBoxStatus$.setValue(
|
|
1965
|
+
lastNotMinimizedBoxStatus,
|
|
1966
|
+
skipUpdate
|
|
1967
|
+
);
|
|
1884
1968
|
if (!skipUpdate) {
|
|
1885
|
-
this.events.emit(TELE_BOX_EVENT.LastNotMinimizedBoxStatus, {
|
|
1969
|
+
this.events.emit(TELE_BOX_EVENT.LastNotMinimizedBoxStatus, {
|
|
1970
|
+
id: this.id,
|
|
1971
|
+
lastNotMinimizedBoxStatus
|
|
1972
|
+
});
|
|
1886
1973
|
}
|
|
1887
1974
|
return this;
|
|
1888
1975
|
}
|
|
@@ -2115,7 +2202,14 @@ class TeleBox {
|
|
|
2115
2202
|
this._collectorRect$,
|
|
2116
2203
|
this._boxStatus$
|
|
2117
2204
|
],
|
|
2118
|
-
([
|
|
2205
|
+
([
|
|
2206
|
+
coord,
|
|
2207
|
+
size,
|
|
2208
|
+
minimized,
|
|
2209
|
+
containerRect,
|
|
2210
|
+
collectorRect,
|
|
2211
|
+
boxStatus
|
|
2212
|
+
]) => {
|
|
2119
2213
|
const absoluteWidth = size.width * containerRect.width;
|
|
2120
2214
|
const absoluteHeight = size.height * containerRect.height;
|
|
2121
2215
|
return {
|
|
@@ -2144,6 +2238,9 @@ class TeleBox {
|
|
|
2144
2238
|
const $content = document.createElement("div");
|
|
2145
2239
|
$content.className = this.wrapClassName("content") + " tele-fancy-scrollbar";
|
|
2146
2240
|
this.$content = $content;
|
|
2241
|
+
if (this.isDragContent) {
|
|
2242
|
+
this.$content.appendChild(this.titleBar.$dragArea);
|
|
2243
|
+
}
|
|
2147
2244
|
this._renderSideEffect.add(() => {
|
|
2148
2245
|
let last$userStyles;
|
|
2149
2246
|
return this._$userStyles$.subscribe(($userStyles) => {
|
|
@@ -2573,6 +2670,7 @@ class TeleBoxCollector {
|
|
|
2573
2670
|
return `${this.namespace}-${className}`;
|
|
2574
2671
|
}
|
|
2575
2672
|
}
|
|
2673
|
+
TeleBoxCollector.kind = "TeleBoxCollector";
|
|
2576
2674
|
var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
|
|
2577
2675
|
TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
|
|
2578
2676
|
TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
|
|
@@ -2621,7 +2719,7 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2621
2719
|
if (this.getBoxesStatus) {
|
|
2622
2720
|
const boxesStatus = this.getBoxesStatus();
|
|
2623
2721
|
if (boxesStatus) {
|
|
2624
|
-
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
|
|
2722
|
+
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized && !box.forceTop);
|
|
2625
2723
|
}
|
|
2626
2724
|
}
|
|
2627
2725
|
return [];
|
|
@@ -2900,7 +2998,6 @@ class AppMenu {
|
|
|
2900
2998
|
createMinimizedItem(appId) {
|
|
2901
2999
|
const appItem = document.createElement("div");
|
|
2902
3000
|
appItem.classList.add(this.c("app-menu-item"));
|
|
2903
|
-
console.log("appId=====>", appId);
|
|
2904
3001
|
appItem.setAttribute(`data-${this.c("app-id")}`, appId);
|
|
2905
3002
|
const titleDiv = document.createElement("div");
|
|
2906
3003
|
titleDiv.classList.add(this.c("app-menu-item-title"));
|
|
@@ -2951,6 +3048,7 @@ class TeleBoxManager {
|
|
|
2951
3048
|
collector,
|
|
2952
3049
|
namespace = "telebox",
|
|
2953
3050
|
readonly = false,
|
|
3051
|
+
forceMaximized = false,
|
|
2954
3052
|
useBoxesStatus = false
|
|
2955
3053
|
} = {}) {
|
|
2956
3054
|
this.events = new EventEmitter();
|
|
@@ -2962,9 +3060,11 @@ class TeleBoxManager {
|
|
|
2962
3060
|
this.boxes$ = createVal([]);
|
|
2963
3061
|
this.topBox$ = this.boxes$.derive((boxes) => {
|
|
2964
3062
|
if (boxes.length > 0) {
|
|
2965
|
-
console.log("topBox===>topBox$===>000");
|
|
2966
3063
|
let currentTopBox = void 0;
|
|
2967
3064
|
const topBox = boxes.reduce((topBox2, box) => {
|
|
3065
|
+
if (box.forceTop) {
|
|
3066
|
+
return topBox2;
|
|
3067
|
+
}
|
|
2968
3068
|
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
2969
3069
|
return topBox2;
|
|
2970
3070
|
}
|
|
@@ -2974,7 +3074,6 @@ class TeleBoxManager {
|
|
|
2974
3074
|
}
|
|
2975
3075
|
return topBox2.zIndex > box.zIndex ? topBox2 : box;
|
|
2976
3076
|
}, currentTopBox);
|
|
2977
|
-
console.log("topBox===>topBox$===>end", topBox == null ? void 0 : topBox.id);
|
|
2978
3077
|
return topBox;
|
|
2979
3078
|
}
|
|
2980
3079
|
return;
|
|
@@ -3021,6 +3120,14 @@ class TeleBoxManager {
|
|
|
3021
3120
|
});
|
|
3022
3121
|
const minimized$ = createVal(minimized);
|
|
3023
3122
|
const maximized$ = createVal(maximized);
|
|
3123
|
+
const forceMaximized$ = createVal(forceMaximized);
|
|
3124
|
+
forceMaximized$.reaction((forceMaximized2, _, skipUpdate) => {
|
|
3125
|
+
var _a;
|
|
3126
|
+
this.boxes.forEach(
|
|
3127
|
+
(box) => box.setForceMaximized(forceMaximized2, skipUpdate)
|
|
3128
|
+
);
|
|
3129
|
+
(_a = this.maxTitleBar) == null ? void 0 : _a.setForceMaximized(forceMaximized2);
|
|
3130
|
+
});
|
|
3024
3131
|
maximized$.reaction((maximized2, _, skipUpdate) => {
|
|
3025
3132
|
this.boxes.forEach(
|
|
3026
3133
|
(box) => box.setMaximized(maximized2, skipUpdate)
|
|
@@ -3157,21 +3264,28 @@ class TeleBoxManager {
|
|
|
3157
3264
|
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3158
3265
|
const maxNormalBoxZIndex = this.getMaxNormalBoxZIndex();
|
|
3159
3266
|
if (maxNormalBoxZIndex > box.zIndex) {
|
|
3160
|
-
this.setBox(
|
|
3161
|
-
|
|
3162
|
-
|
|
3267
|
+
this.setBox(
|
|
3268
|
+
box,
|
|
3269
|
+
{
|
|
3270
|
+
zIndex: maxNormalBoxZIndex + 1
|
|
3271
|
+
},
|
|
3272
|
+
false
|
|
3273
|
+
);
|
|
3163
3274
|
}
|
|
3164
3275
|
} else if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3165
3276
|
const maxMaximizedBoxZIndex = this.getMaxMaximizedBoxZIndex();
|
|
3166
3277
|
if (maxMaximizedBoxZIndex > box.zIndex) {
|
|
3167
|
-
this.setBox(
|
|
3168
|
-
|
|
3169
|
-
|
|
3278
|
+
this.setBox(
|
|
3279
|
+
box,
|
|
3280
|
+
{
|
|
3281
|
+
zIndex: maxMaximizedBoxZIndex + 1
|
|
3282
|
+
},
|
|
3283
|
+
false
|
|
3284
|
+
);
|
|
3170
3285
|
}
|
|
3171
3286
|
this.makeMaximizedTopBoxFocus();
|
|
3172
3287
|
}
|
|
3173
3288
|
}
|
|
3174
|
-
console.log("checkFocusBox===>", box.id);
|
|
3175
3289
|
this.focusBox(box);
|
|
3176
3290
|
return;
|
|
3177
3291
|
}
|
|
@@ -3195,6 +3309,7 @@ class TeleBoxManager {
|
|
|
3195
3309
|
readonly: readonly$.value,
|
|
3196
3310
|
namespace: this.namespace,
|
|
3197
3311
|
state: state$.value,
|
|
3312
|
+
forceMaximized: forceMaximized$.value,
|
|
3198
3313
|
boxes: this.boxes$.value,
|
|
3199
3314
|
containerRect: containerRect$.value,
|
|
3200
3315
|
getBoxesStatus: () => {
|
|
@@ -3203,6 +3318,9 @@ class TeleBoxManager {
|
|
|
3203
3318
|
onEvent: (event) => {
|
|
3204
3319
|
switch (event.type) {
|
|
3205
3320
|
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
3321
|
+
if (forceMaximized$.value && this.state === TELE_BOX_STATE.Maximized) {
|
|
3322
|
+
return;
|
|
3323
|
+
}
|
|
3206
3324
|
if (this.hasBoxesStatus()) {
|
|
3207
3325
|
let targetBox = this.maxTitleBar.focusedBox;
|
|
3208
3326
|
if (!targetBox) {
|
|
@@ -3211,12 +3329,17 @@ class TeleBoxManager {
|
|
|
3211
3329
|
if (targetBox == null ? void 0 : targetBox.id) {
|
|
3212
3330
|
const box = this.getBox(targetBox.id);
|
|
3213
3331
|
if (box) {
|
|
3214
|
-
this.setBox(
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3332
|
+
this.setBox(
|
|
3333
|
+
box,
|
|
3334
|
+
{
|
|
3335
|
+
status: TELE_BOX_STATE.Normal,
|
|
3336
|
+
zIndex: this.getMaxNormalBoxZIndex() + 1
|
|
3337
|
+
},
|
|
3338
|
+
false,
|
|
3339
|
+
() => {
|
|
3340
|
+
this.makeMaximizedTopBoxFocus();
|
|
3341
|
+
}
|
|
3342
|
+
);
|
|
3220
3343
|
}
|
|
3221
3344
|
}
|
|
3222
3345
|
} else {
|
|
@@ -3238,10 +3361,14 @@ class TeleBoxManager {
|
|
|
3238
3361
|
this.blurBox(box);
|
|
3239
3362
|
isFocusChanged = true;
|
|
3240
3363
|
}
|
|
3241
|
-
this.setBox(
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3364
|
+
this.setBox(
|
|
3365
|
+
box,
|
|
3366
|
+
{
|
|
3367
|
+
status: TELE_BOX_STATE.Minimized,
|
|
3368
|
+
zIndex: -1
|
|
3369
|
+
},
|
|
3370
|
+
false
|
|
3371
|
+
);
|
|
3245
3372
|
if (isFocusChanged) {
|
|
3246
3373
|
this.focusTopBox();
|
|
3247
3374
|
} else {
|
|
@@ -3302,7 +3429,8 @@ class TeleBoxManager {
|
|
|
3302
3429
|
readonly: readonly$,
|
|
3303
3430
|
fence: fence$,
|
|
3304
3431
|
minimized: minimized$,
|
|
3305
|
-
maximized: maximized
|
|
3432
|
+
maximized: maximized$,
|
|
3433
|
+
forceMaximized: forceMaximized$
|
|
3306
3434
|
};
|
|
3307
3435
|
i(this, valConfig);
|
|
3308
3436
|
this._state$ = state$;
|
|
@@ -3317,6 +3445,21 @@ class TeleBoxManager {
|
|
|
3317
3445
|
get topBox() {
|
|
3318
3446
|
return this.topBox$.value;
|
|
3319
3447
|
}
|
|
3448
|
+
get forceTopBoxes() {
|
|
3449
|
+
return this.boxes.find((box) => box.forceTop);
|
|
3450
|
+
}
|
|
3451
|
+
get maxForceTopBox() {
|
|
3452
|
+
return this.boxes.reduce((maxTopBox, box) => {
|
|
3453
|
+
var _a;
|
|
3454
|
+
if (box.forceTop && box.zIndex > ((_a = maxTopBox == null ? void 0 : maxTopBox.zIndex) != null ? _a : 0)) {
|
|
3455
|
+
return box;
|
|
3456
|
+
}
|
|
3457
|
+
return maxTopBox;
|
|
3458
|
+
}, void 0);
|
|
3459
|
+
}
|
|
3460
|
+
get forceNormalBoxes() {
|
|
3461
|
+
return this.boxes.find((box) => box.forceNormal);
|
|
3462
|
+
}
|
|
3320
3463
|
get darkMode() {
|
|
3321
3464
|
return this._darkMode$.value;
|
|
3322
3465
|
}
|
|
@@ -3324,6 +3467,9 @@ class TeleBoxManager {
|
|
|
3324
3467
|
return this._state$.value;
|
|
3325
3468
|
}
|
|
3326
3469
|
setState(state, skipUpdate = false) {
|
|
3470
|
+
if (state === TELE_BOX_STATE.Normal && this.forceMaximized) {
|
|
3471
|
+
return this;
|
|
3472
|
+
}
|
|
3327
3473
|
switch (state) {
|
|
3328
3474
|
case TELE_BOX_STATE.Maximized: {
|
|
3329
3475
|
this.setMinimized(false, skipUpdate);
|
|
@@ -3348,7 +3494,11 @@ class TeleBoxManager {
|
|
|
3348
3494
|
const oldBoxStatus = this.boxesStatus$.get(boxId);
|
|
3349
3495
|
this.boxesStatus$.set(boxId, boxStatus);
|
|
3350
3496
|
if (boxStatus === TELE_BOX_STATE.Minimized && oldBoxStatus !== TELE_BOX_STATE.Minimized) {
|
|
3351
|
-
this.setLastNotMinimizedBoxStatus(
|
|
3497
|
+
this.setLastNotMinimizedBoxStatus(
|
|
3498
|
+
boxId,
|
|
3499
|
+
oldBoxStatus,
|
|
3500
|
+
skipUpdate
|
|
3501
|
+
);
|
|
3352
3502
|
} else if (oldBoxStatus === TELE_BOX_STATE.Minimized && boxStatus !== TELE_BOX_STATE.Minimized) {
|
|
3353
3503
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
3354
3504
|
}
|
|
@@ -3357,7 +3507,10 @@ class TeleBoxManager {
|
|
|
3357
3507
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
3358
3508
|
}
|
|
3359
3509
|
if (!skipUpdate) {
|
|
3360
|
-
this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, {
|
|
3510
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, {
|
|
3511
|
+
id: boxId,
|
|
3512
|
+
boxStatus
|
|
3513
|
+
});
|
|
3361
3514
|
}
|
|
3362
3515
|
}
|
|
3363
3516
|
getBoxStatus(boxId) {
|
|
@@ -3403,14 +3556,13 @@ class TeleBoxManager {
|
|
|
3403
3556
|
var _a;
|
|
3404
3557
|
const boxStatus = this.boxesStatus$.get(box.id);
|
|
3405
3558
|
if (boxStatus) {
|
|
3406
|
-
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
|
|
3559
|
+
if (boxStatus !== TELE_BOX_STATE.Minimized && !this.isForceTop(box) && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
|
|
3407
3560
|
newTopBox = box;
|
|
3408
3561
|
}
|
|
3409
3562
|
box.setBoxStatus(boxStatus, skipUpdate);
|
|
3410
3563
|
}
|
|
3411
3564
|
});
|
|
3412
3565
|
this.effectBoxStatusChange();
|
|
3413
|
-
console.log("effectBoxesStatusTimerFunc===>newTopBox", newTopBox, curTopBox);
|
|
3414
3566
|
if (newTopBox && curTopBox !== newTopBox) {
|
|
3415
3567
|
this.topBox$.setValue(newTopBox);
|
|
3416
3568
|
}
|
|
@@ -3419,12 +3571,14 @@ class TeleBoxManager {
|
|
|
3419
3571
|
}
|
|
3420
3572
|
}
|
|
3421
3573
|
async effectBoxesStatusChange(skipUpdate = false) {
|
|
3422
|
-
var _a, _b
|
|
3574
|
+
var _a, _b;
|
|
3423
3575
|
if (!this.useBoxesStatus) {
|
|
3424
3576
|
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
|
|
3425
3577
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
3426
3578
|
if (this.effectBoxesStatusTimer.resolve) {
|
|
3427
|
-
this.effectBoxesStatusTimer.resolve(
|
|
3579
|
+
this.effectBoxesStatusTimer.resolve(
|
|
3580
|
+
!!((_a = this.effectBoxesStatusTimer) == null ? void 0 : _a.skipUpdate)
|
|
3581
|
+
);
|
|
3428
3582
|
}
|
|
3429
3583
|
}
|
|
3430
3584
|
this.effectBoxesStatusTimer = void 0;
|
|
@@ -3434,11 +3588,11 @@ class TeleBoxManager {
|
|
|
3434
3588
|
if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
|
|
3435
3589
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
3436
3590
|
if (this.effectBoxesStatusTimer.resolve) {
|
|
3437
|
-
|
|
3438
|
-
|
|
3591
|
+
this.effectBoxesStatusTimer.resolve(
|
|
3592
|
+
!!((_b = this.effectBoxesStatusTimer) == null ? void 0 : _b.skipUpdate)
|
|
3593
|
+
);
|
|
3439
3594
|
}
|
|
3440
3595
|
this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
|
|
3441
|
-
console.log("effectBoxStatusTimerFunc===>2222", skipUpdate);
|
|
3442
3596
|
} else {
|
|
3443
3597
|
return;
|
|
3444
3598
|
}
|
|
@@ -3454,17 +3608,15 @@ class TeleBoxManager {
|
|
|
3454
3608
|
const _skipUpdate = await new Promise((resolve) => {
|
|
3455
3609
|
this.effectBoxesStatusTimer.resolve = resolve;
|
|
3456
3610
|
this.effectBoxesStatusTimer.timer = setTimeout(() => {
|
|
3457
|
-
var _a2, _b2;
|
|
3458
3611
|
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.resolve) {
|
|
3459
|
-
|
|
3460
|
-
|
|
3612
|
+
this.effectBoxesStatusTimer.resolve(
|
|
3613
|
+
this.effectBoxesStatusTimer.skipUpdate
|
|
3614
|
+
);
|
|
3461
3615
|
}
|
|
3462
3616
|
}, 100);
|
|
3463
3617
|
});
|
|
3464
|
-
console.log("effectBoxStatusTimerFunc===>000==>00", skipUpdate, { id: (_c = this.topBox$.value) == null ? void 0 : _c.id, zIndex: (_d = this.topBox$.value) == null ? void 0 : _d.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
|
|
3465
3618
|
this.effectBoxesStatusTimerFunc(_skipUpdate);
|
|
3466
3619
|
this.effectBoxesStatusTimer = void 0;
|
|
3467
|
-
console.log("effectBoxStatusTimerFunc===>000==>11", skipUpdate, { id: (_e = this.topBox$.value) == null ? void 0 : _e.id, zIndex: (_f = this.topBox$.value) == null ? void 0 : _f.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
|
|
3468
3620
|
}
|
|
3469
3621
|
}
|
|
3470
3622
|
hasBoxesStatus() {
|
|
@@ -3477,13 +3629,18 @@ class TeleBoxManager {
|
|
|
3477
3629
|
if (!this.useBoxesStatus) {
|
|
3478
3630
|
return false;
|
|
3479
3631
|
}
|
|
3480
|
-
return this.boxes.some(
|
|
3632
|
+
return this.boxes.some(
|
|
3633
|
+
(box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized
|
|
3634
|
+
);
|
|
3481
3635
|
}
|
|
3482
3636
|
getMinimizedBoxesStatus() {
|
|
3483
3637
|
const minimizedBoxes = /* @__PURE__ */ new Map();
|
|
3484
3638
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3485
3639
|
if (boxStatus === TELE_BOX_STATE.Minimized) {
|
|
3486
|
-
minimizedBoxes.set(
|
|
3640
|
+
minimizedBoxes.set(
|
|
3641
|
+
boxId,
|
|
3642
|
+
boxStatus
|
|
3643
|
+
);
|
|
3487
3644
|
}
|
|
3488
3645
|
});
|
|
3489
3646
|
return minimizedBoxes;
|
|
@@ -3501,7 +3658,10 @@ class TeleBoxManager {
|
|
|
3501
3658
|
const maximizedBoxes = /* @__PURE__ */ new Map();
|
|
3502
3659
|
this.boxesStatus$.forEach((boxStatus, boxId) => {
|
|
3503
3660
|
if (boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3504
|
-
maximizedBoxes.set(
|
|
3661
|
+
maximizedBoxes.set(
|
|
3662
|
+
boxId,
|
|
3663
|
+
boxStatus
|
|
3664
|
+
);
|
|
3505
3665
|
}
|
|
3506
3666
|
});
|
|
3507
3667
|
return maximizedBoxes;
|
|
@@ -3520,12 +3680,18 @@ class TeleBoxManager {
|
|
|
3520
3680
|
}
|
|
3521
3681
|
setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus, skipUpdate = false) {
|
|
3522
3682
|
if (lastNotMinimizedBoxStatus) {
|
|
3523
|
-
this.lastNotMinimizedBoxesStatus$.set(
|
|
3683
|
+
this.lastNotMinimizedBoxesStatus$.set(
|
|
3684
|
+
boxId,
|
|
3685
|
+
lastNotMinimizedBoxStatus
|
|
3686
|
+
);
|
|
3524
3687
|
} else {
|
|
3525
3688
|
this.lastNotMinimizedBoxesStatus$.delete(boxId);
|
|
3526
3689
|
}
|
|
3527
3690
|
if (!skipUpdate) {
|
|
3528
|
-
this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, {
|
|
3691
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, {
|
|
3692
|
+
id: boxId,
|
|
3693
|
+
boxStatus: lastNotMinimizedBoxStatus
|
|
3694
|
+
});
|
|
3529
3695
|
}
|
|
3530
3696
|
}
|
|
3531
3697
|
setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus, skipUpdate = false) {
|
|
@@ -3538,7 +3704,9 @@ class TeleBoxManager {
|
|
|
3538
3704
|
if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.timer) {
|
|
3539
3705
|
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
3540
3706
|
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3541
|
-
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
3707
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
3708
|
+
!!((_a = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _a.skipUpdate)
|
|
3709
|
+
);
|
|
3542
3710
|
}
|
|
3543
3711
|
}
|
|
3544
3712
|
this.effectLastNotMinimizedBoxStatusTimer = void 0;
|
|
@@ -3548,11 +3716,11 @@ class TeleBoxManager {
|
|
|
3548
3716
|
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
3549
3717
|
if (this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !== skipUpdate) {
|
|
3550
3718
|
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3551
|
-
|
|
3552
|
-
|
|
3719
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
3720
|
+
!!((_b = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _b.skipUpdate)
|
|
3721
|
+
);
|
|
3553
3722
|
}
|
|
3554
3723
|
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate = skipUpdate;
|
|
3555
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>2222", skipUpdate);
|
|
3556
3724
|
} else {
|
|
3557
3725
|
return;
|
|
3558
3726
|
}
|
|
@@ -3567,24 +3735,25 @@ class TeleBoxManager {
|
|
|
3567
3735
|
if (this.effectLastNotMinimizedBoxStatusTimer) {
|
|
3568
3736
|
const _skipUpdate = await new Promise((resolve) => {
|
|
3569
3737
|
this.effectLastNotMinimizedBoxStatusTimer.resolve = resolve;
|
|
3570
|
-
this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3738
|
+
this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(
|
|
3739
|
+
() => {
|
|
3740
|
+
if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3741
|
+
this.effectLastNotMinimizedBoxStatusTimer.resolve(
|
|
3742
|
+
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate
|
|
3743
|
+
);
|
|
3744
|
+
}
|
|
3745
|
+
},
|
|
3746
|
+
100
|
|
3747
|
+
);
|
|
3576
3748
|
});
|
|
3577
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>000==>00", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
|
|
3578
3749
|
this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
|
|
3579
3750
|
this.effectLastNotMinimizedBoxStatusTimer = void 0;
|
|
3580
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>000==>11", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
|
|
3581
3751
|
}
|
|
3582
3752
|
}
|
|
3583
3753
|
effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
|
|
3584
3754
|
if (!this.useBoxesStatus) {
|
|
3585
3755
|
return;
|
|
3586
3756
|
}
|
|
3587
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>end", skipUpdate);
|
|
3588
3757
|
this.boxes.forEach((box) => {
|
|
3589
3758
|
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
3590
3759
|
if (boxStatus) {
|
|
@@ -3600,7 +3769,7 @@ class TeleBoxManager {
|
|
|
3600
3769
|
return this.getUnabledBoxesStatusZIndex();
|
|
3601
3770
|
}
|
|
3602
3771
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
3603
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3772
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized && !this.isForceTop(box)) {
|
|
3604
3773
|
return Math.max(maxZIndex, box.zIndex);
|
|
3605
3774
|
}
|
|
3606
3775
|
return maxZIndex;
|
|
@@ -3611,17 +3780,32 @@ class TeleBoxManager {
|
|
|
3611
3780
|
return this.getUnabledBoxesStatusZIndex();
|
|
3612
3781
|
}
|
|
3613
3782
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
3614
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3783
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal && !this.isForceTop(box)) {
|
|
3615
3784
|
return Math.max(maxZIndex, box.zIndex);
|
|
3616
3785
|
}
|
|
3617
3786
|
return maxZIndex;
|
|
3618
3787
|
}, 299);
|
|
3619
3788
|
}
|
|
3789
|
+
getMaxForceTopBoxZIndex() {
|
|
3790
|
+
if (!this.useBoxesStatus) {
|
|
3791
|
+
return this.getUnabledBoxesStatusZIndex();
|
|
3792
|
+
}
|
|
3793
|
+
return this.boxes.reduce((maxZIndex, box) => {
|
|
3794
|
+
if (box.boxStatus && this.isForceTop(box)) {
|
|
3795
|
+
return Math.max(maxZIndex, box.zIndex);
|
|
3796
|
+
}
|
|
3797
|
+
return maxZIndex;
|
|
3798
|
+
}, 699);
|
|
3799
|
+
}
|
|
3800
|
+
isForceNormal(box) {
|
|
3801
|
+
return box._forceNormal$.value;
|
|
3802
|
+
}
|
|
3803
|
+
isForceTop(box) {
|
|
3804
|
+
return box._forceTop$.value;
|
|
3805
|
+
}
|
|
3620
3806
|
create(config = {}, smartPosition = true) {
|
|
3621
|
-
var _a;
|
|
3622
|
-
console.log("create===>", config, (_a = this.topBox) == null ? void 0 : _a.zIndex);
|
|
3623
3807
|
const box = new TeleBox({
|
|
3624
|
-
zIndex: this.getMaxNormalBoxZIndex() + 1,
|
|
3808
|
+
zIndex: config.forceTop ? this.getMaxForceTopBoxZIndex() + 1 : this.getMaxNormalBoxZIndex() + 1,
|
|
3625
3809
|
...smartPosition ? this.smartPosition(config) : config,
|
|
3626
3810
|
darkMode: this.darkMode,
|
|
3627
3811
|
prefersColorScheme: this.prefersColorScheme,
|
|
@@ -3631,15 +3815,20 @@ class TeleBoxManager {
|
|
|
3631
3815
|
namespace: this.namespace,
|
|
3632
3816
|
containerRect: this.containerRect,
|
|
3633
3817
|
readonly: this.readonly,
|
|
3818
|
+
forceMaximized: this.forceMaximized,
|
|
3634
3819
|
collectorRect: this.collectorRect
|
|
3635
3820
|
});
|
|
3636
3821
|
box.mount(this.root);
|
|
3637
3822
|
this.boxes$.setValue([...this.boxes, box]);
|
|
3638
3823
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
3639
|
-
this.setBox(
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3824
|
+
this.setBox(
|
|
3825
|
+
box,
|
|
3826
|
+
{
|
|
3827
|
+
status: box.boxStatus,
|
|
3828
|
+
lastNotMinimizedBoxStatus: box._lastNotMinimizedBoxStatus$.value
|
|
3829
|
+
},
|
|
3830
|
+
true
|
|
3831
|
+
);
|
|
3643
3832
|
}
|
|
3644
3833
|
if (box.focus) {
|
|
3645
3834
|
this.focusBox(box);
|
|
@@ -3649,38 +3838,60 @@ class TeleBoxManager {
|
|
|
3649
3838
|
}
|
|
3650
3839
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
3651
3840
|
if (this.useBoxesStatus && box.boxStatus) {
|
|
3841
|
+
if (box._forceNormal$.value) {
|
|
3842
|
+
return;
|
|
3843
|
+
}
|
|
3652
3844
|
if (box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3653
|
-
this.setBox(
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3845
|
+
this.setBox(
|
|
3846
|
+
box.id,
|
|
3847
|
+
{
|
|
3848
|
+
status: TELE_BOX_STATE.Normal,
|
|
3849
|
+
zIndex: this.getMaxNormalBoxZIndex() + 1
|
|
3850
|
+
},
|
|
3851
|
+
false
|
|
3852
|
+
);
|
|
3657
3853
|
} else {
|
|
3658
|
-
[...this.boxes].filter(
|
|
3854
|
+
[...this.boxes].filter(
|
|
3855
|
+
(box2) => box2.boxStatus === TELE_BOX_STATE.Normal && !this.isForceNormal(box2)
|
|
3856
|
+
).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
|
|
3659
3857
|
if (box2.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3858
|
+
this.setBox(
|
|
3859
|
+
box2.id,
|
|
3860
|
+
{
|
|
3861
|
+
status: TELE_BOX_STATE.Maximized,
|
|
3862
|
+
zIndex: this.getMaxMaximizedBoxZIndex() + 1
|
|
3863
|
+
},
|
|
3864
|
+
false
|
|
3865
|
+
);
|
|
3665
3866
|
}
|
|
3666
3867
|
});
|
|
3667
3868
|
this.makeMaximizedTopBoxFocus();
|
|
3668
3869
|
}
|
|
3669
3870
|
} else {
|
|
3670
|
-
|
|
3871
|
+
if (!(this.forceMaximized && this.maximized)) {
|
|
3872
|
+
this.setMaximized(!this.maximized);
|
|
3873
|
+
}
|
|
3671
3874
|
}
|
|
3672
3875
|
});
|
|
3673
3876
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
|
|
3674
3877
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
3878
|
+
if (box._forceNormal$.value) {
|
|
3879
|
+
return;
|
|
3880
|
+
}
|
|
3675
3881
|
if (box.focus) {
|
|
3676
3882
|
this.blurBox(box);
|
|
3677
3883
|
}
|
|
3678
|
-
this.setBox(
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3884
|
+
this.setBox(
|
|
3885
|
+
box,
|
|
3886
|
+
{
|
|
3887
|
+
status: TELE_BOX_STATE.Minimized,
|
|
3888
|
+
zIndex: -1
|
|
3889
|
+
},
|
|
3890
|
+
false,
|
|
3891
|
+
() => {
|
|
3892
|
+
this.focusTopBox();
|
|
3893
|
+
}
|
|
3894
|
+
);
|
|
3684
3895
|
} else {
|
|
3685
3896
|
this.setMinimized(true);
|
|
3686
3897
|
}
|
|
@@ -3719,9 +3930,11 @@ class TeleBoxManager {
|
|
|
3719
3930
|
});
|
|
3720
3931
|
box._zIndex$.reaction((_, __, skipUpdate) => {
|
|
3721
3932
|
if (this.boxes.length > 0) {
|
|
3722
|
-
console.log("topBox===>_zIndex", this.boxes.map((box2) => ({ id: box2.id, zIndex: box2.zIndex, boxStatus: box2.boxStatus })));
|
|
3723
3933
|
let currentTopBox = void 0;
|
|
3724
3934
|
const topBox = this.boxes.reduce((topBox2, box2) => {
|
|
3935
|
+
if (this.isForceTop(box2)) {
|
|
3936
|
+
return topBox2;
|
|
3937
|
+
}
|
|
3725
3938
|
if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
3726
3939
|
return topBox2;
|
|
3727
3940
|
}
|
|
@@ -3731,7 +3944,6 @@ class TeleBoxManager {
|
|
|
3731
3944
|
}
|
|
3732
3945
|
return topBox2.zIndex > box2.zIndex ? topBox2 : box2;
|
|
3733
3946
|
}, currentTopBox);
|
|
3734
|
-
console.log("topBox===>_zIndex===>end", topBox == null ? void 0 : topBox.id);
|
|
3735
3947
|
this.topBox$.setValue(topBox);
|
|
3736
3948
|
}
|
|
3737
3949
|
if (!skipUpdate) {
|
|
@@ -3771,8 +3983,15 @@ class TeleBoxManager {
|
|
|
3771
3983
|
box.setZIndex(zIndex, skipUpdate);
|
|
3772
3984
|
}
|
|
3773
3985
|
if (lastNotMinimizedBoxStatus) {
|
|
3774
|
-
this.setLastNotMinimizedBoxStatus(
|
|
3775
|
-
|
|
3986
|
+
this.setLastNotMinimizedBoxStatus(
|
|
3987
|
+
box.id,
|
|
3988
|
+
lastNotMinimizedBoxStatus,
|
|
3989
|
+
skipUpdate
|
|
3990
|
+
);
|
|
3991
|
+
box.setLastNotMinimizedBoxStatus(
|
|
3992
|
+
lastNotMinimizedBoxStatus,
|
|
3993
|
+
skipUpdate
|
|
3994
|
+
);
|
|
3776
3995
|
}
|
|
3777
3996
|
effectFunc && effectFunc();
|
|
3778
3997
|
}
|
|
@@ -3787,12 +4006,16 @@ class TeleBoxManager {
|
|
|
3787
4006
|
deletedBoxes.forEach((box2) => box2.destroy());
|
|
3788
4007
|
if (box && this.useBoxesStatus) {
|
|
3789
4008
|
this.setBoxStatus(box.id, void 0, skipUpdate);
|
|
3790
|
-
this.setLastNotMinimizedBoxStatus(
|
|
4009
|
+
this.setLastNotMinimizedBoxStatus(
|
|
4010
|
+
box.id,
|
|
4011
|
+
void 0,
|
|
4012
|
+
skipUpdate
|
|
4013
|
+
);
|
|
3791
4014
|
this.effectBoxStatusChange();
|
|
3792
4015
|
effectFunc && effectFunc();
|
|
3793
4016
|
}
|
|
3794
4017
|
if (!skipUpdate) {
|
|
3795
|
-
if (this.boxes.length <= 0) {
|
|
4018
|
+
if (this.boxes.length <= 0 && !this.forceMaximized) {
|
|
3796
4019
|
this.setMaximized(false);
|
|
3797
4020
|
this.setMinimized(false);
|
|
3798
4021
|
}
|
|
@@ -3815,7 +4038,7 @@ class TeleBoxManager {
|
|
|
3815
4038
|
this.boxesStatus$.clear();
|
|
3816
4039
|
this.lastNotMinimizedBoxesStatus$.clear();
|
|
3817
4040
|
if (!skipUpdate) {
|
|
3818
|
-
if (this.boxes.length <= 0) {
|
|
4041
|
+
if (this.boxes.length <= 0 && !this.forceMaximized) {
|
|
3819
4042
|
this.setMaximized(false);
|
|
3820
4043
|
this.setMinimized(false);
|
|
3821
4044
|
}
|
|
@@ -3947,10 +4170,20 @@ class TeleBoxManager {
|
|
|
3947
4170
|
box.mountFooter(config.footer);
|
|
3948
4171
|
}
|
|
3949
4172
|
if (this.useBoxesStatus && (config.boxStatus || config.lastNotMinimizedBoxStatus)) {
|
|
3950
|
-
this.setBox(
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
4173
|
+
this.setBox(
|
|
4174
|
+
box,
|
|
4175
|
+
{
|
|
4176
|
+
status: config.boxStatus,
|
|
4177
|
+
lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
|
|
4178
|
+
},
|
|
4179
|
+
skipUpdate
|
|
4180
|
+
);
|
|
4181
|
+
}
|
|
4182
|
+
if (config.forceTop != null) {
|
|
4183
|
+
box.setForceTop(config.forceTop, skipUpdate);
|
|
4184
|
+
}
|
|
4185
|
+
if (config.forceNormal != null) {
|
|
4186
|
+
box.setForceNormal(config.forceNormal, skipUpdate);
|
|
3954
4187
|
}
|
|
3955
4188
|
}
|
|
3956
4189
|
smartPosition(config = {}) {
|
|
@@ -3958,28 +4191,54 @@ class TeleBoxManager {
|
|
|
3958
4191
|
const { width = 0.5, height = 0.5 } = config;
|
|
3959
4192
|
if (x == null) {
|
|
3960
4193
|
let vx = 20;
|
|
3961
|
-
if (
|
|
4194
|
+
if (config.forceTop) {
|
|
4195
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
4196
|
+
if (forceTopBox) {
|
|
4197
|
+
vx = forceTopBox.intrinsicX * this.containerRect.width + 20;
|
|
4198
|
+
if (vx > this.containerRect.width - width * this.containerRect.width) {
|
|
4199
|
+
vx = 20;
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
} else if (this.topBox) {
|
|
3962
4203
|
vx = this.topBox.intrinsicX * this.containerRect.width + 20;
|
|
3963
4204
|
if (vx > this.containerRect.width - width * this.containerRect.width) {
|
|
3964
4205
|
vx = 20;
|
|
3965
4206
|
}
|
|
3966
4207
|
} else if (this.hasMinimizedBox()) {
|
|
3967
|
-
vx = [...this.boxes].filter(
|
|
3968
|
-
|
|
4208
|
+
vx = [...this.boxes].filter(
|
|
4209
|
+
(box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal
|
|
4210
|
+
).reduce((maxX, box) => {
|
|
4211
|
+
return Math.max(
|
|
4212
|
+
maxX,
|
|
4213
|
+
box.intrinsicX * this.containerRect.width + 20
|
|
4214
|
+
);
|
|
3969
4215
|
}, vx);
|
|
3970
4216
|
}
|
|
3971
4217
|
x = vx / this.containerRect.width;
|
|
3972
4218
|
}
|
|
3973
4219
|
if (y == null) {
|
|
3974
4220
|
let vy = 20;
|
|
3975
|
-
if (
|
|
4221
|
+
if (config.forceTop) {
|
|
4222
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
4223
|
+
if (forceTopBox) {
|
|
4224
|
+
vy = forceTopBox.intrinsicY * this.containerRect.height + 20;
|
|
4225
|
+
if (vy > this.containerRect.height - height * this.containerRect.height) {
|
|
4226
|
+
vy = 20;
|
|
4227
|
+
}
|
|
4228
|
+
}
|
|
4229
|
+
} else if (this.topBox) {
|
|
3976
4230
|
vy = this.topBox.intrinsicY * this.containerRect.height + 20;
|
|
3977
4231
|
if (vy > this.containerRect.height - height * this.containerRect.height) {
|
|
3978
4232
|
vy = 20;
|
|
3979
4233
|
}
|
|
3980
4234
|
} else if (this.hasMinimizedBox()) {
|
|
3981
|
-
vy = [...this.boxes].filter(
|
|
3982
|
-
|
|
4235
|
+
vy = [...this.boxes].filter(
|
|
4236
|
+
(box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized && box.lastNotMinimizedBoxStatus && box.lastNotMinimizedBoxStatus === TELE_BOX_STATE.Normal
|
|
4237
|
+
).reduce((maxY, box) => {
|
|
4238
|
+
return Math.max(
|
|
4239
|
+
maxY,
|
|
4240
|
+
box.intrinsicY * this.containerRect.height + 20
|
|
4241
|
+
);
|
|
3983
4242
|
}, vy);
|
|
3984
4243
|
}
|
|
3985
4244
|
y = vy / this.containerRect.height;
|
|
@@ -4000,12 +4259,14 @@ class TeleBoxManager {
|
|
|
4000
4259
|
}
|
|
4001
4260
|
let maximizedBox;
|
|
4002
4261
|
if (this.maxTitleBar.hasMaximizedBoxInStatus()) {
|
|
4003
|
-
maximizedBox = this.maxTitleBar.MaximizedBoxes.reduce(
|
|
4004
|
-
|
|
4005
|
-
|
|
4262
|
+
maximizedBox = this.maxTitleBar.MaximizedBoxes.reduce(
|
|
4263
|
+
(topBox, currentBox) => {
|
|
4264
|
+
if (!topBox) {
|
|
4265
|
+
return currentBox;
|
|
4266
|
+
}
|
|
4267
|
+
return topBox.zIndex > currentBox.zIndex ? topBox : currentBox;
|
|
4006
4268
|
}
|
|
4007
|
-
|
|
4008
|
-
});
|
|
4269
|
+
);
|
|
4009
4270
|
}
|
|
4010
4271
|
return maximizedBox;
|
|
4011
4272
|
}
|
|
@@ -4014,9 +4275,7 @@ class TeleBoxManager {
|
|
|
4014
4275
|
return;
|
|
4015
4276
|
}
|
|
4016
4277
|
const maximizedBox = this.getMaximizedTopBox();
|
|
4017
|
-
console.log("makeMaximizedTopBoxFocus===>", maximizedBox == null ? void 0 : maximizedBox.id);
|
|
4018
4278
|
this.maxTitleBar.focusBox(maximizedBox);
|
|
4019
|
-
console.log("makeMaximizedTopBoxFocus===>end", maximizedBox == null ? void 0 : maximizedBox.id);
|
|
4020
4279
|
}
|
|
4021
4280
|
getBoxIndex(boxOrID) {
|
|
4022
4281
|
return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
|
|
@@ -4039,6 +4298,7 @@ class TeleBoxManager {
|
|
|
4039
4298
|
return;
|
|
4040
4299
|
}
|
|
4041
4300
|
}
|
|
4301
|
+
TeleBoxManager.kind = "TeleBoxManager";
|
|
4042
4302
|
exports.DefaultTitleBar = DefaultTitleBar;
|
|
4043
4303
|
exports.TELE_BOX_COLOR_SCHEME = TELE_BOX_COLOR_SCHEME;
|
|
4044
4304
|
exports.TELE_BOX_DELEGATE_EVENT = TELE_BOX_DELEGATE_EVENT;
|