wunderbaum 0.11.0 → 0.12.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
@@ -7,12 +7,11 @@
7
7
  [![Released with: grunt-yabs](https://img.shields.io/badge/released%20with-grunt--yabs-yellowgreen)](https://github.com/mar10/grunt-yabs)
8
8
  [![StackOverflow: wunderbaum](https://img.shields.io/badge/StackOverflow-wunderbaum-blue.svg)](https://stackoverflow.com/questions/tagged/wunderbaum)
9
9
 
10
- <!-- [![Build Status](https://travis-ci.com/mar10/wunderbaum.svg?branch=main)](https://travis-ci.com/github/mar10/wunderbaum) -->
10
+ > A modern tree/treegrid control for the web.
11
11
 
12
- > A modern tree/treegrid control for the web. <br>
13
- > Potential successor of [Fancytree](https://github.com/mar10/fancytree).
14
-
15
- **Status _beta_:<br>API, Markup, Stylesheet, etc. are still subject to change.**
12
+ Designated successor of [Fancytree](https://github.com/mar10/fancytree).<br>
13
+ See the [upgrade guide](https://mar10.github.io/wunderbaum/tutorial/migrate/#what-has-changed)
14
+ for details.
16
15
 
17
16
  [![Demo](https://mar10.github.io/wunderbaum/assets/teaser_2.png)](https://mar10.github.io/wunderbaum/demo/)
18
17
 
@@ -16,22 +16,22 @@
16
16
  --wb-alternate-row-color: #f7f7f7;
17
17
  --wb-alternate-row-color-hover: #f3f3f3;
18
18
  --wb-focus-border-color: #275dc5;
19
- --wb-drop-source-color: #d3d2ce;
20
- --wb-drop-target-color: #d4ecf8;
21
- --wb-dim-color: #8c877c;
22
- --wb-error-background-color: #f5ddde;
23
- --wb-hover-color: #f7fcfe;
24
- --wb-hover-border-color: #f7fcfe;
19
+ --wb-drop-source-color: rgb(211.3703703704, 209.6481481481, 205.6296296296);
20
+ --wb-drop-target-color: rgb(212.2834645669, 236.2992125984, 247.7165354331);
21
+ --wb-dim-color: rgb(139.5925925926, 135.037037037, 124.4074074074);
22
+ --wb-error-background-color: rgb(244.6292372881, 220.8707627119, 221.625);
23
+ --wb-hover-color: rgb(247.1401574803, 251.5590551181, 253.6598425197);
24
+ --wb-hover-border-color: rgb(247.1401574803, 251.5590551181, 253.6598425197);
25
25
  --wb-grid-color: #dedede;
26
26
  --wb-active-color: #e5f3fb;
27
- --wb-active-cell-color: #7dc6e9;
27
+ --wb-active-cell-color: rgb(125.1417322835, 198.1496062992, 232.8582677165);
28
28
  --wb-active-border-color: #70c0e7;
29
29
  --wb-active-hover-color: #dceff8;
30
30
  --wb-active-hover-border-color: #26a0da;
31
- --wb-active-column-color: #f7fcfe;
32
- --wb-active-header-column-color: #c5c5c5;
31
+ --wb-active-column-color: rgb(247.1401574803, 251.5590551181, 253.6598425197);
32
+ --wb-active-header-column-color: rgb(196.5, 196.5, 196.5);
33
33
  --wb-active-color-grayscale: #f0f0f0;
34
- --wb-active-border-color-grayscale: #acacac;
34
+ --wb-active-border-color-grayscale: rgb(171.5, 171.5, 171.5);
35
35
  --wb-active-hover-color-grayscale: #eaeaea;
36
36
  --wb-active-cell-color-grayscale: #b3b3b3;
37
37
  --wb-grid-color-grayscale: #dedede;
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["../src/wunderbaum.scss"],"names":[],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AA2EA;AAAA;EAME;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAMF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EAGA;AAsBA;AAyBA;AAwRA;AAoHA;AA8BA;AAgEA;AAEA;AAUA;AAoBA;AAYA;;AAjkBA;EAEE;;AAIF;EACE;EACA;;AAGF;EACE;EAEA;;AAMF;EACE;EACA;EACA;EACA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EAGE;EACA;EAGA;EACA;EACA;;AAgBR;AAAA;EAIE;EACA;EACA;;AAKF;EACE;;AAUE;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAOJ;EAIE;EACA;;AAGF;AAAA;EAKE;EACA;;AAMF;AAAA;EAEE;EACA;EACA;EACA;;AAOF;EACE;;AAGF;AAAA;EAEE;;AAKA;EACE;;;AAMR;AAEA;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;;AAQJ;AACA;AAAA;EAEE;;;AAGF;AAAA;EAEE;;;AAIA;AAAA;EAEE;;AAGF;AAAA;EAEE;;;AAIJ;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;;;AAIJ;AAAA;AAAA;AAMA;EACE;EACA;;;AAGF;EAGE;;;AAGF;EACE;;;AAKF;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE","file":"wunderbaum.css"}
1
+ {"version":3,"sourceRoot":"","sources":["../src/wunderbaum.scss"],"names":[],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AA6EA;AAAA;EAME;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAMF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EAGA;AAsBA;AAyBA;AAwRA;AAoHA;AA8BA;AAgEA;AAEA;AAUA;AAoBA;AAYA;;AAjkBA;EAEE;;AAIF;EACE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J;EACE;;AAEA;EACE;EACA;;AAGA;EACE;EACA;;AAEA;EAGE;EACA;EAGA;EACA;EACA;;AAgBR;AAAA;EAIE;EACA;EACA;;AAKF;EACE;;AAUE;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAOJ;EAIE;EACA;;AAGF;AAAA;EAKE;EACA;;AAMF;AAAA;EAEE;EACA;EACA;EACA;;AAOF;EACE;;AAGF;AAAA;EAEE;;AAKA;EACE;;;AAMR;AAEA;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;;AAQJ;AACA;AAAA;EAEE;;;AAGF;AAAA;EAEE;;;AAIA;AAAA;EAEE;;AAGF;AAAA;EAEE;;;AAIJ;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;;;AAIJ;AAAA;AAAA;AAMA;EACE;EACA;;;AAGF;EAGE;;;AAGF;EACE;;;AAKF;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE","file":"wunderbaum.css"}
@@ -293,7 +293,7 @@ declare module "util" {
293
293
  */
294
294
  export function extend(...args: any[]): any;
295
295
  /** Return true if `obj` is of type `array`. */
296
- export function isArray(obj: any): boolean;
296
+ export function isArray(obj: any): obj is any[];
297
297
  /** Return true if `obj` is of type `Object` and has no properties. */
298
298
  export function isEmptyObject(obj: any): boolean;
299
299
  /** Return true if `obj` is of type `function`. */
@@ -396,6 +396,13 @@ declare module "util" {
396
396
  * ```
397
397
  */
398
398
  export function toBool(...boolDefaults: (boolean | undefined | null)[]): boolean;
399
+ /**
400
+ * Return `val` unless `val` is a number in which case we convert to boolean.
401
+ * This is useful when a boolean value is stored as a 0/1 (e.g. in JSON) and
402
+ * we still want to maintain string values. null and undefined are returned as
403
+ * is. E.g. `checkbox` may be boolean or 'radio'.
404
+ */
405
+ export function intToBool(val: boolean | number | string | undefined): boolean | string | undefined;
399
406
  /** Return a canonical string representation for an object's type (e.g. 'array', 'number', ...). */
400
407
  export function type(obj: any): string;
401
408
  /**
@@ -424,7 +431,7 @@ declare module "common" {
424
431
  /**
425
432
  * Fixed height of a row in pixel. Must match the SCSS variable `$row-outer-height`.
426
433
  */
427
- export const ROW_HEIGHT = 22;
434
+ export const DEFAULT_ROW_HEIGHT = 22;
428
435
  /**
429
436
  * Fixed width of node icons in pixel. Must match the SCSS variable `$icon-outer-width`.
430
437
  */
@@ -588,7 +595,9 @@ declare module "wb_node" {
588
595
  */
589
596
  type?: string;
590
597
  /** Tooltip definition (`true`: use node's title). */
591
- tooltip?: string | boolean;
598
+ tooltip?: TooltipOption;
599
+ /** Icon tooltip definition (`true`: use node's title). */
600
+ iconTooltip?: TooltipOption;
592
601
  /** Additional classes added to `div.wb-row`.
593
602
  * @see {@link hasClass}, {@link setClass}. */
594
603
  classes: Set<string> | null;
@@ -672,7 +681,14 @@ declare module "wb_node" {
672
681
  setClass(className: string | string[] | Set<string>, flag?: boolean): void;
673
682
  /** Start editing this node's title. */
674
683
  startEditTitle(): void;
675
- /** Call `setExpanded()` on all descendant nodes. */
684
+ /**
685
+ * Call `setExpanded()` on all descendant nodes.
686
+ *
687
+ * @param flag true to expand, false to collapse.
688
+ * @param options Additional options.
689
+ * @see {@link Wunderbaum.expandAll}
690
+ * @see {@link WunderbaumNode.setExpanded}
691
+ */
676
692
  expandAll(flag?: boolean, options?: ExpandAllOptions): Promise<void>;
677
693
  /**
678
694
  * Find all descendant nodes that match condition (excluding self).
@@ -1552,7 +1568,7 @@ declare module "types" {
1552
1568
  colspan?: boolean;
1553
1569
  expanded?: boolean;
1554
1570
  icon?: IconOption;
1555
- iconTooltip?: boolean | string;
1571
+ iconTooltip?: TooltipOption;
1556
1572
  key?: string;
1557
1573
  lazy?: boolean;
1558
1574
  /** Make child nodes single-select radio buttons. */
@@ -1561,7 +1577,7 @@ declare module "types" {
1561
1577
  selected?: boolean;
1562
1578
  statusNodeType?: NodeStatusType;
1563
1579
  title: string;
1564
- tooltip?: boolean | string;
1580
+ tooltip?: TooltipOption;
1565
1581
  type?: string;
1566
1582
  unselectable?: boolean;
1567
1583
  /** @internal */
@@ -1737,8 +1753,8 @@ declare module "types" {
1737
1753
  colspan?: boolean;
1738
1754
  /** Default icon for matching nodes. */
1739
1755
  icon?: IconOption;
1740
- /** Default icon for matching nodes. */
1741
- iconTooltip?: string | boolean;
1756
+ /** Default icon tooltip for matching nodes. */
1757
+ iconTooltip?: TooltipOption;
1742
1758
  [key: string]: unknown;
1743
1759
  }
1744
1760
  export type NodeTypeDefinitionMap = {
@@ -1946,12 +1962,34 @@ declare module "types" {
1946
1962
  }
1947
1963
  /** Possible values for {@link Wunderbaum.expandAll} and {@link WunderbaumNode.expandAll}. */
1948
1964
  export interface ExpandAllOptions {
1949
- /** Restrict expand level @default 99 */
1950
- depth?: number;
1951
1965
  /** Expand and load lazy nodes @default false */
1952
1966
  loadLazy?: boolean;
1953
- /** Ignore `minExpandLevel` option @default false */
1967
+ /** Unload lazily loaded children if any (if collapsing). @default false */
1968
+ resetLazy?: boolean;
1969
+ /** Ignore tree's `minExpandLevel` option @default false */
1954
1970
  force?: boolean;
1971
+ /** Restrict expand level.
1972
+ * Pass 0 to make only toplevel nodes visible, 1 to expand one level deeper, etc.
1973
+ * @default unset (unlimited)
1974
+ */
1975
+ depth?: number;
1976
+ /**
1977
+ * Also collapse child nodes beyond the `depth` level.
1978
+ * Otherwise only the `depth` level is collapsed and the expand state of the
1979
+ * descendants is retained.
1980
+ * Only in combination with collapse and `depth`.
1981
+ * Expanding with `deep` option is not supported as recursion depth implied by
1982
+ * the `depth` option. However a `deep` option will be considered if
1983
+ * `collapseOthers` is set.
1984
+ * @default false
1985
+ */
1986
+ deep?: boolean;
1987
+ /**
1988
+ * Expand up to level=depth and collapse all other branches.
1989
+ * Only in combination with `flag == true`, `depth > 0`.
1990
+ * @default false
1991
+ */
1992
+ collapseOthers?: boolean;
1955
1993
  /** Keep active node visible @default true */
1956
1994
  keepActiveNodeVisible?: boolean;
1957
1995
  }
@@ -2062,7 +2100,7 @@ declare module "types" {
2062
2100
  }
2063
2101
  /** Possible values for {@link WunderbaumNode.setExpanded} `options` argument. */
2064
2102
  export interface SetExpandedOptions {
2065
- /** Ignore {@link WunderbaumOptions.minExpandLevel}. @default false */
2103
+ /** Ignore {@link WunderbaumOptions}.minExpandLevel. @default false */
2066
2104
  force?: boolean;
2067
2105
  /** Immediately update viewport (async otherwise). @default false */
2068
2106
  immediate?: boolean;
@@ -2070,6 +2108,8 @@ declare module "types" {
2070
2108
  noAnimation?: boolean;
2071
2109
  /** Do not send events. @default false */
2072
2110
  noEvents?: boolean;
2111
+ /** Unload lazily loaded children if any (if collapsing). @default false */
2112
+ resetLazy?: boolean;
2073
2113
  /** Scroll up to bring expanded nodes into viewport. @default false */
2074
2114
  scrollIntoView?: boolean;
2075
2115
  }