wunderbaum 0.5.5 → 0.6.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/README.md CHANGED
@@ -9,31 +9,21 @@
9
9
 
10
10
  <!-- [![Build Status](https://travis-ci.com/mar10/wunderbaum.svg?branch=main)](https://travis-ci.com/github/mar10/wunderbaum) -->
11
11
 
12
- > Potential successor of [Fancytree](https://github.com/mar10/fancytree).<br> > **NOTE: Status _beta_. Do not use in production!**
12
+ > Potential successor of [Fancytree](https://github.com/mar10/fancytree).
13
+
14
+ **NOTE: Status _beta_. Do not use in production!**
13
15
 
14
16
  [![Demo](docs/assets/teaser_2.png?raw=true)](https://mar10.github.io/wunderbaum/demo/)
15
17
 
16
- Wunderbaum is a rewrite of the [Fancytree](https://github.com/mar10/fancytree)
17
- library. Major features include
18
-
19
- - **Treegrid** control with emphasis on "tree".<br>
20
- Depending on the number of columns and nesting depth, Wunderbaum can also be
21
- used as a **plain tree**, **plain grid**, or a **simple list** control.
22
- - **Performant** and efficient handling of **big data structures**.
23
- - Use modern technologies with **zero dependencies** (except for icon fonts you
24
- may want to use).<br>
25
- Drop legacy support (IE, jQuery, ...).
26
- - Built-in support for
27
- <!-- [aria](https://www.w3.org/TR/wai-aria-1.1/), -->
28
- [drag and drop](https://mar10.github.io/wunderbaum/#/tutorial/tutorial_dnd),
29
- [editing](https://mar10.github.io/wunderbaum/#/tutorial/tutorial_edit),
30
- [filtering](https://mar10.github.io/wunderbaum/#/tutorial/tutorial_filter),
31
- [multi-selection](https://mar10.github.io/wunderbaum/#/tutorial/tutorial_select).
32
- - Fully [controllable using the keyboard](https://mar10.github.io/wunderbaum/#/tutorial/tutorial_keyboard).
33
- - Framework agnostic.
34
- - Written in TypeScript, transpiled to JavaScript ES6 with type hints (.esm & .umd).
35
- <!-- - Good documentation. -->
36
- <!-- - Decent test coverage. -->
18
+ <center>
19
+ Supports drag and drop,, editing, filtering, and multi-selection.<br>
20
+ Written in TypeScript, transpiled to ES6 (esm & umd).<br>
21
+ Performant handling of big data structures.<br>
22
+ Provide an object oriented API.<br>
23
+ Framework agnostic.<br>
24
+ Zero dependencies.<br>
25
+ Keyboard support.
26
+ </center>
37
27
 
38
28
  ### Details
39
29
 
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Wunderbaum - util
3
3
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
4
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
4
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
5
5
  */
6
6
  /** @module util */
7
7
  /** Readable names for `MouseEvent.button` */
@@ -765,7 +765,7 @@ var util = /*#__PURE__*/Object.freeze({
765
765
  /*!
766
766
  * Wunderbaum - types
767
767
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
768
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
768
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
769
769
  */
770
770
  /**
771
771
  * Possible values for {@link WunderbaumNode.update()} and {@link Wunderbaum.update()}.
@@ -829,7 +829,7 @@ var NavModeEnum;
829
829
  /*!
830
830
  * Wunderbaum - wb_extension_base
831
831
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
832
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
832
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
833
833
  */
834
834
  class WunderbaumExtension {
835
835
  constructor(tree, id, defaults) {
@@ -1185,7 +1185,7 @@ function throttle(func, wait = 0, options = {}) {
1185
1185
  /*!
1186
1186
  * Wunderbaum - ext-filter
1187
1187
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1188
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
1188
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
1189
1189
  */
1190
1190
  const START_MARKER = "\uFFF7";
1191
1191
  const END_MARKER = "\uFFF8";
@@ -1485,7 +1485,7 @@ function _markFuzzyMatchedChars(text, matches, escapeTitles = true) {
1485
1485
  /*!
1486
1486
  * Wunderbaum - ext-keynav
1487
1487
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1488
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
1488
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
1489
1489
  */
1490
1490
  const QUICKSEARCH_DELAY = 500;
1491
1491
  class KeynavExtension extends WunderbaumExtension {
@@ -1831,7 +1831,7 @@ class KeynavExtension extends WunderbaumExtension {
1831
1831
  /*!
1832
1832
  * Wunderbaum - ext-logger
1833
1833
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1834
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
1834
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
1835
1835
  */
1836
1836
  class LoggerExtension extends WunderbaumExtension {
1837
1837
  constructor(tree) {
@@ -1873,7 +1873,7 @@ class LoggerExtension extends WunderbaumExtension {
1873
1873
  /*!
1874
1874
  * Wunderbaum - common
1875
1875
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1876
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
1876
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
1877
1877
  */
1878
1878
  const DEFAULT_DEBUGLEVEL = 3; // Replaced by rollup script
1879
1879
  /**
@@ -2139,7 +2139,7 @@ function inflateSourceData(source) {
2139
2139
  /*!
2140
2140
  * Wunderbaum - ext-dnd
2141
2141
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2142
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
2142
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
2143
2143
  */
2144
2144
  const nodeMimeType = "application/x-wunderbaum-node";
2145
2145
  class DndExtension extends WunderbaumExtension {
@@ -2373,6 +2373,7 @@ class DndExtension extends WunderbaumExtension {
2373
2373
  * Handle dragstart, drag and dragend events for the source node.
2374
2374
  */
2375
2375
  onDragEvent(e) {
2376
+ var _a;
2376
2377
  // const tree = this.tree;
2377
2378
  const dndOpts = this.treeOpts.dnd;
2378
2379
  const srcNode = Wunderbaum.getNode(e);
@@ -2413,7 +2414,9 @@ class DndExtension extends WunderbaumExtension {
2413
2414
  }
2414
2415
  }
2415
2416
  // e.dataTransfer!.setData("text/html", $(node.span).html());
2416
- e.dataTransfer.setData("text/plain", srcNode.title);
2417
+ if (!((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes("text/plain"))) {
2418
+ e.dataTransfer.setData("text/plain", srcNode.title);
2419
+ }
2417
2420
  this.srcNode = srcNode;
2418
2421
  setTimeout(() => {
2419
2422
  // Decouple this call, so the CSS is applied to the node, but not to
@@ -2565,7 +2568,7 @@ class DndExtension extends WunderbaumExtension {
2565
2568
  /*!
2566
2569
  * Wunderbaum - drag_observer
2567
2570
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2568
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
2571
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
2569
2572
  */
2570
2573
  /**
2571
2574
  * Convert mouse- and touch events to 'dragstart', 'drag', and 'dragstop'.
@@ -2701,7 +2704,7 @@ class DragObserver {
2701
2704
  /*!
2702
2705
  * Wunderbaum - ext-grid
2703
2706
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2704
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
2707
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
2705
2708
  */
2706
2709
  class GridExtension extends WunderbaumExtension {
2707
2710
  constructor(tree) {
@@ -2738,7 +2741,7 @@ class GridExtension extends WunderbaumExtension {
2738
2741
  /*!
2739
2742
  * Wunderbaum - deferred
2740
2743
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2741
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
2744
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
2742
2745
  */
2743
2746
  /**
2744
2747
  * Implement a ES6 Promise, that exposes a resolve() and reject() method.
@@ -2791,7 +2794,7 @@ class Deferred {
2791
2794
  /*!
2792
2795
  * Wunderbaum - wunderbaum_node
2793
2796
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2794
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
2797
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
2795
2798
  */
2796
2799
  /** WunderbaumNode properties that can be passed with source data.
2797
2800
  * (Any other source properties will be stored as `node.data.PROP`.)
@@ -3671,6 +3674,11 @@ class WunderbaumNode {
3671
3674
  if (!url) {
3672
3675
  // An array or a plain object (that does NOT contain a `.url` property)
3673
3676
  // will be treated as native Wunderbaum data
3677
+ if (typeof source.then === "function") {
3678
+ const msg = tree.logTime(`Resolve thenable ${source}`);
3679
+ source = await Promise.resolve(source);
3680
+ tree.logTimeEnd(msg);
3681
+ }
3674
3682
  this._loadSourceObject(source);
3675
3683
  elapProcess = Date.now() - start;
3676
3684
  }
@@ -5118,7 +5126,7 @@ WunderbaumNode.sequence = 0;
5118
5126
  /*!
5119
5127
  * Wunderbaum - ext-edit
5120
5128
  * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
5121
- * v0.5.5, Tue, 31 Oct 2023 14:26:34 GMT (https://github.com/mar10/wunderbaum)
5129
+ * v0.6.0, Wed, 08 Nov 2023 19:58:55 GMT (https://github.com/mar10/wunderbaum)
5122
5130
  */
5123
5131
  // const START_MARKER = "\uFFF7";
5124
5132
  class EditExtension extends WunderbaumExtension {
@@ -5197,9 +5205,13 @@ class EditExtension extends WunderbaumExtension {
5197
5205
  init() {
5198
5206
  super.init();
5199
5207
  onEvent(this.tree.element, "change", //"change input",
5200
- ".contenteditable,input,textarea,select", (e) => {
5201
- this.debouncedOnChange(e);
5202
- });
5208
+ ".contenteditable,input,textarea,select",
5209
+ // #61: we must not debounce the `change`, event.target may be reset to null
5210
+ // when the debounced handler is called.
5211
+ // (e) => {
5212
+ // this.debouncedOnChange(e);
5213
+ // }
5214
+ (e) => this._onChange(e));
5203
5215
  }
5204
5216
  /* Called by ext_keynav to pre-process input. */
5205
5217
  _preprocessKeyEvent(data) {
@@ -5414,8 +5426,8 @@ class EditExtension extends WunderbaumExtension {
5414
5426
  * https://github.com/mar10/wunderbaum
5415
5427
  *
5416
5428
  * Released under the MIT license.
5417
- * @version v0.5.5
5418
- * @date Tue, 31 Oct 2023 14:26:34 GMT
5429
+ * @version v0.6.0
5430
+ * @date Wed, 08 Nov 2023 19:58:55 GMT
5419
5431
  */
5420
5432
  // import "./wunderbaum.scss";
5421
5433
  class WbSystemRoot extends WunderbaumNode {
@@ -7548,7 +7560,7 @@ class Wunderbaum {
7548
7560
  }
7549
7561
  Wunderbaum.sequence = 0;
7550
7562
  /** Wunderbaum release version number "MAJOR.MINOR.PATCH". */
7551
- Wunderbaum.version = "v0.5.5"; // Set to semver by 'grunt release'
7563
+ Wunderbaum.version = "v0.6.0"; // Set to semver by 'grunt release'
7552
7564
  /** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
7553
7565
  Wunderbaum.util = util;
7554
7566