@aptre/flex-layout 0.2.0 → 0.2.2
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/Attribute.d.ts +1 -0
- package/dist/AttributeDefinitions.d.ts +1 -0
- package/dist/DockLocation.d.ts +12 -0
- package/dist/DragDrop.d.ts +15 -0
- package/dist/DropInfo.d.ts +12 -0
- package/dist/I18nLabel.d.ts +14 -0
- package/dist/Orientation.d.ts +7 -0
- package/dist/PopupMenu.d.ts +1 -0
- package/dist/Rect.d.ts +28 -0
- package/dist/Types.d.ts +79 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.mjs +260 -52
- package/dist/model/Action.d.ts +5 -0
- package/dist/model/Actions.d.ts +110 -0
- package/dist/model/BorderNode.d.ts +34 -0
- package/dist/model/BorderSet.d.ts +4 -0
- package/dist/model/ICloseType.d.ts +5 -0
- package/dist/model/IDraggable.d.ts +2 -0
- package/dist/model/IDropTarget.d.ts +2 -0
- package/dist/model/IJsonModel.d.ts +149 -0
- package/dist/model/Model.d.ts +86 -0
- package/dist/model/Node.d.ts +17 -0
- package/dist/model/RowNode.d.ts +11 -0
- package/dist/model/SplitterNode.d.ts +5 -0
- package/dist/model/TabNode.d.ts +37 -0
- package/dist/model/TabSetNode.d.ts +41 -0
- package/dist/model/Utils.d.ts +1 -0
- package/dist/view/BorderButton.d.ts +1 -0
- package/dist/view/BorderTabSet.d.ts +1 -0
- package/dist/view/ErrorBoundary.d.ts +1 -0
- package/dist/view/FloatingWindow.d.ts +1 -0
- package/dist/view/FloatingWindowTab.d.ts +1 -0
- package/dist/view/Icons.d.ts +7 -0
- package/dist/view/Layout.d.ts +161 -0
- package/dist/view/Splitter.d.ts +1 -0
- package/dist/view/Tab.d.ts +1 -0
- package/dist/view/TabButton.d.ts +1 -0
- package/dist/view/TabButtonStamp.d.ts +1 -0
- package/dist/view/TabFloating.d.ts +1 -0
- package/dist/view/TabOverflowHook.d.ts +1 -0
- package/dist/view/TabSet.d.ts +1 -0
- package/dist/view/Utils.d.ts +1 -0
- package/package.json +11 -8
- package/tsconfig.json +1 -0
- package/typedoc/assets/main.js +2 -2
- package/typedoc/assets/style.css +35 -15
- package/typedoc/classes/Action.html +1 -1
- package/typedoc/classes/Actions.html +1 -1
- package/typedoc/classes/BorderNode.html +2 -2
- package/typedoc/classes/BorderSet.html +1 -1
- package/typedoc/classes/DockLocation.html +1 -1
- package/typedoc/classes/DragDrop.html +1 -1
- package/typedoc/classes/DropInfo.html +1 -1
- package/typedoc/classes/Layout.html +13 -13
- package/typedoc/classes/Model.html +1 -1
- package/typedoc/classes/Node.html +2 -2
- package/typedoc/classes/Orientation.html +1 -1
- package/typedoc/classes/Rect.html +1 -1
- package/typedoc/classes/RowNode.html +2 -2
- package/typedoc/classes/SplitterNode.html +2 -2
- package/typedoc/classes/TabNode.html +3 -3
- package/typedoc/classes/TabSetNode.html +2 -2
- package/typedoc/enums/CLASSES.html +1 -1
- package/typedoc/enums/I18nLabel.html +1 -1
- package/typedoc/enums/ICloseType.html +1 -1
- package/typedoc/hierarchy.html +1 -0
- package/typedoc/index.html +1 -1
- package/typedoc/interfaces/IBorderAttributes.html +2 -2
- package/typedoc/interfaces/ICustomDropDestination.html +2 -2
- package/typedoc/interfaces/IDraggable.html +1 -1
- package/typedoc/interfaces/IDropTarget.html +1 -1
- package/typedoc/interfaces/IFontValues.html +2 -2
- package/typedoc/interfaces/IGlobalAttributes.html +2 -2
- package/typedoc/interfaces/IIcons.html +2 -2
- package/typedoc/interfaces/IJsonBorderNode.html +2 -2
- package/typedoc/interfaces/IJsonModel.html +2 -2
- package/typedoc/interfaces/IJsonRowNode.html +2 -2
- package/typedoc/interfaces/IJsonTabNode.html +2 -2
- package/typedoc/interfaces/IJsonTabSetNode.html +2 -2
- package/typedoc/interfaces/ILayoutProps.html +2 -2
- package/typedoc/interfaces/ILayoutState.html +2 -2
- package/typedoc/interfaces/IRowAttributes.html +2 -2
- package/typedoc/interfaces/ITabAttributes.html +2 -2
- package/typedoc/interfaces/ITabRenderValues.html +2 -2
- package/typedoc/interfaces/ITabSetAttributes.html +2 -2
- package/typedoc/interfaces/ITabSetRenderValues.html +2 -2
- package/typedoc/interfaces/ITitleObject.html +2 -2
- package/typedoc/types/CustomDragCallback.html +1 -1
- package/typedoc/types/DragRectRenderCallback.html +1 -1
- package/typedoc/types/FloatingTabPlaceholderRenderCallback.html +1 -1
- package/typedoc/types/IBorderLocation.html +1 -1
- package/typedoc/types/IInsets.html +1 -1
- package/typedoc/types/ITabLocation.html +1 -1
- package/typedoc/types/IconFactory.html +1 -1
- package/typedoc/types/NodeMouseEvent.html +1 -1
- package/typedoc/types/ShowOverflowMenuCallback.html +1 -1
- package/typedoc/types/TabSetPlaceHolderCallback.html +1 -1
- package/typedoc/types/TitleFactory.html +1 -1
package/dist/index.mjs
CHANGED
|
@@ -41,7 +41,7 @@ var Rect = class _Rect {
|
|
|
41
41
|
this.height = height;
|
|
42
42
|
}
|
|
43
43
|
static fromElement(element) {
|
|
44
|
-
|
|
44
|
+
const { x, y, width, height } = element.getBoundingClientRect();
|
|
45
45
|
return new _Rect(x, y, width, height);
|
|
46
46
|
}
|
|
47
47
|
clone() {
|
|
@@ -768,7 +768,7 @@ var AttributeDefinitions = class {
|
|
|
768
768
|
}
|
|
769
769
|
update(jsonObj, obj) {
|
|
770
770
|
for (const attr of this.attributes) {
|
|
771
|
-
if (
|
|
771
|
+
if (attr.name in jsonObj) {
|
|
772
772
|
const fromValue = jsonObj[attr.name];
|
|
773
773
|
if (fromValue === void 0) {
|
|
774
774
|
delete obj[attr.name];
|
|
@@ -801,7 +801,7 @@ var AttributeDefinitions = class {
|
|
|
801
801
|
defaultValue = attr.defaultValue;
|
|
802
802
|
type = attr.type;
|
|
803
803
|
}
|
|
804
|
-
|
|
804
|
+
const defValue = JSON.stringify(defaultValue);
|
|
805
805
|
const required = attr.required || attr.fixed ? "" : "?";
|
|
806
806
|
if (c.fixed) {
|
|
807
807
|
lines.push(" " + c.name + ": " + defValue + ";");
|
|
@@ -1193,15 +1193,6 @@ var SplitterNode = class _SplitterNode extends Node {
|
|
|
1193
1193
|
|
|
1194
1194
|
// src/model/TabNode.ts
|
|
1195
1195
|
var TabNode = class _TabNode extends Node {
|
|
1196
|
-
/** @internal */
|
|
1197
|
-
constructor(model, json, addToModel = true) {
|
|
1198
|
-
super(model);
|
|
1199
|
-
this._extra = {};
|
|
1200
|
-
_TabNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
1201
|
-
if (addToModel === true) {
|
|
1202
|
-
model._addNode(this);
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
1196
|
static {
|
|
1206
1197
|
this.TYPE = "tab";
|
|
1207
1198
|
}
|
|
@@ -1239,6 +1230,15 @@ var TabNode = class _TabNode extends Node {
|
|
|
1239
1230
|
attributeDefinitions.addInherited("borderHeight", "tabBorderHeight").setType(Attribute.NUMBER);
|
|
1240
1231
|
return attributeDefinitions;
|
|
1241
1232
|
}
|
|
1233
|
+
/** @internal */
|
|
1234
|
+
constructor(model, json, addToModel = true) {
|
|
1235
|
+
super(model);
|
|
1236
|
+
this._extra = {};
|
|
1237
|
+
_TabNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
1238
|
+
if (addToModel === true) {
|
|
1239
|
+
model._addNode(this);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
1242
|
getWindow() {
|
|
1243
1243
|
return this._window;
|
|
1244
1244
|
}
|
|
@@ -1374,18 +1374,217 @@ var TabNode = class _TabNode extends Node {
|
|
|
1374
1374
|
}
|
|
1375
1375
|
};
|
|
1376
1376
|
|
|
1377
|
+
// node_modules/layerr/dist/error.js
|
|
1378
|
+
function assertError(err) {
|
|
1379
|
+
if (!isError(err)) {
|
|
1380
|
+
throw new Error("Parameter was not an error");
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
function isError(err) {
|
|
1384
|
+
return objectToString(err) === "[object Error]" || err instanceof Error;
|
|
1385
|
+
}
|
|
1386
|
+
function objectToString(obj) {
|
|
1387
|
+
return Object.prototype.toString.call(obj);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
// node_modules/layerr/dist/tools.js
|
|
1391
|
+
function parseArguments(args) {
|
|
1392
|
+
let options, shortMessage = "";
|
|
1393
|
+
if (args.length === 0) {
|
|
1394
|
+
options = {};
|
|
1395
|
+
} else if (isError(args[0])) {
|
|
1396
|
+
options = {
|
|
1397
|
+
cause: args[0]
|
|
1398
|
+
};
|
|
1399
|
+
shortMessage = args.slice(1).join(" ") || "";
|
|
1400
|
+
} else if (args[0] && typeof args[0] === "object") {
|
|
1401
|
+
options = Object.assign({}, args[0]);
|
|
1402
|
+
shortMessage = args.slice(1).join(" ") || "";
|
|
1403
|
+
} else if (typeof args[0] === "string") {
|
|
1404
|
+
options = {};
|
|
1405
|
+
shortMessage = shortMessage = args.join(" ") || "";
|
|
1406
|
+
} else {
|
|
1407
|
+
throw new Error("Invalid arguments passed to Layerr");
|
|
1408
|
+
}
|
|
1409
|
+
return {
|
|
1410
|
+
options,
|
|
1411
|
+
shortMessage
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
// node_modules/layerr/dist/layerr.js
|
|
1416
|
+
var Layerr = class _Layerr extends Error {
|
|
1417
|
+
constructor(errorOptionsOrMessage, messageText) {
|
|
1418
|
+
const args = [...arguments];
|
|
1419
|
+
const { options, shortMessage } = parseArguments(args);
|
|
1420
|
+
let message = shortMessage;
|
|
1421
|
+
if (options.cause) {
|
|
1422
|
+
message = `${message}: ${options.cause.message}`;
|
|
1423
|
+
}
|
|
1424
|
+
super(message);
|
|
1425
|
+
this.message = message;
|
|
1426
|
+
if (options.name && typeof options.name === "string") {
|
|
1427
|
+
this.name = options.name;
|
|
1428
|
+
} else {
|
|
1429
|
+
this.name = "Layerr";
|
|
1430
|
+
}
|
|
1431
|
+
if (options.cause) {
|
|
1432
|
+
Object.defineProperty(this, "_cause", { value: options.cause });
|
|
1433
|
+
}
|
|
1434
|
+
Object.defineProperty(this, "_info", { value: {} });
|
|
1435
|
+
if (options.info && typeof options.info === "object") {
|
|
1436
|
+
Object.assign(this._info, options.info);
|
|
1437
|
+
}
|
|
1438
|
+
if (Error.captureStackTrace) {
|
|
1439
|
+
const ctor = options.constructorOpt || this.constructor;
|
|
1440
|
+
Error.captureStackTrace(this, ctor);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
static cause(err) {
|
|
1444
|
+
assertError(err);
|
|
1445
|
+
if (!err._cause)
|
|
1446
|
+
return null;
|
|
1447
|
+
return isError(err._cause) ? err._cause : null;
|
|
1448
|
+
}
|
|
1449
|
+
static fullStack(err) {
|
|
1450
|
+
assertError(err);
|
|
1451
|
+
const cause = _Layerr.cause(err);
|
|
1452
|
+
if (cause) {
|
|
1453
|
+
return `${err.stack}
|
|
1454
|
+
caused by: ${_Layerr.fullStack(cause)}`;
|
|
1455
|
+
}
|
|
1456
|
+
return err.stack;
|
|
1457
|
+
}
|
|
1458
|
+
static info(err) {
|
|
1459
|
+
assertError(err);
|
|
1460
|
+
const output = {};
|
|
1461
|
+
const cause = _Layerr.cause(err);
|
|
1462
|
+
if (cause) {
|
|
1463
|
+
Object.assign(output, _Layerr.info(cause));
|
|
1464
|
+
}
|
|
1465
|
+
if (err._info) {
|
|
1466
|
+
Object.assign(output, err._info);
|
|
1467
|
+
}
|
|
1468
|
+
return output;
|
|
1469
|
+
}
|
|
1470
|
+
cause() {
|
|
1471
|
+
return _Layerr.cause(this);
|
|
1472
|
+
}
|
|
1473
|
+
toString() {
|
|
1474
|
+
let output = this.name || this.constructor.name || this.constructor.prototype.name;
|
|
1475
|
+
if (this.message) {
|
|
1476
|
+
output = `${output}: ${this.message}`;
|
|
1477
|
+
}
|
|
1478
|
+
return output;
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
// node_modules/ulidx/dist/browser/index.js
|
|
1483
|
+
var ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
1484
|
+
var ENCODING_LEN = 32;
|
|
1485
|
+
var TIME_MAX = 281474976710655;
|
|
1486
|
+
var TIME_LEN = 10;
|
|
1487
|
+
var RANDOM_LEN = 16;
|
|
1488
|
+
var ERROR_INFO = Object.freeze({
|
|
1489
|
+
source: "ulid"
|
|
1490
|
+
});
|
|
1491
|
+
function detectPRNG(root) {
|
|
1492
|
+
const rootLookup = root || detectRoot();
|
|
1493
|
+
const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || null;
|
|
1494
|
+
if (typeof globalCrypto?.getRandomValues === "function") {
|
|
1495
|
+
return () => {
|
|
1496
|
+
const buffer = new Uint8Array(1);
|
|
1497
|
+
globalCrypto.getRandomValues(buffer);
|
|
1498
|
+
return buffer[0] / 255;
|
|
1499
|
+
};
|
|
1500
|
+
} else if (typeof globalCrypto?.randomBytes === "function") {
|
|
1501
|
+
return () => globalCrypto.randomBytes(1).readUInt8() / 255;
|
|
1502
|
+
} else
|
|
1503
|
+
;
|
|
1504
|
+
throw new Layerr({
|
|
1505
|
+
info: {
|
|
1506
|
+
code: "PRNG_DETECT",
|
|
1507
|
+
...ERROR_INFO
|
|
1508
|
+
}
|
|
1509
|
+
}, "Failed to find a reliable PRNG");
|
|
1510
|
+
}
|
|
1511
|
+
function detectRoot() {
|
|
1512
|
+
if (inWebWorker())
|
|
1513
|
+
return self;
|
|
1514
|
+
if (typeof window !== "undefined") {
|
|
1515
|
+
return window;
|
|
1516
|
+
}
|
|
1517
|
+
if (typeof global !== "undefined") {
|
|
1518
|
+
return global;
|
|
1519
|
+
}
|
|
1520
|
+
if (typeof globalThis !== "undefined") {
|
|
1521
|
+
return globalThis;
|
|
1522
|
+
}
|
|
1523
|
+
return null;
|
|
1524
|
+
}
|
|
1525
|
+
function encodeRandom(len, prng) {
|
|
1526
|
+
let str = "";
|
|
1527
|
+
for (; len > 0; len--) {
|
|
1528
|
+
str = randomChar(prng) + str;
|
|
1529
|
+
}
|
|
1530
|
+
return str;
|
|
1531
|
+
}
|
|
1532
|
+
function encodeTime(now, len) {
|
|
1533
|
+
if (isNaN(now)) {
|
|
1534
|
+
throw new Layerr({
|
|
1535
|
+
info: {
|
|
1536
|
+
code: "ENC_TIME_NAN",
|
|
1537
|
+
...ERROR_INFO
|
|
1538
|
+
}
|
|
1539
|
+
}, `Time must be a number: ${now}`);
|
|
1540
|
+
} else if (now > TIME_MAX) {
|
|
1541
|
+
throw new Layerr({
|
|
1542
|
+
info: {
|
|
1543
|
+
code: "ENC_TIME_SIZE_EXCEED",
|
|
1544
|
+
...ERROR_INFO
|
|
1545
|
+
}
|
|
1546
|
+
}, `Cannot encode a time larger than ${TIME_MAX}: ${now}`);
|
|
1547
|
+
} else if (now < 0) {
|
|
1548
|
+
throw new Layerr({
|
|
1549
|
+
info: {
|
|
1550
|
+
code: "ENC_TIME_NEG",
|
|
1551
|
+
...ERROR_INFO
|
|
1552
|
+
}
|
|
1553
|
+
}, `Time must be positive: ${now}`);
|
|
1554
|
+
} else if (Number.isInteger(now) === false) {
|
|
1555
|
+
throw new Layerr({
|
|
1556
|
+
info: {
|
|
1557
|
+
code: "ENC_TIME_TYPE",
|
|
1558
|
+
...ERROR_INFO
|
|
1559
|
+
}
|
|
1560
|
+
}, `Time must be an integer: ${now}`);
|
|
1561
|
+
}
|
|
1562
|
+
let mod, str = "";
|
|
1563
|
+
for (let currentLen = len; currentLen > 0; currentLen--) {
|
|
1564
|
+
mod = now % ENCODING_LEN;
|
|
1565
|
+
str = ENCODING.charAt(mod) + str;
|
|
1566
|
+
now = (now - mod) / ENCODING_LEN;
|
|
1567
|
+
}
|
|
1568
|
+
return str;
|
|
1569
|
+
}
|
|
1570
|
+
function inWebWorker() {
|
|
1571
|
+
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
|
|
1572
|
+
}
|
|
1573
|
+
function randomChar(prng) {
|
|
1574
|
+
let rand = Math.floor(prng() * ENCODING_LEN);
|
|
1575
|
+
if (rand === ENCODING_LEN) {
|
|
1576
|
+
rand = ENCODING_LEN - 1;
|
|
1577
|
+
}
|
|
1578
|
+
return ENCODING.charAt(rand);
|
|
1579
|
+
}
|
|
1580
|
+
function ulid(seedTime, prng) {
|
|
1581
|
+
const currentPRNG = prng || detectPRNG();
|
|
1582
|
+
const seed = isNaN(seedTime) ? Date.now() : seedTime;
|
|
1583
|
+
return encodeTime(seed, TIME_LEN) + encodeRandom(RANDOM_LEN, currentPRNG);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1377
1586
|
// src/model/RowNode.ts
|
|
1378
1587
|
var RowNode = class _RowNode extends Node {
|
|
1379
|
-
/** @internal */
|
|
1380
|
-
constructor(model, json) {
|
|
1381
|
-
super(model);
|
|
1382
|
-
this._dirty = true;
|
|
1383
|
-
this._drawChildren = [];
|
|
1384
|
-
this._minHeight = 0;
|
|
1385
|
-
this._minWidth = 0;
|
|
1386
|
-
_RowNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
1387
|
-
model._addNode(this);
|
|
1388
|
-
}
|
|
1389
1588
|
static {
|
|
1390
1589
|
this.TYPE = "row";
|
|
1391
1590
|
}
|
|
@@ -1419,6 +1618,16 @@ var RowNode = class _RowNode extends Node {
|
|
|
1419
1618
|
attributeDefinitions.add("height", void 0).setType(Attribute.NUMBER);
|
|
1420
1619
|
return attributeDefinitions;
|
|
1421
1620
|
}
|
|
1621
|
+
/** @internal */
|
|
1622
|
+
constructor(model, json) {
|
|
1623
|
+
super(model);
|
|
1624
|
+
this._dirty = true;
|
|
1625
|
+
this._drawChildren = [];
|
|
1626
|
+
this._minHeight = 0;
|
|
1627
|
+
this._minWidth = 0;
|
|
1628
|
+
_RowNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
1629
|
+
model._addNode(this);
|
|
1630
|
+
}
|
|
1422
1631
|
getWeight() {
|
|
1423
1632
|
return this._attributes.weight;
|
|
1424
1633
|
}
|
|
@@ -1838,14 +2047,6 @@ var RowNode = class _RowNode extends Node {
|
|
|
1838
2047
|
|
|
1839
2048
|
// src/model/TabSetNode.ts
|
|
1840
2049
|
var TabSetNode = class _TabSetNode extends Node {
|
|
1841
|
-
/** @internal */
|
|
1842
|
-
constructor(model, json) {
|
|
1843
|
-
super(model);
|
|
1844
|
-
_TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
1845
|
-
model._addNode(this);
|
|
1846
|
-
this._calculatedTabBarHeight = 0;
|
|
1847
|
-
this._calculatedHeaderBarHeight = 0;
|
|
1848
|
-
}
|
|
1849
2050
|
static {
|
|
1850
2051
|
this.TYPE = "tabset";
|
|
1851
2052
|
}
|
|
@@ -1904,6 +2105,14 @@ var TabSetNode = class _TabSetNode extends Node {
|
|
|
1904
2105
|
attributeDefinitions.addInherited("autoSelectTab", "tabSetAutoSelectTab").setType(Attribute.BOOLEAN);
|
|
1905
2106
|
return attributeDefinitions;
|
|
1906
2107
|
}
|
|
2108
|
+
/** @internal */
|
|
2109
|
+
constructor(model, json) {
|
|
2110
|
+
super(model);
|
|
2111
|
+
_TabSetNode._attributeDefinitions.fromJson(json, this._attributes);
|
|
2112
|
+
model._addNode(this);
|
|
2113
|
+
this._calculatedTabBarHeight = 0;
|
|
2114
|
+
this._calculatedHeaderBarHeight = 0;
|
|
2115
|
+
}
|
|
1907
2116
|
getName() {
|
|
1908
2117
|
return this._getAttr("name");
|
|
1909
2118
|
}
|
|
@@ -2301,7 +2510,7 @@ function adjustSelectedIndex(parent, removedIndex) {
|
|
|
2301
2510
|
}
|
|
2302
2511
|
}
|
|
2303
2512
|
function randomUUID() {
|
|
2304
|
-
return (
|
|
2513
|
+
return ulid();
|
|
2305
2514
|
}
|
|
2306
2515
|
|
|
2307
2516
|
// src/model/BorderNode.ts
|
|
@@ -2743,7 +2952,7 @@ function getRenderStateEx(layout, node, iconFactory, titleFactory, iconAngle) {
|
|
|
2743
2952
|
leadingContent = /* @__PURE__ */ React.createElement("img", { style: { width: "1em", height: "1em" }, src: node.getIcon(), alt: "leadingContent" });
|
|
2744
2953
|
}
|
|
2745
2954
|
}
|
|
2746
|
-
|
|
2955
|
+
const buttons = [];
|
|
2747
2956
|
const renderState = { leading: leadingContent, content: titleContent, name, buttons };
|
|
2748
2957
|
layout.customizeTab(node, renderState);
|
|
2749
2958
|
node._setRenderedName(renderState.name);
|
|
@@ -2925,9 +3134,9 @@ var TabButtonStamp = (props) => {
|
|
|
2925
3134
|
const { layout, node, iconFactory, titleFactory } = props;
|
|
2926
3135
|
const selfRef = React3.useRef(null);
|
|
2927
3136
|
const cm = layout.getClassName;
|
|
2928
|
-
|
|
3137
|
+
const classNames = cm("flexlayout__tab_button_stamp" /* FLEXLAYOUT__TAB_BUTTON_STAMP */);
|
|
2929
3138
|
const renderState = getRenderStateEx(layout, node, iconFactory, titleFactory);
|
|
2930
|
-
|
|
3139
|
+
const content = renderState.content ? /* @__PURE__ */ React3.createElement("div", { className: cm("flexlayout__tab_button_content" /* FLEXLAYOUT__TAB_BUTTON_CONTENT */) }, renderState.content) : node._getNameForOverflowMenu();
|
|
2931
3140
|
const leading = renderState.leading ? /* @__PURE__ */ React3.createElement("div", { className: cm("flexlayout__tab_button_leading" /* FLEXLAYOUT__TAB_BUTTON_LEADING */) }, renderState.leading) : null;
|
|
2932
3141
|
return /* @__PURE__ */ React3.createElement("div", { ref: selfRef, className: classNames, title: node.getHelpText() }, leading, content);
|
|
2933
3142
|
};
|
|
@@ -3068,7 +3277,7 @@ var useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {
|
|
|
3068
3277
|
tabsTruncated.current = false;
|
|
3069
3278
|
}
|
|
3070
3279
|
const nodeRect = node instanceof TabSetNode ? node.getRect() : node.getTabHeaderRect();
|
|
3071
|
-
|
|
3280
|
+
const lastChild = node.getChildren()[node.getChildren().length - 1];
|
|
3072
3281
|
const stickyButtonsSize = stickyButtonsRef.current === null ? 0 : getSize(stickyButtonsRef.current.getBoundingClientRect());
|
|
3073
3282
|
if (firstRender.current === true || lastHiddenCount.current === 0 && hiddenTabs.length !== 0 || nodeRect.width !== lastRect.current.width || // incase rect changed between first render and second
|
|
3074
3283
|
nodeRect.height !== lastRect.current.height) {
|
|
@@ -3183,8 +3392,8 @@ var BorderTabSet = (props) => {
|
|
|
3183
3392
|
let style2 = border.getTabHeaderRect().styleWithPosition({});
|
|
3184
3393
|
const tabs = [];
|
|
3185
3394
|
const layoutTab = (i) => {
|
|
3186
|
-
|
|
3187
|
-
|
|
3395
|
+
const isSelected = border.getSelected() === i;
|
|
3396
|
+
const child = border.getChildren()[i];
|
|
3188
3397
|
tabs.push(
|
|
3189
3398
|
/* @__PURE__ */ React6.createElement(
|
|
3190
3399
|
BorderButton,
|
|
@@ -3213,7 +3422,7 @@ var BorderTabSet = (props) => {
|
|
|
3213
3422
|
borderClasses += " " + border.getClassName();
|
|
3214
3423
|
}
|
|
3215
3424
|
let buttons = [];
|
|
3216
|
-
|
|
3425
|
+
const stickyButtons = [];
|
|
3217
3426
|
const renderState = { headerContent: void 0, buttons, stickyButtons, headerButtons: [], overflowPosition: void 0 };
|
|
3218
3427
|
layout.customizeTabSet(border, renderState);
|
|
3219
3428
|
buttons = renderState.buttons;
|
|
@@ -3412,7 +3621,7 @@ var Splitter = (props) => {
|
|
|
3412
3621
|
return rtn;
|
|
3413
3622
|
};
|
|
3414
3623
|
const cm = layout.getClassName;
|
|
3415
|
-
|
|
3624
|
+
const r = node.getRect();
|
|
3416
3625
|
const style2 = r.styleWithPosition({
|
|
3417
3626
|
cursor: node.getOrientation() === Orientation.HORZ ? "ns-resize" : "ew-resize"
|
|
3418
3627
|
});
|
|
@@ -3428,7 +3637,7 @@ var Splitter = (props) => {
|
|
|
3428
3637
|
if (extra === 0) {
|
|
3429
3638
|
return /* @__PURE__ */ React7.createElement("div", { style: style2, "data-layout-path": path, className, onTouchStart: onMouseDown, onMouseDown });
|
|
3430
3639
|
} else {
|
|
3431
|
-
|
|
3640
|
+
const r2 = r.clone();
|
|
3432
3641
|
r2.x = 0;
|
|
3433
3642
|
r2.y = 0;
|
|
3434
3643
|
if (node.getOrientation() === Orientation.VERT) {
|
|
@@ -3609,7 +3818,7 @@ var TabButton = (props) => {
|
|
|
3609
3818
|
const cm = layout.getClassName;
|
|
3610
3819
|
const parentNode = node.getParent();
|
|
3611
3820
|
const isStretch = parentNode.isEnableSingleTabStretch() && parentNode.getChildren().length === 1;
|
|
3612
|
-
|
|
3821
|
+
const baseClassName = isStretch ? "flexlayout__tab_button_stretch" /* FLEXLAYOUT__TAB_BUTTON_STRETCH */ : "flexlayout__tab_button" /* FLEXLAYOUT__TAB_BUTTON */;
|
|
3613
3822
|
let classNames = cm(baseClassName);
|
|
3614
3823
|
classNames += " " + cm(baseClassName + "_" + parentNode.getTabLocation());
|
|
3615
3824
|
if (!isStretch) {
|
|
@@ -3779,7 +3988,7 @@ var TabSet = (props) => {
|
|
|
3779
3988
|
if (node.isEnableTabStrip()) {
|
|
3780
3989
|
for (let i = 0; i < node.getChildren().length; i++) {
|
|
3781
3990
|
const child = node.getChildren()[i];
|
|
3782
|
-
|
|
3991
|
+
const isSelected = node.getSelected() === i;
|
|
3783
3992
|
tabs.push(/* @__PURE__ */ React11.createElement(TabButton, { layout, node: child, path: path + "/tb" + i, key: child.getId(), selected: isSelected, iconFactory, titleFactory, icons }));
|
|
3784
3993
|
if (i < node.getChildren().length - 1) {
|
|
3785
3994
|
tabs.push(/* @__PURE__ */ React11.createElement("div", { key: "divider" + i, className: cm("flexlayout__tabset_tab_divider" /* FLEXLAYOUT__TABSET_TAB_DIVIDER */) }));
|
|
@@ -3922,7 +4131,6 @@ var TabSet = (props) => {
|
|
|
3922
4131
|
buttons
|
|
3923
4132
|
);
|
|
3924
4133
|
let header;
|
|
3925
|
-
let tabStrip;
|
|
3926
4134
|
let tabStripClasses = cm("flexlayout__tabset_tabbar_outer" /* FLEXLAYOUT__TABSET_TABBAR_OUTER */);
|
|
3927
4135
|
if (node.getClassNameTabStrip() !== void 0) {
|
|
3928
4136
|
tabStripClasses += " " + node.getClassNameTabStrip();
|
|
@@ -3982,7 +4190,7 @@ var TabSet = (props) => {
|
|
|
3982
4190
|
);
|
|
3983
4191
|
}
|
|
3984
4192
|
const tabStripStyle = { height: node.getTabStripHeight() + "px" };
|
|
3985
|
-
tabStrip = /* @__PURE__ */ React11.createElement(
|
|
4193
|
+
const tabStrip = /* @__PURE__ */ React11.createElement(
|
|
3986
4194
|
"div",
|
|
3987
4195
|
{
|
|
3988
4196
|
className: tabStripClasses,
|
|
@@ -4005,7 +4213,7 @@ var TabSet = (props) => {
|
|
|
4005
4213
|
toolbar
|
|
4006
4214
|
);
|
|
4007
4215
|
style2 = layout.styleFont(style2);
|
|
4008
|
-
|
|
4216
|
+
let placeHolder = void 0;
|
|
4009
4217
|
if (node.getChildren().length === 0) {
|
|
4010
4218
|
const placeHolderCallback = layout.getTabSetPlaceHolderCallback();
|
|
4011
4219
|
if (placeHolderCallback) {
|
|
@@ -4013,7 +4221,7 @@ var TabSet = (props) => {
|
|
|
4013
4221
|
}
|
|
4014
4222
|
}
|
|
4015
4223
|
const center = /* @__PURE__ */ React11.createElement("div", { className: cm("flexlayout__tabset_content" /* FLEXLAYOUT__TABSET_CONTENT */) }, placeHolder);
|
|
4016
|
-
|
|
4224
|
+
let content;
|
|
4017
4225
|
if (node.getTabLocation() === "top") {
|
|
4018
4226
|
content = /* @__PURE__ */ React11.createElement(React11.Fragment, null, header, tabStrip, center);
|
|
4019
4227
|
} else {
|
|
@@ -4474,7 +4682,7 @@ var Layout = class extends React16.Component {
|
|
|
4474
4682
|
this.dragDiv.style.visibility = "visible";
|
|
4475
4683
|
}
|
|
4476
4684
|
}
|
|
4477
|
-
|
|
4685
|
+
const dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);
|
|
4478
4686
|
if (dropInfo) {
|
|
4479
4687
|
if (this.props.onTabDrag) {
|
|
4480
4688
|
this.handleCustomTabDrag(dropInfo, pos, event);
|
|
@@ -4770,10 +4978,10 @@ var Layout = class extends React16.Component {
|
|
|
4770
4978
|
let tabCount = 0;
|
|
4771
4979
|
for (const child of drawChildren) {
|
|
4772
4980
|
if (child instanceof SplitterNode) {
|
|
4773
|
-
|
|
4981
|
+
const path = borderPath + "/s";
|
|
4774
4982
|
splitterComponents.push(/* @__PURE__ */ React16.createElement(Splitter, { key: child.getId(), layout: this, node: child, path }));
|
|
4775
4983
|
} else if (child instanceof TabNode) {
|
|
4776
|
-
|
|
4984
|
+
const path = borderPath + "/t" + tabCount++;
|
|
4777
4985
|
if (this.supportsPopout && child.isFloating()) {
|
|
4778
4986
|
const rect = this._getScreenRect(child);
|
|
4779
4987
|
const tabBorderWidth = child._getAttr("borderWidth");
|
|
@@ -5565,12 +5773,12 @@ var Model = class _Model {
|
|
|
5565
5773
|
* @returns {IJsonModel} json object that represents this model
|
|
5566
5774
|
*/
|
|
5567
5775
|
toJson() {
|
|
5568
|
-
const
|
|
5569
|
-
_Model._attributeDefinitions.toJson(
|
|
5776
|
+
const global2 = {};
|
|
5777
|
+
_Model._attributeDefinitions.toJson(global2, this._attributes);
|
|
5570
5778
|
this.visitNodes((node) => {
|
|
5571
5779
|
node._fireEvent("save", void 0);
|
|
5572
5780
|
});
|
|
5573
|
-
return { global, borders: this._borders._toJson(), layout: this._root.toJson() };
|
|
5781
|
+
return { global: global2, borders: this._borders._toJson(), layout: this._root.toJson() };
|
|
5574
5782
|
}
|
|
5575
5783
|
getSplitterSize() {
|
|
5576
5784
|
let splitterSize = this._attributes.splitterSize;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { DockLocation } from "../DockLocation";
|
|
2
|
+
import { Action } from "./Action";
|
|
3
|
+
/**
|
|
4
|
+
* The Action creator class for FlexLayout model actions
|
|
5
|
+
*/
|
|
6
|
+
export declare class Actions {
|
|
7
|
+
static ADD_NODE: string;
|
|
8
|
+
static MOVE_NODE: string;
|
|
9
|
+
static DELETE_TAB: string;
|
|
10
|
+
static DELETE_TABSET: string;
|
|
11
|
+
static RENAME_TAB: string;
|
|
12
|
+
static SELECT_TAB: string;
|
|
13
|
+
static SET_ACTIVE_TABSET: string;
|
|
14
|
+
static ADJUST_SPLIT: string;
|
|
15
|
+
static ADJUST_BORDER_SPLIT: string;
|
|
16
|
+
static MAXIMIZE_TOGGLE: string;
|
|
17
|
+
static UPDATE_MODEL_ATTRIBUTES: string;
|
|
18
|
+
static UPDATE_NODE_ATTRIBUTES: string;
|
|
19
|
+
static FLOAT_TAB: string;
|
|
20
|
+
static UNFLOAT_TAB: string;
|
|
21
|
+
/**
|
|
22
|
+
* Adds a tab node to the given tabset node
|
|
23
|
+
* @param json the json for the new tab node e.g {type:"tab", component:"table"}
|
|
24
|
+
* @param toNodeId the new tab node will be added to the tabset with this node id
|
|
25
|
+
* @param location the location where the new tab will be added, one of the DockLocation enum values.
|
|
26
|
+
* @param index for docking to the center this value is the index of the tab, use -1 to add to the end.
|
|
27
|
+
* @param select (optional) whether to select the new tab, overriding autoSelectTab
|
|
28
|
+
* @returns {Action} the action
|
|
29
|
+
*/
|
|
30
|
+
static addNode(json: any, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action;
|
|
31
|
+
/**
|
|
32
|
+
* Moves a node (tab or tabset) from one location to another
|
|
33
|
+
* @param fromNodeId the id of the node to move
|
|
34
|
+
* @param toNodeId the id of the node to receive the moved node
|
|
35
|
+
* @param location the location where the moved node will be added, one of the DockLocation enum values.
|
|
36
|
+
* @param index for docking to the center this value is the index of the tab, use -1 to add to the end.
|
|
37
|
+
* @param select (optional) whether to select the moved tab(s) in new tabset, overriding autoSelectTab
|
|
38
|
+
* @returns {Action} the action
|
|
39
|
+
*/
|
|
40
|
+
static moveNode(fromNodeId: string, toNodeId: string, location: DockLocation, index: number, select?: boolean): Action;
|
|
41
|
+
/**
|
|
42
|
+
* Deletes a tab node from the layout
|
|
43
|
+
* @param tabsetNodeId the id of the tab node to delete
|
|
44
|
+
* @returns {Action} the action
|
|
45
|
+
*/
|
|
46
|
+
static deleteTab(tabNodeId: string): Action;
|
|
47
|
+
/**
|
|
48
|
+
* Deletes a tabset node and all it's child tab nodes from the layout
|
|
49
|
+
* @param tabsetNodeId the id of the tabset node to delete
|
|
50
|
+
* @returns {Action} the action
|
|
51
|
+
*/
|
|
52
|
+
static deleteTabset(tabsetNodeId: string): Action;
|
|
53
|
+
/**
|
|
54
|
+
* Change the given nodes tab text
|
|
55
|
+
* @param tabNodeId the id of the node to rename
|
|
56
|
+
* @param text the test of the tab
|
|
57
|
+
* @returns {Action} the action
|
|
58
|
+
*/
|
|
59
|
+
static renameTab(tabNodeId: string, text: string): Action;
|
|
60
|
+
/**
|
|
61
|
+
* Selects the given tab in its parent tabset
|
|
62
|
+
* @param tabNodeId the id of the node to set selected
|
|
63
|
+
* @returns {Action} the action
|
|
64
|
+
*/
|
|
65
|
+
static selectTab(tabNodeId: string): Action;
|
|
66
|
+
/**
|
|
67
|
+
* Set the given tabset node as the active tabset
|
|
68
|
+
* @param tabsetNodeId the id of the tabset node to set as active
|
|
69
|
+
* @returns {Action} the action
|
|
70
|
+
*/
|
|
71
|
+
static setActiveTabset(tabsetNodeId: string | undefined): Action;
|
|
72
|
+
/**
|
|
73
|
+
* Adjust the splitter between two tabsets
|
|
74
|
+
* @example
|
|
75
|
+
* Actions.adjustSplit({node1: "1", weight1:30, pixelWidth1:300, node2: "2", weight2:70, pixelWidth2:700});
|
|
76
|
+
*
|
|
77
|
+
* @param splitSpec an object the defines the new split between two tabsets, see example below.
|
|
78
|
+
* @returns {Action} the action
|
|
79
|
+
*/
|
|
80
|
+
static adjustSplit(splitSpec: {
|
|
81
|
+
node1Id: string;
|
|
82
|
+
weight1: number;
|
|
83
|
+
pixelWidth1: number;
|
|
84
|
+
node2Id: string;
|
|
85
|
+
weight2: number;
|
|
86
|
+
pixelWidth2: number;
|
|
87
|
+
}): Action;
|
|
88
|
+
static adjustBorderSplit(nodeId: string, pos: number): Action;
|
|
89
|
+
/**
|
|
90
|
+
* Maximizes the given tabset
|
|
91
|
+
* @param tabsetNodeId the id of the tabset to maximize
|
|
92
|
+
* @returns {Action} the action
|
|
93
|
+
*/
|
|
94
|
+
static maximizeToggle(tabsetNodeId: string): Action;
|
|
95
|
+
/**
|
|
96
|
+
* Updates the global model jsone attributes
|
|
97
|
+
* @param attributes the json for the model attributes to update (merge into the existing attributes)
|
|
98
|
+
* @returns {Action} the action
|
|
99
|
+
*/
|
|
100
|
+
static updateModelAttributes(attributes: any): Action;
|
|
101
|
+
/**
|
|
102
|
+
* Updates the given nodes json attributes
|
|
103
|
+
* @param nodeId the id of the node to update
|
|
104
|
+
* @param attributes the json attributes to update (merge with the existing attributes)
|
|
105
|
+
* @returns {Action} the action
|
|
106
|
+
*/
|
|
107
|
+
static updateNodeAttributes(nodeId: string, attributes: any): Action;
|
|
108
|
+
static floatTab(nodeId: string): Action;
|
|
109
|
+
static unFloatTab(nodeId: string): Action;
|
|
110
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { DockLocation } from "../DockLocation";
|
|
2
|
+
import { Orientation } from "../Orientation";
|
|
3
|
+
import { Rect } from "../Rect";
|
|
4
|
+
import { IDropTarget } from "./IDropTarget";
|
|
5
|
+
import { IJsonBorderNode } from "./IJsonModel";
|
|
6
|
+
import { Node } from "./Node";
|
|
7
|
+
export declare class BorderNode extends Node implements IDropTarget {
|
|
8
|
+
static readonly TYPE = "border";
|
|
9
|
+
getLocation(): DockLocation;
|
|
10
|
+
getTabHeaderRect(): Rect | undefined;
|
|
11
|
+
getRect(): Rect;
|
|
12
|
+
getContentRect(): Rect | undefined;
|
|
13
|
+
isEnableDrop(): boolean;
|
|
14
|
+
isAutoSelectTab(whenOpen?: boolean): boolean;
|
|
15
|
+
getClassName(): string | undefined;
|
|
16
|
+
getBorderBarSize(): number;
|
|
17
|
+
getSize(): any;
|
|
18
|
+
getMinSize(): number;
|
|
19
|
+
getSelected(): number;
|
|
20
|
+
getSelectedNode(): Node | undefined;
|
|
21
|
+
getOrientation(): Orientation;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the config attribute that can be used to store node specific data that
|
|
24
|
+
* WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather
|
|
25
|
+
* than directly, for example:
|
|
26
|
+
* this.state.model.doAction(
|
|
27
|
+
* FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));
|
|
28
|
+
*/
|
|
29
|
+
getConfig(): any;
|
|
30
|
+
isMaximized(): boolean;
|
|
31
|
+
isShowing(): boolean;
|
|
32
|
+
isAutoHide(): boolean;
|
|
33
|
+
toJson(): IJsonBorderNode;
|
|
34
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare enum ICloseType {
|
|
2
|
+
Visible = 1,// close if selected or hovered, i.e. when x is visible (will only close selected on mobile, where css hover is not available)
|
|
3
|
+
Always = 2,// close always (both selected and unselected when x rect tapped e.g where a custom image has been added for close)
|
|
4
|
+
Selected = 3
|
|
5
|
+
}
|