wunderbaum 0.12.0 → 0.12.1

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.
@@ -1,7 +1,7 @@
1
1
  @charset "UTF-8";
2
2
  /*!
3
3
  * Wunderbaum style sheet (generated from wunderbaum.scss)
4
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
4
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
5
5
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
6
6
  */
7
7
  :root,
@@ -1,8 +1,8 @@
1
1
  declare module "debounce" {
2
2
  /*!
3
- * debounce & throttle, taken from https://github.com/lodash/lodash v4.17.21
4
- * MIT License: https://raw.githubusercontent.com/lodash/lodash/4.17.21-npm/LICENSE
5
- * Modified for TypeScript type annotations.
3
+ * Wunderbaum - debounce.ts
4
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
5
+ * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
6
6
  */
7
7
  type Procedure = (...args: any[]) => any;
8
8
  type DebounceOptions = {
@@ -130,7 +130,7 @@ declare module "debounce" {
130
130
  declare module "util" {
131
131
  /*!
132
132
  * Wunderbaum - util
133
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
133
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
134
134
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
135
135
  */
136
136
  /** @module util */
@@ -422,7 +422,7 @@ declare module "util" {
422
422
  declare module "common" {
423
423
  /*!
424
424
  * Wunderbaum - common
425
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
425
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
426
426
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
427
427
  */
428
428
  import { MatcherCallback, SourceObjectType } from "types";
@@ -452,8 +452,11 @@ declare module "common" {
452
452
  */
453
453
  export const TEST_IMG: RegExp;
454
454
  /**
455
- * Default node icons.
456
- * Requires bootstrap icons https://icons.getbootstrap.com
455
+ * Default node icons for icon libraries
456
+ *
457
+ * - 'bootstrap': {@link https://icons.getbootstrap.com}
458
+ * - 'fontawesome6' {@link https://fontawesome.com/icons}
459
+ *
457
460
  */
458
461
  export const iconMaps: {
459
462
  [key: string]: {
@@ -496,7 +499,7 @@ declare module "common" {
496
499
  declare module "deferred" {
497
500
  /*!
498
501
  * Wunderbaum - deferred
499
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
502
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
500
503
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
501
504
  */
502
505
  type PromiseCallbackType = (val: any) => void;
@@ -1112,7 +1115,7 @@ declare module "wb_node" {
1112
1115
  declare module "wb_options" {
1113
1116
  /*!
1114
1117
  * Wunderbaum - utils
1115
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1118
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
1116
1119
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
1117
1120
  */
1118
1121
  import { ColumnDefinitionList, DndOptionsType, DynamicBoolOption, DynamicBoolOrStringOption, DynamicCheckboxOption, DynamicIconOption, EditOptionsType, FilterOptionsType, NavModeEnum, NodeTypeDefinitionMap, SelectModeType, WbActivateEventType, WbButtonClickEventType, WbCancelableEventResultType, WbChangeEventType, WbClickEventType, WbDeactivateEventType, WbErrorEventType, WbExpandEventType, WbIconBadgeCallback, WbIconBadgeEventResultType, WbInitEventType, WbKeydownEventType, WbNodeData, WbNodeEventType, WbReceiveEventType, WbRenderEventType, WbSelectEventType, WbTreeEventType } from "types";
@@ -1190,6 +1193,14 @@ declare module "wb_options" {
1190
1193
  skeleton?: boolean;
1191
1194
  /**
1192
1195
  * Translation map for some system messages.
1196
+ * Default:
1197
+ * ```js
1198
+ * strings: {
1199
+ * loading: "Loading...",
1200
+ * loadError: "Error",
1201
+ * noData: "No data",
1202
+ * }
1203
+ * ```
1193
1204
  */
1194
1205
  strings?: any;
1195
1206
  /**
@@ -1475,7 +1486,7 @@ declare module "wb_options" {
1475
1486
  declare module "types" {
1476
1487
  /*!
1477
1488
  * Wunderbaum - types
1478
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1489
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
1479
1490
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
1480
1491
  */
1481
1492
  import { WunderbaumNode } from "wb_node";
@@ -1494,7 +1505,7 @@ declare module "types" {
1494
1505
  * or a boolean value that indicates if the default icon should be used or hidden.
1495
1506
  */
1496
1507
  export type IconOption = boolean | string;
1497
- /** Show/hide tooltip or display a string. */
1508
+ /** Show/hide default tooltip or display a string. */
1498
1509
  export type TooltipOption = boolean | string;
1499
1510
  export interface SourceAjaxType {
1500
1511
  url: string;
@@ -1548,7 +1559,10 @@ declare module "types" {
1548
1559
  * returns an iteration modifier.
1549
1560
  */
1550
1561
  export type NodeToDictCallback = (dict: WbNodeData, node: WunderbaumNode) => NodeVisitResponse;
1551
- /** A callback that receives a node instance and returns a string value. */
1562
+ /**
1563
+ * A callback that receives a node instance and may returnsa `false` to prevent
1564
+ * (de)selection.
1565
+ */
1552
1566
  export type NodeSelectCallback = (node: WunderbaumNode) => boolean | void;
1553
1567
  /**
1554
1568
  * See also {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
@@ -1562,23 +1576,56 @@ declare module "types" {
1562
1576
  export type DynamicTooltipOption = TooltipOption | BoolOrStringOptionResolver;
1563
1577
  /** A plain object (dictionary) that represents a node instance. */
1564
1578
  export interface WbNodeData {
1579
+ /** Defines if the `selected` state is displayed as checkbox, radio button,
1580
+ * or hidden.
1581
+ * Defaults to {@link WunderbaumOptions.checkbox}.
1582
+ */
1565
1583
  checkbox?: CheckboxOption;
1584
+ /** Optional list of child nodes.
1585
+ * If `children` is an empty array, the node is considered a leaf.
1586
+ * If `lazy` is true and `children is undefined or null, the node, is
1587
+ * considered unloaded. Otherwise, the node is considered a leaf.
1588
+ */
1566
1589
  children?: Array<WbNodeData>;
1590
+ /** Additional classes that are added to `<div class='wb-row'>`. */
1567
1591
  classes?: string;
1592
+ /** Only show title in a single, merged column. */
1568
1593
  colspan?: boolean;
1594
+ /** Expand this node. */
1569
1595
  expanded?: boolean;
1596
+ /** Defaults to standard icons (doc, folder, folderOpen, ...)
1597
+ * from {@link WunderbaumOptions.iconMap}.
1598
+ * Can be overridden by {@link WunderbaumOptions.icon}.
1599
+ */
1570
1600
  icon?: IconOption;
1601
+ /** Tooltip for the node icon only. Defaults to {@link WunderbaumOptions.iconTooltip}. */
1571
1602
  iconTooltip?: TooltipOption;
1603
+ /** The node's key. Must be unique for the whole tree. Defaults to a sequence number. */
1572
1604
  key?: string;
1605
+ /** If true (and children are undefined or null), the node is considered lazy
1606
+ * and {@link WunderbaumOptions.lazyLoad} is called when expanded.
1607
+ */
1573
1608
  lazy?: boolean;
1574
1609
  /** Make child nodes single-select radio buttons. */
1575
1610
  radiogroup?: boolean;
1611
+ /** Node's reference key. Unlike {@link WunderbaumNode.key}, this value
1612
+ * may be non-unique. Nodes within the tree that share the same refKey are considered
1613
+ * clones.
1614
+ */
1576
1615
  refKey?: string;
1616
+ /** The node's selection status, typically displayed as a checkbox. */
1577
1617
  selected?: boolean;
1618
+ /** The node's status, typically displayed as merged single row.
1619
+ * @see {@link Wunderbaum.setStatus}
1620
+ */
1578
1621
  statusNodeType?: NodeStatusType;
1622
+ /** The node's title. Will be html escaped to prevent XSS. */
1579
1623
  title: string;
1624
+ /** Pass true to set node tooltip to the node's title. Defaults to {@link WunderbaumOptions.tooltip}. */
1580
1625
  tooltip?: TooltipOption;
1626
+ /** Inherit shared settings from the matching entry in {@link WunderbaumOptions.types}. */
1581
1627
  type?: string;
1628
+ /** Set to `true` to prevent selection. Defaults to {@link WunderbaumOptions.unselectable}. */
1582
1629
  unselectable?: boolean;
1583
1630
  /** @internal */
1584
1631
  _treeId?: string;
@@ -1910,6 +1957,7 @@ declare module "types" {
1910
1957
  /** Vertical scroll event. Update the 'top' property of all rows. */
1911
1958
  scroll = "scroll"
1912
1959
  }
1960
+ /** @internal */
1913
1961
  export enum RenderFlag {
1914
1962
  clearMarkup = "clearMarkup",
1915
1963
  header = "header",
@@ -1936,9 +1984,13 @@ declare module "types" {
1936
1984
  }
1937
1985
  /** Initial navigation mode and possible transition. */
1938
1986
  export enum NavModeEnum {
1939
- startRow = "startRow",// Start with row mode, but allow cell-nav mode
1940
- cell = "cell",// Cell-nav mode only
1941
- startCell = "startCell",// Start in cell-nav mode, but allow row mode
1987
+ /** Start with row mode, but allow cell-nav mode */
1988
+ startRow = "startRow",
1989
+ /** Cell-nav mode only */
1990
+ cell = "cell",
1991
+ /** Start in cell-nav mode, but allow row mode */
1992
+ startCell = "startCell",
1993
+ /** Row mode only */
1942
1994
  row = "row"
1943
1995
  }
1944
1996
  /** Possible values for {@link WunderbaumNode.addChildren}. */
@@ -2510,7 +2562,7 @@ declare module "wb_ext_filter" {
2510
2562
  declare module "wb_ext_keynav" {
2511
2563
  /*!
2512
2564
  * Wunderbaum - ext-keynav
2513
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2565
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2514
2566
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2515
2567
  */
2516
2568
  import { KeynavOptionsType } from "types";
@@ -2526,7 +2578,7 @@ declare module "wb_ext_keynav" {
2526
2578
  declare module "wb_ext_logger" {
2527
2579
  /*!
2528
2580
  * Wunderbaum - ext-logger
2529
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2581
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2530
2582
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2531
2583
  */
2532
2584
  import { LoggerOptionsType } from "types";
@@ -2590,7 +2642,7 @@ declare module "wb_ext_dnd" {
2590
2642
  declare module "drag_observer" {
2591
2643
  /*!
2592
2644
  * Wunderbaum - drag_observer
2593
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2645
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2594
2646
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2595
2647
  */
2596
2648
  export type DragCallbackArgType = {
@@ -2659,7 +2711,7 @@ declare module "drag_observer" {
2659
2711
  declare module "wb_ext_grid" {
2660
2712
  /*!
2661
2713
  * Wunderbaum - ext-grid
2662
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2714
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2663
2715
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2664
2716
  */
2665
2717
  import { Wunderbaum } from "wunderbaum";
@@ -2679,7 +2731,7 @@ declare module "wb_ext_grid" {
2679
2731
  declare module "wb_ext_edit" {
2680
2732
  /*!
2681
2733
  * Wunderbaum - ext-edit
2682
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2734
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2683
2735
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2684
2736
  */
2685
2737
  import { Wunderbaum } from "wunderbaum";
@@ -2718,7 +2770,7 @@ declare module "wunderbaum" {
2718
2770
  *
2719
2771
  * A treegrid control.
2720
2772
  *
2721
- * Copyright (c) 2021-2024, Martin Wendt (https://wwWendt.de).
2773
+ * Copyright (c) 2021-2025, Martin Wendt (https://wwWendt.de).
2722
2774
  * https://github.com/mar10/wunderbaum
2723
2775
  *
2724
2776
  * Released under the MIT license.
@@ -2770,11 +2822,11 @@ declare module "wunderbaum" {
2770
2822
  protected _activeNode: WunderbaumNode | null;
2771
2823
  protected _focusNode: WunderbaumNode | null;
2772
2824
  /** Currently active node if any.
2773
- * Use @link {WunderbaumNode.setActive|setActive} to modify.
2825
+ * Use {@link WunderbaumNode.setActive|setActive} to modify.
2774
2826
  */
2775
2827
  get activeNode(): WunderbaumNode;
2776
2828
  /** Current node hat has keyboard focus if any.
2777
- * Use @link {WunderbaumNode.setFocus|setFocus()} to modify.
2829
+ * Use {@link WunderbaumNode.setFocus|setFocus()} to modify.
2778
2830
  */
2779
2831
  get focusNode(): WunderbaumNode;
2780
2832
  /** Shared properties, referenced by `node.type`. */
@@ -1,4 +1,9 @@
1
1
  /*!
2
+ * Wunderbaum - debounce.ts
3
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
4
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
5
+ */
6
+ /*
2
7
  * debounce & throttle, taken from https://github.com/lodash/lodash v4.17.21
3
8
  * MIT License: https://raw.githubusercontent.com/lodash/lodash/4.17.21-npm/LICENSE
4
9
  * Modified for TypeScript type annotations.
@@ -287,8 +292,8 @@ function throttle(func, wait = 0, options = {}) {
287
292
 
288
293
  /*!
289
294
  * Wunderbaum - util
290
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
291
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
295
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
296
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
292
297
  */
293
298
  /** @module util */
294
299
  /** Readable names for `MouseEvent.button` */
@@ -1141,8 +1146,8 @@ var util = /*#__PURE__*/Object.freeze({
1141
1146
 
1142
1147
  /*!
1143
1148
  * Wunderbaum - types
1144
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1145
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
1149
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
1150
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
1146
1151
  */
1147
1152
  /**
1148
1153
  * Possible values for {@link WunderbaumNode.update} and {@link Wunderbaum.update}.
@@ -1166,7 +1171,7 @@ var ChangeType;
1166
1171
  /** Vertical scroll event. Update the 'top' property of all rows. */
1167
1172
  ChangeType["scroll"] = "scroll";
1168
1173
  })(ChangeType || (ChangeType = {}));
1169
- /* Internal use. */
1174
+ /** @internal */
1170
1175
  var RenderFlag;
1171
1176
  (function (RenderFlag) {
1172
1177
  RenderFlag["clearMarkup"] = "clearMarkup";
@@ -1197,16 +1202,20 @@ var NodeRegion;
1197
1202
  /** Initial navigation mode and possible transition. */
1198
1203
  var NavModeEnum;
1199
1204
  (function (NavModeEnum) {
1205
+ /** Start with row mode, but allow cell-nav mode */
1200
1206
  NavModeEnum["startRow"] = "startRow";
1207
+ /** Cell-nav mode only */
1201
1208
  NavModeEnum["cell"] = "cell";
1209
+ /** Start in cell-nav mode, but allow row mode */
1202
1210
  NavModeEnum["startCell"] = "startCell";
1211
+ /** Row mode only */
1203
1212
  NavModeEnum["row"] = "row";
1204
1213
  })(NavModeEnum || (NavModeEnum = {}));
1205
1214
 
1206
1215
  /*!
1207
1216
  * Wunderbaum - wb_extension_base
1208
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1209
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
1217
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
1218
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
1210
1219
  */
1211
1220
  class WunderbaumExtension {
1212
1221
  constructor(tree, id, defaults) {
@@ -1264,8 +1273,8 @@ class WunderbaumExtension {
1264
1273
 
1265
1274
  /*!
1266
1275
  * Wunderbaum - ext-filter
1267
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1268
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
1276
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
1277
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
1269
1278
  */
1270
1279
  const START_MARKER = "\uFFF7";
1271
1280
  const END_MARKER = "\uFFF8";
@@ -1397,7 +1406,7 @@ class FilterExtension extends WunderbaumExtension {
1397
1406
  };
1398
1407
  }
1399
1408
  tree.filterMode = opts.mode;
1400
- // eslint-disable-next-line prefer-rest-params, prefer-spread
1409
+ // eslint-disable-next-line prefer-rest-params
1401
1410
  this.lastFilterArgs = arguments;
1402
1411
  tree.element.classList.toggle("wb-ext-filter-hide", !!hideMode);
1403
1412
  tree.element.classList.toggle("wb-ext-filter-dim", !hideMode);
@@ -1589,8 +1598,8 @@ function _markFuzzyMatchedChars(text, matches, escapeTitles = true) {
1589
1598
 
1590
1599
  /*!
1591
1600
  * Wunderbaum - ext-keynav
1592
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1593
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
1601
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
1602
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
1594
1603
  */
1595
1604
  const QUICKSEARCH_DELAY = 500;
1596
1605
  class KeynavExtension extends WunderbaumExtension {
@@ -1953,8 +1962,8 @@ class KeynavExtension extends WunderbaumExtension {
1953
1962
 
1954
1963
  /*!
1955
1964
  * Wunderbaum - ext-logger
1956
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1957
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
1965
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
1966
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
1958
1967
  */
1959
1968
  class LoggerExtension extends WunderbaumExtension {
1960
1969
  constructor(tree) {
@@ -1995,8 +2004,8 @@ class LoggerExtension extends WunderbaumExtension {
1995
2004
 
1996
2005
  /*!
1997
2006
  * Wunderbaum - ext-dnd
1998
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1999
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
2007
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2008
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
2000
2009
  */
2001
2010
  const nodeMimeType = "application/x-wunderbaum-node";
2002
2011
  class DndExtension extends WunderbaumExtension {
@@ -2216,7 +2225,7 @@ class DndExtension extends WunderbaumExtension {
2216
2225
  viewportY >= height - sensitivity) {
2217
2226
  // Mouse in bottom 20px area: scroll down
2218
2227
  // sp.scrollTop = scrollTop + dndOpts.scrollSpeed;
2219
- this.currentScrollDir = +1;
2228
+ this.currentScrollDir = 1;
2220
2229
  }
2221
2230
  if (this.currentScrollDir) {
2222
2231
  this.applyScrollDirThrottled();
@@ -2445,8 +2454,8 @@ class DndExtension extends WunderbaumExtension {
2445
2454
 
2446
2455
  /*!
2447
2456
  * Wunderbaum - drag_observer
2448
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2449
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
2457
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2458
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
2450
2459
  */
2451
2460
  /**
2452
2461
  * Convert mouse- and touch events to 'dragstart', 'drag', and 'dragstop'.
@@ -2594,8 +2603,8 @@ class DragObserver {
2594
2603
 
2595
2604
  /*!
2596
2605
  * Wunderbaum - common
2597
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2598
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
2606
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2607
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
2599
2608
  */
2600
2609
  const DEFAULT_DEBUGLEVEL = 3; // Replaced by rollup script
2601
2610
  /**
@@ -2622,8 +2631,11 @@ const TEST_IMG = new RegExp(/\.|\//);
2622
2631
  // export const RECURSIVE_REQUEST_ERROR = "$recursive_request";
2623
2632
  // export const INVALID_REQUEST_TARGET_ERROR = "$request_target_invalid";
2624
2633
  /**
2625
- * Default node icons.
2626
- * Requires bootstrap icons https://icons.getbootstrap.com
2634
+ * Default node icons for icon libraries
2635
+ *
2636
+ * - 'bootstrap': {@link https://icons.getbootstrap.com}
2637
+ * - 'fontawesome6' {@link https://fontawesome.com/icons}
2638
+ *
2627
2639
  */
2628
2640
  const iconMaps = {
2629
2641
  bootstrap: {
@@ -2764,10 +2776,12 @@ function nodeTitleSorter(a, b) {
2764
2776
  /**
2765
2777
  * Convert 'flat' to 'nested' format.
2766
2778
  *
2767
- * Flat node entry format:
2768
- * [PARENT_ID, [POSITIONAL_ARGS]]
2769
- * or
2770
- * [PARENT_ID, [POSITIONAL_ARGS], {KEY_VALUE_ARGS}]
2779
+ * Flat node entry format:
2780
+ * [PARENT_IDX, {KEY_VALUE_ARGS}]
2781
+ * or, if N _positional re defined:
2782
+ * [PARENT_IDX, POSITIONAL_ARG_1, POSITIONAL_ARG_2, ..., POSITIONAL_ARG_N]
2783
+ * Even if _positional additional are defined, KEY_VALUE_ARGS can be appended:
2784
+ * [PARENT_IDX, POSITIONAL_ARG_1, ..., {KEY_VALUE_ARGS}]
2771
2785
  *
2772
2786
  * 1. Parent-referencing list is converted to a list of nested dicts with
2773
2787
  * optional `children` properties.
@@ -2776,10 +2790,11 @@ function nodeTitleSorter(a, b) {
2776
2790
  function unflattenSource(source) {
2777
2791
  var _a, _b, _c;
2778
2792
  const { _format, _keyMap = {}, _positional = [], children } = source;
2793
+ const _positionalCount = _positional.length;
2779
2794
  if (_format !== "flat") {
2780
2795
  throw new Error(`Expected source._format: "flat", but got ${_format}`);
2781
2796
  }
2782
- if (_positional && _positional.includes("children")) {
2797
+ if (_positionalCount && _positional.includes("children")) {
2783
2798
  throw new Error(`source._positional must not include "children": ${_positional}`);
2784
2799
  }
2785
2800
  let longToShort = _keyMap;
@@ -2793,7 +2808,7 @@ function unflattenSource(source) {
2793
2808
  longToShort[value] = key;
2794
2809
  }
2795
2810
  }
2796
- const positionalShort = _positional.map((e) => longToShort[e]);
2811
+ const positionalShort = _positional.map((e) => { var _a; return (_a = longToShort[e]) !== null && _a !== void 0 ? _a : e; });
2797
2812
  const newChildren = [];
2798
2813
  const keyToNodeMap = {};
2799
2814
  const indexToNodeMap = {};
@@ -2803,19 +2818,32 @@ function unflattenSource(source) {
2803
2818
  // Node entry format:
2804
2819
  // [PARENT_ID, [POSITIONAL_ARGS]]
2805
2820
  // or
2806
- // [PARENT_ID, [POSITIONAL_ARGS], {KEY_VALUE_ARGS}]
2807
- const [parentId, args, kwargs = {}] = nodeTuple;
2821
+ // [PARENT_ID, POSITIONAL_ARG_1, POSITIONAL_ARG_2, ..., {KEY_VALUE_ARGS}]
2822
+ let kwargs;
2823
+ const [parentId, ...args] = nodeTuple;
2824
+ if (args.length === _positionalCount) {
2825
+ kwargs = {};
2826
+ }
2827
+ else if (args.length === _positionalCount + 1) {
2828
+ kwargs = args.pop();
2829
+ if (typeof kwargs !== "object") {
2830
+ throw new Error(`unflattenSource: Expected dict as last tuple element: ${nodeTuple}`);
2831
+ }
2832
+ }
2833
+ else {
2834
+ throw new Error(`unflattenSource: unexpected tuple length: ${nodeTuple}`);
2835
+ }
2808
2836
  // Free up some memory as we go
2809
2837
  nodeTuple[1] = null;
2810
2838
  if (nodeTuple[2] != null) {
2811
2839
  nodeTuple[2] = null;
2812
2840
  }
2813
- // console.log("flatten", parentId, args, kwargs)
2814
2841
  // We keep `kwargs` as our new node definition. Then we add all positional
2815
2842
  // values to this object:
2816
2843
  args.forEach((val, positionalIdx) => {
2817
2844
  kwargs[positionalShort[positionalIdx]] = val;
2818
2845
  });
2846
+ args.length = 0;
2819
2847
  // Find the parent node. `null` means 'toplevel'. PARENT_ID may be the numeric
2820
2848
  // index of the source.children list. If PARENT_ID is a string, we search
2821
2849
  // a parent with node.key of this value.
@@ -2934,8 +2962,8 @@ function decompressSourceData(source) {
2934
2962
 
2935
2963
  /*!
2936
2964
  * Wunderbaum - ext-grid
2937
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2938
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
2965
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
2966
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
2939
2967
  */
2940
2968
  class GridExtension extends WunderbaumExtension {
2941
2969
  constructor(tree) {
@@ -3025,8 +3053,8 @@ class GridExtension extends WunderbaumExtension {
3025
3053
 
3026
3054
  /*!
3027
3055
  * Wunderbaum - deferred
3028
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
3029
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
3056
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
3057
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
3030
3058
  */
3031
3059
  /**
3032
3060
  * Implement a ES6 Promise, that exposes a resolve() and reject() method.
@@ -3078,8 +3106,8 @@ class Deferred {
3078
3106
 
3079
3107
  /*!
3080
3108
  * Wunderbaum - wunderbaum_node
3081
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
3082
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
3109
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
3110
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
3083
3111
  */
3084
3112
  /** WunderbaumNode properties that can be passed with source data.
3085
3113
  * (Any other source properties will be stored as `node.data.PROP`.)
@@ -5163,7 +5191,8 @@ class WunderbaumNode {
5163
5191
  case undefined:
5164
5192
  changed = this.selected || !this._partsel;
5165
5193
  this.selected = false;
5166
- this._partsel = true;
5194
+ // #110: end nodess cannot have a `_partsel` flag
5195
+ this._partsel = this.hasChildren() ? true : false;
5167
5196
  break;
5168
5197
  default:
5169
5198
  error(`Invalid state: ${state}`);
@@ -5624,8 +5653,8 @@ WunderbaumNode.sequence = 0;
5624
5653
 
5625
5654
  /*!
5626
5655
  * Wunderbaum - ext-edit
5627
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
5628
- * v0.12.0, Sun, 12 Jan 2025 10:51:41 GMT (https://github.com/mar10/wunderbaum)
5656
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
5657
+ * v0.12.1, Sat, 22 Feb 2025 22:59:20 GMT (https://github.com/mar10/wunderbaum)
5629
5658
  */
5630
5659
  // const START_MARKER = "\uFFF7";
5631
5660
  class EditExtension extends WunderbaumExtension {
@@ -5956,12 +5985,12 @@ class EditExtension extends WunderbaumExtension {
5956
5985
  *
5957
5986
  * A treegrid control.
5958
5987
  *
5959
- * Copyright (c) 2021-2024, Martin Wendt (https://wwWendt.de).
5988
+ * Copyright (c) 2021-2025, Martin Wendt (https://wwWendt.de).
5960
5989
  * https://github.com/mar10/wunderbaum
5961
5990
  *
5962
5991
  * Released under the MIT license.
5963
- * @version v0.12.0
5964
- * @date Sun, 12 Jan 2025 10:51:41 GMT
5992
+ * @version v0.12.1
5993
+ * @date Sat, 22 Feb 2025 22:59:20 GMT
5965
5994
  */
5966
5995
  // import "./wunderbaum.scss";
5967
5996
  class WbSystemRoot extends WunderbaumNode {
@@ -5982,7 +6011,7 @@ class WbSystemRoot extends WunderbaumNode {
5982
6011
  */
5983
6012
  class Wunderbaum {
5984
6013
  /** Currently active node if any.
5985
- * Use @link {WunderbaumNode.setActive|setActive} to modify.
6014
+ * Use {@link WunderbaumNode.setActive|setActive} to modify.
5986
6015
  */
5987
6016
  get activeNode() {
5988
6017
  var _a;
@@ -5990,7 +6019,7 @@ class Wunderbaum {
5990
6019
  return ((_a = this._activeNode) === null || _a === void 0 ? void 0 : _a.tree) ? this._activeNode : null;
5991
6020
  }
5992
6021
  /** Current node hat has keyboard focus if any.
5993
- * Use @link {WunderbaumNode.setFocus|setFocus()} to modify.
6022
+ * Use {@link WunderbaumNode.setFocus|setFocus()} to modify.
5994
6023
  */
5995
6024
  get focusNode() {
5996
6025
  var _a;
@@ -6140,7 +6169,7 @@ class Wunderbaum {
6140
6169
  const wantHeader = opts.header == null ? this.columns.length > 1 : !!opts.header;
6141
6170
  if (this.headerElement) {
6142
6171
  // User existing header markup to define `this.columns`
6143
- assert(!this.columns, "`opts.columns` must not be set if markup already contains a header");
6172
+ assert(!this.columns, "`opts.columns` must not be set if table markup already contains a header");
6144
6173
  this.columns = [];
6145
6174
  const rowElement = this.headerElement.querySelector("div.wb-row");
6146
6175
  for (const colDiv of rowElement.querySelectorAll("div")) {
@@ -6188,8 +6217,7 @@ class Wunderbaum {
6188
6217
  // --- Load initial data
6189
6218
  if (opts.source) {
6190
6219
  if (opts.showSpinner) {
6191
- this.nodeListElement.innerHTML =
6192
- "<progress class='spinner'>loading...</progress>";
6220
+ this.nodeListElement.innerHTML = `<progress class='spinner'>${opts.strings.loading}</progress>`;
6193
6221
  }
6194
6222
  this.load(opts.source)
6195
6223
  .then(() => {
@@ -7984,8 +8012,9 @@ class Wunderbaum {
7984
8012
  // this.debug("render", opts);
7985
8013
  const obsoleteNodes = new Set();
7986
8014
  this.nodeListElement.childNodes.forEach((elem) => {
7987
- const tr = elem;
7988
- obsoleteNodes.add(tr._wb_node);
8015
+ if (elem._wb_node) {
8016
+ obsoleteNodes.add(elem._wb_node);
8017
+ }
7989
8018
  });
7990
8019
  let idx = 0;
7991
8020
  let top = 0;
@@ -8286,7 +8315,7 @@ class Wunderbaum {
8286
8315
  }
8287
8316
  Wunderbaum.sequence = 0;
8288
8317
  /** Wunderbaum release version number "MAJOR.MINOR.PATCH". */
8289
- Wunderbaum.version = "v0.12.0"; // Set to semver by 'grunt release'
8318
+ Wunderbaum.version = "v0.12.1"; // Set to semver by 'grunt release'
8290
8319
  /** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
8291
8320
  Wunderbaum.util = util;
8292
8321