wunderbaum 0.11.1 → 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,9 +1,11 @@
1
1
  /*!
2
2
  * Wunderbaum style sheet (generated from wunderbaum.scss)
3
- * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
3
+ * Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
4
4
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
5
5
  */
6
6
  // @use "sass:meta";
7
+ @use "sass:color";
8
+ @use "sass:list";
7
9
 
8
10
  // ----------------------------------------------------------------------------
9
11
  // --- Define default colors and settings
@@ -22,26 +24,26 @@ $alternate-row-color-hover: #f3f3f3; //#f7fcfe;
22
24
  $focus-border-color: #275dc5;
23
25
 
24
26
  // derived
25
- $drop-source-color: adjust-color($node-text-color, $lightness: 50%);
26
- $drop-target-color: adjust-color($bg-highlight-color, $lightness: 40%);
27
- $dim-color: adjust-color($node-text-color, $lightness: 20%);
28
- $error-background-color: adjust-color($error-color, $lightness: 45%);
27
+ $drop-source-color: color.adjust($node-text-color, $lightness: 50%);
28
+ $drop-target-color: color.adjust($bg-highlight-color, $lightness: 40%);
29
+ $dim-color: color.adjust($node-text-color, $lightness: 20%);
30
+ $error-background-color: color.adjust($error-color, $lightness: 45%);
29
31
  // @debug $dim-color;
30
- $hover-color: adjust-color($bg-highlight-color, $lightness: 48%); // #f7f7f7;
32
+ $hover-color: color.adjust($bg-highlight-color, $lightness: 48%); // #f7f7f7;
31
33
  $hover-border-color: $hover-color;
32
34
  $grid-color: #dedede;
33
35
  $active-color: #e5f3fb;
34
- $active-cell-color: adjust-color($bg-highlight-color, $lightness: 20%);
36
+ $active-cell-color: color.adjust($bg-highlight-color, $lightness: 20%);
35
37
  $active-border-color: #70c0e7;
36
38
  $active-hover-color: #dceff8;
37
39
  $active-hover-border-color: $bg-highlight-color;
38
40
  $active-column-color: $hover-color;
39
- $active-header-column-color: adjust-color($header-color, $lightness: -10%);
40
- $active-color-grayscale: grayscale($active-color);
41
- $active-border-color-grayscale: grayscale($active-border-color);
42
- $active-hover-color-grayscale: grayscale($active-hover-color);
43
- $active-cell-color-grayscale: grayscale($active-cell-color);
44
- $grid-color-grayscale: grayscale($grid-color);
41
+ $active-header-column-color: color.adjust($header-color, $lightness: -10%);
42
+ $active-color-grayscale: color.grayscale($active-color);
43
+ $active-border-color-grayscale: color.grayscale($active-border-color);
44
+ $active-hover-color-grayscale: color.grayscale($active-hover-color);
45
+ $active-cell-color-grayscale: color.grayscale($active-cell-color);
46
+ $grid-color-grayscale: color.grayscale($grid-color);
45
47
  // @debug $active-header-column-color;
46
48
  $filter-dim-color: #dedede;
47
49
  $filter-submatch-color: #868581;
@@ -67,8 +69,8 @@ $header-height: $row-outer-height;
67
69
  // $level-rainbow: rgba(255, 255, 64, 0.07), rgba(127, 255, 127, 0.07),
68
70
  // rgba(255, 127, 255, 0.07), rgba(79, 236, 236, 0.07);
69
71
  // Slightly stronger*
70
- $level-rainbow: rgb(255, 255, 201), rgb(218, 255, 218), rgb(255, 217, 254),
71
- rgb(204, 250, 250);
72
+ $level-rainbow:
73
+ rgb(255, 255, 201), rgb(218, 255, 218), rgb(255, 217, 254), rgb(204, 250, 250);
72
74
 
73
75
  // ----------------------------------------------------------------------------
74
76
  // --- Define CSS variables with calculated default values
@@ -696,10 +698,10 @@ div.wunderbaum {
696
698
 
697
699
  /* Colorize indentation levels. */
698
700
  &.wb-rainbow {
699
- @for $i from 1 through length($level-rainbow) {
700
- i.wb-expander:nth-child(#{length($level-rainbow)}n + #{$i}),
701
- i.wb-indent:nth-child(#{length($level-rainbow)}n + #{$i}) {
702
- background: nth($level-rainbow, $i);
701
+ @for $i from 1 through list.length($level-rainbow) {
702
+ i.wb-expander:nth-child(#{list.length($level-rainbow)}n + #{$i}),
703
+ i.wb-indent:nth-child(#{list.length($level-rainbow)}n + #{$i}) {
704
+ background: list.nth($level-rainbow, $i);
703
705
  }
704
706
  }
705
707
  }
package/src/wunderbaum.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * A treegrid control.
5
5
  *
6
- * Copyright (c) 2021-2024, Martin Wendt (https://wwWendt.de).
6
+ * Copyright (c) 2021-2025, Martin Wendt (https://wwWendt.de).
7
7
  * https://github.com/mar10/wunderbaum
8
8
  *
9
9
  * Released under the MIT license.
@@ -125,14 +125,14 @@ export class Wunderbaum {
125
125
  protected _focusNode: WunderbaumNode | null = null;
126
126
 
127
127
  /** Currently active node if any.
128
- * Use @link {WunderbaumNode.setActive|setActive} to modify.
128
+ * Use {@link WunderbaumNode.setActive|setActive} to modify.
129
129
  */
130
130
  public get activeNode() {
131
131
  // Check for deleted node, i.e. node.tree === null
132
132
  return this._activeNode?.tree ? this._activeNode : null;
133
133
  }
134
134
  /** Current node hat has keyboard focus if any.
135
- * Use @link {WunderbaumNode.setFocus|setFocus()} to modify.
135
+ * Use {@link WunderbaumNode.setFocus|setFocus()} to modify.
136
136
  */
137
137
  public get focusNode() {
138
138
  // Check for deleted node, i.e. node.tree === null
@@ -319,7 +319,7 @@ export class Wunderbaum {
319
319
  // User existing header markup to define `this.columns`
320
320
  util.assert(
321
321
  !this.columns,
322
- "`opts.columns` must not be set if markup already contains a header"
322
+ "`opts.columns` must not be set if table markup already contains a header"
323
323
  );
324
324
  this.columns = [];
325
325
  const rowElement =
@@ -380,8 +380,7 @@ export class Wunderbaum {
380
380
  // --- Load initial data
381
381
  if (opts.source) {
382
382
  if (opts.showSpinner) {
383
- this.nodeListElement.innerHTML =
384
- "<progress class='spinner'>loading...</progress>";
383
+ this.nodeListElement.innerHTML = `<progress class='spinner'>${opts.strings.loading}</progress>`;
385
384
  }
386
385
  this.load(opts.source)
387
386
  .then(() => {
@@ -498,7 +497,12 @@ export class Wunderbaum {
498
497
  ) {
499
498
  return false;
500
499
  }
501
- if (node && info.colIdx === 0 && node.isExpandable()) {
500
+ if (
501
+ node &&
502
+ info.colIdx === 0 &&
503
+ node.isExpandable() &&
504
+ info.region !== NodeRegion.expander
505
+ ) {
502
506
  this._callMethod("edit._stopEditTitle");
503
507
  node.setExpanded(!node.isExpanded());
504
508
  }
@@ -2395,8 +2399,9 @@ export class Wunderbaum {
2395
2399
  // this.debug("render", opts);
2396
2400
  const obsoleteNodes = new Set<WunderbaumNode>();
2397
2401
  this.nodeListElement.childNodes.forEach((elem) => {
2398
- const tr = elem as HTMLTableRowElement;
2399
- obsoleteNodes.add((<any>tr)._wb_node);
2402
+ if ((<any>elem)._wb_node) {
2403
+ obsoleteNodes.add((<any>elem)._wb_node);
2404
+ }
2400
2405
  });
2401
2406
 
2402
2407
  let idx = 0;