wunderbaum 0.8.4 → 0.10.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.
@@ -1,7 +1,7 @@
1
1
  @charset "UTF-8";
2
2
  /*!
3
3
  * Wunderbaum style sheet (generated from wunderbaum.scss)
4
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
4
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
5
5
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
6
6
  */
7
7
  :root,
@@ -94,6 +94,8 @@ div.wunderbaum div.wb-header {
94
94
  position: sticky;
95
95
  top: 0;
96
96
  z-index: 2;
97
+ user-select: none;
98
+ -webkit-user-select: none; /* Safari */
97
99
  }
98
100
  div.wunderbaum div.wb-header,
99
101
  div.wunderbaum div.wb-list-container {
@@ -202,6 +204,10 @@ div.wunderbaum div.wb-header span.wb-col-resizer {
202
204
  border: none;
203
205
  border-right: 2px solid var(--wb-border-color);
204
206
  height: 100%;
207
+ user-select: none;
208
+ -webkit-user-select: none;
209
+ }
210
+ div.wunderbaum div.wb-header span.wb-col-resizer.wb-col-resizer-active {
205
211
  cursor: col-resize;
206
212
  }
207
213
  div.wunderbaum span.wb-col {
@@ -219,6 +225,7 @@ div.wunderbaum span.wb-col:last-of-type {
219
225
  }
220
226
  div.wunderbaum span.wb-node {
221
227
  user-select: none;
228
+ -webkit-user-select: none;
222
229
  /* Fix Bootstrap Icon alignment */
223
230
  }
224
231
  div.wunderbaum span.wb-node i.wb-checkbox,
@@ -333,6 +340,9 @@ div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row.wb-submatch, div.wu
333
340
  div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row.wb-match, div.wunderbaum.wb-ext-filter-hide div.wb-node-list div.wb-row.wb-match {
334
341
  color: var(--wb-node-text-color);
335
342
  }
343
+ div.wunderbaum.wb-ext-filter-hide.wb-ext-filter-hide-expanders div.wb-node-list div.wb-row:not(.wb-submatch) i.wb-expander {
344
+ visibility: hidden;
345
+ }
336
346
  div.wunderbaum div.wb-row.wb-drag-source {
337
347
  opacity: 0.5;
338
348
  }
@@ -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;AAuBA;AAwQA;AAoHA;AAwBA;AAgEA;AAEA;AAUA;AAoBA;AAYA;;AAziBA;EAEE;;AAIF;EACE;EACA;;AAGF;EACE;EAEA;;AAMF;EACE;EACA;EACA;;AAGF;AAAA;EAEE;;AAKF;EACE;EACA;EACA;EACA;EACA;;AAMA;EACE;EACA;EACA;EACA;;AAIA;EACE;;AAKF;EAEE;;AAGF;EAEE;;AAGF;EACE;;AAOA;EAEE;EACA;;AAEA;EACE;;AAaN;EAEE;EACA;;AAEA;EACE;;AAON;EACE;;AAEA;EACE;;AAOF;EACE;;AAGF;EAEE;;AAGA;EACE;;AAKJ;EACE;EACA;;AAGF;EAEE;EACA;;AAEA;EAEE;;AAIJ;EACE;;AAGF;AAAA;AAAA;EAGE;EAcA;EASA;;AAGF;EAEE;;AAON;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EAIA;;AAIF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;;AAIJ;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAIJ;EACE;AAqBA;;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E;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;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;AA8QA;AAoHA;AA8BA;AAgEA;AAEA;AAUA;AAoBA;AAYA;;AAvjBA;EAEE;;AAIF;EACE;EACA;;AAGF;EACE;EAEA;;AAMF;EACE;EACA;EACA;EACA;EACA;;AAGF;AAAA;EAEE;;AAKF;EACE;EACA;EACA;EACA;EACA;;AAMA;EACE;EACA;EACA;EACA;;AAIA;EACE;;AAKF;EAEE;;AAGF;EAEE;;AAGF;EACE;;AAOA;EAEE;EACA;;AAEA;EACE;;AAaN;EAEE;EACA;;AAEA;EACE;;AAON;EACE;;AAEA;EACE;;AAOF;EACE;;AAGF;EAEE;;AAGA;EACE;;AAKJ;EACE;EACA;;AAGF;EAEE;EACA;;AAEA;EAEE;;AAIJ;EACE;;AAGF;AAAA;AAAA;EAGE;EAcA;EASA;;AAGF;EAEE;;AAON;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EAIA;;AAIF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAMN;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAIJ;EACE;EACA;AAqBA;;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ACE;;;AAKF;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE","file":"wunderbaum.css"}
@@ -6,12 +6,17 @@ declare module "debounce" {
6
6
  */
7
7
  type Procedure = (...args: any[]) => any;
8
8
  type DebounceOptions = {
9
+ /** Specify invoking on the leading edge of the timeout. @default false */
9
10
  leading?: boolean;
11
+ /** The maximum time `func` is allowed to be delayed before it's invoked.*/
10
12
  maxWait?: number;
13
+ /** Specify invoking on the trailing edge of the timeout. @default true */
11
14
  trailing?: boolean;
12
15
  };
13
16
  type ThrottleOptions = {
17
+ /** Specify invoking on the leading edge of the timeout. @default true */
14
18
  leading?: boolean;
19
+ /** Specify invoking on the trailing edge of the timeout. @default true */
15
20
  trailing?: boolean;
16
21
  };
17
22
  export interface DebouncedFunction<F extends Procedure> {
@@ -51,13 +56,7 @@ declare module "debounce" {
51
56
  * @param {number} [wait=0]
52
57
  * The number of milliseconds to delay; if omitted, `requestAnimationFrame` is
53
58
  * used (if available).
54
- * @param {Object} [options={}] The options object.
55
- * @param {boolean} [options.leading=false]
56
- * Specify invoking on the leading edge of the timeout.
57
- * @param {number} [options.maxWait]
58
- * The maximum time `func` is allowed to be delayed before it's invoked.
59
- * @param {boolean} [options.trailing=true]
60
- * Specify invoking on the trailing edge of the timeout.
59
+ * @param [options={}] The options object.
61
60
  * @returns {Function} Returns the new debounced function.
62
61
  * @example
63
62
  *
@@ -112,11 +111,7 @@ declare module "debounce" {
112
111
  * @param {number} [wait=0]
113
112
  * The number of milliseconds to throttle invocations to; if omitted,
114
113
  * `requestAnimationFrame` is used (if available).
115
- * @param {Object} [options={}] The options object.
116
- * @param {boolean} [options.leading=true]
117
- * Specify invoking on the leading edge of the timeout.
118
- * @param {boolean} [options.trailing=true]
119
- * Specify invoking on the trailing edge of the timeout.
114
+ * @param [options={}] The options object.
120
115
  * @returns {Function} Returns the new throttled function.
121
116
  * @example
122
117
  *
@@ -135,7 +130,7 @@ declare module "debounce" {
135
130
  declare module "util" {
136
131
  /*!
137
132
  * Wunderbaum - util
138
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
133
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
139
134
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
140
135
  */
141
136
  /** @module util */
@@ -189,7 +184,7 @@ declare module "util" {
189
184
  * Iterate over Object properties or array elements.
190
185
  *
191
186
  * @param obj `Object`, `Array` or null
192
- * @param callback(index, item) called for every item.
187
+ * @param callback called for every item.
193
188
  * `this` also contains the item.
194
189
  * Return `false` to stop the iteration.
195
190
  */
@@ -310,7 +305,7 @@ declare module "util" {
310
305
  /**
311
306
  * Bind one or more event handlers directly to an [EventTarget](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget).
312
307
  *
313
- * @param element EventTarget or selector
308
+ * @param rootTarget EventTarget or selector
314
309
  * @param eventNames
315
310
  * @param handler
316
311
  */
@@ -326,7 +321,7 @@ declare module "util" {
326
321
  * });
327
322
  * ```
328
323
  *
329
- * @param element EventTarget or selector
324
+ * @param rootTarget EventTarget or selector
330
325
  * @param eventNames
331
326
  * @param selector
332
327
  * @param handler
@@ -379,6 +374,24 @@ declare module "util" {
379
374
  export function getOption(opts: any, name: string, defaultValue?: any): any;
380
375
  /** Convert an Array or space-separated string to a Set. */
381
376
  export function toSet(val: any): Set<string>;
377
+ /** Convert a pixel string to number.
378
+ * We accept a number or a string like '123px'. If undefined, the first default
379
+ * value that is a number or a string ending with 'px' is returned.
380
+ *
381
+ * Example:
382
+ * ```js
383
+ * const width = util.toPixel("123px", 100);
384
+ * ```
385
+ */
386
+ export function toPixel(...defaults: (string | number | undefined | null)[]): number;
387
+ /** Evaluate a boolean value using default if undefined.
388
+ * Example:
389
+ * ```js
390
+ * const opts = { flag: true };
391
+ * const value = util.toBool(opts.flag, otherVar, false);
392
+ * ```
393
+ */
394
+ export function toBool(...boolDefaults: (boolean | undefined | null)[]): boolean;
382
395
  /** Return a canonical string representation for an object's type (e.g. 'array', 'number', ...). */
383
396
  export function type(obj: any): string;
384
397
  /**
@@ -398,7 +411,7 @@ declare module "util" {
398
411
  declare module "common" {
399
412
  /*!
400
413
  * Wunderbaum - common
401
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
414
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
402
415
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
403
416
  */
404
417
  import { MatcherCallback, SourceObjectType } from "types";
@@ -421,6 +434,8 @@ declare module "common" {
421
434
  export const RENDER_MAX_PREFETCH = 5;
422
435
  /** Skip rendering new rows when we have at least N nodes rendeed above and below the viewport. */
423
436
  export const RENDER_MIN_PREFETCH = 5;
437
+ /** Minimum column width if not set otherwise. */
438
+ export const DEFAULT_MIN_COL_WIDTH = 4;
424
439
  /** Regular expression to detect if a string describes an image URL (in contrast
425
440
  * to a class name). Strings are considered image urls if they contain '.' or '/'.
426
441
  */
@@ -470,7 +485,7 @@ declare module "common" {
470
485
  declare module "deferred" {
471
486
  /*!
472
487
  * Wunderbaum - deferred
473
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
488
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
474
489
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
475
490
  */
476
491
  type PromiseCallbackType = (val: any) => void;
@@ -728,7 +743,7 @@ declare module "wb_node" {
728
743
  getParentList(includeRoot?: boolean, includeSelf?: boolean): any[];
729
744
  /** Return a string representing the hierachical node path, e.g. "a/b/c".
730
745
  * @param includeSelf
731
- * @param node property name or callback
746
+ * @param part property name or callback
732
747
  * @param separator
733
748
  */
734
749
  getPath(includeSelf?: boolean, part?: keyof WunderbaumNode | NodeAnyCallback, separator?: string): string;
@@ -740,6 +755,8 @@ declare module "wb_node" {
740
755
  hasChildren(): boolean;
741
756
  /** Return true if node has className set. */
742
757
  hasClass(className: string): boolean;
758
+ /** Return true if node ist the currently focused node. */
759
+ hasFocus(): boolean;
743
760
  /** Return true if this node is the currently active tree node. */
744
761
  isActive(): boolean;
745
762
  /** Return true if this node is a direct or indirect parent of `other`.
@@ -768,7 +785,7 @@ declare module "wb_node" {
768
785
  isExpandable(andCollapsed?: boolean): boolean;
769
786
  /** Return true if _this_ node is currently in edit-title mode.
770
787
  *
771
- * See {@link Wunderbaum.startEditTitle} to check if any node is currently edited.
788
+ * See {@link WunderbaumNode.startEditTitle}.
772
789
  */
773
790
  isEditingTitle(): boolean;
774
791
  /** Return true if this node is currently expanded. */
@@ -899,8 +916,8 @@ declare module "wb_node" {
899
916
  *
900
917
  * The result is compatible with node.addChildren().
901
918
  *
902
- * @param include child nodes
903
- * @param callback(dict, node) is called for every node, in order to allow
919
+ * @param recursive include child nodes
920
+ * @param callback is called for every node, in order to allow
904
921
  * modifications.
905
922
  * Return `false` to ignore this node or `"skip"` to include this node
906
923
  * without its children.
@@ -1031,8 +1048,9 @@ declare module "wb_node" {
1031
1048
  * Stop iteration, if fn() returns false.<br>
1032
1049
  * Return false if iteration was stopped.
1033
1050
  *
1034
- * @param {function} fn the callback function.
1051
+ * @param callback the callback function.
1035
1052
  * Return false to stop iteration.
1053
+ * @param includeSelf include this node in the iteration.
1036
1054
  */
1037
1055
  visitSiblings(callback: (node: WunderbaumNode) => boolean | void, includeSelf?: boolean): boolean;
1038
1056
  /**
@@ -1044,7 +1062,7 @@ declare module "wb_node" {
1044
1062
  declare module "wb_options" {
1045
1063
  /*!
1046
1064
  * Wunderbaum - utils
1047
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1065
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1048
1066
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
1049
1067
  */
1050
1068
  import { ColumnDefinitionList, DndOptionsType, DynamicBoolOption, DynamicBoolOrStringOption, DynamicCheckboxOption, DynamicIconOption, EditOptionsType, FilterOptionsType, NavModeEnum, NodeTypeDefinitionMap, SelectModeType, WbActivateEventType, WbCancelableEventResultType, WbChangeEventType, WbClickEventType, WbDeactivateEventType, WbErrorEventType, WbExpandEventType, WbIconBadgeCallback, WbIconBadgeEventResultType, WbInitEventType, WbKeydownEventType, WbNodeData, WbNodeEventType, WbReceiveEventType, WbRenderEventType, WbSelectEventType, WbTreeEventType } from "types";
@@ -1219,6 +1237,11 @@ declare module "wb_options" {
1219
1237
  * Default: false
1220
1238
  */
1221
1239
  fixedCol?: boolean;
1240
+ /**
1241
+ * Default value for ColumnDefinition.resizable option.
1242
+ * Default: false
1243
+ */
1244
+ resizableColumns?: boolean;
1222
1245
  /**
1223
1246
  * Default: "multi"
1224
1247
  */
@@ -1379,7 +1402,7 @@ declare module "wb_options" {
1379
1402
  declare module "types" {
1380
1403
  /*!
1381
1404
  * Wunderbaum - types
1382
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
1405
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
1383
1406
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
1384
1407
  */
1385
1408
  import { WunderbaumNode } from "wb_node";
@@ -1388,6 +1411,8 @@ declare module "types" {
1388
1411
  export type TristateType = boolean | undefined;
1389
1412
  /** Show/hide checkbox or display a radiobutton icon instead. */
1390
1413
  export type CheckboxOption = boolean | "radio";
1414
+ /** A value that can either be true, false, or undefined. */
1415
+ export type SortOrderType = "asc" | "desc" | undefined;
1391
1416
  /** An icon may either be
1392
1417
  * a string-tag that references an entry in the `iconMap` (e.g. `"folderOpen"`)),
1393
1418
  * an HTML string that contains a `<` and is used as-is,
@@ -1669,6 +1694,22 @@ declare module "types" {
1669
1694
  * Default: `4px`.
1670
1695
  */
1671
1696
  minWidth?: string | number;
1697
+ /** Allow user to resize the column.
1698
+ * Default: false.
1699
+ */
1700
+ resizable?: boolean;
1701
+ /** Optional custom column width when user resized by mouse drag.
1702
+ * Default: unset.
1703
+ */
1704
+ customWidthPx?: number;
1705
+ /** Allow user to sort the column.
1706
+ * Default: false.
1707
+ */
1708
+ sortable?: boolean;
1709
+ /** Optional custom column sort orde when user clicked the sort icon.
1710
+ * Default: unset.
1711
+ */
1712
+ sortOrder?: SortOrderType;
1672
1713
  /** Optional class names that are added to all `span.wb-col` header AND data
1673
1714
  * elements of that column.
1674
1715
  */
@@ -1782,9 +1823,9 @@ declare module "types" {
1782
1823
  }
1783
1824
  /** Initial navigation mode and possible transition. */
1784
1825
  export enum NavModeEnum {
1785
- startRow = "startRow",
1786
- cell = "cell",
1787
- startCell = "startCell",
1826
+ startRow = "startRow",// Start with row mode, but allow cell-nav mode
1827
+ cell = "cell",// Cell-nav mode only
1828
+ startCell = "startCell",// Start in cell-nav mode, but allow row mode
1788
1829
  row = "row"
1789
1830
  }
1790
1831
  /** Possible values for {@link WunderbaumNode.addChildren()}. */
@@ -1817,15 +1858,31 @@ declare module "types" {
1817
1858
  /** Keep active node visible @default true */
1818
1859
  keepActiveNodeVisible?: boolean;
1819
1860
  }
1820
- /** Possible values for {@link Wunderbaum.filterNodes()} and {@link Wunderbaum.filterBranches()}. */
1861
+ /**
1862
+ * Possible option values for {@link Wunderbaum.filterNodes()}.
1863
+ * The defaults are inherited from the tree instances ´tree.options.filter`
1864
+ * settings (see also {@link FilterOptionsType}).
1865
+ */
1821
1866
  export interface FilterNodesOptions {
1822
- mode?: string;
1823
- leavesOnly?: boolean;
1867
+ /** Expand all branches that contain matches while filtered @default false */
1868
+ autoExpand?: boolean;
1869
+ /** Whether to implicitly match all children of matched nodes @default false */
1870
+ matchBranch?: boolean;
1871
+ /** Match single characters in order, e.g. 'fb' will match 'FooBar' @default false */
1824
1872
  fuzzy?: boolean;
1825
- highlight?: boolean;
1873
+ /**Hide expanders if all child nodes are hidden by filter @default false */
1826
1874
  hideExpanders?: boolean;
1827
- autoExpand?: boolean;
1828
- noData?: boolean;
1875
+ /** Highlight matches by wrapping inside `<mark>` tags.
1876
+ * Does not work for filter callbacks.
1877
+ * @default true
1878
+ */
1879
+ highlight?: boolean;
1880
+ /** Match end nodes only @default false */
1881
+ leavesOnly?: boolean;
1882
+ /** Grayout unmatched nodes (pass 'hide' to remove instead) @default 'dim' */
1883
+ mode?: FilterModeType;
1884
+ /** Display a 'no data' status node if result is empty @default true */
1885
+ noData?: boolean | string;
1829
1886
  }
1830
1887
  /** Possible values for {@link WunderbaumNode.makeVisible()}. */
1831
1888
  export interface MakeVisibleOptions {
@@ -1895,7 +1952,7 @@ declare module "types" {
1895
1952
  */
1896
1953
  edit?: boolean;
1897
1954
  }
1898
- /** Possible values for {@link WunderbaumNode.setColumn()} `options` argument. */
1955
+ /** Possible values for {@link Wunderbaum.setColumn()} `options` argument. */
1899
1956
  export interface SetColumnOptions {
1900
1957
  /**
1901
1958
  * Focus embedded input control of the grid cell if any .
@@ -1956,6 +2013,12 @@ declare module "types" {
1956
2013
  * until the start node is reached again @default false */
1957
2014
  wrap?: boolean;
1958
2015
  }
2016
+ /**
2017
+ * Passed as tree options to configure default filtering behavior.
2018
+ *
2019
+ * @see {@link Wunderbaum.filterNodes}
2020
+ * @see {@link FilterNodesOptions}
2021
+ */
1959
2022
  export type FilterOptionsType = {
1960
2023
  /**
1961
2024
  * Element or selector of an input control for filter query strings
@@ -1967,53 +2030,7 @@ declare module "types" {
1967
2030
  * @default true
1968
2031
  */
1969
2032
  autoApply?: boolean;
1970
- /**
1971
- * Expand all branches that contain matches while filtered
1972
- * @default false
1973
- */
1974
- autoExpand?: boolean;
1975
- /**
1976
- * Show a badge with number of matching child nodes near parent icons
1977
- * @default true
1978
- */
1979
- counter?: boolean;
1980
- /**
1981
- * Match single characters in order, e.g. 'fb' will match 'FooBar'
1982
- * @default false
1983
- */
1984
- fuzzy?: boolean;
1985
- /**
1986
- * Hide counter badge if parent is expanded
1987
- * @default true
1988
- */
1989
- hideExpandedCounter?: boolean;
1990
- /**
1991
- * Hide expanders if all child nodes are hidden by filter
1992
- * @default false;
1993
- */
1994
- hideExpanders?: boolean;
1995
- /**
1996
- * Highlight matches by wrapping inside <mark> tags
1997
- * @default true
1998
- */
1999
- highlight?: boolean;
2000
- /**
2001
- * Match end nodes only
2002
- * @default false
2003
- */
2004
- leavesOnly?: boolean;
2005
- /**
2006
- * Grayout unmatched nodes (pass "hide" to remove unmatched node instead)
2007
- * @default 'dim'
2008
- */
2009
- mode?: FilterModeType;
2010
- /**
2011
- * Display a 'no data' status node if result is empty (hide-mode only).
2012
- * Pass false to simply show an empy pane, or pass a string to customize the message.
2013
- * @default true
2014
- */
2015
- noData?: boolean | string;
2016
- };
2033
+ } & FilterNodesOptions;
2017
2034
  /**
2018
2035
  * Note: <br>
2019
2036
  * This options are used for renaming node titles. <br>
@@ -2284,16 +2301,21 @@ declare module "wb_ext_filter" {
2284
2301
  constructor(tree: Wunderbaum);
2285
2302
  init(): void;
2286
2303
  setPluginOption(name: string, value: any): void;
2287
- _applyFilterNoUpdate(filter: string | NodeFilterCallback, branchMode: boolean, _opts: any): void;
2288
- _applyFilterImpl(filter: string | NodeFilterCallback, branchMode: boolean, _opts: any): number;
2304
+ _applyFilterNoUpdate(filter: string | RegExp | NodeFilterCallback, _opts: FilterNodesOptions): number;
2305
+ _applyFilterImpl(filter: string | RegExp | NodeFilterCallback, _opts: FilterNodesOptions): number;
2289
2306
  /**
2290
2307
  * [ext-filter] Dim or hide nodes.
2291
2308
  */
2292
- filterNodes(filter: string | NodeFilterCallback, options: FilterNodesOptions): void;
2309
+ filterNodes(filter: string | RegExp | NodeFilterCallback, options: FilterNodesOptions): number;
2293
2310
  /**
2294
2311
  * [ext-filter] Dim or hide whole branches.
2312
+ * @deprecated Use {@link filterNodes} instead and set `options.matchBranch: true`.
2313
+ */
2314
+ filterBranches(filter: string | NodeFilterCallback, options: FilterNodesOptions): number;
2315
+ /**
2316
+ * [ext-filter] Return the number of matched nodes.
2295
2317
  */
2296
- filterBranches(filter: string | NodeFilterCallback, options: FilterNodesOptions): void;
2318
+ countMatches(): number;
2297
2319
  /**
2298
2320
  * [ext-filter] Re-apply current filter.
2299
2321
  */
@@ -2307,7 +2329,7 @@ declare module "wb_ext_filter" {
2307
2329
  declare module "wb_ext_keynav" {
2308
2330
  /*!
2309
2331
  * Wunderbaum - ext-keynav
2310
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2332
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2311
2333
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2312
2334
  */
2313
2335
  import { KeynavOptionsType } from "types";
@@ -2323,7 +2345,7 @@ declare module "wb_ext_keynav" {
2323
2345
  declare module "wb_ext_logger" {
2324
2346
  /*!
2325
2347
  * Wunderbaum - ext-logger
2326
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2348
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2327
2349
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2328
2350
  */
2329
2351
  import { LoggerOptionsType } from "types";
@@ -2387,14 +2409,21 @@ declare module "wb_ext_dnd" {
2387
2409
  declare module "drag_observer" {
2388
2410
  /*!
2389
2411
  * Wunderbaum - drag_observer
2390
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2412
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2391
2413
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2392
2414
  */
2393
2415
  export type DragCallbackArgType = {
2394
2416
  /** "dragstart", "drag", or "dragstop". */
2395
2417
  type: string;
2396
- /** Original mouse or touch event that triggered the drag event. */
2418
+ /** Original mousedown or touch event that triggered the dragstart event. */
2419
+ startEvent: MouseEvent | TouchEvent;
2420
+ /** Original mouse or touch event that triggered the current drag event.
2421
+ * Note that this is not the same as `startEvent`, but a mousemove in case of
2422
+ * a dragstart threshold.
2423
+ */
2397
2424
  event: MouseEvent | TouchEvent;
2425
+ /** Custom data that was passed to the DragObserver, typically on dragstart. */
2426
+ customData: any;
2398
2427
  /** Element which is currently dragged. */
2399
2428
  dragElem: HTMLElement | null;
2400
2429
  /** Relative horizontal drag distance since start. */
@@ -2424,6 +2453,7 @@ declare module "drag_observer" {
2424
2453
  protected _handler: any;
2425
2454
  protected root: EventTarget;
2426
2455
  protected start: {
2456
+ event: MouseEvent | TouchEvent | null;
2427
2457
  x: number;
2428
2458
  y: number;
2429
2459
  altKey: boolean;
@@ -2433,6 +2463,7 @@ declare module "drag_observer" {
2433
2463
  };
2434
2464
  protected dragElem: HTMLElement | null;
2435
2465
  protected dragging: boolean;
2466
+ protected customData: object;
2436
2467
  protected events: string[];
2437
2468
  protected opts: DragObserverOptionsType;
2438
2469
  constructor(opts: DragObserverOptionsType);
@@ -2447,7 +2478,7 @@ declare module "drag_observer" {
2447
2478
  declare module "wb_ext_grid" {
2448
2479
  /*!
2449
2480
  * Wunderbaum - ext-grid
2450
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2481
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2451
2482
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2452
2483
  */
2453
2484
  import { Wunderbaum } from "wunderbaum";
@@ -2458,13 +2489,16 @@ declare module "wb_ext_grid" {
2458
2489
  protected observer: DragObserver;
2459
2490
  constructor(tree: Wunderbaum);
2460
2491
  init(): void;
2492
+ /**
2493
+ * Hanldes drag and sragstop events for column resizing.
2494
+ */
2461
2495
  protected handleDrag(e: DragCallbackArgType): void;
2462
2496
  }
2463
2497
  }
2464
2498
  declare module "wb_ext_edit" {
2465
2499
  /*!
2466
2500
  * Wunderbaum - ext-edit
2467
- * Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
2501
+ * Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
2468
2502
  * @VERSION, @DATE (https://github.com/mar10/wunderbaum)
2469
2503
  */
2470
2504
  import { Wunderbaum } from "wunderbaum";
@@ -2503,7 +2537,7 @@ declare module "wunderbaum" {
2503
2537
  *
2504
2538
  * A treegrid control.
2505
2539
  *
2506
- * Copyright (c) 2021-2023, Martin Wendt (https://wwWendt.de).
2540
+ * Copyright (c) 2021-2024, Martin Wendt (https://wwWendt.de).
2507
2541
  * https://github.com/mar10/wunderbaum
2508
2542
  *
2509
2543
  * Released under the MIT license.
@@ -2587,6 +2621,7 @@ declare module "wunderbaum" {
2587
2621
  static util: typeof util;
2588
2622
  /** Expose some useful methods of the util.ts module as `tree._util`. */
2589
2623
  _util: typeof util;
2624
+ /** Filter options (used as defaults for calls to {@link Wunderbaum.filterNodes} ) */
2590
2625
  filterMode: FilterModeType;
2591
2626
  /** @internal Use `setColumn()`/`getActiveColElem()` to access. */
2592
2627
  activeColIdx: number;
@@ -2726,7 +2761,7 @@ declare module "wunderbaum" {
2726
2761
  * });
2727
2762
  * ```
2728
2763
  */
2729
- runWithDeferredUpdate(func: () => any, hint?: any): void;
2764
+ runWithDeferredUpdate(func: () => any, hint?: any): any;
2730
2765
  /** Recursively expand all expandable nodes (triggers lazy load if needed). */
2731
2766
  expandAll(flag?: boolean, options?: ExpandAllOptions): Promise<void>;
2732
2767
  /** Recursively select all nodes. */
@@ -2891,6 +2926,8 @@ declare module "wunderbaum" {
2891
2926
  logTimeEnd(label: string): void;
2892
2927
  /** Write to `console.warn` with tree name as prefix with if opts.debugLevel >= 2. */
2893
2928
  logWarn(...args: any[]): void;
2929
+ /** Reset column widths to default. */
2930
+ resetColumns(): void;
2894
2931
  /**
2895
2932
  * Make sure that this node is vertically scrolled into the viewport.
2896
2933
  *
@@ -2962,7 +2999,7 @@ declare module "wunderbaum" {
2962
2999
  sortChildren(cmp?: SortCallback | null, deep?: boolean): void;
2963
3000
  /** Convert tree to an array of plain objects.
2964
3001
  *
2965
- * @param callback(dict, node) is called for every node, in order to allow
3002
+ * @param callback is called for every node, in order to allow
2966
3003
  * modifications.
2967
3004
  * Return `false` to ignore this node or `"skip"` to include this node
2968
3005
  * without its children.
@@ -3051,13 +3088,28 @@ declare module "wunderbaum" {
3051
3088
  */
3052
3089
  enableUpdate(flag: boolean): void;
3053
3090
  /**
3054
- * Dim or hide nodes.
3091
+ * Dim or hide unmatched nodes.
3092
+ * @param filter a string to match against node titles, or a callback function.
3093
+ * @param options filter options. Defaults to the `tree.options.filter` settings.
3094
+ * @returns the number of nodes that match the filter.
3095
+ * @example
3096
+ * ```ts
3097
+ * tree.filterNodes("foo", {mode: 'dim', fuzzy: true});
3098
+ * // or pass a callback
3099
+ * tree.filterNodes((node) => { return node.data.foo === true }, {mode: 'hide'});
3100
+ * ```
3101
+ */
3102
+ filterNodes(filter: string | RegExp | NodeFilterCallback, options: FilterNodesOptions): number;
3103
+ /**
3104
+ * Return the number of nodes that match the current filter.
3105
+ * @see {@link Wunderbaum.filterNodes}
3055
3106
  */
3056
- filterNodes(filter: string | NodeFilterCallback, options: FilterNodesOptions): void;
3107
+ countMatches(): number;
3057
3108
  /**
3058
3109
  * Dim or hide whole branches.
3110
+ * @deprecated Use {@link filterNodes} instead and set `options.matchBranch: true`.
3059
3111
  */
3060
- filterBranches(filter: string | NodeFilterCallback, options: FilterNodesOptions): void;
3112
+ filterBranches(filter: string | NodeFilterCallback, options: FilterNodesOptions): number;
3061
3113
  /**
3062
3114
  * Reset the filter.
3063
3115
  */