wunderbaum 0.8.4 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wunderbaum.css +4 -1
- package/dist/wunderbaum.css.map +1 -1
- package/dist/wunderbaum.d.ts +92 -97
- package/dist/wunderbaum.esm.js +165 -133
- package/dist/wunderbaum.esm.min.js +32 -32
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +165 -133
- package/dist/wunderbaum.umd.min.js +34 -34
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/common.ts +1 -1
- package/src/debounce.ts +7 -12
- package/src/deferred.ts +1 -1
- package/src/drag_observer.ts +1 -1
- package/src/types.ts +31 -55
- package/src/util.ts +4 -4
- package/src/wb_ext_dnd.ts +1 -1
- package/src/wb_ext_edit.ts +1 -1
- package/src/wb_ext_filter.ts +66 -45
- package/src/wb_ext_grid.ts +1 -1
- package/src/wb_ext_keynav.ts +1 -1
- package/src/wb_ext_logger.ts +1 -1
- package/src/wb_extension_base.ts +1 -1
- package/src/wb_node.ts +14 -8
- package/src/wb_options.ts +1 -1
- package/src/wunderbaum.scss +7 -1
- package/src/wunderbaum.ts +25 -6
package/dist/wunderbaum.umd.js
CHANGED
|
@@ -82,13 +82,7 @@
|
|
|
82
82
|
* @param {number} [wait=0]
|
|
83
83
|
* The number of milliseconds to delay; if omitted, `requestAnimationFrame` is
|
|
84
84
|
* used (if available).
|
|
85
|
-
* @param
|
|
86
|
-
* @param {boolean} [options.leading=false]
|
|
87
|
-
* Specify invoking on the leading edge of the timeout.
|
|
88
|
-
* @param {number} [options.maxWait]
|
|
89
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
90
|
-
* @param {boolean} [options.trailing=true]
|
|
91
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
85
|
+
* @param [options={}] The options object.
|
|
92
86
|
* @returns {Function} Returns the new debounced function.
|
|
93
87
|
* @example
|
|
94
88
|
*
|
|
@@ -266,11 +260,7 @@
|
|
|
266
260
|
* @param {number} [wait=0]
|
|
267
261
|
* The number of milliseconds to throttle invocations to; if omitted,
|
|
268
262
|
* `requestAnimationFrame` is used (if available).
|
|
269
|
-
* @param
|
|
270
|
-
* @param {boolean} [options.leading=true]
|
|
271
|
-
* Specify invoking on the leading edge of the timeout.
|
|
272
|
-
* @param {boolean} [options.trailing=true]
|
|
273
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
263
|
+
* @param [options={}] The options object.
|
|
274
264
|
* @returns {Function} Returns the new throttled function.
|
|
275
265
|
* @example
|
|
276
266
|
*
|
|
@@ -303,8 +293,8 @@
|
|
|
303
293
|
|
|
304
294
|
/*!
|
|
305
295
|
* Wunderbaum - util
|
|
306
|
-
* Copyright (c) 2021-
|
|
307
|
-
* v0.
|
|
296
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
297
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
308
298
|
*/
|
|
309
299
|
/** @module util */
|
|
310
300
|
/** Readable names for `MouseEvent.button` */
|
|
@@ -427,7 +417,7 @@
|
|
|
427
417
|
* Iterate over Object properties or array elements.
|
|
428
418
|
*
|
|
429
419
|
* @param obj `Object`, `Array` or null
|
|
430
|
-
* @param callback
|
|
420
|
+
* @param callback called for every item.
|
|
431
421
|
* `this` also contains the item.
|
|
432
422
|
* Return `false` to stop the iteration.
|
|
433
423
|
*/
|
|
@@ -1101,8 +1091,8 @@
|
|
|
1101
1091
|
|
|
1102
1092
|
/*!
|
|
1103
1093
|
* Wunderbaum - types
|
|
1104
|
-
* Copyright (c) 2021-
|
|
1105
|
-
* v0.
|
|
1094
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1095
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
1106
1096
|
*/
|
|
1107
1097
|
/**
|
|
1108
1098
|
* Possible values for {@link WunderbaumNode.update()} and {@link Wunderbaum.update()}.
|
|
@@ -1165,8 +1155,8 @@
|
|
|
1165
1155
|
|
|
1166
1156
|
/*!
|
|
1167
1157
|
* Wunderbaum - wb_extension_base
|
|
1168
|
-
* Copyright (c) 2021-
|
|
1169
|
-
* v0.
|
|
1158
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1159
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
1170
1160
|
*/
|
|
1171
1161
|
class WunderbaumExtension {
|
|
1172
1162
|
constructor(tree, id, defaults) {
|
|
@@ -1224,8 +1214,8 @@
|
|
|
1224
1214
|
|
|
1225
1215
|
/*!
|
|
1226
1216
|
* Wunderbaum - ext-filter
|
|
1227
|
-
* Copyright (c) 2021-
|
|
1228
|
-
* v0.
|
|
1217
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1218
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
1229
1219
|
*/
|
|
1230
1220
|
const START_MARKER = "\uFFF7";
|
|
1231
1221
|
const END_MARKER = "\uFFF8";
|
|
@@ -1234,16 +1224,15 @@
|
|
|
1234
1224
|
class FilterExtension extends WunderbaumExtension {
|
|
1235
1225
|
constructor(tree) {
|
|
1236
1226
|
super(tree, "filter", {
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
fuzzy: false,
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
mode: "dim",
|
|
1227
|
+
autoApply: true, // Re-apply last filter if lazy data is loaded
|
|
1228
|
+
autoExpand: false, // Expand all branches that contain matches while filtered
|
|
1229
|
+
matchBranch: false, // Whether to implicitly match all children of matched nodes
|
|
1230
|
+
connectInput: null, // Element or selector of an input control for filter query strings
|
|
1231
|
+
fuzzy: false, // Match single characters in order, e.g. 'fb' will match 'FooBar'
|
|
1232
|
+
hideExpanders: false, // Hide expanders if all child nodes are hidden by filter
|
|
1233
|
+
highlight: true, // Highlight matches by wrapping inside <mark> tags
|
|
1234
|
+
leavesOnly: false, // Match end nodes only
|
|
1235
|
+
mode: "dim", // Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
|
|
1247
1236
|
noData: true, // Display a 'no data' status node if result is empty
|
|
1248
1237
|
});
|
|
1249
1238
|
this.lastFilterArgs = null;
|
|
@@ -1269,33 +1258,38 @@
|
|
|
1269
1258
|
break;
|
|
1270
1259
|
}
|
|
1271
1260
|
}
|
|
1272
|
-
_applyFilterNoUpdate(filter,
|
|
1261
|
+
_applyFilterNoUpdate(filter, _opts) {
|
|
1273
1262
|
return this.tree.runWithDeferredUpdate(() => {
|
|
1274
|
-
return this._applyFilterImpl(filter,
|
|
1263
|
+
return this._applyFilterImpl(filter, _opts);
|
|
1275
1264
|
});
|
|
1276
1265
|
}
|
|
1277
|
-
_applyFilterImpl(filter,
|
|
1278
|
-
let
|
|
1266
|
+
_applyFilterImpl(filter, _opts) {
|
|
1267
|
+
let //temp,
|
|
1268
|
+
count = 0;
|
|
1279
1269
|
const start = Date.now();
|
|
1280
1270
|
const tree = this.tree;
|
|
1281
1271
|
const treeOpts = tree.options;
|
|
1282
|
-
// escapeTitles = treeOpts.escapeTitles,
|
|
1283
1272
|
const prevAutoCollapse = treeOpts.autoCollapse;
|
|
1273
|
+
// Use default options from `tree.options.filter`, but allow to override them
|
|
1284
1274
|
const opts = extend({}, treeOpts.filter, _opts);
|
|
1285
1275
|
const hideMode = opts.mode === "hide";
|
|
1286
|
-
const
|
|
1276
|
+
const matchBranch = !!opts.matchBranch;
|
|
1277
|
+
const leavesOnly = !!opts.leavesOnly && !matchBranch;
|
|
1278
|
+
let filterRegExp;
|
|
1279
|
+
let highlightRegExp;
|
|
1287
1280
|
// Default to 'match title substring (case insensitive)'
|
|
1288
|
-
if (typeof filter === "string") {
|
|
1281
|
+
if (typeof filter === "string" || filter instanceof RegExp) {
|
|
1289
1282
|
if (filter === "") {
|
|
1290
1283
|
tree.logInfo("Passing an empty string as a filter is handled as clearFilter().");
|
|
1291
1284
|
this.clearFilter();
|
|
1292
|
-
return;
|
|
1285
|
+
return 0;
|
|
1293
1286
|
}
|
|
1294
1287
|
if (opts.fuzzy) {
|
|
1288
|
+
assert(typeof filter === "string", "fuzzy filter must be a string");
|
|
1295
1289
|
// See https://codereview.stackexchange.com/questions/23899/faster-javascript-fuzzy-string-matching-function/23905#23905
|
|
1296
1290
|
// and http://www.quora.com/How-is-the-fuzzy-search-algorithm-in-Sublime-Text-designed
|
|
1297
1291
|
// and http://www.dustindiaz.com/autocomplete-fuzzy-matching
|
|
1298
|
-
|
|
1292
|
+
const matchReString = filter
|
|
1299
1293
|
.split("")
|
|
1300
1294
|
// Escaping the `filter` will not work because,
|
|
1301
1295
|
// it gets further split into individual characters. So,
|
|
@@ -1306,12 +1300,21 @@
|
|
|
1306
1300
|
// the character
|
|
1307
1301
|
return a + "([^" + b + "]*)" + b;
|
|
1308
1302
|
}, "");
|
|
1303
|
+
filterRegExp = new RegExp(matchReString, "i");
|
|
1304
|
+
// highlightRegExp = new RegExp(escapeRegex(filter), "gi");
|
|
1305
|
+
}
|
|
1306
|
+
else if (filter instanceof RegExp) {
|
|
1307
|
+
filterRegExp = filter;
|
|
1308
|
+
highlightRegExp = filter;
|
|
1309
1309
|
}
|
|
1310
1310
|
else {
|
|
1311
|
-
|
|
1311
|
+
const matchReString = escapeRegex(filter); // make sure a '.' is treated literally
|
|
1312
|
+
filterRegExp = new RegExp(matchReString, "i");
|
|
1313
|
+
highlightRegExp = new RegExp(matchReString, "gi");
|
|
1312
1314
|
}
|
|
1313
|
-
|
|
1314
|
-
const
|
|
1315
|
+
tree.logDebug(`Filtering nodes by '${filterRegExp}'`);
|
|
1316
|
+
// const re = new RegExp(match, "i");
|
|
1317
|
+
// const reHighlight = new RegExp(escapeRegex(filter), "gi");
|
|
1315
1318
|
filter = (node) => {
|
|
1316
1319
|
if (!node.title) {
|
|
1317
1320
|
return false;
|
|
@@ -1319,34 +1322,25 @@
|
|
|
1319
1322
|
// let text = escapeTitles ? node.title : extractHtmlText(node.title);
|
|
1320
1323
|
const text = node.title;
|
|
1321
1324
|
// `.match` instead of `.test` to get the capture groups
|
|
1322
|
-
const res = text.match(
|
|
1325
|
+
// const res = text.match(filterRegExp);
|
|
1326
|
+
const res = filterRegExp.exec(text);
|
|
1323
1327
|
if (res && opts.highlight) {
|
|
1324
|
-
|
|
1328
|
+
let highlightString;
|
|
1325
1329
|
if (opts.fuzzy) {
|
|
1326
|
-
|
|
1330
|
+
highlightString = _markFuzzyMatchedChars(text, res, true);
|
|
1327
1331
|
}
|
|
1328
1332
|
else {
|
|
1329
1333
|
// #740: we must not apply the marks to escaped entity names, e.g. `"`
|
|
1330
1334
|
// Use some exotic characters to mark matches:
|
|
1331
|
-
|
|
1335
|
+
highlightString = text.replace(highlightRegExp, function (s) {
|
|
1332
1336
|
return START_MARKER + s + END_MARKER;
|
|
1333
1337
|
});
|
|
1334
1338
|
}
|
|
1335
1339
|
// now we can escape the title...
|
|
1336
|
-
node.titleWithHighlight = escapeHtml(
|
|
1340
|
+
node.titleWithHighlight = escapeHtml(highlightString)
|
|
1337
1341
|
// ... and finally insert the desired `<mark>` tags
|
|
1338
1342
|
.replace(RE_START_MARKER, "<mark>")
|
|
1339
1343
|
.replace(RE_END_MARTKER, "</mark>");
|
|
1340
|
-
// } else {
|
|
1341
|
-
// if (opts.fuzzy) {
|
|
1342
|
-
// node.titleWithHighlight = _markFuzzyMatchedChars(text, res);
|
|
1343
|
-
// } else {
|
|
1344
|
-
// node.titleWithHighlight = text.replace(reHighlight, function (s) {
|
|
1345
|
-
// return "<mark>" + s + "</mark>";
|
|
1346
|
-
// });
|
|
1347
|
-
// }
|
|
1348
|
-
// }
|
|
1349
|
-
// node.debug("filter", escapeTitles, text, node.titleWithHighlight);
|
|
1350
1344
|
}
|
|
1351
1345
|
return !!res;
|
|
1352
1346
|
};
|
|
@@ -1383,7 +1377,7 @@
|
|
|
1383
1377
|
return "skip";
|
|
1384
1378
|
}
|
|
1385
1379
|
let matchedByBranch = false;
|
|
1386
|
-
if ((
|
|
1380
|
+
if ((matchBranch || res === "branch") && node.parent.match) {
|
|
1387
1381
|
res = true;
|
|
1388
1382
|
matchedByBranch = true;
|
|
1389
1383
|
}
|
|
@@ -1415,20 +1409,35 @@
|
|
|
1415
1409
|
}
|
|
1416
1410
|
}
|
|
1417
1411
|
// Redraw whole tree
|
|
1418
|
-
tree.
|
|
1412
|
+
tree.logDebug(`Filter '${filter}' found ${count} nodes in ${Date.now() - start} ms.`);
|
|
1419
1413
|
return count;
|
|
1420
1414
|
}
|
|
1421
1415
|
/**
|
|
1422
1416
|
* [ext-filter] Dim or hide nodes.
|
|
1423
1417
|
*/
|
|
1424
1418
|
filterNodes(filter, options) {
|
|
1425
|
-
return this._applyFilterNoUpdate(filter,
|
|
1419
|
+
return this._applyFilterNoUpdate(filter, options);
|
|
1426
1420
|
}
|
|
1427
1421
|
/**
|
|
1428
1422
|
* [ext-filter] Dim or hide whole branches.
|
|
1423
|
+
* @deprecated Use {@link filterNodes} instead and set `options.matchBranch: true`.
|
|
1429
1424
|
*/
|
|
1430
1425
|
filterBranches(filter, options) {
|
|
1431
|
-
|
|
1426
|
+
assert(options.matchBranch === undefined, "filterBranches() is deprecated.");
|
|
1427
|
+
options.matchBranch = true;
|
|
1428
|
+
return this._applyFilterNoUpdate(filter, options);
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* [ext-filter] Return the number of matched nodes.
|
|
1432
|
+
*/
|
|
1433
|
+
countMatches() {
|
|
1434
|
+
let n = 0;
|
|
1435
|
+
this.tree.visit((node) => {
|
|
1436
|
+
if (node.match && !node.statusNodeType) {
|
|
1437
|
+
n++;
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
return n;
|
|
1432
1441
|
}
|
|
1433
1442
|
/**
|
|
1434
1443
|
* [ext-filter] Re-apply current filter.
|
|
@@ -1529,8 +1538,8 @@
|
|
|
1529
1538
|
|
|
1530
1539
|
/*!
|
|
1531
1540
|
* Wunderbaum - ext-keynav
|
|
1532
|
-
* Copyright (c) 2021-
|
|
1533
|
-
* v0.
|
|
1541
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1542
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
1534
1543
|
*/
|
|
1535
1544
|
const QUICKSEARCH_DELAY = 500;
|
|
1536
1545
|
class KeynavExtension extends WunderbaumExtension {
|
|
@@ -1893,8 +1902,8 @@
|
|
|
1893
1902
|
|
|
1894
1903
|
/*!
|
|
1895
1904
|
* Wunderbaum - ext-logger
|
|
1896
|
-
* Copyright (c) 2021-
|
|
1897
|
-
* v0.
|
|
1905
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1906
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
1898
1907
|
*/
|
|
1899
1908
|
class LoggerExtension extends WunderbaumExtension {
|
|
1900
1909
|
constructor(tree) {
|
|
@@ -1935,8 +1944,8 @@
|
|
|
1935
1944
|
|
|
1936
1945
|
/*!
|
|
1937
1946
|
* Wunderbaum - common
|
|
1938
|
-
* Copyright (c) 2021-
|
|
1939
|
-
* v0.
|
|
1947
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1948
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
1940
1949
|
*/
|
|
1941
1950
|
const DEFAULT_DEBUGLEVEL = 3; // Replaced by rollup script
|
|
1942
1951
|
/**
|
|
@@ -2011,12 +2020,12 @@
|
|
|
2011
2020
|
};
|
|
2012
2021
|
/** Dict keys that are evaluated by source loader (others are added to `tree.data` instead). */
|
|
2013
2022
|
const RESERVED_TREE_SOURCE_KEYS = new Set([
|
|
2014
|
-
"_format",
|
|
2015
|
-
"_keyMap",
|
|
2016
|
-
"_positional",
|
|
2017
|
-
"_typeList",
|
|
2018
|
-
"_valueMap",
|
|
2019
|
-
"_version",
|
|
2023
|
+
"_format", // reserved for future use
|
|
2024
|
+
"_keyMap", // Used for compressed data format
|
|
2025
|
+
"_positional", // Used for compressed data format
|
|
2026
|
+
"_typeList", // Used for compressed data format @deprecated
|
|
2027
|
+
"_valueMap", // Used for compressed data format
|
|
2028
|
+
"_version", // reserved for future use
|
|
2020
2029
|
"children",
|
|
2021
2030
|
"columns",
|
|
2022
2031
|
"types",
|
|
@@ -2044,8 +2053,8 @@
|
|
|
2044
2053
|
Home: "firstCol",
|
|
2045
2054
|
"Control+End": "last",
|
|
2046
2055
|
"Control+Home": "first",
|
|
2047
|
-
"Meta+ArrowDown": "last",
|
|
2048
|
-
"Meta+ArrowUp": "first",
|
|
2056
|
+
"Meta+ArrowDown": "last", // macOs
|
|
2057
|
+
"Meta+ArrowUp": "first", // macOs
|
|
2049
2058
|
"*": "expandAll",
|
|
2050
2059
|
Multiply: "expandAll",
|
|
2051
2060
|
PageDown: "pageDown",
|
|
@@ -2258,44 +2267,44 @@
|
|
|
2258
2267
|
|
|
2259
2268
|
/*!
|
|
2260
2269
|
* Wunderbaum - ext-dnd
|
|
2261
|
-
* Copyright (c) 2021-
|
|
2262
|
-
* v0.
|
|
2270
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2271
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
2263
2272
|
*/
|
|
2264
2273
|
const nodeMimeType = "application/x-wunderbaum-node";
|
|
2265
2274
|
class DndExtension extends WunderbaumExtension {
|
|
2266
2275
|
constructor(tree) {
|
|
2267
2276
|
super(tree, "dnd", {
|
|
2268
|
-
autoExpandMS: 1500,
|
|
2277
|
+
autoExpandMS: 1500, // Expand nodes after n milliseconds of hovering
|
|
2269
2278
|
// dropMarkerInsertOffsetX: -16, // Additional offset for drop-marker with hitMode = "before"/"after"
|
|
2270
2279
|
// dropMarkerOffsetX: -24, // Absolute position offset for .fancytree-drop-marker relatively to ..fancytree-title (icon/img near a node accepting drop)
|
|
2271
2280
|
// #1021 `document.body` is not available yet
|
|
2272
2281
|
// dropMarkerParent: "body", // Root Container used for drop marker (could be a shadow root)
|
|
2273
|
-
multiSource: false,
|
|
2274
|
-
effectAllowed: "all",
|
|
2275
|
-
dropEffectDefault: "move",
|
|
2276
|
-
guessDropEffect: true,
|
|
2277
|
-
preventForeignNodes: false,
|
|
2278
|
-
preventLazyParents: true,
|
|
2279
|
-
preventNonNodes: false,
|
|
2280
|
-
preventRecursion: true,
|
|
2281
|
-
preventSameParent: false,
|
|
2282
|
-
preventVoidMoves: true,
|
|
2283
|
-
serializeClipboardData: true,
|
|
2284
|
-
scroll: true,
|
|
2285
|
-
scrollSensitivity: 20,
|
|
2282
|
+
multiSource: false, // true: Drag multiple (i.e. selected) nodes. Also a callback() is allowed
|
|
2283
|
+
effectAllowed: "all", // Restrict the possible cursor shapes and modifier operations (can also be set in the dragStart event)
|
|
2284
|
+
dropEffectDefault: "move", // Default dropEffect ('copy', 'link', or 'move') when no modifier is pressed (override in drag, dragOver).
|
|
2285
|
+
guessDropEffect: true, // Calculate from `effectAllowed` and modifier keys)
|
|
2286
|
+
preventForeignNodes: false, // Prevent dropping nodes from different Wunderbaum trees
|
|
2287
|
+
preventLazyParents: true, // Prevent dropping items on unloaded lazy Wunderbaum tree nodes
|
|
2288
|
+
preventNonNodes: false, // Prevent dropping items other than Wunderbaum tree nodes
|
|
2289
|
+
preventRecursion: true, // Prevent dropping nodes on own descendants
|
|
2290
|
+
preventSameParent: false, // Prevent dropping nodes under same direct parent
|
|
2291
|
+
preventVoidMoves: true, // Prevent dropping nodes 'before self', etc. (move only)
|
|
2292
|
+
serializeClipboardData: true, // Serialize node data to dataTransfer object
|
|
2293
|
+
scroll: true, // Enable auto-scrolling while dragging
|
|
2294
|
+
scrollSensitivity: 20, // Active top/bottom margin in pixel
|
|
2286
2295
|
// scrollnterval: 50, // Generate event every 50 ms
|
|
2287
|
-
scrollSpeed: 5,
|
|
2296
|
+
scrollSpeed: 5, // Scroll pixel per 50 ms
|
|
2288
2297
|
// setTextTypeJson: false, // Allow dragging of nodes to different IE windows
|
|
2289
|
-
sourceCopyHook: null,
|
|
2298
|
+
sourceCopyHook: null, // Optional callback passed to `toDict` on dragStart @since 2.38
|
|
2290
2299
|
// Events (drag support)
|
|
2291
|
-
dragStart: null,
|
|
2292
|
-
drag: null,
|
|
2293
|
-
dragEnd: null,
|
|
2300
|
+
dragStart: null, // Callback(sourceNode, data), return true, to enable dnd drag
|
|
2301
|
+
drag: null, // Callback(sourceNode, data)
|
|
2302
|
+
dragEnd: null, // Callback(sourceNode, data)
|
|
2294
2303
|
// Events (drop support)
|
|
2295
|
-
dragEnter: null,
|
|
2296
|
-
dragOver: null,
|
|
2297
|
-
dragExpand: null,
|
|
2298
|
-
drop: null,
|
|
2304
|
+
dragEnter: null, // Callback(targetNode, data), return true, to enable dnd drop
|
|
2305
|
+
dragOver: null, // Callback(targetNode, data)
|
|
2306
|
+
dragExpand: null, // Callback(targetNode, data), return false to prevent autoExpand
|
|
2307
|
+
drop: null, // Callback(targetNode, data)
|
|
2299
2308
|
dragLeave: null, // Callback(targetNode, data)
|
|
2300
2309
|
});
|
|
2301
2310
|
// public dropMarkerElem?: HTMLElement;
|
|
@@ -2703,8 +2712,8 @@
|
|
|
2703
2712
|
|
|
2704
2713
|
/*!
|
|
2705
2714
|
* Wunderbaum - drag_observer
|
|
2706
|
-
* Copyright (c) 2021-
|
|
2707
|
-
* v0.
|
|
2715
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2716
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
2708
2717
|
*/
|
|
2709
2718
|
/**
|
|
2710
2719
|
* Convert mouse- and touch events to 'dragstart', 'drag', and 'dragstop'.
|
|
@@ -2839,8 +2848,8 @@
|
|
|
2839
2848
|
|
|
2840
2849
|
/*!
|
|
2841
2850
|
* Wunderbaum - ext-grid
|
|
2842
|
-
* Copyright (c) 2021-
|
|
2843
|
-
* v0.
|
|
2851
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2852
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
2844
2853
|
*/
|
|
2845
2854
|
class GridExtension extends WunderbaumExtension {
|
|
2846
2855
|
constructor(tree) {
|
|
@@ -2876,8 +2885,8 @@
|
|
|
2876
2885
|
|
|
2877
2886
|
/*!
|
|
2878
2887
|
* Wunderbaum - deferred
|
|
2879
|
-
* Copyright (c) 2021-
|
|
2880
|
-
* v0.
|
|
2888
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2889
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
2881
2890
|
*/
|
|
2882
2891
|
/**
|
|
2883
2892
|
* Implement a ES6 Promise, that exposes a resolve() and reject() method.
|
|
@@ -2929,8 +2938,8 @@
|
|
|
2929
2938
|
|
|
2930
2939
|
/*!
|
|
2931
2940
|
* Wunderbaum - wunderbaum_node
|
|
2932
|
-
* Copyright (c) 2021-
|
|
2933
|
-
* v0.
|
|
2941
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2942
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
2934
2943
|
*/
|
|
2935
2944
|
/** WunderbaumNode properties that can be passed with source data.
|
|
2936
2945
|
* (Any other source properties will be stored as `node.data.PROP`.)
|
|
@@ -3242,7 +3251,7 @@
|
|
|
3242
3251
|
const minExpandLevel = this.tree.options.minExpandLevel;
|
|
3243
3252
|
const { depth = 99, loadLazy, force, keepActiveNodeVisible = true, } = options !== null && options !== void 0 ? options : {};
|
|
3244
3253
|
const expandOpts = {
|
|
3245
|
-
scrollIntoView: false,
|
|
3254
|
+
scrollIntoView: false, // don't scroll very node on iteration
|
|
3246
3255
|
force: force,
|
|
3247
3256
|
loadLazy: loadLazy,
|
|
3248
3257
|
};
|
|
@@ -3510,7 +3519,7 @@
|
|
|
3510
3519
|
}
|
|
3511
3520
|
/** Return a string representing the hierachical node path, e.g. "a/b/c".
|
|
3512
3521
|
* @param includeSelf
|
|
3513
|
-
* @param
|
|
3522
|
+
* @param part property name or callback
|
|
3514
3523
|
* @param separator
|
|
3515
3524
|
*/
|
|
3516
3525
|
getPath(includeSelf = true, part = "title", separator = "/") {
|
|
@@ -3560,6 +3569,10 @@
|
|
|
3560
3569
|
hasClass(className) {
|
|
3561
3570
|
return this.classes ? this.classes.has(className) : false;
|
|
3562
3571
|
}
|
|
3572
|
+
/** Return true if node ist the currently focused node. */
|
|
3573
|
+
hasFocus() {
|
|
3574
|
+
return this.tree.focusNode === this;
|
|
3575
|
+
}
|
|
3563
3576
|
/** Return true if this node is the currently active tree node. */
|
|
3564
3577
|
isActive() {
|
|
3565
3578
|
return this.tree.activeNode === this;
|
|
@@ -3625,7 +3638,7 @@
|
|
|
3625
3638
|
}
|
|
3626
3639
|
/** Return true if _this_ node is currently in edit-title mode.
|
|
3627
3640
|
*
|
|
3628
|
-
* See {@link
|
|
3641
|
+
* See {@link WunderbaumNode.startEditTitle}.
|
|
3629
3642
|
*/
|
|
3630
3643
|
isEditingTitle() {
|
|
3631
3644
|
return this.tree._callMethod("edit.isEditingTitle", this);
|
|
@@ -4654,8 +4667,8 @@
|
|
|
4654
4667
|
*
|
|
4655
4668
|
* The result is compatible with node.addChildren().
|
|
4656
4669
|
*
|
|
4657
|
-
* @param include child nodes
|
|
4658
|
-
* @param callback
|
|
4670
|
+
* @param recursive include child nodes
|
|
4671
|
+
* @param callback is called for every node, in order to allow
|
|
4659
4672
|
* modifications.
|
|
4660
4673
|
* Return `false` to ignore this node or `"skip"` to include this node
|
|
4661
4674
|
* without its children.
|
|
@@ -5307,8 +5320,9 @@
|
|
|
5307
5320
|
* Stop iteration, if fn() returns false.<br>
|
|
5308
5321
|
* Return false if iteration was stopped.
|
|
5309
5322
|
*
|
|
5310
|
-
* @param
|
|
5323
|
+
* @param callback the callback function.
|
|
5311
5324
|
* Return false to stop iteration.
|
|
5325
|
+
* @param includeSelf include this node in the iteration.
|
|
5312
5326
|
*/
|
|
5313
5327
|
visitSiblings(callback, includeSelf = false) {
|
|
5314
5328
|
const ac = this.parent.children;
|
|
@@ -5333,8 +5347,8 @@
|
|
|
5333
5347
|
|
|
5334
5348
|
/*!
|
|
5335
5349
|
* Wunderbaum - ext-edit
|
|
5336
|
-
* Copyright (c) 2021-
|
|
5337
|
-
* v0.
|
|
5350
|
+
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
5351
|
+
* v0.9.0, Sun, 05 May 2024 16:08:56 GMT (https://github.com/mar10/wunderbaum)
|
|
5338
5352
|
*/
|
|
5339
5353
|
// const START_MARKER = "\uFFF7";
|
|
5340
5354
|
class EditExtension extends WunderbaumExtension {
|
|
@@ -5343,11 +5357,11 @@
|
|
|
5343
5357
|
debounce: 100,
|
|
5344
5358
|
minlength: 1,
|
|
5345
5359
|
maxlength: null,
|
|
5346
|
-
trigger: [],
|
|
5360
|
+
trigger: [], //["clickActive", "F2", "macEnter"],
|
|
5347
5361
|
trim: true,
|
|
5348
5362
|
select: true,
|
|
5349
|
-
slowClickDelay: 1000,
|
|
5350
|
-
validity: true,
|
|
5363
|
+
slowClickDelay: 1000, // Handle 'clickActive' only if last click is less than this old (0: always)
|
|
5364
|
+
validity: true, //"Please enter a title",
|
|
5351
5365
|
// --- Events ---
|
|
5352
5366
|
// (note: there is also the `tree.change` event.)
|
|
5353
5367
|
beforeEdit: null,
|
|
@@ -5661,12 +5675,12 @@
|
|
|
5661
5675
|
*
|
|
5662
5676
|
* A treegrid control.
|
|
5663
5677
|
*
|
|
5664
|
-
* Copyright (c) 2021-
|
|
5678
|
+
* Copyright (c) 2021-2024, Martin Wendt (https://wwWendt.de).
|
|
5665
5679
|
* https://github.com/mar10/wunderbaum
|
|
5666
5680
|
*
|
|
5667
5681
|
* Released under the MIT license.
|
|
5668
|
-
* @version v0.
|
|
5669
|
-
* @date
|
|
5682
|
+
* @version v0.9.0
|
|
5683
|
+
* @date Sun, 05 May 2024 16:08:56 GMT
|
|
5670
5684
|
*/
|
|
5671
5685
|
// import "./wunderbaum.scss";
|
|
5672
5686
|
class WbSystemRoot extends WunderbaumNode {
|
|
@@ -5728,6 +5742,7 @@
|
|
|
5728
5742
|
// /** @internal */
|
|
5729
5743
|
// public selectRangeAnchor: WunderbaumNode | null = null;
|
|
5730
5744
|
// --- FILTER ---
|
|
5745
|
+
/** Filter options (used as defaults for calls to {@link Wunderbaum.filterNodes} ) */
|
|
5731
5746
|
this.filterMode = null;
|
|
5732
5747
|
// --- KEYNAV ---
|
|
5733
5748
|
/** @internal Use `setColumn()`/`getActiveColElem()` to access. */
|
|
@@ -5742,10 +5757,10 @@
|
|
|
5742
5757
|
this.lastClickTime = 0;
|
|
5743
5758
|
const opts = (this.options = extend({
|
|
5744
5759
|
id: null,
|
|
5745
|
-
source: null,
|
|
5746
|
-
element: null,
|
|
5747
|
-
debugLevel: DEFAULT_DEBUGLEVEL,
|
|
5748
|
-
header: null,
|
|
5760
|
+
source: null, // URL for GET/PUT, Ajax options, or callback
|
|
5761
|
+
element: null, // <div class="wunderbaum">
|
|
5762
|
+
debugLevel: DEFAULT_DEBUGLEVEL, // 0:quiet, 1:errors, 2:warnings, 3:info, 4:verbose
|
|
5763
|
+
header: null, // Show/hide header (pass bool or string)
|
|
5749
5764
|
// headerHeightPx: ROW_HEIGHT,
|
|
5750
5765
|
rowHeightPx: ROW_HEIGHT,
|
|
5751
5766
|
iconMap: "bootstrap",
|
|
@@ -5760,10 +5775,10 @@
|
|
|
5760
5775
|
emptyChildListExpandable: false,
|
|
5761
5776
|
// updateThrottleWait: 200,
|
|
5762
5777
|
skeleton: false,
|
|
5763
|
-
connectTopBreadcrumb: null,
|
|
5764
|
-
selectMode: "multi",
|
|
5778
|
+
connectTopBreadcrumb: null, // HTMLElement that receives the top nodes breadcrumb
|
|
5779
|
+
selectMode: "multi", // SelectModeType
|
|
5765
5780
|
// --- KeyNav ---
|
|
5766
|
-
navigationModeOption: null,
|
|
5781
|
+
navigationModeOption: null, // NavModeEnum.startRow,
|
|
5767
5782
|
quicksearch: true,
|
|
5768
5783
|
// --- Events ---
|
|
5769
5784
|
iconBadge: null,
|
|
@@ -7304,7 +7319,7 @@
|
|
|
7304
7319
|
}
|
|
7305
7320
|
/** Convert tree to an array of plain objects.
|
|
7306
7321
|
*
|
|
7307
|
-
* @param callback
|
|
7322
|
+
* @param callback is called for every node, in order to allow
|
|
7308
7323
|
* modifications.
|
|
7309
7324
|
* Return `false` to ignore this node or `"skip"` to include this node
|
|
7310
7325
|
* without its children.
|
|
@@ -7852,13 +7867,30 @@
|
|
|
7852
7867
|
* FILTER
|
|
7853
7868
|
* -------------------------------------------------------------------------*/
|
|
7854
7869
|
/**
|
|
7855
|
-
* Dim or hide nodes.
|
|
7870
|
+
* Dim or hide unmatched nodes.
|
|
7871
|
+
* @param filter a string to match against node titles, or a callback function.
|
|
7872
|
+
* @param options filter options. Defaults to the `tree.options.filter` settings.
|
|
7873
|
+
* @returns the number of nodes that match the filter.
|
|
7874
|
+
* @example
|
|
7875
|
+
* ```ts
|
|
7876
|
+
* tree.filterNodes("foo", {mode: 'dim', fuzzy: true});
|
|
7877
|
+
* // or pass a callback
|
|
7878
|
+
* tree.filterNodes((node) => { return node.data.foo === true }, {mode: 'hide'});
|
|
7879
|
+
* ```
|
|
7856
7880
|
*/
|
|
7857
7881
|
filterNodes(filter, options) {
|
|
7858
7882
|
return this.extensions.filter.filterNodes(filter, options);
|
|
7859
7883
|
}
|
|
7884
|
+
/**
|
|
7885
|
+
* Return the number of nodes that match the current filter.
|
|
7886
|
+
* @see {@link Wunderbaum.filterNodes}
|
|
7887
|
+
*/
|
|
7888
|
+
countMatches() {
|
|
7889
|
+
return this.extensions.filter.countMatches();
|
|
7890
|
+
}
|
|
7860
7891
|
/**
|
|
7861
7892
|
* Dim or hide whole branches.
|
|
7893
|
+
* @deprecated Use {@link filterNodes} instead and set `options.matchBranch: true`.
|
|
7862
7894
|
*/
|
|
7863
7895
|
filterBranches(filter, options) {
|
|
7864
7896
|
return this.extensions.filter.filterBranches(filter, options);
|
|
@@ -7884,7 +7916,7 @@
|
|
|
7884
7916
|
}
|
|
7885
7917
|
Wunderbaum.sequence = 0;
|
|
7886
7918
|
/** Wunderbaum release version number "MAJOR.MINOR.PATCH". */
|
|
7887
|
-
Wunderbaum.version = "v0.
|
|
7919
|
+
Wunderbaum.version = "v0.9.0"; // Set to semver by 'grunt release'
|
|
7888
7920
|
/** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
|
|
7889
7921
|
Wunderbaum.util = util;
|
|
7890
7922
|
|