wunderbaum 0.4.0 → 0.5.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.
- package/dist/wunderbaum.css +23 -3
- package/dist/wunderbaum.css.map +1 -1
- package/dist/wunderbaum.d.ts +133 -50
- package/dist/wunderbaum.esm.js +122 -81
- package/dist/wunderbaum.esm.min.js +23 -23
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +122 -81
- package/dist/wunderbaum.umd.min.js +30 -30
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/common.ts +44 -24
- package/src/types.ts +98 -21
- package/src/wb_ext_dnd.ts +1 -1
- package/src/wb_ext_filter.ts +4 -11
- package/src/wb_ext_logger.ts +2 -1
- package/src/wb_node.ts +63 -28
- package/src/wb_options.ts +31 -6
- package/src/wunderbaum.scss +36 -3
- package/src/wunderbaum.ts +28 -5
package/dist/wunderbaum.css
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
5
5
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
6
6
|
*/
|
|
7
|
-
:root
|
|
7
|
+
:root,
|
|
8
|
+
:host {
|
|
8
9
|
--wb-font-stack: Helvetica, sans-serif;
|
|
9
10
|
--wb-error-color: #b5373b;
|
|
10
11
|
--wb-node-text-color: #56534c;
|
|
@@ -347,13 +348,13 @@ div.wunderbaum div.wb-row.wb-drop-target .wb-node .wb-icon {
|
|
|
347
348
|
div.wunderbaum div.wb-row.wb-drop-target .wb-node .wb-icon::after {
|
|
348
349
|
position: absolute;
|
|
349
350
|
z-index: 1000;
|
|
350
|
-
content: url(
|
|
351
|
+
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAMAAABA3o1rAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACKUExURe/v9/f39+//7+f35+f/79bW5wgIawwYd97e55Tnpc731rjA2d7350LOY1LWa7Xvvf///wAQcyAze97e773vxnuczgA5pQBCpdb33rXvxu//9whjxgBaxlKU1oOz5ABz3gB73tbn99bW1rXe/wCM9xiU997v/97e3gCc/xil/9bv/wic/+/3/wAAALM9X5QAAAAudFJOU////////////////////////////////////////////////////////////wCCj3NVAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAqUlEQVQoU6WQ2w6CMAxA54agsCHq1HlFBREv/f/fs1tHAoaoiedlbXrWtGXwhV8FNqAXuAi4DwkShmE0cgGIcSwCCgkSkrAxpEonot0DhQxJptFsbnOpdNdgsFh6VtYwyqzTmG+oijDY7hr22E4qY7QybeGQe46nsxP0Wwc3Q1GWl+qKec8MlqKubxX+xzV7tkDuD1+3d+heigT2zGx/hCMUeUj4wL8CwAsW1kqCTugMCwAAAABJRU5ErkJggg==);
|
|
351
352
|
left: 0;
|
|
352
353
|
top: calc((22px - --wb-icon-height) / 2);
|
|
353
354
|
}
|
|
354
355
|
div.wunderbaum div.wb-row.wb-drop-target.wb-drop-before .wb-node .wb-icon::after,
|
|
355
356
|
div.wunderbaum div.wb-row.wb-drop-target.wb-drop-after .wb-node .wb-icon::after {
|
|
356
|
-
content: url(
|
|
357
|
+
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAAACROYkbAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAACNUExURe/v9/f39+//7+f35+f/79bW5wgIawwYd97e55Tnpc731rjA2d7350LOY1LWa7Xvvf///wAQcyAze97e773vxgAAAHuczgA5pQBCpdb33rXvxu//9whjxgBaxlKU1oOz5ABz3gB73tbn99bW1rXe/wCM9xiU997v/97e3gCc/xil/9bv/wic/+/3/wAAAParqS4AAAAvdFJOU/////////////////////////////////////////////////////////////8AWqU49wAAAAlwSFlzAAAOwwAADsMBx2+oZAAAALlJREFUOE/FktsSgiAQhglMS8WstKLzQTM77Ps/XguL16I208cFyzB8/LPAYCC/ErARzcCFx23pBgnGfjAxBYhpKDwq3SBB5DeGWCYz0SUDClIkmgeLpV7HMiNDbrbbYbBaWzbaoKTaJiHfQe5oYLA/NBwxTiyVyqTSghYwox4MTmfL5XozgqxjAtODoizv1QPXPXqgKer6WeH9+Iw9XgF5ve15/Q+6/SQSsE+q8yMcocoREgzg3wKAL4vrpBIKREShAAAAAElFTkSuQmCC);
|
|
357
358
|
left: 0;
|
|
358
359
|
top: calc((22px - --wb-icon-height) / 2 - 11px);
|
|
359
360
|
}
|
|
@@ -457,6 +458,25 @@ div.wunderbaum.wb-checkbox-auto-hide:focus .wb-row.wb-active i.wb-checkbox, div.
|
|
|
457
458
|
text-align: left;
|
|
458
459
|
}
|
|
459
460
|
|
|
461
|
+
i.wb-icon {
|
|
462
|
+
position: relative;
|
|
463
|
+
}
|
|
464
|
+
i.wb-icon > span.wb-badge {
|
|
465
|
+
position: absolute;
|
|
466
|
+
display: inline-block;
|
|
467
|
+
top: 0;
|
|
468
|
+
left: -0.6rem;
|
|
469
|
+
color: white;
|
|
470
|
+
background-color: var(--wb-bg-highlight-color);
|
|
471
|
+
padding: 0.2em 0.3rem 0.1em 0.3rem;
|
|
472
|
+
font-size: 60%;
|
|
473
|
+
font-weight: 200;
|
|
474
|
+
line-height: 1;
|
|
475
|
+
text-align: center;
|
|
476
|
+
white-space: nowrap;
|
|
477
|
+
border-radius: 0.5rem;
|
|
478
|
+
}
|
|
479
|
+
|
|
460
480
|
/* Class 'wb-tristate' is used to mark checkboxes that should toggle like
|
|
461
481
|
* indeterminate -> checked -> unchecked -> indeterminate ...
|
|
462
482
|
*/
|
package/dist/wunderbaum.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../src/wunderbaum.scss"],"names":[],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AA2EA;
|
|
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;AAkQA;AAoHA;AAwBA;AAgEA;AAEA;AAUA;AAoBA;AAYA;;AAniBA;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;AAeA;;AAVA;AAAA;AAAA;AAAA;EAIE;EACA;EACA;EACA;;AAIF;EACE;;AAGF;EACE;EACA;EACA;;AAMA;EACE;;AAIJ;AAAA;EAEE;EACA;EACA;EACA;;AAGF;EACE;EAEA;EACA;EACA;EACA;EACA;;AAUI;EACE;;AAON;EACE;;AAIJ;EACE;;AAEA;EACE;;AAIF;EACE;;AAGF;EACE;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAgBE;EACA;EACA;;AAGF;AAAA;EAEE;;AAcA;EACE;;AAWJ;EACE;;AAGF;EACE;;AAEA;EACE;;AAON;EACE;;AAEA;EACE;;AAQJ;EACE;;AASJ;EACE;;AAEA;EACE;;AAGF;EACE;;AAcN;EACE;;AAEA;EACE;;AAIJ;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;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAIJ;AAAA;AAAA;AAMA;EACE;EACA;;;AAGF;EAEE;EACA;;;AAGF;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE","file":"wunderbaum.css"}
|
package/dist/wunderbaum.d.ts
CHANGED
|
@@ -285,23 +285,10 @@ declare module "common" {
|
|
|
285
285
|
* Default node icons.
|
|
286
286
|
* Requires bootstrap icons https://icons.getbootstrap.com
|
|
287
287
|
*/
|
|
288
|
-
export const
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
expanderExpanded: string;
|
|
293
|
-
expanderCollapsed: string;
|
|
294
|
-
expanderLazy: string;
|
|
295
|
-
checkChecked: string;
|
|
296
|
-
checkUnchecked: string;
|
|
297
|
-
checkUnknown: string;
|
|
298
|
-
radioChecked: string;
|
|
299
|
-
radioUnchecked: string;
|
|
300
|
-
radioUnknown: string;
|
|
301
|
-
folder: string;
|
|
302
|
-
folderOpen: string;
|
|
303
|
-
folderLazy: string;
|
|
304
|
-
doc: string;
|
|
288
|
+
export const iconMaps: {
|
|
289
|
+
[key: string]: {
|
|
290
|
+
[key: string]: string;
|
|
291
|
+
};
|
|
305
292
|
};
|
|
306
293
|
export const KEY_NODATA = "__not_found__";
|
|
307
294
|
/** Define which keys are handled by embedded <input> control, and should
|
|
@@ -371,7 +358,7 @@ declare module "deferred" {
|
|
|
371
358
|
}
|
|
372
359
|
declare module "wb_node" {
|
|
373
360
|
import { Wunderbaum } from "wunderbaum";
|
|
374
|
-
import { AddChildrenOptions, InsertNodeType, ApplyCommandOptions, ApplyCommandType, ChangeType, ExpandAllOptions, MakeVisibleOptions, MatcherCallback, NavigateOptions, NodeAnyCallback, NodeStatusType, NodeStringCallback, NodeVisitCallback, NodeVisitResponse, RenderOptions, ScrollIntoViewOptions, SetActiveOptions, SetExpandedOptions, SetSelectedOptions, SetStatusOptions, SortCallback, NodeToDictCallback, WbNodeData, TristateType } from "types";
|
|
361
|
+
import { AddChildrenOptions, InsertNodeType, ApplyCommandOptions, ApplyCommandType, ChangeType, ExpandAllOptions, MakeVisibleOptions, MatcherCallback, NavigateOptions, NodeAnyCallback, NodeStatusType, NodeStringCallback, NodeVisitCallback, NodeVisitResponse, RenderOptions, ScrollIntoViewOptions, SetActiveOptions, SetExpandedOptions, SetSelectedOptions, SetStatusOptions, SortCallback, NodeToDictCallback, WbNodeData, TristateType, CheckboxOption, IconOption, SourceType } from "types";
|
|
375
362
|
/**
|
|
376
363
|
* A single tree node.
|
|
377
364
|
*
|
|
@@ -397,27 +384,27 @@ declare module "wb_node" {
|
|
|
397
384
|
*/
|
|
398
385
|
readonly refKey: string | undefined;
|
|
399
386
|
children: WunderbaumNode[] | null;
|
|
400
|
-
checkbox?:
|
|
387
|
+
checkbox?: CheckboxOption;
|
|
401
388
|
radiogroup?: boolean;
|
|
402
389
|
/** If true, (in grid mode) no cells are rendered, except for the node title.*/
|
|
403
390
|
colspan?: boolean;
|
|
404
|
-
icon?:
|
|
405
|
-
lazy
|
|
391
|
+
icon?: IconOption;
|
|
392
|
+
lazy?: boolean;
|
|
406
393
|
/** Expansion state.
|
|
407
394
|
* @see {@link isExpandable}, {@link isExpanded}, {@link setExpanded}. */
|
|
408
|
-
expanded
|
|
395
|
+
expanded?: boolean;
|
|
409
396
|
/** Selection state.
|
|
410
397
|
* @see {@link isSelected}, {@link setSelected}, {@link toggleSelected}. */
|
|
411
|
-
selected
|
|
398
|
+
selected?: boolean;
|
|
412
399
|
unselectable?: boolean;
|
|
413
400
|
type?: string;
|
|
414
|
-
tooltip?: string;
|
|
401
|
+
tooltip?: string | boolean;
|
|
415
402
|
/** Additional classes added to `div.wb-row`.
|
|
416
403
|
* @see {@link hasClass}, {@link setClass}. */
|
|
417
404
|
classes: Set<string> | null;
|
|
418
405
|
/** Custom data that was passed to the constructor */
|
|
419
406
|
data: any;
|
|
420
|
-
statusNodeType?:
|
|
407
|
+
statusNodeType?: NodeStatusType;
|
|
421
408
|
_isLoading: boolean;
|
|
422
409
|
_requestId: number;
|
|
423
410
|
_errorInfo: any | null;
|
|
@@ -640,6 +627,8 @@ declare module "wb_node" {
|
|
|
640
627
|
/** Return true if this node is partially selected (tri-state). */
|
|
641
628
|
isPartsel(): boolean;
|
|
642
629
|
/** Return true if this node has DOM representaion, i.e. is displayed in the viewport. */
|
|
630
|
+
isRadio(): boolean;
|
|
631
|
+
/** Return true if this node has DOM representaion, i.e. is displayed in the viewport. */
|
|
643
632
|
isRendered(): boolean;
|
|
644
633
|
/** Return true if this node is the (invisible) system root node.
|
|
645
634
|
* (See also [[isTopLevel()]].)
|
|
@@ -666,7 +655,7 @@ declare module "wb_node" {
|
|
|
666
655
|
protected _loadSourceObject(source: any, level?: number): void;
|
|
667
656
|
_fetchWithOptions(source: any): Promise<any>;
|
|
668
657
|
/** Download data from the cloud, then call `.update()`. */
|
|
669
|
-
load(source:
|
|
658
|
+
load(source: SourceType): Promise<void>;
|
|
670
659
|
/**Load content of a lazy node. */
|
|
671
660
|
loadLazy(forceReload?: boolean): Promise<void>;
|
|
672
661
|
/** Alias for `logDebug` */
|
|
@@ -703,7 +692,7 @@ declare module "wb_node" {
|
|
|
703
692
|
/** Remove all HTML markup from the DOM. */
|
|
704
693
|
removeMarkup(): void;
|
|
705
694
|
protected _getRenderInfo(): any;
|
|
706
|
-
protected _createIcon(parentElem: HTMLElement, replaceChild: HTMLElement | null, showLoading: boolean): HTMLElement | null;
|
|
695
|
+
protected _createIcon(iconMap: any, parentElem: HTMLElement, replaceChild: HTMLElement | null, showLoading: boolean): HTMLElement | null;
|
|
707
696
|
/**
|
|
708
697
|
* Create a whole new `<div class="wb-row">` element.
|
|
709
698
|
* @see {@link WunderbaumNode._render}
|
|
@@ -879,7 +868,7 @@ declare module "wb_options" {
|
|
|
879
868
|
* Copyright (c) 2021-2023, Martin Wendt. Released under the MIT license.
|
|
880
869
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
881
870
|
*/
|
|
882
|
-
import {
|
|
871
|
+
import { ColumnDefinitionList, DndOptionsType, DynamicBoolOption, DynamicBoolOrStringOption, DynamicCheckboxOption, DynamicIconOption, NavModeEnum, NodeTypeDefinitionMap, SelectModeType, WbActivateEventType, WbChangeEventType, WbClickEventType, WbDeactivateEventType, WbErrorEventType, WbIconBadgeCallback, WbInitEventType, WbKeydownEventType, WbNodeData, WbNodeEventType, WbReceiveEventType, WbRenderEventType, WbTreeEventType } from "types";
|
|
883
872
|
/**
|
|
884
873
|
* Available options for [[Wunderbaum]].
|
|
885
874
|
*
|
|
@@ -978,6 +967,15 @@ declare module "wb_options" {
|
|
|
978
967
|
* Default: 22
|
|
979
968
|
*/
|
|
980
969
|
rowHeightPx?: number;
|
|
970
|
+
/**
|
|
971
|
+
* Icon font definition. May be a string (e.g. "fontawesome6" or "bootstrap")
|
|
972
|
+
* or a map of `iconName: iconClass` pairs.
|
|
973
|
+
* Note: the icon font must be loaded separately.
|
|
974
|
+
* Default: "bootstrap"
|
|
975
|
+
*/
|
|
976
|
+
iconMap?: string | {
|
|
977
|
+
[key: string]: string;
|
|
978
|
+
};
|
|
981
979
|
/**
|
|
982
980
|
* Collapse siblings when a node is expanded.
|
|
983
981
|
* Default: false
|
|
@@ -1006,10 +1004,20 @@ declare module "wb_options" {
|
|
|
1006
1004
|
showSpinner?: boolean;
|
|
1007
1005
|
/**
|
|
1008
1006
|
* If true, render a checkbox before the node tile to allow selection with the
|
|
1009
|
-
* mouse.
|
|
1007
|
+
* mouse. Pass `"radio"` to render a radio button instead.
|
|
1010
1008
|
* Default: false.
|
|
1011
1009
|
*/
|
|
1012
|
-
checkbox?:
|
|
1010
|
+
checkbox?: DynamicCheckboxOption;
|
|
1011
|
+
/** Optional callback to render icons per node. */
|
|
1012
|
+
icon?: DynamicIconOption;
|
|
1013
|
+
/** Optional callback to render a tooltip for the icon. */
|
|
1014
|
+
iconTooltip?: DynamicBoolOrStringOption;
|
|
1015
|
+
/** Optional callback to render a tooltip for the node title.
|
|
1016
|
+
* Pass `true` to use the node's `title` property as tooltip.
|
|
1017
|
+
*/
|
|
1018
|
+
tooltip?: DynamicBoolOrStringOption;
|
|
1019
|
+
/** Optional callback to make a node unselectable. */
|
|
1020
|
+
unselectable?: DynamicBoolOption;
|
|
1013
1021
|
/**
|
|
1014
1022
|
* Default: true
|
|
1015
1023
|
*/
|
|
@@ -1073,7 +1081,7 @@ declare module "wb_options" {
|
|
|
1073
1081
|
*
|
|
1074
1082
|
* @category Callback
|
|
1075
1083
|
*/
|
|
1076
|
-
|
|
1084
|
+
iconBadge?: WbIconBadgeCallback;
|
|
1077
1085
|
/**
|
|
1078
1086
|
*
|
|
1079
1087
|
* @category Callback
|
|
@@ -1160,8 +1168,40 @@ declare module "types" {
|
|
|
1160
1168
|
import { Wunderbaum } from "wunderbaum";
|
|
1161
1169
|
/** A value that can either be true, false, or undefined. */
|
|
1162
1170
|
export type TristateType = boolean | undefined;
|
|
1171
|
+
/** Show/hide checkbox or display a radiobutton icon instead. */
|
|
1172
|
+
export type CheckboxOption = boolean | "radio";
|
|
1173
|
+
/** An icon may either be
|
|
1174
|
+
* a string-tag that references an entry in the `iconMap` (e.g. `"folderOpen"`)),
|
|
1175
|
+
* an HTML string that contains a `<` and is used as-is,
|
|
1176
|
+
* an image URL string that contains a `.` or `/` and is rendered as `<img src='...'>`,
|
|
1177
|
+
* a class string such as `"bi bi-folder"`,
|
|
1178
|
+
* or a boolean value that indicates if the default icon should be used or hidden.
|
|
1179
|
+
*/
|
|
1180
|
+
export type IconOption = boolean | string;
|
|
1181
|
+
export interface SourceAjaxType {
|
|
1182
|
+
url: string;
|
|
1183
|
+
params?: any;
|
|
1184
|
+
body?: any;
|
|
1185
|
+
options?: RequestInit;
|
|
1186
|
+
}
|
|
1187
|
+
export type SourceListType = Array<WbNodeData>;
|
|
1188
|
+
export interface SourceObjectType {
|
|
1189
|
+
_format?: "nested" | "flat";
|
|
1190
|
+
types?: NodeTypeDefinitionMap;
|
|
1191
|
+
columns?: ColumnDefinitionList;
|
|
1192
|
+
children: SourceListType;
|
|
1193
|
+
_keyMap?: {
|
|
1194
|
+
[key: string]: string;
|
|
1195
|
+
};
|
|
1196
|
+
_typeList?: Array<string>;
|
|
1197
|
+
_positional?: Array<string>;
|
|
1198
|
+
}
|
|
1199
|
+
/** Possible initilization for tree nodes. */
|
|
1200
|
+
export type SourceType = string | SourceListType | SourceAjaxType | SourceObjectType;
|
|
1163
1201
|
/** Passed to `find...()` methods. Should return true if node matches. */
|
|
1164
1202
|
export type MatcherCallback = (node: WunderbaumNode) => boolean;
|
|
1203
|
+
/** Used for `tree.iconBadge` event. */
|
|
1204
|
+
export type WbIconBadgeCallback = (e: WbIconBadgeEventType) => WbIconBadgeEventResultType;
|
|
1165
1205
|
/** Passed to `sortChildren()` methods. Should return -1, 0, or 1. */
|
|
1166
1206
|
export type SortCallback = (a: WunderbaumNode, b: WunderbaumNode) => number;
|
|
1167
1207
|
/** When set as option, called when the value is needed (e.g. `colspan` type definition). */
|
|
@@ -1180,17 +1220,39 @@ declare module "types" {
|
|
|
1180
1220
|
export type NodeToDictCallback = (dict: WbNodeData, node: WunderbaumNode) => NodeVisitResponse;
|
|
1181
1221
|
/** A callback that receives a node instance and returns a string value. */
|
|
1182
1222
|
export type NodeSelectCallback = (node: WunderbaumNode) => boolean | void;
|
|
1223
|
+
/**
|
|
1224
|
+
* See also {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
|
|
1225
|
+
* to evaluate `node.NAME` setting and `tree.types[node.type].NAME`.
|
|
1226
|
+
*/
|
|
1227
|
+
export type DynamicBoolOption = boolean | BoolOptionResolver;
|
|
1228
|
+
export type DynamicStringOption = string | BoolOptionResolver;
|
|
1229
|
+
export type DynamicBoolOrStringOption = boolean | string | BoolOrStringOptionResolver;
|
|
1230
|
+
export type DynamicCheckboxOption = CheckboxOption | BoolOrStringOptionResolver;
|
|
1231
|
+
export type DynamicIconOption = IconOption | BoolOrStringOptionResolver;
|
|
1183
1232
|
/** A plain object (dictionary) that represents a node instance. */
|
|
1184
1233
|
export interface WbNodeData {
|
|
1185
|
-
|
|
1234
|
+
checkbox?: CheckboxOption;
|
|
1235
|
+
children?: Array<WbNodeData>;
|
|
1236
|
+
classes?: string;
|
|
1237
|
+
colspan?: boolean;
|
|
1238
|
+
expanded?: boolean;
|
|
1239
|
+
icon?: IconOption;
|
|
1240
|
+
iconTooltip?: boolean | string;
|
|
1186
1241
|
key?: string;
|
|
1242
|
+
lazy?: boolean;
|
|
1243
|
+
/** Make child nodes single-select radio buttons. */
|
|
1244
|
+
radiogroup?: boolean;
|
|
1187
1245
|
refKey?: string;
|
|
1188
|
-
expanded?: boolean;
|
|
1189
1246
|
selected?: boolean;
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1247
|
+
statusNodeType?: NodeStatusType;
|
|
1248
|
+
title: string;
|
|
1249
|
+
tooltip?: boolean | string;
|
|
1250
|
+
type?: string;
|
|
1251
|
+
unselectable?: boolean;
|
|
1252
|
+
/** @internal */
|
|
1253
|
+
_treeId?: string;
|
|
1254
|
+
/** Other data is passed to `node.data` and can be accessed via `node.data.NAME` */
|
|
1255
|
+
[key: string]: unknown;
|
|
1194
1256
|
}
|
|
1195
1257
|
export interface WbTreeEventType {
|
|
1196
1258
|
/** Name of the event. */
|
|
@@ -1237,8 +1299,16 @@ declare module "types" {
|
|
|
1237
1299
|
/** The original event. */
|
|
1238
1300
|
event: Event;
|
|
1239
1301
|
}
|
|
1240
|
-
export interface
|
|
1241
|
-
|
|
1302
|
+
export interface WbIconBadgeEventType extends WbNodeEventType {
|
|
1303
|
+
iconSpan: HTMLElement;
|
|
1304
|
+
}
|
|
1305
|
+
export interface WbIconBadgeEventResultType {
|
|
1306
|
+
/** Content of the badge `<span class='wb-badge'>` if any. */
|
|
1307
|
+
badge: string | number | HTMLSpanElement | null | false;
|
|
1308
|
+
/** Additional class name(s), separate with space. */
|
|
1309
|
+
badgeClass?: string;
|
|
1310
|
+
/** Additional class name(s), separate with space. */
|
|
1311
|
+
badgeTooltip?: string;
|
|
1242
1312
|
}
|
|
1243
1313
|
export interface WbFocusEventType extends WbTreeEventType {
|
|
1244
1314
|
/** The original event. */
|
|
@@ -1284,21 +1354,21 @@ declare module "types" {
|
|
|
1284
1354
|
}
|
|
1285
1355
|
/**
|
|
1286
1356
|
* Contains the node's type information, i.e. `tree.types[node.type]` if
|
|
1287
|
-
* defined.
|
|
1357
|
+
* defined.
|
|
1358
|
+
* @see {@link Wunderbaum.types} and {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
|
|
1359
|
+
* to evaluate `node.NAME` setting and `tree.types[node.type].NAME`.
|
|
1288
1360
|
*/
|
|
1289
1361
|
export interface NodeTypeDefinition {
|
|
1290
1362
|
/** En/disable checkbox for matching nodes. */
|
|
1291
|
-
checkbox?:
|
|
1363
|
+
checkbox?: CheckboxOption;
|
|
1292
1364
|
/** Optional class names that are added to all `div.wb-row` elements of matching nodes. */
|
|
1293
1365
|
classes?: string;
|
|
1294
1366
|
/** Only show title and hide other columns if any. */
|
|
1295
|
-
colspan?: boolean
|
|
1367
|
+
colspan?: boolean;
|
|
1296
1368
|
/** Default icon for matching nodes. */
|
|
1297
|
-
icon?:
|
|
1298
|
-
/**
|
|
1299
|
-
|
|
1300
|
-
* to evaluate `node.NAME` setting and `tree.types[node.type].NAME`.
|
|
1301
|
-
*/
|
|
1369
|
+
icon?: IconOption;
|
|
1370
|
+
/** Default icon for matching nodes. */
|
|
1371
|
+
iconTooltip?: string | boolean;
|
|
1302
1372
|
[key: string]: unknown;
|
|
1303
1373
|
}
|
|
1304
1374
|
export type NodeTypeDefinitionMap = {
|
|
@@ -1338,6 +1408,7 @@ declare module "types" {
|
|
|
1338
1408
|
_weight?: number;
|
|
1339
1409
|
_widthPx?: number;
|
|
1340
1410
|
_ofsPx?: number;
|
|
1411
|
+
[key: string]: unknown;
|
|
1341
1412
|
}
|
|
1342
1413
|
export type ColumnDefinitionList = Array<ColumnDefinition>;
|
|
1343
1414
|
/**
|
|
@@ -1419,7 +1490,8 @@ declare module "types" {
|
|
|
1419
1490
|
ok = "ok",
|
|
1420
1491
|
loading = "loading",
|
|
1421
1492
|
error = "error",
|
|
1422
|
-
noData = "noData"
|
|
1493
|
+
noData = "noData",
|
|
1494
|
+
paging = "paging"
|
|
1423
1495
|
}
|
|
1424
1496
|
/** Define the subregion of a node, where an event occurred. */
|
|
1425
1497
|
export enum NodeRegion {
|
|
@@ -2070,7 +2142,7 @@ declare module "wunderbaum" {
|
|
|
2070
2142
|
*/
|
|
2071
2143
|
import * as util from "util";
|
|
2072
2144
|
import { ExtensionsDict, WunderbaumExtension } from "wb_extension_base";
|
|
2073
|
-
import { ApplyCommandType, ChangeType, ColumnDefinitionList, ExpandAllOptions, FilterModeType, MatcherCallback, NavModeEnum, NodeStatusType, NodeStringCallback, NodeTypeDefinitionMap, ScrollToOptions, SetActiveOptions, UpdateOptions, SetStatusOptions, WbEventInfo, ApplyCommandOptions, AddChildrenOptions, VisitRowsOptions, NodeFilterCallback, FilterNodesOptions, RenderFlag, NodeVisitCallback, SortCallback, NodeToDictCallback, WbNodeData } from "types";
|
|
2145
|
+
import { ApplyCommandType, ChangeType, ColumnDefinitionList, ExpandAllOptions, FilterModeType, MatcherCallback, NavModeEnum, NodeStatusType, NodeStringCallback, NodeTypeDefinitionMap, ScrollToOptions, SetActiveOptions, UpdateOptions, SetStatusOptions, WbEventInfo, ApplyCommandOptions, AddChildrenOptions, VisitRowsOptions, NodeFilterCallback, FilterNodesOptions, RenderFlag, NodeVisitCallback, SortCallback, NodeToDictCallback, WbNodeData, DynamicCheckboxOption, SourceType, DynamicIconOption, DynamicStringOption, DynamicBoolOption } from "types";
|
|
2074
2146
|
import { WunderbaumNode } from "wb_node";
|
|
2075
2147
|
import { WunderbaumOptions } from "wb_options";
|
|
2076
2148
|
/**
|
|
@@ -2117,6 +2189,11 @@ declare module "wunderbaum" {
|
|
|
2117
2189
|
types: NodeTypeDefinitionMap;
|
|
2118
2190
|
/** List of column definitions. */
|
|
2119
2191
|
columns: ColumnDefinitionList;
|
|
2192
|
+
checkbox?: DynamicCheckboxOption;
|
|
2193
|
+
icon?: DynamicIconOption;
|
|
2194
|
+
iconTooltip?: DynamicStringOption;
|
|
2195
|
+
tooltip?: DynamicStringOption;
|
|
2196
|
+
unselectable?: DynamicBoolOption;
|
|
2120
2197
|
protected _columnsById: {
|
|
2121
2198
|
[key: string]: any;
|
|
2122
2199
|
};
|
|
@@ -2151,6 +2228,12 @@ declare module "wunderbaum" {
|
|
|
2151
2228
|
* ```
|
|
2152
2229
|
*/
|
|
2153
2230
|
static getTree(el?: Element | Event | number | string | WunderbaumNode): Wunderbaum | null;
|
|
2231
|
+
/**
|
|
2232
|
+
* Return the icon-function -> icon-definition mapping.
|
|
2233
|
+
*/
|
|
2234
|
+
get iconMap(): {
|
|
2235
|
+
[key: string]: string;
|
|
2236
|
+
};
|
|
2154
2237
|
/**
|
|
2155
2238
|
* Return a WunderbaumNode instance from element or event.
|
|
2156
2239
|
*/
|
|
@@ -2530,7 +2613,7 @@ declare module "wunderbaum" {
|
|
|
2530
2613
|
* Previous data is cleared. Note that also column- and type defintions may
|
|
2531
2614
|
* be passed with the `source` object.
|
|
2532
2615
|
*/
|
|
2533
|
-
load(source:
|
|
2616
|
+
load(source: SourceType): Promise<void>;
|
|
2534
2617
|
/**
|
|
2535
2618
|
* Disable render requests during operations that would trigger many updates.
|
|
2536
2619
|
*
|