@ninebone/util 1.0.18 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nine-util.js +34 -21
- package/dist/nine-util.js.map +1 -1
- package/dist/nine-util.umd.js +1 -1
- package/dist/nine-util.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-util.js
CHANGED
|
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
9
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
10
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
11
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
12
|
-
var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _detectMode, _startDrag, _init2, _prepareLayout;
|
|
12
|
+
var _name, _color, _Trace_instances, isTraceEnabled_fn, _a, _timer, _queue, _delay, _TaskDebouncer_instances, flush_fn, _request, _shift, _dialog, _init, _onMouseDown, _onTouchStart, _NineUxUtil_instances, prepare_fn, _mode, _isSiblingOnly, _detectMode, _startDrag, _init2, _prepareLayout;
|
|
13
13
|
import React from "react";
|
|
14
14
|
import { createRoot } from "react-dom/client";
|
|
15
15
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -1130,6 +1130,11 @@ class UxSplitter extends HTMLElement {
|
|
|
1130
1130
|
constructor() {
|
|
1131
1131
|
super();
|
|
1132
1132
|
__privateAdd(this, _mode);
|
|
1133
|
+
__privateAdd(this, _isSiblingOnly, () => {
|
|
1134
|
+
const attr = this.getAttribute("only-sibling");
|
|
1135
|
+
if (attr === null) return false;
|
|
1136
|
+
return attr.toLowerCase() === "false" ? false : true;
|
|
1137
|
+
});
|
|
1133
1138
|
__privateAdd(this, _detectMode, (el) => {
|
|
1134
1139
|
const prev = el.previousElementSibling;
|
|
1135
1140
|
const next = el.nextElementSibling;
|
|
@@ -1247,25 +1252,32 @@ class UxSplitter extends HTMLElement {
|
|
|
1247
1252
|
trace$1.log(`[Debug] Panel[${index}] (${isChartPanel ? "Canvas" : "Normal"}): Current=${currentSize.toFixed(2)}, New=${(panel === prev ? newPrevSize : panel === next ? newNextSize : initialSizes[index]).toFixed(2)}`);
|
|
1248
1253
|
});
|
|
1249
1254
|
trace$1.log(`[Debug] ---------------------------`);
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
if (
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
newSize = newNextSize;
|
|
1257
|
-
} else {
|
|
1258
|
-
newSize = initialSizes[index];
|
|
1255
|
+
if (__privateGet(this, _isSiblingOnly).call(this)) {
|
|
1256
|
+
const prev2 = this.previousElementSibling;
|
|
1257
|
+
const next2 = this.nextElementSibling;
|
|
1258
|
+
if (prev2 && next2) {
|
|
1259
|
+
prev2.style.flex = `0 0 ${newPrevSize}px`;
|
|
1260
|
+
next2.style.flex = `0 0 ${newNextSize}px`;
|
|
1259
1261
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
panel
|
|
1264
|
-
|
|
1265
|
-
panel
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1262
|
+
} else {
|
|
1263
|
+
allPanels.forEach((panel, index) => {
|
|
1264
|
+
let newSize;
|
|
1265
|
+
if (panel === prev) {
|
|
1266
|
+
newSize = newPrevSize;
|
|
1267
|
+
} else if (panel === next) {
|
|
1268
|
+
newSize = newNextSize;
|
|
1269
|
+
} else {
|
|
1270
|
+
newSize = initialSizes[index];
|
|
1271
|
+
}
|
|
1272
|
+
const newFlexBasis = newSize / totalFlexSpace;
|
|
1273
|
+
trace$1.log(panel);
|
|
1274
|
+
if (panel.classList.contains("sidebar")) {
|
|
1275
|
+
panel.style.flex = `0 0 ${newSize}px`;
|
|
1276
|
+
} else {
|
|
1277
|
+
panel.style.flex = `${newFlexBasis} ${newFlexBasis} 0`;
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1269
1281
|
trace$1.log(`dragOffset: ${dragOffset}`);
|
|
1270
1282
|
trace$1.log(`Calculated FlexSum: ${flexSum}`);
|
|
1271
1283
|
};
|
|
@@ -1282,7 +1294,7 @@ class UxSplitter extends HTMLElement {
|
|
|
1282
1294
|
const htmlTmpl = document.createElement("template");
|
|
1283
1295
|
htmlTmpl.innerHTML = `
|
|
1284
1296
|
<style>
|
|
1285
|
-
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"1.0.
|
|
1297
|
+
@import "https://cdn.jsdelivr.net/npm/@ninebone/util@${"1.0.20"}/dist/css/nine-util.css";
|
|
1286
1298
|
${customImport}
|
|
1287
1299
|
</style>
|
|
1288
1300
|
${gripTmpl}
|
|
@@ -1322,6 +1334,7 @@ class UxSplitter extends HTMLElement {
|
|
|
1322
1334
|
}
|
|
1323
1335
|
}
|
|
1324
1336
|
_mode = new WeakMap();
|
|
1337
|
+
_isSiblingOnly = new WeakMap();
|
|
1325
1338
|
_detectMode = new WeakMap();
|
|
1326
1339
|
_startDrag = new WeakMap();
|
|
1327
1340
|
_init2 = new WeakMap();
|
|
@@ -1688,7 +1701,7 @@ const TreeUtil = {
|
|
|
1688
1701
|
};
|
|
1689
1702
|
sortNodes(roots);
|
|
1690
1703
|
const result = [];
|
|
1691
|
-
const flatten = (nodes, currentLevel =
|
|
1704
|
+
const flatten = (nodes, currentLevel = 1) => {
|
|
1692
1705
|
nodes.forEach((node) => {
|
|
1693
1706
|
node[level] = currentLevel;
|
|
1694
1707
|
const { children, ...item } = node;
|