flexlayout-react 0.7.1 → 0.7.4
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/ChangeLog.txt +12 -0
- package/README.md +33 -34
- package/declarations/view/Icons.d.ts +1 -0
- package/declarations/view/Layout.d.ts +1 -0
- package/dist/flexlayout.js +96 -184
- package/dist/flexlayout_min.js +1 -1
- package/lib/Attribute.js +12 -17
- package/lib/Attribute.js.map +1 -1
- package/lib/AttributeDefinitions.js +44 -53
- package/lib/AttributeDefinitions.js.map +1 -1
- package/lib/DockLocation.js +41 -46
- package/lib/DockLocation.js.map +1 -1
- package/lib/DragDrop.js +55 -60
- package/lib/DragDrop.js.map +1 -1
- package/lib/DropInfo.js +3 -8
- package/lib/DropInfo.js.map +1 -1
- package/lib/I18nLabel.js +2 -5
- package/lib/I18nLabel.js.map +1 -1
- package/lib/Orientation.js +11 -16
- package/lib/Orientation.js.map +1 -1
- package/lib/PopupMenu.js +24 -28
- package/lib/PopupMenu.js.map +1 -1
- package/lib/Rect.js +35 -41
- package/lib/Rect.js.map +1 -1
- package/lib/Types.js +2 -5
- package/lib/Types.js.map +1 -1
- package/lib/index.js +22 -38
- package/lib/index.js.map +1 -1
- package/lib/model/Action.js +3 -8
- package/lib/model/Action.js.map +1 -1
- package/lib/model/Actions.js +68 -75
- package/lib/model/Actions.js.map +1 -1
- package/lib/model/BorderNode.js +189 -206
- package/lib/model/BorderNode.js.map +1 -1
- package/lib/model/BorderSet.js +44 -55
- package/lib/model/BorderSet.js.map +1 -1
- package/lib/model/ICloseType.js +2 -5
- package/lib/model/ICloseType.js.map +1 -1
- package/lib/model/IDraggable.js +1 -2
- package/lib/model/IDropTarget.js +1 -2
- package/lib/model/IJsonModel.js +1 -2
- package/lib/model/Model.js +217 -232
- package/lib/model/Model.js.map +1 -1
- package/lib/model/Node.js +87 -94
- package/lib/model/Node.js.map +1 -1
- package/lib/model/RowNode.js +204 -250
- package/lib/model/RowNode.js.map +1 -1
- package/lib/model/SplitterNode.js +35 -57
- package/lib/model/SplitterNode.js.map +1 -1
- package/lib/model/TabNode.js +100 -124
- package/lib/model/TabNode.js.map +1 -1
- package/lib/model/TabSetNode.js +181 -197
- package/lib/model/TabSetNode.js.map +1 -1
- package/lib/model/Utils.js +20 -26
- package/lib/model/Utils.js.map +1 -1
- package/lib/view/BorderButton.js +45 -49
- package/lib/view/BorderButton.js.map +1 -1
- package/lib/view/BorderTabSet.js +57 -61
- package/lib/view/BorderTabSet.js.map +1 -1
- package/lib/view/ErrorBoundary.js +15 -37
- package/lib/view/ErrorBoundary.js.map +1 -1
- package/lib/view/FloatingWindow.js +43 -56
- package/lib/view/FloatingWindow.js.map +1 -1
- package/lib/view/FloatingWindowTab.js +12 -16
- package/lib/view/FloatingWindowTab.js.map +1 -1
- package/lib/view/Icons.js +17 -25
- package/lib/view/Icons.js.map +1 -1
- package/lib/view/Layout.js +396 -508
- package/lib/view/Layout.js.map +1 -1
- package/lib/view/Splitter.js +53 -57
- package/lib/view/Splitter.js.map +1 -1
- package/lib/view/Tab.js +31 -35
- package/lib/view/Tab.js.map +1 -1
- package/lib/view/TabButton.js +46 -50
- package/lib/view/TabButton.js.map +1 -1
- package/lib/view/TabButtonStamp.js +11 -15
- package/lib/view/TabButtonStamp.js.map +1 -1
- package/lib/view/TabFloating.js +30 -34
- package/lib/view/TabFloating.js.map +1 -1
- package/lib/view/TabOverflowHook.js +46 -50
- package/lib/view/TabOverflowHook.js.map +1 -1
- package/lib/view/TabSet.js +93 -106
- package/lib/view/TabSet.js.map +1 -1
- package/lib/view/Utils.js +11 -17
- package/lib/view/Utils.js.map +1 -1
- package/package.json +5 -3
- package/src/model/BorderNode.ts +6 -1
- package/src/model/TabSetNode.ts +6 -1
- package/src/view/FloatingWindow.tsx +5 -1
- package/src/view/Icons.tsx +7 -7
- package/src/view/Layout.tsx +23 -104
- package/style/dark.css +1 -0
- package/style/dark.css.map +1 -1
- package/style/dark.scss +1 -0
- package/style/gray.css +1 -0
- package/style/gray.css.map +1 -1
- package/style/gray.scss +1 -0
- package/style/light.css +1 -0
- package/style/light.css.map +1 -1
- package/style/light.scss +1 -0
- package/style/underline.css +1 -0
- package/style/underline.css.map +1 -1
- package/style/underline.scss +1 -0
package/dist/flexlayout.js
CHANGED
|
@@ -20,46 +20,6 @@ return /******/ (() => { // webpackBootstrap
|
|
|
20
20
|
/******/ "use strict";
|
|
21
21
|
/******/ var __webpack_modules__ = ({
|
|
22
22
|
|
|
23
|
-
/***/ "./node_modules/uuid/dist/esm-browser/index.js":
|
|
24
|
-
/*!*****************************************************!*\
|
|
25
|
-
!*** ./node_modules/uuid/dist/esm-browser/index.js ***!
|
|
26
|
-
\*****************************************************/
|
|
27
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
28
|
-
|
|
29
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"NIL\": () => (/* reexport safe */ _nil_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"]),\n/* harmony export */ \"parse\": () => (/* reexport safe */ _parse_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]),\n/* harmony export */ \"stringify\": () => (/* reexport safe */ _stringify_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"]),\n/* harmony export */ \"v1\": () => (/* reexport safe */ _v1_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]),\n/* harmony export */ \"v3\": () => (/* reexport safe */ _v3_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]),\n/* harmony export */ \"v4\": () => (/* reexport safe */ _v4_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"]),\n/* harmony export */ \"v5\": () => (/* reexport safe */ _v5_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"]),\n/* harmony export */ \"validate\": () => (/* reexport safe */ _validate_js__WEBPACK_IMPORTED_MODULE_6__[\"default\"]),\n/* harmony export */ \"version\": () => (/* reexport safe */ _version_js__WEBPACK_IMPORTED_MODULE_5__[\"default\"])\n/* harmony export */ });\n/* harmony import */ var _v1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v1.js */ \"./node_modules/uuid/dist/esm-browser/v1.js\");\n/* harmony import */ var _v3_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./v3.js */ \"./node_modules/uuid/dist/esm-browser/v3.js\");\n/* harmony import */ var _v4_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v4.js */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n/* harmony import */ var _v5_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v5.js */ \"./node_modules/uuid/dist/esm-browser/v5.js\");\n/* harmony import */ var _nil_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nil.js */ \"./node_modules/uuid/dist/esm-browser/nil.js\");\n/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./version.js */ \"./node_modules/uuid/dist/esm-browser/version.js\");\n/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/esm-browser/validate.js\");\n/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/esm-browser/stringify.js\");\n/* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./parse.js */ \"./node_modules/uuid/dist/esm-browser/parse.js\");\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/index.js?");
|
|
30
|
-
|
|
31
|
-
/***/ }),
|
|
32
|
-
|
|
33
|
-
/***/ "./node_modules/uuid/dist/esm-browser/md5.js":
|
|
34
|
-
/*!***************************************************!*\
|
|
35
|
-
!*** ./node_modules/uuid/dist/esm-browser/md5.js ***!
|
|
36
|
-
\***************************************************/
|
|
37
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
38
|
-
|
|
39
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (var i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n var output = [];\n var length32 = input.length * 32;\n var hexTab = '0123456789abcdef';\n\n for (var i = 0; i < length32; i += 8) {\n var x = input[i >> 5] >>> i % 32 & 0xff;\n var hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n var a = 1732584193;\n var b = -271733879;\n var c = -1732584194;\n var d = 271733878;\n\n for (var i = 0; i < x.length; i += 16) {\n var olda = a;\n var oldb = b;\n var oldc = c;\n var oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n var length8 = input.length * 8;\n var output = new Uint32Array(getOutputLength(length8));\n\n for (var i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff);\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (md5);\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/md5.js?");
|
|
40
|
-
|
|
41
|
-
/***/ }),
|
|
42
|
-
|
|
43
|
-
/***/ "./node_modules/uuid/dist/esm-browser/nil.js":
|
|
44
|
-
/*!***************************************************!*\
|
|
45
|
-
!*** ./node_modules/uuid/dist/esm-browser/nil.js ***!
|
|
46
|
-
\***************************************************/
|
|
47
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
48
|
-
|
|
49
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ('00000000-0000-0000-0000-000000000000');\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/nil.js?");
|
|
50
|
-
|
|
51
|
-
/***/ }),
|
|
52
|
-
|
|
53
|
-
/***/ "./node_modules/uuid/dist/esm-browser/parse.js":
|
|
54
|
-
/*!*****************************************************!*\
|
|
55
|
-
!*** ./node_modules/uuid/dist/esm-browser/parse.js ***!
|
|
56
|
-
\*****************************************************/
|
|
57
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
58
|
-
|
|
59
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/esm-browser/validate.js\");\n\n\nfunction parse(uuid) {\n if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n var v;\n var arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/parse.js?");
|
|
60
|
-
|
|
61
|
-
/***/ }),
|
|
62
|
-
|
|
63
23
|
/***/ "./node_modules/uuid/dist/esm-browser/regex.js":
|
|
64
24
|
/*!*****************************************************!*\
|
|
65
25
|
!*** ./node_modules/uuid/dist/esm-browser/regex.js ***!
|
|
@@ -80,16 +40,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
80
40
|
|
|
81
41
|
/***/ }),
|
|
82
42
|
|
|
83
|
-
/***/ "./node_modules/uuid/dist/esm-browser/sha1.js":
|
|
84
|
-
/*!****************************************************!*\
|
|
85
|
-
!*** ./node_modules/uuid/dist/esm-browser/sha1.js ***!
|
|
86
|
-
\****************************************************/
|
|
87
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
88
|
-
|
|
89
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (var i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n var l = bytes.length / 4 + 2;\n var N = Math.ceil(l / 16);\n var M = new Array(N);\n\n for (var _i = 0; _i < N; ++_i) {\n var arr = new Uint32Array(16);\n\n for (var j = 0; j < 16; ++j) {\n arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3];\n }\n\n M[_i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (var _i2 = 0; _i2 < N; ++_i2) {\n var W = new Uint32Array(80);\n\n for (var t = 0; t < 16; ++t) {\n W[t] = M[_i2][t];\n }\n\n for (var _t = 16; _t < 80; ++_t) {\n W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1);\n }\n\n var a = H[0];\n var b = H[1];\n var c = H[2];\n var d = H[3];\n var e = H[4];\n\n for (var _t2 = 0; _t2 < 80; ++_t2) {\n var s = Math.floor(_t2 / 20);\n var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (sha1);\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/sha1.js?");
|
|
90
|
-
|
|
91
|
-
/***/ }),
|
|
92
|
-
|
|
93
43
|
/***/ "./node_modules/uuid/dist/esm-browser/stringify.js":
|
|
94
44
|
/*!*********************************************************!*\
|
|
95
45
|
!*** ./node_modules/uuid/dist/esm-browser/stringify.js ***!
|
|
@@ -100,36 +50,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
100
50
|
|
|
101
51
|
/***/ }),
|
|
102
52
|
|
|
103
|
-
/***/ "./node_modules/uuid/dist/esm-browser/v1.js":
|
|
104
|
-
/*!**************************************************!*\
|
|
105
|
-
!*** ./node_modules/uuid/dist/esm-browser/v1.js ***!
|
|
106
|
-
\**************************************************/
|
|
107
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
108
|
-
|
|
109
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rng.js */ \"./node_modules/uuid/dist/esm-browser/rng.js\");\n/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/esm-browser/stringify.js\");\n\n // **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\n\nvar _clockseq; // Previous uuid creation time\n\n\nvar _lastMSecs = 0;\nvar _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || new Array(16);\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n var seedBytes = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n var tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || (0,_stringify_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(b);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v1);\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/v1.js?");
|
|
110
|
-
|
|
111
|
-
/***/ }),
|
|
112
|
-
|
|
113
|
-
/***/ "./node_modules/uuid/dist/esm-browser/v3.js":
|
|
114
|
-
/*!**************************************************!*\
|
|
115
|
-
!*** ./node_modules/uuid/dist/esm-browser/v3.js ***!
|
|
116
|
-
\**************************************************/
|
|
117
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
118
|
-
|
|
119
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ \"./node_modules/uuid/dist/esm-browser/v35.js\");\n/* harmony import */ var _md5_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./md5.js */ \"./node_modules/uuid/dist/esm-browser/md5.js\");\n\n\nvar v3 = (0,_v35_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])('v3', 0x30, _md5_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v3);\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/v3.js?");
|
|
120
|
-
|
|
121
|
-
/***/ }),
|
|
122
|
-
|
|
123
|
-
/***/ "./node_modules/uuid/dist/esm-browser/v35.js":
|
|
124
|
-
/*!***************************************************!*\
|
|
125
|
-
!*** ./node_modules/uuid/dist/esm-browser/v35.js ***!
|
|
126
|
-
\***************************************************/
|
|
127
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
128
|
-
|
|
129
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DNS\": () => (/* binding */ DNS),\n/* harmony export */ \"URL\": () => (/* binding */ URL),\n/* harmony export */ \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringify.js */ \"./node_modules/uuid/dist/esm-browser/stringify.js\");\n/* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parse.js */ \"./node_modules/uuid/dist/esm-browser/parse.js\");\n\n\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n var bytes = [];\n\n for (var i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nvar DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nvar URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = (0,_parse_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(namespace);\n }\n\n if (namespace.length !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n var bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (var i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return (0,_stringify_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/v35.js?");
|
|
130
|
-
|
|
131
|
-
/***/ }),
|
|
132
|
-
|
|
133
53
|
/***/ "./node_modules/uuid/dist/esm-browser/v4.js":
|
|
134
54
|
/*!**************************************************!*\
|
|
135
55
|
!*** ./node_modules/uuid/dist/esm-browser/v4.js ***!
|
|
@@ -140,16 +60,6 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
140
60
|
|
|
141
61
|
/***/ }),
|
|
142
62
|
|
|
143
|
-
/***/ "./node_modules/uuid/dist/esm-browser/v5.js":
|
|
144
|
-
/*!**************************************************!*\
|
|
145
|
-
!*** ./node_modules/uuid/dist/esm-browser/v5.js ***!
|
|
146
|
-
\**************************************************/
|
|
147
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
148
|
-
|
|
149
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ \"./node_modules/uuid/dist/esm-browser/v35.js\");\n/* harmony import */ var _sha1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sha1.js */ \"./node_modules/uuid/dist/esm-browser/sha1.js\");\n\n\nvar v5 = (0,_v35_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])('v5', 0x50, _sha1_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v5);\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/v5.js?");
|
|
150
|
-
|
|
151
|
-
/***/ }),
|
|
152
|
-
|
|
153
63
|
/***/ "./node_modules/uuid/dist/esm-browser/validate.js":
|
|
154
64
|
/*!********************************************************!*\
|
|
155
65
|
!*** ./node_modules/uuid/dist/esm-browser/validate.js ***!
|
|
@@ -160,23 +70,13 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
160
70
|
|
|
161
71
|
/***/ }),
|
|
162
72
|
|
|
163
|
-
/***/ "./node_modules/uuid/dist/esm-browser/version.js":
|
|
164
|
-
/*!*******************************************************!*\
|
|
165
|
-
!*** ./node_modules/uuid/dist/esm-browser/version.js ***!
|
|
166
|
-
\*******************************************************/
|
|
167
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
168
|
-
|
|
169
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ \"./node_modules/uuid/dist/esm-browser/validate.js\");\n\n\nfunction version(uuid) {\n if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.substr(14, 1), 16);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (version);\n\n//# sourceURL=webpack://FlexLayout/./node_modules/uuid/dist/esm-browser/version.js?");
|
|
170
|
-
|
|
171
|
-
/***/ }),
|
|
172
|
-
|
|
173
73
|
/***/ "./src/Attribute.ts":
|
|
174
74
|
/*!**************************!*\
|
|
175
75
|
!*** ./src/Attribute.ts ***!
|
|
176
76
|
\**************************/
|
|
177
|
-
/***/ ((__unused_webpack_module,
|
|
77
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
178
78
|
|
|
179
|
-
eval("
|
|
79
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Attribute\": () => (/* binding */ Attribute)\n/* harmony export */ });\n/** @internal */\nclass Attribute {\n constructor(name, modelName, defaultValue, alwaysWriteJson) {\n this.name = name;\n this.modelName = modelName;\n this.defaultValue = defaultValue;\n this.alwaysWriteJson = alwaysWriteJson;\n this.required = false;\n this.fixed = false;\n this.type = \"any\";\n }\n setType(value) {\n this.type = value;\n return this;\n }\n setRequired() {\n this.required = true;\n return this;\n }\n setFixed() {\n this.fixed = true;\n return this;\n }\n}\nAttribute.NUMBER = \"number\";\nAttribute.STRING = \"string\";\nAttribute.BOOLEAN = \"boolean\";\n\n\n//# sourceURL=webpack://FlexLayout/./src/Attribute.ts?");
|
|
180
80
|
|
|
181
81
|
/***/ }),
|
|
182
82
|
|
|
@@ -184,9 +84,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
184
84
|
/*!*************************************!*\
|
|
185
85
|
!*** ./src/AttributeDefinitions.ts ***!
|
|
186
86
|
\*************************************/
|
|
187
|
-
/***/ ((__unused_webpack_module,
|
|
87
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
188
88
|
|
|
189
|
-
eval("
|
|
89
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"AttributeDefinitions\": () => (/* binding */ AttributeDefinitions)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Attribute */ \"./src/Attribute.ts\");\n\n/** @internal */\nclass AttributeDefinitions {\n constructor() {\n this.attributes = [];\n this.nameToAttribute = {};\n }\n addWithAll(name, modelName, defaultValue, alwaysWriteJson) {\n const attr = new _Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute(name, modelName, defaultValue, alwaysWriteJson);\n this.attributes.push(attr);\n this.nameToAttribute[name] = attr;\n return attr;\n }\n addInherited(name, modelName) {\n return this.addWithAll(name, modelName, undefined, false);\n }\n add(name, defaultValue, alwaysWriteJson) {\n return this.addWithAll(name, undefined, defaultValue, alwaysWriteJson);\n }\n getAttributes() {\n return this.attributes;\n }\n getModelName(name) {\n const conversion = this.nameToAttribute[name];\n if (conversion !== undefined) {\n return conversion.modelName;\n }\n return undefined;\n }\n toJson(jsonObj, obj) {\n for (const attr of this.attributes) {\n const fromValue = obj[attr.name];\n if (attr.alwaysWriteJson || fromValue !== attr.defaultValue) {\n jsonObj[attr.name] = fromValue;\n }\n }\n }\n fromJson(jsonObj, obj) {\n for (const attr of this.attributes) {\n const fromValue = jsonObj[attr.name];\n if (fromValue === undefined) {\n obj[attr.name] = attr.defaultValue;\n }\n else {\n obj[attr.name] = fromValue;\n }\n }\n }\n update(jsonObj, obj) {\n for (const attr of this.attributes) {\n if (jsonObj.hasOwnProperty(attr.name)) {\n const fromValue = jsonObj[attr.name];\n if (fromValue === undefined) {\n delete obj[attr.name];\n }\n else {\n obj[attr.name] = fromValue;\n }\n }\n }\n }\n setDefaults(obj) {\n for (const attr of this.attributes) {\n obj[attr.name] = attr.defaultValue;\n }\n }\n toTypescriptInterface(name, parentAttributes) {\n const lines = [];\n const sorted = this.attributes.sort((a, b) => a.name.localeCompare(b.name));\n // const sorted = this.attributes;\n lines.push(\"export interface I\" + name + \"Attributes {\");\n for (let i = 0; i < sorted.length; i++) {\n const c = sorted[i];\n let type = c.type;\n let defaultValue = undefined;\n let attr = c;\n let inherited = undefined;\n if (attr.defaultValue !== undefined) {\n defaultValue = attr.defaultValue;\n }\n else if (attr.modelName !== undefined\n && parentAttributes !== undefined\n && parentAttributes.nameToAttribute[attr.modelName] !== undefined) {\n inherited = attr.modelName;\n attr = parentAttributes.nameToAttribute[attr.modelName];\n defaultValue = attr.defaultValue;\n type = attr.type;\n }\n let defValue = JSON.stringify(defaultValue);\n const required = attr.required || attr.fixed ? \"\" : \"?\";\n if (c.fixed) {\n lines.push(\"\\t\" + c.name + \": \" + defValue + \";\");\n }\n else {\n const comment = (defaultValue !== undefined ? \"default: \" + defValue : \"\") +\n (inherited !== undefined ? \" - inherited from global \" + inherited : \"\");\n lines.push(\"\\t\" + c.name + required + \": \" + type + \";\" +\n (comment.length > 0 ? \" // \" + comment : \"\"));\n }\n }\n lines.push(\"}\");\n return lines.join(\"\\n\");\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/AttributeDefinitions.ts?");
|
|
190
90
|
|
|
191
91
|
/***/ }),
|
|
192
92
|
|
|
@@ -194,9 +94,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
194
94
|
/*!*****************************!*\
|
|
195
95
|
!*** ./src/DockLocation.ts ***!
|
|
196
96
|
\*****************************/
|
|
197
|
-
/***/ ((__unused_webpack_module,
|
|
97
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
198
98
|
|
|
199
|
-
eval("
|
|
99
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DockLocation\": () => (/* binding */ DockLocation)\n/* harmony export */ });\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Rect */ \"./src/Rect.ts\");\n\n\nclass DockLocation {\n /** @internal */\n constructor(name, orientation, indexPlus) {\n this._name = name;\n this._orientation = orientation;\n this._indexPlus = indexPlus;\n DockLocation.values[this._name] = this;\n }\n /** @internal */\n static getByName(name) {\n return DockLocation.values[name];\n }\n /** @internal */\n static getLocation(rect, x, y) {\n x = (x - rect.x) / rect.width;\n y = (y - rect.y) / rect.height;\n if (x >= 0.25 && x < 0.75 && y >= 0.25 && y < 0.75) {\n return DockLocation.CENTER;\n }\n // Whether or not the point is in the bottom-left half of the rect\n // +-----+\n // |\\ |\n // |x\\ |\n // |xx\\ |\n // |xxx\\ |\n // |xxxx\\|\n // +-----+\n const bl = y >= x;\n // Whether or not the point is in the bottom-right half of the rect\n // +-----+\n // | /|\n // | /x|\n // | /xx|\n // | /xxx|\n // |/xxxx|\n // +-----+\n const br = y >= 1 - x;\n if (bl) {\n return br ? DockLocation.BOTTOM : DockLocation.LEFT;\n }\n else {\n return br ? DockLocation.RIGHT : DockLocation.TOP;\n }\n }\n getName() {\n return this._name;\n }\n getOrientation() {\n return this._orientation;\n }\n /** @internal */\n getDockRect(r) {\n if (this === DockLocation.TOP) {\n return new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(r.x, r.y, r.width, r.height / 2);\n }\n else if (this === DockLocation.BOTTOM) {\n return new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(r.x, r.getBottom() - r.height / 2, r.width, r.height / 2);\n }\n if (this === DockLocation.LEFT) {\n return new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(r.x, r.y, r.width / 2, r.height);\n }\n else if (this === DockLocation.RIGHT) {\n return new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(r.getRight() - r.width / 2, r.y, r.width / 2, r.height);\n }\n else {\n return r.clone();\n }\n }\n /** @internal */\n split(rect, size) {\n if (this === DockLocation.TOP) {\n const r1 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.x, rect.y, rect.width, size);\n const r2 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.x, rect.y + size, rect.width, rect.height - size);\n return { start: r1, end: r2 };\n }\n else if (this === DockLocation.LEFT) {\n const r1 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.x, rect.y, size, rect.height);\n const r2 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.x + size, rect.y, rect.width - size, rect.height);\n return { start: r1, end: r2 };\n }\n if (this === DockLocation.RIGHT) {\n const r1 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.getRight() - size, rect.y, size, rect.height);\n const r2 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.x, rect.y, rect.width - size, rect.height);\n return { start: r1, end: r2 };\n }\n else {\n // if (this === DockLocation.BOTTOM) {\n const r1 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.x, rect.getBottom() - size, rect.width, size);\n const r2 = new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(rect.x, rect.y, rect.width, rect.height - size);\n return { start: r1, end: r2 };\n }\n }\n /** @internal */\n reflect() {\n if (this === DockLocation.TOP) {\n return DockLocation.BOTTOM;\n }\n else if (this === DockLocation.LEFT) {\n return DockLocation.RIGHT;\n }\n if (this === DockLocation.RIGHT) {\n return DockLocation.LEFT;\n }\n else {\n // if (this === DockLocation.BOTTOM) {\n return DockLocation.TOP;\n }\n }\n toString() {\n return \"(DockLocation: name=\" + this._name + \", orientation=\" + this._orientation + \")\";\n }\n}\nDockLocation.values = {};\nDockLocation.TOP = new DockLocation(\"top\", _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.VERT, 0);\nDockLocation.BOTTOM = new DockLocation(\"bottom\", _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.VERT, 1);\nDockLocation.LEFT = new DockLocation(\"left\", _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.HORZ, 0);\nDockLocation.RIGHT = new DockLocation(\"right\", _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.HORZ, 1);\nDockLocation.CENTER = new DockLocation(\"center\", _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.VERT, 0);\n\n\n//# sourceURL=webpack://FlexLayout/./src/DockLocation.ts?");
|
|
200
100
|
|
|
201
101
|
/***/ }),
|
|
202
102
|
|
|
@@ -204,9 +104,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
204
104
|
/*!*************************!*\
|
|
205
105
|
!*** ./src/DragDrop.ts ***!
|
|
206
106
|
\*************************/
|
|
207
|
-
/***/ ((__unused_webpack_module,
|
|
107
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
208
108
|
|
|
209
|
-
eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.DragDrop = void 0;\nvar Rect_1 = __webpack_require__(/*! ./Rect */ \"./src/Rect.ts\");\n/** @internal */\nvar canUseDOM = !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\nvar DragDrop = /** @class */ (function () {\n /** @internal */\n function DragDrop() {\n /** @internal */\n this._manualGlassManagement = false;\n /** @internal */\n this._startX = 0;\n /** @internal */\n this._startY = 0;\n /** @internal */\n this._dragDepth = 0;\n /** @internal */\n this._glassShowing = false;\n /** @internal */\n this._dragging = false;\n /** @internal */\n this._active = false; // drag and drop is in progress, can be used on ios to prevent body scrolling (see demo)\n if (canUseDOM) {\n // check for serverside rendering\n this._glass = document.createElement(\"div\");\n this._glass.style.zIndex = \"998\";\n this._glass.style.backgroundColor = \"transparent\";\n this._glass.style.outline = \"none\";\n }\n this._defaultGlassCursor = \"default\";\n this._onMouseMove = this._onMouseMove.bind(this);\n this._onMouseUp = this._onMouseUp.bind(this);\n this._onKeyPress = this._onKeyPress.bind(this);\n this._onDragCancel = this._onDragCancel.bind(this);\n this._onDragEnter = this._onDragEnter.bind(this);\n this._onDragLeave = this._onDragLeave.bind(this);\n this.resizeGlass = this.resizeGlass.bind(this);\n this._lastClick = 0;\n this._clickX = 0;\n this._clickY = 0;\n }\n // if you add the glass pane then you should remove it\n DragDrop.prototype.addGlass = function (fCancel) {\n var _a;\n if (!this._glassShowing) {\n if (!this._document) {\n this._document = window.document;\n }\n if (!this._rootElement) {\n this._rootElement = this._document.body;\n }\n this.resizeGlass();\n (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.addEventListener('resize', this.resizeGlass);\n this._document.body.appendChild(this._glass);\n this._glass.tabIndex = -1;\n this._glass.focus();\n this._glass.addEventListener(\"keydown\", this._onKeyPress);\n this._glass.addEventListener(\"dragenter\", this._onDragEnter, { passive: false });\n this._glass.addEventListener(\"dragover\", this._onMouseMove, { passive: false });\n this._glass.addEventListener(\"dragleave\", this._onDragLeave, { passive: false });\n this._glassShowing = true;\n this._fDragCancel = fCancel;\n this._manualGlassManagement = false;\n }\n else {\n // second call to addGlass (via dragstart)\n this._manualGlassManagement = true;\n }\n };\n DragDrop.prototype.resizeGlass = function () {\n var glassRect = Rect_1.Rect.fromElement(this._rootElement);\n glassRect.positionElement(this._glass, \"fixed\");\n };\n DragDrop.prototype.hideGlass = function () {\n var _a;\n if (this._glassShowing) {\n this._document.body.removeChild(this._glass);\n (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.removeEventListener('resize', this.resizeGlass);\n this._glassShowing = false;\n this._document = undefined;\n this._rootElement = undefined;\n this.setGlassCursorOverride(undefined);\n }\n };\n /** @internal */\n DragDrop.prototype._updateGlassCursor = function () {\n var _a;\n this._glass.style.cursor = (_a = this._glassCursorOverride) !== null && _a !== void 0 ? _a : this._defaultGlassCursor;\n };\n /** @internal */\n DragDrop.prototype._setDefaultGlassCursor = function (cursor) {\n this._defaultGlassCursor = cursor;\n this._updateGlassCursor();\n };\n DragDrop.prototype.setGlassCursorOverride = function (cursor) {\n this._glassCursorOverride = cursor;\n this._updateGlassCursor();\n };\n DragDrop.prototype.startDrag = function (event, fDragStart, fDragMove, fDragEnd, fDragCancel, fClick, fDblClick, currentDocument, rootElement) {\n // prevent 'duplicate' action (mouse event for same action as previous touch event (a fix for ios))\n if (event && this._lastEvent && this._lastEvent.type.startsWith(\"touch\") && event.type.startsWith(\"mouse\") && event.timeStamp - this._lastEvent.timeStamp < 500) {\n return;\n }\n this._lastEvent = event;\n if (currentDocument) {\n this._document = currentDocument;\n }\n else {\n this._document = window.document;\n }\n if (rootElement) {\n this._rootElement = rootElement;\n }\n else {\n this._rootElement = this._document.body;\n }\n var posEvent = this._getLocationEvent(event);\n this.addGlass(fDragCancel);\n if (this._dragging) {\n console.warn(\"this._dragging true on startDrag should never happen\");\n }\n if (event) {\n this._startX = posEvent.clientX;\n this._startY = posEvent.clientY;\n if (!window.matchMedia || window.matchMedia(\"(pointer: fine)\").matches) {\n this._setDefaultGlassCursor(getComputedStyle(event.target).cursor);\n }\n this._stopPropagation(event);\n this._preventDefault(event);\n }\n else {\n this._startX = 0;\n this._startY = 0;\n this._setDefaultGlassCursor(\"default\");\n }\n this._dragging = false;\n this._fDragStart = fDragStart;\n this._fDragMove = fDragMove;\n this._fDragEnd = fDragEnd;\n this._fDragCancel = fDragCancel;\n this._fClick = fClick;\n this._fDblClick = fDblClick;\n this._active = true;\n if ((event === null || event === void 0 ? void 0 : event.type) === 'dragenter') {\n this._dragDepth = 1;\n this._rootElement.addEventListener(\"dragenter\", this._onDragEnter, { passive: false });\n this._rootElement.addEventListener(\"dragover\", this._onMouseMove, { passive: false });\n this._rootElement.addEventListener(\"dragleave\", this._onDragLeave, { passive: false });\n this._document.addEventListener(\"dragend\", this._onDragCancel, { passive: false });\n this._document.addEventListener(\"drop\", this._onMouseUp, { passive: false });\n }\n else {\n this._document.addEventListener(\"mouseup\", this._onMouseUp, { passive: false });\n this._document.addEventListener(\"mousemove\", this._onMouseMove, { passive: false });\n this._document.addEventListener(\"touchend\", this._onMouseUp, { passive: false });\n this._document.addEventListener(\"touchmove\", this._onMouseMove, { passive: false });\n }\n };\n DragDrop.prototype.isDragging = function () {\n return this._dragging;\n };\n DragDrop.prototype.isActive = function () {\n return this._active;\n };\n DragDrop.prototype.toString = function () {\n var rtn = \"(DragDrop: \" + \"startX=\" + this._startX + \", startY=\" + this._startY + \", dragging=\" + this._dragging + \")\";\n return rtn;\n };\n /** @internal */\n DragDrop.prototype._onKeyPress = function (event) {\n if (event.keyCode === 27) {\n // esc\n this._onDragCancel();\n }\n };\n /** @internal */\n DragDrop.prototype._onDragCancel = function () {\n this._rootElement.removeEventListener(\"dragenter\", this._onDragEnter);\n this._rootElement.removeEventListener(\"dragover\", this._onMouseMove);\n this._rootElement.removeEventListener(\"dragleave\", this._onDragLeave);\n this._document.removeEventListener(\"dragend\", this._onDragCancel);\n this._document.removeEventListener(\"drop\", this._onMouseUp);\n this._document.removeEventListener(\"mousemove\", this._onMouseMove);\n this._document.removeEventListener(\"mouseup\", this._onMouseUp);\n this._document.removeEventListener(\"touchend\", this._onMouseUp);\n this._document.removeEventListener(\"touchmove\", this._onMouseMove);\n this.hideGlass();\n if (this._fDragCancel !== undefined) {\n this._fDragCancel(this._dragging);\n }\n this._dragging = false;\n this._active = false;\n };\n /** @internal */\n DragDrop.prototype._getLocationEvent = function (event) {\n var posEvent = event;\n if (event && event.touches) {\n posEvent = event.touches[0];\n }\n return posEvent;\n };\n /** @internal */\n DragDrop.prototype._getLocationEventEnd = function (event) {\n var posEvent = event;\n if (event.changedTouches) {\n posEvent = event.changedTouches[0];\n }\n return posEvent;\n };\n /** @internal */\n DragDrop.prototype._stopPropagation = function (event) {\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n };\n /** @internal */\n DragDrop.prototype._preventDefault = function (event) {\n if (event.preventDefault && event.cancelable) {\n event.preventDefault();\n }\n return event;\n };\n /** @internal */\n DragDrop.prototype._onMouseMove = function (event) {\n this._lastEvent = event;\n var posEvent = this._getLocationEvent(event);\n this._stopPropagation(event);\n this._preventDefault(event);\n if (!this._dragging && (Math.abs(this._startX - posEvent.clientX) > 5 || Math.abs(this._startY - posEvent.clientY) > 5)) {\n this._dragging = true;\n if (this._fDragStart) {\n this._setDefaultGlassCursor(\"move\");\n this._dragging = this._fDragStart({ clientX: this._startX, clientY: this._startY });\n }\n }\n if (this._dragging) {\n if (this._fDragMove) {\n this._fDragMove(posEvent);\n }\n }\n return false;\n };\n /** @internal */\n DragDrop.prototype._onMouseUp = function (event) {\n this._lastEvent = event;\n var posEvent = this._getLocationEventEnd(event);\n this._stopPropagation(event);\n this._preventDefault(event);\n this._active = false;\n this._rootElement.removeEventListener(\"dragenter\", this._onDragEnter);\n this._rootElement.removeEventListener(\"dragover\", this._onMouseMove);\n this._rootElement.removeEventListener(\"dragleave\", this._onDragLeave);\n this._document.removeEventListener(\"dragend\", this._onDragCancel);\n this._document.removeEventListener(\"drop\", this._onMouseUp);\n this._document.removeEventListener(\"mousemove\", this._onMouseMove);\n this._document.removeEventListener(\"mouseup\", this._onMouseUp);\n this._document.removeEventListener(\"touchend\", this._onMouseUp);\n this._document.removeEventListener(\"touchmove\", this._onMouseMove);\n if (!this._manualGlassManagement) {\n this.hideGlass();\n }\n if (this._dragging) {\n this._dragging = false;\n if (this._fDragEnd) {\n this._fDragEnd(event);\n }\n // dump(\"set dragging = false\\n\");\n }\n else {\n if (this._fDragCancel) {\n this._fDragCancel(this._dragging);\n }\n if (Math.abs(this._startX - posEvent.clientX) <= 5 && Math.abs(this._startY - posEvent.clientY) <= 5) {\n var isDoubleClick = false;\n var clickTime = new Date().getTime();\n // check for double click\n if (Math.abs(this._clickX - posEvent.clientX) <= 5 && Math.abs(this._clickY - posEvent.clientY) <= 5) {\n if (clickTime - this._lastClick < 500) {\n if (this._fDblClick) {\n this._fDblClick(event);\n isDoubleClick = true;\n }\n }\n }\n if (!isDoubleClick && this._fClick) {\n this._fClick(event);\n }\n this._lastClick = clickTime;\n this._clickX = posEvent.clientX;\n this._clickY = posEvent.clientY;\n }\n }\n return false;\n };\n /** @internal */\n DragDrop.prototype._onDragEnter = function (event) {\n this._preventDefault(event);\n this._stopPropagation(event);\n this._dragDepth++;\n return false;\n };\n /** @internal */\n DragDrop.prototype._onDragLeave = function (event) {\n this._preventDefault(event);\n this._stopPropagation(event);\n this._dragDepth--;\n if (this._dragDepth <= 0) {\n this._onDragCancel();\n }\n return false;\n };\n DragDrop.instance = new DragDrop();\n return DragDrop;\n}());\nexports.DragDrop = DragDrop;\n\n\n//# sourceURL=webpack://FlexLayout/./src/DragDrop.ts?");
|
|
109
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DragDrop\": () => (/* binding */ DragDrop)\n/* harmony export */ });\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Rect */ \"./src/Rect.ts\");\n\n/** @internal */\nconst canUseDOM = !!(typeof window !== \"undefined\" && window.document && window.document.createElement);\nclass DragDrop {\n /** @internal */\n constructor() {\n /** @internal */\n this._manualGlassManagement = false;\n /** @internal */\n this._startX = 0;\n /** @internal */\n this._startY = 0;\n /** @internal */\n this._dragDepth = 0;\n /** @internal */\n this._glassShowing = false;\n /** @internal */\n this._dragging = false;\n /** @internal */\n this._active = false; // drag and drop is in progress, can be used on ios to prevent body scrolling (see demo)\n if (canUseDOM) {\n // check for serverside rendering\n this._glass = document.createElement(\"div\");\n this._glass.style.zIndex = \"998\";\n this._glass.style.backgroundColor = \"transparent\";\n this._glass.style.outline = \"none\";\n }\n this._defaultGlassCursor = \"default\";\n this._onMouseMove = this._onMouseMove.bind(this);\n this._onMouseUp = this._onMouseUp.bind(this);\n this._onKeyPress = this._onKeyPress.bind(this);\n this._onDragCancel = this._onDragCancel.bind(this);\n this._onDragEnter = this._onDragEnter.bind(this);\n this._onDragLeave = this._onDragLeave.bind(this);\n this.resizeGlass = this.resizeGlass.bind(this);\n this._lastClick = 0;\n this._clickX = 0;\n this._clickY = 0;\n }\n // if you add the glass pane then you should remove it\n addGlass(fCancel) {\n var _a;\n if (!this._glassShowing) {\n if (!this._document) {\n this._document = window.document;\n }\n if (!this._rootElement) {\n this._rootElement = this._document.body;\n }\n this.resizeGlass();\n (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.addEventListener('resize', this.resizeGlass);\n this._document.body.appendChild(this._glass);\n this._glass.tabIndex = -1;\n this._glass.focus();\n this._glass.addEventListener(\"keydown\", this._onKeyPress);\n this._glass.addEventListener(\"dragenter\", this._onDragEnter, { passive: false });\n this._glass.addEventListener(\"dragover\", this._onMouseMove, { passive: false });\n this._glass.addEventListener(\"dragleave\", this._onDragLeave, { passive: false });\n this._glassShowing = true;\n this._fDragCancel = fCancel;\n this._manualGlassManagement = false;\n }\n else {\n // second call to addGlass (via dragstart)\n this._manualGlassManagement = true;\n }\n }\n resizeGlass() {\n const glassRect = _Rect__WEBPACK_IMPORTED_MODULE_0__.Rect.fromElement(this._rootElement);\n glassRect.positionElement(this._glass, \"fixed\");\n }\n hideGlass() {\n var _a;\n if (this._glassShowing) {\n this._document.body.removeChild(this._glass);\n (_a = this._document.defaultView) === null || _a === void 0 ? void 0 : _a.removeEventListener('resize', this.resizeGlass);\n this._glassShowing = false;\n this._document = undefined;\n this._rootElement = undefined;\n this.setGlassCursorOverride(undefined);\n }\n }\n /** @internal */\n _updateGlassCursor() {\n var _a;\n this._glass.style.cursor = (_a = this._glassCursorOverride) !== null && _a !== void 0 ? _a : this._defaultGlassCursor;\n }\n /** @internal */\n _setDefaultGlassCursor(cursor) {\n this._defaultGlassCursor = cursor;\n this._updateGlassCursor();\n }\n setGlassCursorOverride(cursor) {\n this._glassCursorOverride = cursor;\n this._updateGlassCursor();\n }\n startDrag(event, fDragStart, fDragMove, fDragEnd, fDragCancel, fClick, fDblClick, currentDocument, rootElement) {\n // prevent 'duplicate' action (mouse event for same action as previous touch event (a fix for ios))\n if (event && this._lastEvent && this._lastEvent.type.startsWith(\"touch\") && event.type.startsWith(\"mouse\") && event.timeStamp - this._lastEvent.timeStamp < 500) {\n return;\n }\n this._lastEvent = event;\n if (currentDocument) {\n this._document = currentDocument;\n }\n else {\n this._document = window.document;\n }\n if (rootElement) {\n this._rootElement = rootElement;\n }\n else {\n this._rootElement = this._document.body;\n }\n const posEvent = this._getLocationEvent(event);\n this.addGlass(fDragCancel);\n if (this._dragging) {\n console.warn(\"this._dragging true on startDrag should never happen\");\n }\n if (event) {\n this._startX = posEvent.clientX;\n this._startY = posEvent.clientY;\n if (!window.matchMedia || window.matchMedia(\"(pointer: fine)\").matches) {\n this._setDefaultGlassCursor(getComputedStyle(event.target).cursor);\n }\n this._stopPropagation(event);\n this._preventDefault(event);\n }\n else {\n this._startX = 0;\n this._startY = 0;\n this._setDefaultGlassCursor(\"default\");\n }\n this._dragging = false;\n this._fDragStart = fDragStart;\n this._fDragMove = fDragMove;\n this._fDragEnd = fDragEnd;\n this._fDragCancel = fDragCancel;\n this._fClick = fClick;\n this._fDblClick = fDblClick;\n this._active = true;\n if ((event === null || event === void 0 ? void 0 : event.type) === 'dragenter') {\n this._dragDepth = 1;\n this._rootElement.addEventListener(\"dragenter\", this._onDragEnter, { passive: false });\n this._rootElement.addEventListener(\"dragover\", this._onMouseMove, { passive: false });\n this._rootElement.addEventListener(\"dragleave\", this._onDragLeave, { passive: false });\n this._document.addEventListener(\"dragend\", this._onDragCancel, { passive: false });\n this._document.addEventListener(\"drop\", this._onMouseUp, { passive: false });\n }\n else {\n this._document.addEventListener(\"mouseup\", this._onMouseUp, { passive: false });\n this._document.addEventListener(\"mousemove\", this._onMouseMove, { passive: false });\n this._document.addEventListener(\"touchend\", this._onMouseUp, { passive: false });\n this._document.addEventListener(\"touchmove\", this._onMouseMove, { passive: false });\n }\n }\n isDragging() {\n return this._dragging;\n }\n isActive() {\n return this._active;\n }\n toString() {\n const rtn = \"(DragDrop: \" + \"startX=\" + this._startX + \", startY=\" + this._startY + \", dragging=\" + this._dragging + \")\";\n return rtn;\n }\n /** @internal */\n _onKeyPress(event) {\n if (event.keyCode === 27) {\n // esc\n this._onDragCancel();\n }\n }\n /** @internal */\n _onDragCancel() {\n this._rootElement.removeEventListener(\"dragenter\", this._onDragEnter);\n this._rootElement.removeEventListener(\"dragover\", this._onMouseMove);\n this._rootElement.removeEventListener(\"dragleave\", this._onDragLeave);\n this._document.removeEventListener(\"dragend\", this._onDragCancel);\n this._document.removeEventListener(\"drop\", this._onMouseUp);\n this._document.removeEventListener(\"mousemove\", this._onMouseMove);\n this._document.removeEventListener(\"mouseup\", this._onMouseUp);\n this._document.removeEventListener(\"touchend\", this._onMouseUp);\n this._document.removeEventListener(\"touchmove\", this._onMouseMove);\n this.hideGlass();\n if (this._fDragCancel !== undefined) {\n this._fDragCancel(this._dragging);\n }\n this._dragging = false;\n this._active = false;\n }\n /** @internal */\n _getLocationEvent(event) {\n let posEvent = event;\n if (event && event.touches) {\n posEvent = event.touches[0];\n }\n return posEvent;\n }\n /** @internal */\n _getLocationEventEnd(event) {\n let posEvent = event;\n if (event.changedTouches) {\n posEvent = event.changedTouches[0];\n }\n return posEvent;\n }\n /** @internal */\n _stopPropagation(event) {\n if (event.stopPropagation) {\n event.stopPropagation();\n }\n }\n /** @internal */\n _preventDefault(event) {\n if (event.preventDefault && event.cancelable) {\n event.preventDefault();\n }\n return event;\n }\n /** @internal */\n _onMouseMove(event) {\n this._lastEvent = event;\n const posEvent = this._getLocationEvent(event);\n this._stopPropagation(event);\n this._preventDefault(event);\n if (!this._dragging && (Math.abs(this._startX - posEvent.clientX) > 5 || Math.abs(this._startY - posEvent.clientY) > 5)) {\n this._dragging = true;\n if (this._fDragStart) {\n this._setDefaultGlassCursor(\"move\");\n this._dragging = this._fDragStart({ clientX: this._startX, clientY: this._startY });\n }\n }\n if (this._dragging) {\n if (this._fDragMove) {\n this._fDragMove(posEvent);\n }\n }\n return false;\n }\n /** @internal */\n _onMouseUp(event) {\n this._lastEvent = event;\n const posEvent = this._getLocationEventEnd(event);\n this._stopPropagation(event);\n this._preventDefault(event);\n this._active = false;\n this._rootElement.removeEventListener(\"dragenter\", this._onDragEnter);\n this._rootElement.removeEventListener(\"dragover\", this._onMouseMove);\n this._rootElement.removeEventListener(\"dragleave\", this._onDragLeave);\n this._document.removeEventListener(\"dragend\", this._onDragCancel);\n this._document.removeEventListener(\"drop\", this._onMouseUp);\n this._document.removeEventListener(\"mousemove\", this._onMouseMove);\n this._document.removeEventListener(\"mouseup\", this._onMouseUp);\n this._document.removeEventListener(\"touchend\", this._onMouseUp);\n this._document.removeEventListener(\"touchmove\", this._onMouseMove);\n if (!this._manualGlassManagement) {\n this.hideGlass();\n }\n if (this._dragging) {\n this._dragging = false;\n if (this._fDragEnd) {\n this._fDragEnd(event);\n }\n // dump(\"set dragging = false\\n\");\n }\n else {\n if (this._fDragCancel) {\n this._fDragCancel(this._dragging);\n }\n if (Math.abs(this._startX - posEvent.clientX) <= 5 && Math.abs(this._startY - posEvent.clientY) <= 5) {\n let isDoubleClick = false;\n const clickTime = new Date().getTime();\n // check for double click\n if (Math.abs(this._clickX - posEvent.clientX) <= 5 && Math.abs(this._clickY - posEvent.clientY) <= 5) {\n if (clickTime - this._lastClick < 500) {\n if (this._fDblClick) {\n this._fDblClick(event);\n isDoubleClick = true;\n }\n }\n }\n if (!isDoubleClick && this._fClick) {\n this._fClick(event);\n }\n this._lastClick = clickTime;\n this._clickX = posEvent.clientX;\n this._clickY = posEvent.clientY;\n }\n }\n return false;\n }\n /** @internal */\n _onDragEnter(event) {\n this._preventDefault(event);\n this._stopPropagation(event);\n this._dragDepth++;\n return false;\n }\n /** @internal */\n _onDragLeave(event) {\n this._preventDefault(event);\n this._stopPropagation(event);\n this._dragDepth--;\n if (this._dragDepth <= 0) {\n this._onDragCancel();\n }\n return false;\n }\n}\nDragDrop.instance = new DragDrop();\n\n\n//# sourceURL=webpack://FlexLayout/./src/DragDrop.ts?");
|
|
210
110
|
|
|
211
111
|
/***/ }),
|
|
212
112
|
|
|
@@ -214,9 +114,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
214
114
|
/*!*************************!*\
|
|
215
115
|
!*** ./src/DropInfo.ts ***!
|
|
216
116
|
\*************************/
|
|
217
|
-
/***/ ((__unused_webpack_module,
|
|
117
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
218
118
|
|
|
219
|
-
eval("
|
|
119
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"DropInfo\": () => (/* binding */ DropInfo)\n/* harmony export */ });\nclass DropInfo {\n constructor(node, rect, location, index, className) {\n this.node = node;\n this.rect = rect;\n this.location = location;\n this.index = index;\n this.className = className;\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/DropInfo.ts?");
|
|
220
120
|
|
|
221
121
|
/***/ }),
|
|
222
122
|
|
|
@@ -224,9 +124,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
224
124
|
/*!**************************!*\
|
|
225
125
|
!*** ./src/I18nLabel.ts ***!
|
|
226
126
|
\**************************/
|
|
227
|
-
/***/ ((__unused_webpack_module,
|
|
127
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
228
128
|
|
|
229
|
-
eval("
|
|
129
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"I18nLabel\": () => (/* binding */ I18nLabel)\n/* harmony export */ });\nvar I18nLabel;\n(function (I18nLabel) {\n I18nLabel[\"Close_Tab\"] = \"Close\";\n I18nLabel[\"Close_Tabset\"] = \"Close tabset\";\n I18nLabel[\"Move_Tab\"] = \"Move: \";\n I18nLabel[\"Move_Tabset\"] = \"Move tabset\";\n I18nLabel[\"Maximize\"] = \"Maximize tabset\";\n I18nLabel[\"Restore\"] = \"Restore tabset\";\n I18nLabel[\"Float_Tab\"] = \"Show selected tab in floating window\";\n I18nLabel[\"Overflow_Menu_Tooltip\"] = \"Hidden tabs\";\n I18nLabel[\"Floating_Window_Message\"] = \"This panel is shown in a floating window\";\n I18nLabel[\"Floating_Window_Show_Window\"] = \"Show window\";\n I18nLabel[\"Floating_Window_Dock_Window\"] = \"Dock window\";\n I18nLabel[\"Error_rendering_component\"] = \"Error rendering component\";\n})(I18nLabel || (I18nLabel = {}));\n\n\n//# sourceURL=webpack://FlexLayout/./src/I18nLabel.ts?");
|
|
230
130
|
|
|
231
131
|
/***/ }),
|
|
232
132
|
|
|
@@ -234,9 +134,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
234
134
|
/*!****************************!*\
|
|
235
135
|
!*** ./src/Orientation.ts ***!
|
|
236
136
|
\****************************/
|
|
237
|
-
/***/ ((__unused_webpack_module,
|
|
137
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
238
138
|
|
|
239
|
-
eval("
|
|
139
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Orientation\": () => (/* binding */ Orientation)\n/* harmony export */ });\nclass Orientation {\n /** @internal */\n constructor(name) {\n this._name = name;\n }\n static flip(from) {\n if (from === Orientation.HORZ) {\n return Orientation.VERT;\n }\n else {\n return Orientation.HORZ;\n }\n }\n getName() {\n return this._name;\n }\n toString() {\n return this._name;\n }\n}\nOrientation.HORZ = new Orientation(\"horz\");\nOrientation.VERT = new Orientation(\"vert\");\n\n\n//# sourceURL=webpack://FlexLayout/./src/Orientation.ts?");
|
|
240
140
|
|
|
241
141
|
/***/ }),
|
|
242
142
|
|
|
@@ -244,9 +144,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
244
144
|
/*!***************************!*\
|
|
245
145
|
!*** ./src/PopupMenu.tsx ***!
|
|
246
146
|
\***************************/
|
|
247
|
-
/***/ ((__unused_webpack_module,
|
|
147
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
248
148
|
|
|
249
|
-
eval("
|
|
149
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"showPopup\": () => (/* binding */ showPopup)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _DragDrop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./DragDrop */ \"./src/DragDrop.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Types */ \"./src/Types.ts\");\n/* harmony import */ var _view_TabButtonStamp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./view/TabButtonStamp */ \"./src/view/TabButtonStamp.tsx\");\n\n\n\n\n/** @internal */\nfunction showPopup(triggerElement, items, onSelect, layout, iconFactory, titleFactory) {\n const layoutDiv = layout.getRootDiv();\n const classNameMapper = layout.getClassName;\n const currentDocument = triggerElement.ownerDocument;\n const triggerRect = triggerElement.getBoundingClientRect();\n const layoutRect = layoutDiv.getBoundingClientRect();\n const elm = currentDocument.createElement(\"div\");\n elm.className = classNameMapper(_Types__WEBPACK_IMPORTED_MODULE_2__.CLASSES.FLEXLAYOUT__POPUP_MENU_CONTAINER);\n if (triggerRect.left < layoutRect.left + layoutRect.width / 2) {\n elm.style.left = triggerRect.left - layoutRect.left + \"px\";\n }\n else {\n elm.style.right = layoutRect.right - triggerRect.right + \"px\";\n }\n if (triggerRect.top < layoutRect.top + layoutRect.height / 2) {\n elm.style.top = triggerRect.top - layoutRect.top + \"px\";\n }\n else {\n elm.style.bottom = layoutRect.bottom - triggerRect.bottom + \"px\";\n }\n _DragDrop__WEBPACK_IMPORTED_MODULE_1__.DragDrop.instance.addGlass(() => onHide());\n _DragDrop__WEBPACK_IMPORTED_MODULE_1__.DragDrop.instance.setGlassCursorOverride(\"default\");\n layoutDiv.appendChild(elm);\n const onHide = () => {\n layout.hidePortal();\n _DragDrop__WEBPACK_IMPORTED_MODULE_1__.DragDrop.instance.hideGlass();\n layoutDiv.removeChild(elm);\n elm.removeEventListener(\"mousedown\", onElementMouseDown);\n currentDocument.removeEventListener(\"mousedown\", onDocMouseDown);\n };\n const onElementMouseDown = (event) => {\n event.stopPropagation();\n };\n const onDocMouseDown = (event) => {\n onHide();\n };\n elm.addEventListener(\"mousedown\", onElementMouseDown);\n currentDocument.addEventListener(\"mousedown\", onDocMouseDown);\n layout.showPortal(react__WEBPACK_IMPORTED_MODULE_0__.createElement(PopupMenu, { currentDocument: currentDocument, onSelect: onSelect, onHide: onHide, items: items, classNameMapper: classNameMapper, layout: layout, iconFactory: iconFactory, titleFactory: titleFactory }), elm);\n}\n/** @internal */\nconst PopupMenu = (props) => {\n const { items, onHide, onSelect, classNameMapper, layout, iconFactory, titleFactory } = props;\n const onItemClick = (item, event) => {\n onSelect(item);\n onHide();\n event.stopPropagation();\n };\n const itemElements = items.map((item, i) => (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: item.index, className: classNameMapper(_Types__WEBPACK_IMPORTED_MODULE_2__.CLASSES.FLEXLAYOUT__POPUP_MENU_ITEM), \"data-layout-path\": \"/popup-menu/tb\" + i, onClick: (event) => onItemClick(item, event), title: item.node.getHelpText() }, item.node.getModel().isLegacyOverflowMenu() ?\n item.node._getNameForOverflowMenu() :\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_view_TabButtonStamp__WEBPACK_IMPORTED_MODULE_3__.TabButtonStamp, { node: item.node, layout: layout, iconFactory: iconFactory, titleFactory: titleFactory }))));\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: classNameMapper(_Types__WEBPACK_IMPORTED_MODULE_2__.CLASSES.FLEXLAYOUT__POPUP_MENU), \"data-layout-path\": \"/popup-menu\" }, itemElements));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/PopupMenu.tsx?");
|
|
250
150
|
|
|
251
151
|
/***/ }),
|
|
252
152
|
|
|
@@ -254,9 +154,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
254
154
|
/*!*********************!*\
|
|
255
155
|
!*** ./src/Rect.ts ***!
|
|
256
156
|
\*********************/
|
|
257
|
-
/***/ ((__unused_webpack_module,
|
|
157
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
258
158
|
|
|
259
|
-
eval("
|
|
159
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Rect\": () => (/* binding */ Rect)\n/* harmony export */ });\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Orientation */ \"./src/Orientation.ts\");\n\nclass Rect {\n constructor(x, y, width, height) {\n this.x = x;\n this.y = y;\n this.width = width;\n this.height = height;\n }\n static empty() {\n return new Rect(0, 0, 0, 0);\n }\n static fromElement(element) {\n let { x, y, width, height } = element.getBoundingClientRect();\n return new Rect(x, y, width, height);\n }\n clone() {\n return new Rect(this.x, this.y, this.width, this.height);\n }\n equals(rect) {\n if (this.x === rect.x && this.y === rect.y && this.width === rect.width && this.height === rect.height) {\n return true;\n }\n else {\n return false;\n }\n }\n getBottom() {\n return this.y + this.height;\n }\n getRight() {\n return this.x + this.width;\n }\n getCenter() {\n return { x: this.x + this.width / 2, y: this.y + this.height / 2 };\n }\n positionElement(element, position) {\n this.styleWithPosition(element.style, position);\n }\n styleWithPosition(style, position = \"absolute\") {\n style.left = this.x + \"px\";\n style.top = this.y + \"px\";\n style.width = Math.max(0, this.width) + \"px\"; // need Math.max to prevent -ve, cause error in IE\n style.height = Math.max(0, this.height) + \"px\";\n style.position = position;\n return style;\n }\n contains(x, y) {\n if (this.x <= x && x <= this.getRight() && this.y <= y && y <= this.getBottom()) {\n return true;\n }\n else {\n return false;\n }\n }\n removeInsets(insets) {\n return new Rect(this.x + insets.left, this.y + insets.top, Math.max(0, this.width - insets.left - insets.right), Math.max(0, this.height - insets.top - insets.bottom));\n }\n centerInRect(outerRect) {\n this.x = (outerRect.width - this.width) / 2;\n this.y = (outerRect.height - this.height) / 2;\n }\n /** @internal */\n _getSize(orientation) {\n let prefSize = this.width;\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.VERT) {\n prefSize = this.height;\n }\n return prefSize;\n }\n toString() {\n return \"(Rect: x=\" + this.x + \", y=\" + this.y + \", width=\" + this.width + \", height=\" + this.height + \")\";\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/Rect.ts?");
|
|
260
160
|
|
|
261
161
|
/***/ }),
|
|
262
162
|
|
|
@@ -264,9 +164,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
264
164
|
/*!**********************!*\
|
|
265
165
|
!*** ./src/Types.ts ***!
|
|
266
166
|
\**********************/
|
|
267
|
-
/***/ ((__unused_webpack_module,
|
|
167
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
268
168
|
|
|
269
|
-
eval("
|
|
169
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CLASSES\": () => (/* binding */ CLASSES)\n/* harmony export */ });\nvar CLASSES;\n(function (CLASSES) {\n CLASSES[\"FLEXLAYOUT__BORDER\"] = \"flexlayout__border\";\n CLASSES[\"FLEXLAYOUT__BORDER_\"] = \"flexlayout__border_\";\n CLASSES[\"FLEXLAYOUT__BORDER_BUTTON\"] = \"flexlayout__border_button\";\n CLASSES[\"FLEXLAYOUT__BORDER_BUTTON_\"] = \"flexlayout__border_button_\";\n CLASSES[\"FLEXLAYOUT__BORDER_BUTTON_CONTENT\"] = \"flexlayout__border_button_content\";\n CLASSES[\"FLEXLAYOUT__BORDER_BUTTON_LEADING\"] = \"flexlayout__border_button_leading\";\n CLASSES[\"FLEXLAYOUT__BORDER_BUTTON_TRAILING\"] = \"flexlayout__border_button_trailing\";\n CLASSES[\"FLEXLAYOUT__BORDER_BUTTON__SELECTED\"] = \"flexlayout__border_button--selected\";\n CLASSES[\"FLEXLAYOUT__BORDER_BUTTON__UNSELECTED\"] = \"flexlayout__border_button--unselected\";\n CLASSES[\"FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW\"] = \"flexlayout__border_toolbar_button_overflow\";\n CLASSES[\"FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_\"] = \"flexlayout__border_toolbar_button_overflow_\";\n CLASSES[\"FLEXLAYOUT__BORDER_INNER\"] = \"flexlayout__border_inner\";\n CLASSES[\"FLEXLAYOUT__BORDER_INNER_\"] = \"flexlayout__border_inner_\";\n CLASSES[\"FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER\"] = \"flexlayout__border_inner_tab_container\";\n CLASSES[\"FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_\"] = \"flexlayout__border_inner_tab_container_\";\n CLASSES[\"FLEXLAYOUT__BORDER_TAB_DIVIDER\"] = \"flexlayout__border_tab_divider\";\n CLASSES[\"FLEXLAYOUT__BORDER_SIZER\"] = \"flexlayout__border_sizer\";\n CLASSES[\"FLEXLAYOUT__BORDER_TOOLBAR\"] = \"flexlayout__border_toolbar\";\n CLASSES[\"FLEXLAYOUT__BORDER_TOOLBAR_\"] = \"flexlayout__border_toolbar_\";\n CLASSES[\"FLEXLAYOUT__BORDER_TOOLBAR_BUTTON\"] = \"flexlayout__border_toolbar_button\";\n CLASSES[\"FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT\"] = \"flexlayout__border_toolbar_button-float\";\n CLASSES[\"FLEXLAYOUT__DRAG_RECT\"] = \"flexlayout__drag_rect\";\n CLASSES[\"FLEXLAYOUT__EDGE_RECT\"] = \"flexlayout__edge_rect\";\n CLASSES[\"FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER\"] = \"flexlayout__error_boundary_container\";\n CLASSES[\"FLEXLAYOUT__ERROR_BOUNDARY_CONTENT\"] = \"flexlayout__error_boundary_content\";\n CLASSES[\"FLEXLAYOUT__FLOATING_WINDOW_CONTENT\"] = \"flexlayout__floating_window_content\";\n CLASSES[\"FLEXLAYOUT__FLOATING_WINDOW_TAB\"] = \"flexlayout__floating_window_tab\";\n CLASSES[\"FLEXLAYOUT__LAYOUT\"] = \"flexlayout__layout\";\n CLASSES[\"FLEXLAYOUT__OUTLINE_RECT\"] = \"flexlayout__outline_rect\";\n CLASSES[\"FLEXLAYOUT__OUTLINE_RECT_EDGE\"] = \"flexlayout__outline_rect_edge\";\n CLASSES[\"FLEXLAYOUT__SPLITTER\"] = \"flexlayout__splitter\";\n CLASSES[\"FLEXLAYOUT__SPLITTER_EXTRA\"] = \"flexlayout__splitter_extra\";\n CLASSES[\"FLEXLAYOUT__SPLITTER_\"] = \"flexlayout__splitter_\";\n CLASSES[\"FLEXLAYOUT__SPLITTER_BORDER\"] = \"flexlayout__splitter_border\";\n CLASSES[\"FLEXLAYOUT__SPLITTER_DRAG\"] = \"flexlayout__splitter_drag\";\n CLASSES[\"FLEXLAYOUT__TAB\"] = \"flexlayout__tab\";\n CLASSES[\"FLEXLAYOUT__TABSET\"] = \"flexlayout__tabset\";\n CLASSES[\"FLEXLAYOUT__TABSET_HEADER\"] = \"flexlayout__tabset_header\";\n CLASSES[\"FLEXLAYOUT__TABSET_HEADER_SIZER\"] = \"flexlayout__tabset_header_sizer\";\n CLASSES[\"FLEXLAYOUT__TABSET_HEADER_CONTENT\"] = \"flexlayout__tabset_header_content\";\n CLASSES[\"FLEXLAYOUT__TABSET_MAXIMIZED\"] = \"flexlayout__tabset-maximized\";\n CLASSES[\"FLEXLAYOUT__TABSET_SELECTED\"] = \"flexlayout__tabset-selected\";\n CLASSES[\"FLEXLAYOUT__TABSET_SIZER\"] = \"flexlayout__tabset_sizer\";\n CLASSES[\"FLEXLAYOUT__TABSET_TAB_DIVIDER\"] = \"flexlayout__tabset_tab_divider\";\n CLASSES[\"FLEXLAYOUT__TABSET_CONTENT\"] = \"flexlayout__tabset_content\";\n CLASSES[\"FLEXLAYOUT__TABSET_TABBAR_INNER\"] = \"flexlayout__tabset_tabbar_inner\";\n CLASSES[\"FLEXLAYOUT__TABSET_TABBAR_INNER_\"] = \"flexlayout__tabset_tabbar_inner_\";\n CLASSES[\"FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER\"] = \"flexlayout__tabset_tabbar_inner_tab_container\";\n CLASSES[\"FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_\"] = \"flexlayout__tabset_tabbar_inner_tab_container_\";\n CLASSES[\"FLEXLAYOUT__TABSET_TABBAR_OUTER\"] = \"flexlayout__tabset_tabbar_outer\";\n CLASSES[\"FLEXLAYOUT__TABSET_TABBAR_OUTER_\"] = \"flexlayout__tabset_tabbar_outer_\";\n CLASSES[\"FLEXLAYOUT__TAB_BORDER\"] = \"flexlayout__tab_border\";\n CLASSES[\"FLEXLAYOUT__TAB_BORDER_\"] = \"flexlayout__tab_border_\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON\"] = \"flexlayout__tab_button\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON_CONTENT\"] = \"flexlayout__tab_button_content\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON_LEADING\"] = \"flexlayout__tab_button_leading\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON_OVERFLOW\"] = \"flexlayout__tab_button_overflow\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT\"] = \"flexlayout__tab_button_overflow_count\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON_TEXTBOX\"] = \"flexlayout__tab_button_textbox\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON_TRAILING\"] = \"flexlayout__tab_button_trailing\";\n CLASSES[\"FLEXLAYOUT__TAB_BUTTON_STAMP\"] = \"flexlayout__tab_button_stamp\";\n CLASSES[\"FLEXLAYOUT__TAB_FLOATING\"] = \"flexlayout__tab_floating\";\n CLASSES[\"FLEXLAYOUT__TAB_FLOATING_INNER\"] = \"flexlayout__tab_floating_inner\";\n CLASSES[\"FLEXLAYOUT__TAB_TOOLBAR\"] = \"flexlayout__tab_toolbar\";\n CLASSES[\"FLEXLAYOUT__TAB_TOOLBAR_BUTTON\"] = \"flexlayout__tab_toolbar_button\";\n CLASSES[\"FLEXLAYOUT__TAB_TOOLBAR_BUTTON_\"] = \"flexlayout__tab_toolbar_button-\";\n CLASSES[\"FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT\"] = \"flexlayout__tab_toolbar_button-float\";\n CLASSES[\"FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER\"] = \"flexlayout__tab_toolbar_sticky_buttons_container\";\n CLASSES[\"FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE\"] = \"flexlayout__tab_toolbar_button-close\";\n CLASSES[\"FLEXLAYOUT__POPUP_MENU_CONTAINER\"] = \"flexlayout__popup_menu_container\";\n CLASSES[\"FLEXLAYOUT__POPUP_MENU_ITEM\"] = \"flexlayout__popup_menu_item\";\n CLASSES[\"FLEXLAYOUT__POPUP_MENU\"] = \"flexlayout__popup_menu\";\n})(CLASSES || (CLASSES = {}));\n\n\n//# sourceURL=webpack://FlexLayout/./src/Types.ts?");
|
|
270
170
|
|
|
271
171
|
/***/ }),
|
|
272
172
|
|
|
@@ -274,9 +174,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
274
174
|
/*!**********************!*\
|
|
275
175
|
!*** ./src/index.ts ***!
|
|
276
176
|
\**********************/
|
|
277
|
-
/***/ (
|
|
177
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
278
178
|
|
|
279
|
-
eval("\
|
|
179
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Action\": () => (/* reexport safe */ _model_Action__WEBPACK_IMPORTED_MODULE_1__.Action),\n/* harmony export */ \"Actions\": () => (/* reexport safe */ _model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions),\n/* harmony export */ \"BorderNode\": () => (/* reexport safe */ _model_BorderNode__WEBPACK_IMPORTED_MODULE_3__.BorderNode),\n/* harmony export */ \"BorderSet\": () => (/* reexport safe */ _model_BorderSet__WEBPACK_IMPORTED_MODULE_4__.BorderSet),\n/* harmony export */ \"CLASSES\": () => (/* reexport safe */ _Types__WEBPACK_IMPORTED_MODULE_21__.CLASSES),\n/* harmony export */ \"DockLocation\": () => (/* reexport safe */ _DockLocation__WEBPACK_IMPORTED_MODULE_15__.DockLocation),\n/* harmony export */ \"DragDrop\": () => (/* reexport safe */ _DragDrop__WEBPACK_IMPORTED_MODULE_16__.DragDrop),\n/* harmony export */ \"DropInfo\": () => (/* reexport safe */ _DropInfo__WEBPACK_IMPORTED_MODULE_17__.DropInfo),\n/* harmony export */ \"I18nLabel\": () => (/* reexport safe */ _I18nLabel__WEBPACK_IMPORTED_MODULE_18__.I18nLabel),\n/* harmony export */ \"ICloseType\": () => (/* reexport safe */ _model_ICloseType__WEBPACK_IMPORTED_MODULE_5__.ICloseType),\n/* harmony export */ \"Layout\": () => (/* reexport safe */ _view_Layout__WEBPACK_IMPORTED_MODULE_0__.Layout),\n/* harmony export */ \"Model\": () => (/* reexport safe */ _model_Model__WEBPACK_IMPORTED_MODULE_9__.Model),\n/* harmony export */ \"Node\": () => (/* reexport safe */ _model_Node__WEBPACK_IMPORTED_MODULE_10__.Node),\n/* harmony export */ \"Orientation\": () => (/* reexport safe */ _Orientation__WEBPACK_IMPORTED_MODULE_19__.Orientation),\n/* harmony export */ \"Rect\": () => (/* reexport safe */ _Rect__WEBPACK_IMPORTED_MODULE_20__.Rect),\n/* harmony export */ \"RowNode\": () => (/* reexport safe */ _model_RowNode__WEBPACK_IMPORTED_MODULE_11__.RowNode),\n/* harmony export */ \"SplitterNode\": () => (/* reexport safe */ _model_SplitterNode__WEBPACK_IMPORTED_MODULE_12__.SplitterNode),\n/* harmony export */ \"TabNode\": () => (/* reexport safe */ _model_TabNode__WEBPACK_IMPORTED_MODULE_13__.TabNode),\n/* harmony export */ \"TabSetNode\": () => (/* reexport safe */ _model_TabSetNode__WEBPACK_IMPORTED_MODULE_14__.TabSetNode)\n/* harmony export */ });\n/* harmony import */ var _view_Layout__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./view/Layout */ \"./src/view/Layout.tsx\");\n/* harmony import */ var _model_Action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./model/Action */ \"./src/model/Action.ts\");\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _model_BorderNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./model/BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _model_BorderSet__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./model/BorderSet */ \"./src/model/BorderSet.ts\");\n/* harmony import */ var _model_ICloseType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./model/ICloseType */ \"./src/model/ICloseType.ts\");\n/* harmony import */ var _model_IDraggable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./model/IDraggable */ \"./src/model/IDraggable.ts\");\n/* harmony import */ var _model_IDropTarget__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./model/IDropTarget */ \"./src/model/IDropTarget.ts\");\n/* harmony import */ var _model_IJsonModel__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./model/IJsonModel */ \"./src/model/IJsonModel.ts\");\n/* harmony import */ var _model_Model__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./model/Model */ \"./src/model/Model.ts\");\n/* harmony import */ var _model_Node__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./model/Node */ \"./src/model/Node.ts\");\n/* harmony import */ var _model_RowNode__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./model/RowNode */ \"./src/model/RowNode.ts\");\n/* harmony import */ var _model_SplitterNode__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./model/SplitterNode */ \"./src/model/SplitterNode.ts\");\n/* harmony import */ var _model_TabNode__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./model/TabNode */ \"./src/model/TabNode.ts\");\n/* harmony import */ var _model_TabSetNode__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./model/TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _DragDrop__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./DragDrop */ \"./src/DragDrop.ts\");\n/* harmony import */ var _DropInfo__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./DropInfo */ \"./src/DropInfo.ts\");\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Types */ \"./src/Types.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://FlexLayout/./src/index.ts?");
|
|
280
180
|
|
|
281
181
|
/***/ }),
|
|
282
182
|
|
|
@@ -284,9 +184,9 @@ eval("\nvar __createBinding = (this && this.__createBinding) || (Object.create ?
|
|
|
284
184
|
/*!*****************************!*\
|
|
285
185
|
!*** ./src/model/Action.ts ***!
|
|
286
186
|
\*****************************/
|
|
287
|
-
/***/ ((__unused_webpack_module,
|
|
187
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
288
188
|
|
|
289
|
-
eval("
|
|
189
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Action\": () => (/* binding */ Action)\n/* harmony export */ });\nclass Action {\n constructor(type, data) {\n this.type = type;\n this.data = data;\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Action.ts?");
|
|
290
190
|
|
|
291
191
|
/***/ }),
|
|
292
192
|
|
|
@@ -294,9 +194,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
294
194
|
/*!******************************!*\
|
|
295
195
|
!*** ./src/model/Actions.ts ***!
|
|
296
196
|
\******************************/
|
|
297
|
-
/***/ ((__unused_webpack_module,
|
|
197
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
298
198
|
|
|
299
|
-
eval("
|
|
199
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Actions\": () => (/* binding */ Actions)\n/* harmony export */ });\n/* harmony import */ var _Action__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Action */ \"./src/model/Action.ts\");\n\n/**\n * The Action creator class for FlexLayout model actions\n */\nclass Actions {\n /**\n * Adds a tab node to the given tabset node\n * @param json the json for the new tab node e.g {type:\"tab\", component:\"table\"}\n * @param toNodeId the new tab node will be added to the tabset with this node id\n * @param location the location where the new tab will be added, one of the DockLocation enum values.\n * @param index for docking to the center this value is the index of the tab, use -1 to add to the end.\n * @param select (optional) whether to select the new tab, overriding autoSelectTab\n * @returns {Action} the action\n */\n static addNode(json, toNodeId, location, index, select) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.ADD_NODE, {\n json,\n toNode: toNodeId,\n location: location.getName(),\n index,\n select,\n });\n }\n /**\n * Moves a node (tab or tabset) from one location to another\n * @param fromNodeId the id of the node to move\n * @param toNodeId the id of the node to receive the moved node\n * @param location the location where the moved node will be added, one of the DockLocation enum values.\n * @param index for docking to the center this value is the index of the tab, use -1 to add to the end.\n * @param select (optional) whether to select the moved tab(s) in new tabset, overriding autoSelectTab\n * @returns {Action} the action\n */\n static moveNode(fromNodeId, toNodeId, location, index, select) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.MOVE_NODE, {\n fromNode: fromNodeId,\n toNode: toNodeId,\n location: location.getName(),\n index,\n select,\n });\n }\n /**\n * Deletes a tab node from the layout\n * @param tabsetNodeId the id of the tab node to delete\n * @returns {Action} the action\n */\n static deleteTab(tabNodeId) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.DELETE_TAB, { node: tabNodeId });\n }\n /**\n * Deletes a tabset node and all it's child tab nodes from the layout\n * @param tabsetNodeId the id of the tabset node to delete\n * @returns {Action} the action\n */\n static deleteTabset(tabsetNodeId) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.DELETE_TABSET, { node: tabsetNodeId });\n }\n /**\n * Change the given nodes tab text\n * @param tabNodeId the id of the node to rename\n * @param text the test of the tab\n * @returns {Action} the action\n */\n static renameTab(tabNodeId, text) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.RENAME_TAB, { node: tabNodeId, text });\n }\n /**\n * Selects the given tab in its parent tabset\n * @param tabNodeId the id of the node to set selected\n * @returns {Action} the action\n */\n static selectTab(tabNodeId) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.SELECT_TAB, { tabNode: tabNodeId });\n }\n /**\n * Set the given tabset node as the active tabset\n * @param tabsetNodeId the id of the tabset node to set as active\n * @returns {Action} the action\n */\n static setActiveTabset(tabsetNodeId) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.SET_ACTIVE_TABSET, { tabsetNode: tabsetNodeId });\n }\n /**\n * Adjust the splitter between two tabsets\n * @example\n * Actions.adjustSplit({node1: \"1\", weight1:30, pixelWidth1:300, node2: \"2\", weight2:70, pixelWidth2:700});\n *\n * @param splitSpec an object the defines the new split between two tabsets, see example below.\n * @returns {Action} the action\n */\n static adjustSplit(splitSpec) {\n const node1 = splitSpec.node1Id;\n const node2 = splitSpec.node2Id;\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.ADJUST_SPLIT, {\n node1,\n weight1: splitSpec.weight1,\n pixelWidth1: splitSpec.pixelWidth1,\n node2,\n weight2: splitSpec.weight2,\n pixelWidth2: splitSpec.pixelWidth2,\n });\n }\n static adjustBorderSplit(nodeId, pos) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.ADJUST_BORDER_SPLIT, { node: nodeId, pos });\n }\n /**\n * Maximizes the given tabset\n * @param tabsetNodeId the id of the tabset to maximize\n * @returns {Action} the action\n */\n static maximizeToggle(tabsetNodeId) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.MAXIMIZE_TOGGLE, { node: tabsetNodeId });\n }\n /**\n * Updates the global model jsone attributes\n * @param attributes the json for the model attributes to update (merge into the existing attributes)\n * @returns {Action} the action\n */\n static updateModelAttributes(attributes) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.UPDATE_MODEL_ATTRIBUTES, { json: attributes });\n }\n /**\n * Updates the given nodes json attributes\n * @param nodeId the id of the node to update\n * @param attributes the json attributes to update (merge with the existing attributes)\n * @returns {Action} the action\n */\n static updateNodeAttributes(nodeId, attributes) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.UPDATE_NODE_ATTRIBUTES, { node: nodeId, json: attributes });\n }\n static floatTab(nodeId) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.FLOAT_TAB, { node: nodeId });\n }\n static unFloatTab(nodeId) {\n return new _Action__WEBPACK_IMPORTED_MODULE_0__.Action(Actions.UNFLOAT_TAB, { node: nodeId });\n }\n}\nActions.ADD_NODE = \"FlexLayout_AddNode\";\nActions.MOVE_NODE = \"FlexLayout_MoveNode\";\nActions.DELETE_TAB = \"FlexLayout_DeleteTab\";\nActions.DELETE_TABSET = \"FlexLayout_DeleteTabset\";\nActions.RENAME_TAB = \"FlexLayout_RenameTab\";\nActions.SELECT_TAB = \"FlexLayout_SelectTab\";\nActions.SET_ACTIVE_TABSET = \"FlexLayout_SetActiveTabset\";\nActions.ADJUST_SPLIT = \"FlexLayout_AdjustSplit\";\nActions.ADJUST_BORDER_SPLIT = \"FlexLayout_AdjustBorderSplit\";\nActions.MAXIMIZE_TOGGLE = \"FlexLayout_MaximizeToggle\";\nActions.UPDATE_MODEL_ATTRIBUTES = \"FlexLayout_UpdateModelAttributes\";\nActions.UPDATE_NODE_ATTRIBUTES = \"FlexLayout_UpdateNodeAttributes\";\nActions.FLOAT_TAB = \"FlexLayout_FloatTab\";\nActions.UNFLOAT_TAB = \"FlexLayout_UnFloatTab\";\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Actions.ts?");
|
|
300
200
|
|
|
301
201
|
/***/ }),
|
|
302
202
|
|
|
@@ -304,9 +204,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
304
204
|
/*!*********************************!*\
|
|
305
205
|
!*** ./src/model/BorderNode.ts ***!
|
|
306
206
|
\*********************************/
|
|
307
|
-
/***/ (
|
|
207
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
308
208
|
|
|
309
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.BorderNode = void 0;\nvar Attribute_1 = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\nvar AttributeDefinitions_1 = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\nvar DockLocation_1 = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\nvar DropInfo_1 = __webpack_require__(/*! ../DropInfo */ \"./src/DropInfo.ts\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Rect_1 = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\nvar Types_1 = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\nvar Node_1 = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\nvar SplitterNode_1 = __webpack_require__(/*! ./SplitterNode */ \"./src/model/SplitterNode.ts\");\nvar TabNode_1 = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\nvar Utils_1 = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\nvar BorderNode = /** @class */ (function (_super) {\n __extends(BorderNode, _super);\n /** @internal */\n function BorderNode(location, json, model) {\n var _this = _super.call(this, model) || this;\n /** @internal */\n _this._adjustedSize = 0;\n /** @internal */\n _this._calculatedBorderBarSize = 0;\n _this._location = location;\n _this._drawChildren = [];\n _this._attributes.id = \"border_\".concat(location.getName());\n BorderNode._attributeDefinitions.fromJson(json, _this._attributes);\n model._addNode(_this);\n return _this;\n }\n /** @internal */\n BorderNode._fromJson = function (json, model) {\n var location = DockLocation_1.DockLocation.getByName(json.location);\n var border = new BorderNode(location, json, model);\n if (json.children) {\n border._children = json.children.map(function (jsonChild) {\n var child = TabNode_1.TabNode._fromJson(jsonChild, model);\n child._setParent(border);\n return child;\n });\n }\n return border;\n };\n /** @internal */\n BorderNode._createAttributeDefinitions = function () {\n var attributeDefinitions = new AttributeDefinitions_1.AttributeDefinitions();\n attributeDefinitions.add(\"type\", BorderNode.TYPE, true).setType(Attribute_1.Attribute.STRING).setFixed();\n attributeDefinitions.add(\"selected\", -1).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"show\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"config\", undefined).setType(\"any\");\n attributeDefinitions.addInherited(\"barSize\", \"borderBarSize\").setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.addInherited(\"enableDrop\", \"borderEnableDrop\").setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"className\", \"borderClassName\").setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.addInherited(\"autoSelectTabWhenOpen\", \"borderAutoSelectTabWhenOpen\").setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"autoSelectTabWhenClosed\", \"borderAutoSelectTabWhenClosed\").setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"size\", \"borderSize\").setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.addInherited(\"minSize\", \"borderMinSize\").setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.addInherited(\"enableAutoHide\", \"borderEnableAutoHide\").setType(Attribute_1.Attribute.BOOLEAN);\n return attributeDefinitions;\n };\n BorderNode.prototype.getLocation = function () {\n return this._location;\n };\n BorderNode.prototype.getTabHeaderRect = function () {\n return this._tabHeaderRect;\n };\n BorderNode.prototype.getRect = function () {\n return this._tabHeaderRect;\n };\n BorderNode.prototype.getContentRect = function () {\n return this._contentRect;\n };\n BorderNode.prototype.isEnableDrop = function () {\n return this._getAttr(\"enableDrop\");\n };\n BorderNode.prototype.isAutoSelectTab = function (whenOpen) {\n if (whenOpen == null) {\n whenOpen = this.getSelected() !== -1;\n }\n if (whenOpen) {\n return this._getAttr(\"autoSelectTabWhenOpen\");\n }\n else {\n return this._getAttr(\"autoSelectTabWhenClosed\");\n }\n };\n BorderNode.prototype.getClassName = function () {\n return this._getAttr(\"className\");\n };\n /** @internal */\n BorderNode.prototype.calcBorderBarSize = function (metrics) {\n var barSize = this._getAttr(\"barSize\");\n if (barSize !== 0) {\n // its defined\n this._calculatedBorderBarSize = barSize;\n }\n else {\n this._calculatedBorderBarSize = metrics.borderBarSize;\n }\n };\n BorderNode.prototype.getBorderBarSize = function () {\n return this._calculatedBorderBarSize;\n };\n BorderNode.prototype.getSize = function () {\n var defaultSize = this._getAttr(\"size\");\n var selected = this.getSelected();\n if (selected === -1) {\n return defaultSize;\n }\n else {\n var tabNode = this._children[selected];\n var tabBorderSize = (this._location._orientation === Orientation_1.Orientation.HORZ) ? tabNode._getAttr(\"borderWidth\") : tabNode._getAttr(\"borderHeight\");\n if (tabBorderSize === -1) {\n return defaultSize;\n }\n else {\n return tabBorderSize;\n }\n }\n };\n BorderNode.prototype.getMinSize = function () {\n return this._getAttr(\"minSize\");\n };\n BorderNode.prototype.getSelected = function () {\n return this._attributes.selected;\n };\n BorderNode.prototype.getSelectedNode = function () {\n if (this.getSelected() !== -1) {\n return this._children[this.getSelected()];\n }\n return undefined;\n };\n BorderNode.prototype.getOrientation = function () {\n return this._location.getOrientation();\n };\n /**\n * Returns the config attribute that can be used to store node specific data that\n * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather\n * than directly, for example:\n * this.state.model.doAction(\n * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));\n */\n BorderNode.prototype.getConfig = function () {\n return this._attributes.config;\n };\n BorderNode.prototype.isMaximized = function () {\n return false;\n };\n BorderNode.prototype.isShowing = function () {\n var show = this._attributes.show;\n if (show) {\n if (this._model._getShowHiddenBorder() !== this._location && this.isAutoHide() && this._children.length === 0) {\n return false;\n }\n return true;\n }\n else {\n return false;\n }\n };\n BorderNode.prototype.isAutoHide = function () {\n return this._getAttr(\"enableAutoHide\");\n };\n /** @internal */\n BorderNode.prototype._setSelected = function (index) {\n this._attributes.selected = index;\n };\n /** @internal */\n BorderNode.prototype._setSize = function (pos) {\n var selected = this.getSelected();\n if (selected === -1) {\n this._attributes.size = pos;\n }\n else {\n var tabNode = this._children[selected];\n var tabBorderSize = (this._location._orientation === Orientation_1.Orientation.HORZ) ? tabNode._getAttr(\"borderWidth\") : tabNode._getAttr(\"borderHeight\");\n if (tabBorderSize === -1) {\n this._attributes.size = pos;\n }\n else {\n if (this._location._orientation === Orientation_1.Orientation.HORZ) {\n tabNode._setBorderWidth(pos);\n }\n else {\n tabNode._setBorderHeight(pos);\n }\n }\n }\n };\n /** @internal */\n BorderNode.prototype._updateAttrs = function (json) {\n BorderNode._attributeDefinitions.update(json, this._attributes);\n };\n /** @internal */\n BorderNode.prototype._getDrawChildren = function () {\n return this._drawChildren;\n };\n /** @internal */\n BorderNode.prototype._setAdjustedSize = function (size) {\n this._adjustedSize = size;\n };\n /** @internal */\n BorderNode.prototype._getAdjustedSize = function () {\n return this._adjustedSize;\n };\n /** @internal */\n BorderNode.prototype._layoutBorderOuter = function (outer, metrics) {\n this.calcBorderBarSize(metrics);\n var split1 = this._location.split(outer, this.getBorderBarSize()); // split border outer\n this._tabHeaderRect = split1.start;\n return split1.end;\n };\n /** @internal */\n BorderNode.prototype._layoutBorderInner = function (inner, metrics) {\n this._drawChildren = [];\n var location = this._location;\n var split1 = location.split(inner, this._adjustedSize + this._model.getSplitterSize()); // split off tab contents\n var split2 = location.reflect().split(split1.start, this._model.getSplitterSize()); // split contents into content and splitter\n this._contentRect = split2.end;\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child._layout(this._contentRect, metrics);\n child._setVisible(i === this.getSelected());\n this._drawChildren.push(child);\n }\n if (this.getSelected() === -1) {\n return inner;\n }\n else {\n var newSplitter = new SplitterNode_1.SplitterNode(this._model);\n newSplitter._setParent(this);\n newSplitter._setRect(split2.start);\n this._drawChildren.push(newSplitter);\n return split1.end;\n }\n };\n /** @internal */\n BorderNode.prototype._remove = function (node) {\n var removedIndex = this._removeChild(node);\n if (this.getSelected() !== -1) {\n (0, Utils_1.adjustSelectedIndex)(this, removedIndex);\n }\n };\n /** @internal */\n BorderNode.prototype.canDrop = function (dragNode, x, y) {\n if (dragNode.getType() !== TabNode_1.TabNode.TYPE) {\n return undefined;\n }\n var dropInfo;\n var dockLocation = DockLocation_1.DockLocation.CENTER;\n if (this._tabHeaderRect.contains(x, y)) {\n if (this._location._orientation === Orientation_1.Orientation.VERT) {\n if (this._children.length > 0) {\n var child = this._children[0];\n var childRect = child.getTabRect();\n var childY = childRect.y;\n var childHeight = childRect.height;\n var pos = this._tabHeaderRect.x;\n var childCenter = 0;\n for (var i = 0; i < this._children.length; i++) {\n child = this._children[i];\n childRect = child.getTabRect();\n childCenter = childRect.x + childRect.width / 2;\n if (x >= pos && x < childCenter) {\n var outlineRect = new Rect_1.Rect(childRect.x - 2, childY, 3, childHeight);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, i, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n break;\n }\n pos = childCenter;\n }\n if (dropInfo == null) {\n var outlineRect = new Rect_1.Rect(childRect.getRight() - 2, childY, 3, childHeight);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, this._children.length, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n else {\n var outlineRect = new Rect_1.Rect(this._tabHeaderRect.x + 1, this._tabHeaderRect.y + 2, 3, 18);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, 0, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n else {\n if (this._children.length > 0) {\n var child = this._children[0];\n var childRect = child.getTabRect();\n var childX = childRect.x;\n var childWidth = childRect.width;\n var pos = this._tabHeaderRect.y;\n var childCenter = 0;\n for (var i = 0; i < this._children.length; i++) {\n child = this._children[i];\n childRect = child.getTabRect();\n childCenter = childRect.y + childRect.height / 2;\n if (y >= pos && y < childCenter) {\n var outlineRect = new Rect_1.Rect(childX, childRect.y - 2, childWidth, 3);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, i, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n break;\n }\n pos = childCenter;\n }\n if (dropInfo == null) {\n var outlineRect = new Rect_1.Rect(childX, childRect.getBottom() - 2, childWidth, 3);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, this._children.length, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n else {\n var outlineRect = new Rect_1.Rect(this._tabHeaderRect.x + 2, this._tabHeaderRect.y + 1, 18, 3);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, 0, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n }\n else if (this.getSelected() !== -1 && this._contentRect.contains(x, y)) {\n var outlineRect = this._contentRect;\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n }\n return dropInfo;\n };\n /** @internal */\n BorderNode.prototype.drop = function (dragNode, location, index, select) {\n var fromIndex = 0;\n var dragParent = dragNode.getParent();\n if (dragParent !== undefined) {\n fromIndex = dragParent._removeChild(dragNode);\n (0, Utils_1.adjustSelectedIndex)(dragParent, fromIndex);\n }\n // if dropping a tab back to same tabset and moving to forward position then reduce insertion index\n if (dragNode.getType() === TabNode_1.TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {\n index--;\n }\n // simple_bundled dock to existing tabset\n var insertPos = index;\n if (insertPos === -1) {\n insertPos = this._children.length;\n }\n if (dragNode.getType() === TabNode_1.TabNode.TYPE) {\n this._addChild(dragNode, insertPos);\n }\n if (select || (select !== false && this.isAutoSelectTab())) {\n this._setSelected(insertPos);\n }\n this._model._tidy();\n };\n BorderNode.prototype.toJson = function () {\n var json = {};\n BorderNode._attributeDefinitions.toJson(json, this._attributes);\n json.location = this._location.getName();\n json.children = this._children.map(function (child) { return child.toJson(); });\n return json;\n };\n /** @internal */\n BorderNode.prototype._getSplitterBounds = function (splitter, useMinSize) {\n if (useMinSize === void 0) { useMinSize = false; }\n var pBounds = [0, 0];\n var minSize = useMinSize ? this.getMinSize() : 0;\n var outerRect = this._model._getOuterInnerRects().outer;\n var innerRect = this._model._getOuterInnerRects().inner;\n var rootRow = this._model.getRoot();\n if (this._location === DockLocation_1.DockLocation.TOP) {\n pBounds[0] = outerRect.y + minSize;\n pBounds[1] = Math.max(pBounds[0], innerRect.getBottom() - splitter.getHeight() - rootRow.getMinHeight());\n }\n else if (this._location === DockLocation_1.DockLocation.LEFT) {\n pBounds[0] = outerRect.x + minSize;\n pBounds[1] = Math.max(pBounds[0], innerRect.getRight() - splitter.getWidth() - rootRow.getMinWidth());\n }\n else if (this._location === DockLocation_1.DockLocation.BOTTOM) {\n pBounds[1] = outerRect.getBottom() - splitter.getHeight() - minSize;\n pBounds[0] = Math.min(pBounds[1], innerRect.y + rootRow.getMinHeight());\n }\n else if (this._location === DockLocation_1.DockLocation.RIGHT) {\n pBounds[1] = outerRect.getRight() - splitter.getWidth() - minSize;\n pBounds[0] = Math.min(pBounds[1], innerRect.x + rootRow.getMinWidth());\n }\n return pBounds;\n };\n /** @internal */\n BorderNode.prototype._calculateSplit = function (splitter, splitterPos) {\n var pBounds = this._getSplitterBounds(splitter);\n if (this._location === DockLocation_1.DockLocation.BOTTOM || this._location === DockLocation_1.DockLocation.RIGHT) {\n return Math.max(0, pBounds[1] - splitterPos);\n }\n else {\n return Math.max(0, splitterPos - pBounds[0]);\n }\n };\n /** @internal */\n BorderNode.prototype._getAttributeDefinitions = function () {\n return BorderNode._attributeDefinitions;\n };\n /** @internal */\n BorderNode.getAttributeDefinitions = function () {\n return BorderNode._attributeDefinitions;\n };\n BorderNode.TYPE = \"border\";\n /** @internal */\n BorderNode._attributeDefinitions = BorderNode._createAttributeDefinitions();\n return BorderNode;\n}(Node_1.Node));\nexports.BorderNode = BorderNode;\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/BorderNode.ts?");
|
|
209
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BorderNode\": () => (/* binding */ BorderNode)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _DropInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../DropInfo */ \"./src/DropInfo.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _Node__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\n/* harmony import */ var _SplitterNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./SplitterNode */ \"./src/model/SplitterNode.ts\");\n/* harmony import */ var _TabNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\n\n\n\n\n\n\n\n\n\n\n\nclass BorderNode extends _Node__WEBPACK_IMPORTED_MODULE_7__.Node {\n /** @internal */\n constructor(location, json, model) {\n super(model);\n /** @internal */\n this._adjustedSize = 0;\n /** @internal */\n this._calculatedBorderBarSize = 0;\n this._location = location;\n this._drawChildren = [];\n this._attributes.id = `border_${location.getName()}`;\n BorderNode._attributeDefinitions.fromJson(json, this._attributes);\n model._addNode(this);\n }\n /** @internal */\n static _fromJson(json, model) {\n const location = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getByName(json.location);\n const border = new BorderNode(location, json, model);\n if (json.children) {\n border._children = json.children.map((jsonChild) => {\n const child = _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode._fromJson(jsonChild, model);\n child._setParent(border);\n return child;\n });\n }\n return border;\n }\n /** @internal */\n static _createAttributeDefinitions() {\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\n attributeDefinitions.add(\"type\", BorderNode.TYPE, true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING).setFixed();\n attributeDefinitions.add(\"selected\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"show\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"config\", undefined).setType(\"any\");\n attributeDefinitions.addInherited(\"barSize\", \"borderBarSize\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.addInherited(\"enableDrop\", \"borderEnableDrop\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"className\", \"borderClassName\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.addInherited(\"autoSelectTabWhenOpen\", \"borderAutoSelectTabWhenOpen\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"autoSelectTabWhenClosed\", \"borderAutoSelectTabWhenClosed\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"size\", \"borderSize\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.addInherited(\"minSize\", \"borderMinSize\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.addInherited(\"enableAutoHide\", \"borderEnableAutoHide\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n return attributeDefinitions;\n }\n getLocation() {\n return this._location;\n }\n getTabHeaderRect() {\n return this._tabHeaderRect;\n }\n getRect() {\n return this._tabHeaderRect;\n }\n getContentRect() {\n return this._contentRect;\n }\n isEnableDrop() {\n return this._getAttr(\"enableDrop\");\n }\n isAutoSelectTab(whenOpen) {\n if (whenOpen == null) {\n whenOpen = this.getSelected() !== -1;\n }\n if (whenOpen) {\n return this._getAttr(\"autoSelectTabWhenOpen\");\n }\n else {\n return this._getAttr(\"autoSelectTabWhenClosed\");\n }\n }\n getClassName() {\n return this._getAttr(\"className\");\n }\n /** @internal */\n calcBorderBarSize(metrics) {\n const barSize = this._getAttr(\"barSize\");\n if (barSize !== 0) {\n // its defined\n this._calculatedBorderBarSize = barSize;\n }\n else {\n this._calculatedBorderBarSize = metrics.borderBarSize;\n }\n }\n getBorderBarSize() {\n return this._calculatedBorderBarSize;\n }\n getSize() {\n const defaultSize = this._getAttr(\"size\");\n const selected = this.getSelected();\n if (selected === -1) {\n return defaultSize;\n }\n else {\n const tabNode = this._children[selected];\n const tabBorderSize = (this._location._orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) ? tabNode._getAttr(\"borderWidth\") : tabNode._getAttr(\"borderHeight\");\n if (tabBorderSize === -1) {\n return defaultSize;\n }\n else {\n return tabBorderSize;\n }\n }\n }\n getMinSize() {\n return this._getAttr(\"minSize\");\n }\n getSelected() {\n return this._attributes.selected;\n }\n getSelectedNode() {\n if (this.getSelected() !== -1) {\n return this._children[this.getSelected()];\n }\n return undefined;\n }\n getOrientation() {\n return this._location.getOrientation();\n }\n /**\n * Returns the config attribute that can be used to store node specific data that\n * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather\n * than directly, for example:\n * this.state.model.doAction(\n * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));\n */\n getConfig() {\n return this._attributes.config;\n }\n isMaximized() {\n return false;\n }\n isShowing() {\n const show = this._attributes.show;\n if (show) {\n if (this._model._getShowHiddenBorder() !== this._location && this.isAutoHide() && this._children.length === 0) {\n return false;\n }\n return true;\n }\n else {\n return false;\n }\n }\n isAutoHide() {\n return this._getAttr(\"enableAutoHide\");\n }\n /** @internal */\n _setSelected(index) {\n this._attributes.selected = index;\n }\n /** @internal */\n _setSize(pos) {\n const selected = this.getSelected();\n if (selected === -1) {\n this._attributes.size = pos;\n }\n else {\n const tabNode = this._children[selected];\n const tabBorderSize = (this._location._orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) ? tabNode._getAttr(\"borderWidth\") : tabNode._getAttr(\"borderHeight\");\n if (tabBorderSize === -1) {\n this._attributes.size = pos;\n }\n else {\n if (this._location._orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) {\n tabNode._setBorderWidth(pos);\n }\n else {\n tabNode._setBorderHeight(pos);\n }\n }\n }\n }\n /** @internal */\n _updateAttrs(json) {\n BorderNode._attributeDefinitions.update(json, this._attributes);\n }\n /** @internal */\n _getDrawChildren() {\n return this._drawChildren;\n }\n /** @internal */\n _setAdjustedSize(size) {\n this._adjustedSize = size;\n }\n /** @internal */\n _getAdjustedSize() {\n return this._adjustedSize;\n }\n /** @internal */\n _layoutBorderOuter(outer, metrics) {\n this.calcBorderBarSize(metrics);\n const split1 = this._location.split(outer, this.getBorderBarSize()); // split border outer\n this._tabHeaderRect = split1.start;\n return split1.end;\n }\n /** @internal */\n _layoutBorderInner(inner, metrics) {\n this._drawChildren = [];\n const location = this._location;\n const split1 = location.split(inner, this._adjustedSize + this._model.getSplitterSize()); // split off tab contents\n const split2 = location.reflect().split(split1.start, this._model.getSplitterSize()); // split contents into content and splitter\n this._contentRect = split2.end;\n for (let i = 0; i < this._children.length; i++) {\n const child = this._children[i];\n child._layout(this._contentRect, metrics);\n child._setVisible(i === this.getSelected());\n this._drawChildren.push(child);\n }\n if (this.getSelected() === -1) {\n return inner;\n }\n else {\n const newSplitter = new _SplitterNode__WEBPACK_IMPORTED_MODULE_8__.SplitterNode(this._model);\n newSplitter._setParent(this);\n newSplitter._setRect(split2.start);\n this._drawChildren.push(newSplitter);\n return split1.end;\n }\n }\n /** @internal */\n _remove(node) {\n const removedIndex = this._removeChild(node);\n if (this.getSelected() !== -1) {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_10__.adjustSelectedIndex)(this, removedIndex);\n }\n }\n /** @internal */\n canDrop(dragNode, x, y) {\n if (dragNode.getType() !== _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode.TYPE) {\n return undefined;\n }\n let dropInfo;\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\n if (this._tabHeaderRect.contains(x, y)) {\n if (this._location._orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.VERT) {\n if (this._children.length > 0) {\n let child = this._children[0];\n let childRect = child.getTabRect();\n const childY = childRect.y;\n const childHeight = childRect.height;\n let pos = this._tabHeaderRect.x;\n let childCenter = 0;\n for (let i = 0; i < this._children.length; i++) {\n child = this._children[i];\n childRect = child.getTabRect();\n childCenter = childRect.x + childRect.width / 2;\n if (x >= pos && x < childCenter) {\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(childRect.x - 2, childY, 3, childHeight);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, i, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n break;\n }\n pos = childCenter;\n }\n if (dropInfo == null) {\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(childRect.getRight() - 2, childY, 3, childHeight);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, this._children.length, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n else {\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(this._tabHeaderRect.x + 1, this._tabHeaderRect.y + 2, 3, 18);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, 0, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n else {\n if (this._children.length > 0) {\n let child = this._children[0];\n let childRect = child.getTabRect();\n const childX = childRect.x;\n const childWidth = childRect.width;\n let pos = this._tabHeaderRect.y;\n let childCenter = 0;\n for (let i = 0; i < this._children.length; i++) {\n child = this._children[i];\n childRect = child.getTabRect();\n childCenter = childRect.y + childRect.height / 2;\n if (y >= pos && y < childCenter) {\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(childX, childRect.y - 2, childWidth, 3);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, i, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n break;\n }\n pos = childCenter;\n }\n if (dropInfo == null) {\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(childX, childRect.getBottom() - 2, childWidth, 3);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, this._children.length, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n else {\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(this._tabHeaderRect.x + 2, this._tabHeaderRect.y + 1, 18, 3);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, 0, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n }\n else if (this.getSelected() !== -1 && this._contentRect.contains(x, y)) {\n const outlineRect = this._contentRect;\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, -1, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n }\n return dropInfo;\n }\n /** @internal */\n drop(dragNode, location, index, select) {\n let fromIndex = 0;\n const dragParent = dragNode.getParent();\n if (dragParent !== undefined) {\n fromIndex = dragParent._removeChild(dragNode);\n // if selected node in border is being docked into a different border then deselect border tabs\n if (dragParent !== this && dragParent instanceof BorderNode && dragParent.getSelected() === fromIndex) {\n dragParent._setSelected(-1);\n }\n else {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_10__.adjustSelectedIndex)(dragParent, fromIndex);\n }\n }\n // if dropping a tab back to same tabset and moving to forward position then reduce insertion index\n if (dragNode.getType() === _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {\n index--;\n }\n // simple_bundled dock to existing tabset\n let insertPos = index;\n if (insertPos === -1) {\n insertPos = this._children.length;\n }\n if (dragNode.getType() === _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode.TYPE) {\n this._addChild(dragNode, insertPos);\n }\n if (select || (select !== false && this.isAutoSelectTab())) {\n this._setSelected(insertPos);\n }\n this._model._tidy();\n }\n toJson() {\n const json = {};\n BorderNode._attributeDefinitions.toJson(json, this._attributes);\n json.location = this._location.getName();\n json.children = this._children.map((child) => child.toJson());\n return json;\n }\n /** @internal */\n _getSplitterBounds(splitter, useMinSize = false) {\n const pBounds = [0, 0];\n const minSize = useMinSize ? this.getMinSize() : 0;\n const outerRect = this._model._getOuterInnerRects().outer;\n const innerRect = this._model._getOuterInnerRects().inner;\n const rootRow = this._model.getRoot();\n if (this._location === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.TOP) {\n pBounds[0] = outerRect.y + minSize;\n pBounds[1] = Math.max(pBounds[0], innerRect.getBottom() - splitter.getHeight() - rootRow.getMinHeight());\n }\n else if (this._location === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.LEFT) {\n pBounds[0] = outerRect.x + minSize;\n pBounds[1] = Math.max(pBounds[0], innerRect.getRight() - splitter.getWidth() - rootRow.getMinWidth());\n }\n else if (this._location === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.BOTTOM) {\n pBounds[1] = outerRect.getBottom() - splitter.getHeight() - minSize;\n pBounds[0] = Math.min(pBounds[1], innerRect.y + rootRow.getMinHeight());\n }\n else if (this._location === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.RIGHT) {\n pBounds[1] = outerRect.getRight() - splitter.getWidth() - minSize;\n pBounds[0] = Math.min(pBounds[1], innerRect.x + rootRow.getMinWidth());\n }\n return pBounds;\n }\n /** @internal */\n _calculateSplit(splitter, splitterPos) {\n const pBounds = this._getSplitterBounds(splitter);\n if (this._location === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.BOTTOM || this._location === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.RIGHT) {\n return Math.max(0, pBounds[1] - splitterPos);\n }\n else {\n return Math.max(0, splitterPos - pBounds[0]);\n }\n }\n /** @internal */\n _getAttributeDefinitions() {\n return BorderNode._attributeDefinitions;\n }\n /** @internal */\n static getAttributeDefinitions() {\n return BorderNode._attributeDefinitions;\n }\n}\nBorderNode.TYPE = \"border\";\n/** @internal */\nBorderNode._attributeDefinitions = BorderNode._createAttributeDefinitions();\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/BorderNode.ts?");
|
|
310
210
|
|
|
311
211
|
/***/ }),
|
|
312
212
|
|
|
@@ -314,9 +214,9 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
314
214
|
/*!********************************!*\
|
|
315
215
|
!*** ./src/model/BorderSet.ts ***!
|
|
316
216
|
\********************************/
|
|
317
|
-
/***/ ((__unused_webpack_module,
|
|
217
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
318
218
|
|
|
319
|
-
eval("
|
|
219
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BorderSet\": () => (/* binding */ BorderSet)\n/* harmony export */ });\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _BorderNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\n\n\nclass BorderSet {\n /** @internal */\n constructor(model) {\n this._model = model;\n this._borders = [];\n }\n /** @internal */\n static _fromJson(json, model) {\n const borderSet = new BorderSet(model);\n borderSet._borders = json.map((borderJson) => _BorderNode__WEBPACK_IMPORTED_MODULE_1__.BorderNode._fromJson(borderJson, model));\n return borderSet;\n }\n getBorders() {\n return this._borders;\n }\n /** @internal */\n _forEachNode(fn) {\n for (const borderNode of this._borders) {\n fn(borderNode, 0);\n for (const node of borderNode.getChildren()) {\n node._forEachNode(fn, 1);\n }\n }\n }\n /** @internal */\n _toJson() {\n return this._borders.map((borderNode) => borderNode.toJson());\n }\n /** @internal */\n _layoutBorder(outerInnerRects, metrics) {\n const rect = outerInnerRects.outer;\n const rootRow = this._model.getRoot();\n let height = Math.max(0, rect.height - rootRow.getMinHeight());\n let width = Math.max(0, rect.width - rootRow.getMinWidth());\n let sumHeight = 0;\n let sumWidth = 0;\n let adjustableHeight = 0;\n let adjustableWidth = 0;\n const showingBorders = this._borders.filter((border) => border.isShowing());\n // sum size of borders to see they will fit\n for (const border of showingBorders) {\n border._setAdjustedSize(border.getSize());\n const visible = border.getSelected() !== -1;\n if (border.getLocation().getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.HORZ) {\n sumWidth += border.getBorderBarSize();\n if (visible) {\n width -= this._model.getSplitterSize();\n sumWidth += border.getSize();\n adjustableWidth += border.getSize();\n }\n }\n else {\n sumHeight += border.getBorderBarSize();\n if (visible) {\n height -= this._model.getSplitterSize();\n sumHeight += border.getSize();\n adjustableHeight += border.getSize();\n }\n }\n }\n // adjust border sizes if too large\n let j = 0;\n let adjusted = false;\n while ((sumWidth > width && adjustableWidth > 0) || (sumHeight > height && adjustableHeight > 0)) {\n const border = showingBorders[j];\n if (border.getSelected() !== -1) {\n // visible\n const size = border._getAdjustedSize();\n if (sumWidth > width && adjustableWidth > 0 && border.getLocation().getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.HORZ && size > 0\n && size > border.getMinSize()) {\n border._setAdjustedSize(size - 1);\n sumWidth--;\n adjustableWidth--;\n adjusted = true;\n }\n else if (sumHeight > height && adjustableHeight > 0 && border.getLocation().getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_0__.Orientation.VERT && size > 0\n && size > border.getMinSize()) {\n border._setAdjustedSize(size - 1);\n sumHeight--;\n adjustableHeight--;\n adjusted = true;\n }\n }\n j = (j + 1) % showingBorders.length;\n if (j === 0) {\n if (adjusted) {\n adjusted = false;\n }\n else {\n break;\n }\n }\n }\n for (const border of showingBorders) {\n outerInnerRects.outer = border._layoutBorderOuter(outerInnerRects.outer, metrics);\n }\n outerInnerRects.inner = outerInnerRects.outer;\n for (const border of showingBorders) {\n outerInnerRects.inner = border._layoutBorderInner(outerInnerRects.inner, metrics);\n }\n return outerInnerRects;\n }\n /** @internal */\n _findDropTargetNode(dragNode, x, y) {\n for (const border of this._borders) {\n if (border.isShowing()) {\n const dropInfo = border.canDrop(dragNode, x, y);\n if (dropInfo !== undefined) {\n return dropInfo;\n }\n }\n }\n return undefined;\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/BorderSet.ts?");
|
|
320
220
|
|
|
321
221
|
/***/ }),
|
|
322
222
|
|
|
@@ -324,9 +224,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
324
224
|
/*!*********************************!*\
|
|
325
225
|
!*** ./src/model/ICloseType.ts ***!
|
|
326
226
|
\*********************************/
|
|
327
|
-
/***/ ((__unused_webpack_module,
|
|
227
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
328
228
|
|
|
329
|
-
eval("
|
|
229
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ICloseType\": () => (/* binding */ ICloseType)\n/* harmony export */ });\nvar ICloseType;\n(function (ICloseType) {\n ICloseType[ICloseType[\"Visible\"] = 1] = \"Visible\";\n ICloseType[ICloseType[\"Always\"] = 2] = \"Always\";\n ICloseType[ICloseType[\"Selected\"] = 3] = \"Selected\";\n})(ICloseType || (ICloseType = {}));\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/ICloseType.ts?");
|
|
330
230
|
|
|
331
231
|
/***/ }),
|
|
332
232
|
|
|
@@ -334,9 +234,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
334
234
|
/*!*********************************!*\
|
|
335
235
|
!*** ./src/model/IDraggable.ts ***!
|
|
336
236
|
\*********************************/
|
|
337
|
-
/***/ ((__unused_webpack_module,
|
|
237
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
338
238
|
|
|
339
|
-
eval("
|
|
239
|
+
eval("__webpack_require__.r(__webpack_exports__);\n\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/IDraggable.ts?");
|
|
340
240
|
|
|
341
241
|
/***/ }),
|
|
342
242
|
|
|
@@ -344,9 +244,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n\n\n
|
|
|
344
244
|
/*!**********************************!*\
|
|
345
245
|
!*** ./src/model/IDropTarget.ts ***!
|
|
346
246
|
\**********************************/
|
|
347
|
-
/***/ ((__unused_webpack_module,
|
|
247
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
348
248
|
|
|
349
|
-
eval("
|
|
249
|
+
eval("__webpack_require__.r(__webpack_exports__);\n\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/IDropTarget.ts?");
|
|
350
250
|
|
|
351
251
|
/***/ }),
|
|
352
252
|
|
|
@@ -354,9 +254,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n\n\n
|
|
|
354
254
|
/*!*********************************!*\
|
|
355
255
|
!*** ./src/model/IJsonModel.ts ***!
|
|
356
256
|
\*********************************/
|
|
357
|
-
/***/ ((__unused_webpack_module,
|
|
257
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
358
258
|
|
|
359
|
-
eval("
|
|
259
|
+
eval("__webpack_require__.r(__webpack_exports__);\n\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/IJsonModel.ts?");
|
|
360
260
|
|
|
361
261
|
/***/ }),
|
|
362
262
|
|
|
@@ -364,9 +264,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\n\n\n
|
|
|
364
264
|
/*!****************************!*\
|
|
365
265
|
!*** ./src/model/Model.ts ***!
|
|
366
266
|
\****************************/
|
|
367
|
-
/***/ (
|
|
267
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
368
268
|
|
|
369
|
-
eval("\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Model = void 0;\nvar uuid_1 = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/index.js\");\nvar Attribute_1 = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\nvar AttributeDefinitions_1 = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\nvar DockLocation_1 = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Rect_1 = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\nvar Actions_1 = __webpack_require__(/*! ./Actions */ \"./src/model/Actions.ts\");\nvar BorderNode_1 = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\nvar BorderSet_1 = __webpack_require__(/*! ./BorderSet */ \"./src/model/BorderSet.ts\");\nvar RowNode_1 = __webpack_require__(/*! ./RowNode */ \"./src/model/RowNode.ts\");\nvar TabNode_1 = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\nvar TabSetNode_1 = __webpack_require__(/*! ./TabSetNode */ \"./src/model/TabSetNode.ts\");\nvar Utils_1 = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\n/**\n * Class containing the Tree of Nodes used by the FlexLayout component\n */\nvar Model = /** @class */ (function () {\n /**\n * 'private' constructor. Use the static method Model.fromJson(json) to create a model\n * @internal\n */\n function Model() {\n /** @internal */\n this._borderRects = { inner: Rect_1.Rect.empty(), outer: Rect_1.Rect.empty() };\n this._attributes = {};\n this._idMap = {};\n this._borders = new BorderSet_1.BorderSet(this);\n this._pointerFine = true;\n this._showHiddenBorder = DockLocation_1.DockLocation.CENTER;\n }\n /**\n * Loads the model from the given json object\n * @param json the json model to load\n * @returns {Model} a new Model object\n */\n Model.fromJson = function (json) {\n var model = new Model();\n Model._attributeDefinitions.fromJson(json.global, model._attributes);\n if (json.borders) {\n model._borders = BorderSet_1.BorderSet._fromJson(json.borders, model);\n }\n model._root = RowNode_1.RowNode._fromJson(json.layout, model);\n model._tidy(); // initial tidy of node tree\n return model;\n };\n /** @internal */\n Model._createAttributeDefinitions = function () {\n var attributeDefinitions = new AttributeDefinitions_1.AttributeDefinitions();\n attributeDefinitions.add(\"legacyOverflowMenu\", false).setType(Attribute_1.Attribute.BOOLEAN);\n // splitter\n attributeDefinitions.add(\"splitterSize\", -1).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"splitterExtra\", 0).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"enableEdgeDock\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"rootOrientationVertical\", false).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"marginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\n .setType(\"IInsets\");\n attributeDefinitions.add(\"enableUseVisibility\", false).setType(Attribute_1.Attribute.BOOLEAN);\n // tab\n attributeDefinitions.add(\"tabEnableClose\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabCloseType\", 1).setType(\"ICloseType\");\n attributeDefinitions.add(\"tabEnableFloat\", false).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabEnableDrag\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabEnableRename\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabClassName\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"tabIcon\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"tabEnableRenderOnDemand\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabDragSpeed\", 0.3).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"tabBorderWidth\", -1).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"tabBorderHeight\", -1).setType(Attribute_1.Attribute.NUMBER);\n // tabset\n attributeDefinitions.add(\"tabSetEnableDeleteWhenEmpty\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableDrop\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableDrag\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableDivide\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableMaximize\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableClose\", false).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetAutoSelectTab\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetClassNameTabStrip\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"tabSetClassNameHeader\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"tabSetEnableTabStrip\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetHeaderHeight\", 0).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"tabSetTabStripHeight\", 0).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"tabSetMarginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\n .setType(\"IInsets\");\n attributeDefinitions.add(\"tabSetBorderInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\n .setType(\"IInsets\");\n attributeDefinitions.add(\"tabSetTabLocation\", \"top\").setType(\"ITabLocation\");\n attributeDefinitions.add(\"tabSetMinWidth\", 0).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"tabSetMinHeight\", 0).setType(Attribute_1.Attribute.NUMBER);\n // border\n attributeDefinitions.add(\"borderSize\", 200).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"borderMinSize\", 0).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"borderBarSize\", 0).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"borderEnableDrop\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"borderAutoSelectTabWhenOpen\", true).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"borderAutoSelectTabWhenClosed\", false).setType(Attribute_1.Attribute.BOOLEAN);\n attributeDefinitions.add(\"borderClassName\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"borderEnableAutoHide\", false).setType(Attribute_1.Attribute.BOOLEAN);\n return attributeDefinitions;\n };\n /** @internal */\n Model.prototype._setChangeListener = function (listener) {\n this._changeListener = listener;\n };\n /**\n * Get the currently active tabset node\n */\n Model.prototype.getActiveTabset = function () {\n if (this._activeTabSet && this.getNodeById(this._activeTabSet.getId())) {\n return this._activeTabSet;\n }\n else {\n return undefined;\n }\n };\n /** @internal */\n Model.prototype._getShowHiddenBorder = function () {\n return this._showHiddenBorder;\n };\n /** @internal */\n Model.prototype._setShowHiddenBorder = function (location) {\n this._showHiddenBorder = location;\n };\n /** @internal */\n Model.prototype._setActiveTabset = function (tabsetNode) {\n this._activeTabSet = tabsetNode;\n };\n /**\n * Get the currently maximized tabset node\n */\n Model.prototype.getMaximizedTabset = function () {\n return this._maximizedTabSet;\n };\n /** @internal */\n Model.prototype._setMaximizedTabset = function (tabsetNode) {\n this._maximizedTabSet = tabsetNode;\n };\n /**\n * Gets the root RowNode of the model\n * @returns {RowNode}\n */\n Model.prototype.getRoot = function () {\n return this._root;\n };\n Model.prototype.isRootOrientationVertical = function () {\n return this._attributes.rootOrientationVertical;\n };\n Model.prototype.isUseVisibility = function () {\n return this._attributes.enableUseVisibility;\n };\n /**\n * Gets the\n * @returns {BorderSet|*}\n */\n Model.prototype.getBorderSet = function () {\n return this._borders;\n };\n /** @internal */\n Model.prototype._getOuterInnerRects = function () {\n return this._borderRects;\n };\n /** @internal */\n Model.prototype._getPointerFine = function () {\n return this._pointerFine;\n };\n /** @internal */\n Model.prototype._setPointerFine = function (pointerFine) {\n this._pointerFine = pointerFine;\n };\n /**\n * Visits all the nodes in the model and calls the given function for each\n * @param fn a function that takes visited node and a integer level as parameters\n */\n Model.prototype.visitNodes = function (fn) {\n this._borders._forEachNode(fn);\n this._root._forEachNode(fn, 0);\n };\n /**\n * Gets a node by its id\n * @param id the id to find\n */\n Model.prototype.getNodeById = function (id) {\n return this._idMap[id];\n };\n /**\n * Update the node tree by performing the given action,\n * Actions should be generated via static methods on the Actions class\n * @param action the action to perform\n * @returns added Node for Actions.addNode; undefined otherwise\n */\n Model.prototype.doAction = function (action) {\n var returnVal = undefined;\n // console.log(action);\n switch (action.type) {\n case Actions_1.Actions.ADD_NODE: {\n var newNode = new TabNode_1.TabNode(this, action.data.json, true);\n var toNode = this._idMap[action.data.toNode];\n if (toNode instanceof TabSetNode_1.TabSetNode || toNode instanceof BorderNode_1.BorderNode || toNode instanceof RowNode_1.RowNode) {\n toNode.drop(newNode, DockLocation_1.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\n returnVal = newNode;\n }\n break;\n }\n case Actions_1.Actions.MOVE_NODE: {\n var fromNode = this._idMap[action.data.fromNode];\n if (fromNode instanceof TabNode_1.TabNode || fromNode instanceof TabSetNode_1.TabSetNode) {\n var toNode = this._idMap[action.data.toNode];\n if (toNode instanceof TabSetNode_1.TabSetNode || toNode instanceof BorderNode_1.BorderNode || toNode instanceof RowNode_1.RowNode) {\n toNode.drop(fromNode, DockLocation_1.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\n }\n }\n break;\n }\n case Actions_1.Actions.DELETE_TAB: {\n var node = this._idMap[action.data.node];\n if (node instanceof TabNode_1.TabNode) {\n node._delete();\n }\n break;\n }\n case Actions_1.Actions.DELETE_TABSET: {\n var node = this._idMap[action.data.node];\n if (node instanceof TabSetNode_1.TabSetNode) {\n // first delete all child tabs that are closeable\n var children = __spreadArray([], node.getChildren(), true);\n for (var i = 0; i < children.length; i++) {\n var child = children[i];\n if (child.isEnableClose()) {\n child._delete();\n }\n }\n if (node.getChildren().length === 0) {\n node._delete();\n }\n this._tidy();\n }\n break;\n }\n case Actions_1.Actions.FLOAT_TAB: {\n var node = this._idMap[action.data.node];\n if (node instanceof TabNode_1.TabNode) {\n node._setFloating(true);\n (0, Utils_1.adjustSelectedIndexAfterFloat)(node);\n }\n break;\n }\n case Actions_1.Actions.UNFLOAT_TAB: {\n var node = this._idMap[action.data.node];\n if (node instanceof TabNode_1.TabNode) {\n node._setFloating(false);\n (0, Utils_1.adjustSelectedIndexAfterDock)(node);\n }\n break;\n }\n case Actions_1.Actions.RENAME_TAB: {\n var node = this._idMap[action.data.node];\n if (node instanceof TabNode_1.TabNode) {\n node._setName(action.data.text);\n }\n break;\n }\n case Actions_1.Actions.SELECT_TAB: {\n var tabNode = this._idMap[action.data.tabNode];\n if (tabNode instanceof TabNode_1.TabNode) {\n var parent_1 = tabNode.getParent();\n var pos = parent_1.getChildren().indexOf(tabNode);\n if (parent_1 instanceof BorderNode_1.BorderNode) {\n if (parent_1.getSelected() === pos) {\n parent_1._setSelected(-1);\n }\n else {\n parent_1._setSelected(pos);\n }\n }\n else if (parent_1 instanceof TabSetNode_1.TabSetNode) {\n if (parent_1.getSelected() !== pos) {\n parent_1._setSelected(pos);\n }\n this._activeTabSet = parent_1;\n }\n }\n break;\n }\n case Actions_1.Actions.SET_ACTIVE_TABSET: {\n var tabsetNode = this._idMap[action.data.tabsetNode];\n if (tabsetNode instanceof TabSetNode_1.TabSetNode) {\n this._activeTabSet = tabsetNode;\n }\n break;\n }\n case Actions_1.Actions.ADJUST_SPLIT: {\n var node1 = this._idMap[action.data.node1];\n var node2 = this._idMap[action.data.node2];\n if ((node1 instanceof TabSetNode_1.TabSetNode || node1 instanceof RowNode_1.RowNode) && (node2 instanceof TabSetNode_1.TabSetNode || node2 instanceof RowNode_1.RowNode)) {\n this._adjustSplitSide(node1, action.data.weight1, action.data.pixelWidth1);\n this._adjustSplitSide(node2, action.data.weight2, action.data.pixelWidth2);\n }\n break;\n }\n case Actions_1.Actions.ADJUST_BORDER_SPLIT: {\n var node = this._idMap[action.data.node];\n if (node instanceof BorderNode_1.BorderNode) {\n node._setSize(action.data.pos);\n }\n break;\n }\n case Actions_1.Actions.MAXIMIZE_TOGGLE: {\n var node = this._idMap[action.data.node];\n if (node instanceof TabSetNode_1.TabSetNode) {\n if (node === this._maximizedTabSet) {\n this._maximizedTabSet = undefined;\n }\n else {\n this._maximizedTabSet = node;\n this._activeTabSet = node;\n }\n }\n break;\n }\n case Actions_1.Actions.UPDATE_MODEL_ATTRIBUTES: {\n this._updateAttrs(action.data.json);\n break;\n }\n case Actions_1.Actions.UPDATE_NODE_ATTRIBUTES: {\n var node = this._idMap[action.data.node];\n node._updateAttrs(action.data.json);\n break;\n }\n default:\n break;\n }\n this._updateIdMap();\n if (this._changeListener !== undefined) {\n this._changeListener();\n }\n return returnVal;\n };\n /** @internal */\n Model.prototype._updateIdMap = function () {\n var _this = this;\n // regenerate idMap to stop it building up\n this._idMap = {};\n this.visitNodes(function (node) { return (_this._idMap[node.getId()] = node); });\n // console.log(JSON.stringify(Object.keys(this._idMap)));\n };\n /** @internal */\n Model.prototype._adjustSplitSide = function (node, weight, pixels) {\n node._setWeight(weight);\n if (node.getWidth() != null && node.getOrientation() === Orientation_1.Orientation.VERT) {\n node._updateAttrs({ width: pixels });\n }\n else if (node.getHeight() != null && node.getOrientation() === Orientation_1.Orientation.HORZ) {\n node._updateAttrs({ height: pixels });\n }\n };\n /**\n * Converts the model to a json object\n * @returns {IJsonModel} json object that represents this model\n */\n Model.prototype.toJson = function () {\n var global = {};\n Model._attributeDefinitions.toJson(global, this._attributes);\n // save state of nodes\n this.visitNodes(function (node) {\n node._fireEvent(\"save\", undefined);\n });\n return { global: global, borders: this._borders._toJson(), layout: this._root.toJson() };\n };\n Model.prototype.getSplitterSize = function () {\n var splitterSize = this._attributes.splitterSize;\n if (splitterSize === -1) {\n // use defaults\n splitterSize = this._pointerFine ? 8 : 12; // larger for mobile\n }\n return splitterSize;\n };\n Model.prototype.isLegacyOverflowMenu = function () {\n return this._attributes.legacyOverflowMenu;\n };\n Model.prototype.getSplitterExtra = function () {\n return this._attributes.splitterExtra;\n };\n Model.prototype.isEnableEdgeDock = function () {\n return this._attributes.enableEdgeDock;\n };\n /** @internal */\n Model.prototype._addNode = function (node) {\n var id = node.getId();\n if (this._idMap[id] !== undefined) {\n throw new Error(\"Error: each node must have a unique id, duplicate id:\".concat(node.getId()));\n }\n if (node.getType() !== \"splitter\") {\n this._idMap[id] = node;\n }\n };\n /** @internal */\n Model.prototype._layout = function (rect, metrics) {\n var _a;\n // let start = Date.now();\n this._borderRects = this._borders._layoutBorder({ outer: rect, inner: rect }, metrics);\n rect = this._borderRects.inner.removeInsets(this._getAttribute(\"marginInsets\"));\n (_a = this._root) === null || _a === void 0 ? void 0 : _a.calcMinSize();\n this._root._layout(rect, metrics);\n // console.log(\"layout time: \" + (Date.now() - start));\n return rect;\n };\n /** @internal */\n Model.prototype._findDropTargetNode = function (dragNode, x, y) {\n var node = this._root._findDropTargetNode(dragNode, x, y);\n if (node === undefined) {\n node = this._borders._findDropTargetNode(dragNode, x, y);\n }\n return node;\n };\n /** @internal */\n Model.prototype._tidy = function () {\n // console.log(\"before _tidy\", this.toString());\n this._root._tidy();\n // console.log(\"after _tidy\", this.toString());\n };\n /** @internal */\n Model.prototype._updateAttrs = function (json) {\n Model._attributeDefinitions.update(json, this._attributes);\n };\n /** @internal */\n Model.prototype._nextUniqueId = function () {\n return '#' + (0, uuid_1.v4)();\n };\n /** @internal */\n Model.prototype._getAttribute = function (name) {\n return this._attributes[name];\n };\n /**\n * Sets a function to allow/deny dropping a node\n * @param onAllowDrop function that takes the drag node and DropInfo and returns true if the drop is allowed\n */\n Model.prototype.setOnAllowDrop = function (onAllowDrop) {\n this._onAllowDrop = onAllowDrop;\n };\n /** @internal */\n Model.prototype._getOnAllowDrop = function () {\n return this._onAllowDrop;\n };\n /**\n * set callback called when a new TabSet is created.\n * The tabNode can be undefined if it's the auto created first tabset in the root row (when the last\n * tab is deleted, the root tabset can be recreated)\n * @param onCreateTabSet\n */\n Model.prototype.setOnCreateTabSet = function (onCreateTabSet) {\n this._onCreateTabSet = onCreateTabSet;\n };\n /** @internal */\n Model.prototype._getOnCreateTabSet = function () {\n return this._onCreateTabSet;\n };\n Model.toTypescriptInterfaces = function () {\n console.log(Model._attributeDefinitions.toTypescriptInterface(\"Global\", undefined));\n console.log(RowNode_1.RowNode.getAttributeDefinitions().toTypescriptInterface(\"Row\", Model._attributeDefinitions));\n console.log(TabSetNode_1.TabSetNode.getAttributeDefinitions().toTypescriptInterface(\"TabSet\", Model._attributeDefinitions));\n console.log(TabNode_1.TabNode.getAttributeDefinitions().toTypescriptInterface(\"Tab\", Model._attributeDefinitions));\n console.log(BorderNode_1.BorderNode.getAttributeDefinitions().toTypescriptInterface(\"Border\", Model._attributeDefinitions));\n };\n Model.prototype.toString = function () {\n return JSON.stringify(this.toJson());\n };\n /** @internal */\n Model._attributeDefinitions = Model._createAttributeDefinitions();\n return Model;\n}());\nexports.Model = Model;\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Model.ts?");
|
|
269
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Model\": () => (/* binding */ Model)\n/* harmony export */ });\n/* harmony import */ var uuid__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! uuid */ \"./node_modules/uuid/dist/esm-browser/v4.js\");\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Actions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _BorderNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _BorderSet__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BorderSet */ \"./src/model/BorderSet.ts\");\n/* harmony import */ var _RowNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./RowNode */ \"./src/model/RowNode.ts\");\n/* harmony import */ var _TabNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\n/* harmony import */ var _TabSetNode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * Class containing the Tree of Nodes used by the FlexLayout component\n */\nclass Model {\n /**\n * 'private' constructor. Use the static method Model.fromJson(json) to create a model\n * @internal\n */\n constructor() {\n /** @internal */\n this._borderRects = { inner: _Rect__WEBPACK_IMPORTED_MODULE_4__.Rect.empty(), outer: _Rect__WEBPACK_IMPORTED_MODULE_4__.Rect.empty() };\n this._attributes = {};\n this._idMap = {};\n this._borders = new _BorderSet__WEBPACK_IMPORTED_MODULE_7__.BorderSet(this);\n this._pointerFine = true;\n this._showHiddenBorder = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\n }\n /**\n * Loads the model from the given json object\n * @param json the json model to load\n * @returns {Model} a new Model object\n */\n static fromJson(json) {\n const model = new Model();\n Model._attributeDefinitions.fromJson(json.global, model._attributes);\n if (json.borders) {\n model._borders = _BorderSet__WEBPACK_IMPORTED_MODULE_7__.BorderSet._fromJson(json.borders, model);\n }\n model._root = _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode._fromJson(json.layout, model);\n model._tidy(); // initial tidy of node tree\n return model;\n }\n /** @internal */\n static _createAttributeDefinitions() {\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\n attributeDefinitions.add(\"legacyOverflowMenu\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n // splitter\n attributeDefinitions.add(\"splitterSize\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"splitterExtra\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"enableEdgeDock\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"rootOrientationVertical\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"marginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\n .setType(\"IInsets\");\n attributeDefinitions.add(\"enableUseVisibility\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n // tab\n attributeDefinitions.add(\"tabEnableClose\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabCloseType\", 1).setType(\"ICloseType\");\n attributeDefinitions.add(\"tabEnableFloat\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabEnableDrag\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabEnableRename\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabClassName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"tabIcon\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"tabEnableRenderOnDemand\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabDragSpeed\", 0.3).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"tabBorderWidth\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"tabBorderHeight\", -1).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n // tabset\n attributeDefinitions.add(\"tabSetEnableDeleteWhenEmpty\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableDrop\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableDrag\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableDivide\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableMaximize\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetEnableClose\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetAutoSelectTab\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetClassNameTabStrip\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"tabSetClassNameHeader\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"tabSetEnableTabStrip\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"tabSetHeaderHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"tabSetTabStripHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"tabSetMarginInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\n .setType(\"IInsets\");\n attributeDefinitions.add(\"tabSetBorderInsets\", { top: 0, right: 0, bottom: 0, left: 0 })\n .setType(\"IInsets\");\n attributeDefinitions.add(\"tabSetTabLocation\", \"top\").setType(\"ITabLocation\");\n attributeDefinitions.add(\"tabSetMinWidth\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"tabSetMinHeight\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n // border\n attributeDefinitions.add(\"borderSize\", 200).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"borderMinSize\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"borderBarSize\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"borderEnableDrop\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"borderAutoSelectTabWhenOpen\", true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"borderAutoSelectTabWhenClosed\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.add(\"borderClassName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"borderEnableAutoHide\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n return attributeDefinitions;\n }\n /** @internal */\n _setChangeListener(listener) {\n this._changeListener = listener;\n }\n /**\n * Get the currently active tabset node\n */\n getActiveTabset() {\n if (this._activeTabSet && this.getNodeById(this._activeTabSet.getId())) {\n return this._activeTabSet;\n }\n else {\n return undefined;\n }\n }\n /** @internal */\n _getShowHiddenBorder() {\n return this._showHiddenBorder;\n }\n /** @internal */\n _setShowHiddenBorder(location) {\n this._showHiddenBorder = location;\n }\n /** @internal */\n _setActiveTabset(tabsetNode) {\n this._activeTabSet = tabsetNode;\n }\n /**\n * Get the currently maximized tabset node\n */\n getMaximizedTabset() {\n return this._maximizedTabSet;\n }\n /** @internal */\n _setMaximizedTabset(tabsetNode) {\n this._maximizedTabSet = tabsetNode;\n }\n /**\n * Gets the root RowNode of the model\n * @returns {RowNode}\n */\n getRoot() {\n return this._root;\n }\n isRootOrientationVertical() {\n return this._attributes.rootOrientationVertical;\n }\n isUseVisibility() {\n return this._attributes.enableUseVisibility;\n }\n /**\n * Gets the\n * @returns {BorderSet|*}\n */\n getBorderSet() {\n return this._borders;\n }\n /** @internal */\n _getOuterInnerRects() {\n return this._borderRects;\n }\n /** @internal */\n _getPointerFine() {\n return this._pointerFine;\n }\n /** @internal */\n _setPointerFine(pointerFine) {\n this._pointerFine = pointerFine;\n }\n /**\n * Visits all the nodes in the model and calls the given function for each\n * @param fn a function that takes visited node and a integer level as parameters\n */\n visitNodes(fn) {\n this._borders._forEachNode(fn);\n this._root._forEachNode(fn, 0);\n }\n /**\n * Gets a node by its id\n * @param id the id to find\n */\n getNodeById(id) {\n return this._idMap[id];\n }\n /**\n * Update the node tree by performing the given action,\n * Actions should be generated via static methods on the Actions class\n * @param action the action to perform\n * @returns added Node for Actions.addNode; undefined otherwise\n */\n doAction(action) {\n let returnVal = undefined;\n // console.log(action);\n switch (action.type) {\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADD_NODE: {\n const newNode = new _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode(this, action.data.json, true);\n const toNode = this._idMap[action.data.toNode];\n if (toNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || toNode instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode || toNode instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) {\n toNode.drop(newNode, _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\n returnVal = newNode;\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.MOVE_NODE: {\n const fromNode = this._idMap[action.data.fromNode];\n if (fromNode instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode || fromNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\n const toNode = this._idMap[action.data.toNode];\n if (toNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || toNode instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode || toNode instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) {\n toNode.drop(fromNode, _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getByName(action.data.location), action.data.index, action.data.select);\n }\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.DELETE_TAB: {\n const node = this._idMap[action.data.node];\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\n node._delete();\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.DELETE_TABSET: {\n const node = this._idMap[action.data.node];\n if (node instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\n // first delete all child tabs that are closeable\n const children = [...node.getChildren()];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child.isEnableClose()) {\n child._delete();\n }\n }\n if (node.getChildren().length === 0) {\n node._delete();\n }\n this._tidy();\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.FLOAT_TAB: {\n const node = this._idMap[action.data.node];\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\n node._setFloating(true);\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndexAfterFloat)(node);\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UNFLOAT_TAB: {\n const node = this._idMap[action.data.node];\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\n node._setFloating(false);\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndexAfterDock)(node);\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.RENAME_TAB: {\n const node = this._idMap[action.data.node];\n if (node instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\n node._setName(action.data.text);\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.SELECT_TAB: {\n const tabNode = this._idMap[action.data.tabNode];\n if (tabNode instanceof _TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode) {\n const parent = tabNode.getParent();\n const pos = parent.getChildren().indexOf(tabNode);\n if (parent instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\n if (parent.getSelected() === pos) {\n parent._setSelected(-1);\n }\n else {\n parent._setSelected(pos);\n }\n }\n else if (parent instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\n if (parent.getSelected() !== pos) {\n parent._setSelected(pos);\n }\n this._activeTabSet = parent;\n }\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.SET_ACTIVE_TABSET: {\n const tabsetNode = this._idMap[action.data.tabsetNode];\n if (tabsetNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\n this._activeTabSet = tabsetNode;\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADJUST_SPLIT: {\n const node1 = this._idMap[action.data.node1];\n const node2 = this._idMap[action.data.node2];\n if ((node1 instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || node1 instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode) && (node2 instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode || node2 instanceof _RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode)) {\n this._adjustSplitSide(node1, action.data.weight1, action.data.pixelWidth1);\n this._adjustSplitSide(node2, action.data.weight2, action.data.pixelWidth2);\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.ADJUST_BORDER_SPLIT: {\n const node = this._idMap[action.data.node];\n if (node instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\n node._setSize(action.data.pos);\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.MAXIMIZE_TOGGLE: {\n const node = this._idMap[action.data.node];\n if (node instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\n if (node === this._maximizedTabSet) {\n this._maximizedTabSet = undefined;\n }\n else {\n this._maximizedTabSet = node;\n this._activeTabSet = node;\n }\n }\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UPDATE_MODEL_ATTRIBUTES: {\n this._updateAttrs(action.data.json);\n break;\n }\n case _Actions__WEBPACK_IMPORTED_MODULE_5__.Actions.UPDATE_NODE_ATTRIBUTES: {\n const node = this._idMap[action.data.node];\n node._updateAttrs(action.data.json);\n break;\n }\n default:\n break;\n }\n this._updateIdMap();\n if (this._changeListener !== undefined) {\n this._changeListener();\n }\n return returnVal;\n }\n /** @internal */\n _updateIdMap() {\n // regenerate idMap to stop it building up\n this._idMap = {};\n this.visitNodes((node) => (this._idMap[node.getId()] = node));\n // console.log(JSON.stringify(Object.keys(this._idMap)));\n }\n /** @internal */\n _adjustSplitSide(node, weight, pixels) {\n node._setWeight(weight);\n if (node.getWidth() != null && node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.VERT) {\n node._updateAttrs({ width: pixels });\n }\n else if (node.getHeight() != null && node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.HORZ) {\n node._updateAttrs({ height: pixels });\n }\n }\n /**\n * Converts the model to a json object\n * @returns {IJsonModel} json object that represents this model\n */\n toJson() {\n const global = {};\n Model._attributeDefinitions.toJson(global, this._attributes);\n // save state of nodes\n this.visitNodes((node) => {\n node._fireEvent(\"save\", undefined);\n });\n return { global, borders: this._borders._toJson(), layout: this._root.toJson() };\n }\n getSplitterSize() {\n let splitterSize = this._attributes.splitterSize;\n if (splitterSize === -1) {\n // use defaults\n splitterSize = this._pointerFine ? 8 : 12; // larger for mobile\n }\n return splitterSize;\n }\n isLegacyOverflowMenu() {\n return this._attributes.legacyOverflowMenu;\n }\n getSplitterExtra() {\n return this._attributes.splitterExtra;\n }\n isEnableEdgeDock() {\n return this._attributes.enableEdgeDock;\n }\n /** @internal */\n _addNode(node) {\n const id = node.getId();\n if (this._idMap[id] !== undefined) {\n throw new Error(`Error: each node must have a unique id, duplicate id:${node.getId()}`);\n }\n if (node.getType() !== \"splitter\") {\n this._idMap[id] = node;\n }\n }\n /** @internal */\n _layout(rect, metrics) {\n var _a;\n // let start = Date.now();\n this._borderRects = this._borders._layoutBorder({ outer: rect, inner: rect }, metrics);\n rect = this._borderRects.inner.removeInsets(this._getAttribute(\"marginInsets\"));\n (_a = this._root) === null || _a === void 0 ? void 0 : _a.calcMinSize();\n this._root._layout(rect, metrics);\n // console.log(\"layout time: \" + (Date.now() - start));\n return rect;\n }\n /** @internal */\n _findDropTargetNode(dragNode, x, y) {\n let node = this._root._findDropTargetNode(dragNode, x, y);\n if (node === undefined) {\n node = this._borders._findDropTargetNode(dragNode, x, y);\n }\n return node;\n }\n /** @internal */\n _tidy() {\n // console.log(\"before _tidy\", this.toString());\n this._root._tidy();\n // console.log(\"after _tidy\", this.toString());\n }\n /** @internal */\n _updateAttrs(json) {\n Model._attributeDefinitions.update(json, this._attributes);\n }\n /** @internal */\n _nextUniqueId() {\n return '#' + (0,uuid__WEBPACK_IMPORTED_MODULE_12__[\"default\"])();\n }\n /** @internal */\n _getAttribute(name) {\n return this._attributes[name];\n }\n /**\n * Sets a function to allow/deny dropping a node\n * @param onAllowDrop function that takes the drag node and DropInfo and returns true if the drop is allowed\n */\n setOnAllowDrop(onAllowDrop) {\n this._onAllowDrop = onAllowDrop;\n }\n /** @internal */\n _getOnAllowDrop() {\n return this._onAllowDrop;\n }\n /**\n * set callback called when a new TabSet is created.\n * The tabNode can be undefined if it's the auto created first tabset in the root row (when the last\n * tab is deleted, the root tabset can be recreated)\n * @param onCreateTabSet\n */\n setOnCreateTabSet(onCreateTabSet) {\n this._onCreateTabSet = onCreateTabSet;\n }\n /** @internal */\n _getOnCreateTabSet() {\n return this._onCreateTabSet;\n }\n static toTypescriptInterfaces() {\n console.log(Model._attributeDefinitions.toTypescriptInterface(\"Global\", undefined));\n console.log(_RowNode__WEBPACK_IMPORTED_MODULE_8__.RowNode.getAttributeDefinitions().toTypescriptInterface(\"Row\", Model._attributeDefinitions));\n console.log(_TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode.getAttributeDefinitions().toTypescriptInterface(\"TabSet\", Model._attributeDefinitions));\n console.log(_TabNode__WEBPACK_IMPORTED_MODULE_9__.TabNode.getAttributeDefinitions().toTypescriptInterface(\"Tab\", Model._attributeDefinitions));\n console.log(_BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode.getAttributeDefinitions().toTypescriptInterface(\"Border\", Model._attributeDefinitions));\n }\n toString() {\n return JSON.stringify(this.toJson());\n }\n}\n/** @internal */\nModel._attributeDefinitions = Model._createAttributeDefinitions();\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Model.ts?");
|
|
370
270
|
|
|
371
271
|
/***/ }),
|
|
372
272
|
|
|
@@ -374,9 +274,9 @@ eval("\nvar __spreadArray = (this && this.__spreadArray) || function (to, from,
|
|
|
374
274
|
/*!***************************!*\
|
|
375
275
|
!*** ./src/model/Node.ts ***!
|
|
376
276
|
\***************************/
|
|
377
|
-
/***/ ((__unused_webpack_module,
|
|
277
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
378
278
|
|
|
379
|
-
eval("
|
|
279
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Node\": () => (/* binding */ Node)\n/* harmony export */ });\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n\n\n\nclass Node {\n /** @internal */\n constructor(model) {\n /** @internal */\n this._dirty = false;\n /** @internal */\n this._tempSize = 0;\n this._model = model;\n this._attributes = {};\n this._children = [];\n this._fixed = false;\n this._rect = _Rect__WEBPACK_IMPORTED_MODULE_2__.Rect.empty();\n this._visible = false;\n this._listeners = {};\n }\n getId() {\n let id = this._attributes.id;\n if (id !== undefined) {\n return id;\n }\n id = this._model._nextUniqueId();\n this._setId(id);\n return id;\n }\n getModel() {\n return this._model;\n }\n getType() {\n return this._attributes.type;\n }\n getParent() {\n return this._parent;\n }\n getChildren() {\n return this._children;\n }\n getRect() {\n return this._rect;\n }\n isVisible() {\n return this._visible;\n }\n getOrientation() {\n if (this._parent === undefined) {\n return this._model.isRootOrientationVertical() ? _Orientation__WEBPACK_IMPORTED_MODULE_1__.Orientation.VERT : _Orientation__WEBPACK_IMPORTED_MODULE_1__.Orientation.HORZ;\n }\n else {\n return _Orientation__WEBPACK_IMPORTED_MODULE_1__.Orientation.flip(this._parent.getOrientation());\n }\n }\n // event can be: resize, visibility, maximize (on tabset), close\n setEventListener(event, callback) {\n this._listeners[event] = callback;\n }\n removeEventListener(event) {\n delete this._listeners[event];\n }\n /** @internal */\n _setId(id) {\n this._attributes.id = id;\n }\n /** @internal */\n _fireEvent(event, params) {\n // console.log(this._type, \" fireEvent \" + event + \" \" + JSON.stringify(params));\n if (this._listeners[event] !== undefined) {\n this._listeners[event](params);\n }\n }\n /** @internal */\n _getAttr(name) {\n let val = this._attributes[name];\n if (val === undefined) {\n const modelName = this._getAttributeDefinitions().getModelName(name);\n if (modelName !== undefined) {\n val = this._model._getAttribute(modelName);\n }\n }\n // console.log(name + \"=\" + val);\n return val;\n }\n /** @internal */\n _forEachNode(fn, level) {\n fn(this, level);\n level++;\n for (const node of this._children) {\n node._forEachNode(fn, level);\n }\n }\n /** @internal */\n _setVisible(visible) {\n if (visible !== this._visible) {\n this._fireEvent(\"visibility\", { visible });\n this._visible = visible;\n }\n }\n /** @internal */\n _getDrawChildren() {\n return this._children;\n }\n /** @internal */\n _setParent(parent) {\n this._parent = parent;\n }\n /** @internal */\n _setRect(rect) {\n this._rect = rect;\n }\n /** @internal */\n _setWeight(weight) {\n this._attributes.weight = weight;\n }\n /** @internal */\n _setSelected(index) {\n this._attributes.selected = index;\n }\n /** @internal */\n _isFixed() {\n return this._fixed;\n }\n /** @internal */\n _layout(rect, metrics) {\n this._rect = rect;\n }\n /** @internal */\n _findDropTargetNode(dragNode, x, y) {\n let rtn;\n if (this._rect.contains(x, y)) {\n if (this._model.getMaximizedTabset() !== undefined) {\n rtn = this._model.getMaximizedTabset().canDrop(dragNode, x, y);\n }\n else {\n rtn = this.canDrop(dragNode, x, y);\n if (rtn === undefined) {\n if (this._children.length !== 0) {\n for (const child of this._children) {\n rtn = child._findDropTargetNode(dragNode, x, y);\n if (rtn !== undefined) {\n break;\n }\n }\n }\n }\n }\n }\n return rtn;\n }\n /** @internal */\n canDrop(dragNode, x, y) {\n return undefined;\n }\n /** @internal */\n _canDockInto(dragNode, dropInfo) {\n if (dropInfo != null) {\n if (dropInfo.location === _DockLocation__WEBPACK_IMPORTED_MODULE_0__.DockLocation.CENTER && dropInfo.node.isEnableDrop() === false) {\n return false;\n }\n // prevent named tabset docking into another tabset, since this would lose the header\n if (dropInfo.location === _DockLocation__WEBPACK_IMPORTED_MODULE_0__.DockLocation.CENTER && dragNode.getType() === \"tabset\" && dragNode.getName() !== undefined) {\n return false;\n }\n if (dropInfo.location !== _DockLocation__WEBPACK_IMPORTED_MODULE_0__.DockLocation.CENTER && dropInfo.node.isEnableDivide() === false) {\n return false;\n }\n // finally check model callback to check if drop allowed\n if (this._model._getOnAllowDrop()) {\n return this._model._getOnAllowDrop()(dragNode, dropInfo);\n }\n }\n return true;\n }\n /** @internal */\n _removeChild(childNode) {\n const pos = this._children.indexOf(childNode);\n if (pos !== -1) {\n this._children.splice(pos, 1);\n }\n this._dirty = true;\n return pos;\n }\n /** @internal */\n _addChild(childNode, pos) {\n if (pos != null) {\n this._children.splice(pos, 0, childNode);\n }\n else {\n this._children.push(childNode);\n pos = this._children.length - 1;\n }\n childNode._parent = this;\n this._dirty = true;\n return pos;\n }\n /** @internal */\n _removeAll() {\n this._children = [];\n this._dirty = true;\n }\n /** @internal */\n _styleWithPosition(style) {\n if (style == null) {\n style = {};\n }\n return this._rect.styleWithPosition(style);\n }\n /** @internal */\n _getTempSize() {\n return this._tempSize;\n }\n /** @internal */\n _setTempSize(value) {\n this._tempSize = value;\n }\n /** @internal */\n isEnableDivide() {\n return true;\n }\n /** @internal */\n _toAttributeString() {\n return JSON.stringify(this._attributes, undefined, \"\\t\");\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Node.ts?");
|
|
380
280
|
|
|
381
281
|
/***/ }),
|
|
382
282
|
|
|
@@ -384,9 +284,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
384
284
|
/*!******************************!*\
|
|
385
285
|
!*** ./src/model/RowNode.ts ***!
|
|
386
286
|
\******************************/
|
|
387
|
-
/***/ (
|
|
287
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
388
288
|
|
|
389
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.RowNode = void 0;\nvar Attribute_1 = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\nvar AttributeDefinitions_1 = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\nvar DockLocation_1 = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\nvar DropInfo_1 = __webpack_require__(/*! ../DropInfo */ \"./src/DropInfo.ts\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Rect_1 = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\nvar Types_1 = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\nvar BorderNode_1 = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\nvar Node_1 = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\nvar SplitterNode_1 = __webpack_require__(/*! ./SplitterNode */ \"./src/model/SplitterNode.ts\");\nvar TabSetNode_1 = __webpack_require__(/*! ./TabSetNode */ \"./src/model/TabSetNode.ts\");\nvar RowNode = /** @class */ (function (_super) {\n __extends(RowNode, _super);\n /** @internal */\n function RowNode(model, json) {\n var _this = _super.call(this, model) || this;\n _this._dirty = true;\n _this._drawChildren = [];\n _this._minHeight = 0;\n _this._minWidth = 0;\n RowNode._attributeDefinitions.fromJson(json, _this._attributes);\n model._addNode(_this);\n return _this;\n }\n /** @internal */\n RowNode._fromJson = function (json, model) {\n var newLayoutNode = new RowNode(model, json);\n if (json.children != null) {\n for (var _i = 0, _a = json.children; _i < _a.length; _i++) {\n var jsonChild = _a[_i];\n if (jsonChild.type === TabSetNode_1.TabSetNode.TYPE) {\n var child = TabSetNode_1.TabSetNode._fromJson(jsonChild, model);\n newLayoutNode._addChild(child);\n }\n else {\n var child = RowNode._fromJson(jsonChild, model);\n newLayoutNode._addChild(child);\n }\n }\n }\n return newLayoutNode;\n };\n /** @internal */\n RowNode._createAttributeDefinitions = function () {\n var attributeDefinitions = new AttributeDefinitions_1.AttributeDefinitions();\n attributeDefinitions.add(\"type\", RowNode.TYPE, true).setType(Attribute_1.Attribute.STRING).setFixed();\n attributeDefinitions.add(\"id\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"weight\", 100).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"width\", undefined).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"height\", undefined).setType(Attribute_1.Attribute.NUMBER);\n return attributeDefinitions;\n };\n RowNode.prototype.getWeight = function () {\n return this._attributes.weight;\n };\n RowNode.prototype.getWidth = function () {\n return this._getAttr(\"width\");\n };\n RowNode.prototype.getHeight = function () {\n return this._getAttr(\"height\");\n };\n /** @internal */\n RowNode.prototype._setWeight = function (weight) {\n this._attributes.weight = weight;\n };\n /** @internal */\n RowNode.prototype._layout = function (rect, metrics) {\n _super.prototype._layout.call(this, rect, metrics);\n var pixelSize = this._rect._getSize(this.getOrientation());\n var totalWeight = 0;\n var fixedPixels = 0;\n var prefPixels = 0;\n var totalPrefWeight = 0;\n var drawChildren = this._getDrawChildren();\n for (var _i = 0, drawChildren_1 = drawChildren; _i < drawChildren_1.length; _i++) {\n var child = drawChildren_1[_i];\n var prefSize = child._getPrefSize(this.getOrientation());\n if (child._isFixed()) {\n if (prefSize !== undefined) {\n fixedPixels += prefSize;\n }\n }\n else {\n if (prefSize === undefined) {\n totalWeight += child.getWeight();\n }\n else {\n prefPixels += prefSize;\n totalPrefWeight += child.getWeight();\n }\n }\n }\n var resizePreferred = false;\n var availablePixels = pixelSize - fixedPixels - prefPixels;\n if (availablePixels < 0) {\n availablePixels = pixelSize - fixedPixels;\n resizePreferred = true;\n totalWeight += totalPrefWeight;\n }\n // assign actual pixel sizes\n var totalSizeGiven = 0;\n var variableSize = 0;\n for (var _a = 0, drawChildren_2 = drawChildren; _a < drawChildren_2.length; _a++) {\n var child = drawChildren_2[_a];\n var prefSize = child._getPrefSize(this.getOrientation());\n if (child._isFixed()) {\n if (prefSize !== undefined) {\n child._setTempSize(prefSize);\n }\n }\n else {\n if (prefSize == null || resizePreferred) {\n if (totalWeight === 0) {\n child._setTempSize(0);\n }\n else {\n var minSize = child.getMinSize(this.getOrientation());\n var size = Math.floor(availablePixels * (child.getWeight() / totalWeight));\n child._setTempSize(Math.max(minSize, size));\n }\n variableSize += child._getTempSize();\n }\n else {\n child._setTempSize(prefSize);\n }\n }\n totalSizeGiven += child._getTempSize();\n }\n // adjust sizes to exactly fit\n if (variableSize > 0) {\n while (totalSizeGiven < pixelSize) {\n for (var _b = 0, drawChildren_3 = drawChildren; _b < drawChildren_3.length; _b++) {\n var child = drawChildren_3[_b];\n if (!(child instanceof SplitterNode_1.SplitterNode)) {\n var prefSize = child._getPrefSize(this.getOrientation());\n if (!child._isFixed() && (prefSize === undefined || resizePreferred) && totalSizeGiven < pixelSize) {\n child._setTempSize(child._getTempSize() + 1);\n totalSizeGiven++;\n }\n }\n }\n }\n // decrease size using nodes not at there minimum\n while (totalSizeGiven > pixelSize) {\n var changed = false;\n for (var _c = 0, drawChildren_4 = drawChildren; _c < drawChildren_4.length; _c++) {\n var child = drawChildren_4[_c];\n if (!(child instanceof SplitterNode_1.SplitterNode)) {\n var minSize = child.getMinSize(this.getOrientation());\n var size = child._getTempSize();\n if (size > minSize && totalSizeGiven > pixelSize) {\n child._setTempSize(child._getTempSize() - 1);\n totalSizeGiven--;\n changed = true;\n }\n }\n }\n if (!changed) {\n // all children are at min values\n break;\n }\n }\n // if still too big then simply reduce all nodes until fits\n while (totalSizeGiven > pixelSize) {\n var changed = false;\n for (var _d = 0, drawChildren_5 = drawChildren; _d < drawChildren_5.length; _d++) {\n var child = drawChildren_5[_d];\n if (!(child instanceof SplitterNode_1.SplitterNode)) {\n var size = child._getTempSize();\n if (size > 0 && totalSizeGiven > pixelSize) {\n child._setTempSize(child._getTempSize() - 1);\n totalSizeGiven--;\n changed = true;\n }\n }\n }\n if (!changed) {\n // all children are at 0 values\n break;\n }\n }\n }\n // layout children\n var p = 0;\n for (var _e = 0, drawChildren_6 = drawChildren; _e < drawChildren_6.length; _e++) {\n var child = drawChildren_6[_e];\n if (this.getOrientation() === Orientation_1.Orientation.HORZ) {\n child._layout(new Rect_1.Rect(this._rect.x + p, this._rect.y, child._getTempSize(), this._rect.height), metrics);\n }\n else {\n child._layout(new Rect_1.Rect(this._rect.x, this._rect.y + p, this._rect.width, child._getTempSize()), metrics);\n }\n p += child._getTempSize();\n }\n return true;\n };\n /** @internal */\n RowNode.prototype._getSplitterBounds = function (splitterNode, useMinSize) {\n if (useMinSize === void 0) { useMinSize = false; }\n var pBounds = [0, 0];\n var drawChildren = this._getDrawChildren();\n var p = drawChildren.indexOf(splitterNode);\n var node1 = drawChildren[p - 1];\n var node2 = drawChildren[p + 1];\n if (this.getOrientation() === Orientation_1.Orientation.HORZ) {\n var minSize1 = useMinSize ? node1.getMinWidth() : 0;\n var minSize2 = useMinSize ? node2.getMinWidth() : 0;\n pBounds[0] = node1.getRect().x + minSize1;\n pBounds[1] = node2.getRect().getRight() - splitterNode.getWidth() - minSize2;\n }\n else {\n var minSize1 = useMinSize ? node1.getMinHeight() : 0;\n var minSize2 = useMinSize ? node2.getMinHeight() : 0;\n pBounds[0] = node1.getRect().y + minSize1;\n pBounds[1] = node2.getRect().getBottom() - splitterNode.getHeight() - minSize2;\n }\n return pBounds;\n };\n /** @internal */\n RowNode.prototype._calculateSplit = function (splitter, splitterPos) {\n var rtn;\n var drawChildren = this._getDrawChildren();\n var p = drawChildren.indexOf(splitter);\n var pBounds = this._getSplitterBounds(splitter);\n var weightedLength = drawChildren[p - 1].getWeight() + drawChildren[p + 1].getWeight();\n var pixelWidth1 = Math.max(0, splitterPos - pBounds[0]);\n var pixelWidth2 = Math.max(0, pBounds[1] - splitterPos);\n if (pixelWidth1 + pixelWidth2 > 0) {\n var weight1 = (pixelWidth1 * weightedLength) / (pixelWidth1 + pixelWidth2);\n var weight2 = (pixelWidth2 * weightedLength) / (pixelWidth1 + pixelWidth2);\n rtn = {\n node1Id: drawChildren[p - 1].getId(),\n weight1: weight1,\n pixelWidth1: pixelWidth1,\n node2Id: drawChildren[p + 1].getId(),\n weight2: weight2,\n pixelWidth2: pixelWidth2,\n };\n }\n return rtn;\n };\n /** @internal */\n RowNode.prototype._getDrawChildren = function () {\n if (this._dirty) {\n this._drawChildren = [];\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n if (i !== 0) {\n var newSplitter = new SplitterNode_1.SplitterNode(this._model);\n newSplitter._setParent(this);\n this._drawChildren.push(newSplitter);\n }\n this._drawChildren.push(child);\n }\n this._dirty = false;\n }\n return this._drawChildren;\n };\n /** @internal */\n RowNode.prototype.getMinSize = function (orientation) {\n if (orientation === Orientation_1.Orientation.HORZ) {\n return this.getMinWidth();\n }\n else {\n return this.getMinHeight();\n }\n };\n /** @internal */\n RowNode.prototype.getMinWidth = function () {\n return this._minWidth;\n };\n /** @internal */\n RowNode.prototype.getMinHeight = function () {\n return this._minHeight;\n };\n /** @internal */\n RowNode.prototype.calcMinSize = function () {\n this._minHeight = 0;\n this._minWidth = 0;\n var first = true;\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\n var child = _a[_i];\n var c = child;\n if (c instanceof RowNode) {\n c.calcMinSize();\n }\n if (this.getOrientation() === Orientation_1.Orientation.VERT) {\n this._minHeight += c.getMinHeight();\n if (!first) {\n this._minHeight += this._model.getSplitterSize();\n }\n this._minWidth = Math.max(this._minWidth, c.getMinWidth());\n }\n else {\n this._minWidth += c.getMinWidth();\n if (!first) {\n this._minWidth += this._model.getSplitterSize();\n }\n this._minHeight = Math.max(this._minHeight, c.getMinHeight());\n }\n first = false;\n }\n };\n /** @internal */\n RowNode.prototype._tidy = function () {\n var i = 0;\n while (i < this._children.length) {\n var child = this._children[i];\n if (child instanceof RowNode) {\n child._tidy();\n var childChildren = child.getChildren();\n if (childChildren.length === 0) {\n this._removeChild(child);\n }\n else if (childChildren.length === 1) {\n // hoist child/children up to this level\n var subchild = childChildren[0];\n this._removeChild(child);\n if (subchild instanceof RowNode) {\n var subChildrenTotal = 0;\n var subChildChildren = subchild.getChildren();\n for (var _i = 0, subChildChildren_1 = subChildChildren; _i < subChildChildren_1.length; _i++) {\n var ssc = subChildChildren_1[_i];\n var subsubChild = ssc;\n subChildrenTotal += subsubChild.getWeight();\n }\n for (var j = 0; j < subChildChildren.length; j++) {\n var subsubChild = subChildChildren[j];\n subsubChild._setWeight((child.getWeight() * subsubChild.getWeight()) / subChildrenTotal);\n this._addChild(subsubChild, i + j);\n }\n }\n else {\n subchild._setWeight(child.getWeight());\n this._addChild(subchild, i);\n }\n }\n else {\n i++;\n }\n }\n else if (child instanceof TabSetNode_1.TabSetNode && child.getChildren().length === 0) {\n if (child.isEnableDeleteWhenEmpty()) {\n this._removeChild(child);\n if (child === this._model.getMaximizedTabset()) {\n this._model._setMaximizedTabset(undefined);\n }\n }\n else {\n i++;\n }\n }\n else {\n i++;\n }\n }\n // add tabset into empty root\n if (this === this._model.getRoot() && this._children.length === 0) {\n var callback = this._model._getOnCreateTabSet();\n var attrs = callback ? callback() : {};\n attrs = __assign(__assign({}, attrs), { selected: -1 });\n var child = new TabSetNode_1.TabSetNode(this._model, attrs);\n this._model._setActiveTabset(child);\n this._addChild(child);\n }\n };\n /** @internal */\n RowNode.prototype.canDrop = function (dragNode, x, y) {\n var yy = y - this._rect.y;\n var xx = x - this._rect.x;\n var w = this._rect.width;\n var h = this._rect.height;\n var margin = 10; // height of edge rect\n var half = 50; // half width of edge rect\n var dropInfo;\n if (this._model.isEnableEdgeDock() && this._parent === undefined) {\n // _root row\n if (x < this._rect.x + margin && yy > h / 2 - half && yy < h / 2 + half) {\n var dockLocation = DockLocation_1.DockLocation.LEFT;\n var outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.width = outlineRect.width / 2;\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n else if (x > this._rect.getRight() - margin && yy > h / 2 - half && yy < h / 2 + half) {\n var dockLocation = DockLocation_1.DockLocation.RIGHT;\n var outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.width = outlineRect.width / 2;\n outlineRect.x += outlineRect.width;\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n else if (y < this._rect.y + margin && xx > w / 2 - half && xx < w / 2 + half) {\n var dockLocation = DockLocation_1.DockLocation.TOP;\n var outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.height = outlineRect.height / 2;\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n else if (y > this._rect.getBottom() - margin && xx > w / 2 - half && xx < w / 2 + half) {\n var dockLocation = DockLocation_1.DockLocation.BOTTOM;\n var outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.height = outlineRect.height / 2;\n outlineRect.y += outlineRect.height;\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n if (dropInfo !== undefined) {\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n }\n }\n return dropInfo;\n };\n /** @internal */\n RowNode.prototype.drop = function (dragNode, location, index) {\n var dockLocation = location;\n var parent = dragNode.getParent();\n if (parent) {\n parent._removeChild(dragNode);\n }\n if (parent !== undefined && parent.getType() === TabSetNode_1.TabSetNode.TYPE) {\n parent._setSelected(0);\n }\n if (parent !== undefined && parent.getType() === BorderNode_1.BorderNode.TYPE) {\n parent._setSelected(-1);\n }\n var tabSet;\n if (dragNode instanceof TabSetNode_1.TabSetNode) {\n tabSet = dragNode;\n }\n else {\n var callback = this._model._getOnCreateTabSet();\n tabSet = new TabSetNode_1.TabSetNode(this._model, callback ? callback(dragNode) : {});\n tabSet._addChild(dragNode);\n }\n var size = this._children.reduce(function (sum, child) {\n return sum + child.getWeight();\n }, 0);\n if (size === 0) {\n size = 100;\n }\n tabSet._setWeight(size / 3);\n var horz = !this._model.isRootOrientationVertical();\n if (horz && dockLocation === DockLocation_1.DockLocation.LEFT || !horz && dockLocation === DockLocation_1.DockLocation.TOP) {\n this._addChild(tabSet, 0);\n }\n else if (horz && dockLocation === DockLocation_1.DockLocation.RIGHT || !horz && dockLocation === DockLocation_1.DockLocation.BOTTOM) {\n this._addChild(tabSet);\n }\n else if (horz && dockLocation === DockLocation_1.DockLocation.TOP || !horz && dockLocation === DockLocation_1.DockLocation.LEFT) {\n var vrow = new RowNode(this._model, {});\n var hrow = new RowNode(this._model, {});\n hrow._setWeight(75);\n tabSet._setWeight(25);\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\n var child = _a[_i];\n hrow._addChild(child);\n }\n this._removeAll();\n vrow._addChild(tabSet);\n vrow._addChild(hrow);\n this._addChild(vrow);\n }\n else if (horz && dockLocation === DockLocation_1.DockLocation.BOTTOM || !horz && dockLocation === DockLocation_1.DockLocation.RIGHT) {\n var vrow = new RowNode(this._model, {});\n var hrow = new RowNode(this._model, {});\n hrow._setWeight(75);\n tabSet._setWeight(25);\n for (var _b = 0, _c = this._children; _b < _c.length; _b++) {\n var child = _c[_b];\n hrow._addChild(child);\n }\n this._removeAll();\n vrow._addChild(hrow);\n vrow._addChild(tabSet);\n this._addChild(vrow);\n }\n this._model._setActiveTabset(tabSet);\n this._model._tidy();\n };\n RowNode.prototype.toJson = function () {\n var json = {};\n RowNode._attributeDefinitions.toJson(json, this._attributes);\n json.children = [];\n for (var _i = 0, _a = this._children; _i < _a.length; _i++) {\n var child = _a[_i];\n json.children.push(child.toJson());\n }\n return json;\n };\n RowNode.prototype.isEnableDrop = function () {\n return true;\n };\n /** @internal */\n RowNode.prototype._getPrefSize = function (orientation) {\n var prefSize = this.getWidth();\n if (orientation === Orientation_1.Orientation.VERT) {\n prefSize = this.getHeight();\n }\n return prefSize;\n };\n /** @internal */\n RowNode.prototype._getAttributeDefinitions = function () {\n return RowNode._attributeDefinitions;\n };\n /** @internal */\n RowNode.prototype._updateAttrs = function (json) {\n RowNode._attributeDefinitions.update(json, this._attributes);\n };\n /** @internal */\n RowNode.getAttributeDefinitions = function () {\n return RowNode._attributeDefinitions;\n };\n RowNode.TYPE = \"row\";\n /** @internal */\n RowNode._attributeDefinitions = RowNode._createAttributeDefinitions();\n return RowNode;\n}(Node_1.Node));\nexports.RowNode = RowNode;\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/RowNode.ts?");
|
|
289
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"RowNode\": () => (/* binding */ RowNode)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _DropInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../DropInfo */ \"./src/DropInfo.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _BorderNode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _Node__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\n/* harmony import */ var _SplitterNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./SplitterNode */ \"./src/model/SplitterNode.ts\");\n/* harmony import */ var _TabSetNode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./TabSetNode */ \"./src/model/TabSetNode.ts\");\n\n\n\n\n\n\n\n\n\n\n\nclass RowNode extends _Node__WEBPACK_IMPORTED_MODULE_8__.Node {\n /** @internal */\n constructor(model, json) {\n super(model);\n this._dirty = true;\n this._drawChildren = [];\n this._minHeight = 0;\n this._minWidth = 0;\n RowNode._attributeDefinitions.fromJson(json, this._attributes);\n model._addNode(this);\n }\n /** @internal */\n static _fromJson(json, model) {\n const newLayoutNode = new RowNode(model, json);\n if (json.children != null) {\n for (const jsonChild of json.children) {\n if (jsonChild.type === _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode.TYPE) {\n const child = _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode._fromJson(jsonChild, model);\n newLayoutNode._addChild(child);\n }\n else {\n const child = RowNode._fromJson(jsonChild, model);\n newLayoutNode._addChild(child);\n }\n }\n }\n return newLayoutNode;\n }\n /** @internal */\n static _createAttributeDefinitions() {\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\n attributeDefinitions.add(\"type\", RowNode.TYPE, true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING).setFixed();\n attributeDefinitions.add(\"id\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"weight\", 100).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"width\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"height\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n return attributeDefinitions;\n }\n getWeight() {\n return this._attributes.weight;\n }\n getWidth() {\n return this._getAttr(\"width\");\n }\n getHeight() {\n return this._getAttr(\"height\");\n }\n /** @internal */\n _setWeight(weight) {\n this._attributes.weight = weight;\n }\n /** @internal */\n _layout(rect, metrics) {\n super._layout(rect, metrics);\n const pixelSize = this._rect._getSize(this.getOrientation());\n let totalWeight = 0;\n let fixedPixels = 0;\n let prefPixels = 0;\n let totalPrefWeight = 0;\n const drawChildren = this._getDrawChildren();\n for (const child of drawChildren) {\n const prefSize = child._getPrefSize(this.getOrientation());\n if (child._isFixed()) {\n if (prefSize !== undefined) {\n fixedPixels += prefSize;\n }\n }\n else {\n if (prefSize === undefined) {\n totalWeight += child.getWeight();\n }\n else {\n prefPixels += prefSize;\n totalPrefWeight += child.getWeight();\n }\n }\n }\n let resizePreferred = false;\n let availablePixels = pixelSize - fixedPixels - prefPixels;\n if (availablePixels < 0) {\n availablePixels = pixelSize - fixedPixels;\n resizePreferred = true;\n totalWeight += totalPrefWeight;\n }\n // assign actual pixel sizes\n let totalSizeGiven = 0;\n let variableSize = 0;\n for (const child of drawChildren) {\n const prefSize = child._getPrefSize(this.getOrientation());\n if (child._isFixed()) {\n if (prefSize !== undefined) {\n child._setTempSize(prefSize);\n }\n }\n else {\n if (prefSize == null || resizePreferred) {\n if (totalWeight === 0) {\n child._setTempSize(0);\n }\n else {\n const minSize = child.getMinSize(this.getOrientation());\n const size = Math.floor(availablePixels * (child.getWeight() / totalWeight));\n child._setTempSize(Math.max(minSize, size));\n }\n variableSize += child._getTempSize();\n }\n else {\n child._setTempSize(prefSize);\n }\n }\n totalSizeGiven += child._getTempSize();\n }\n // adjust sizes to exactly fit\n if (variableSize > 0) {\n while (totalSizeGiven < pixelSize) {\n for (const child of drawChildren) {\n if (!(child instanceof _SplitterNode__WEBPACK_IMPORTED_MODULE_9__.SplitterNode)) {\n const prefSize = child._getPrefSize(this.getOrientation());\n if (!child._isFixed() && (prefSize === undefined || resizePreferred) && totalSizeGiven < pixelSize) {\n child._setTempSize(child._getTempSize() + 1);\n totalSizeGiven++;\n }\n }\n }\n }\n // decrease size using nodes not at there minimum\n while (totalSizeGiven > pixelSize) {\n let changed = false;\n for (const child of drawChildren) {\n if (!(child instanceof _SplitterNode__WEBPACK_IMPORTED_MODULE_9__.SplitterNode)) {\n const minSize = child.getMinSize(this.getOrientation());\n const size = child._getTempSize();\n if (size > minSize && totalSizeGiven > pixelSize) {\n child._setTempSize(child._getTempSize() - 1);\n totalSizeGiven--;\n changed = true;\n }\n }\n }\n if (!changed) {\n // all children are at min values\n break;\n }\n }\n // if still too big then simply reduce all nodes until fits\n while (totalSizeGiven > pixelSize) {\n let changed = false;\n for (const child of drawChildren) {\n if (!(child instanceof _SplitterNode__WEBPACK_IMPORTED_MODULE_9__.SplitterNode)) {\n const size = child._getTempSize();\n if (size > 0 && totalSizeGiven > pixelSize) {\n child._setTempSize(child._getTempSize() - 1);\n totalSizeGiven--;\n changed = true;\n }\n }\n }\n if (!changed) {\n // all children are at 0 values\n break;\n }\n }\n }\n // layout children\n let p = 0;\n for (const child of drawChildren) {\n if (this.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) {\n child._layout(new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(this._rect.x + p, this._rect.y, child._getTempSize(), this._rect.height), metrics);\n }\n else {\n child._layout(new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(this._rect.x, this._rect.y + p, this._rect.width, child._getTempSize()), metrics);\n }\n p += child._getTempSize();\n }\n return true;\n }\n /** @internal */\n _getSplitterBounds(splitterNode, useMinSize = false) {\n const pBounds = [0, 0];\n const drawChildren = this._getDrawChildren();\n const p = drawChildren.indexOf(splitterNode);\n const node1 = drawChildren[p - 1];\n const node2 = drawChildren[p + 1];\n if (this.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) {\n const minSize1 = useMinSize ? node1.getMinWidth() : 0;\n const minSize2 = useMinSize ? node2.getMinWidth() : 0;\n pBounds[0] = node1.getRect().x + minSize1;\n pBounds[1] = node2.getRect().getRight() - splitterNode.getWidth() - minSize2;\n }\n else {\n const minSize1 = useMinSize ? node1.getMinHeight() : 0;\n const minSize2 = useMinSize ? node2.getMinHeight() : 0;\n pBounds[0] = node1.getRect().y + minSize1;\n pBounds[1] = node2.getRect().getBottom() - splitterNode.getHeight() - minSize2;\n }\n return pBounds;\n }\n /** @internal */\n _calculateSplit(splitter, splitterPos) {\n let rtn;\n const drawChildren = this._getDrawChildren();\n const p = drawChildren.indexOf(splitter);\n const pBounds = this._getSplitterBounds(splitter);\n const weightedLength = drawChildren[p - 1].getWeight() + drawChildren[p + 1].getWeight();\n const pixelWidth1 = Math.max(0, splitterPos - pBounds[0]);\n const pixelWidth2 = Math.max(0, pBounds[1] - splitterPos);\n if (pixelWidth1 + pixelWidth2 > 0) {\n const weight1 = (pixelWidth1 * weightedLength) / (pixelWidth1 + pixelWidth2);\n const weight2 = (pixelWidth2 * weightedLength) / (pixelWidth1 + pixelWidth2);\n rtn = {\n node1Id: drawChildren[p - 1].getId(),\n weight1,\n pixelWidth1,\n node2Id: drawChildren[p + 1].getId(),\n weight2,\n pixelWidth2,\n };\n }\n return rtn;\n }\n /** @internal */\n _getDrawChildren() {\n if (this._dirty) {\n this._drawChildren = [];\n for (let i = 0; i < this._children.length; i++) {\n const child = this._children[i];\n if (i !== 0) {\n const newSplitter = new _SplitterNode__WEBPACK_IMPORTED_MODULE_9__.SplitterNode(this._model);\n newSplitter._setParent(this);\n this._drawChildren.push(newSplitter);\n }\n this._drawChildren.push(child);\n }\n this._dirty = false;\n }\n return this._drawChildren;\n }\n /** @internal */\n getMinSize(orientation) {\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) {\n return this.getMinWidth();\n }\n else {\n return this.getMinHeight();\n }\n }\n /** @internal */\n getMinWidth() {\n return this._minWidth;\n }\n /** @internal */\n getMinHeight() {\n return this._minHeight;\n }\n /** @internal */\n calcMinSize() {\n this._minHeight = 0;\n this._minWidth = 0;\n let first = true;\n for (const child of this._children) {\n const c = child;\n if (c instanceof RowNode) {\n c.calcMinSize();\n }\n if (this.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.VERT) {\n this._minHeight += c.getMinHeight();\n if (!first) {\n this._minHeight += this._model.getSplitterSize();\n }\n this._minWidth = Math.max(this._minWidth, c.getMinWidth());\n }\n else {\n this._minWidth += c.getMinWidth();\n if (!first) {\n this._minWidth += this._model.getSplitterSize();\n }\n this._minHeight = Math.max(this._minHeight, c.getMinHeight());\n }\n first = false;\n }\n }\n /** @internal */\n _tidy() {\n let i = 0;\n while (i < this._children.length) {\n const child = this._children[i];\n if (child instanceof RowNode) {\n child._tidy();\n const childChildren = child.getChildren();\n if (childChildren.length === 0) {\n this._removeChild(child);\n }\n else if (childChildren.length === 1) {\n // hoist child/children up to this level\n const subchild = childChildren[0];\n this._removeChild(child);\n if (subchild instanceof RowNode) {\n let subChildrenTotal = 0;\n const subChildChildren = subchild.getChildren();\n for (const ssc of subChildChildren) {\n const subsubChild = ssc;\n subChildrenTotal += subsubChild.getWeight();\n }\n for (let j = 0; j < subChildChildren.length; j++) {\n const subsubChild = subChildChildren[j];\n subsubChild._setWeight((child.getWeight() * subsubChild.getWeight()) / subChildrenTotal);\n this._addChild(subsubChild, i + j);\n }\n }\n else {\n subchild._setWeight(child.getWeight());\n this._addChild(subchild, i);\n }\n }\n else {\n i++;\n }\n }\n else if (child instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode && child.getChildren().length === 0) {\n if (child.isEnableDeleteWhenEmpty()) {\n this._removeChild(child);\n if (child === this._model.getMaximizedTabset()) {\n this._model._setMaximizedTabset(undefined);\n }\n }\n else {\n i++;\n }\n }\n else {\n i++;\n }\n }\n // add tabset into empty root\n if (this === this._model.getRoot() && this._children.length === 0) {\n const callback = this._model._getOnCreateTabSet();\n let attrs = callback ? callback() : {};\n attrs = Object.assign(Object.assign({}, attrs), { selected: -1 });\n const child = new _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode(this._model, attrs);\n this._model._setActiveTabset(child);\n this._addChild(child);\n }\n }\n /** @internal */\n canDrop(dragNode, x, y) {\n const yy = y - this._rect.y;\n const xx = x - this._rect.x;\n const w = this._rect.width;\n const h = this._rect.height;\n const margin = 10; // height of edge rect\n const half = 50; // half width of edge rect\n let dropInfo;\n if (this._model.isEnableEdgeDock() && this._parent === undefined) {\n // _root row\n if (x < this._rect.x + margin && yy > h / 2 - half && yy < h / 2 + half) {\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.LEFT;\n const outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.width = outlineRect.width / 2;\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, -1, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n else if (x > this._rect.getRight() - margin && yy > h / 2 - half && yy < h / 2 + half) {\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.RIGHT;\n const outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.width = outlineRect.width / 2;\n outlineRect.x += outlineRect.width;\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, -1, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n else if (y < this._rect.y + margin && xx > w / 2 - half && xx < w / 2 + half) {\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.TOP;\n const outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.height = outlineRect.height / 2;\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, -1, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n else if (y > this._rect.getBottom() - margin && xx > w / 2 - half && xx < w / 2 + half) {\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.BOTTOM;\n const outlineRect = dockLocation.getDockRect(this._rect);\n outlineRect.height = outlineRect.height / 2;\n outlineRect.y += outlineRect.height;\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, -1, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT_EDGE);\n }\n if (dropInfo !== undefined) {\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n }\n }\n return dropInfo;\n }\n /** @internal */\n drop(dragNode, location, index) {\n const dockLocation = location;\n const parent = dragNode.getParent();\n if (parent) {\n parent._removeChild(dragNode);\n }\n if (parent !== undefined && parent.getType() === _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode.TYPE) {\n parent._setSelected(0);\n }\n if (parent !== undefined && parent.getType() === _BorderNode__WEBPACK_IMPORTED_MODULE_7__.BorderNode.TYPE) {\n parent._setSelected(-1);\n }\n let tabSet;\n if (dragNode instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode) {\n tabSet = dragNode;\n }\n else {\n const callback = this._model._getOnCreateTabSet();\n tabSet = new _TabSetNode__WEBPACK_IMPORTED_MODULE_10__.TabSetNode(this._model, callback ? callback(dragNode) : {});\n tabSet._addChild(dragNode);\n }\n let size = this._children.reduce((sum, child) => {\n return sum + child.getWeight();\n }, 0);\n if (size === 0) {\n size = 100;\n }\n tabSet._setWeight(size / 3);\n const horz = !this._model.isRootOrientationVertical();\n if (horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.LEFT || !horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.TOP) {\n this._addChild(tabSet, 0);\n }\n else if (horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.RIGHT || !horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.BOTTOM) {\n this._addChild(tabSet);\n }\n else if (horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.TOP || !horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.LEFT) {\n const vrow = new RowNode(this._model, {});\n const hrow = new RowNode(this._model, {});\n hrow._setWeight(75);\n tabSet._setWeight(25);\n for (const child of this._children) {\n hrow._addChild(child);\n }\n this._removeAll();\n vrow._addChild(tabSet);\n vrow._addChild(hrow);\n this._addChild(vrow);\n }\n else if (horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.BOTTOM || !horz && dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.RIGHT) {\n const vrow = new RowNode(this._model, {});\n const hrow = new RowNode(this._model, {});\n hrow._setWeight(75);\n tabSet._setWeight(25);\n for (const child of this._children) {\n hrow._addChild(child);\n }\n this._removeAll();\n vrow._addChild(hrow);\n vrow._addChild(tabSet);\n this._addChild(vrow);\n }\n this._model._setActiveTabset(tabSet);\n this._model._tidy();\n }\n toJson() {\n const json = {};\n RowNode._attributeDefinitions.toJson(json, this._attributes);\n json.children = [];\n for (const child of this._children) {\n json.children.push(child.toJson());\n }\n return json;\n }\n isEnableDrop() {\n return true;\n }\n /** @internal */\n _getPrefSize(orientation) {\n let prefSize = this.getWidth();\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.VERT) {\n prefSize = this.getHeight();\n }\n return prefSize;\n }\n /** @internal */\n _getAttributeDefinitions() {\n return RowNode._attributeDefinitions;\n }\n /** @internal */\n _updateAttrs(json) {\n RowNode._attributeDefinitions.update(json, this._attributes);\n }\n /** @internal */\n static getAttributeDefinitions() {\n return RowNode._attributeDefinitions;\n }\n}\nRowNode.TYPE = \"row\";\n/** @internal */\nRowNode._attributeDefinitions = RowNode._createAttributeDefinitions();\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/RowNode.ts?");
|
|
390
290
|
|
|
391
291
|
/***/ }),
|
|
392
292
|
|
|
@@ -394,9 +294,9 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
394
294
|
/*!***********************************!*\
|
|
395
295
|
!*** ./src/model/SplitterNode.ts ***!
|
|
396
296
|
\***********************************/
|
|
397
|
-
/***/ (
|
|
297
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
398
298
|
|
|
399
|
-
eval("
|
|
299
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"SplitterNode\": () => (/* binding */ SplitterNode)\n/* harmony export */ });\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Node__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\n\n\n\nclass SplitterNode extends _Node__WEBPACK_IMPORTED_MODULE_2__.Node {\n /** @internal */\n constructor(model) {\n super(model);\n this._fixed = true;\n this._attributes.type = SplitterNode.TYPE;\n model._addNode(this);\n }\n /** @internal */\n getWidth() {\n return this._model.getSplitterSize();\n }\n /** @internal */\n getMinWidth() {\n if (this.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_1__.Orientation.VERT) {\n return this._model.getSplitterSize();\n }\n else {\n return 0;\n }\n }\n /** @internal */\n getHeight() {\n return this._model.getSplitterSize();\n }\n /** @internal */\n getMinHeight() {\n if (this.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_1__.Orientation.HORZ) {\n return this._model.getSplitterSize();\n }\n else {\n return 0;\n }\n }\n /** @internal */\n getMinSize(orientation) {\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_1__.Orientation.HORZ) {\n return this.getMinWidth();\n }\n else {\n return this.getMinHeight();\n }\n }\n /** @internal */\n getWeight() {\n return 0;\n }\n /** @internal */\n _setWeight(value) { }\n /** @internal */\n _getPrefSize(orientation) {\n return this._model.getSplitterSize();\n }\n /** @internal */\n _updateAttrs(json) { }\n /** @internal */\n _getAttributeDefinitions() {\n return new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_0__.AttributeDefinitions();\n }\n toJson() {\n return undefined;\n }\n}\nSplitterNode.TYPE = \"splitter\";\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/SplitterNode.ts?");
|
|
400
300
|
|
|
401
301
|
/***/ }),
|
|
402
302
|
|
|
@@ -404,9 +304,9 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
404
304
|
/*!******************************!*\
|
|
405
305
|
!*** ./src/model/TabNode.ts ***!
|
|
406
306
|
\******************************/
|
|
407
|
-
/***/ (
|
|
307
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
408
308
|
|
|
409
|
-
eval("
|
|
309
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabNode\": () => (/* binding */ TabNode)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _Node__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\n\n\n\nclass TabNode extends _Node__WEBPACK_IMPORTED_MODULE_2__.Node {\n /** @internal */\n constructor(model, json, addToModel = true) {\n super(model);\n this._extra = {}; // extra data added to node not saved in json\n TabNode._attributeDefinitions.fromJson(json, this._attributes);\n if (addToModel === true) {\n model._addNode(this);\n }\n }\n /** @internal */\n static _fromJson(json, model, addToModel = true) {\n const newLayoutNode = new TabNode(model, json, addToModel);\n return newLayoutNode;\n }\n /** @internal */\n static _createAttributeDefinitions() {\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\n attributeDefinitions.add(\"type\", TabNode.TYPE, true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"id\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"name\", \"[Unnamed Tab]\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"altName\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"helpText\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"component\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"config\", undefined).setType(\"any\");\n attributeDefinitions.add(\"floating\", false).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"enableClose\", \"tabEnableClose\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"closeType\", \"tabCloseType\").setType(\"ICloseType\");\n attributeDefinitions.addInherited(\"enableDrag\", \"tabEnableDrag\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"enableRename\", \"tabEnableRename\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"className\", \"tabClassName\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.addInherited(\"icon\", \"tabIcon\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.addInherited(\"enableRenderOnDemand\", \"tabEnableRenderOnDemand\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"enableFloat\", \"tabEnableFloat\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n attributeDefinitions.addInherited(\"borderWidth\", \"tabBorderWidth\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.addInherited(\"borderHeight\", \"tabBorderHeight\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n return attributeDefinitions;\n }\n getWindow() {\n return this._window;\n }\n getTabRect() {\n return this._tabRect;\n }\n /** @internal */\n _setTabRect(rect) {\n this._tabRect = rect;\n }\n /** @internal */\n _setRenderedName(name) {\n this._renderedName = name;\n }\n /** @internal */\n _getNameForOverflowMenu() {\n const altName = this._getAttr(\"altName\");\n if (altName !== undefined) {\n return altName;\n }\n return this._renderedName;\n }\n getName() {\n return this._getAttr(\"name\");\n }\n getHelpText() {\n return this._getAttr(\"helpText\");\n }\n getComponent() {\n return this._getAttr(\"component\");\n }\n /**\n * Returns the config attribute that can be used to store node specific data that\n * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather\n * than directly, for example:\n * this.state.model.doAction(\n * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));\n */\n getConfig() {\n return this._attributes.config;\n }\n /**\n * Returns an object that can be used to store transient node specific data that will\n * NOT be saved in the json.\n */\n getExtraData() {\n return this._extra;\n }\n isFloating() {\n return this._getAttr(\"floating\");\n }\n getIcon() {\n return this._getAttr(\"icon\");\n }\n isEnableClose() {\n return this._getAttr(\"enableClose\");\n }\n getCloseType() {\n return this._getAttr(\"closeType\");\n }\n isEnableFloat() {\n return this._getAttr(\"enableFloat\");\n }\n isEnableDrag() {\n return this._getAttr(\"enableDrag\");\n }\n isEnableRename() {\n return this._getAttr(\"enableRename\");\n }\n getClassName() {\n return this._getAttr(\"className\");\n }\n isEnableRenderOnDemand() {\n return this._getAttr(\"enableRenderOnDemand\");\n }\n /** @internal */\n _setName(name) {\n this._attributes.name = name;\n if (this._window && this._window.document) {\n this._window.document.title = name;\n }\n }\n /** @internal */\n _setFloating(float) {\n this._attributes.floating = float;\n }\n /** @internal */\n _layout(rect, metrics) {\n if (!rect.equals(this._rect)) {\n this._fireEvent(\"resize\", { rect });\n }\n this._rect = rect;\n }\n /** @internal */\n _delete() {\n this._parent._remove(this);\n this._fireEvent(\"close\", {});\n }\n toJson() {\n const json = {};\n TabNode._attributeDefinitions.toJson(json, this._attributes);\n return json;\n }\n /** @internal */\n _updateAttrs(json) {\n TabNode._attributeDefinitions.update(json, this._attributes);\n }\n /** @internal */\n _getAttributeDefinitions() {\n return TabNode._attributeDefinitions;\n }\n /** @internal */\n _setWindow(window) {\n this._window = window;\n }\n /** @internal */\n _setBorderWidth(width) {\n this._attributes.borderWidth = width;\n }\n /** @internal */\n _setBorderHeight(height) {\n this._attributes.borderHeight = height;\n }\n /** @internal */\n static getAttributeDefinitions() {\n return TabNode._attributeDefinitions;\n }\n}\nTabNode.TYPE = \"tab\";\n/** @internal */\nTabNode._attributeDefinitions = TabNode._createAttributeDefinitions();\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/TabNode.ts?");
|
|
410
310
|
|
|
411
311
|
/***/ }),
|
|
412
312
|
|
|
@@ -414,9 +314,9 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
414
314
|
/*!*********************************!*\
|
|
415
315
|
!*** ./src/model/TabSetNode.ts ***!
|
|
416
316
|
\*********************************/
|
|
417
|
-
/***/ (
|
|
317
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
418
318
|
|
|
419
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TabSetNode = void 0;\nvar Attribute_1 = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\nvar AttributeDefinitions_1 = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\nvar DockLocation_1 = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\nvar DropInfo_1 = __webpack_require__(/*! ../DropInfo */ \"./src/DropInfo.ts\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Rect_1 = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\nvar Types_1 = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\nvar Node_1 = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\nvar RowNode_1 = __webpack_require__(/*! ./RowNode */ \"./src/model/RowNode.ts\");\nvar TabNode_1 = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\nvar Utils_1 = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\nvar TabSetNode = /** @class */ (function (_super) {\n __extends(TabSetNode, _super);\n /** @internal */\n function TabSetNode(model, json) {\n var _this = _super.call(this, model) || this;\n TabSetNode._attributeDefinitions.fromJson(json, _this._attributes);\n model._addNode(_this);\n _this._calculatedTabBarHeight = 0;\n _this._calculatedHeaderBarHeight = 0;\n return _this;\n }\n /** @internal */\n TabSetNode._fromJson = function (json, model) {\n var newLayoutNode = new TabSetNode(model, json);\n if (json.children != null) {\n for (var _i = 0, _a = json.children; _i < _a.length; _i++) {\n var jsonChild = _a[_i];\n var child = TabNode_1.TabNode._fromJson(jsonChild, model);\n newLayoutNode._addChild(child);\n }\n }\n if (newLayoutNode._children.length === 0) {\n newLayoutNode._setSelected(-1);\n }\n if (json.maximized && json.maximized === true) {\n model._setMaximizedTabset(newLayoutNode);\n }\n if (json.active && json.active === true) {\n model._setActiveTabset(newLayoutNode);\n }\n return newLayoutNode;\n };\n /** @internal */\n TabSetNode._createAttributeDefinitions = function () {\n var attributeDefinitions = new AttributeDefinitions_1.AttributeDefinitions();\n attributeDefinitions.add(\"type\", TabSetNode.TYPE, true).setType(Attribute_1.Attribute.STRING).setFixed();\n attributeDefinitions.add(\"id\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"weight\", 100).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"width\", undefined).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"height\", undefined).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"selected\", 0).setType(Attribute_1.Attribute.NUMBER);\n attributeDefinitions.add(\"name\", undefined).setType(Attribute_1.Attribute.STRING);\n attributeDefinitions.add(\"config\", undefined).setType(\"any\");\n attributeDefinitions.addInherited(\"enableDeleteWhenEmpty\", \"tabSetEnableDeleteWhenEmpty\");\n attributeDefinitions.addInherited(\"enableDrop\", \"tabSetEnableDrop\");\n attributeDefinitions.addInherited(\"enableDrag\", \"tabSetEnableDrag\");\n attributeDefinitions.addInherited(\"enableDivide\", \"tabSetEnableDivide\");\n attributeDefinitions.addInherited(\"enableMaximize\", \"tabSetEnableMaximize\");\n attributeDefinitions.addInherited(\"enableClose\", \"tabSetEnableClose\");\n attributeDefinitions.addInherited(\"classNameTabStrip\", \"tabSetClassNameTabStrip\");\n attributeDefinitions.addInherited(\"classNameHeader\", \"tabSetClassNameHeader\");\n attributeDefinitions.addInherited(\"enableTabStrip\", \"tabSetEnableTabStrip\");\n attributeDefinitions.addInherited(\"borderInsets\", \"tabSetBorderInsets\");\n attributeDefinitions.addInherited(\"marginInsets\", \"tabSetMarginInsets\");\n attributeDefinitions.addInherited(\"minWidth\", \"tabSetMinWidth\");\n attributeDefinitions.addInherited(\"minHeight\", \"tabSetMinHeight\");\n attributeDefinitions.addInherited(\"headerHeight\", \"tabSetHeaderHeight\");\n attributeDefinitions.addInherited(\"tabStripHeight\", \"tabSetTabStripHeight\");\n attributeDefinitions.addInherited(\"tabLocation\", \"tabSetTabLocation\");\n attributeDefinitions.addInherited(\"autoSelectTab\", \"tabSetAutoSelectTab\").setType(Attribute_1.Attribute.BOOLEAN);\n return attributeDefinitions;\n };\n TabSetNode.prototype.getName = function () {\n return this._getAttr(\"name\");\n };\n TabSetNode.prototype.getSelected = function () {\n var selected = this._attributes.selected;\n if (selected !== undefined) {\n return selected;\n }\n return -1;\n };\n TabSetNode.prototype.getSelectedNode = function () {\n var selected = this.getSelected();\n if (selected !== -1) {\n return this._children[selected];\n }\n return undefined;\n };\n TabSetNode.prototype.getWeight = function () {\n return this._getAttr(\"weight\");\n };\n TabSetNode.prototype.getWidth = function () {\n return this._getAttr(\"width\");\n };\n TabSetNode.prototype.getMinWidth = function () {\n return this._getAttr(\"minWidth\");\n };\n TabSetNode.prototype.getHeight = function () {\n return this._getAttr(\"height\");\n };\n TabSetNode.prototype.getMinHeight = function () {\n return this._getAttr(\"minHeight\");\n };\n /** @internal */\n TabSetNode.prototype.getMinSize = function (orientation) {\n if (orientation === Orientation_1.Orientation.HORZ) {\n return this.getMinWidth();\n }\n else {\n return this.getMinHeight();\n }\n };\n /**\n * Returns the config attribute that can be used to store node specific data that\n * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather\n * than directly, for example:\n * this.state.model.doAction(\n * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));\n */\n TabSetNode.prototype.getConfig = function () {\n return this._attributes.config;\n };\n TabSetNode.prototype.isMaximized = function () {\n return this._model.getMaximizedTabset() === this;\n };\n TabSetNode.prototype.isActive = function () {\n return this._model.getActiveTabset() === this;\n };\n TabSetNode.prototype.isEnableDeleteWhenEmpty = function () {\n return this._getAttr(\"enableDeleteWhenEmpty\");\n };\n TabSetNode.prototype.isEnableDrop = function () {\n return this._getAttr(\"enableDrop\");\n };\n TabSetNode.prototype.isEnableDrag = function () {\n return this._getAttr(\"enableDrag\");\n };\n TabSetNode.prototype.isEnableDivide = function () {\n return this._getAttr(\"enableDivide\");\n };\n TabSetNode.prototype.isEnableMaximize = function () {\n return this._getAttr(\"enableMaximize\");\n };\n TabSetNode.prototype.isEnableClose = function () {\n return this._getAttr(\"enableClose\");\n };\n TabSetNode.prototype.canMaximize = function () {\n if (this.isEnableMaximize()) {\n // always allow maximize toggle if already maximized\n if (this.getModel().getMaximizedTabset() === this) {\n return true;\n }\n // only one tabset, so disable\n if (this.getParent() === this.getModel().getRoot() && this.getModel().getRoot().getChildren().length === 1) {\n return false;\n }\n return true;\n }\n return false;\n };\n TabSetNode.prototype.isEnableTabStrip = function () {\n return this._getAttr(\"enableTabStrip\");\n };\n TabSetNode.prototype.isAutoSelectTab = function () {\n return this._getAttr(\"autoSelectTab\");\n };\n TabSetNode.prototype.getClassNameTabStrip = function () {\n return this._getAttr(\"classNameTabStrip\");\n };\n TabSetNode.prototype.getClassNameHeader = function () {\n return this._getAttr(\"classNameHeader\");\n };\n /** @internal */\n TabSetNode.prototype.calculateHeaderBarHeight = function (metrics) {\n var headerBarHeight = this._getAttr(\"headerHeight\");\n if (headerBarHeight !== 0) {\n // its defined\n this._calculatedHeaderBarHeight = headerBarHeight;\n }\n else {\n this._calculatedHeaderBarHeight = metrics.headerBarSize;\n }\n };\n /** @internal */\n TabSetNode.prototype.calculateTabBarHeight = function (metrics) {\n var tabBarHeight = this._getAttr(\"tabStripHeight\");\n if (tabBarHeight !== 0) {\n // its defined\n this._calculatedTabBarHeight = tabBarHeight;\n }\n else {\n this._calculatedTabBarHeight = metrics.tabBarSize;\n }\n };\n TabSetNode.prototype.getHeaderHeight = function () {\n return this._calculatedHeaderBarHeight;\n };\n TabSetNode.prototype.getTabStripHeight = function () {\n return this._calculatedTabBarHeight;\n };\n TabSetNode.prototype.getTabLocation = function () {\n return this._getAttr(\"tabLocation\");\n };\n /** @internal */\n TabSetNode.prototype._setWeight = function (weight) {\n this._attributes.weight = weight;\n };\n /** @internal */\n TabSetNode.prototype._setSelected = function (index) {\n this._attributes.selected = index;\n };\n /** @internal */\n TabSetNode.prototype.canDrop = function (dragNode, x, y) {\n var dropInfo;\n if (dragNode === this) {\n var dockLocation = DockLocation_1.DockLocation.CENTER;\n var outlineRect = this._tabHeaderRect;\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n else if (this._contentRect.contains(x, y)) {\n var dockLocation = DockLocation_1.DockLocation.CENTER;\n if (this._model.getMaximizedTabset() === undefined) {\n dockLocation = DockLocation_1.DockLocation.getLocation(this._contentRect, x, y);\n }\n var outlineRect = dockLocation.getDockRect(this._rect);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, -1, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n else if (this._tabHeaderRect != null && this._tabHeaderRect.contains(x, y)) {\n var r = void 0;\n var yy = void 0;\n var h = void 0;\n if (this._children.length === 0) {\n r = this._tabHeaderRect.clone();\n yy = r.y + 3;\n h = r.height - 4;\n r.width = 2;\n }\n else {\n var child = this._children[0];\n r = child.getTabRect();\n yy = r.y;\n h = r.height;\n var p = this._tabHeaderRect.x;\n var childCenter = 0;\n for (var i = 0; i < this._children.length; i++) {\n child = this._children[i];\n r = child.getTabRect();\n childCenter = r.x + r.width / 2;\n if (x >= p && x < childCenter) {\n var dockLocation = DockLocation_1.DockLocation.CENTER;\n var outlineRect = new Rect_1.Rect(r.x - 2, yy, 3, h);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, i, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n break;\n }\n p = childCenter;\n }\n }\n if (dropInfo == null) {\n var dockLocation = DockLocation_1.DockLocation.CENTER;\n var outlineRect = new Rect_1.Rect(r.getRight() - 2, yy, 3, h);\n dropInfo = new DropInfo_1.DropInfo(this, outlineRect, dockLocation, this._children.length, Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n return dropInfo;\n };\n /** @internal */\n TabSetNode.prototype._layout = function (rect, metrics) {\n this.calculateHeaderBarHeight(metrics);\n this.calculateTabBarHeight(metrics);\n if (this.isMaximized()) {\n rect = this._model.getRoot().getRect();\n }\n rect = rect.removeInsets(this._getAttr(\"marginInsets\"));\n this._rect = rect;\n rect = rect.removeInsets(this._getAttr(\"borderInsets\"));\n var showHeader = this.getName() !== undefined;\n var y = 0;\n var h = 0;\n if (showHeader) {\n y += this._calculatedHeaderBarHeight;\n h += this._calculatedHeaderBarHeight;\n }\n if (this.isEnableTabStrip()) {\n if (this.getTabLocation() === \"top\") {\n this._tabHeaderRect = new Rect_1.Rect(rect.x, rect.y + y, rect.width, this._calculatedTabBarHeight);\n }\n else {\n this._tabHeaderRect = new Rect_1.Rect(rect.x, rect.y + rect.height - this._calculatedTabBarHeight, rect.width, this._calculatedTabBarHeight);\n }\n h += this._calculatedTabBarHeight;\n if (this.getTabLocation() === \"top\") {\n y += this._calculatedTabBarHeight;\n }\n }\n this._contentRect = new Rect_1.Rect(rect.x, rect.y + y, rect.width, rect.height - h);\n for (var i = 0; i < this._children.length; i++) {\n var child = this._children[i];\n child._layout(this._contentRect, metrics);\n child._setVisible(i === this.getSelected());\n }\n };\n /** @internal */\n TabSetNode.prototype._delete = function () {\n this._parent._removeChild(this);\n };\n /** @internal */\n TabSetNode.prototype._remove = function (node) {\n var removedIndex = this._removeChild(node);\n this._model._tidy();\n (0, Utils_1.adjustSelectedIndex)(this, removedIndex);\n };\n /** @internal */\n TabSetNode.prototype.drop = function (dragNode, location, index, select) {\n var dockLocation = location;\n if (this === dragNode) {\n // tabset drop into itself\n return; // dock back to itself\n }\n var dragParent = dragNode.getParent();\n var fromIndex = 0;\n if (dragParent !== undefined) {\n fromIndex = dragParent._removeChild(dragNode);\n (0, Utils_1.adjustSelectedIndex)(dragParent, fromIndex);\n }\n // if dropping a tab back to same tabset and moving to forward position then reduce insertion index\n if (dragNode.getType() === TabNode_1.TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {\n index--;\n }\n // simple_bundled dock to existing tabset\n if (dockLocation === DockLocation_1.DockLocation.CENTER) {\n var insertPos = index;\n if (insertPos === -1) {\n insertPos = this._children.length;\n }\n if (dragNode.getType() === TabNode_1.TabNode.TYPE) {\n this._addChild(dragNode, insertPos);\n if (select || (select !== false && this.isAutoSelectTab())) {\n this._setSelected(insertPos);\n }\n // console.log(\"added child at : \" + insertPos);\n }\n else {\n for (var i = 0; i < dragNode.getChildren().length; i++) {\n var child = dragNode.getChildren()[i];\n this._addChild(child, insertPos);\n // console.log(\"added child at : \" + insertPos);\n insertPos++;\n }\n }\n this._model._setActiveTabset(this);\n }\n else {\n var tabSet = void 0;\n if (dragNode instanceof TabNode_1.TabNode) {\n // create new tabset parent\n // console.log(\"create a new tabset\");\n var callback = this._model._getOnCreateTabSet();\n tabSet = new TabSetNode(this._model, callback ? callback(dragNode) : {});\n tabSet._addChild(dragNode);\n // console.log(\"added child at end\");\n dragParent = tabSet;\n }\n else {\n tabSet = dragNode;\n }\n var parentRow = this._parent;\n var pos = parentRow.getChildren().indexOf(this);\n if (parentRow.getOrientation() === dockLocation._orientation) {\n tabSet._setWeight(this.getWeight() / 2);\n this._setWeight(this.getWeight() / 2);\n // console.log(\"added child 50% size at: \" + pos + dockLocation.indexPlus);\n parentRow._addChild(tabSet, pos + dockLocation._indexPlus);\n }\n else {\n // create a new row to host the new tabset (it will go in the opposite direction)\n // console.log(\"create a new row\");\n var newRow = new RowNode_1.RowNode(this._model, {});\n newRow._setWeight(this.getWeight());\n newRow._addChild(this);\n this._setWeight(50);\n tabSet._setWeight(50);\n // console.log(\"added child 50% size at: \" + dockLocation.indexPlus);\n newRow._addChild(tabSet, dockLocation._indexPlus);\n parentRow._removeChild(this);\n parentRow._addChild(newRow, pos);\n }\n this._model._setActiveTabset(tabSet);\n }\n this._model._tidy();\n };\n TabSetNode.prototype.toJson = function () {\n var json = {};\n TabSetNode._attributeDefinitions.toJson(json, this._attributes);\n json.children = this._children.map(function (child) { return child.toJson(); });\n if (this.isActive()) {\n json.active = true;\n }\n if (this.isMaximized()) {\n json.maximized = true;\n }\n return json;\n };\n /** @internal */\n TabSetNode.prototype._updateAttrs = function (json) {\n TabSetNode._attributeDefinitions.update(json, this._attributes);\n };\n /** @internal */\n TabSetNode.prototype._getAttributeDefinitions = function () {\n return TabSetNode._attributeDefinitions;\n };\n /** @internal */\n TabSetNode.prototype._getPrefSize = function (orientation) {\n var prefSize = this.getWidth();\n if (orientation === Orientation_1.Orientation.VERT) {\n prefSize = this.getHeight();\n }\n return prefSize;\n };\n /** @internal */\n TabSetNode.getAttributeDefinitions = function () {\n return TabSetNode._attributeDefinitions;\n };\n TabSetNode.TYPE = \"tabset\";\n /** @internal */\n TabSetNode._attributeDefinitions = TabSetNode._createAttributeDefinitions();\n return TabSetNode;\n}(Node_1.Node));\nexports.TabSetNode = TabSetNode;\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/TabSetNode.ts?");
|
|
319
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabSetNode\": () => (/* binding */ TabSetNode)\n/* harmony export */ });\n/* harmony import */ var _Attribute__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Attribute */ \"./src/Attribute.ts\");\n/* harmony import */ var _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AttributeDefinitions */ \"./src/AttributeDefinitions.ts\");\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _DropInfo__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../DropInfo */ \"./src/DropInfo.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _BorderNode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _Node__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Node */ \"./src/model/Node.ts\");\n/* harmony import */ var _RowNode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./RowNode */ \"./src/model/RowNode.ts\");\n/* harmony import */ var _TabNode__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./TabNode */ \"./src/model/TabNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Utils */ \"./src/model/Utils.ts\");\n\n\n\n\n\n\n\n\n\n\n\n\nclass TabSetNode extends _Node__WEBPACK_IMPORTED_MODULE_8__.Node {\n /** @internal */\n constructor(model, json) {\n super(model);\n TabSetNode._attributeDefinitions.fromJson(json, this._attributes);\n model._addNode(this);\n this._calculatedTabBarHeight = 0;\n this._calculatedHeaderBarHeight = 0;\n }\n /** @internal */\n static _fromJson(json, model) {\n const newLayoutNode = new TabSetNode(model, json);\n if (json.children != null) {\n for (const jsonChild of json.children) {\n const child = _TabNode__WEBPACK_IMPORTED_MODULE_10__.TabNode._fromJson(jsonChild, model);\n newLayoutNode._addChild(child);\n }\n }\n if (newLayoutNode._children.length === 0) {\n newLayoutNode._setSelected(-1);\n }\n if (json.maximized && json.maximized === true) {\n model._setMaximizedTabset(newLayoutNode);\n }\n if (json.active && json.active === true) {\n model._setActiveTabset(newLayoutNode);\n }\n return newLayoutNode;\n }\n /** @internal */\n static _createAttributeDefinitions() {\n const attributeDefinitions = new _AttributeDefinitions__WEBPACK_IMPORTED_MODULE_1__.AttributeDefinitions();\n attributeDefinitions.add(\"type\", TabSetNode.TYPE, true).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING).setFixed();\n attributeDefinitions.add(\"id\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"weight\", 100).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"width\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"height\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"selected\", 0).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.NUMBER);\n attributeDefinitions.add(\"name\", undefined).setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.STRING);\n attributeDefinitions.add(\"config\", undefined).setType(\"any\");\n attributeDefinitions.addInherited(\"enableDeleteWhenEmpty\", \"tabSetEnableDeleteWhenEmpty\");\n attributeDefinitions.addInherited(\"enableDrop\", \"tabSetEnableDrop\");\n attributeDefinitions.addInherited(\"enableDrag\", \"tabSetEnableDrag\");\n attributeDefinitions.addInherited(\"enableDivide\", \"tabSetEnableDivide\");\n attributeDefinitions.addInherited(\"enableMaximize\", \"tabSetEnableMaximize\");\n attributeDefinitions.addInherited(\"enableClose\", \"tabSetEnableClose\");\n attributeDefinitions.addInherited(\"classNameTabStrip\", \"tabSetClassNameTabStrip\");\n attributeDefinitions.addInherited(\"classNameHeader\", \"tabSetClassNameHeader\");\n attributeDefinitions.addInherited(\"enableTabStrip\", \"tabSetEnableTabStrip\");\n attributeDefinitions.addInherited(\"borderInsets\", \"tabSetBorderInsets\");\n attributeDefinitions.addInherited(\"marginInsets\", \"tabSetMarginInsets\");\n attributeDefinitions.addInherited(\"minWidth\", \"tabSetMinWidth\");\n attributeDefinitions.addInherited(\"minHeight\", \"tabSetMinHeight\");\n attributeDefinitions.addInherited(\"headerHeight\", \"tabSetHeaderHeight\");\n attributeDefinitions.addInherited(\"tabStripHeight\", \"tabSetTabStripHeight\");\n attributeDefinitions.addInherited(\"tabLocation\", \"tabSetTabLocation\");\n attributeDefinitions.addInherited(\"autoSelectTab\", \"tabSetAutoSelectTab\").setType(_Attribute__WEBPACK_IMPORTED_MODULE_0__.Attribute.BOOLEAN);\n return attributeDefinitions;\n }\n getName() {\n return this._getAttr(\"name\");\n }\n getSelected() {\n const selected = this._attributes.selected;\n if (selected !== undefined) {\n return selected;\n }\n return -1;\n }\n getSelectedNode() {\n const selected = this.getSelected();\n if (selected !== -1) {\n return this._children[selected];\n }\n return undefined;\n }\n getWeight() {\n return this._getAttr(\"weight\");\n }\n getWidth() {\n return this._getAttr(\"width\");\n }\n getMinWidth() {\n return this._getAttr(\"minWidth\");\n }\n getHeight() {\n return this._getAttr(\"height\");\n }\n getMinHeight() {\n return this._getAttr(\"minHeight\");\n }\n /** @internal */\n getMinSize(orientation) {\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) {\n return this.getMinWidth();\n }\n else {\n return this.getMinHeight();\n }\n }\n /**\n * Returns the config attribute that can be used to store node specific data that\n * WILL be saved to the json. The config attribute should be changed via the action Actions.updateNodeAttributes rather\n * than directly, for example:\n * this.state.model.doAction(\n * FlexLayout.Actions.updateNodeAttributes(node.getId(), {config:myConfigObject}));\n */\n getConfig() {\n return this._attributes.config;\n }\n isMaximized() {\n return this._model.getMaximizedTabset() === this;\n }\n isActive() {\n return this._model.getActiveTabset() === this;\n }\n isEnableDeleteWhenEmpty() {\n return this._getAttr(\"enableDeleteWhenEmpty\");\n }\n isEnableDrop() {\n return this._getAttr(\"enableDrop\");\n }\n isEnableDrag() {\n return this._getAttr(\"enableDrag\");\n }\n isEnableDivide() {\n return this._getAttr(\"enableDivide\");\n }\n isEnableMaximize() {\n return this._getAttr(\"enableMaximize\");\n }\n isEnableClose() {\n return this._getAttr(\"enableClose\");\n }\n canMaximize() {\n if (this.isEnableMaximize()) {\n // always allow maximize toggle if already maximized\n if (this.getModel().getMaximizedTabset() === this) {\n return true;\n }\n // only one tabset, so disable\n if (this.getParent() === this.getModel().getRoot() && this.getModel().getRoot().getChildren().length === 1) {\n return false;\n }\n return true;\n }\n return false;\n }\n isEnableTabStrip() {\n return this._getAttr(\"enableTabStrip\");\n }\n isAutoSelectTab() {\n return this._getAttr(\"autoSelectTab\");\n }\n getClassNameTabStrip() {\n return this._getAttr(\"classNameTabStrip\");\n }\n getClassNameHeader() {\n return this._getAttr(\"classNameHeader\");\n }\n /** @internal */\n calculateHeaderBarHeight(metrics) {\n const headerBarHeight = this._getAttr(\"headerHeight\");\n if (headerBarHeight !== 0) {\n // its defined\n this._calculatedHeaderBarHeight = headerBarHeight;\n }\n else {\n this._calculatedHeaderBarHeight = metrics.headerBarSize;\n }\n }\n /** @internal */\n calculateTabBarHeight(metrics) {\n const tabBarHeight = this._getAttr(\"tabStripHeight\");\n if (tabBarHeight !== 0) {\n // its defined\n this._calculatedTabBarHeight = tabBarHeight;\n }\n else {\n this._calculatedTabBarHeight = metrics.tabBarSize;\n }\n }\n getHeaderHeight() {\n return this._calculatedHeaderBarHeight;\n }\n getTabStripHeight() {\n return this._calculatedTabBarHeight;\n }\n getTabLocation() {\n return this._getAttr(\"tabLocation\");\n }\n /** @internal */\n _setWeight(weight) {\n this._attributes.weight = weight;\n }\n /** @internal */\n _setSelected(index) {\n this._attributes.selected = index;\n }\n /** @internal */\n canDrop(dragNode, x, y) {\n let dropInfo;\n if (dragNode === this) {\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\n const outlineRect = this._tabHeaderRect;\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, -1, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n else if (this._contentRect.contains(x, y)) {\n let dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\n if (this._model.getMaximizedTabset() === undefined) {\n dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.getLocation(this._contentRect, x, y);\n }\n const outlineRect = dockLocation.getDockRect(this._rect);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, -1, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n else if (this._tabHeaderRect != null && this._tabHeaderRect.contains(x, y)) {\n let r;\n let yy;\n let h;\n if (this._children.length === 0) {\n r = this._tabHeaderRect.clone();\n yy = r.y + 3;\n h = r.height - 4;\n r.width = 2;\n }\n else {\n let child = this._children[0];\n r = child.getTabRect();\n yy = r.y;\n h = r.height;\n let p = this._tabHeaderRect.x;\n let childCenter = 0;\n for (let i = 0; i < this._children.length; i++) {\n child = this._children[i];\n r = child.getTabRect();\n childCenter = r.x + r.width / 2;\n if (x >= p && x < childCenter) {\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(r.x - 2, yy, 3, h);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, i, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n break;\n }\n p = childCenter;\n }\n }\n if (dropInfo == null) {\n const dockLocation = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\n const outlineRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(r.getRight() - 2, yy, 3, h);\n dropInfo = new _DropInfo__WEBPACK_IMPORTED_MODULE_3__.DropInfo(this, outlineRect, dockLocation, this._children.length, _Types__WEBPACK_IMPORTED_MODULE_6__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n }\n }\n if (!dragNode._canDockInto(dragNode, dropInfo)) {\n return undefined;\n }\n return dropInfo;\n }\n /** @internal */\n _layout(rect, metrics) {\n this.calculateHeaderBarHeight(metrics);\n this.calculateTabBarHeight(metrics);\n if (this.isMaximized()) {\n rect = this._model.getRoot().getRect();\n }\n rect = rect.removeInsets(this._getAttr(\"marginInsets\"));\n this._rect = rect;\n rect = rect.removeInsets(this._getAttr(\"borderInsets\"));\n const showHeader = this.getName() !== undefined;\n let y = 0;\n let h = 0;\n if (showHeader) {\n y += this._calculatedHeaderBarHeight;\n h += this._calculatedHeaderBarHeight;\n }\n if (this.isEnableTabStrip()) {\n if (this.getTabLocation() === \"top\") {\n this._tabHeaderRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(rect.x, rect.y + y, rect.width, this._calculatedTabBarHeight);\n }\n else {\n this._tabHeaderRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(rect.x, rect.y + rect.height - this._calculatedTabBarHeight, rect.width, this._calculatedTabBarHeight);\n }\n h += this._calculatedTabBarHeight;\n if (this.getTabLocation() === \"top\") {\n y += this._calculatedTabBarHeight;\n }\n }\n this._contentRect = new _Rect__WEBPACK_IMPORTED_MODULE_5__.Rect(rect.x, rect.y + y, rect.width, rect.height - h);\n for (let i = 0; i < this._children.length; i++) {\n const child = this._children[i];\n child._layout(this._contentRect, metrics);\n child._setVisible(i === this.getSelected());\n }\n }\n /** @internal */\n _delete() {\n this._parent._removeChild(this);\n }\n /** @internal */\n _remove(node) {\n const removedIndex = this._removeChild(node);\n this._model._tidy();\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndex)(this, removedIndex);\n }\n /** @internal */\n drop(dragNode, location, index, select) {\n const dockLocation = location;\n if (this === dragNode) {\n // tabset drop into itself\n return; // dock back to itself\n }\n let dragParent = dragNode.getParent();\n let fromIndex = 0;\n if (dragParent !== undefined) {\n fromIndex = dragParent._removeChild(dragNode);\n // if selected node in border is being docked into tabset then deselect border tabs\n if (dragParent instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_7__.BorderNode && dragParent.getSelected() === fromIndex) {\n dragParent._setSelected(-1);\n }\n else {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_11__.adjustSelectedIndex)(dragParent, fromIndex);\n }\n }\n // if dropping a tab back to same tabset and moving to forward position then reduce insertion index\n if (dragNode.getType() === _TabNode__WEBPACK_IMPORTED_MODULE_10__.TabNode.TYPE && dragParent === this && fromIndex < index && index > 0) {\n index--;\n }\n // simple_bundled dock to existing tabset\n if (dockLocation === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER) {\n let insertPos = index;\n if (insertPos === -1) {\n insertPos = this._children.length;\n }\n if (dragNode.getType() === _TabNode__WEBPACK_IMPORTED_MODULE_10__.TabNode.TYPE) {\n this._addChild(dragNode, insertPos);\n if (select || (select !== false && this.isAutoSelectTab())) {\n this._setSelected(insertPos);\n }\n // console.log(\"added child at : \" + insertPos);\n }\n else {\n for (let i = 0; i < dragNode.getChildren().length; i++) {\n const child = dragNode.getChildren()[i];\n this._addChild(child, insertPos);\n // console.log(\"added child at : \" + insertPos);\n insertPos++;\n }\n }\n this._model._setActiveTabset(this);\n }\n else {\n let tabSet;\n if (dragNode instanceof _TabNode__WEBPACK_IMPORTED_MODULE_10__.TabNode) {\n // create new tabset parent\n // console.log(\"create a new tabset\");\n const callback = this._model._getOnCreateTabSet();\n tabSet = new TabSetNode(this._model, callback ? callback(dragNode) : {});\n tabSet._addChild(dragNode);\n // console.log(\"added child at end\");\n dragParent = tabSet;\n }\n else {\n tabSet = dragNode;\n }\n const parentRow = this._parent;\n const pos = parentRow.getChildren().indexOf(this);\n if (parentRow.getOrientation() === dockLocation._orientation) {\n tabSet._setWeight(this.getWeight() / 2);\n this._setWeight(this.getWeight() / 2);\n // console.log(\"added child 50% size at: \" + pos + dockLocation.indexPlus);\n parentRow._addChild(tabSet, pos + dockLocation._indexPlus);\n }\n else {\n // create a new row to host the new tabset (it will go in the opposite direction)\n // console.log(\"create a new row\");\n const newRow = new _RowNode__WEBPACK_IMPORTED_MODULE_9__.RowNode(this._model, {});\n newRow._setWeight(this.getWeight());\n newRow._addChild(this);\n this._setWeight(50);\n tabSet._setWeight(50);\n // console.log(\"added child 50% size at: \" + dockLocation.indexPlus);\n newRow._addChild(tabSet, dockLocation._indexPlus);\n parentRow._removeChild(this);\n parentRow._addChild(newRow, pos);\n }\n this._model._setActiveTabset(tabSet);\n }\n this._model._tidy();\n }\n toJson() {\n const json = {};\n TabSetNode._attributeDefinitions.toJson(json, this._attributes);\n json.children = this._children.map((child) => child.toJson());\n if (this.isActive()) {\n json.active = true;\n }\n if (this.isMaximized()) {\n json.maximized = true;\n }\n return json;\n }\n /** @internal */\n _updateAttrs(json) {\n TabSetNode._attributeDefinitions.update(json, this._attributes);\n }\n /** @internal */\n _getAttributeDefinitions() {\n return TabSetNode._attributeDefinitions;\n }\n /** @internal */\n _getPrefSize(orientation) {\n let prefSize = this.getWidth();\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.VERT) {\n prefSize = this.getHeight();\n }\n return prefSize;\n }\n /** @internal */\n static getAttributeDefinitions() {\n return TabSetNode._attributeDefinitions;\n }\n}\nTabSetNode.TYPE = \"tabset\";\n/** @internal */\nTabSetNode._attributeDefinitions = TabSetNode._createAttributeDefinitions();\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/TabSetNode.ts?");
|
|
420
320
|
|
|
421
321
|
/***/ }),
|
|
422
322
|
|
|
@@ -424,9 +324,9 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
424
324
|
/*!****************************!*\
|
|
425
325
|
!*** ./src/model/Utils.ts ***!
|
|
426
326
|
\****************************/
|
|
427
|
-
/***/ ((__unused_webpack_module,
|
|
327
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
428
328
|
|
|
429
|
-
eval("
|
|
329
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"adjustSelectedIndex\": () => (/* binding */ adjustSelectedIndex),\n/* harmony export */ \"adjustSelectedIndexAfterDock\": () => (/* binding */ adjustSelectedIndexAfterDock),\n/* harmony export */ \"adjustSelectedIndexAfterFloat\": () => (/* binding */ adjustSelectedIndexAfterFloat)\n/* harmony export */ });\n/* harmony import */ var _TabSetNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _BorderNode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BorderNode */ \"./src/model/BorderNode.ts\");\n\n\n/** @internal */\nfunction adjustSelectedIndexAfterFloat(node) {\n const parent = node.getParent();\n if (parent !== null) {\n if (parent instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_0__.TabSetNode) {\n let found = false;\n let newSelected = 0;\n const children = parent.getChildren();\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child === node) {\n found = true;\n }\n else {\n if (!child.isFloating()) {\n newSelected = i;\n if (found)\n break;\n }\n }\n }\n parent._setSelected(newSelected);\n }\n else if (parent instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_1__.BorderNode) {\n parent._setSelected(-1);\n }\n }\n}\n/** @internal */\nfunction adjustSelectedIndexAfterDock(node) {\n const parent = node.getParent();\n if (parent !== null && (parent instanceof _TabSetNode__WEBPACK_IMPORTED_MODULE_0__.TabSetNode || parent instanceof _BorderNode__WEBPACK_IMPORTED_MODULE_1__.BorderNode)) {\n const children = parent.getChildren();\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child === node) {\n parent._setSelected(i);\n return;\n }\n }\n }\n}\n/** @internal */\nfunction adjustSelectedIndex(parent, removedIndex) {\n // for the tabset/border being removed from set the selected index\n if (parent !== undefined && (parent.getType() === _TabSetNode__WEBPACK_IMPORTED_MODULE_0__.TabSetNode.TYPE || parent.getType() === _BorderNode__WEBPACK_IMPORTED_MODULE_1__.BorderNode.TYPE)) {\n const selectedIndex = parent.getSelected();\n if (selectedIndex !== -1) {\n if (removedIndex === selectedIndex && parent.getChildren().length > 0) {\n if (removedIndex >= parent.getChildren().length) {\n // removed last tab; select new last tab\n parent._setSelected(parent.getChildren().length - 1);\n }\n else {\n // leave selected index as is, selecting next tab after this one\n }\n }\n else if (removedIndex < selectedIndex) {\n parent._setSelected(selectedIndex - 1);\n }\n else if (removedIndex > selectedIndex) {\n // leave selected index as is\n }\n else {\n parent._setSelected(-1);\n }\n }\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/model/Utils.ts?");
|
|
430
330
|
|
|
431
331
|
/***/ }),
|
|
432
332
|
|
|
@@ -434,9 +334,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
434
334
|
/*!***********************************!*\
|
|
435
335
|
!*** ./src/view/BorderButton.tsx ***!
|
|
436
336
|
\***********************************/
|
|
437
|
-
/***/ ((__unused_webpack_module,
|
|
337
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
438
338
|
|
|
439
|
-
eval("
|
|
339
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BorderButton\": () => (/* binding */ BorderButton)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _model_ICloseType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../model/ICloseType */ \"./src/model/ICloseType.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\n\n\n\n\n\n\n/** @internal */\nconst BorderButton = (props) => {\n const { layout, node, selected, border, iconFactory, titleFactory, icons, path } = props;\n const selfRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const contentRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const onMouseDown = (event) => {\n if (!(0,_Utils__WEBPACK_IMPORTED_MODULE_6__.isAuxMouseEvent)(event) && !layout.getEditingTab()) {\n layout.dragStart(event, undefined, node, node.isEnableDrag(), onClick, onDoubleClick);\n }\n };\n const onAuxMouseClick = (event) => {\n if ((0,_Utils__WEBPACK_IMPORTED_MODULE_6__.isAuxMouseEvent)(event)) {\n layout.auxMouseClick(node, event);\n }\n };\n const onContextMenu = (event) => {\n layout.showContextMenu(node, event);\n };\n const onClick = () => {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.selectTab(node.getId()));\n };\n const onDoubleClick = (event) => {\n // if (node.isEnableRename()) {\n // onRename();\n // }\n };\n // const onRename = () => {\n // layout.setEditingTab(node);\n // layout.getCurrentDocument()!.body.addEventListener(\"mousedown\", onEndEdit);\n // layout.getCurrentDocument()!.body.addEventListener(\"touchstart\", onEndEdit);\n // };\n const onEndEdit = (event) => {\n if (event.target !== contentRef.current) {\n layout.getCurrentDocument().body.removeEventListener(\"mousedown\", onEndEdit);\n layout.getCurrentDocument().body.removeEventListener(\"touchstart\", onEndEdit);\n layout.setEditingTab(undefined);\n }\n };\n const isClosable = () => {\n const closeType = node.getCloseType();\n if (selected || closeType === _model_ICloseType__WEBPACK_IMPORTED_MODULE_4__.ICloseType.Always) {\n return true;\n }\n if (closeType === _model_ICloseType__WEBPACK_IMPORTED_MODULE_4__.ICloseType.Visible) {\n // not selected but x should be visible due to hover\n if (window.matchMedia && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches) {\n return true;\n }\n }\n return false;\n };\n const onClose = (event) => {\n if (isClosable()) {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.deleteTab(node.getId()));\n }\n else {\n onClick();\n }\n };\n const onCloseMouseDown = (event) => {\n event.stopPropagation();\n };\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\n updateRect();\n if (layout.getEditingTab() === node) {\n contentRef.current.select();\n }\n });\n const updateRect = () => {\n // record position of tab in node\n const layoutRect = layout.getDomRect();\n const r = selfRef.current.getBoundingClientRect();\n node._setTabRect(new _Rect__WEBPACK_IMPORTED_MODULE_3__.Rect(r.left - layoutRect.left, r.top - layoutRect.top, r.width, r.height));\n };\n const onTextBoxMouseDown = (event) => {\n // console.log(\"onTextBoxMouseDown\");\n event.stopPropagation();\n };\n const onTextBoxKeyPress = (event) => {\n // console.log(event, event.keyCode);\n if (event.keyCode === 27) {\n // esc\n layout.setEditingTab(undefined);\n }\n else if (event.keyCode === 13) {\n // enter\n layout.setEditingTab(undefined);\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.renameTab(node.getId(), event.target.value));\n }\n };\n const cm = layout.getClassName;\n let classNames = cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__BORDER_BUTTON) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__BORDER_BUTTON_ + border);\n if (selected) {\n classNames += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__BORDER_BUTTON__SELECTED);\n }\n else {\n classNames += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__BORDER_BUTTON__UNSELECTED);\n }\n if (node.getClassName() !== undefined) {\n classNames += \" \" + node.getClassName();\n }\n const renderState = (0,_Utils__WEBPACK_IMPORTED_MODULE_6__.getRenderStateEx)(layout, node, iconFactory, titleFactory);\n let content = renderState.content ? (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__BORDER_BUTTON_CONTENT) }, renderState.content)) : null;\n const leading = renderState.leading ? (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__BORDER_BUTTON_LEADING) }, renderState.leading)) : null;\n if (layout.getEditingTab() === node) {\n content = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"input\", { ref: contentRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__TAB_BUTTON_TEXTBOX), \"data-layout-path\": path + \"/textbox\", type: \"text\", autoFocus: true, defaultValue: node.getName(), onKeyDown: onTextBoxKeyPress, onMouseDown: onTextBoxMouseDown, onTouchStart: onTextBoxMouseDown }));\n }\n if (node.isEnableClose()) {\n const closeTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Close_Tab);\n renderState.buttons.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"close\", \"data-layout-path\": path + \"/button/close\", title: closeTitle, className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__BORDER_BUTTON_TRAILING), onMouseDown: onCloseMouseDown, onClick: onClose, onTouchStart: onCloseMouseDown }, (typeof icons.close === \"function\") ? icons.close(node) : icons.close));\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: selfRef, \"data-layout-path\": path, className: classNames, onMouseDown: onMouseDown, onClick: onAuxMouseClick, onAuxClick: onAuxMouseClick, onContextMenu: onContextMenu, onTouchStart: onMouseDown, title: node.getHelpText() },\n leading,\n content,\n renderState.buttons));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/BorderButton.tsx?");
|
|
440
340
|
|
|
441
341
|
/***/ }),
|
|
442
342
|
|
|
@@ -444,9 +344,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
444
344
|
/*!***********************************!*\
|
|
445
345
|
!*** ./src/view/BorderTabSet.tsx ***!
|
|
446
346
|
\***********************************/
|
|
447
|
-
/***/ ((__unused_webpack_module,
|
|
347
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
448
348
|
|
|
449
|
-
eval("
|
|
349
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"BorderTabSet\": () => (/* binding */ BorderTabSet)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _BorderButton__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./BorderButton */ \"./src/view/BorderButton.tsx\");\n/* harmony import */ var _PopupMenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../PopupMenu */ \"./src/PopupMenu.tsx\");\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _TabOverflowHook__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./TabOverflowHook */ \"./src/view/TabOverflowHook.tsx\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\n\n\n\n\n\n\n\n\n\n/** @internal */\nconst BorderTabSet = (props) => {\n const { border, layout, iconFactory, titleFactory, icons, path } = props;\n const toolbarRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const overflowbuttonRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const stickyButtonsRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const { selfRef, position, userControlledLeft, hiddenTabs, onMouseWheel } = (0,_TabOverflowHook__WEBPACK_IMPORTED_MODULE_6__.useTabOverflow)(border, _Orientation__WEBPACK_IMPORTED_MODULE_7__.Orientation.flip(border.getOrientation()), toolbarRef, stickyButtonsRef);\n const onAuxMouseClick = (event) => {\n if ((0,_Utils__WEBPACK_IMPORTED_MODULE_9__.isAuxMouseEvent)(event)) {\n layout.auxMouseClick(border, event);\n }\n };\n const onContextMenu = (event) => {\n layout.showContextMenu(border, event);\n };\n const onInterceptMouseDown = (event) => {\n event.stopPropagation();\n };\n const onOverflowClick = (event) => {\n const callback = layout.getShowOverflowMenu();\n if (callback !== undefined) {\n callback(border, event, hiddenTabs, onOverflowItemSelect);\n }\n else {\n const element = overflowbuttonRef.current;\n (0,_PopupMenu__WEBPACK_IMPORTED_MODULE_3__.showPopup)(element, hiddenTabs, onOverflowItemSelect, layout, iconFactory, titleFactory);\n }\n event.stopPropagation();\n };\n const onOverflowItemSelect = (item) => {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.selectTab(item.node.getId()));\n userControlledLeft.current = false;\n };\n const onFloatTab = (event) => {\n const selectedTabNode = border.getChildren()[border.getSelected()];\n if (selectedTabNode !== undefined) {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.floatTab(selectedTabNode.getId()));\n }\n event.stopPropagation();\n };\n const cm = layout.getClassName;\n let style = border.getTabHeaderRect().styleWithPosition({});\n const tabs = [];\n const layoutTab = (i) => {\n let isSelected = border.getSelected() === i;\n let child = border.getChildren()[i];\n tabs.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_BorderButton__WEBPACK_IMPORTED_MODULE_2__.BorderButton, { layout: layout, border: border.getLocation().getName(), node: child, path: path + \"/tb\" + i, key: child.getId(), selected: isSelected, iconFactory: iconFactory, titleFactory: titleFactory, icons: icons }));\n if (i < border.getChildren().length - 1) {\n tabs.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"divider\" + i, className: cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TAB_DIVIDER) }));\n }\n };\n for (let i = 0; i < border.getChildren().length; i++) {\n layoutTab(i);\n }\n let borderClasses = cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_ + border.getLocation().getName());\n if (border.getClassName() !== undefined) {\n borderClasses += \" \" + border.getClassName();\n }\n // allow customization of tabset right/bottom buttons\n let buttons = [];\n const renderState = { headerContent: undefined, buttons, stickyButtons: [], headerButtons: [] };\n layout.customizeTabSet(border, renderState);\n buttons = renderState.buttons;\n let toolbar;\n if (hiddenTabs.length > 0) {\n const overflowTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_5__.I18nLabel.Overflow_Menu_Tooltip);\n let overflowContent;\n if (typeof icons.more === \"function\") {\n overflowContent = icons.more(border, hiddenTabs);\n }\n else {\n overflowContent = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n icons.more,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT) }, hiddenTabs.length)));\n }\n buttons.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"button\", { key: \"overflowbutton\", ref: overflowbuttonRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_OVERFLOW_ + border.getLocation().getName()), title: overflowTitle, onClick: onOverflowClick, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, overflowContent));\n }\n const selectedIndex = border.getSelected();\n if (selectedIndex !== -1) {\n const selectedTabNode = border.getChildren()[selectedIndex];\n if (selectedTabNode !== undefined && layout.isSupportsPopout() && selectedTabNode.isEnableFloat() && !selectedTabNode.isFloating()) {\n const floatTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_5__.I18nLabel.Float_Tab);\n buttons.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"button\", { key: \"float\", title: floatTitle, className: cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_BUTTON_FLOAT), onClick: onFloatTab, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, (typeof icons.popout === \"function\") ? icons.popout(selectedTabNode) : icons.popout));\n }\n }\n toolbar = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"toolbar\", ref: toolbarRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TOOLBAR) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_TOOLBAR_ + border.getLocation().getName()) }, buttons));\n style = layout.styleFont(style);\n let innerStyle = {};\n const borderHeight = border.getBorderBarSize() - 1;\n if (border.getLocation() === _DockLocation__WEBPACK_IMPORTED_MODULE_1__.DockLocation.LEFT) {\n innerStyle = { right: borderHeight, height: borderHeight, top: position };\n }\n else if (border.getLocation() === _DockLocation__WEBPACK_IMPORTED_MODULE_1__.DockLocation.RIGHT) {\n innerStyle = { left: borderHeight, height: borderHeight, top: position };\n }\n else {\n innerStyle = { height: borderHeight, left: position };\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: selfRef, dir: \"ltr\", style: style, className: borderClasses, \"data-layout-path\": path, onClick: onAuxMouseClick, onAuxClick: onAuxMouseClick, onContextMenu: onContextMenu, onWheel: onMouseWheel },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { style: { height: borderHeight }, className: cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_INNER) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_INNER_ + border.getLocation().getName()) },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { style: innerStyle, className: cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_8__.CLASSES.FLEXLAYOUT__BORDER_INNER_TAB_CONTAINER_ + border.getLocation().getName()) }, tabs)),\n toolbar));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/BorderTabSet.tsx?");
|
|
450
350
|
|
|
451
351
|
/***/ }),
|
|
452
352
|
|
|
@@ -454,9 +354,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
454
354
|
/*!************************************!*\
|
|
455
355
|
!*** ./src/view/ErrorBoundary.tsx ***!
|
|
456
356
|
\************************************/
|
|
457
|
-
/***/ (
|
|
357
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
458
358
|
|
|
459
|
-
eval("
|
|
359
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"ErrorBoundary\": () => (/* binding */ ErrorBoundary)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n\n\n/** @internal */\nclass ErrorBoundary extends react__WEBPACK_IMPORTED_MODULE_0__.Component {\n constructor(props) {\n super(props);\n this.state = { hasError: false };\n }\n static getDerivedStateFromError(error) {\n return { hasError: true };\n }\n componentDidCatch(error, errorInfo) {\n console.debug(error);\n console.debug(errorInfo);\n }\n render() {\n if (this.state.hasError) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: _Types__WEBPACK_IMPORTED_MODULE_1__.CLASSES.FLEXLAYOUT__ERROR_BOUNDARY_CONTAINER },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: _Types__WEBPACK_IMPORTED_MODULE_1__.CLASSES.FLEXLAYOUT__ERROR_BOUNDARY_CONTENT }, this.props.message)));\n }\n return this.props.children;\n }\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/ErrorBoundary.tsx?");
|
|
460
360
|
|
|
461
361
|
/***/ }),
|
|
462
362
|
|
|
@@ -464,9 +364,9 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
464
364
|
/*!*************************************!*\
|
|
465
365
|
!*** ./src/view/FloatingWindow.tsx ***!
|
|
466
366
|
\*************************************/
|
|
467
|
-
/***/ (
|
|
367
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
468
368
|
|
|
469
|
-
eval("
|
|
369
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FloatingWindow\": () => (/* binding */ FloatingWindow)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"react-dom\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n\n\n\n/** @internal */\nconst FloatingWindow = (props) => {\n const { title, id, url, rect, onCloseWindow, onSetWindow, children } = props;\n const popoutWindow = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const timerId = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const [content, setContent] = react__WEBPACK_IMPORTED_MODULE_0__.useState(undefined);\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\n if (timerId.current) {\n clearTimeout(timerId.current);\n }\n const r = rect;\n // Make a local copy of the styles from the current window which will be passed into\n // the floating window. window.document.styleSheets is mutable and we can't guarantee\n // the styles will exist when 'popoutWindow.load' is called below.\n const styles = Array.from(window.document.styleSheets).reduce((result, styleSheet) => {\n let rules = undefined;\n try {\n rules = styleSheet.cssRules;\n }\n catch (e) {\n // styleSheet.cssRules can throw security exception\n }\n try {\n return [\n ...result,\n {\n href: styleSheet.href,\n type: styleSheet.type,\n rules: rules ? Array.from(rules).map(rule => rule.cssText) : null,\n }\n ];\n }\n catch (e) {\n return result;\n }\n }, []);\n popoutWindow.current = window.open(url, id, `left=${r.x},top=${r.y},width=${r.width},height=${r.height}`);\n if (popoutWindow.current !== null) {\n onSetWindow(id, popoutWindow.current);\n // listen for parent unloading to remove all popouts\n window.addEventListener(\"beforeunload\", () => {\n if (popoutWindow.current) {\n popoutWindow.current.close();\n popoutWindow.current = null;\n }\n });\n popoutWindow.current.addEventListener(\"load\", () => {\n const popoutDocument = popoutWindow.current.document;\n popoutDocument.title = title;\n const popoutContent = popoutDocument.createElement(\"div\");\n popoutContent.className = _Types__WEBPACK_IMPORTED_MODULE_2__.CLASSES.FLEXLAYOUT__FLOATING_WINDOW_CONTENT;\n popoutDocument.body.appendChild(popoutContent);\n copyStyles(popoutDocument, styles).then(() => {\n setContent(popoutContent);\n });\n // listen for popout unloading (needs to be after load for safari)\n popoutWindow.current.addEventListener(\"beforeunload\", () => {\n onCloseWindow(id);\n });\n });\n }\n else {\n console.warn(`Unable to open window ${url}`);\n onCloseWindow(id);\n }\n return () => {\n // delay so refresh will close window\n timerId.current = setTimeout(() => {\n if (popoutWindow.current) {\n popoutWindow.current.close();\n popoutWindow.current = null;\n }\n }, 0);\n };\n }, []);\n if (content !== undefined) {\n return (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(children, content);\n }\n else {\n return null;\n }\n};\n/** @internal */\nfunction copyStyles(doc, styleSheets) {\n const head = doc.head;\n const promises = [];\n for (const styleSheet of styleSheets) {\n if (styleSheet.href) {\n // prefer links since they will keep paths to images etc\n const styleElement = doc.createElement(\"link\");\n styleElement.type = styleSheet.type;\n styleElement.rel = \"stylesheet\";\n styleElement.href = styleSheet.href;\n head.appendChild(styleElement);\n promises.push(new Promise((resolve, reject) => {\n styleElement.onload = () => resolve(true);\n }));\n }\n else {\n if (styleSheet.rules) {\n const style = doc.createElement(\"style\");\n for (const rule of styleSheet.rules) {\n style.appendChild(doc.createTextNode(rule));\n }\n head.appendChild(style);\n }\n }\n }\n return Promise.all(promises);\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/FloatingWindow.tsx?");
|
|
470
370
|
|
|
471
371
|
/***/ }),
|
|
472
372
|
|
|
@@ -474,9 +374,9 @@ eval("\nvar __spreadArray = (this && this.__spreadArray) || function (to, from,
|
|
|
474
374
|
/*!****************************************!*\
|
|
475
375
|
!*** ./src/view/FloatingWindowTab.tsx ***!
|
|
476
376
|
\****************************************/
|
|
477
|
-
/***/ ((__unused_webpack_module,
|
|
377
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
478
378
|
|
|
479
|
-
eval("
|
|
379
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"FloatingWindowTab\": () => (/* binding */ FloatingWindowTab)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _ErrorBoundary__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ErrorBoundary */ \"./src/view/ErrorBoundary.tsx\");\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n\n\n\n\n\n/** @internal */\nconst FloatingWindowTab = (props) => {\n const { layout, node, factory } = props;\n const cm = layout.getClassName;\n const child = factory(node);\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__FLOATING_WINDOW_TAB) },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ErrorBoundary__WEBPACK_IMPORTED_MODULE_1__.ErrorBoundary, { message: props.layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_2__.I18nLabel.Error_rendering_component) },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, child))));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/FloatingWindowTab.tsx?");
|
|
480
380
|
|
|
481
381
|
/***/ }),
|
|
482
382
|
|
|
@@ -484,9 +384,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
484
384
|
/*!****************************!*\
|
|
485
385
|
!*** ./src/view/Icons.tsx ***!
|
|
486
386
|
\****************************/
|
|
487
|
-
/***/ ((__unused_webpack_module,
|
|
387
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
488
388
|
|
|
489
|
-
eval("
|
|
389
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"CloseIcon\": () => (/* binding */ CloseIcon),\n/* harmony export */ \"MaximizeIcon\": () => (/* binding */ MaximizeIcon),\n/* harmony export */ \"OverflowIcon\": () => (/* binding */ OverflowIcon),\n/* harmony export */ \"PopoutIcon\": () => (/* binding */ PopoutIcon),\n/* harmony export */ \"RestoreIcon\": () => (/* binding */ RestoreIcon)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\nconst style = { width: \"1em\", height: \"1em\", display: \"flex\", alignItems: \"center\" };\nconst CloseIcon = () => {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\" },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { fill: \"none\", d: \"M0 0h24v24H0z\" }),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { stroke: \"var(--color-icon)\", fill: \"var(--color-icon)\", d: \"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z\" })));\n};\nconst MaximizeIcon = () => {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"var(--color-icon)\" },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { stroke: \"var(--color-icon)\", d: \"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z\" })));\n};\nconst OverflowIcon = () => {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"var(--color-icon)\" },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { stroke: \"var(--color-icon)\", d: \"M7 10l5 5 5-5z\" })));\n};\nconst PopoutIcon = () => {\n return (\n // <svg xmlns=\"http://www.w3.org/2000/svg\" style={style} viewBox=\"0 0 24 24\" fill=\"var(--color-icon)\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path stroke=\"var(--color-icon)\" d=\"M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z\"/></svg>\n // <svg xmlns=\"http://www.w3.org/2000/svg\" style={style} fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"var(--color-icon)\" stroke-width=\"2\">\n // <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14\" />\n // </svg>\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 20 20\", fill: \"var(--color-icon)\" },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { d: \"M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z\" }),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { d: \"M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z\" })));\n};\nconst RestoreIcon = () => {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"svg\", { xmlns: \"http://www.w3.org/2000/svg\", style: style, viewBox: \"0 0 24 24\", fill: \"var(--color-icon)\" },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { d: \"M0 0h24v24H0z\", fill: \"none\" }),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"path\", { stroke: \"var(--color-icon)\", d: \"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z\" })));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Icons.tsx?");
|
|
490
390
|
|
|
491
391
|
/***/ }),
|
|
492
392
|
|
|
@@ -494,9 +394,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
494
394
|
/*!*****************************!*\
|
|
495
395
|
!*** ./src/view/Layout.tsx ***!
|
|
496
396
|
\*****************************/
|
|
497
|
-
/***/ (
|
|
397
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
498
398
|
|
|
499
|
-
eval("\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Layout = void 0;\nvar React = __webpack_require__(/*! react */ \"react\");\nvar react_dom_1 = __webpack_require__(/*! react-dom */ \"react-dom\");\nvar DockLocation_1 = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\nvar DragDrop_1 = __webpack_require__(/*! ../DragDrop */ \"./src/DragDrop.ts\");\nvar Actions_1 = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\nvar BorderNode_1 = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\nvar SplitterNode_1 = __webpack_require__(/*! ../model/SplitterNode */ \"./src/model/SplitterNode.ts\");\nvar TabNode_1 = __webpack_require__(/*! ../model/TabNode */ \"./src/model/TabNode.ts\");\nvar TabSetNode_1 = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\nvar Rect_1 = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\nvar Types_1 = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\nvar BorderTabSet_1 = __webpack_require__(/*! ./BorderTabSet */ \"./src/view/BorderTabSet.tsx\");\nvar Splitter_1 = __webpack_require__(/*! ./Splitter */ \"./src/view/Splitter.tsx\");\nvar Tab_1 = __webpack_require__(/*! ./Tab */ \"./src/view/Tab.tsx\");\nvar TabSet_1 = __webpack_require__(/*! ./TabSet */ \"./src/view/TabSet.tsx\");\nvar FloatingWindow_1 = __webpack_require__(/*! ./FloatingWindow */ \"./src/view/FloatingWindow.tsx\");\nvar FloatingWindowTab_1 = __webpack_require__(/*! ./FloatingWindowTab */ \"./src/view/FloatingWindowTab.tsx\");\nvar TabFloating_1 = __webpack_require__(/*! ./TabFloating */ \"./src/view/TabFloating.tsx\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Icons_1 = __webpack_require__(/*! ./Icons */ \"./src/view/Icons.tsx\");\nvar TabButtonStamp_1 = __webpack_require__(/*! ./TabButtonStamp */ \"./src/view/TabButtonStamp.tsx\");\nvar defaultIcons = {\n close: React.createElement(Icons_1.CloseIcon, null),\n closeTabset: React.createElement(Icons_1.CloseIcon, null),\n popout: React.createElement(Icons_1.PopoutIcon, null),\n maximize: React.createElement(Icons_1.MaximizeIcon, null),\n restore: React.createElement(Icons_1.RestoreIcon, null),\n more: React.createElement(Icons_1.OverflowIcon, null),\n};\n// Popout windows work in latest browsers based on webkit (Chrome, Opera, Safari, latest Edge) and Firefox. They do\n// not work on any version if IE or the original Edge browser\n// Assume any recent desktop browser not IE or original Edge will work\n/** @internal */\n// @ts-ignore\nvar isIEorEdge = typeof window !== \"undefined\" && (window.document.documentMode || /Edge\\//.test(window.navigator.userAgent));\n/** @internal */\nvar isDesktop = typeof window !== \"undefined\" && window.matchMedia && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n/** @internal */\nvar defaultSupportsPopout = isDesktop && !isIEorEdge;\n/**\n * A React component that hosts a multi-tabbed layout\n */\nvar Layout = /** @class */ (function (_super) {\n __extends(Layout, _super);\n function Layout(props) {\n var _this = _super.call(this, props) || this;\n /** @internal */\n _this.firstMove = false;\n /** @internal */\n _this.dragRectRendered = true;\n /** @internal */\n _this.dragDivText = undefined;\n /** @internal */\n _this.edgeRectLength = 100;\n /** @internal */\n _this.edgeRectWidth = 10;\n /** @internal */\n _this.edgesShown = false;\n /** @internal */\n _this.onModelChange = function () {\n _this.forceUpdate();\n if (_this.props.onModelChange) {\n _this.props.onModelChange(_this.props.model);\n }\n };\n /** @internal */\n _this.updateRect = function (domRect) {\n if (domRect === void 0) { domRect = _this.getDomRect(); }\n var rect = new Rect_1.Rect(0, 0, domRect.width, domRect.height);\n if (!rect.equals(_this.state.rect) && rect.width !== 0 && rect.height !== 0) {\n _this.setState({ rect: rect });\n }\n };\n /** @internal */\n _this.updateLayoutMetrics = function () {\n if (_this.findHeaderBarSizeRef.current) {\n var headerBarSize = _this.findHeaderBarSizeRef.current.getBoundingClientRect().height;\n if (headerBarSize !== _this.state.calculatedHeaderBarSize) {\n _this.setState({ calculatedHeaderBarSize: headerBarSize });\n }\n }\n if (_this.findTabBarSizeRef.current) {\n var tabBarSize = _this.findTabBarSizeRef.current.getBoundingClientRect().height;\n if (tabBarSize !== _this.state.calculatedTabBarSize) {\n _this.setState({ calculatedTabBarSize: tabBarSize });\n }\n }\n if (_this.findBorderBarSizeRef.current) {\n var borderBarSize = _this.findBorderBarSizeRef.current.getBoundingClientRect().height;\n if (borderBarSize !== _this.state.calculatedBorderBarSize) {\n _this.setState({ calculatedBorderBarSize: borderBarSize });\n }\n }\n };\n /** @internal */\n _this.getClassName = function (defaultClassName) {\n if (_this.props.classNameMapper === undefined) {\n return defaultClassName;\n }\n else {\n return _this.props.classNameMapper(defaultClassName);\n }\n };\n /** @internal */\n _this.onCloseWindow = function (id) {\n _this.doAction(Actions_1.Actions.unFloatTab(id));\n try {\n _this.props.model.getNodeById(id)._setWindow(undefined);\n }\n catch (e) {\n // catch incase it was a model change\n }\n };\n /** @internal */\n _this.onSetWindow = function (id, window) {\n _this.props.model.getNodeById(id)._setWindow(window);\n };\n /** @internal */\n _this.onCancelAdd = function () {\n var _a, _b;\n var rootdiv = _this.selfRef.current;\n rootdiv.removeChild(_this.dragDiv);\n _this.dragDiv = undefined;\n _this.hidePortal();\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = _this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n DragDrop_1.DragDrop.instance.hideGlass();\n _this.newTabJson = undefined;\n _this.customDrop = undefined;\n };\n /** @internal */\n _this.onCancelDrag = function (wasDragging) {\n var _a, _b;\n if (wasDragging) {\n var rootdiv = _this.selfRef.current;\n try {\n rootdiv.removeChild(_this.outlineDiv);\n }\n catch (e) { }\n try {\n rootdiv.removeChild(_this.dragDiv);\n }\n catch (e) { }\n _this.dragDiv = undefined;\n _this.hidePortal();\n _this.hideEdges(rootdiv);\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = _this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n DragDrop_1.DragDrop.instance.hideGlass();\n _this.newTabJson = undefined;\n _this.customDrop = undefined;\n }\n _this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });\n };\n /** @internal */\n _this.onDragDivMouseDown = function (event) {\n event.preventDefault();\n _this.dragStart(event, _this.dragDivText, TabNode_1.TabNode._fromJson(_this.newTabJson, _this.props.model, false), true, undefined, undefined);\n };\n /** @internal */\n _this.dragStart = function (event, dragDivText, node, allowDrag, onClick, onDoubleClick) {\n if (!allowDrag) {\n DragDrop_1.DragDrop.instance.startDrag(event, undefined, undefined, undefined, undefined, onClick, onDoubleClick, _this.currentDocument, _this.selfRef.current);\n }\n else {\n _this.dragNode = node;\n _this.dragDivText = dragDivText;\n DragDrop_1.DragDrop.instance.startDrag(event, _this.onDragStart, _this.onDragMove, _this.onDragEnd, _this.onCancelDrag, onClick, onDoubleClick, _this.currentDocument, _this.selfRef.current);\n }\n };\n /** @internal */\n _this.dragRectRender = function (text, node, json, onRendered) {\n var content;\n if (text !== undefined) {\n content = React.createElement(\"div\", { style: { whiteSpace: \"pre\" } }, text.replace(\"<br>\", \"\\n\"));\n }\n else {\n if (node && node instanceof TabNode_1.TabNode) {\n content = (React.createElement(TabButtonStamp_1.TabButtonStamp, { node: node, layout: _this, iconFactory: _this.props.iconFactory, titleFactory: _this.props.titleFactory }));\n }\n }\n if (_this.props.onRenderDragRect !== undefined) {\n var customContent = _this.props.onRenderDragRect(content, node, json);\n if (customContent !== undefined) {\n content = customContent;\n }\n }\n // hide div until the render is complete\n _this.dragDiv.style.visibility = \"hidden\";\n _this.dragRectRendered = false;\n _this.showPortal(React.createElement(DragRectRenderWrapper\n // wait for it to be rendered\n , { \n // wait for it to be rendered\n onRendered: function () {\n _this.dragRectRendered = true;\n onRendered === null || onRendered === void 0 ? void 0 : onRendered();\n } }, content), _this.dragDiv);\n };\n /** @internal */\n _this.showPortal = function (control, element) {\n var portal = (0, react_dom_1.createPortal)(control, element);\n _this.setState({ portal: portal });\n };\n /** @internal */\n _this.hidePortal = function () {\n _this.setState({ portal: undefined });\n };\n /** @internal */\n _this.onDragStart = function () {\n _this.dropInfo = undefined;\n _this.customDrop = undefined;\n var rootdiv = _this.selfRef.current;\n _this.outlineDiv = _this.currentDocument.createElement(\"div\");\n _this.outlineDiv.className = _this.getClassName(Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n _this.outlineDiv.style.visibility = \"hidden\";\n rootdiv.appendChild(_this.outlineDiv);\n if (_this.dragDiv == null) {\n _this.dragDiv = _this.currentDocument.createElement(\"div\");\n _this.dragDiv.className = _this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);\n _this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n _this.dragRectRender(_this.dragDivText, _this.dragNode, _this.newTabJson);\n rootdiv.appendChild(_this.dragDiv);\n }\n // add edge indicators\n if (_this.props.model.getMaximizedTabset() === undefined) {\n _this.showEdges(rootdiv);\n }\n if (_this.dragNode !== undefined && _this.dragNode instanceof TabNode_1.TabNode && _this.dragNode.getTabRect() !== undefined) {\n _this.dragNode.getTabRect().positionElement(_this.outlineDiv);\n }\n _this.firstMove = true;\n return true;\n };\n /** @internal */\n _this.onDragMove = function (event) {\n if (_this.firstMove === false) {\n var speed = _this.props.model._getAttribute(\"tabDragSpeed\");\n _this.outlineDiv.style.transition = \"top \".concat(speed, \"s, left \").concat(speed, \"s, width \").concat(speed, \"s, height \").concat(speed, \"s\");\n }\n _this.firstMove = false;\n var clientRect = _this.selfRef.current.getBoundingClientRect();\n var pos = {\n x: event.clientX - clientRect.left,\n y: event.clientY - clientRect.top,\n };\n _this.checkForBorderToShow(pos.x, pos.y);\n // keep it between left & right\n var dragRect = _this.dragDiv.getBoundingClientRect();\n var newLeft = pos.x - dragRect.width / 2;\n if (newLeft + dragRect.width > clientRect.width) {\n newLeft = clientRect.width - dragRect.width;\n }\n newLeft = Math.max(0, newLeft);\n _this.dragDiv.style.left = newLeft + \"px\";\n _this.dragDiv.style.top = pos.y + 5 + \"px\";\n if (_this.dragRectRendered && _this.dragDiv.style.visibility === \"hidden\") {\n // make visible once the drag rect has been rendered\n _this.dragDiv.style.visibility = \"visible\";\n }\n var dropInfo = _this.props.model._findDropTargetNode(_this.dragNode, pos.x, pos.y);\n if (dropInfo) {\n if (_this.props.onTabDrag) {\n _this.handleCustomTabDrag(dropInfo, pos, event);\n }\n else {\n _this.dropInfo = dropInfo;\n _this.outlineDiv.className = _this.getClassName(dropInfo.className);\n dropInfo.rect.positionElement(_this.outlineDiv);\n _this.outlineDiv.style.visibility = \"visible\";\n }\n }\n };\n /** @internal */\n _this.onDragEnd = function (event) {\n var rootdiv = _this.selfRef.current;\n rootdiv.removeChild(_this.outlineDiv);\n rootdiv.removeChild(_this.dragDiv);\n _this.dragDiv = undefined;\n _this.hidePortal();\n _this.hideEdges(rootdiv);\n DragDrop_1.DragDrop.instance.hideGlass();\n if (_this.dropInfo) {\n if (_this.customDrop) {\n _this.newTabJson = undefined;\n try {\n var _a = _this.customDrop, callback = _a.callback, dragging = _a.dragging, over = _a.over, x = _a.x, y = _a.y, location_1 = _a.location;\n callback(dragging, over, x, y, location_1);\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped();\n _this.fnNewNodeDropped = undefined;\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n else if (_this.newTabJson !== undefined) {\n var newNode = _this.doAction(Actions_1.Actions.addNode(_this.newTabJson, _this.dropInfo.node.getId(), _this.dropInfo.location, _this.dropInfo.index));\n if (_this.fnNewNodeDropped != null) {\n _this.fnNewNodeDropped(newNode, event);\n _this.fnNewNodeDropped = undefined;\n }\n _this.newTabJson = undefined;\n }\n else if (_this.dragNode !== undefined) {\n _this.doAction(Actions_1.Actions.moveNode(_this.dragNode.getId(), _this.dropInfo.node.getId(), _this.dropInfo.location, _this.dropInfo.index));\n }\n }\n _this.setState({ showHiddenBorder: DockLocation_1.DockLocation.CENTER });\n };\n _this.props.model._setChangeListener(_this.onModelChange);\n _this.tabIds = [];\n _this.selfRef = React.createRef();\n _this.findHeaderBarSizeRef = React.createRef();\n _this.findTabBarSizeRef = React.createRef();\n _this.findBorderBarSizeRef = React.createRef();\n _this.supportsPopout = props.supportsPopout !== undefined ? props.supportsPopout : defaultSupportsPopout;\n _this.popoutURL = props.popoutURL ? props.popoutURL : \"popout.html\";\n _this.icons = __assign(__assign({}, defaultIcons), props.icons);\n _this.firstRender = true;\n _this.state = {\n rect: new Rect_1.Rect(0, 0, 0, 0),\n calculatedHeaderBarSize: 25,\n calculatedTabBarSize: 26,\n calculatedBorderBarSize: 30,\n editingTab: undefined,\n showHiddenBorder: DockLocation_1.DockLocation.CENTER,\n };\n _this.onDragEnter = _this.onDragEnter.bind(_this);\n return _this;\n }\n /** @internal */\n Layout.prototype.styleFont = function (style) {\n if (this.props.font) {\n if (this.selfRef.current) {\n if (this.props.font.size) {\n this.selfRef.current.style.setProperty(\"--font-size\", this.props.font.size);\n }\n if (this.props.font.family) {\n this.selfRef.current.style.setProperty(\"--font-family\", this.props.font.family);\n }\n }\n if (this.props.font.style) {\n style.fontStyle = this.props.font.style;\n }\n if (this.props.font.weight) {\n style.fontWeight = this.props.font.weight;\n }\n }\n return style;\n };\n /** @internal */\n Layout.prototype.doAction = function (action) {\n if (this.props.onAction !== undefined) {\n var outcome = this.props.onAction(action);\n if (outcome !== undefined) {\n return this.props.model.doAction(outcome);\n }\n return undefined;\n }\n else {\n return this.props.model.doAction(action);\n }\n };\n /** @internal */\n Layout.prototype.componentDidMount = function () {\n var _this = this;\n this.updateRect();\n this.updateLayoutMetrics();\n // need to re-render if size changes\n this.currentDocument = this.selfRef.current.ownerDocument;\n this.currentWindow = this.currentDocument.defaultView;\n this.resizeObserver = new ResizeObserver(function (entries) {\n _this.updateRect(entries[0].contentRect);\n });\n this.resizeObserver.observe(this.selfRef.current);\n };\n /** @internal */\n Layout.prototype.componentDidUpdate = function () {\n this.updateLayoutMetrics();\n if (this.props.model !== this.previousModel) {\n if (this.previousModel !== undefined) {\n this.previousModel._setChangeListener(undefined); // stop listening to old model\n }\n this.props.model._setChangeListener(this.onModelChange);\n this.previousModel = this.props.model;\n }\n // console.log(\"Layout time: \" + this.layoutTime + \"ms Render time: \" + (Date.now() - this.start) + \"ms\");\n };\n /** @internal */\n Layout.prototype.getCurrentDocument = function () {\n return this.currentDocument;\n };\n /** @internal */\n Layout.prototype.getDomRect = function () {\n return this.selfRef.current.getBoundingClientRect();\n };\n /** @internal */\n Layout.prototype.getRootDiv = function () {\n return this.selfRef.current;\n };\n /** @internal */\n Layout.prototype.isSupportsPopout = function () {\n return this.supportsPopout;\n };\n /** @internal */\n Layout.prototype.isRealtimeResize = function () {\n var _a;\n return (_a = this.props.realtimeResize) !== null && _a !== void 0 ? _a : false;\n };\n /** @internal */\n Layout.prototype.onTabDrag = function () {\n var _a, _b;\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n return (_b = (_a = this.props).onTabDrag) === null || _b === void 0 ? void 0 : _b.call.apply(_b, __spreadArray([_a], args, false));\n };\n /** @internal */\n Layout.prototype.getPopoutURL = function () {\n return this.popoutURL;\n };\n /** @internal */\n Layout.prototype.componentWillUnmount = function () {\n var _a;\n (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.unobserve(this.selfRef.current);\n };\n /** @internal */\n Layout.prototype.setEditingTab = function (tabNode) {\n this.setState({ editingTab: tabNode });\n };\n /** @internal */\n Layout.prototype.getEditingTab = function () {\n return this.state.editingTab;\n };\n /** @internal */\n Layout.prototype.render = function () {\n // first render will be used to find the size (via selfRef)\n if (this.firstRender) {\n this.firstRender = false;\n return (React.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));\n }\n this.props.model._setPointerFine(window && window.matchMedia && window.matchMedia(\"(pointer: fine)\").matches);\n // this.start = Date.now();\n var borderComponents = [];\n var tabSetComponents = [];\n var floatingWindows = [];\n var tabComponents = {};\n var splitterComponents = [];\n var metrics = {\n headerBarSize: this.state.calculatedHeaderBarSize,\n tabBarSize: this.state.calculatedTabBarSize,\n borderBarSize: this.state.calculatedBorderBarSize\n };\n this.props.model._setShowHiddenBorder(this.state.showHiddenBorder);\n this.centerRect = this.props.model._layout(this.state.rect, metrics);\n this.renderBorder(this.props.model.getBorderSet(), borderComponents, tabComponents, floatingWindows, splitterComponents);\n this.renderChildren(\"\", this.props.model.getRoot(), tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n if (this.edgesShown) {\n this.repositionEdges(this.state.rect);\n }\n var nextTopIds = [];\n var nextTopIdsMap = {};\n // Keep any previous tabs in the same DOM order as before, removing any that have been deleted\n for (var _i = 0, _a = this.tabIds; _i < _a.length; _i++) {\n var t = _a[_i];\n if (tabComponents[t]) {\n nextTopIds.push(t);\n nextTopIdsMap[t] = t;\n }\n }\n this.tabIds = nextTopIds;\n // Add tabs that have been added to the DOM\n for (var _b = 0, _c = Object.keys(tabComponents); _b < _c.length; _b++) {\n var t = _c[_b];\n if (!nextTopIdsMap[t]) {\n this.tabIds.push(t);\n }\n }\n // this.layoutTime = (Date.now() - this.start);\n return (React.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__LAYOUT), onDragEnter: this.props.onExternalDrag ? this.onDragEnter : undefined },\n tabSetComponents,\n this.tabIds.map(function (t) {\n return tabComponents[t];\n }),\n borderComponents,\n splitterComponents,\n floatingWindows,\n this.metricsElements(),\n this.state.portal));\n };\n /** @internal */\n Layout.prototype.metricsElements = function () {\n // used to measure the tab and border tab sizes\n var fontStyle = this.styleFont({ visibility: \"hidden\" });\n return (React.createElement(React.Fragment, null,\n React.createElement(\"div\", { key: \"findHeaderBarSize\", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_HEADER_SIZER) }, \"FindHeaderBarSize\"),\n React.createElement(\"div\", { key: \"findTabBarSize\", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__TABSET_SIZER) }, \"FindTabBarSize\"),\n React.createElement(\"div\", { key: \"findBorderBarSize\", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName(Types_1.CLASSES.FLEXLAYOUT__BORDER_SIZER) }, \"FindBorderBarSize\")));\n };\n /** @internal */\n Layout.prototype.renderBorder = function (borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {\n for (var _i = 0, _a = borderSet.getBorders(); _i < _a.length; _i++) {\n var border = _a[_i];\n var borderPath = \"/border/\".concat(border.getLocation().getName());\n if (border.isShowing()) {\n borderComponents.push(React.createElement(BorderTabSet_1.BorderTabSet, { key: \"border_\".concat(border.getLocation().getName()), path: borderPath, border: border, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));\n var drawChildren = border._getDrawChildren();\n var i = 0;\n var tabCount = 0;\n for (var _b = 0, drawChildren_1 = drawChildren; _b < drawChildren_1.length; _b++) {\n var child = drawChildren_1[_b];\n if (child instanceof SplitterNode_1.SplitterNode) {\n var path = borderPath + \"/s\";\n splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, node: child, path: path }));\n }\n else if (child instanceof TabNode_1.TabNode) {\n var path = borderPath + \"/t\" + tabCount++;\n if (this.supportsPopout && child.isFloating()) {\n var rect = this._getScreenRect(child);\n floatingWindows.push(React.createElement(FloatingWindow_1.FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },\n React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected() });\n }\n else {\n tabComponents[child.getId()] = React.createElement(Tab_1.Tab, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected(), factory: this.props.factory });\n }\n }\n i++;\n }\n }\n }\n };\n /** @internal */\n Layout.prototype.renderChildren = function (path, node, tabSetComponents, tabComponents, floatingWindows, splitterComponents) {\n var drawChildren = node._getDrawChildren();\n var splitterCount = 0;\n var tabCount = 0;\n var rowCount = 0;\n for (var _i = 0, _a = drawChildren; _i < _a.length; _i++) {\n var child = _a[_i];\n if (child instanceof SplitterNode_1.SplitterNode) {\n var newPath = path + \"/s\" + (splitterCount++);\n splitterComponents.push(React.createElement(Splitter_1.Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));\n }\n else if (child instanceof TabSetNode_1.TabSetNode) {\n var newPath = path + \"/ts\" + (rowCount++);\n tabSetComponents.push(React.createElement(TabSet_1.TabSet, { key: child.getId(), layout: this, path: newPath, node: child, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n else if (child instanceof TabNode_1.TabNode) {\n var newPath = path + \"/t\" + (tabCount++);\n var selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];\n if (selectedTab === undefined) {\n // this should not happen!\n console.warn(\"undefined selectedTab should not happen\");\n }\n if (this.supportsPopout && child.isFloating()) {\n var rect = this._getScreenRect(child);\n floatingWindows.push(React.createElement(FloatingWindow_1.FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },\n React.createElement(FloatingWindowTab_1.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = React.createElement(TabFloating_1.TabFloating, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab });\n }\n else {\n tabComponents[child.getId()] = React.createElement(Tab_1.Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });\n }\n }\n else {\n // is row\n var newPath = path + ((child.getOrientation() === Orientation_1.Orientation.HORZ) ? \"/r\" : \"/c\") + (rowCount++);\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n }\n };\n /** @internal */\n Layout.prototype._getScreenRect = function (node) {\n var rect = node.getRect().clone();\n var bodyRect = this.selfRef.current.getBoundingClientRect();\n var navHeight = Math.min(80, this.currentWindow.outerHeight - this.currentWindow.innerHeight);\n var navWidth = Math.min(80, this.currentWindow.outerWidth - this.currentWindow.innerWidth);\n rect.x = rect.x + bodyRect.x + this.currentWindow.screenX + navWidth;\n rect.y = rect.y + bodyRect.y + this.currentWindow.screenY + navHeight;\n return rect;\n };\n /**\n * Adds a new tab to the given tabset\n * @param tabsetId the id of the tabset where the new tab will be added\n * @param json the json for the new tab node\n */\n Layout.prototype.addTabToTabSet = function (tabsetId, json) {\n var tabsetNode = this.props.model.getNodeById(tabsetId);\n if (tabsetNode !== undefined) {\n this.doAction(Actions_1.Actions.addNode(json, tabsetId, DockLocation_1.DockLocation.CENTER, -1));\n }\n };\n /**\n * Adds a new tab to the active tabset (if there is one)\n * @param json the json for the new tab node\n */\n Layout.prototype.addTabToActiveTabSet = function (json) {\n var tabsetNode = this.props.model.getActiveTabset();\n if (tabsetNode !== undefined) {\n this.doAction(Actions_1.Actions.addNode(json, tabsetNode.getId(), DockLocation_1.DockLocation.CENTER, -1));\n }\n };\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts immediatelly\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n Layout.prototype.addTabWithDragAndDrop = function (dragText, json, onDrop) {\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n this.dragStart(undefined, dragText, TabNode_1.TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);\n };\n /**\n * Move a tab/tabset using drag and drop\n * @param node the tab or tabset to drag\n * @param dragText the text to show on the drag panel\n */\n Layout.prototype.moveTabWithDragAndDrop = function (node, dragText) {\n this.dragStart(undefined, dragText, node, true, undefined, undefined);\n };\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you\n * mouse down on the panel\n *\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n Layout.prototype.addTabWithDragAndDropIndirect = function (dragText, json, onDrop) {\n var _this = this;\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n DragDrop_1.DragDrop.instance.addGlass(this.onCancelAdd);\n this.dragDivText = dragText;\n this.dragDiv = this.currentDocument.createElement(\"div\");\n this.dragDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__DRAG_RECT);\n this.dragDiv.addEventListener(\"mousedown\", this.onDragDivMouseDown);\n this.dragDiv.addEventListener(\"touchstart\", this.onDragDivMouseDown, { passive: false });\n this.dragRectRender(this.dragDivText, undefined, this.newTabJson, function () {\n if (_this.dragDiv) {\n // now it's been rendered into the dom it can be centered\n _this.dragDiv.style.visibility = \"visible\";\n var domRect = _this.dragDiv.getBoundingClientRect();\n var r = new Rect_1.Rect(0, 0, domRect === null || domRect === void 0 ? void 0 : domRect.width, domRect === null || domRect === void 0 ? void 0 : domRect.height);\n r.centerInRect(_this.state.rect);\n _this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n _this.dragDiv.style.left = r.x + \"px\";\n _this.dragDiv.style.top = r.y + \"px\";\n }\n });\n var rootdiv = this.selfRef.current;\n rootdiv.appendChild(this.dragDiv);\n };\n /** @internal */\n Layout.prototype.handleCustomTabDrag = function (dropInfo, pos, event) {\n var _this = this;\n var _a, _b, _c;\n var invalidated = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated;\n var currentCallback = (_b = this.customDrop) === null || _b === void 0 ? void 0 : _b.callback;\n this.customDrop = undefined;\n var dragging = this.newTabJson || (this.dragNode instanceof TabNode_1.TabNode ? this.dragNode : undefined);\n if (dragging && (dropInfo.node instanceof TabSetNode_1.TabSetNode || dropInfo.node instanceof BorderNode_1.BorderNode) && dropInfo.index === -1) {\n var selected = dropInfo.node.getSelectedNode();\n var tabRect = selected === null || selected === void 0 ? void 0 : selected.getRect();\n if (selected && (tabRect === null || tabRect === void 0 ? void 0 : tabRect.contains(pos.x, pos.y))) {\n var customDrop = undefined;\n try {\n var dest = this.onTabDrag(dragging, selected, pos.x - tabRect.x, pos.y - tabRect.y, dropInfo.location, function () { return _this.onDragMove(event); });\n if (dest) {\n customDrop = {\n rect: new Rect_1.Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),\n callback: dest.callback,\n invalidated: dest.invalidated,\n dragging: dragging,\n over: selected,\n x: pos.x - tabRect.x,\n y: pos.y - tabRect.y,\n location: dropInfo.location,\n cursor: dest.cursor\n };\n }\n }\n catch (e) {\n console.error(e);\n }\n if ((customDrop === null || customDrop === void 0 ? void 0 : customDrop.callback) === currentCallback) {\n invalidated = undefined;\n }\n this.customDrop = customDrop;\n }\n }\n this.dropInfo = dropInfo;\n this.outlineDiv.className = this.getClassName(this.customDrop ? Types_1.CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);\n if (this.customDrop) {\n this.customDrop.rect.positionElement(this.outlineDiv);\n }\n else {\n dropInfo.rect.positionElement(this.outlineDiv);\n }\n DragDrop_1.DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);\n this.outlineDiv.style.visibility = \"visible\";\n try {\n invalidated === null || invalidated === void 0 ? void 0 : invalidated();\n }\n catch (e) {\n console.error(e);\n }\n };\n /** @internal */\n Layout.prototype.onDragEnter = function (event) {\n // DragDrop keeps track of number of dragenters minus the number of\n // dragleaves. Only start a new drag if there isn't one already.\n if (DragDrop_1.DragDrop.instance.isDragging())\n return;\n var drag = this.props.onExternalDrag(event);\n if (drag) {\n // Mimic addTabWithDragAndDrop, but pass in DragEvent\n this.fnNewNodeDropped = drag.onDrop;\n this.newTabJson = drag.json;\n this.dragStart(event, drag.dragText, TabNode_1.TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);\n }\n };\n /** @internal */\n Layout.prototype.checkForBorderToShow = function (x, y) {\n var r = this.props.model._getOuterInnerRects().outer;\n var c = r.getCenter();\n var margin = this.edgeRectWidth;\n var offset = this.edgeRectLength / 2;\n var overEdge = false;\n if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === DockLocation_1.DockLocation.CENTER) {\n if ((y > c.y - offset && y < c.y + offset) ||\n (x > c.x - offset && x < c.x + offset)) {\n overEdge = true;\n }\n }\n var location = DockLocation_1.DockLocation.CENTER;\n if (!overEdge) {\n if (x <= r.x + margin) {\n location = DockLocation_1.DockLocation.LEFT;\n }\n else if (x >= r.getRight() - margin) {\n location = DockLocation_1.DockLocation.RIGHT;\n }\n else if (y <= r.y + margin) {\n location = DockLocation_1.DockLocation.TOP;\n }\n else if (y >= r.getBottom() - margin) {\n location = DockLocation_1.DockLocation.BOTTOM;\n }\n }\n if (location !== this.state.showHiddenBorder) {\n this.setState({ showHiddenBorder: location });\n }\n };\n /** @internal */\n Layout.prototype.showEdges = function (rootdiv) {\n if (this.props.model.isEnableEdgeDock()) {\n var length_1 = this.edgeRectLength + \"px\";\n var radius = \"50px\";\n var width = this.edgeRectWidth + \"px\";\n this.edgeTopDiv = this.currentDocument.createElement(\"div\");\n this.edgeTopDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeTopDiv.style.width = length_1;\n this.edgeTopDiv.style.height = width;\n this.edgeTopDiv.style.borderBottomLeftRadius = radius;\n this.edgeTopDiv.style.borderBottomRightRadius = radius;\n this.edgeLeftDiv = this.currentDocument.createElement(\"div\");\n this.edgeLeftDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeLeftDiv.style.width = width;\n this.edgeLeftDiv.style.height = length_1;\n this.edgeLeftDiv.style.borderTopRightRadius = radius;\n this.edgeLeftDiv.style.borderBottomRightRadius = radius;\n this.edgeBottomDiv = this.currentDocument.createElement(\"div\");\n this.edgeBottomDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeBottomDiv.style.width = length_1;\n this.edgeBottomDiv.style.height = width;\n this.edgeBottomDiv.style.borderTopLeftRadius = radius;\n this.edgeBottomDiv.style.borderTopRightRadius = radius;\n this.edgeRightDiv = this.currentDocument.createElement(\"div\");\n this.edgeRightDiv.className = this.getClassName(Types_1.CLASSES.FLEXLAYOUT__EDGE_RECT);\n this.edgeRightDiv.style.width = width;\n this.edgeRightDiv.style.height = length_1;\n this.edgeRightDiv.style.borderTopLeftRadius = radius;\n this.edgeRightDiv.style.borderBottomLeftRadius = radius;\n this.repositionEdges(this.state.rect);\n rootdiv.appendChild(this.edgeTopDiv);\n rootdiv.appendChild(this.edgeLeftDiv);\n rootdiv.appendChild(this.edgeBottomDiv);\n rootdiv.appendChild(this.edgeRightDiv);\n this.edgesShown = true;\n }\n };\n /** @internal */\n Layout.prototype.repositionEdges = function (domRect) {\n if (this.props.model.isEnableEdgeDock()) {\n var r = this.centerRect;\n this.edgeTopDiv.style.top = r.y + \"px\";\n this.edgeTopDiv.style.left = r.x + (r.width - this.edgeRectLength) / 2 + \"px\";\n this.edgeLeftDiv.style.top = r.y + (r.height - this.edgeRectLength) / 2 + \"px\";\n this.edgeLeftDiv.style.left = r.x + \"px\";\n this.edgeBottomDiv.style.bottom = domRect.height - r.getBottom() + \"px\";\n this.edgeBottomDiv.style.left = r.x + (r.width - this.edgeRectLength) / 2 + \"px\";\n this.edgeRightDiv.style.top = r.y + (r.height - this.edgeRectLength) / 2 + \"px\";\n this.edgeRightDiv.style.right = domRect.width - r.getRight() + \"px\";\n }\n };\n /** @internal */\n Layout.prototype.hideEdges = function (rootdiv) {\n if (this.props.model.isEnableEdgeDock()) {\n try {\n rootdiv.removeChild(this.edgeTopDiv);\n rootdiv.removeChild(this.edgeLeftDiv);\n rootdiv.removeChild(this.edgeBottomDiv);\n rootdiv.removeChild(this.edgeRightDiv);\n }\n catch (e) { }\n }\n this.edgesShown = false;\n };\n /** @internal */\n Layout.prototype.maximize = function (tabsetNode) {\n this.doAction(Actions_1.Actions.maximizeToggle(tabsetNode.getId()));\n };\n /** @internal */\n Layout.prototype.customizeTab = function (tabNode, renderValues) {\n if (this.props.onRenderTab) {\n this.props.onRenderTab(tabNode, renderValues);\n }\n };\n /** @internal */\n Layout.prototype.customizeTabSet = function (tabSetNode, renderValues) {\n if (this.props.onRenderTabSet) {\n this.props.onRenderTabSet(tabSetNode, renderValues);\n }\n };\n /** @internal */\n Layout.prototype.i18nName = function (id, param) {\n var message;\n if (this.props.i18nMapper) {\n message = this.props.i18nMapper(id, param);\n }\n if (message === undefined) {\n message = id + (param === undefined ? \"\" : param);\n }\n return message;\n };\n /** @internal */\n Layout.prototype.getOnRenderFloatingTabPlaceholder = function () {\n return this.props.onRenderFloatingTabPlaceholder;\n };\n /** @internal */\n Layout.prototype.getShowOverflowMenu = function () {\n return this.props.onShowOverflowMenu;\n };\n /** @internal */\n Layout.prototype.getTabSetPlaceHolderCallback = function () {\n return this.props.onTabSetPlaceHolder;\n };\n /** @internal */\n Layout.prototype.showContextMenu = function (node, event) {\n if (this.props.onContextMenu) {\n this.props.onContextMenu(node, event);\n }\n };\n /** @internal */\n Layout.prototype.auxMouseClick = function (node, event) {\n if (this.props.onAuxMouseClick) {\n this.props.onAuxMouseClick(node, event);\n }\n };\n return Layout;\n}(React.Component));\nexports.Layout = Layout;\n/** @internal */\nvar DragRectRenderWrapper = function (props) {\n React.useEffect(function () {\n var _a;\n (_a = props.onRendered) === null || _a === void 0 ? void 0 : _a.call(props);\n }, [props]);\n return (React.createElement(React.Fragment, null, props.children));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Layout.tsx?");
|
|
399
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Layout\": () => (/* binding */ Layout)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ \"react-dom\");\n/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _DockLocation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../DockLocation */ \"./src/DockLocation.ts\");\n/* harmony import */ var _DragDrop__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../DragDrop */ \"./src/DragDrop.ts\");\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _model_BorderNode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _model_SplitterNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../model/SplitterNode */ \"./src/model/SplitterNode.ts\");\n/* harmony import */ var _model_TabNode__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../model/TabNode */ \"./src/model/TabNode.ts\");\n/* harmony import */ var _model_TabSetNode__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _BorderTabSet__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./BorderTabSet */ \"./src/view/BorderTabSet.tsx\");\n/* harmony import */ var _Splitter__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Splitter */ \"./src/view/Splitter.tsx\");\n/* harmony import */ var _Tab__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Tab */ \"./src/view/Tab.tsx\");\n/* harmony import */ var _TabSet__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./TabSet */ \"./src/view/TabSet.tsx\");\n/* harmony import */ var _FloatingWindow__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./FloatingWindow */ \"./src/view/FloatingWindow.tsx\");\n/* harmony import */ var _FloatingWindowTab__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./FloatingWindowTab */ \"./src/view/FloatingWindowTab.tsx\");\n/* harmony import */ var _TabFloating__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./TabFloating */ \"./src/view/TabFloating.tsx\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Icons__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./Icons */ \"./src/view/Icons.tsx\");\n/* harmony import */ var _TabButtonStamp__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./TabButtonStamp */ \"./src/view/TabButtonStamp.tsx\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst defaultIcons = {\n close: react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Icons__WEBPACK_IMPORTED_MODULE_19__.CloseIcon, null),\n closeTabset: react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Icons__WEBPACK_IMPORTED_MODULE_19__.CloseIcon, null),\n popout: react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Icons__WEBPACK_IMPORTED_MODULE_19__.PopoutIcon, null),\n maximize: react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Icons__WEBPACK_IMPORTED_MODULE_19__.MaximizeIcon, null),\n restore: react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Icons__WEBPACK_IMPORTED_MODULE_19__.RestoreIcon, null),\n more: react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Icons__WEBPACK_IMPORTED_MODULE_19__.OverflowIcon, null),\n};\n// Popout windows work in latest browsers based on webkit (Chrome, Opera, Safari, latest Edge) and Firefox. They do\n// not work on any version if IE or the original Edge browser\n// Assume any recent desktop browser not IE or original Edge will work\n/** @internal */\n// @ts-ignore\nconst isIEorEdge = typeof window !== \"undefined\" && (window.document.documentMode || /Edge\\//.test(window.navigator.userAgent));\n/** @internal */\nconst isDesktop = typeof window !== \"undefined\" && window.matchMedia && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches;\n/** @internal */\nconst defaultSupportsPopout = isDesktop && !isIEorEdge;\n/**\n * A React component that hosts a multi-tabbed layout\n */\nclass Layout extends react__WEBPACK_IMPORTED_MODULE_0__.Component {\n constructor(props) {\n super(props);\n /** @internal */\n this.firstMove = false;\n /** @internal */\n this.dragRectRendered = true;\n /** @internal */\n this.dragDivText = undefined;\n /** @internal */\n this.edgeRectLength = 100;\n /** @internal */\n this.edgeRectWidth = 10;\n /** @internal */\n this.onModelChange = () => {\n this.forceUpdate();\n if (this.props.onModelChange) {\n this.props.onModelChange(this.props.model);\n }\n };\n /** @internal */\n this.updateRect = (domRect = this.getDomRect()) => {\n const rect = new _Rect__WEBPACK_IMPORTED_MODULE_9__.Rect(0, 0, domRect.width, domRect.height);\n if (!rect.equals(this.state.rect) && rect.width !== 0 && rect.height !== 0) {\n this.setState({ rect });\n }\n };\n /** @internal */\n this.updateLayoutMetrics = () => {\n if (this.findHeaderBarSizeRef.current) {\n const headerBarSize = this.findHeaderBarSizeRef.current.getBoundingClientRect().height;\n if (headerBarSize !== this.state.calculatedHeaderBarSize) {\n this.setState({ calculatedHeaderBarSize: headerBarSize });\n }\n }\n if (this.findTabBarSizeRef.current) {\n const tabBarSize = this.findTabBarSizeRef.current.getBoundingClientRect().height;\n if (tabBarSize !== this.state.calculatedTabBarSize) {\n this.setState({ calculatedTabBarSize: tabBarSize });\n }\n }\n if (this.findBorderBarSizeRef.current) {\n const borderBarSize = this.findBorderBarSizeRef.current.getBoundingClientRect().height;\n if (borderBarSize !== this.state.calculatedBorderBarSize) {\n this.setState({ calculatedBorderBarSize: borderBarSize });\n }\n }\n };\n /** @internal */\n this.getClassName = (defaultClassName) => {\n if (this.props.classNameMapper === undefined) {\n return defaultClassName;\n }\n else {\n return this.props.classNameMapper(defaultClassName);\n }\n };\n /** @internal */\n this.onCloseWindow = (id) => {\n this.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.unFloatTab(id));\n try {\n this.props.model.getNodeById(id)._setWindow(undefined);\n }\n catch (e) {\n // catch incase it was a model change\n }\n };\n /** @internal */\n this.onSetWindow = (id, window) => {\n this.props.model.getNodeById(id)._setWindow(window);\n };\n /** @internal */\n this.onCancelAdd = () => {\n var _a, _b;\n const rootdiv = this.selfRef.current;\n rootdiv.removeChild(this.dragDiv);\n this.dragDiv = undefined;\n this.hidePortal();\n if (this.fnNewNodeDropped != null) {\n this.fnNewNodeDropped();\n this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n _DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.hideGlass();\n this.newTabJson = undefined;\n this.customDrop = undefined;\n };\n /** @internal */\n this.onCancelDrag = (wasDragging) => {\n var _a, _b;\n if (wasDragging) {\n const rootdiv = this.selfRef.current;\n try {\n rootdiv.removeChild(this.outlineDiv);\n }\n catch (e) { }\n try {\n rootdiv.removeChild(this.dragDiv);\n }\n catch (e) { }\n this.dragDiv = undefined;\n this.hidePortal();\n this.setState({ showEdges: false });\n if (this.fnNewNodeDropped != null) {\n this.fnNewNodeDropped();\n this.fnNewNodeDropped = undefined;\n }\n try {\n (_b = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n catch (e) {\n console.error(e);\n }\n _DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.hideGlass();\n this.newTabJson = undefined;\n this.customDrop = undefined;\n }\n this.setState({ showHiddenBorder: _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER });\n };\n /** @internal */\n this.onDragDivMouseDown = (event) => {\n event.preventDefault();\n this.dragStart(event, this.dragDivText, _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode._fromJson(this.newTabJson, this.props.model, false), true, undefined, undefined);\n };\n /** @internal */\n this.dragStart = (event, dragDivText, node, allowDrag, onClick, onDoubleClick) => {\n if (!allowDrag) {\n _DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.startDrag(event, undefined, undefined, undefined, undefined, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);\n }\n else {\n this.dragNode = node;\n this.dragDivText = dragDivText;\n _DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.startDrag(event, this.onDragStart, this.onDragMove, this.onDragEnd, this.onCancelDrag, onClick, onDoubleClick, this.currentDocument, this.selfRef.current);\n }\n };\n /** @internal */\n this.dragRectRender = (text, node, json, onRendered) => {\n let content;\n if (text !== undefined) {\n content = react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { style: { whiteSpace: \"pre\" } }, text.replace(\"<br>\", \"\\n\"));\n }\n else {\n if (node && node instanceof _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode) {\n content = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(_TabButtonStamp__WEBPACK_IMPORTED_MODULE_20__.TabButtonStamp, { node: node, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory }));\n }\n }\n if (this.props.onRenderDragRect !== undefined) {\n const customContent = this.props.onRenderDragRect(content, node, json);\n if (customContent !== undefined) {\n content = customContent;\n }\n }\n // hide div until the render is complete\n this.dragDiv.style.visibility = \"hidden\";\n this.dragRectRendered = false;\n this.showPortal(react__WEBPACK_IMPORTED_MODULE_0__.createElement(DragRectRenderWrapper\n // wait for it to be rendered\n , { \n // wait for it to be rendered\n onRendered: () => {\n this.dragRectRendered = true;\n onRendered === null || onRendered === void 0 ? void 0 : onRendered();\n } }, content), this.dragDiv);\n };\n /** @internal */\n this.showPortal = (control, element) => {\n const portal = (0,react_dom__WEBPACK_IMPORTED_MODULE_1__.createPortal)(control, element);\n this.setState({ portal });\n };\n /** @internal */\n this.hidePortal = () => {\n this.setState({ portal: undefined });\n };\n /** @internal */\n this.onDragStart = () => {\n this.dropInfo = undefined;\n this.customDrop = undefined;\n const rootdiv = this.selfRef.current;\n this.outlineDiv = this.currentDocument.createElement(\"div\");\n this.outlineDiv.className = this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__OUTLINE_RECT);\n this.outlineDiv.style.visibility = \"hidden\";\n rootdiv.appendChild(this.outlineDiv);\n if (this.dragDiv == null) {\n this.dragDiv = this.currentDocument.createElement(\"div\");\n this.dragDiv.className = this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__DRAG_RECT);\n this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n this.dragRectRender(this.dragDivText, this.dragNode, this.newTabJson);\n rootdiv.appendChild(this.dragDiv);\n }\n // add edge indicators\n if (this.props.model.getMaximizedTabset() === undefined) {\n this.setState({ showEdges: true });\n }\n if (this.dragNode !== undefined && this.dragNode instanceof _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode && this.dragNode.getTabRect() !== undefined) {\n this.dragNode.getTabRect().positionElement(this.outlineDiv);\n }\n this.firstMove = true;\n return true;\n };\n /** @internal */\n this.onDragMove = (event) => {\n if (this.firstMove === false) {\n const speed = this.props.model._getAttribute(\"tabDragSpeed\");\n this.outlineDiv.style.transition = `top ${speed}s, left ${speed}s, width ${speed}s, height ${speed}s`;\n }\n this.firstMove = false;\n const clientRect = this.selfRef.current.getBoundingClientRect();\n const pos = {\n x: event.clientX - clientRect.left,\n y: event.clientY - clientRect.top,\n };\n this.checkForBorderToShow(pos.x, pos.y);\n // keep it between left & right\n const dragRect = this.dragDiv.getBoundingClientRect();\n let newLeft = pos.x - dragRect.width / 2;\n if (newLeft + dragRect.width > clientRect.width) {\n newLeft = clientRect.width - dragRect.width;\n }\n newLeft = Math.max(0, newLeft);\n this.dragDiv.style.left = newLeft + \"px\";\n this.dragDiv.style.top = pos.y + 5 + \"px\";\n if (this.dragRectRendered && this.dragDiv.style.visibility === \"hidden\") {\n // make visible once the drag rect has been rendered\n this.dragDiv.style.visibility = \"visible\";\n }\n let dropInfo = this.props.model._findDropTargetNode(this.dragNode, pos.x, pos.y);\n if (dropInfo) {\n if (this.props.onTabDrag) {\n this.handleCustomTabDrag(dropInfo, pos, event);\n }\n else {\n this.dropInfo = dropInfo;\n this.outlineDiv.className = this.getClassName(dropInfo.className);\n dropInfo.rect.positionElement(this.outlineDiv);\n this.outlineDiv.style.visibility = \"visible\";\n }\n }\n };\n /** @internal */\n this.onDragEnd = (event) => {\n const rootdiv = this.selfRef.current;\n rootdiv.removeChild(this.outlineDiv);\n rootdiv.removeChild(this.dragDiv);\n this.dragDiv = undefined;\n this.hidePortal();\n this.setState({ showEdges: false });\n _DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.hideGlass();\n if (this.dropInfo) {\n if (this.customDrop) {\n this.newTabJson = undefined;\n try {\n const { callback, dragging, over, x, y, location } = this.customDrop;\n callback(dragging, over, x, y, location);\n if (this.fnNewNodeDropped != null) {\n this.fnNewNodeDropped();\n this.fnNewNodeDropped = undefined;\n }\n }\n catch (e) {\n console.error(e);\n }\n }\n else if (this.newTabJson !== undefined) {\n const newNode = this.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.addNode(this.newTabJson, this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));\n if (this.fnNewNodeDropped != null) {\n this.fnNewNodeDropped(newNode, event);\n this.fnNewNodeDropped = undefined;\n }\n this.newTabJson = undefined;\n }\n else if (this.dragNode !== undefined) {\n this.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.moveNode(this.dragNode.getId(), this.dropInfo.node.getId(), this.dropInfo.location, this.dropInfo.index));\n }\n }\n this.setState({ showHiddenBorder: _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER });\n };\n this.props.model._setChangeListener(this.onModelChange);\n this.tabIds = [];\n this.selfRef = react__WEBPACK_IMPORTED_MODULE_0__.createRef();\n this.findHeaderBarSizeRef = react__WEBPACK_IMPORTED_MODULE_0__.createRef();\n this.findTabBarSizeRef = react__WEBPACK_IMPORTED_MODULE_0__.createRef();\n this.findBorderBarSizeRef = react__WEBPACK_IMPORTED_MODULE_0__.createRef();\n this.supportsPopout = props.supportsPopout !== undefined ? props.supportsPopout : defaultSupportsPopout;\n this.popoutURL = props.popoutURL ? props.popoutURL : \"popout.html\";\n this.icons = Object.assign(Object.assign({}, defaultIcons), props.icons);\n this.state = {\n rect: new _Rect__WEBPACK_IMPORTED_MODULE_9__.Rect(0, 0, 0, 0),\n calculatedHeaderBarSize: 25,\n calculatedTabBarSize: 26,\n calculatedBorderBarSize: 30,\n editingTab: undefined,\n showHiddenBorder: _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER,\n showEdges: false,\n };\n this.onDragEnter = this.onDragEnter.bind(this);\n }\n /** @internal */\n styleFont(style) {\n if (this.props.font) {\n if (this.selfRef.current) {\n if (this.props.font.size) {\n this.selfRef.current.style.setProperty(\"--font-size\", this.props.font.size);\n }\n if (this.props.font.family) {\n this.selfRef.current.style.setProperty(\"--font-family\", this.props.font.family);\n }\n }\n if (this.props.font.style) {\n style.fontStyle = this.props.font.style;\n }\n if (this.props.font.weight) {\n style.fontWeight = this.props.font.weight;\n }\n }\n return style;\n }\n /** @internal */\n doAction(action) {\n if (this.props.onAction !== undefined) {\n const outcome = this.props.onAction(action);\n if (outcome !== undefined) {\n return this.props.model.doAction(outcome);\n }\n return undefined;\n }\n else {\n return this.props.model.doAction(action);\n }\n }\n /** @internal */\n componentDidMount() {\n this.updateRect();\n this.updateLayoutMetrics();\n // need to re-render if size changes\n this.currentDocument = this.selfRef.current.ownerDocument;\n this.currentWindow = this.currentDocument.defaultView;\n this.resizeObserver = new ResizeObserver(entries => {\n this.updateRect(entries[0].contentRect);\n });\n this.resizeObserver.observe(this.selfRef.current);\n }\n /** @internal */\n componentDidUpdate() {\n this.updateLayoutMetrics();\n if (this.props.model !== this.previousModel) {\n if (this.previousModel !== undefined) {\n this.previousModel._setChangeListener(undefined); // stop listening to old model\n }\n this.props.model._setChangeListener(this.onModelChange);\n this.previousModel = this.props.model;\n }\n // console.log(\"Layout time: \" + this.layoutTime + \"ms Render time: \" + (Date.now() - this.start) + \"ms\");\n }\n /** @internal */\n getCurrentDocument() {\n return this.currentDocument;\n }\n /** @internal */\n getDomRect() {\n return this.selfRef.current.getBoundingClientRect();\n }\n /** @internal */\n getRootDiv() {\n return this.selfRef.current;\n }\n /** @internal */\n isSupportsPopout() {\n return this.supportsPopout;\n }\n /** @internal */\n isRealtimeResize() {\n var _a;\n return (_a = this.props.realtimeResize) !== null && _a !== void 0 ? _a : false;\n }\n /** @internal */\n onTabDrag(...args) {\n var _a, _b;\n return (_b = (_a = this.props).onTabDrag) === null || _b === void 0 ? void 0 : _b.call(_a, ...args);\n }\n /** @internal */\n getPopoutURL() {\n return this.popoutURL;\n }\n /** @internal */\n componentWillUnmount() {\n var _a;\n (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.unobserve(this.selfRef.current);\n }\n /** @internal */\n setEditingTab(tabNode) {\n this.setState({ editingTab: tabNode });\n }\n /** @internal */\n getEditingTab() {\n return this.state.editingTab;\n }\n /** @internal */\n render() {\n // first render will be used to find the size (via selfRef)\n if (!this.selfRef.current) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__LAYOUT) }, this.metricsElements()));\n }\n this.props.model._setPointerFine(window && window.matchMedia && window.matchMedia(\"(pointer: fine)\").matches);\n // this.start = Date.now();\n const borderComponents = [];\n const tabSetComponents = [];\n const floatingWindows = [];\n const tabComponents = {};\n const splitterComponents = [];\n const metrics = {\n headerBarSize: this.state.calculatedHeaderBarSize,\n tabBarSize: this.state.calculatedTabBarSize,\n borderBarSize: this.state.calculatedBorderBarSize\n };\n this.props.model._setShowHiddenBorder(this.state.showHiddenBorder);\n this.centerRect = this.props.model._layout(this.state.rect, metrics);\n this.renderBorder(this.props.model.getBorderSet(), borderComponents, tabComponents, floatingWindows, splitterComponents);\n this.renderChildren(\"\", this.props.model.getRoot(), tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n const nextTopIds = [];\n const nextTopIdsMap = {};\n // Keep any previous tabs in the same DOM order as before, removing any that have been deleted\n for (const t of this.tabIds) {\n if (tabComponents[t]) {\n nextTopIds.push(t);\n nextTopIdsMap[t] = t;\n }\n }\n this.tabIds = nextTopIds;\n // Add tabs that have been added to the DOM\n for (const t of Object.keys(tabComponents)) {\n if (!nextTopIdsMap[t]) {\n this.tabIds.push(t);\n }\n }\n const edges = [];\n if (this.state.showEdges) {\n const r = this.centerRect;\n const length = this.edgeRectLength;\n const width = this.edgeRectWidth;\n const offset = this.edgeRectLength / 2;\n const className = this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__EDGE_RECT);\n const radius = 50;\n edges.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"North\", style: { top: r.y, left: r.x + r.width / 2 - offset, width: length, height: width, borderBottomLeftRadius: radius, borderBottomRightRadius: radius }, className: className }));\n edges.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"West\", style: { top: r.y + r.height / 2 - offset, left: r.x, width: width, height: length, borderTopRightRadius: radius, borderBottomRightRadius: radius }, className: className }));\n edges.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"South\", style: { top: r.y + r.height - width, left: r.x + r.width / 2 - offset, width: length, height: width, borderTopLeftRadius: radius, borderTopRightRadius: radius }, className: className }));\n edges.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"East\", style: { top: r.y + r.height / 2 - offset, left: r.x + r.width - width, width: width, height: length, borderTopLeftRadius: radius, borderBottomLeftRadius: radius }, className: className }));\n }\n // this.layoutTime = (Date.now() - this.start);\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: this.selfRef, className: this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__LAYOUT), onDragEnter: this.props.onExternalDrag ? this.onDragEnter : undefined },\n tabSetComponents,\n this.tabIds.map((t) => {\n return tabComponents[t];\n }),\n borderComponents,\n splitterComponents,\n edges,\n floatingWindows,\n this.metricsElements(),\n this.state.portal));\n }\n /** @internal */\n metricsElements() {\n // used to measure the tab and border tab sizes\n const fontStyle = this.styleFont({ visibility: \"hidden\" });\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"findHeaderBarSize\", ref: this.findHeaderBarSizeRef, style: fontStyle, className: this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__TABSET_HEADER_SIZER) }, \"FindHeaderBarSize\"),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"findTabBarSize\", ref: this.findTabBarSizeRef, style: fontStyle, className: this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__TABSET_SIZER) }, \"FindTabBarSize\"),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"findBorderBarSize\", ref: this.findBorderBarSizeRef, style: fontStyle, className: this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__BORDER_SIZER) }, \"FindBorderBarSize\")));\n }\n /** @internal */\n renderBorder(borderSet, borderComponents, tabComponents, floatingWindows, splitterComponents) {\n for (const border of borderSet.getBorders()) {\n const borderPath = `/border/${border.getLocation().getName()}`;\n if (border.isShowing()) {\n borderComponents.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_BorderTabSet__WEBPACK_IMPORTED_MODULE_11__.BorderTabSet, { key: `border_${border.getLocation().getName()}`, path: borderPath, border: border, layout: this, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));\n const drawChildren = border._getDrawChildren();\n let i = 0;\n let tabCount = 0;\n for (const child of drawChildren) {\n if (child instanceof _model_SplitterNode__WEBPACK_IMPORTED_MODULE_6__.SplitterNode) {\n let path = borderPath + \"/s\";\n splitterComponents.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Splitter__WEBPACK_IMPORTED_MODULE_12__.Splitter, { key: child.getId(), layout: this, node: child, path: path }));\n }\n else if (child instanceof _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode) {\n let path = borderPath + \"/t\" + tabCount++;\n if (this.supportsPopout && child.isFloating()) {\n const rect = this._getScreenRect(child);\n floatingWindows.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_FloatingWindow__WEBPACK_IMPORTED_MODULE_15__.FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_FloatingWindowTab__WEBPACK_IMPORTED_MODULE_16__.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = react__WEBPACK_IMPORTED_MODULE_0__.createElement(_TabFloating__WEBPACK_IMPORTED_MODULE_17__.TabFloating, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected() });\n }\n else {\n tabComponents[child.getId()] = react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Tab__WEBPACK_IMPORTED_MODULE_13__.Tab, { key: child.getId(), layout: this, path: path, node: child, selected: i === border.getSelected(), factory: this.props.factory });\n }\n }\n i++;\n }\n }\n }\n }\n /** @internal */\n renderChildren(path, node, tabSetComponents, tabComponents, floatingWindows, splitterComponents) {\n const drawChildren = node._getDrawChildren();\n let splitterCount = 0;\n let tabCount = 0;\n let rowCount = 0;\n for (const child of drawChildren) {\n if (child instanceof _model_SplitterNode__WEBPACK_IMPORTED_MODULE_6__.SplitterNode) {\n const newPath = path + \"/s\" + (splitterCount++);\n splitterComponents.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Splitter__WEBPACK_IMPORTED_MODULE_12__.Splitter, { key: child.getId(), layout: this, path: newPath, node: child }));\n }\n else if (child instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_8__.TabSetNode) {\n const newPath = path + \"/ts\" + (rowCount++);\n tabSetComponents.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_TabSet__WEBPACK_IMPORTED_MODULE_14__.TabSet, { key: child.getId(), layout: this, path: newPath, node: child, iconFactory: this.props.iconFactory, titleFactory: this.props.titleFactory, icons: this.icons }));\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n else if (child instanceof _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode) {\n const newPath = path + \"/t\" + (tabCount++);\n const selectedTab = child.getParent().getChildren()[child.getParent().getSelected()];\n if (selectedTab === undefined) {\n // this should not happen!\n console.warn(\"undefined selectedTab should not happen\");\n }\n if (this.supportsPopout && child.isFloating()) {\n const rect = this._getScreenRect(child);\n floatingWindows.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_FloatingWindow__WEBPACK_IMPORTED_MODULE_15__.FloatingWindow, { key: child.getId(), url: this.popoutURL, rect: rect, title: child.getName(), id: child.getId(), onSetWindow: this.onSetWindow, onCloseWindow: this.onCloseWindow },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_FloatingWindowTab__WEBPACK_IMPORTED_MODULE_16__.FloatingWindowTab, { layout: this, node: child, factory: this.props.factory })));\n tabComponents[child.getId()] = react__WEBPACK_IMPORTED_MODULE_0__.createElement(_TabFloating__WEBPACK_IMPORTED_MODULE_17__.TabFloating, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab });\n }\n else {\n tabComponents[child.getId()] = react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Tab__WEBPACK_IMPORTED_MODULE_13__.Tab, { key: child.getId(), layout: this, path: newPath, node: child, selected: child === selectedTab, factory: this.props.factory });\n }\n }\n else {\n // is row\n const newPath = path + ((child.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_18__.Orientation.HORZ) ? \"/r\" : \"/c\") + (rowCount++);\n this.renderChildren(newPath, child, tabSetComponents, tabComponents, floatingWindows, splitterComponents);\n }\n }\n }\n /** @internal */\n _getScreenRect(node) {\n const rect = node.getRect().clone();\n const bodyRect = this.selfRef.current.getBoundingClientRect();\n const navHeight = Math.min(80, this.currentWindow.outerHeight - this.currentWindow.innerHeight);\n const navWidth = Math.min(80, this.currentWindow.outerWidth - this.currentWindow.innerWidth);\n rect.x = rect.x + bodyRect.x + this.currentWindow.screenX + navWidth;\n rect.y = rect.y + bodyRect.y + this.currentWindow.screenY + navHeight;\n return rect;\n }\n /**\n * Adds a new tab to the given tabset\n * @param tabsetId the id of the tabset where the new tab will be added\n * @param json the json for the new tab node\n */\n addTabToTabSet(tabsetId, json) {\n const tabsetNode = this.props.model.getNodeById(tabsetId);\n if (tabsetNode !== undefined) {\n this.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.addNode(json, tabsetId, _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER, -1));\n }\n }\n /**\n * Adds a new tab to the active tabset (if there is one)\n * @param json the json for the new tab node\n */\n addTabToActiveTabSet(json) {\n const tabsetNode = this.props.model.getActiveTabset();\n if (tabsetNode !== undefined) {\n this.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.addNode(json, tabsetNode.getId(), _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER, -1));\n }\n }\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts immediatelly\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n addTabWithDragAndDrop(dragText, json, onDrop) {\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n this.dragStart(undefined, dragText, _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode._fromJson(json, this.props.model, false), true, undefined, undefined);\n }\n /**\n * Move a tab/tabset using drag and drop\n * @param node the tab or tabset to drag\n * @param dragText the text to show on the drag panel\n */\n moveTabWithDragAndDrop(node, dragText) {\n this.dragStart(undefined, dragText, node, true, undefined, undefined);\n }\n /**\n * Adds a new tab by dragging a labeled panel to the drop location, dragging starts when you\n * mouse down on the panel\n *\n * @param dragText the text to show on the drag panel\n * @param json the json for the new tab node\n * @param onDrop a callback to call when the drag is complete (node and event will be undefined if the drag was cancelled)\n */\n addTabWithDragAndDropIndirect(dragText, json, onDrop) {\n this.fnNewNodeDropped = onDrop;\n this.newTabJson = json;\n _DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.addGlass(this.onCancelAdd);\n this.dragDivText = dragText;\n this.dragDiv = this.currentDocument.createElement(\"div\");\n this.dragDiv.className = this.getClassName(_Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__DRAG_RECT);\n this.dragDiv.addEventListener(\"mousedown\", this.onDragDivMouseDown);\n this.dragDiv.addEventListener(\"touchstart\", this.onDragDivMouseDown, { passive: false });\n this.dragRectRender(this.dragDivText, undefined, this.newTabJson, () => {\n if (this.dragDiv) {\n // now it's been rendered into the dom it can be centered\n this.dragDiv.style.visibility = \"visible\";\n const domRect = this.dragDiv.getBoundingClientRect();\n const r = new _Rect__WEBPACK_IMPORTED_MODULE_9__.Rect(0, 0, domRect === null || domRect === void 0 ? void 0 : domRect.width, domRect === null || domRect === void 0 ? void 0 : domRect.height);\n r.centerInRect(this.state.rect);\n this.dragDiv.setAttribute(\"data-layout-path\", \"/drag-rectangle\");\n this.dragDiv.style.left = r.x + \"px\";\n this.dragDiv.style.top = r.y + \"px\";\n }\n });\n const rootdiv = this.selfRef.current;\n rootdiv.appendChild(this.dragDiv);\n }\n /** @internal */\n handleCustomTabDrag(dropInfo, pos, event) {\n var _a, _b, _c;\n let invalidated = (_a = this.customDrop) === null || _a === void 0 ? void 0 : _a.invalidated;\n const currentCallback = (_b = this.customDrop) === null || _b === void 0 ? void 0 : _b.callback;\n this.customDrop = undefined;\n const dragging = this.newTabJson || (this.dragNode instanceof _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode ? this.dragNode : undefined);\n if (dragging && (dropInfo.node instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_8__.TabSetNode || dropInfo.node instanceof _model_BorderNode__WEBPACK_IMPORTED_MODULE_5__.BorderNode) && dropInfo.index === -1) {\n const selected = dropInfo.node.getSelectedNode();\n const tabRect = selected === null || selected === void 0 ? void 0 : selected.getRect();\n if (selected && (tabRect === null || tabRect === void 0 ? void 0 : tabRect.contains(pos.x, pos.y))) {\n let customDrop = undefined;\n try {\n const dest = this.onTabDrag(dragging, selected, pos.x - tabRect.x, pos.y - tabRect.y, dropInfo.location, () => this.onDragMove(event));\n if (dest) {\n customDrop = {\n rect: new _Rect__WEBPACK_IMPORTED_MODULE_9__.Rect(dest.x + tabRect.x, dest.y + tabRect.y, dest.width, dest.height),\n callback: dest.callback,\n invalidated: dest.invalidated,\n dragging: dragging,\n over: selected,\n x: pos.x - tabRect.x,\n y: pos.y - tabRect.y,\n location: dropInfo.location,\n cursor: dest.cursor\n };\n }\n }\n catch (e) {\n console.error(e);\n }\n if ((customDrop === null || customDrop === void 0 ? void 0 : customDrop.callback) === currentCallback) {\n invalidated = undefined;\n }\n this.customDrop = customDrop;\n }\n }\n this.dropInfo = dropInfo;\n this.outlineDiv.className = this.getClassName(this.customDrop ? _Types__WEBPACK_IMPORTED_MODULE_10__.CLASSES.FLEXLAYOUT__OUTLINE_RECT : dropInfo.className);\n if (this.customDrop) {\n this.customDrop.rect.positionElement(this.outlineDiv);\n }\n else {\n dropInfo.rect.positionElement(this.outlineDiv);\n }\n _DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.setGlassCursorOverride((_c = this.customDrop) === null || _c === void 0 ? void 0 : _c.cursor);\n this.outlineDiv.style.visibility = \"visible\";\n try {\n invalidated === null || invalidated === void 0 ? void 0 : invalidated();\n }\n catch (e) {\n console.error(e);\n }\n }\n /** @internal */\n onDragEnter(event) {\n // DragDrop keeps track of number of dragenters minus the number of\n // dragleaves. Only start a new drag if there isn't one already.\n if (_DragDrop__WEBPACK_IMPORTED_MODULE_3__.DragDrop.instance.isDragging())\n return;\n const drag = this.props.onExternalDrag(event);\n if (drag) {\n // Mimic addTabWithDragAndDrop, but pass in DragEvent\n this.fnNewNodeDropped = drag.onDrop;\n this.newTabJson = drag.json;\n this.dragStart(event, drag.dragText, _model_TabNode__WEBPACK_IMPORTED_MODULE_7__.TabNode._fromJson(drag.json, this.props.model, false), true, undefined, undefined);\n }\n }\n /** @internal */\n checkForBorderToShow(x, y) {\n const r = this.props.model._getOuterInnerRects().outer;\n const c = r.getCenter();\n const margin = this.edgeRectWidth;\n const offset = this.edgeRectLength / 2;\n let overEdge = false;\n if (this.props.model.isEnableEdgeDock() && this.state.showHiddenBorder === _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER) {\n if ((y > c.y - offset && y < c.y + offset) ||\n (x > c.x - offset && x < c.x + offset)) {\n overEdge = true;\n }\n }\n let location = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.CENTER;\n if (!overEdge) {\n if (x <= r.x + margin) {\n location = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.LEFT;\n }\n else if (x >= r.getRight() - margin) {\n location = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.RIGHT;\n }\n else if (y <= r.y + margin) {\n location = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.TOP;\n }\n else if (y >= r.getBottom() - margin) {\n location = _DockLocation__WEBPACK_IMPORTED_MODULE_2__.DockLocation.BOTTOM;\n }\n }\n if (location !== this.state.showHiddenBorder) {\n this.setState({ showHiddenBorder: location });\n }\n }\n /** @internal */\n maximize(tabsetNode) {\n this.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_4__.Actions.maximizeToggle(tabsetNode.getId()));\n }\n /** @internal */\n customizeTab(tabNode, renderValues) {\n if (this.props.onRenderTab) {\n this.props.onRenderTab(tabNode, renderValues);\n }\n }\n /** @internal */\n customizeTabSet(tabSetNode, renderValues) {\n if (this.props.onRenderTabSet) {\n this.props.onRenderTabSet(tabSetNode, renderValues);\n }\n }\n /** @internal */\n i18nName(id, param) {\n let message;\n if (this.props.i18nMapper) {\n message = this.props.i18nMapper(id, param);\n }\n if (message === undefined) {\n message = id + (param === undefined ? \"\" : param);\n }\n return message;\n }\n /** @internal */\n getOnRenderFloatingTabPlaceholder() {\n return this.props.onRenderFloatingTabPlaceholder;\n }\n /** @internal */\n getShowOverflowMenu() {\n return this.props.onShowOverflowMenu;\n }\n /** @internal */\n getTabSetPlaceHolderCallback() {\n return this.props.onTabSetPlaceHolder;\n }\n /** @internal */\n showContextMenu(node, event) {\n if (this.props.onContextMenu) {\n this.props.onContextMenu(node, event);\n }\n }\n /** @internal */\n auxMouseClick(node, event) {\n if (this.props.onAuxMouseClick) {\n this.props.onAuxMouseClick(node, event);\n }\n }\n}\n/** @internal */\nconst DragRectRenderWrapper = (props) => {\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n var _a;\n (_a = props.onRendered) === null || _a === void 0 ? void 0 : _a.call(props);\n }, [props]);\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, props.children));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Layout.tsx?");
|
|
500
400
|
|
|
501
401
|
/***/ }),
|
|
502
402
|
|
|
@@ -504,9 +404,9 @@ eval("\nvar __extends = (this && this.__extends) || (function () {\n var exte
|
|
|
504
404
|
/*!*******************************!*\
|
|
505
405
|
!*** ./src/view/Splitter.tsx ***!
|
|
506
406
|
\*******************************/
|
|
507
|
-
/***/ ((__unused_webpack_module,
|
|
407
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
508
408
|
|
|
509
|
-
eval("
|
|
409
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Splitter\": () => (/* binding */ Splitter)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _DragDrop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../DragDrop */ \"./src/DragDrop.ts\");\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _model_BorderNode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n\n\n\n\n\n\n/** @internal */\nconst Splitter = (props) => {\n const { layout, node, path } = props;\n const pBounds = react__WEBPACK_IMPORTED_MODULE_0__.useRef([]);\n const outlineDiv = react__WEBPACK_IMPORTED_MODULE_0__.useRef(undefined);\n const parentNode = node.getParent();\n const onMouseDown = (event) => {\n _DragDrop__WEBPACK_IMPORTED_MODULE_1__.DragDrop.instance.setGlassCursorOverride(node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ ? \"ns-resize\" : \"ew-resize\");\n _DragDrop__WEBPACK_IMPORTED_MODULE_1__.DragDrop.instance.startDrag(event, onDragStart, onDragMove, onDragEnd, onDragCancel, undefined, undefined, layout.getCurrentDocument(), layout.getRootDiv());\n pBounds.current = parentNode._getSplitterBounds(node, true);\n const rootdiv = layout.getRootDiv();\n outlineDiv.current = layout.getCurrentDocument().createElement(\"div\");\n outlineDiv.current.style.position = \"absolute\";\n outlineDiv.current.className = layout.getClassName(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__SPLITTER_DRAG);\n outlineDiv.current.style.cursor = node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ ? \"ns-resize\" : \"ew-resize\";\n const r = node.getRect();\n if (node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.VERT && r.width < 2) {\n r.width = 2;\n }\n else if (node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ && r.height < 2) {\n r.height = 2;\n }\n r.positionElement(outlineDiv.current);\n rootdiv.appendChild(outlineDiv.current);\n };\n const onDragCancel = (wasDragging) => {\n const rootdiv = layout.getRootDiv();\n rootdiv.removeChild(outlineDiv.current);\n };\n const onDragStart = () => {\n return true;\n };\n const onDragMove = (event) => {\n const clientRect = layout.getDomRect();\n const pos = {\n x: event.clientX - clientRect.left,\n y: event.clientY - clientRect.top,\n };\n if (outlineDiv) {\n if (node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) {\n outlineDiv.current.style.top = getBoundPosition(pos.y - 4) + \"px\";\n }\n else {\n outlineDiv.current.style.left = getBoundPosition(pos.x - 4) + \"px\";\n }\n }\n if (layout.isRealtimeResize()) {\n updateLayout();\n }\n };\n const updateLayout = () => {\n let value = 0;\n if (outlineDiv) {\n if (node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ) {\n value = outlineDiv.current.offsetTop;\n }\n else {\n value = outlineDiv.current.offsetLeft;\n }\n }\n if (parentNode instanceof _model_BorderNode__WEBPACK_IMPORTED_MODULE_3__.BorderNode) {\n const pos = parentNode._calculateSplit(node, value);\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.adjustBorderSplit(node.getParent().getId(), pos));\n }\n else {\n const splitSpec = parentNode._calculateSplit(node, value);\n if (splitSpec !== undefined) {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.adjustSplit(splitSpec));\n }\n }\n };\n const onDragEnd = () => {\n updateLayout();\n const rootdiv = layout.getRootDiv();\n rootdiv.removeChild(outlineDiv.current);\n };\n const getBoundPosition = (p) => {\n const bounds = pBounds.current;\n let rtn = p;\n if (p < bounds[0]) {\n rtn = bounds[0];\n }\n if (p > bounds[1]) {\n rtn = bounds[1];\n }\n return rtn;\n };\n const cm = layout.getClassName;\n let r = node.getRect();\n const style = r.styleWithPosition({\n cursor: node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ ? \"ns-resize\" : \"ew-resize\",\n });\n let className = cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__SPLITTER) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__SPLITTER_ + node.getOrientation().getName());\n if (parentNode instanceof _model_BorderNode__WEBPACK_IMPORTED_MODULE_3__.BorderNode) {\n className += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__SPLITTER_BORDER);\n }\n else {\n if (node.getModel().getMaximizedTabset() !== undefined) {\n style.display = \"none\";\n }\n }\n const extra = node.getModel().getSplitterExtra();\n if (extra === 0) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { style: style, \"data-layout-path\": path, className: className, onTouchStart: onMouseDown, onMouseDown: onMouseDown }));\n }\n else {\n // add extended transparent div for hit testing\n // extends forward only, so as not to interfere with scrollbars\n let r2 = r.clone();\n r2.x = 0;\n r2.y = 0;\n if (node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.VERT) {\n r2.width += extra;\n }\n else {\n r2.height += extra;\n }\n const style2 = r2.styleWithPosition({\n cursor: node.getOrientation() === _Orientation__WEBPACK_IMPORTED_MODULE_4__.Orientation.HORZ ? \"ns-resize\" : \"ew-resize\"\n });\n const className2 = cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__SPLITTER_EXTRA);\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { style: style, \"data-layout-path\": path, className: className },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { style: style2, className: className2, onTouchStart: onMouseDown, onMouseDown: onMouseDown })));\n }\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Splitter.tsx?");
|
|
510
410
|
|
|
511
411
|
/***/ }),
|
|
512
412
|
|
|
@@ -514,9 +414,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
514
414
|
/*!**************************!*\
|
|
515
415
|
!*** ./src/view/Tab.tsx ***!
|
|
516
416
|
\**************************/
|
|
517
|
-
/***/ ((__unused_webpack_module,
|
|
417
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
518
418
|
|
|
519
|
-
eval("
|
|
419
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Tab\": () => (/* binding */ Tab)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _ErrorBoundary__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ErrorBoundary */ \"./src/view/ErrorBoundary.tsx\");\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _model_BorderNode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../model/BorderNode */ \"./src/model/BorderNode.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\n\n\n\n\n\n\n\n\n/** @internal */\nconst Tab = (props) => {\n const { layout, selected, node, factory, path } = props;\n const [renderComponent, setRenderComponent] = react__WEBPACK_IMPORTED_MODULE_0__.useState(!props.node.isEnableRenderOnDemand() || props.selected);\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\n if (!renderComponent && selected) {\n // load on demand\n // console.log(\"load on demand: \" + node.getName());\n setRenderComponent(true);\n }\n });\n const onMouseDown = () => {\n const parent = node.getParent();\n if (parent.getType() === _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode.TYPE) {\n if (!parent.isActive()) {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_1__.Actions.setActiveTabset(parent.getId()));\n }\n }\n };\n const cm = layout.getClassName;\n const useVisibility = node.getModel().isUseVisibility();\n const parentNode = node.getParent();\n const style = node._styleWithPosition();\n if (!selected) {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_7__.hideElement)(style, useVisibility);\n }\n if (parentNode instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode) {\n if (node.getModel().getMaximizedTabset() !== undefined && !parentNode.isMaximized()) {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_7__.hideElement)(style, useVisibility);\n }\n }\n let child;\n if (renderComponent) {\n child = factory(node);\n }\n let className = cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB);\n if (parentNode instanceof _model_BorderNode__WEBPACK_IMPORTED_MODULE_6__.BorderNode) {\n className += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_BORDER);\n className += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_BORDER_ + parentNode.getLocation().getName());\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: className, \"data-layout-path\": path, onMouseDown: onMouseDown, onTouchStart: onMouseDown, style: style },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ErrorBoundary__WEBPACK_IMPORTED_MODULE_4__.ErrorBoundary, { message: props.layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_5__.I18nLabel.Error_rendering_component) },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, child))));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Tab.tsx?");
|
|
520
420
|
|
|
521
421
|
/***/ }),
|
|
522
422
|
|
|
@@ -524,9 +424,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
524
424
|
/*!********************************!*\
|
|
525
425
|
!*** ./src/view/TabButton.tsx ***!
|
|
526
426
|
\********************************/
|
|
527
|
-
/***/ ((__unused_webpack_module,
|
|
427
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
528
428
|
|
|
529
|
-
eval("
|
|
429
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabButton\": () => (/* binding */ TabButton)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _model_ICloseType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../model/ICloseType */ \"./src/model/ICloseType.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\n\n\n\n\n\n\n/** @internal */\nconst TabButton = (props) => {\n const { layout, node, selected, iconFactory, titleFactory, icons, path } = props;\n const selfRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const contentRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const onMouseDown = (event) => {\n if (!(0,_Utils__WEBPACK_IMPORTED_MODULE_6__.isAuxMouseEvent)(event) && !layout.getEditingTab()) {\n layout.dragStart(event, undefined, node, node.isEnableDrag(), onClick, onDoubleClick);\n }\n };\n const onAuxMouseClick = (event) => {\n if ((0,_Utils__WEBPACK_IMPORTED_MODULE_6__.isAuxMouseEvent)(event)) {\n layout.auxMouseClick(node, event);\n }\n };\n const onContextMenu = (event) => {\n layout.showContextMenu(node, event);\n };\n const onClick = () => {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.selectTab(node.getId()));\n };\n const onDoubleClick = (event) => {\n if (node.isEnableRename()) {\n onRename();\n }\n };\n const onRename = () => {\n layout.setEditingTab(node);\n layout.getCurrentDocument().body.addEventListener(\"mousedown\", onEndEdit);\n layout.getCurrentDocument().body.addEventListener(\"touchstart\", onEndEdit);\n };\n const onEndEdit = (event) => {\n if (event.target !== contentRef.current) {\n layout.getCurrentDocument().body.removeEventListener(\"mousedown\", onEndEdit);\n layout.getCurrentDocument().body.removeEventListener(\"touchstart\", onEndEdit);\n layout.setEditingTab(undefined);\n }\n };\n const isClosable = () => {\n const closeType = node.getCloseType();\n if (selected || closeType === _model_ICloseType__WEBPACK_IMPORTED_MODULE_4__.ICloseType.Always) {\n return true;\n }\n if (closeType === _model_ICloseType__WEBPACK_IMPORTED_MODULE_4__.ICloseType.Visible) {\n // not selected but x should be visible due to hover\n if (window.matchMedia && window.matchMedia(\"(hover: hover) and (pointer: fine)\").matches) {\n return true;\n }\n }\n return false;\n };\n const onClose = (event) => {\n if (isClosable()) {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.deleteTab(node.getId()));\n }\n else {\n onClick();\n }\n };\n const onCloseMouseDown = (event) => {\n event.stopPropagation();\n };\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\n updateRect();\n if (layout.getEditingTab() === node) {\n contentRef.current.select();\n }\n });\n const updateRect = () => {\n // record position of tab in node\n const layoutRect = layout.getDomRect();\n const r = selfRef.current.getBoundingClientRect();\n node._setTabRect(new _Rect__WEBPACK_IMPORTED_MODULE_3__.Rect(r.left - layoutRect.left, r.top - layoutRect.top, r.width, r.height));\n };\n const onTextBoxMouseDown = (event) => {\n // console.log(\"onTextBoxMouseDown\");\n event.stopPropagation();\n };\n const onTextBoxKeyPress = (event) => {\n // console.log(event, event.keyCode);\n if (event.keyCode === 27) {\n // esc\n layout.setEditingTab(undefined);\n }\n else if (event.keyCode === 13) {\n // enter\n layout.setEditingTab(undefined);\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.renameTab(node.getId(), event.target.value));\n }\n };\n const cm = layout.getClassName;\n const parentNode = node.getParent();\n let baseClassName = _Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__TAB_BUTTON;\n let classNames = cm(baseClassName);\n classNames += \" \" + cm(baseClassName + \"_\" + parentNode.getTabLocation());\n if (selected) {\n classNames += \" \" + cm(baseClassName + \"--selected\");\n }\n else {\n classNames += \" \" + cm(baseClassName + \"--unselected\");\n }\n if (node.getClassName() !== undefined) {\n classNames += \" \" + node.getClassName();\n }\n const renderState = (0,_Utils__WEBPACK_IMPORTED_MODULE_6__.getRenderStateEx)(layout, node, iconFactory, titleFactory);\n let content = renderState.content ? (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__TAB_BUTTON_CONTENT) }, renderState.content)) : null;\n const leading = renderState.leading ? (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__TAB_BUTTON_LEADING) }, renderState.leading)) : null;\n if (layout.getEditingTab() === node) {\n content = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"input\", { ref: contentRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__TAB_BUTTON_TEXTBOX), \"data-layout-path\": path + \"/textbox\", type: \"text\", autoFocus: true, defaultValue: node.getName(), onKeyDown: onTextBoxKeyPress, onMouseDown: onTextBoxMouseDown, onTouchStart: onTextBoxMouseDown }));\n }\n if (node.isEnableClose()) {\n const closeTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Close_Tab);\n renderState.buttons.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"close\", \"data-layout-path\": path + \"/button/close\", title: closeTitle, className: cm(_Types__WEBPACK_IMPORTED_MODULE_5__.CLASSES.FLEXLAYOUT__TAB_BUTTON_TRAILING), onMouseDown: onCloseMouseDown, onClick: onClose, onTouchStart: onCloseMouseDown }, (typeof icons.close === \"function\") ? icons.close(node) : icons.close));\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: selfRef, \"data-layout-path\": path, className: classNames, onMouseDown: onMouseDown, onClick: onAuxMouseClick, onAuxClick: onAuxMouseClick, onContextMenu: onContextMenu, onTouchStart: onMouseDown, title: node.getHelpText() },\n leading,\n content,\n renderState.buttons));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/TabButton.tsx?");
|
|
530
430
|
|
|
531
431
|
/***/ }),
|
|
532
432
|
|
|
@@ -534,9 +434,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
534
434
|
/*!*************************************!*\
|
|
535
435
|
!*** ./src/view/TabButtonStamp.tsx ***!
|
|
536
436
|
\*************************************/
|
|
537
|
-
/***/ ((__unused_webpack_module,
|
|
437
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
538
438
|
|
|
539
|
-
eval("
|
|
439
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabButtonStamp\": () => (/* binding */ TabButtonStamp)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\n\n\n/** @internal */\nconst TabButtonStamp = (props) => {\n const { layout, node, iconFactory, titleFactory } = props;\n const selfRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const cm = layout.getClassName;\n let classNames = cm(_Types__WEBPACK_IMPORTED_MODULE_1__.CLASSES.FLEXLAYOUT__TAB_BUTTON_STAMP);\n const renderState = (0,_Utils__WEBPACK_IMPORTED_MODULE_2__.getRenderStateEx)(layout, node, iconFactory, titleFactory);\n let content = renderState.content ? (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_1__.CLASSES.FLEXLAYOUT__TAB_BUTTON_CONTENT) }, renderState.content))\n : node._getNameForOverflowMenu();\n const leading = renderState.leading ? (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_1__.CLASSES.FLEXLAYOUT__TAB_BUTTON_LEADING) }, renderState.leading)) : null;\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: selfRef, className: classNames, title: node.getHelpText() },\n leading,\n content));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/TabButtonStamp.tsx?");
|
|
540
440
|
|
|
541
441
|
/***/ }),
|
|
542
442
|
|
|
@@ -544,9 +444,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
544
444
|
/*!**********************************!*\
|
|
545
445
|
!*** ./src/view/TabFloating.tsx ***!
|
|
546
446
|
\**********************************/
|
|
547
|
-
/***/ ((__unused_webpack_module,
|
|
447
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
548
448
|
|
|
549
|
-
eval("
|
|
449
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabFloating\": () => (/* binding */ TabFloating)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\n\n\n\n\n\n/** @internal */\nconst TabFloating = (props) => {\n const { layout, selected, node, path } = props;\n const showPopout = () => {\n if (node.getWindow()) {\n node.getWindow().focus();\n }\n };\n const dockPopout = () => {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_1__.Actions.unFloatTab(node.getId()));\n };\n const onMouseDown = () => {\n const parent = node.getParent();\n if (parent.getType() === _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode.TYPE) {\n if (!parent.isActive()) {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_1__.Actions.setActiveTabset(parent.getId()));\n }\n }\n };\n const onClickFocus = (event) => {\n event.preventDefault();\n showPopout();\n };\n const onClickDock = (event) => {\n event.preventDefault();\n dockPopout();\n };\n const cm = layout.getClassName;\n const parentNode = node.getParent();\n const style = node._styleWithPosition();\n if (!selected) {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_5__.hideElement)(style, node.getModel().isUseVisibility());\n }\n if (parentNode instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode) {\n if (node.getModel().getMaximizedTabset() !== undefined && !parentNode.isMaximized()) {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_5__.hideElement)(style, node.getModel().isUseVisibility());\n }\n }\n const message = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_4__.I18nLabel.Floating_Window_Message);\n const showMessage = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_4__.I18nLabel.Floating_Window_Show_Window);\n const dockMessage = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_4__.I18nLabel.Floating_Window_Dock_Window);\n const customRenderCallback = layout.getOnRenderFloatingTabPlaceholder();\n if (customRenderCallback) {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_FLOATING), onMouseDown: onMouseDown, onTouchStart: onMouseDown, style: style }, customRenderCallback(dockPopout, showPopout)));\n }\n else {\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_FLOATING), \"data-layout-path\": path, onMouseDown: onMouseDown, onTouchStart: onMouseDown, style: style },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_3__.CLASSES.FLEXLAYOUT__TAB_FLOATING_INNER) },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", null, message),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"a\", { href: \"#\", onClick: onClickFocus }, showMessage)),\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", null,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"a\", { href: \"#\", onClick: onClickDock }, dockMessage)))));\n }\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/TabFloating.tsx?");
|
|
550
450
|
|
|
551
451
|
/***/ }),
|
|
552
452
|
|
|
@@ -554,9 +454,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
554
454
|
/*!**************************************!*\
|
|
555
455
|
!*** ./src/view/TabOverflowHook.tsx ***!
|
|
556
456
|
\**************************************/
|
|
557
|
-
/***/ ((__unused_webpack_module,
|
|
457
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
558
458
|
|
|
559
|
-
eval("
|
|
459
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"useTabOverflow\": () => (/* binding */ useTabOverflow)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _Rect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Rect */ \"./src/Rect.ts\");\n/* harmony import */ var _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/TabSetNode */ \"./src/model/TabSetNode.ts\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n\n\n\n\n/** @internal */\nconst useTabOverflow = (node, orientation, toolbarRef, stickyButtonsRef) => {\n const firstRender = react__WEBPACK_IMPORTED_MODULE_0__.useRef(true);\n const tabsTruncated = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);\n const lastRect = react__WEBPACK_IMPORTED_MODULE_0__.useRef(new _Rect__WEBPACK_IMPORTED_MODULE_1__.Rect(0, 0, 0, 0));\n const selfRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const [position, setPosition] = react__WEBPACK_IMPORTED_MODULE_0__.useState(0);\n const userControlledLeft = react__WEBPACK_IMPORTED_MODULE_0__.useRef(false);\n const [hiddenTabs, setHiddenTabs] = react__WEBPACK_IMPORTED_MODULE_0__.useState([]);\n const lastHiddenCount = react__WEBPACK_IMPORTED_MODULE_0__.useRef(0);\n // if selected node or tabset/border rectangle change then unset usercontrolled (so selected tab will be kept in view)\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\n userControlledLeft.current = false;\n }, [node.getSelectedNode(), node.getRect().width, node.getRect().height]);\n react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect(() => {\n updateVisibleTabs();\n });\n react__WEBPACK_IMPORTED_MODULE_0__.useEffect(() => {\n const instance = selfRef.current;\n instance.addEventListener('wheel', onWheel, { passive: false });\n return () => {\n instance.removeEventListener('wheel', onWheel);\n };\n }, []);\n // needed to prevent default mouse wheel over tabset/border (cannot do with react event?)\n const onWheel = (event) => {\n event.preventDefault();\n };\n const getNear = (rect) => {\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.HORZ) {\n return rect.x;\n }\n else {\n return rect.y;\n }\n };\n const getFar = (rect) => {\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.HORZ) {\n return rect.getRight();\n }\n else {\n return rect.getBottom();\n }\n };\n const getSize = (rect) => {\n if (orientation === _Orientation__WEBPACK_IMPORTED_MODULE_3__.Orientation.HORZ) {\n return rect.width;\n }\n else {\n return rect.height;\n }\n };\n const updateVisibleTabs = () => {\n const tabMargin = 2;\n if (firstRender.current === true) {\n tabsTruncated.current = false;\n }\n const nodeRect = node instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode ? node.getRect() : node.getTabHeaderRect();\n let lastChild = node.getChildren()[node.getChildren().length - 1];\n const stickyButtonsSize = stickyButtonsRef.current === null ? 0 : getSize(stickyButtonsRef.current.getBoundingClientRect());\n if (firstRender.current === true ||\n (lastHiddenCount.current === 0 && hiddenTabs.length !== 0) ||\n nodeRect.width !== lastRect.current.width || // incase rect changed between first render and second\n nodeRect.height !== lastRect.current.height) {\n lastHiddenCount.current = hiddenTabs.length;\n lastRect.current = nodeRect;\n const enabled = node instanceof _model_TabSetNode__WEBPACK_IMPORTED_MODULE_2__.TabSetNode ? node.isEnableTabStrip() === true : true;\n let endPos = getFar(nodeRect) - stickyButtonsSize;\n if (toolbarRef.current !== null) {\n endPos -= getSize(toolbarRef.current.getBoundingClientRect());\n }\n if (enabled && node.getChildren().length > 0) {\n if (hiddenTabs.length === 0 && position === 0 && getFar(lastChild.getTabRect()) + tabMargin < endPos) {\n return; // nothing to do all tabs are shown in available space\n }\n let shiftPos = 0;\n const selectedTab = node.getSelectedNode();\n if (selectedTab && !userControlledLeft.current) {\n const selectedRect = selectedTab.getTabRect();\n const selectedStart = getNear(selectedRect) - tabMargin;\n const selectedEnd = getFar(selectedRect) + tabMargin;\n // when selected tab is larger than available space then align left\n if (getSize(selectedRect) + 2 * tabMargin >= endPos - getNear(nodeRect)) {\n shiftPos = getNear(nodeRect) - selectedStart;\n }\n else {\n if (selectedEnd > endPos || selectedStart < getNear(nodeRect)) {\n if (selectedStart < getNear(nodeRect)) {\n shiftPos = getNear(nodeRect) - selectedStart;\n }\n // use second if statement to prevent tab moving back then forwards if not enough space for single tab\n if (selectedEnd + shiftPos > endPos) {\n shiftPos = endPos - selectedEnd;\n }\n }\n }\n }\n const extraSpace = Math.max(0, endPos - (getFar(lastChild.getTabRect()) + tabMargin + shiftPos));\n const newPosition = Math.min(0, position + shiftPos + extraSpace);\n // find hidden tabs\n const diff = newPosition - position;\n const hidden = [];\n for (let i = 0; i < node.getChildren().length; i++) {\n const child = node.getChildren()[i];\n if (getNear(child.getTabRect()) + diff < getNear(nodeRect) || getFar(child.getTabRect()) + diff > endPos) {\n hidden.push({ node: child, index: i });\n }\n }\n if (hidden.length > 0) {\n tabsTruncated.current = true;\n }\n firstRender.current = false; // need to do a second render\n setHiddenTabs(hidden);\n setPosition(newPosition);\n }\n }\n else {\n firstRender.current = true;\n }\n };\n const onMouseWheel = (event) => {\n let delta = 0;\n if (Math.abs(event.deltaX) > Math.abs(event.deltaY)) {\n delta = -event.deltaX;\n }\n else {\n delta = -event.deltaY;\n }\n if (event.deltaMode === 1) {\n // DOM_DELTA_LINE\t0x01\tThe delta values are specified in lines.\n delta *= 40;\n }\n setPosition(position + delta);\n userControlledLeft.current = true;\n event.stopPropagation();\n };\n return { selfRef, position, userControlledLeft, hiddenTabs, onMouseWheel, tabsTruncated: tabsTruncated.current };\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/TabOverflowHook.tsx?");
|
|
560
460
|
|
|
561
461
|
/***/ }),
|
|
562
462
|
|
|
@@ -564,9 +464,9 @@ eval("\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexpo
|
|
|
564
464
|
/*!*****************************!*\
|
|
565
465
|
!*** ./src/view/TabSet.tsx ***!
|
|
566
466
|
\*****************************/
|
|
567
|
-
/***/ (
|
|
467
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
568
468
|
|
|
569
|
-
eval("\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.TabSet = void 0;\nvar React = __webpack_require__(/*! react */ \"react\");\nvar I18nLabel_1 = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\nvar Actions_1 = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\nvar PopupMenu_1 = __webpack_require__(/*! ../PopupMenu */ \"./src/PopupMenu.tsx\");\nvar TabButton_1 = __webpack_require__(/*! ./TabButton */ \"./src/view/TabButton.tsx\");\nvar TabOverflowHook_1 = __webpack_require__(/*! ./TabOverflowHook */ \"./src/view/TabOverflowHook.tsx\");\nvar Orientation_1 = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\nvar Types_1 = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\nvar Utils_1 = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n/** @internal */\nvar TabSet = function (props) {\n var node = props.node, layout = props.layout, iconFactory = props.iconFactory, titleFactory = props.titleFactory, icons = props.icons, path = props.path;\n var toolbarRef = React.useRef(null);\n var overflowbuttonRef = React.useRef(null);\n var tabbarInnerRef = React.useRef(null);\n var stickyButtonsRef = React.useRef(null);\n var _a = (0, TabOverflowHook_1.useTabOverflow)(node, Orientation_1.Orientation.HORZ, toolbarRef, stickyButtonsRef), selfRef = _a.selfRef, position = _a.position, userControlledLeft = _a.userControlledLeft, hiddenTabs = _a.hiddenTabs, onMouseWheel = _a.onMouseWheel, tabsTruncated = _a.tabsTruncated;\n var onOverflowClick = function (event) {\n var callback = layout.getShowOverflowMenu();\n if (callback !== undefined) {\n callback(node, event, hiddenTabs, onOverflowItemSelect);\n }\n else {\n var element = overflowbuttonRef.current;\n (0, PopupMenu_1.showPopup)(element, hiddenTabs, onOverflowItemSelect, layout, iconFactory, titleFactory);\n }\n event.stopPropagation();\n };\n var onOverflowItemSelect = function (item) {\n layout.doAction(Actions_1.Actions.selectTab(item.node.getId()));\n userControlledLeft.current = false;\n };\n var onMouseDown = function (event) {\n if (!(0, Utils_1.isAuxMouseEvent)(event)) {\n var name_1 = node.getName();\n if (name_1 === undefined) {\n name_1 = \"\";\n }\n else {\n name_1 = \": \" + name_1;\n }\n layout.doAction(Actions_1.Actions.setActiveTabset(node.getId()));\n if (!layout.getEditingTab()) {\n var message = layout.i18nName(I18nLabel_1.I18nLabel.Move_Tabset, name_1);\n if (node.getModel().getMaximizedTabset() !== undefined) {\n layout.dragStart(event, message, node, false, function (event2) { return undefined; }, onDoubleClick);\n }\n else {\n layout.dragStart(event, message, node, node.isEnableDrag(), function (event2) { return undefined; }, onDoubleClick);\n }\n }\n }\n };\n var onAuxMouseClick = function (event) {\n if ((0, Utils_1.isAuxMouseEvent)(event)) {\n layout.auxMouseClick(node, event);\n }\n };\n var onContextMenu = function (event) {\n layout.showContextMenu(node, event);\n };\n var onInterceptMouseDown = function (event) {\n event.stopPropagation();\n };\n var onMaximizeToggle = function (event) {\n if (node.canMaximize()) {\n layout.maximize(node);\n }\n event.stopPropagation();\n };\n var onClose = function (event) {\n layout.doAction(Actions_1.Actions.deleteTabset(node.getId()));\n event.stopPropagation();\n };\n var onFloatTab = function (event) {\n if (selectedTabNode !== undefined) {\n layout.doAction(Actions_1.Actions.floatTab(selectedTabNode.getId()));\n }\n event.stopPropagation();\n };\n var onDoubleClick = function (event) {\n if (node.canMaximize()) {\n layout.maximize(node);\n }\n };\n // Start Render\n var cm = layout.getClassName;\n // tabbar inner can get shifted left via tab rename, this resets scrollleft to 0\n if (tabbarInnerRef.current !== null && tabbarInnerRef.current.scrollLeft !== 0) {\n tabbarInnerRef.current.scrollLeft = 0;\n }\n var selectedTabNode = node.getSelectedNode();\n var style = node._styleWithPosition();\n if (node.getModel().getMaximizedTabset() !== undefined && !node.isMaximized()) {\n (0, Utils_1.hideElement)(style, node.getModel().isUseVisibility());\n }\n var tabs = [];\n if (node.isEnableTabStrip()) {\n for (var i = 0; i < node.getChildren().length; i++) {\n var child = node.getChildren()[i];\n var isSelected = node.getSelected() === i;\n tabs.push(React.createElement(TabButton_1.TabButton, { layout: layout, node: child, path: path + \"/tb\" + i, key: child.getId(), selected: isSelected, iconFactory: iconFactory, titleFactory: titleFactory, icons: icons }));\n if (i < node.getChildren().length - 1) {\n tabs.push(React.createElement(\"div\", { key: \"divider\" + i, className: cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_TAB_DIVIDER) }));\n }\n }\n }\n var showHeader = node.getName() !== undefined;\n var stickyButtons = [];\n var buttons = [];\n var headerButtons = [];\n // allow customization of header contents and buttons\n var renderState = { headerContent: node.getName(), stickyButtons: stickyButtons, buttons: buttons, headerButtons: headerButtons };\n layout.customizeTabSet(node, renderState);\n var headerContent = renderState.headerContent;\n stickyButtons = renderState.stickyButtons;\n buttons = renderState.buttons;\n headerButtons = renderState.headerButtons;\n if (stickyButtons.length > 0) {\n if (tabsTruncated) {\n buttons = __spreadArray(__spreadArray([], stickyButtons, true), buttons, true);\n }\n else {\n tabs.push(React.createElement(\"div\", { ref: stickyButtonsRef, key: \"sticky_buttons_container\", onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown, onDragStart: function (e) { e.preventDefault(); }, className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER) }, stickyButtons));\n }\n }\n var toolbar;\n if (hiddenTabs.length > 0) {\n var overflowTitle = layout.i18nName(I18nLabel_1.I18nLabel.Overflow_Menu_Tooltip);\n var overflowContent = void 0;\n if (typeof icons.more === \"function\") {\n overflowContent = icons.more(node, hiddenTabs);\n }\n else {\n overflowContent = (React.createElement(React.Fragment, null,\n icons.more,\n React.createElement(\"div\", { className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT) }, hiddenTabs.length)));\n }\n buttons.push(React.createElement(\"button\", { key: \"overflowbutton\", \"data-layout-path\": path + \"/button/overflow\", ref: overflowbuttonRef, className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TAB_BUTTON_OVERFLOW), title: overflowTitle, onClick: onOverflowClick, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, overflowContent));\n }\n if (selectedTabNode !== undefined && layout.isSupportsPopout() && selectedTabNode.isEnableFloat() && !selectedTabNode.isFloating()) {\n var floatTitle = layout.i18nName(I18nLabel_1.I18nLabel.Float_Tab);\n buttons.push(React.createElement(\"button\", { key: \"float\", \"data-layout-path\": path + \"/button/float\", title: floatTitle, className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT), onClick: onFloatTab, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, (typeof icons.popout === \"function\") ? icons.popout(selectedTabNode) : icons.popout));\n }\n if (node.canMaximize()) {\n var minTitle = layout.i18nName(I18nLabel_1.I18nLabel.Restore);\n var maxTitle = layout.i18nName(I18nLabel_1.I18nLabel.Maximize);\n var btns = showHeader ? headerButtons : buttons;\n btns.push(React.createElement(\"button\", { key: \"max\", \"data-layout-path\": path + \"/button/max\", title: node.isMaximized() ? minTitle : maxTitle, className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_ + (node.isMaximized() ? \"max\" : \"min\")), onClick: onMaximizeToggle, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, node.isMaximized() ?\n (typeof icons.restore === \"function\") ? icons.restore(node) : icons.restore :\n (typeof icons.maximize === \"function\") ? icons.maximize(node) : icons.maximize));\n }\n if (!node.isMaximized() && node.isEnableClose()) {\n var title = layout.i18nName(I18nLabel_1.I18nLabel.Close_Tabset);\n var btns = showHeader ? headerButtons : buttons;\n btns.push(React.createElement(\"button\", { key: \"close\", \"data-layout-path\": path + \"/button/close\", title: title, className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE), onClick: onClose, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, (typeof icons.closeTabset === \"function\") ? icons.closeTabset(node) : icons.closeTabset));\n }\n toolbar = (React.createElement(\"div\", { key: \"toolbar\", ref: toolbarRef, className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR), onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown, onDragStart: function (e) { e.preventDefault(); } }, buttons));\n var header;\n var tabStrip;\n var tabStripClasses = cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_TABBAR_OUTER);\n if (node.getClassNameTabStrip() !== undefined) {\n tabStripClasses += \" \" + node.getClassNameTabStrip();\n }\n tabStripClasses += \" \" + Types_1.CLASSES.FLEXLAYOUT__TABSET_TABBAR_OUTER_ + node.getTabLocation();\n if (node.isActive() && !showHeader) {\n tabStripClasses += \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_SELECTED);\n }\n if (node.isMaximized() && !showHeader) {\n tabStripClasses += \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_MAXIMIZED);\n }\n if (showHeader) {\n var headerToolbar = (React.createElement(\"div\", { key: \"toolbar\", ref: toolbarRef, className: cm(Types_1.CLASSES.FLEXLAYOUT__TAB_TOOLBAR), onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown, onDragStart: function (e) { e.preventDefault(); } }, headerButtons));\n var tabHeaderClasses = cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_HEADER);\n if (node.isActive()) {\n tabHeaderClasses += \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_SELECTED);\n }\n if (node.isMaximized()) {\n tabHeaderClasses += \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_MAXIMIZED);\n }\n if (node.getClassNameHeader() !== undefined) {\n tabHeaderClasses += \" \" + node.getClassNameHeader();\n }\n header = (React.createElement(\"div\", { className: tabHeaderClasses, style: { height: node.getHeaderHeight() + \"px\" }, \"data-layout-path\": path + \"/header\", onMouseDown: onMouseDown, onContextMenu: onContextMenu, onClick: onAuxMouseClick, onAuxClick: onAuxMouseClick, onTouchStart: onMouseDown },\n React.createElement(\"div\", { className: cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_HEADER_CONTENT) }, headerContent),\n headerToolbar));\n }\n var tabStripStyle = { height: node.getTabStripHeight() + \"px\" };\n tabStrip = (React.createElement(\"div\", { className: tabStripClasses, style: tabStripStyle, \"data-layout-path\": path + \"/tabstrip\", onMouseDown: onMouseDown, onContextMenu: onContextMenu, onClick: onAuxMouseClick, onAuxClick: onAuxMouseClick, onTouchStart: onMouseDown },\n React.createElement(\"div\", { ref: tabbarInnerRef, className: cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER) + \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER_ + node.getTabLocation()) },\n React.createElement(\"div\", { style: { left: position }, className: cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER) + \" \" + cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_ + node.getTabLocation()) }, tabs)),\n toolbar));\n style = layout.styleFont(style);\n var placeHolder = undefined;\n if (node.getChildren().length === 0) {\n var placeHolderCallback = layout.getTabSetPlaceHolderCallback();\n if (placeHolderCallback) {\n placeHolder = placeHolderCallback(node);\n }\n }\n var center = React.createElement(\"div\", { className: cm(Types_1.CLASSES.FLEXLAYOUT__TABSET_CONTENT) }, placeHolder);\n var content;\n if (node.getTabLocation() === \"top\") {\n content = React.createElement(React.Fragment, null,\n header,\n tabStrip,\n center);\n }\n else {\n content = React.createElement(React.Fragment, null,\n header,\n center,\n tabStrip);\n }\n return (React.createElement(\"div\", { ref: selfRef, dir: \"ltr\", \"data-layout-path\": path, style: style, className: cm(Types_1.CLASSES.FLEXLAYOUT__TABSET), onWheel: onMouseWheel }, content));\n};\nexports.TabSet = TabSet;\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/TabSet.tsx?");
|
|
469
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"TabSet\": () => (/* binding */ TabSet)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _I18nLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../I18nLabel */ \"./src/I18nLabel.ts\");\n/* harmony import */ var _model_Actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../model/Actions */ \"./src/model/Actions.ts\");\n/* harmony import */ var _PopupMenu__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../PopupMenu */ \"./src/PopupMenu.tsx\");\n/* harmony import */ var _TabButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./TabButton */ \"./src/view/TabButton.tsx\");\n/* harmony import */ var _TabOverflowHook__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./TabOverflowHook */ \"./src/view/TabOverflowHook.tsx\");\n/* harmony import */ var _Orientation__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Orientation */ \"./src/Orientation.ts\");\n/* harmony import */ var _Types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../Types */ \"./src/Types.ts\");\n/* harmony import */ var _Utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Utils */ \"./src/view/Utils.tsx\");\n\n\n\n\n\n\n\n\n\n/** @internal */\nconst TabSet = (props) => {\n const { node, layout, iconFactory, titleFactory, icons, path } = props;\n const toolbarRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const overflowbuttonRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const tabbarInnerRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const stickyButtonsRef = react__WEBPACK_IMPORTED_MODULE_0__.useRef(null);\n const { selfRef, position, userControlledLeft, hiddenTabs, onMouseWheel, tabsTruncated } = (0,_TabOverflowHook__WEBPACK_IMPORTED_MODULE_5__.useTabOverflow)(node, _Orientation__WEBPACK_IMPORTED_MODULE_6__.Orientation.HORZ, toolbarRef, stickyButtonsRef);\n const onOverflowClick = (event) => {\n const callback = layout.getShowOverflowMenu();\n if (callback !== undefined) {\n callback(node, event, hiddenTabs, onOverflowItemSelect);\n }\n else {\n const element = overflowbuttonRef.current;\n (0,_PopupMenu__WEBPACK_IMPORTED_MODULE_3__.showPopup)(element, hiddenTabs, onOverflowItemSelect, layout, iconFactory, titleFactory);\n }\n event.stopPropagation();\n };\n const onOverflowItemSelect = (item) => {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.selectTab(item.node.getId()));\n userControlledLeft.current = false;\n };\n const onMouseDown = (event) => {\n if (!(0,_Utils__WEBPACK_IMPORTED_MODULE_8__.isAuxMouseEvent)(event)) {\n let name = node.getName();\n if (name === undefined) {\n name = \"\";\n }\n else {\n name = \": \" + name;\n }\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.setActiveTabset(node.getId()));\n if (!layout.getEditingTab()) {\n const message = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Move_Tabset, name);\n if (node.getModel().getMaximizedTabset() !== undefined) {\n layout.dragStart(event, message, node, false, (event2) => undefined, onDoubleClick);\n }\n else {\n layout.dragStart(event, message, node, node.isEnableDrag(), (event2) => undefined, onDoubleClick);\n }\n }\n }\n };\n const onAuxMouseClick = (event) => {\n if ((0,_Utils__WEBPACK_IMPORTED_MODULE_8__.isAuxMouseEvent)(event)) {\n layout.auxMouseClick(node, event);\n }\n };\n const onContextMenu = (event) => {\n layout.showContextMenu(node, event);\n };\n const onInterceptMouseDown = (event) => {\n event.stopPropagation();\n };\n const onMaximizeToggle = (event) => {\n if (node.canMaximize()) {\n layout.maximize(node);\n }\n event.stopPropagation();\n };\n const onClose = (event) => {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.deleteTabset(node.getId()));\n event.stopPropagation();\n };\n const onFloatTab = (event) => {\n if (selectedTabNode !== undefined) {\n layout.doAction(_model_Actions__WEBPACK_IMPORTED_MODULE_2__.Actions.floatTab(selectedTabNode.getId()));\n }\n event.stopPropagation();\n };\n const onDoubleClick = (event) => {\n if (node.canMaximize()) {\n layout.maximize(node);\n }\n };\n // Start Render\n const cm = layout.getClassName;\n // tabbar inner can get shifted left via tab rename, this resets scrollleft to 0\n if (tabbarInnerRef.current !== null && tabbarInnerRef.current.scrollLeft !== 0) {\n tabbarInnerRef.current.scrollLeft = 0;\n }\n const selectedTabNode = node.getSelectedNode();\n let style = node._styleWithPosition();\n if (node.getModel().getMaximizedTabset() !== undefined && !node.isMaximized()) {\n (0,_Utils__WEBPACK_IMPORTED_MODULE_8__.hideElement)(style, node.getModel().isUseVisibility());\n }\n const tabs = [];\n if (node.isEnableTabStrip()) {\n for (let i = 0; i < node.getChildren().length; i++) {\n const child = node.getChildren()[i];\n let isSelected = node.getSelected() === i;\n tabs.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(_TabButton__WEBPACK_IMPORTED_MODULE_4__.TabButton, { layout: layout, node: child, path: path + \"/tb\" + i, key: child.getId(), selected: isSelected, iconFactory: iconFactory, titleFactory: titleFactory, icons: icons }));\n if (i < node.getChildren().length - 1) {\n tabs.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"divider\" + i, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_TAB_DIVIDER) }));\n }\n }\n }\n const showHeader = node.getName() !== undefined;\n let stickyButtons = [];\n let buttons = [];\n let headerButtons = [];\n // allow customization of header contents and buttons\n const renderState = { headerContent: node.getName(), stickyButtons, buttons, headerButtons };\n layout.customizeTabSet(node, renderState);\n const headerContent = renderState.headerContent;\n stickyButtons = renderState.stickyButtons;\n buttons = renderState.buttons;\n headerButtons = renderState.headerButtons;\n if (stickyButtons.length > 0) {\n if (tabsTruncated) {\n buttons = [...stickyButtons, ...buttons];\n }\n else {\n tabs.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: stickyButtonsRef, key: \"sticky_buttons_container\", onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown, onDragStart: (e) => { e.preventDefault(); }, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_STICKY_BUTTONS_CONTAINER) }, stickyButtons));\n }\n }\n let toolbar;\n if (hiddenTabs.length > 0) {\n const overflowTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Overflow_Menu_Tooltip);\n let overflowContent;\n if (typeof icons.more === \"function\") {\n overflowContent = icons.more(node, hiddenTabs);\n }\n else {\n overflowContent = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n icons.more,\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_BUTTON_OVERFLOW_COUNT) }, hiddenTabs.length)));\n }\n buttons.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"button\", { key: \"overflowbutton\", \"data-layout-path\": path + \"/button/overflow\", ref: overflowbuttonRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_BUTTON_OVERFLOW), title: overflowTitle, onClick: onOverflowClick, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, overflowContent));\n }\n if (selectedTabNode !== undefined && layout.isSupportsPopout() && selectedTabNode.isEnableFloat() && !selectedTabNode.isFloating()) {\n const floatTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Float_Tab);\n buttons.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"button\", { key: \"float\", \"data-layout-path\": path + \"/button/float\", title: floatTitle, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_FLOAT), onClick: onFloatTab, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, (typeof icons.popout === \"function\") ? icons.popout(selectedTabNode) : icons.popout));\n }\n if (node.canMaximize()) {\n const minTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Restore);\n const maxTitle = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Maximize);\n const btns = showHeader ? headerButtons : buttons;\n btns.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"button\", { key: \"max\", \"data-layout-path\": path + \"/button/max\", title: node.isMaximized() ? minTitle : maxTitle, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_ + (node.isMaximized() ? \"max\" : \"min\")), onClick: onMaximizeToggle, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, node.isMaximized() ?\n (typeof icons.restore === \"function\") ? icons.restore(node) : icons.restore :\n (typeof icons.maximize === \"function\") ? icons.maximize(node) : icons.maximize));\n }\n if (!node.isMaximized() && node.isEnableClose()) {\n const title = layout.i18nName(_I18nLabel__WEBPACK_IMPORTED_MODULE_1__.I18nLabel.Close_Tabset);\n const btns = showHeader ? headerButtons : buttons;\n btns.push(react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"button\", { key: \"close\", \"data-layout-path\": path + \"/button/close\", title: title, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR_BUTTON_CLOSE), onClick: onClose, onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown }, (typeof icons.closeTabset === \"function\") ? icons.closeTabset(node) : icons.closeTabset));\n }\n toolbar = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"toolbar\", ref: toolbarRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR), onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown, onDragStart: (e) => { e.preventDefault(); } }, buttons));\n let header;\n let tabStrip;\n let tabStripClasses = cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_TABBAR_OUTER);\n if (node.getClassNameTabStrip() !== undefined) {\n tabStripClasses += \" \" + node.getClassNameTabStrip();\n }\n tabStripClasses += \" \" + _Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_TABBAR_OUTER_ + node.getTabLocation();\n if (node.isActive() && !showHeader) {\n tabStripClasses += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_SELECTED);\n }\n if (node.isMaximized() && !showHeader) {\n tabStripClasses += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_MAXIMIZED);\n }\n if (showHeader) {\n const headerToolbar = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { key: \"toolbar\", ref: toolbarRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TAB_TOOLBAR), onMouseDown: onInterceptMouseDown, onTouchStart: onInterceptMouseDown, onDragStart: (e) => { e.preventDefault(); } }, headerButtons));\n let tabHeaderClasses = cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_HEADER);\n if (node.isActive()) {\n tabHeaderClasses += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_SELECTED);\n }\n if (node.isMaximized()) {\n tabHeaderClasses += \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_MAXIMIZED);\n }\n if (node.getClassNameHeader() !== undefined) {\n tabHeaderClasses += \" \" + node.getClassNameHeader();\n }\n header = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: tabHeaderClasses, style: { height: node.getHeaderHeight() + \"px\" }, \"data-layout-path\": path + \"/header\", onMouseDown: onMouseDown, onContextMenu: onContextMenu, onClick: onAuxMouseClick, onAuxClick: onAuxMouseClick, onTouchStart: onMouseDown },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_HEADER_CONTENT) }, headerContent),\n headerToolbar));\n }\n const tabStripStyle = { height: node.getTabStripHeight() + \"px\" };\n tabStrip = (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: tabStripClasses, style: tabStripStyle, \"data-layout-path\": path + \"/tabstrip\", onMouseDown: onMouseDown, onContextMenu: onContextMenu, onClick: onAuxMouseClick, onAuxClick: onAuxMouseClick, onTouchStart: onMouseDown },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: tabbarInnerRef, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER_ + node.getTabLocation()) },\n react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { style: { left: position }, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER) + \" \" + cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_TABBAR_INNER_TAB_CONTAINER_ + node.getTabLocation()) }, tabs)),\n toolbar));\n style = layout.styleFont(style);\n var placeHolder = undefined;\n if (node.getChildren().length === 0) {\n const placeHolderCallback = layout.getTabSetPlaceHolderCallback();\n if (placeHolderCallback) {\n placeHolder = placeHolderCallback(node);\n }\n }\n const center = react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET_CONTENT) }, placeHolder);\n var content;\n if (node.getTabLocation() === \"top\") {\n content = react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n header,\n tabStrip,\n center);\n }\n else {\n content = react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null,\n header,\n center,\n tabStrip);\n }\n return (react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"div\", { ref: selfRef, dir: \"ltr\", \"data-layout-path\": path, style: style, className: cm(_Types__WEBPACK_IMPORTED_MODULE_7__.CLASSES.FLEXLAYOUT__TABSET), onWheel: onMouseWheel }, content));\n};\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/TabSet.tsx?");
|
|
570
470
|
|
|
571
471
|
/***/ }),
|
|
572
472
|
|
|
@@ -574,9 +474,9 @@ eval("\nvar __spreadArray = (this && this.__spreadArray) || function (to, from,
|
|
|
574
474
|
/*!****************************!*\
|
|
575
475
|
!*** ./src/view/Utils.tsx ***!
|
|
576
476
|
\****************************/
|
|
577
|
-
/***/ ((__unused_webpack_module,
|
|
477
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
578
478
|
|
|
579
|
-
eval("
|
|
479
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"getRenderStateEx\": () => (/* binding */ getRenderStateEx),\n/* harmony export */ \"hideElement\": () => (/* binding */ hideElement),\n/* harmony export */ \"isAuxMouseEvent\": () => (/* binding */ isAuxMouseEvent)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"react\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n\n/** @internal */\nfunction getRenderStateEx(layout, node, iconFactory, titleFactory) {\n let leadingContent = iconFactory ? iconFactory(node) : undefined;\n let titleContent = node.getName();\n let name = node.getName();\n function isTitleObject(obj) {\n return obj.titleContent !== undefined;\n }\n if (titleFactory !== undefined) {\n const titleObj = titleFactory(node);\n if (titleObj !== undefined) {\n if (typeof titleObj === \"string\") {\n titleContent = titleObj;\n name = titleObj;\n }\n else if (isTitleObject(titleObj)) {\n titleContent = titleObj.titleContent;\n name = titleObj.name;\n }\n else {\n titleContent = titleObj;\n }\n }\n }\n if (leadingContent === undefined && node.getIcon() !== undefined) {\n leadingContent = react__WEBPACK_IMPORTED_MODULE_0__.createElement(\"img\", { style: { width: \"1em\", height: \"1em\" }, src: node.getIcon(), alt: \"leadingContent\" });\n }\n let buttons = [];\n // allow customization of leading contents (icon) and contents\n const renderState = { leading: leadingContent, content: titleContent, name, buttons };\n layout.customizeTab(node, renderState);\n node._setRenderedName(renderState.name);\n return renderState;\n}\n/** @internal */\nfunction hideElement(style, useVisibility) {\n if (useVisibility) {\n style.visibility = \"hidden\";\n }\n else {\n style.display = \"none\";\n }\n}\n/** @internal */\nfunction isAuxMouseEvent(event) {\n let auxEvent = false;\n if (event.nativeEvent instanceof MouseEvent) {\n if (event.nativeEvent.button !== 0 || event.ctrlKey || event.altKey || event.metaKey || event.shiftKey) {\n auxEvent = true;\n }\n }\n return auxEvent;\n}\n\n\n//# sourceURL=webpack://FlexLayout/./src/view/Utils.tsx?");
|
|
580
480
|
|
|
581
481
|
/***/ }),
|
|
582
482
|
|
|
@@ -620,13 +520,25 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_react_dom__;
|
|
|
620
520
|
/******/ };
|
|
621
521
|
/******/
|
|
622
522
|
/******/ // Execute the module function
|
|
623
|
-
/******/ __webpack_modules__[moduleId]
|
|
523
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
624
524
|
/******/
|
|
625
525
|
/******/ // Return the exports of the module
|
|
626
526
|
/******/ return module.exports;
|
|
627
527
|
/******/ }
|
|
628
528
|
/******/
|
|
629
529
|
/************************************************************************/
|
|
530
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
531
|
+
/******/ (() => {
|
|
532
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
533
|
+
/******/ __webpack_require__.n = (module) => {
|
|
534
|
+
/******/ var getter = module && module.__esModule ?
|
|
535
|
+
/******/ () => (module['default']) :
|
|
536
|
+
/******/ () => (module);
|
|
537
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
538
|
+
/******/ return getter;
|
|
539
|
+
/******/ };
|
|
540
|
+
/******/ })();
|
|
541
|
+
/******/
|
|
630
542
|
/******/ /* webpack/runtime/define property getters */
|
|
631
543
|
/******/ (() => {
|
|
632
544
|
/******/ // define getter functions for harmony exports
|
|
@@ -659,7 +571,7 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_react_dom__;
|
|
|
659
571
|
/******/
|
|
660
572
|
/******/ // startup
|
|
661
573
|
/******/ // Load entry module and return exports
|
|
662
|
-
/******/ // This entry module
|
|
574
|
+
/******/ // This entry module can't be inlined because the eval devtool is used.
|
|
663
575
|
/******/ var __webpack_exports__ = __webpack_require__("./src/index.ts");
|
|
664
576
|
/******/
|
|
665
577
|
/******/ return __webpack_exports__;
|