wunderbaum 0.12.0 → 0.13.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/dist/wunderbaum.css +10 -1
- package/dist/wunderbaum.css.map +1 -1
- package/dist/wunderbaum.d.ts +214 -59
- package/dist/wunderbaum.esm.js +417 -222
- package/dist/wunderbaum.esm.min.js +42 -42
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +417 -222
- package/dist/wunderbaum.umd.min.js +45 -45
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +30 -28
- package/src/common.ts +58 -16
- package/src/debounce.ts +5 -0
- package/src/deferred.ts +1 -1
- package/src/drag_observer.ts +1 -1
- package/src/types.ts +163 -21
- package/src/util.ts +1 -14
- package/src/wb_ext_dnd.ts +3 -3
- package/src/wb_ext_edit.ts +2 -2
- package/src/wb_ext_filter.ts +119 -44
- package/src/wb_ext_grid.ts +1 -1
- package/src/wb_ext_keynav.ts +1 -1
- package/src/wb_ext_logger.ts +1 -1
- package/src/wb_extension_base.ts +4 -3
- package/src/wb_node.ts +27 -98
- package/src/wb_options.ts +7 -5
- package/src/wunderbaum.scss +12 -4
- package/src/wunderbaum.ts +272 -48
package/dist/wunderbaum.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare module "debounce" {
|
|
2
2
|
/*!
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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-
|
|
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,10 +422,10 @@ declare module "util" {
|
|
|
422
422
|
declare module "common" {
|
|
423
423
|
/*!
|
|
424
424
|
* Wunderbaum - common
|
|
425
|
-
* Copyright (c) 2021-
|
|
425
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
426
426
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
427
427
|
*/
|
|
428
|
-
import {
|
|
428
|
+
import { ApplyCommandType, NavigationType, SourceObjectType, IconMapType, MatcherCallback } from "types";
|
|
429
429
|
import { WunderbaumNode } from "wb_node";
|
|
430
430
|
export const DEFAULT_DEBUGLEVEL = 4;
|
|
431
431
|
/**
|
|
@@ -452,13 +452,14 @@ declare module "common" {
|
|
|
452
452
|
*/
|
|
453
453
|
export const TEST_IMG: RegExp;
|
|
454
454
|
/**
|
|
455
|
-
* Default node icons
|
|
456
|
-
*
|
|
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
|
-
[key: string]:
|
|
460
|
-
[key: string]: string;
|
|
461
|
-
};
|
|
462
|
+
[key: string]: IconMapType;
|
|
462
463
|
};
|
|
463
464
|
export const KEY_NODATA = "__not_found__";
|
|
464
465
|
/** Define which keys are handled by embedded <input> control, and should
|
|
@@ -470,8 +471,12 @@ declare module "common" {
|
|
|
470
471
|
/** Dict keys that are evaluated by source loader (others are added to `tree.data` instead). */
|
|
471
472
|
export const RESERVED_TREE_SOURCE_KEYS: Set<string>;
|
|
472
473
|
/** Map `KeyEvent.key` to navigation action. */
|
|
473
|
-
export const
|
|
474
|
-
[key: string]:
|
|
474
|
+
export const KEY_TO_NAVIGATION_MAP: {
|
|
475
|
+
[key: string]: NavigationType;
|
|
476
|
+
};
|
|
477
|
+
/** Map `KeyEvent.key` to navigation action. */
|
|
478
|
+
export const KEY_TO_COMMAND_MAP: {
|
|
479
|
+
[key: string]: ApplyCommandType;
|
|
475
480
|
};
|
|
476
481
|
/** Return a callback that returns true if the node title matches the string
|
|
477
482
|
* or regular expression.
|
|
@@ -496,7 +501,7 @@ declare module "common" {
|
|
|
496
501
|
declare module "deferred" {
|
|
497
502
|
/*!
|
|
498
503
|
* Wunderbaum - deferred
|
|
499
|
-
* Copyright (c) 2021-
|
|
504
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
500
505
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
501
506
|
*/
|
|
502
507
|
type PromiseCallbackType = (val: any) => void;
|
|
@@ -537,7 +542,7 @@ declare module "deferred" {
|
|
|
537
542
|
}
|
|
538
543
|
declare module "wb_node" {
|
|
539
544
|
import { Wunderbaum } from "wunderbaum";
|
|
540
|
-
import { AddChildrenOptions, ApplyCommandOptions, ApplyCommandType, ChangeType, CheckboxOption, ExpandAllOptions, IconOption, InsertNodeType, MakeVisibleOptions, MatcherCallback, NavigateOptions, NodeAnyCallback, NodeStatusType, NodeStringCallback, NodeToDictCallback, NodeVisitCallback, NodeVisitResponse, RenderOptions, ResetOrderOptions, ScrollIntoViewOptions, SetActiveOptions, SetExpandedOptions, SetSelectedOptions, SetStatusOptions, SortByPropertyOptions, SortCallback, SourceType, TooltipOption, TristateType, WbNodeData } from "types";
|
|
545
|
+
import { AddChildrenOptions, ApplyCommandOptions, ApplyCommandType, ChangeType, CheckboxOption, ExpandAllOptions, IconOption, InsertNodeType, MakeVisibleOptions, MatcherCallback, NavigateOptions, NavigationType, NodeAnyCallback, NodeStatusType, NodeStringCallback, NodeToDictCallback, NodeVisitCallback, NodeVisitResponse, RenderOptions, ResetOrderOptions, ScrollIntoViewOptions, SetActiveOptions, SetExpandedOptions, SetSelectedOptions, SetStatusOptions, SortByPropertyOptions, SortCallback, SourceType, TooltipOption, TristateType, WbNodeData } from "types";
|
|
541
546
|
/**
|
|
542
547
|
* A single tree node.
|
|
543
548
|
*
|
|
@@ -609,7 +614,11 @@ declare module "wb_node" {
|
|
|
609
614
|
_errorInfo: any | null;
|
|
610
615
|
_partsel: boolean;
|
|
611
616
|
_partload: boolean;
|
|
612
|
-
|
|
617
|
+
/**
|
|
618
|
+
* > 0 if matched (-1 to keep system nodes visible);
|
|
619
|
+
* Added and removed by filter code.
|
|
620
|
+
*/
|
|
621
|
+
match?: number;
|
|
613
622
|
subMatchCount?: number;
|
|
614
623
|
/** @internal */
|
|
615
624
|
titleWithHighlight?: string;
|
|
@@ -727,7 +736,7 @@ declare module "wb_node" {
|
|
|
727
736
|
*
|
|
728
737
|
* @see {@link Wunderbaum.findRelatedNode|tree.findRelatedNode()}
|
|
729
738
|
*/
|
|
730
|
-
findRelatedNode(where:
|
|
739
|
+
findRelatedNode(where: NavigationType, includeHidden?: boolean): any;
|
|
731
740
|
/**
|
|
732
741
|
* Iterator version of {@link WunderbaumNode.format}.
|
|
733
742
|
*/
|
|
@@ -844,7 +853,7 @@ declare module "wb_node" {
|
|
|
844
853
|
* @see {@link WunderbaumNode.isAncestorOf}
|
|
845
854
|
*/
|
|
846
855
|
isParentOf(other: WunderbaumNode): boolean;
|
|
847
|
-
/**
|
|
856
|
+
/** Return true if this node is partially loaded. @experimental */
|
|
848
857
|
isPartload(): boolean;
|
|
849
858
|
/** Return true if this node is partially selected (tri-state). */
|
|
850
859
|
isPartsel(): boolean;
|
|
@@ -919,7 +928,7 @@ declare module "wb_node" {
|
|
|
919
928
|
* e.g. `ArrowLeft` = 'left'.
|
|
920
929
|
* @param options
|
|
921
930
|
*/
|
|
922
|
-
navigate(where: string, options?: NavigateOptions): Promise<any>;
|
|
931
|
+
navigate(where: NavigationType | string, options?: NavigateOptions): Promise<any>;
|
|
923
932
|
/** Delete this node and all descendants. */
|
|
924
933
|
remove(): void;
|
|
925
934
|
/** Remove all descendants of this node. */
|
|
@@ -927,7 +936,7 @@ declare module "wb_node" {
|
|
|
927
936
|
/** Remove all HTML markup from the DOM. */
|
|
928
937
|
removeMarkup(): void;
|
|
929
938
|
protected _getRenderInfo(): any;
|
|
930
|
-
protected _createIcon(
|
|
939
|
+
protected _createIcon(parentElem: HTMLElement, replaceChild: HTMLElement | null, showLoading: boolean): HTMLElement | null;
|
|
931
940
|
/**
|
|
932
941
|
* Create a whole new `<div class="wb-row">` element.
|
|
933
942
|
* @see {@link WunderbaumNode._render}
|
|
@@ -1112,10 +1121,10 @@ declare module "wb_node" {
|
|
|
1112
1121
|
declare module "wb_options" {
|
|
1113
1122
|
/*!
|
|
1114
1123
|
* Wunderbaum - utils
|
|
1115
|
-
* Copyright (c) 2021-
|
|
1124
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
1116
1125
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
1117
1126
|
*/
|
|
1118
|
-
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";
|
|
1127
|
+
import { ColumnDefinitionList, DndOptionsType, DynamicBoolOption, DynamicBoolOrStringOption, DynamicCheckboxOption, DynamicIconOption, EditOptionsType, FilterOptionsType, IconMapType, NavModeEnum, NodeTypeDefinitionMap, SelectModeType, TranslationsType, WbActivateEventType, WbButtonClickEventType, WbCancelableEventResultType, WbChangeEventType, WbClickEventType, WbDeactivateEventType, WbErrorEventType, WbExpandEventType, WbIconBadgeCallback, WbIconBadgeEventResultType, WbInitEventType, WbKeydownEventType, WbNodeData, WbNodeEventType, WbReceiveEventType, WbRenderEventType, WbSelectEventType, WbTreeEventType } from "types";
|
|
1119
1128
|
/**
|
|
1120
1129
|
* Available options for {@link wunderbaum.Wunderbaum}.
|
|
1121
1130
|
*
|
|
@@ -1191,7 +1200,7 @@ declare module "wb_options" {
|
|
|
1191
1200
|
/**
|
|
1192
1201
|
* Translation map for some system messages.
|
|
1193
1202
|
*/
|
|
1194
|
-
strings?:
|
|
1203
|
+
strings?: TranslationsType;
|
|
1195
1204
|
/**
|
|
1196
1205
|
* 0:quiet, 1:errors, 2:warnings, 3:info, 4:verbose
|
|
1197
1206
|
* Default: 3 (4 in local debug environment)
|
|
@@ -1220,9 +1229,7 @@ declare module "wb_options" {
|
|
|
1220
1229
|
* Note: the icon font must be loaded separately.
|
|
1221
1230
|
* Default: "bootstrap"
|
|
1222
1231
|
*/
|
|
1223
|
-
iconMap?: string |
|
|
1224
|
-
[key: string]: string;
|
|
1225
|
-
};
|
|
1232
|
+
iconMap?: string | IconMapType;
|
|
1226
1233
|
/**
|
|
1227
1234
|
* Collapse siblings when a node is expanded.
|
|
1228
1235
|
* Default: false
|
|
@@ -1243,10 +1250,10 @@ declare module "wb_options" {
|
|
|
1243
1250
|
*/
|
|
1244
1251
|
adjustHeight?: boolean;
|
|
1245
1252
|
/**
|
|
1246
|
-
* HTMLElement that receives the top nodes breadcrumb.
|
|
1253
|
+
* HTMLElement or selector that receives the top nodes breadcrumb.
|
|
1247
1254
|
* Default: undefined
|
|
1248
1255
|
*/
|
|
1249
|
-
connectTopBreadcrumb?: HTMLElement;
|
|
1256
|
+
connectTopBreadcrumb?: HTMLElement | string;
|
|
1250
1257
|
/**
|
|
1251
1258
|
* Default: NavModeEnum.startRow
|
|
1252
1259
|
*/
|
|
@@ -1475,7 +1482,7 @@ declare module "wb_options" {
|
|
|
1475
1482
|
declare module "types" {
|
|
1476
1483
|
/*!
|
|
1477
1484
|
* Wunderbaum - types
|
|
1478
|
-
* Copyright (c) 2021-
|
|
1485
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
1479
1486
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
1480
1487
|
*/
|
|
1481
1488
|
import { WunderbaumNode } from "wb_node";
|
|
@@ -1494,7 +1501,7 @@ declare module "types" {
|
|
|
1494
1501
|
* or a boolean value that indicates if the default icon should be used or hidden.
|
|
1495
1502
|
*/
|
|
1496
1503
|
export type IconOption = boolean | string;
|
|
1497
|
-
/** Show/hide tooltip or display a string. */
|
|
1504
|
+
/** Show/hide default tooltip or display a string. */
|
|
1498
1505
|
export type TooltipOption = boolean | string;
|
|
1499
1506
|
export interface SourceAjaxType {
|
|
1500
1507
|
url: string;
|
|
@@ -1548,7 +1555,10 @@ declare module "types" {
|
|
|
1548
1555
|
* returns an iteration modifier.
|
|
1549
1556
|
*/
|
|
1550
1557
|
export type NodeToDictCallback = (dict: WbNodeData, node: WunderbaumNode) => NodeVisitResponse;
|
|
1551
|
-
/**
|
|
1558
|
+
/**
|
|
1559
|
+
* A callback that receives a node instance and may returnsa `false` to prevent
|
|
1560
|
+
* (de)selection.
|
|
1561
|
+
*/
|
|
1552
1562
|
export type NodeSelectCallback = (node: WunderbaumNode) => boolean | void;
|
|
1553
1563
|
/**
|
|
1554
1564
|
* See also {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
|
|
@@ -1562,29 +1572,88 @@ declare module "types" {
|
|
|
1562
1572
|
export type DynamicTooltipOption = TooltipOption | BoolOrStringOptionResolver;
|
|
1563
1573
|
/** A plain object (dictionary) that represents a node instance. */
|
|
1564
1574
|
export interface WbNodeData {
|
|
1575
|
+
/** Defines if the `selected` state is displayed as checkbox, radio button,
|
|
1576
|
+
* or hidden.
|
|
1577
|
+
* Defaults to {@link WunderbaumOptions.checkbox}.
|
|
1578
|
+
*/
|
|
1565
1579
|
checkbox?: CheckboxOption;
|
|
1580
|
+
/** Optional list of child nodes.
|
|
1581
|
+
* If `children` is an empty array, the node is considered a leaf.
|
|
1582
|
+
* If `lazy` is true and `children is undefined or null, the node, is
|
|
1583
|
+
* considered unloaded. Otherwise, the node is considered a leaf.
|
|
1584
|
+
*/
|
|
1566
1585
|
children?: Array<WbNodeData>;
|
|
1586
|
+
/** Additional classes that are added to `<div class='wb-row'>`. */
|
|
1567
1587
|
classes?: string;
|
|
1588
|
+
/** Only show title in a single, merged column. */
|
|
1568
1589
|
colspan?: boolean;
|
|
1590
|
+
/** Expand this node. */
|
|
1569
1591
|
expanded?: boolean;
|
|
1592
|
+
/** Defaults to standard icons (doc, folder, folderOpen, ...)
|
|
1593
|
+
* from {@link WunderbaumOptions.iconMap}.
|
|
1594
|
+
* Can be overridden by {@link WunderbaumOptions.icon}.
|
|
1595
|
+
*/
|
|
1570
1596
|
icon?: IconOption;
|
|
1597
|
+
/** Tooltip for the node icon only. Defaults to {@link WunderbaumOptions.iconTooltip}. */
|
|
1571
1598
|
iconTooltip?: TooltipOption;
|
|
1599
|
+
/** The node's key. Must be unique for the whole tree. Defaults to a sequence number. */
|
|
1572
1600
|
key?: string;
|
|
1601
|
+
/** If true (and children are undefined or null), the node is considered lazy
|
|
1602
|
+
* and {@link WunderbaumOptions.lazyLoad} is called when expanded.
|
|
1603
|
+
*/
|
|
1573
1604
|
lazy?: boolean;
|
|
1574
1605
|
/** Make child nodes single-select radio buttons. */
|
|
1575
1606
|
radiogroup?: boolean;
|
|
1607
|
+
/** Node's reference key. Unlike {@link WunderbaumNode.key}, this value
|
|
1608
|
+
* may be non-unique. Nodes within the tree that share the same refKey are considered
|
|
1609
|
+
* clones.
|
|
1610
|
+
*/
|
|
1576
1611
|
refKey?: string;
|
|
1612
|
+
/** The node's selection status, typically displayed as a checkbox. */
|
|
1577
1613
|
selected?: boolean;
|
|
1614
|
+
/** The node's status, typically displayed as merged single row.
|
|
1615
|
+
* @see {@link Wunderbaum.setStatus}
|
|
1616
|
+
*/
|
|
1578
1617
|
statusNodeType?: NodeStatusType;
|
|
1618
|
+
/** The node's title. Will be html escaped to prevent XSS. */
|
|
1579
1619
|
title: string;
|
|
1620
|
+
/** Pass true to set node tooltip to the node's title. Defaults to {@link WunderbaumOptions.tooltip}. */
|
|
1580
1621
|
tooltip?: TooltipOption;
|
|
1622
|
+
/** Inherit shared settings from the matching entry in {@link WunderbaumOptions.types}. */
|
|
1581
1623
|
type?: string;
|
|
1624
|
+
/** Set to `true` to prevent selection. Defaults to {@link WunderbaumOptions.unselectable}. */
|
|
1582
1625
|
unselectable?: boolean;
|
|
1583
1626
|
/** @internal */
|
|
1584
1627
|
_treeId?: string;
|
|
1585
1628
|
/** Other data is passed to `node.data` and can be accessed via `node.data.NAME` */
|
|
1586
1629
|
[key: string]: unknown;
|
|
1587
1630
|
}
|
|
1631
|
+
/** A plain object (dictionary) that defines node icons. */
|
|
1632
|
+
export interface IconMapType {
|
|
1633
|
+
error: string;
|
|
1634
|
+
loading: string;
|
|
1635
|
+
noData: string;
|
|
1636
|
+
expanderExpanded: string;
|
|
1637
|
+
expanderCollapsed: string;
|
|
1638
|
+
expanderLazy: string;
|
|
1639
|
+
checkChecked: string;
|
|
1640
|
+
checkUnchecked: string;
|
|
1641
|
+
checkUnknown: string;
|
|
1642
|
+
radioChecked: string;
|
|
1643
|
+
radioUnchecked: string;
|
|
1644
|
+
radioUnknown: string;
|
|
1645
|
+
folder: string;
|
|
1646
|
+
folderOpen: string;
|
|
1647
|
+
folderLazy: string;
|
|
1648
|
+
doc: string;
|
|
1649
|
+
colSortable: string;
|
|
1650
|
+
colSortAsc: string;
|
|
1651
|
+
colSortDesc: string;
|
|
1652
|
+
colFilter: string;
|
|
1653
|
+
colFilterActive: string;
|
|
1654
|
+
colMenu: string;
|
|
1655
|
+
[key: string]: string;
|
|
1656
|
+
}
|
|
1588
1657
|
/** A callback that receives a node instance and returns a string value. */
|
|
1589
1658
|
export type WbCancelableEventResultType = false | void;
|
|
1590
1659
|
export interface WbTreeEventType {
|
|
@@ -1842,6 +1911,19 @@ declare module "types" {
|
|
|
1842
1911
|
[key: string]: unknown;
|
|
1843
1912
|
}
|
|
1844
1913
|
export type ColumnDefinitionList = Array<ColumnDefinition>;
|
|
1914
|
+
/**
|
|
1915
|
+
* Used by {@link Wunderbaum.getState} and {@link Wunderbaum.setState}.
|
|
1916
|
+
*/
|
|
1917
|
+
export interface TreeStateDefinition {
|
|
1918
|
+
/** The active node's key if any. */
|
|
1919
|
+
activeKey: string | null;
|
|
1920
|
+
/** The active column index if any. */
|
|
1921
|
+
activeColIdx: number | null;
|
|
1922
|
+
/** List of selected node's keys. */
|
|
1923
|
+
selectedKeys: Array<string> | undefined;
|
|
1924
|
+
/** List of expanded node's keys. */
|
|
1925
|
+
expandedKeys: Array<string> | undefined;
|
|
1926
|
+
}
|
|
1845
1927
|
/**
|
|
1846
1928
|
* Column information (passed to the `render` event).
|
|
1847
1929
|
*/
|
|
@@ -1884,9 +1966,10 @@ declare module "types" {
|
|
|
1884
1966
|
/** The affected column's span tag if any. */
|
|
1885
1967
|
colElem?: HTMLSpanElement;
|
|
1886
1968
|
}
|
|
1887
|
-
export type FilterModeType = null | "dim" | "hide";
|
|
1969
|
+
export type FilterModeType = null | "mark" | "dim" | "hide";
|
|
1888
1970
|
export type SelectModeType = "single" | "multi" | "hier";
|
|
1889
|
-
export type
|
|
1971
|
+
export type NavigationType = "down" | "first" | "firstCol" | "last" | "lastCol" | "left" | "nextMatch" | "pageDown" | "pageUp" | "parent" | "prevMatch" | "right" | "up";
|
|
1972
|
+
export type ApplyCommandType = NavigationType | "addChild" | "addSibling" | "collapse" | "collapseAll" | "copy" | "cut" | "edit" | "expand" | "expandAll" | "indent" | "moveDown" | "moveUp" | "outdent" | "paste" | "remove" | "rename" | "toggleSelect";
|
|
1890
1973
|
export type NodeFilterResponse = "skip" | "branch" | boolean | void;
|
|
1891
1974
|
export type NodeFilterCallback = (node: WunderbaumNode) => NodeFilterResponse;
|
|
1892
1975
|
/**
|
|
@@ -1910,6 +1993,7 @@ declare module "types" {
|
|
|
1910
1993
|
/** Vertical scroll event. Update the 'top' property of all rows. */
|
|
1911
1994
|
scroll = "scroll"
|
|
1912
1995
|
}
|
|
1996
|
+
/** @internal */
|
|
1913
1997
|
export enum RenderFlag {
|
|
1914
1998
|
clearMarkup = "clearMarkup",
|
|
1915
1999
|
header = "header",
|
|
@@ -1936,11 +2020,32 @@ declare module "types" {
|
|
|
1936
2020
|
}
|
|
1937
2021
|
/** Initial navigation mode and possible transition. */
|
|
1938
2022
|
export enum NavModeEnum {
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
2023
|
+
/** Start with row mode, but allow cell-nav mode */
|
|
2024
|
+
startRow = "startRow",
|
|
2025
|
+
/** Cell-nav mode only */
|
|
2026
|
+
cell = "cell",
|
|
2027
|
+
/** Start in cell-nav mode, but allow row mode */
|
|
2028
|
+
startCell = "startCell",
|
|
2029
|
+
/** Row mode only */
|
|
1942
2030
|
row = "row"
|
|
1943
2031
|
}
|
|
2032
|
+
/** Translatable strings. */
|
|
2033
|
+
export type TranslationsType = {
|
|
2034
|
+
/** @default "Loading..." */
|
|
2035
|
+
loading: string;
|
|
2036
|
+
/** @default "Error" */
|
|
2037
|
+
loadError: string;
|
|
2038
|
+
/** @default "No data" */
|
|
2039
|
+
noData: string;
|
|
2040
|
+
/** @default " » " */
|
|
2041
|
+
breadcrumbDelimiter: string;
|
|
2042
|
+
/** @default "Found ${matches} of ${count}" */
|
|
2043
|
+
queryResult: string;
|
|
2044
|
+
/** @default "No result" */
|
|
2045
|
+
noMatch: string;
|
|
2046
|
+
/** @default "${match} of ${matches}" */
|
|
2047
|
+
matchIndex: string;
|
|
2048
|
+
};
|
|
1944
2049
|
/** Possible values for {@link WunderbaumNode.addChildren}. */
|
|
1945
2050
|
export interface AddChildrenOptions {
|
|
1946
2051
|
/** Insert children before this node (or index)
|
|
@@ -2019,6 +2124,18 @@ declare module "types" {
|
|
|
2019
2124
|
/** Display a 'no data' status node if result is empty @default true */
|
|
2020
2125
|
noData?: boolean | string;
|
|
2021
2126
|
}
|
|
2127
|
+
/** Possible values for {@link Wunderbaum.getState}. */
|
|
2128
|
+
export interface GetStateOptions {
|
|
2129
|
+
/** Include the expanded keys. @default true */
|
|
2130
|
+
expandedKeys?: boolean;
|
|
2131
|
+
/** Include the selected keys. @default true */
|
|
2132
|
+
selectedKeys?: boolean;
|
|
2133
|
+
}
|
|
2134
|
+
/** Possible values for {@link Wunderbaum.setState}. */
|
|
2135
|
+
export interface SetStateOptions {
|
|
2136
|
+
/** Recursively load lazy nodes as needed. @default false */
|
|
2137
|
+
expandLazy?: boolean;
|
|
2138
|
+
}
|
|
2022
2139
|
/** Possible values for {@link WunderbaumNode.makeVisible}. */
|
|
2023
2140
|
export interface MakeVisibleOptions {
|
|
2024
2141
|
/** Do not animate expand (currently not implemented). @default false */
|
|
@@ -2194,6 +2311,17 @@ declare module "types" {
|
|
|
2194
2311
|
* until the start node is reached again @default false */
|
|
2195
2312
|
wrap?: boolean;
|
|
2196
2313
|
}
|
|
2314
|
+
/**
|
|
2315
|
+
* Passed as tree option.filer.connect to configure automatic integration of
|
|
2316
|
+
* filter UI controls. @experimental
|
|
2317
|
+
*/
|
|
2318
|
+
export interface FilterConnectType {
|
|
2319
|
+
inputElem: string | HTMLInputElement | null;
|
|
2320
|
+
modeButton?: string | HTMLButtonElement | null;
|
|
2321
|
+
nextButton?: string | HTMLButtonElement | HTMLAnchorElement | null;
|
|
2322
|
+
prevButton?: string | HTMLButtonElement | HTMLAnchorElement | null;
|
|
2323
|
+
matchInfoElem?: string | HTMLElement | null;
|
|
2324
|
+
}
|
|
2197
2325
|
/**
|
|
2198
2326
|
* Passed as tree options to configure default filtering behavior.
|
|
2199
2327
|
*
|
|
@@ -2202,10 +2330,12 @@ declare module "types" {
|
|
|
2202
2330
|
*/
|
|
2203
2331
|
export type FilterOptionsType = {
|
|
2204
2332
|
/**
|
|
2205
|
-
* Element or selector of
|
|
2333
|
+
* Element or selector of input controls and buttons for filter query strings.
|
|
2334
|
+
* @experimental
|
|
2335
|
+
* @since 0.13
|
|
2206
2336
|
* @default null
|
|
2207
2337
|
*/
|
|
2208
|
-
|
|
2338
|
+
connect?: null | FilterConnectType;
|
|
2209
2339
|
/**
|
|
2210
2340
|
* Re-apply last filter if lazy data is loaded
|
|
2211
2341
|
* @default true
|
|
@@ -2452,6 +2582,7 @@ declare module "types" {
|
|
|
2452
2582
|
export type LoggerOptionsType = object;
|
|
2453
2583
|
}
|
|
2454
2584
|
declare module "wb_extension_base" {
|
|
2585
|
+
import { WunderbaumOptions } from "wb_options";
|
|
2455
2586
|
import { Wunderbaum } from "wunderbaum";
|
|
2456
2587
|
export type ExtensionsDict = {
|
|
2457
2588
|
[key: string]: WunderbaumExtension<any>;
|
|
@@ -2460,7 +2591,7 @@ declare module "wb_extension_base" {
|
|
|
2460
2591
|
enabled: boolean;
|
|
2461
2592
|
readonly id: string;
|
|
2462
2593
|
readonly tree: Wunderbaum;
|
|
2463
|
-
readonly treeOpts:
|
|
2594
|
+
readonly treeOpts: WunderbaumOptions;
|
|
2464
2595
|
readonly extensionOpts: any;
|
|
2465
2596
|
constructor(tree: Wunderbaum, id: string, defaults: TOptions);
|
|
2466
2597
|
/** Called on tree (re)init after all extensions are added, but before loading.*/
|
|
@@ -2477,11 +2608,17 @@ declare module "wb_ext_filter" {
|
|
|
2477
2608
|
import { Wunderbaum } from "wunderbaum";
|
|
2478
2609
|
import { WunderbaumExtension } from "wb_extension_base";
|
|
2479
2610
|
export class FilterExtension extends WunderbaumExtension<FilterOptionsType> {
|
|
2480
|
-
queryInput
|
|
2611
|
+
queryInput: HTMLInputElement | null;
|
|
2612
|
+
prevButton: HTMLElement | HTMLAnchorElement | null;
|
|
2613
|
+
nextButton: HTMLElement | HTMLAnchorElement | null;
|
|
2614
|
+
modeButton: HTMLButtonElement | null;
|
|
2615
|
+
matchInfoElem: HTMLElement | null;
|
|
2481
2616
|
lastFilterArgs: IArguments | null;
|
|
2482
2617
|
constructor(tree: Wunderbaum);
|
|
2483
2618
|
init(): void;
|
|
2484
2619
|
setPluginOption(name: string, value: any): void;
|
|
2620
|
+
_updatedConnectedControls(): void;
|
|
2621
|
+
_connectControls(): void;
|
|
2485
2622
|
_applyFilterNoUpdate(filter: string | RegExp | NodeFilterCallback, _opts: FilterNodesOptions): number;
|
|
2486
2623
|
_applyFilterImpl(filter: string | RegExp | NodeFilterCallback, _opts: FilterNodesOptions): number;
|
|
2487
2624
|
/**
|
|
@@ -2510,7 +2647,7 @@ declare module "wb_ext_filter" {
|
|
|
2510
2647
|
declare module "wb_ext_keynav" {
|
|
2511
2648
|
/*!
|
|
2512
2649
|
* Wunderbaum - ext-keynav
|
|
2513
|
-
* Copyright (c) 2021-
|
|
2650
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
2514
2651
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
2515
2652
|
*/
|
|
2516
2653
|
import { KeynavOptionsType } from "types";
|
|
@@ -2526,7 +2663,7 @@ declare module "wb_ext_keynav" {
|
|
|
2526
2663
|
declare module "wb_ext_logger" {
|
|
2527
2664
|
/*!
|
|
2528
2665
|
* Wunderbaum - ext-logger
|
|
2529
|
-
* Copyright (c) 2021-
|
|
2666
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
2530
2667
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
2531
2668
|
*/
|
|
2532
2669
|
import { LoggerOptionsType } from "types";
|
|
@@ -2590,7 +2727,7 @@ declare module "wb_ext_dnd" {
|
|
|
2590
2727
|
declare module "drag_observer" {
|
|
2591
2728
|
/*!
|
|
2592
2729
|
* Wunderbaum - drag_observer
|
|
2593
|
-
* Copyright (c) 2021-
|
|
2730
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
2594
2731
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
2595
2732
|
*/
|
|
2596
2733
|
export type DragCallbackArgType = {
|
|
@@ -2659,7 +2796,7 @@ declare module "drag_observer" {
|
|
|
2659
2796
|
declare module "wb_ext_grid" {
|
|
2660
2797
|
/*!
|
|
2661
2798
|
* Wunderbaum - ext-grid
|
|
2662
|
-
* Copyright (c) 2021-
|
|
2799
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
2663
2800
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
2664
2801
|
*/
|
|
2665
2802
|
import { Wunderbaum } from "wunderbaum";
|
|
@@ -2679,7 +2816,7 @@ declare module "wb_ext_grid" {
|
|
|
2679
2816
|
declare module "wb_ext_edit" {
|
|
2680
2817
|
/*!
|
|
2681
2818
|
* Wunderbaum - ext-edit
|
|
2682
|
-
* Copyright (c) 2021-
|
|
2819
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
2683
2820
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
2684
2821
|
*/
|
|
2685
2822
|
import { Wunderbaum } from "wunderbaum";
|
|
@@ -2718,7 +2855,7 @@ declare module "wunderbaum" {
|
|
|
2718
2855
|
*
|
|
2719
2856
|
* A treegrid control.
|
|
2720
2857
|
*
|
|
2721
|
-
* Copyright (c) 2021-
|
|
2858
|
+
* Copyright (c) 2021-2025, Martin Wendt (https://wwWendt.de).
|
|
2722
2859
|
* https://github.com/mar10/wunderbaum
|
|
2723
2860
|
*
|
|
2724
2861
|
* Released under the MIT license.
|
|
@@ -2727,7 +2864,7 @@ declare module "wunderbaum" {
|
|
|
2727
2864
|
*/
|
|
2728
2865
|
import * as util from "util";
|
|
2729
2866
|
import { ExtensionsDict, WunderbaumExtension } from "wb_extension_base";
|
|
2730
|
-
import { AddChildrenOptions, ApplyCommandOptions, ApplyCommandType, ChangeType, ColumnDefinitionList, DynamicBoolOption, DynamicCheckboxOption, DynamicIconOption, DynamicStringOption, DynamicTooltipOption, ExpandAllOptions, FilterModeType, FilterNodesOptions, MatcherCallback, NavModeEnum, NodeFilterCallback, NodeStatusType, NodeStringCallback, NodeToDictCallback, NodeTypeDefinitionMap, NodeVisitCallback, RenderFlag, ScrollToOptions, SetActiveOptions, SetColumnOptions, SetStatusOptions, SortByPropertyOptions, SortCallback, SourceType, UpdateOptions, VisitRowsOptions, WbEventInfo, WbNodeData } from "types";
|
|
2867
|
+
import { AddChildrenOptions, ApplyCommandOptions, ApplyCommandType, ChangeType, ColumnDefinitionList, DynamicBoolOption, DynamicCheckboxOption, DynamicIconOption, DynamicStringOption, DynamicTooltipOption, ExpandAllOptions, FilterModeType, FilterNodesOptions, IconMapType, GetStateOptions, MatcherCallback, NavigationType, NavModeEnum, NodeFilterCallback, NodeStatusType, NodeStringCallback, NodeToDictCallback, NodeTypeDefinitionMap, NodeVisitCallback, RenderFlag, ScrollToOptions, SetActiveOptions, SetColumnOptions, SetStateOptions, SetStatusOptions, SortByPropertyOptions, SortCallback, SourceType, TreeStateDefinition, UpdateOptions, VisitRowsOptions, WbEventInfo, WbNodeData } from "types";
|
|
2731
2868
|
import { WunderbaumNode } from "wb_node";
|
|
2732
2869
|
import { WunderbaumOptions } from "wb_options";
|
|
2733
2870
|
import { DebouncedFunction } from "debounce";
|
|
@@ -2770,11 +2907,11 @@ declare module "wunderbaum" {
|
|
|
2770
2907
|
protected _activeNode: WunderbaumNode | null;
|
|
2771
2908
|
protected _focusNode: WunderbaumNode | null;
|
|
2772
2909
|
/** Currently active node if any.
|
|
2773
|
-
* Use @link
|
|
2910
|
+
* Use {@link WunderbaumNode.setActive|setActive} to modify.
|
|
2774
2911
|
*/
|
|
2775
2912
|
get activeNode(): WunderbaumNode;
|
|
2776
2913
|
/** Current node hat has keyboard focus if any.
|
|
2777
|
-
* Use @link
|
|
2914
|
+
* Use {@link WunderbaumNode.setFocus|setFocus()} to modify.
|
|
2778
2915
|
*/
|
|
2779
2916
|
get focusNode(): WunderbaumNode;
|
|
2780
2917
|
/** Shared properties, referenced by `node.type`. */
|
|
@@ -2803,6 +2940,8 @@ declare module "wunderbaum" {
|
|
|
2803
2940
|
/** Expose some useful methods of the util.ts module as `tree._util`. */
|
|
2804
2941
|
_util: typeof util;
|
|
2805
2942
|
/** Filter options (used as defaults for calls to {@link Wunderbaum.filterNodes} ) */
|
|
2943
|
+
breadcrumb: HTMLElement | null;
|
|
2944
|
+
/** Filter options (used as defaults for calls to {@link Wunderbaum.filterNodes} ) */
|
|
2806
2945
|
filterMode: FilterModeType;
|
|
2807
2946
|
/** @internal Use `setColumn()`/`getActiveColElem()` to access. */
|
|
2808
2947
|
activeColIdx: number;
|
|
@@ -2829,9 +2968,7 @@ declare module "wunderbaum" {
|
|
|
2829
2968
|
/**
|
|
2830
2969
|
* Return the icon-function -> icon-definition mapping.
|
|
2831
2970
|
*/
|
|
2832
|
-
get iconMap():
|
|
2833
|
-
[key: string]: string;
|
|
2834
|
-
};
|
|
2971
|
+
get iconMap(): IconMapType;
|
|
2835
2972
|
/**
|
|
2836
2973
|
* Return a WunderbaumNode instance from element or event.
|
|
2837
2974
|
*/
|
|
@@ -2878,14 +3015,19 @@ declare module "wunderbaum" {
|
|
|
2878
3015
|
_callEvent(type: string, extra?: any): any;
|
|
2879
3016
|
/** Return the node for given row index. */
|
|
2880
3017
|
protected _getNodeByRowIdx(idx: number): WunderbaumNode | null;
|
|
2881
|
-
/** Return the topmost visible node in the viewport.
|
|
3018
|
+
/** Return the topmost visible node in the viewport.
|
|
3019
|
+
* @param complete If `false`, the node is considered visible if at least one
|
|
3020
|
+
* pixel is visible.
|
|
3021
|
+
*/
|
|
2882
3022
|
getTopmostVpNode(complete?: boolean): WunderbaumNode;
|
|
2883
3023
|
/** Return the lowest visible node in the viewport. */
|
|
2884
3024
|
getLowestVpNode(complete?: boolean): WunderbaumNode;
|
|
2885
|
-
/** Return preceeding visible node in the viewport. */
|
|
2886
|
-
protected _getPrevNodeInView(node?: WunderbaumNode, ofs?: number): WunderbaumNode;
|
|
2887
3025
|
/** Return following visible node in the viewport. */
|
|
2888
|
-
protected _getNextNodeInView(node?: WunderbaumNode,
|
|
3026
|
+
protected _getNextNodeInView(node?: WunderbaumNode, options?: {
|
|
3027
|
+
ofs?: number;
|
|
3028
|
+
reverse?: boolean;
|
|
3029
|
+
cb?: (n: WunderbaumNode) => boolean;
|
|
3030
|
+
}): WunderbaumNode;
|
|
2889
3031
|
/**
|
|
2890
3032
|
* Append (or insert) a list of toplevel nodes.
|
|
2891
3033
|
*
|
|
@@ -2959,6 +3101,9 @@ declare module "wunderbaum" {
|
|
|
2959
3101
|
* @param visible if true, nodes that are hidden due to collapsed parents are ignored.
|
|
2960
3102
|
*/
|
|
2961
3103
|
count(visible?: boolean): number;
|
|
3104
|
+
/** Return the number of *unique* nodes in the data model, i.e. unique `node.refKey`.
|
|
3105
|
+
*/
|
|
3106
|
+
countUnique(): number;
|
|
2962
3107
|
/** @internal sanity check. */
|
|
2963
3108
|
_check(): void;
|
|
2964
3109
|
/**
|
|
@@ -2999,7 +3144,7 @@ declare module "wunderbaum" {
|
|
|
2999
3144
|
* and wrap-around at the end.
|
|
3000
3145
|
* Used by quicksearch and keyboard navigation.
|
|
3001
3146
|
*/
|
|
3002
|
-
findNextNode(match: string | MatcherCallback, startNode?: WunderbaumNode | null): WunderbaumNode | null;
|
|
3147
|
+
findNextNode(match: string | MatcherCallback, startNode?: WunderbaumNode | null, reverse?: boolean): WunderbaumNode | null;
|
|
3003
3148
|
/**
|
|
3004
3149
|
* Find a node relative to another node.
|
|
3005
3150
|
*
|
|
@@ -3009,7 +3154,7 @@ declare module "wunderbaum" {
|
|
|
3009
3154
|
* e.g. `$.ui.keyCode.LEFT` = 'left'.
|
|
3010
3155
|
* @param includeHidden Not yet implemented
|
|
3011
3156
|
*/
|
|
3012
|
-
findRelatedNode(node: WunderbaumNode, where:
|
|
3157
|
+
findRelatedNode(node: WunderbaumNode, where: NavigationType, includeHidden?: boolean): any;
|
|
3013
3158
|
/**
|
|
3014
3159
|
* Iterator version of {@link Wunderbaum.format}.
|
|
3015
3160
|
*/
|
|
@@ -3053,6 +3198,10 @@ declare module "wunderbaum" {
|
|
|
3053
3198
|
* Return the first top level node if any (not the invisible root node).
|
|
3054
3199
|
*/
|
|
3055
3200
|
getFirstChild(): WunderbaumNode;
|
|
3201
|
+
/**
|
|
3202
|
+
* Return the last top level node if any (not the invisible root node).
|
|
3203
|
+
*/
|
|
3204
|
+
getLastChild(): WunderbaumNode;
|
|
3056
3205
|
/**
|
|
3057
3206
|
* Return the node that currently has keyboard focus or null.
|
|
3058
3207
|
* Alias for {@link Wunderbaum.focusNode}.
|
|
@@ -3138,6 +3287,10 @@ declare module "wunderbaum" {
|
|
|
3138
3287
|
/** Set or remove keyboard focus to the tree container. */
|
|
3139
3288
|
setFocus(flag?: boolean): void;
|
|
3140
3289
|
_setFocusNode(node: WunderbaumNode | null): void;
|
|
3290
|
+
/** Return the current selection/expansion/activation status. @experimental */
|
|
3291
|
+
getState(options: GetStateOptions): TreeStateDefinition;
|
|
3292
|
+
/** Apply selection/expansion/activation status. @experimental */
|
|
3293
|
+
setState(state: TreeStateDefinition, options: SetStateOptions): void;
|
|
3141
3294
|
/**
|
|
3142
3295
|
* Schedule an update request to reflect a tree change.
|
|
3143
3296
|
* The render operation is async and debounced unless the `immediate` option
|
|
@@ -3198,7 +3351,6 @@ declare module "wunderbaum" {
|
|
|
3198
3351
|
* Return true if at least one column width changed.
|
|
3199
3352
|
*/
|
|
3200
3353
|
_updateColumnWidths(): boolean;
|
|
3201
|
-
protected _insertIcon(icon: string, elem: HTMLElement): void;
|
|
3202
3354
|
/** Create/update header markup from `this.columns` definition.
|
|
3203
3355
|
* @internal
|
|
3204
3356
|
*/
|
|
@@ -3214,6 +3366,9 @@ declare module "wunderbaum" {
|
|
|
3214
3366
|
* pending async changes if any.
|
|
3215
3367
|
*/
|
|
3216
3368
|
updatePendingModifications(): void;
|
|
3369
|
+
/** @internal */
|
|
3370
|
+
_createNodeIcon(node: WunderbaumNode, showLoading: boolean, showBadge: boolean): HTMLElement | null;
|
|
3371
|
+
private _updateTopBreadcrumb;
|
|
3217
3372
|
/**
|
|
3218
3373
|
* This is the actual update method, which is wrapped inside a throttle method.
|
|
3219
3374
|
* It calls `updateColumns()` and `_updateRows()`.
|