wunderbaum 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wunderbaum.d.ts +146 -60
- package/dist/wunderbaum.esm.js +136 -69
- package/dist/wunderbaum.esm.min.js +18 -18
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +136 -69
- package/dist/wunderbaum.umd.min.js +22 -22
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +69 -12
- package/src/wb_ext_dnd.ts +44 -15
- package/src/wb_ext_keynav.ts +2 -2
- package/src/wb_ext_logger.ts +2 -1
- package/src/wb_node.ts +38 -22
- package/src/wb_options.ts +54 -28
- package/src/wunderbaum.ts +56 -21
package/dist/wunderbaum.umd.js
CHANGED
|
@@ -304,7 +304,7 @@
|
|
|
304
304
|
/*!
|
|
305
305
|
* Wunderbaum - util
|
|
306
306
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
307
|
-
* v0.8.
|
|
307
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
308
308
|
*/
|
|
309
309
|
/** @module util */
|
|
310
310
|
/** Readable names for `MouseEvent.button` */
|
|
@@ -1102,7 +1102,7 @@
|
|
|
1102
1102
|
/*!
|
|
1103
1103
|
* Wunderbaum - types
|
|
1104
1104
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
1105
|
-
* v0.8.
|
|
1105
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
1106
1106
|
*/
|
|
1107
1107
|
/**
|
|
1108
1108
|
* Possible values for {@link WunderbaumNode.update()} and {@link Wunderbaum.update()}.
|
|
@@ -1166,7 +1166,7 @@
|
|
|
1166
1166
|
/*!
|
|
1167
1167
|
* Wunderbaum - wb_extension_base
|
|
1168
1168
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
1169
|
-
* v0.8.
|
|
1169
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
1170
1170
|
*/
|
|
1171
1171
|
class WunderbaumExtension {
|
|
1172
1172
|
constructor(tree, id, defaults) {
|
|
@@ -1225,7 +1225,7 @@
|
|
|
1225
1225
|
/*!
|
|
1226
1226
|
* Wunderbaum - ext-filter
|
|
1227
1227
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
1228
|
-
* v0.8.
|
|
1228
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
1229
1229
|
*/
|
|
1230
1230
|
const START_MARKER = "\uFFF7";
|
|
1231
1231
|
const END_MARKER = "\uFFF8";
|
|
@@ -1530,7 +1530,7 @@
|
|
|
1530
1530
|
/*!
|
|
1531
1531
|
* Wunderbaum - ext-keynav
|
|
1532
1532
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
1533
|
-
* v0.8.
|
|
1533
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
1534
1534
|
*/
|
|
1535
1535
|
const QUICKSEARCH_DELAY = 500;
|
|
1536
1536
|
class KeynavExtension extends WunderbaumExtension {
|
|
@@ -1894,7 +1894,7 @@
|
|
|
1894
1894
|
/*!
|
|
1895
1895
|
* Wunderbaum - ext-logger
|
|
1896
1896
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
1897
|
-
* v0.8.
|
|
1897
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
1898
1898
|
*/
|
|
1899
1899
|
class LoggerExtension extends WunderbaumExtension {
|
|
1900
1900
|
constructor(tree) {
|
|
@@ -1936,7 +1936,7 @@
|
|
|
1936
1936
|
/*!
|
|
1937
1937
|
* Wunderbaum - common
|
|
1938
1938
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
1939
|
-
* v0.8.
|
|
1939
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
1940
1940
|
*/
|
|
1941
1941
|
const DEFAULT_DEBUGLEVEL = 3; // Replaced by rollup script
|
|
1942
1942
|
/**
|
|
@@ -2259,7 +2259,7 @@
|
|
|
2259
2259
|
/*!
|
|
2260
2260
|
* Wunderbaum - ext-dnd
|
|
2261
2261
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
2262
|
-
* v0.8.
|
|
2262
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
2263
2263
|
*/
|
|
2264
2264
|
const nodeMimeType = "application/x-wunderbaum-node";
|
|
2265
2265
|
class DndExtension extends WunderbaumExtension {
|
|
@@ -2498,7 +2498,7 @@
|
|
|
2498
2498
|
const dndOpts = this.treeOpts.dnd;
|
|
2499
2499
|
const srcNode = Wunderbaum.getNode(e);
|
|
2500
2500
|
if (!srcNode) {
|
|
2501
|
-
this.tree.logWarn(`onDragEvent.${e.type} no node`);
|
|
2501
|
+
this.tree.logWarn(`onDragEvent.${e.type}: no node`);
|
|
2502
2502
|
return;
|
|
2503
2503
|
}
|
|
2504
2504
|
if (["dragstart", "dragend"].includes(e.type)) {
|
|
@@ -2573,6 +2573,13 @@
|
|
|
2573
2573
|
const dndOpts = this.treeOpts.dnd;
|
|
2574
2574
|
const dt = e.dataTransfer;
|
|
2575
2575
|
const dropRegion = this._calcDropRegion(e, this.lastAllowedDropRegions);
|
|
2576
|
+
/** Helper to log a message if predicate is false. */
|
|
2577
|
+
const _t = (pred, msg) => {
|
|
2578
|
+
if (pred) {
|
|
2579
|
+
this.tree.log(`Prevented drop operation (${msg}).`);
|
|
2580
|
+
}
|
|
2581
|
+
return pred;
|
|
2582
|
+
};
|
|
2576
2583
|
if (!targetNode) {
|
|
2577
2584
|
this._leaveNode();
|
|
2578
2585
|
return;
|
|
@@ -2583,6 +2590,7 @@
|
|
|
2583
2590
|
}
|
|
2584
2591
|
// --- dragenter ---
|
|
2585
2592
|
if (e.type === "dragenter") {
|
|
2593
|
+
// this.tree.logWarn(` onDropEvent.${e.type} targetNode: ${targetNode}`, e);
|
|
2586
2594
|
this.lastAllowedDropRegions = null;
|
|
2587
2595
|
// `dragleave` is not reliable with event delegation, so we generate it
|
|
2588
2596
|
// from dragenter:
|
|
@@ -2593,29 +2601,32 @@
|
|
|
2593
2601
|
this.lastEnterStamp = Date.now();
|
|
2594
2602
|
if (
|
|
2595
2603
|
// Don't drop on status node:
|
|
2596
|
-
targetNode.isStatusNode() ||
|
|
2604
|
+
_t(targetNode.isStatusNode(), "is status node") ||
|
|
2597
2605
|
// Prevent dropping nodes from different Wunderbaum trees:
|
|
2598
|
-
(dndOpts.preventForeignNodes && targetNode.tree !== srcTree) ||
|
|
2606
|
+
_t(dndOpts.preventForeignNodes && targetNode.tree !== srcTree, "preventForeignNodes") ||
|
|
2599
2607
|
// Prevent dropping items on unloaded lazy Wunderbaum tree nodes:
|
|
2600
|
-
(dndOpts.preventLazyParents && !targetNode.isLoaded()) ||
|
|
2608
|
+
_t(dndOpts.preventLazyParents && !targetNode.isLoaded(), "preventLazyParents") ||
|
|
2601
2609
|
// Prevent dropping items other than Wunderbaum tree nodes:
|
|
2602
|
-
(dndOpts.preventNonNodes && !srcNode) ||
|
|
2610
|
+
_t(dndOpts.preventNonNodes && !srcNode, "preventNonNodes") ||
|
|
2603
2611
|
// Prevent dropping nodes on own descendants:
|
|
2604
|
-
(dndOpts.preventRecursion && (srcNode === null || srcNode === void 0 ? void 0 : srcNode.isAncestorOf(targetNode))) ||
|
|
2612
|
+
_t(dndOpts.preventRecursion && (srcNode === null || srcNode === void 0 ? void 0 : srcNode.isAncestorOf(targetNode)), "preventRecursion") ||
|
|
2605
2613
|
// Prevent dropping nodes under same direct parent:
|
|
2606
|
-
(dndOpts.preventSameParent &&
|
|
2614
|
+
_t(dndOpts.preventSameParent &&
|
|
2607
2615
|
srcNode &&
|
|
2608
|
-
targetNode.parent === srcNode.parent) ||
|
|
2616
|
+
targetNode.parent === srcNode.parent, "preventSameParent") ||
|
|
2609
2617
|
// Don't allow void operation ('drop on self'): TODO: should be checked on move only
|
|
2610
|
-
(dndOpts.preventVoidMoves && targetNode === srcNode)) {
|
|
2618
|
+
_t(dndOpts.preventVoidMoves && targetNode === srcNode, "preventVoidMoves")) {
|
|
2611
2619
|
dt.dropEffect = "none";
|
|
2612
|
-
this.tree.log("Prevented drop operation");
|
|
2620
|
+
// this.tree.log("Prevented drop operation");
|
|
2613
2621
|
return true; // Prevent drop operation
|
|
2614
2622
|
}
|
|
2615
2623
|
// User may return a set of regions (or `false` to prevent drop)
|
|
2616
2624
|
// Figure out a drop effect (copy/link/move) using opinated conventions.
|
|
2617
2625
|
dt.dropEffect = this._guessDropEffect(e) || "none";
|
|
2618
|
-
let regionSet = targetNode._callEvent("dnd.dragEnter", {
|
|
2626
|
+
let regionSet = targetNode._callEvent("dnd.dragEnter", {
|
|
2627
|
+
event: e,
|
|
2628
|
+
sourceNode: srcNode,
|
|
2629
|
+
});
|
|
2619
2630
|
//
|
|
2620
2631
|
regionSet = this.unifyDragover(regionSet);
|
|
2621
2632
|
if (!regionSet) {
|
|
@@ -2633,7 +2644,7 @@
|
|
|
2633
2644
|
const viewportY = e.clientY - this.tree.element.offsetTop;
|
|
2634
2645
|
this._autoScroll(viewportY);
|
|
2635
2646
|
dt.dropEffect = this._guessDropEffect(e) || "none";
|
|
2636
|
-
targetNode._callEvent("dnd.dragOver", { event: e });
|
|
2647
|
+
targetNode._callEvent("dnd.dragOver", { event: e, sourceNode: srcNode });
|
|
2637
2648
|
const region = this._calcDropRegion(e, this.lastAllowedDropRegions);
|
|
2638
2649
|
this.lastDropRegion = region;
|
|
2639
2650
|
this.lastDropEffect = dt.dropEffect;
|
|
@@ -2641,7 +2652,10 @@
|
|
|
2641
2652
|
targetNode.isExpandable(true) &&
|
|
2642
2653
|
!targetNode._isLoading &&
|
|
2643
2654
|
Date.now() - this.lastEnterStamp > dndOpts.autoExpandMS &&
|
|
2644
|
-
targetNode._callEvent("dnd.dragExpand", {
|
|
2655
|
+
targetNode._callEvent("dnd.dragExpand", {
|
|
2656
|
+
event: e,
|
|
2657
|
+
sourceNode: srcNode,
|
|
2658
|
+
}) !== false) {
|
|
2645
2659
|
targetNode.setExpanded();
|
|
2646
2660
|
}
|
|
2647
2661
|
if (!region || this._isVoidDrop(targetNode, srcNode, region)) {
|
|
@@ -2657,7 +2671,7 @@
|
|
|
2657
2671
|
else if (e.type === "dragleave") {
|
|
2658
2672
|
// NOTE: we cannot trust this event, since it is always fired,
|
|
2659
2673
|
// Instead we remove the marker on dragenter
|
|
2660
|
-
targetNode._callEvent("dnd.dragLeave", { event: e });
|
|
2674
|
+
targetNode._callEvent("dnd.dragLeave", { event: e, sourceNode: srcNode });
|
|
2661
2675
|
// --- drop ---
|
|
2662
2676
|
}
|
|
2663
2677
|
else if (e.type === "drop") {
|
|
@@ -2690,7 +2704,7 @@
|
|
|
2690
2704
|
/*!
|
|
2691
2705
|
* Wunderbaum - drag_observer
|
|
2692
2706
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
2693
|
-
* v0.8.
|
|
2707
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
2694
2708
|
*/
|
|
2695
2709
|
/**
|
|
2696
2710
|
* Convert mouse- and touch events to 'dragstart', 'drag', and 'dragstop'.
|
|
@@ -2826,7 +2840,7 @@
|
|
|
2826
2840
|
/*!
|
|
2827
2841
|
* Wunderbaum - ext-grid
|
|
2828
2842
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
2829
|
-
* v0.8.
|
|
2843
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
2830
2844
|
*/
|
|
2831
2845
|
class GridExtension extends WunderbaumExtension {
|
|
2832
2846
|
constructor(tree) {
|
|
@@ -2863,7 +2877,7 @@
|
|
|
2863
2877
|
/*!
|
|
2864
2878
|
* Wunderbaum - deferred
|
|
2865
2879
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
2866
|
-
* v0.8.
|
|
2880
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
2867
2881
|
*/
|
|
2868
2882
|
/**
|
|
2869
2883
|
* Implement a ES6 Promise, that exposes a resolve() and reject() method.
|
|
@@ -2916,7 +2930,7 @@
|
|
|
2916
2930
|
/*!
|
|
2917
2931
|
* Wunderbaum - wunderbaum_node
|
|
2918
2932
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
2919
|
-
* v0.8.
|
|
2933
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
2920
2934
|
*/
|
|
2921
2935
|
/** WunderbaumNode properties that can be passed with source data.
|
|
2922
2936
|
* (Any other source properties will be stored as `node.data.PROP`.)
|
|
@@ -3876,13 +3890,20 @@
|
|
|
3876
3890
|
}
|
|
3877
3891
|
}
|
|
3878
3892
|
}
|
|
3879
|
-
/**
|
|
3893
|
+
/**
|
|
3894
|
+
* Load content of a lazy node.
|
|
3895
|
+
* If the node is already loaded, nothing happens.
|
|
3896
|
+
* @param [forceReload=false] If true, reload even if already loaded.
|
|
3897
|
+
*/
|
|
3880
3898
|
async loadLazy(forceReload = false) {
|
|
3881
3899
|
const wasExpanded = this.expanded;
|
|
3882
3900
|
assert(this.lazy, "load() requires a lazy node");
|
|
3883
|
-
// _assert( forceReload || this.isUndefined(), "Pass forceReload=true to re-load a lazy node" );
|
|
3884
3901
|
if (!forceReload && !this.isUnloaded()) {
|
|
3885
|
-
return;
|
|
3902
|
+
return; // Already loaded: nothing to do
|
|
3903
|
+
}
|
|
3904
|
+
if (this.isLoading()) {
|
|
3905
|
+
this.logWarn("loadLazy() called while already loading: ignored.");
|
|
3906
|
+
return; // Already loading: prevent duplicate requests
|
|
3886
3907
|
}
|
|
3887
3908
|
if (this.isLoaded()) {
|
|
3888
3909
|
this.resetLazy(); // Also collapses if currently expanded
|
|
@@ -3898,7 +3919,7 @@
|
|
|
3898
3919
|
}
|
|
3899
3920
|
assert(isArray(source) || (source && source.url), "The lazyLoad event must return a node list, `{url: ...}`, or false.");
|
|
3900
3921
|
await this.load(source);
|
|
3901
|
-
this.setStatus(NodeStatusType.ok);
|
|
3922
|
+
this.setStatus(NodeStatusType.ok); // Also resets `this._isLoading`
|
|
3902
3923
|
if (wasExpanded) {
|
|
3903
3924
|
this.expanded = true;
|
|
3904
3925
|
this.tree.update(ChangeType.structure);
|
|
@@ -3910,33 +3931,41 @@
|
|
|
3910
3931
|
catch (e) {
|
|
3911
3932
|
this.logError("Error during loadLazy()", e);
|
|
3912
3933
|
this._callEvent("error", { error: e });
|
|
3934
|
+
// Also resets `this._isLoading`:
|
|
3913
3935
|
this.setStatus(NodeStatusType.error, { message: "" + e });
|
|
3914
3936
|
}
|
|
3915
3937
|
return;
|
|
3916
3938
|
}
|
|
3917
|
-
/**
|
|
3939
|
+
/** Write to `console.log` with node name as prefix if opts.debugLevel >= 4.
|
|
3940
|
+
* @see {@link WunderbaumNode.logDebug}
|
|
3941
|
+
*/
|
|
3918
3942
|
log(...args) {
|
|
3919
|
-
this.
|
|
3943
|
+
if (this.tree.options.debugLevel >= 4) {
|
|
3944
|
+
console.log(this.toString(), ...args); // eslint-disable-line no-console
|
|
3945
|
+
}
|
|
3920
3946
|
}
|
|
3921
|
-
|
|
3947
|
+
/** Write to `console.debug` with node name as prefix if opts.debugLevel >= 4
|
|
3948
|
+
* and browser console level includes debug/verbose messages.
|
|
3949
|
+
* @see {@link WunderbaumNode.log}
|
|
3950
|
+
*/
|
|
3922
3951
|
logDebug(...args) {
|
|
3923
3952
|
if (this.tree.options.debugLevel >= 4) {
|
|
3924
|
-
console.
|
|
3953
|
+
console.debug(this.toString(), ...args); // eslint-disable-line no-console
|
|
3925
3954
|
}
|
|
3926
3955
|
}
|
|
3927
|
-
|
|
3956
|
+
/** Write to `console.error` with node name as prefix if opts.debugLevel >= 1. */
|
|
3928
3957
|
logError(...args) {
|
|
3929
3958
|
if (this.tree.options.debugLevel >= 1) {
|
|
3930
3959
|
console.error(this.toString(), ...args); // eslint-disable-line no-console
|
|
3931
3960
|
}
|
|
3932
3961
|
}
|
|
3933
|
-
|
|
3962
|
+
/** Write to `console.info` with node name as prefix if opts.debugLevel >= 3. */
|
|
3934
3963
|
logInfo(...args) {
|
|
3935
3964
|
if (this.tree.options.debugLevel >= 3) {
|
|
3936
3965
|
console.info(this.toString(), ...args); // eslint-disable-line no-console
|
|
3937
3966
|
}
|
|
3938
3967
|
}
|
|
3939
|
-
|
|
3968
|
+
/** Write to `console.warn` with node name as prefix if opts.debugLevel >= 2. */
|
|
3940
3969
|
logWarn(...args) {
|
|
3941
3970
|
if (this.tree.options.debugLevel >= 2) {
|
|
3942
3971
|
console.warn(this.toString(), ...args); // eslint-disable-line no-console
|
|
@@ -4127,15 +4156,16 @@
|
|
|
4127
4156
|
}
|
|
4128
4157
|
/** Remove all descendants of this node. */
|
|
4129
4158
|
removeChildren() {
|
|
4159
|
+
var _a, _b;
|
|
4130
4160
|
const tree = this.tree;
|
|
4131
4161
|
if (!this.children) {
|
|
4132
4162
|
return;
|
|
4133
4163
|
}
|
|
4134
|
-
if (tree.activeNode
|
|
4164
|
+
if ((_a = tree.activeNode) === null || _a === void 0 ? void 0 : _a.isDescendantOf(this)) {
|
|
4135
4165
|
tree.activeNode.setActive(false); // TODO: don't fire events
|
|
4136
4166
|
}
|
|
4137
|
-
if (tree.focusNode
|
|
4138
|
-
tree.
|
|
4167
|
+
if ((_b = tree.focusNode) === null || _b === void 0 ? void 0 : _b.isDescendantOf(this)) {
|
|
4168
|
+
tree._setFocusNode(null);
|
|
4139
4169
|
}
|
|
4140
4170
|
// TODO: persist must take care to clear select and expand cookies
|
|
4141
4171
|
// Unlink children to support GC
|
|
@@ -4734,7 +4764,7 @@
|
|
|
4734
4764
|
*/
|
|
4735
4765
|
async setActive(flag = true, options) {
|
|
4736
4766
|
const tree = this.tree;
|
|
4737
|
-
const prev = tree.
|
|
4767
|
+
const prev = tree.getActiveNode();
|
|
4738
4768
|
const retrigger = options === null || options === void 0 ? void 0 : options.retrigger; // Default: false
|
|
4739
4769
|
const focusTree = options === null || options === void 0 ? void 0 : options.focusTree; // Default: false
|
|
4740
4770
|
// const focusNode = options?.focusNode !== false; // Default: true
|
|
@@ -4757,7 +4787,7 @@
|
|
|
4757
4787
|
}) === false) {
|
|
4758
4788
|
return;
|
|
4759
4789
|
}
|
|
4760
|
-
tree.
|
|
4790
|
+
tree._setActiveNode(null);
|
|
4761
4791
|
prev === null || prev === void 0 ? void 0 : prev.update(ChangeType.status);
|
|
4762
4792
|
}
|
|
4763
4793
|
}
|
|
@@ -4767,7 +4797,7 @@
|
|
|
4767
4797
|
}
|
|
4768
4798
|
if (prev !== this) {
|
|
4769
4799
|
if (flag) {
|
|
4770
|
-
tree.
|
|
4800
|
+
tree._setActiveNode(this);
|
|
4771
4801
|
}
|
|
4772
4802
|
prev === null || prev === void 0 ? void 0 : prev.update(ChangeType.status);
|
|
4773
4803
|
this.update(ChangeType.status);
|
|
@@ -4776,7 +4806,7 @@
|
|
|
4776
4806
|
if (flag) {
|
|
4777
4807
|
if (focusTree || edit) {
|
|
4778
4808
|
tree.setFocus();
|
|
4779
|
-
tree.
|
|
4809
|
+
tree._setFocusNode(this);
|
|
4780
4810
|
tree.focusNode.setFocus();
|
|
4781
4811
|
}
|
|
4782
4812
|
// if (focusNode || edit) {
|
|
@@ -4802,7 +4832,7 @@
|
|
|
4802
4832
|
this.isExpanded() &&
|
|
4803
4833
|
this.getLevel() <= this.tree.getOption("minExpandLevel") &&
|
|
4804
4834
|
!force) {
|
|
4805
|
-
this.logDebug("Ignored collapse request below
|
|
4835
|
+
this.logDebug("Ignored collapse request below minExpandLevel.");
|
|
4806
4836
|
return;
|
|
4807
4837
|
}
|
|
4808
4838
|
if (!flag === !this.expanded) {
|
|
@@ -4841,7 +4871,7 @@
|
|
|
4841
4871
|
setFocus(flag = true) {
|
|
4842
4872
|
assert(!!flag, "Blur is not yet implemented");
|
|
4843
4873
|
const prev = this.tree.focusNode;
|
|
4844
|
-
this.tree.
|
|
4874
|
+
this.tree._setFocusNode(this);
|
|
4845
4875
|
prev === null || prev === void 0 ? void 0 : prev.update();
|
|
4846
4876
|
this.update();
|
|
4847
4877
|
}
|
|
@@ -5294,7 +5324,7 @@
|
|
|
5294
5324
|
/*!
|
|
5295
5325
|
* Wunderbaum - ext-edit
|
|
5296
5326
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
5297
|
-
* v0.8.
|
|
5327
|
+
* v0.8.2, Sat, 17 Feb 2024 07:32:06 GMT (https://github.com/mar10/wunderbaum)
|
|
5298
5328
|
*/
|
|
5299
5329
|
// const START_MARKER = "\uFFF7";
|
|
5300
5330
|
class EditExtension extends WunderbaumExtension {
|
|
@@ -5623,8 +5653,8 @@
|
|
|
5623
5653
|
* https://github.com/mar10/wunderbaum
|
|
5624
5654
|
*
|
|
5625
5655
|
* Released under the MIT license.
|
|
5626
|
-
* @version v0.8.
|
|
5627
|
-
* @date
|
|
5656
|
+
* @version v0.8.2
|
|
5657
|
+
* @date Sat, 17 Feb 2024 07:32:06 GMT
|
|
5628
5658
|
*/
|
|
5629
5659
|
// import "./wunderbaum.scss";
|
|
5630
5660
|
class WbSystemRoot extends WunderbaumNode {
|
|
@@ -5644,6 +5674,22 @@
|
|
|
5644
5674
|
* See also {@link WunderbaumOptions}.
|
|
5645
5675
|
*/
|
|
5646
5676
|
class Wunderbaum {
|
|
5677
|
+
/** Currently active node if any.
|
|
5678
|
+
* Use @link {WunderbaumNode.setActive|setActive} to modify.
|
|
5679
|
+
*/
|
|
5680
|
+
get activeNode() {
|
|
5681
|
+
var _a;
|
|
5682
|
+
// Check for deleted node, i.e. node.tree === null
|
|
5683
|
+
return ((_a = this._activeNode) === null || _a === void 0 ? void 0 : _a.tree) ? this._activeNode : null;
|
|
5684
|
+
}
|
|
5685
|
+
/** Current node hat has keyboard focus if any.
|
|
5686
|
+
* Use @link {WunderbaumNode.setFocus|setFocus()} to modify.
|
|
5687
|
+
*/
|
|
5688
|
+
get focusNode() {
|
|
5689
|
+
var _a;
|
|
5690
|
+
// Check for deleted node, i.e. node.tree === null
|
|
5691
|
+
return ((_a = this._focusNode) === null || _a === void 0 ? void 0 : _a.tree) ? this._focusNode : null;
|
|
5692
|
+
}
|
|
5647
5693
|
constructor(options) {
|
|
5648
5694
|
this.enabled = true;
|
|
5649
5695
|
/** Contains additional data that was sent as response to an Ajax source load request. */
|
|
@@ -5655,10 +5701,8 @@
|
|
|
5655
5701
|
this.treeRowCount = 0;
|
|
5656
5702
|
this._disableUpdateCount = 0;
|
|
5657
5703
|
this._disableUpdateIgnoreCount = 0;
|
|
5658
|
-
|
|
5659
|
-
this.
|
|
5660
|
-
/** Current node hat has keyboard focus if any. */
|
|
5661
|
-
this.focusNode = null;
|
|
5704
|
+
this._activeNode = null;
|
|
5705
|
+
this._focusNode = null;
|
|
5662
5706
|
/** Shared properties, referenced by `node.type`. */
|
|
5663
5707
|
this.types = {};
|
|
5664
5708
|
/** List of column definitions. */
|
|
@@ -5684,10 +5728,6 @@
|
|
|
5684
5728
|
this.lastQuicksearchTerm = "";
|
|
5685
5729
|
// --- EDIT ---
|
|
5686
5730
|
this.lastClickTime = 0;
|
|
5687
|
-
/** Alias for {@link Wunderbaum.logDebug}.
|
|
5688
|
-
* @alias Wunderbaum.logDebug
|
|
5689
|
-
*/
|
|
5690
|
-
this.log = this.logDebug;
|
|
5691
5731
|
const opts = (this.options = extend({
|
|
5692
5732
|
id: null,
|
|
5693
5733
|
source: null,
|
|
@@ -6077,7 +6117,8 @@
|
|
|
6077
6117
|
/** Add node to tree's bookkeeping data structures. */
|
|
6078
6118
|
_registerNode(node) {
|
|
6079
6119
|
const key = node.key;
|
|
6080
|
-
assert(key != null
|
|
6120
|
+
assert(key != null, `Missing key: '${node}'.`);
|
|
6121
|
+
assert(!this.keyMap.has(key), `Duplicate key: '${key}': ${node}.`);
|
|
6081
6122
|
this.keyMap.set(key, node);
|
|
6082
6123
|
const rk = node.refKey;
|
|
6083
6124
|
if (rk != null) {
|
|
@@ -6358,8 +6399,8 @@
|
|
|
6358
6399
|
this.keyMap.clear();
|
|
6359
6400
|
this.refKeyMap.clear();
|
|
6360
6401
|
this.treeRowCount = 0;
|
|
6361
|
-
this.
|
|
6362
|
-
this.
|
|
6402
|
+
this._activeNode = null;
|
|
6403
|
+
this._focusNode = null;
|
|
6363
6404
|
// this.types = {};
|
|
6364
6405
|
// this. columns =[];
|
|
6365
6406
|
// this._columnsById = {};
|
|
@@ -6758,10 +6799,13 @@
|
|
|
6758
6799
|
return null;
|
|
6759
6800
|
}
|
|
6760
6801
|
/**
|
|
6761
|
-
* Return the currently active node or null.
|
|
6802
|
+
* Return the currently active node or null (alias for `tree.activeNode`).
|
|
6803
|
+
* Alias for {@link Wunderbaum.activeNode}.
|
|
6804
|
+
*
|
|
6762
6805
|
* @see {@link WunderbaumNode.setActive}
|
|
6763
6806
|
* @see {@link WunderbaumNode.isActive}
|
|
6764
|
-
* @see {@link
|
|
6807
|
+
* @see {@link Wunderbaum.activeNode}
|
|
6808
|
+
* @see {@link Wunderbaum.focusNode}
|
|
6765
6809
|
*/
|
|
6766
6810
|
getActiveNode() {
|
|
6767
6811
|
return this.activeNode;
|
|
@@ -6774,7 +6818,11 @@
|
|
|
6774
6818
|
}
|
|
6775
6819
|
/**
|
|
6776
6820
|
* Return the node that currently has keyboard focus or null.
|
|
6777
|
-
*
|
|
6821
|
+
* Alias for {@link Wunderbaum.focusNode}.
|
|
6822
|
+
* @see {@link WunderbaumNode.setFocus}
|
|
6823
|
+
* @see {@link WunderbaumNode.hasFocus}
|
|
6824
|
+
* @see {@link Wunderbaum.activeNode}
|
|
6825
|
+
* @see {@link Wunderbaum.focusNode}
|
|
6778
6826
|
*/
|
|
6779
6827
|
getFocusNode() {
|
|
6780
6828
|
return this.focusNode;
|
|
@@ -6880,19 +6928,30 @@
|
|
|
6880
6928
|
}, true);
|
|
6881
6929
|
return res;
|
|
6882
6930
|
}
|
|
6883
|
-
/**
|
|
6884
|
-
|
|
6931
|
+
/** Write to `console.log` with tree name as prefix if opts.debugLevel >= 4.
|
|
6932
|
+
* @see {@link Wunderbaum.logDebug}
|
|
6933
|
+
*/
|
|
6934
|
+
log(...args) {
|
|
6885
6935
|
if (this.options.debugLevel >= 4) {
|
|
6886
6936
|
console.log(this.toString(), ...args); // eslint-disable-line no-console
|
|
6887
6937
|
}
|
|
6888
6938
|
}
|
|
6889
|
-
/**
|
|
6939
|
+
/** Write to `console.debug` with tree name as prefix if opts.debugLevel >= 4.
|
|
6940
|
+
* and browser console level includes debug/verbose messages.
|
|
6941
|
+
* @see {@link Wunderbaum.log}
|
|
6942
|
+
*/
|
|
6943
|
+
logDebug(...args) {
|
|
6944
|
+
if (this.options.debugLevel >= 4) {
|
|
6945
|
+
console.debug(this.toString(), ...args); // eslint-disable-line no-console
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6948
|
+
/** Write to `console.error` with tree name as prefix. */
|
|
6890
6949
|
logError(...args) {
|
|
6891
6950
|
if (this.options.debugLevel >= 1) {
|
|
6892
6951
|
console.error(this.toString(), ...args); // eslint-disable-line no-console
|
|
6893
6952
|
}
|
|
6894
6953
|
}
|
|
6895
|
-
/**
|
|
6954
|
+
/** Write to `console.info` with tree name as prefix if opts.debugLevel >= 3. */
|
|
6896
6955
|
logInfo(...args) {
|
|
6897
6956
|
if (this.options.debugLevel >= 3) {
|
|
6898
6957
|
console.info(this.toString(), ...args); // eslint-disable-line no-console
|
|
@@ -6911,7 +6970,7 @@
|
|
|
6911
6970
|
console.timeEnd(this + ": " + label); // eslint-disable-line no-console
|
|
6912
6971
|
}
|
|
6913
6972
|
}
|
|
6914
|
-
/**
|
|
6973
|
+
/** Write to `console.warn` with tree name as prefix with if opts.debugLevel >= 2. */
|
|
6915
6974
|
logWarn(...args) {
|
|
6916
6975
|
if (this.options.debugLevel >= 2) {
|
|
6917
6976
|
console.warn(this.toString(), ...args); // eslint-disable-line no-console
|
|
@@ -7049,6 +7108,10 @@
|
|
|
7049
7108
|
}
|
|
7050
7109
|
}
|
|
7051
7110
|
}
|
|
7111
|
+
/* Set or remove keyboard focus to the tree container. @internal */
|
|
7112
|
+
_setActiveNode(node) {
|
|
7113
|
+
this._activeNode = node;
|
|
7114
|
+
}
|
|
7052
7115
|
/** Set or remove keyboard focus to the tree container. */
|
|
7053
7116
|
setActiveNode(key, flag = true, options) {
|
|
7054
7117
|
var _a;
|
|
@@ -7063,6 +7126,10 @@
|
|
|
7063
7126
|
this.element.blur();
|
|
7064
7127
|
}
|
|
7065
7128
|
}
|
|
7129
|
+
/* Set or remove keyboard focus to the tree container. @internal */
|
|
7130
|
+
_setFocusNode(node) {
|
|
7131
|
+
this._focusNode = node;
|
|
7132
|
+
}
|
|
7066
7133
|
update(change, node, options) {
|
|
7067
7134
|
// this.log(`update(${change}) node=${node}`);
|
|
7068
7135
|
if (!(node instanceof WunderbaumNode)) {
|
|
@@ -7805,7 +7872,7 @@
|
|
|
7805
7872
|
}
|
|
7806
7873
|
Wunderbaum.sequence = 0;
|
|
7807
7874
|
/** Wunderbaum release version number "MAJOR.MINOR.PATCH". */
|
|
7808
|
-
Wunderbaum.version = "v0.8.
|
|
7875
|
+
Wunderbaum.version = "v0.8.2"; // Set to semver by 'grunt release'
|
|
7809
7876
|
/** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
|
|
7810
7877
|
Wunderbaum.util = util;
|
|
7811
7878
|
|