wunderbaum 0.0.9 → 0.1.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 +2 -2
- package/dist/wunderbaum.d.ts +196 -78
- package/dist/wunderbaum.esm.js +191 -147
- package/dist/wunderbaum.esm.min.js +22 -22
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +191 -147
- package/dist/wunderbaum.umd.min.js +25 -25
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +171 -37
- package/src/wb_ext_dnd.ts +1 -1
- package/src/wb_ext_edit.ts +11 -9
- package/src/wb_ext_filter.ts +17 -7
- package/src/wb_ext_keynav.ts +40 -21
- package/src/wb_node.ts +60 -24
- package/src/wb_options.ts +31 -17
- package/src/wunderbaum.scss +62 -21
- package/src/wunderbaum.ts +92 -77
package/dist/wunderbaum.d.ts
CHANGED
|
@@ -337,7 +337,7 @@ declare module "wb_options" {
|
|
|
337
337
|
* Copyright (c) 2021-2022, Martin Wendt. Released under the MIT license.
|
|
338
338
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
339
339
|
*/
|
|
340
|
-
import { BoolOptionResolver, ColumnDefinitionList, DndOptionsType,
|
|
340
|
+
import { BoolOptionResolver, ColumnDefinitionList, DndOptionsType, NavModeEnum, NodeTypeDefinitionMap, WbActivateEventType, WbChangeEventType, WbClickEventType, WbDeactivateEventType, WbEnhanceTitleEventType, WbErrorEventType, WbInitEventType, WbKeydownEventType, WbNodeEventType, WbReceiveEventType, WbRenderEventType, WbTreeEventType } from "types";
|
|
341
341
|
export interface WbNodeData {
|
|
342
342
|
title: string;
|
|
343
343
|
key?: string;
|
|
@@ -345,6 +345,7 @@ declare module "wb_options" {
|
|
|
345
345
|
expanded?: boolean;
|
|
346
346
|
selected?: boolean;
|
|
347
347
|
checkbox?: boolean | string;
|
|
348
|
+
colspan?: boolean;
|
|
348
349
|
children?: Array<WbNodeData>;
|
|
349
350
|
}
|
|
350
351
|
/**
|
|
@@ -403,7 +404,7 @@ declare module "wb_options" {
|
|
|
403
404
|
*
|
|
404
405
|
* Default: `{}`.
|
|
405
406
|
*/
|
|
406
|
-
types?:
|
|
407
|
+
types?: NodeTypeDefinitionMap;
|
|
407
408
|
/**
|
|
408
409
|
* A list of maps that define column headers. If this option is set,
|
|
409
410
|
* Wunderbaum becomes a treegrid control instead of a plain tree.
|
|
@@ -450,9 +451,9 @@ declare module "wb_options" {
|
|
|
450
451
|
*/
|
|
451
452
|
connectTopBreadcrumb?: HTMLElement;
|
|
452
453
|
/**
|
|
453
|
-
* Default:
|
|
454
|
+
* Default: NavModeEnum.startRow
|
|
454
455
|
*/
|
|
455
|
-
navigationModeOption?:
|
|
456
|
+
navigationModeOption?: NavModeEnum;
|
|
456
457
|
/**
|
|
457
458
|
* Show/hide header (default: null)
|
|
458
459
|
* null: assume false for plain tree and true for grids.
|
|
@@ -495,32 +496,36 @@ declare module "wb_options" {
|
|
|
495
496
|
*
|
|
496
497
|
* @category Callback
|
|
497
498
|
*/
|
|
498
|
-
activate?: (e:
|
|
499
|
+
activate?: (e: WbActivateEventType) => void;
|
|
499
500
|
/**
|
|
500
501
|
*
|
|
502
|
+
* Return `false` to prevent default handling, e.g. activating the node.
|
|
501
503
|
* @category Callback
|
|
502
504
|
*/
|
|
503
|
-
|
|
505
|
+
beforeActivate?: (e: WbActivateEventType) => void;
|
|
504
506
|
/**
|
|
505
507
|
*
|
|
506
|
-
* Return `false` to prevent default handling, e.g. activating the node.
|
|
507
508
|
* @category Callback
|
|
508
509
|
*/
|
|
509
|
-
|
|
510
|
+
change?: (e: WbChangeEventType) => void;
|
|
510
511
|
/**
|
|
511
512
|
*
|
|
512
513
|
* Return `false` to prevent default handling, e.g. activating the node.
|
|
513
514
|
* @category Callback
|
|
514
515
|
*/
|
|
515
|
-
|
|
516
|
+
click?: (e: WbClickEventType) => void;
|
|
516
517
|
/**
|
|
518
|
+
*
|
|
519
|
+
* @category Callback
|
|
520
|
+
*/
|
|
521
|
+
dblclick?: (e: WbClickEventType) => void;
|
|
517
522
|
/**
|
|
518
523
|
*
|
|
519
524
|
* Return `false` to prevent default handling, e.g. deactivating the node
|
|
520
525
|
* and activating the next.
|
|
521
526
|
* @category Callback
|
|
522
527
|
*/
|
|
523
|
-
deactivate?: (e:
|
|
528
|
+
deactivate?: (e: WbDeactivateEventType) => void;
|
|
524
529
|
/**
|
|
525
530
|
*
|
|
526
531
|
* @category Callback
|
|
@@ -530,12 +535,12 @@ declare module "wb_options" {
|
|
|
530
535
|
*
|
|
531
536
|
* @category Callback
|
|
532
537
|
*/
|
|
533
|
-
enhanceTitle?: (e:
|
|
538
|
+
enhanceTitle?: (e: WbEnhanceTitleEventType) => void;
|
|
534
539
|
/**
|
|
535
540
|
*
|
|
536
541
|
* @category Callback
|
|
537
542
|
*/
|
|
538
|
-
error?: (e:
|
|
543
|
+
error?: (e: WbErrorEventType) => void;
|
|
539
544
|
/**
|
|
540
545
|
*
|
|
541
546
|
* Check `e.flag` for status.
|
|
@@ -549,12 +554,12 @@ declare module "wb_options" {
|
|
|
549
554
|
* Check `e.error` for status.
|
|
550
555
|
* @category Callback
|
|
551
556
|
*/
|
|
552
|
-
init?: (e:
|
|
557
|
+
init?: (e: WbInitEventType) => void;
|
|
553
558
|
/**
|
|
554
559
|
*
|
|
555
560
|
* @category Callback
|
|
556
561
|
*/
|
|
557
|
-
keydown?: (e:
|
|
562
|
+
keydown?: (e: WbKeydownEventType) => void;
|
|
558
563
|
/**
|
|
559
564
|
* Fires when a node that was marked 'lazy', is expanded for the first time.
|
|
560
565
|
* Typically we return an endpoint URL or the Promise of a fetch request that
|
|
@@ -579,7 +584,7 @@ declare module "wb_options" {
|
|
|
579
584
|
* external response to native Wunderbaum syntax.
|
|
580
585
|
* @category Callback
|
|
581
586
|
*/
|
|
582
|
-
receive?: (e:
|
|
587
|
+
receive?: (e: WbReceiveEventType) => void;
|
|
583
588
|
/**
|
|
584
589
|
* Fires when a node is about to be displayed.
|
|
585
590
|
* The default HTML markup is already created, but not yet added to the DOM.
|
|
@@ -593,7 +598,7 @@ declare module "wb_options" {
|
|
|
593
598
|
*
|
|
594
599
|
* @category Callback
|
|
595
600
|
*/
|
|
596
|
-
renderStatusNode?: (e:
|
|
601
|
+
renderStatusNode?: (e: WbRenderEventType) => void;
|
|
597
602
|
/**
|
|
598
603
|
*
|
|
599
604
|
* Check `e.flag` for status.
|
|
@@ -615,7 +620,7 @@ declare module "wb_node" {
|
|
|
615
620
|
*/
|
|
616
621
|
import "./wunderbaum.scss";
|
|
617
622
|
import { Wunderbaum } from "wunderbaum";
|
|
618
|
-
import { AddChildrenOptions, AddNodeType, ApplyCommandType, ChangeType, ExpandAllOptions, MakeVisibleOptions, MatcherCallback, NodeAnyCallback, NodeStatusType, NodeStringCallback, NodeVisitCallback, NodeVisitResponse, ScrollIntoViewOptions, SetActiveOptions, SetExpandedOptions, SetSelectedOptions, SetStatusOptions } from "types";
|
|
623
|
+
import { AddChildrenOptions, AddNodeType, ApplyCommandOptions, ApplyCommandType, ChangeType, ExpandAllOptions, MakeVisibleOptions, MatcherCallback, NavigateOptions, NodeAnyCallback, NodeStatusType, NodeStringCallback, NodeVisitCallback, NodeVisitResponse, RenderOptions, ScrollIntoViewOptions, SetActiveOptions, SetExpandedOptions, SetSelectedOptions, SetStatusOptions } from "types";
|
|
619
624
|
import { WbNodeData } from "wb_options";
|
|
620
625
|
/**
|
|
621
626
|
* A single tree node.
|
|
@@ -722,7 +727,7 @@ declare module "wb_node" {
|
|
|
722
727
|
*
|
|
723
728
|
* @see {@link Wunderbaum.applyCommand}
|
|
724
729
|
*/
|
|
725
|
-
applyCommand(cmd: ApplyCommandType,
|
|
730
|
+
applyCommand(cmd: ApplyCommandType, options: ApplyCommandOptions): any;
|
|
726
731
|
/**
|
|
727
732
|
* Add/remove one or more classes to `<div class='wb-row'>`.
|
|
728
733
|
*
|
|
@@ -777,7 +782,7 @@ declare module "wb_node" {
|
|
|
777
782
|
*/
|
|
778
783
|
format_iter(name_cb?: NodeStringCallback, connectors?: string[]): IterableIterator<string>;
|
|
779
784
|
/**
|
|
780
|
-
* Return multiline string representation of a node/subnode hierarchy.
|
|
785
|
+
* Return a multiline string representation of a node/subnode hierarchy.
|
|
781
786
|
* Mostly useful for debugging.
|
|
782
787
|
*
|
|
783
788
|
* Example:
|
|
@@ -789,7 +794,6 @@ declare module "wb_node" {
|
|
|
789
794
|
* Books
|
|
790
795
|
* ├─ Art of War
|
|
791
796
|
* ╰─ Don Quixote
|
|
792
|
-
* ...
|
|
793
797
|
* ```
|
|
794
798
|
* @see {@link WunderbaumNode.format_iter}
|
|
795
799
|
*/
|
|
@@ -833,7 +837,11 @@ declare module "wb_node" {
|
|
|
833
837
|
hasClass(className: string): boolean;
|
|
834
838
|
/** Return true if this node is the currently active tree node. */
|
|
835
839
|
isActive(): boolean;
|
|
836
|
-
/** Return true if this node is a
|
|
840
|
+
/** Return true if this node is a direct or indirect parent of `other`.
|
|
841
|
+
* (See also [[isParentOf]].)
|
|
842
|
+
*/
|
|
843
|
+
isAncestorOf(other: WunderbaumNode): boolean;
|
|
844
|
+
/** Return true if this node is a **direct** subnode of `other`.
|
|
837
845
|
* (See also [[isDescendantOf]].)
|
|
838
846
|
*/
|
|
839
847
|
isChildOf(other: WunderbaumNode): boolean;
|
|
@@ -841,7 +849,7 @@ declare module "wb_node" {
|
|
|
841
849
|
* grid cells.
|
|
842
850
|
*/
|
|
843
851
|
isColspan(): boolean;
|
|
844
|
-
/** Return true if this node is a direct or indirect
|
|
852
|
+
/** Return true if this node is a direct or indirect subnode of `other`.
|
|
845
853
|
* (See also [[isChildOf]].)
|
|
846
854
|
*/
|
|
847
855
|
isDescendantOf(other: WunderbaumNode): boolean;
|
|
@@ -866,6 +874,10 @@ declare module "wb_node" {
|
|
|
866
874
|
isLoading(): boolean;
|
|
867
875
|
/** Return true if this node is a temporarily generated status node of type 'paging'. */
|
|
868
876
|
isPagingNode(): boolean;
|
|
877
|
+
/** Return true if this node is a **direct** parent of `other`.
|
|
878
|
+
* (See also [[isAncestorOf]].)
|
|
879
|
+
*/
|
|
880
|
+
isParentOf(other: WunderbaumNode): boolean;
|
|
869
881
|
/** (experimental) Return true if this node is partially loaded. */
|
|
870
882
|
isPartload(): boolean;
|
|
871
883
|
/** Return true if this node is partially selected (tri-state). */
|
|
@@ -923,7 +935,7 @@ declare module "wb_node" {
|
|
|
923
935
|
* e.g. `ArrowLeft` = 'left'.
|
|
924
936
|
* @param options
|
|
925
937
|
*/
|
|
926
|
-
navigate(where: string, options?:
|
|
938
|
+
navigate(where: string, options?: NavigateOptions): Promise<any>;
|
|
927
939
|
/** Delete this node and all descendants. */
|
|
928
940
|
remove(): void;
|
|
929
941
|
/** Remove all descendants of this node. */
|
|
@@ -936,18 +948,18 @@ declare module "wb_node" {
|
|
|
936
948
|
* Create a whole new `<div class="wb-row">` element.
|
|
937
949
|
* @see {@link WunderbaumNode.render}
|
|
938
950
|
*/
|
|
939
|
-
protected _render_markup(opts:
|
|
951
|
+
protected _render_markup(opts: RenderOptions): void;
|
|
940
952
|
/**
|
|
941
953
|
* Render `node.title`, `.icon` into an existing row.
|
|
942
954
|
*
|
|
943
955
|
* @see {@link WunderbaumNode.render}
|
|
944
956
|
*/
|
|
945
|
-
protected _render_data(opts:
|
|
957
|
+
protected _render_data(opts: RenderOptions): void;
|
|
946
958
|
/**
|
|
947
959
|
* Update row classes to reflect active, focuses, etc.
|
|
948
960
|
* @see {@link WunderbaumNode.render}
|
|
949
961
|
*/
|
|
950
|
-
protected _render_status(opts:
|
|
962
|
+
protected _render_status(opts: RenderOptions): void;
|
|
951
963
|
/**
|
|
952
964
|
* Create or update node's markup.
|
|
953
965
|
*
|
|
@@ -962,7 +974,7 @@ declare module "wb_node" {
|
|
|
962
974
|
* Calling `setModified` instead may be a better alternative.
|
|
963
975
|
* @see {@link WunderbaumNode.setModified}
|
|
964
976
|
*/
|
|
965
|
-
render(options?:
|
|
977
|
+
render(options?: RenderOptions): void;
|
|
966
978
|
/**
|
|
967
979
|
* Remove all children, collapse, and set the lazy-flag, so that the lazyLoad
|
|
968
980
|
* event is triggered on next expand.
|
|
@@ -1098,8 +1110,10 @@ declare module "types" {
|
|
|
1098
1110
|
export interface WbTreeEventType {
|
|
1099
1111
|
/** Name of the event. */
|
|
1100
1112
|
type: string;
|
|
1101
|
-
/** The affected tree. */
|
|
1113
|
+
/** The affected tree instance. */
|
|
1102
1114
|
tree: Wunderbaum;
|
|
1115
|
+
/** Exposed utility module methods. */
|
|
1116
|
+
util: any;
|
|
1103
1117
|
/** Originating HTML event, e.g. `click` if any. */
|
|
1104
1118
|
event?: Event;
|
|
1105
1119
|
}
|
|
@@ -1112,6 +1126,53 @@ declare module "types" {
|
|
|
1112
1126
|
*/
|
|
1113
1127
|
typeInfo: NodeTypeDefinition;
|
|
1114
1128
|
}
|
|
1129
|
+
export interface WbActivateEventType extends WbNodeEventType {
|
|
1130
|
+
prevNode: WunderbaumNode;
|
|
1131
|
+
/** The original event. */
|
|
1132
|
+
event: Event;
|
|
1133
|
+
}
|
|
1134
|
+
export interface WbChangeEventType extends WbNodeEventType {
|
|
1135
|
+
info: WbEventInfo;
|
|
1136
|
+
inputElem: HTMLInputElement;
|
|
1137
|
+
inputValue: any;
|
|
1138
|
+
}
|
|
1139
|
+
export interface WbClickEventType extends WbTreeEventType {
|
|
1140
|
+
/** The original event. */
|
|
1141
|
+
event: MouseEvent;
|
|
1142
|
+
node: WunderbaumNode;
|
|
1143
|
+
info: WbEventInfo;
|
|
1144
|
+
}
|
|
1145
|
+
export interface WbErrorEventType extends WbNodeEventType {
|
|
1146
|
+
error: any;
|
|
1147
|
+
}
|
|
1148
|
+
export interface WbDeactivateEventType extends WbNodeEventType {
|
|
1149
|
+
nextNode: WunderbaumNode;
|
|
1150
|
+
/** The original event. */
|
|
1151
|
+
event: Event;
|
|
1152
|
+
}
|
|
1153
|
+
export interface WbEnhanceTitleEventType extends WbNodeEventType {
|
|
1154
|
+
titleSpan: HTMLSpanElement;
|
|
1155
|
+
}
|
|
1156
|
+
export interface WbFocusEventType extends WbTreeEventType {
|
|
1157
|
+
/** The original event. */
|
|
1158
|
+
event: FocusEvent;
|
|
1159
|
+
/** True if `focusin`, false if `focusout`. */
|
|
1160
|
+
flag: boolean;
|
|
1161
|
+
}
|
|
1162
|
+
export interface WbKeydownEventType extends WbTreeEventType {
|
|
1163
|
+
/** The original event. */
|
|
1164
|
+
event: KeyboardEvent;
|
|
1165
|
+
node: WunderbaumNode;
|
|
1166
|
+
info: WbEventInfo;
|
|
1167
|
+
/** Canical name of the key including modifiers. @see {@link eventToString} */
|
|
1168
|
+
eventName: string;
|
|
1169
|
+
}
|
|
1170
|
+
export interface WbInitEventType extends WbTreeEventType {
|
|
1171
|
+
error?: any;
|
|
1172
|
+
}
|
|
1173
|
+
export interface WbReceiveEventType extends WbNodeEventType {
|
|
1174
|
+
response: any;
|
|
1175
|
+
}
|
|
1115
1176
|
export interface WbRenderEventType extends WbNodeEventType {
|
|
1116
1177
|
/**
|
|
1117
1178
|
* True if the node's markup was not yet created. In this case the render
|
|
@@ -1119,35 +1180,35 @@ declare module "types" {
|
|
|
1119
1180
|
* values according to to current node data).
|
|
1120
1181
|
*/
|
|
1121
1182
|
isNew: boolean;
|
|
1122
|
-
/** True if the node only displays the title and is stretched over all remaining columns. */
|
|
1123
|
-
isColspan: boolean;
|
|
1124
1183
|
/** The node's `<span class='wb-node'>` element. */
|
|
1125
1184
|
nodeElem: HTMLSpanElement;
|
|
1185
|
+
/** True if the node only displays the title and is stretched over all remaining columns. */
|
|
1186
|
+
isColspan: boolean;
|
|
1126
1187
|
/**
|
|
1127
1188
|
* Array of node's `<span class='wb-col'>` elements.
|
|
1128
1189
|
* The first element is `<span class='wb-node wb-col'>`, which contains the
|
|
1129
1190
|
* node title and icon (`idx: 0`, id: '*'`).
|
|
1130
1191
|
*/
|
|
1131
|
-
allColInfosById:
|
|
1192
|
+
allColInfosById: ColumnEventInfoMap;
|
|
1132
1193
|
/**
|
|
1133
1194
|
* Array of node's `<span class='wb-node'>` elements, *that should be rendered*.
|
|
1134
1195
|
* In contrast to `allColInfosById`, the node title is not part of this array.
|
|
1135
1196
|
* If node.isColspan() is true, this array is empty (`[]`).
|
|
1136
1197
|
*/
|
|
1137
|
-
renderColInfosById:
|
|
1198
|
+
renderColInfosById: ColumnEventInfoMap;
|
|
1138
1199
|
}
|
|
1139
1200
|
/**
|
|
1140
1201
|
* Contains the node's type information, i.e. `tree.types[node.type]` if
|
|
1141
1202
|
* defined. @see {@link Wunderbaum.types}
|
|
1142
1203
|
*/
|
|
1143
1204
|
export interface NodeTypeDefinition {
|
|
1144
|
-
/** En/disable checkbox for matching nodes
|
|
1205
|
+
/** En/disable checkbox for matching nodes. */
|
|
1145
1206
|
checkbox?: boolean | BoolOrStringOptionResolver;
|
|
1146
|
-
/**
|
|
1147
|
-
colspan?: boolean | BoolOptionResolver;
|
|
1148
|
-
/** Optional class names that are added to all `div.wb-row` elements of matching nodes.*/
|
|
1207
|
+
/** Optional class names that are added to all `div.wb-row` elements of matching nodes. */
|
|
1149
1208
|
classes?: string;
|
|
1150
|
-
/**
|
|
1209
|
+
/** Only show title and hide other columns if any. */
|
|
1210
|
+
colspan?: boolean | BoolOptionResolver;
|
|
1211
|
+
/** Default icon for matching nodes. */
|
|
1151
1212
|
icon?: boolean | string | BoolOrStringOptionResolver;
|
|
1152
1213
|
/**
|
|
1153
1214
|
* See also {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
|
|
@@ -1155,10 +1216,11 @@ declare module "types" {
|
|
|
1155
1216
|
*/
|
|
1156
1217
|
[key: string]: unknown;
|
|
1157
1218
|
}
|
|
1158
|
-
export type
|
|
1219
|
+
export type NodeTypeDefinitionMap = {
|
|
1159
1220
|
[type: string]: NodeTypeDefinition;
|
|
1160
1221
|
};
|
|
1161
1222
|
/**
|
|
1223
|
+
* Column type definitions.
|
|
1162
1224
|
* @see {@link `Wunderbaum.columns`}
|
|
1163
1225
|
*/
|
|
1164
1226
|
export interface ColumnDefinition {
|
|
@@ -1187,6 +1249,9 @@ declare module "types" {
|
|
|
1187
1249
|
_ofsPx?: number;
|
|
1188
1250
|
}
|
|
1189
1251
|
export type ColumnDefinitionList = Array<ColumnDefinition>;
|
|
1252
|
+
/**
|
|
1253
|
+
* Column information (passed to the `render` event).
|
|
1254
|
+
*/
|
|
1190
1255
|
export interface ColumnEventInfo {
|
|
1191
1256
|
/** Column ID as defined in `tree.columns` definition ("*" for title column). */
|
|
1192
1257
|
id: string;
|
|
@@ -1197,12 +1262,29 @@ declare module "types" {
|
|
|
1197
1262
|
/** The value of `tree.columns[]` for the current index. */
|
|
1198
1263
|
info: ColumnDefinition;
|
|
1199
1264
|
}
|
|
1200
|
-
export type
|
|
1265
|
+
export type ColumnEventInfoMap = {
|
|
1201
1266
|
[colId: string]: ColumnEventInfo;
|
|
1202
1267
|
};
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1268
|
+
/**
|
|
1269
|
+
* Additional inforation derived from mouse or keyboard events.
|
|
1270
|
+
* @see {@link Wunderbaum.getEventInfo}
|
|
1271
|
+
*/
|
|
1272
|
+
export interface WbEventInfo {
|
|
1273
|
+
/** The tree instance. */
|
|
1274
|
+
tree: Wunderbaum;
|
|
1275
|
+
/** The affected node instance instance if any. */
|
|
1276
|
+
node: WunderbaumNode | null;
|
|
1277
|
+
/** The affected part of the node span (e.g. title, expander, ...). */
|
|
1278
|
+
region: NodeRegion;
|
|
1279
|
+
/** The definition of the affected column if any. */
|
|
1280
|
+
colDef?: ColumnDefinition;
|
|
1281
|
+
/** The index of affected column or -1. */
|
|
1282
|
+
colIdx: number;
|
|
1283
|
+
/** The column definition ID of affected column if any. */
|
|
1284
|
+
colId?: string;
|
|
1285
|
+
/** The affected column's span tag if any. */
|
|
1286
|
+
colElem?: HTMLSpanElement;
|
|
1287
|
+
}
|
|
1206
1288
|
export type FilterModeType = null | "dim" | "hide";
|
|
1207
1289
|
export type ApplyCommandType = "moveUp" | "moveDown" | "indent" | "outdent" | "remove" | "rename" | "addChild" | "addSibling" | "cut" | "copy" | "paste" | "down" | "first" | "last" | "left" | "pageDown" | "pageUp" | "parent" | "right" | "up";
|
|
1208
1290
|
export type NodeFilterResponse = "skip" | "branch" | boolean | void;
|
|
@@ -1234,7 +1316,7 @@ declare module "types" {
|
|
|
1234
1316
|
noData = "noData"
|
|
1235
1317
|
}
|
|
1236
1318
|
/** Define the subregion of a node, where an event occurred. */
|
|
1237
|
-
export enum
|
|
1319
|
+
export enum NodeRegion {
|
|
1238
1320
|
unknown = "",
|
|
1239
1321
|
checkbox = "checkbox",
|
|
1240
1322
|
column = "column",
|
|
@@ -1243,6 +1325,13 @@ declare module "types" {
|
|
|
1243
1325
|
prefix = "prefix",
|
|
1244
1326
|
title = "title"
|
|
1245
1327
|
}
|
|
1328
|
+
/** Initial navigation mode and possible transition. */
|
|
1329
|
+
export enum NavModeEnum {
|
|
1330
|
+
startRow = "startRow",
|
|
1331
|
+
cell = "cell",
|
|
1332
|
+
startCell = "startCell",
|
|
1333
|
+
row = "row"
|
|
1334
|
+
}
|
|
1246
1335
|
/** Possible values for {@link WunderbaumNode.addChildren()}. */
|
|
1247
1336
|
export interface AddChildrenOptions {
|
|
1248
1337
|
/** Insert children before this node (or index)
|
|
@@ -1258,6 +1347,10 @@ declare module "types" {
|
|
|
1258
1347
|
/** (@internal Internal use, do not set! ) */
|
|
1259
1348
|
_level?: number;
|
|
1260
1349
|
}
|
|
1350
|
+
/** Possible values for {@link Wunderbaum.applyCommand()} and {@link WunderbaumNode.applyCommand()}. */
|
|
1351
|
+
export interface ApplyCommandOptions {
|
|
1352
|
+
[key: string]: unknown;
|
|
1353
|
+
}
|
|
1261
1354
|
/** Possible values for {@link Wunderbaum.expandAll()} and {@link WunderbaumNode.expandAll()}. */
|
|
1262
1355
|
export interface ExpandAllOptions {
|
|
1263
1356
|
/** Restrict expand level @default 99 */
|
|
@@ -1267,6 +1360,16 @@ declare module "types" {
|
|
|
1267
1360
|
/** Ignore `minExpandLevel` option @default false */
|
|
1268
1361
|
force?: boolean;
|
|
1269
1362
|
}
|
|
1363
|
+
/** Possible values for {@link Wunderbaum.filterNodes()} and {@link Wunderbaum.filterBranches()}. */
|
|
1364
|
+
export interface FilterNodesOptions {
|
|
1365
|
+
mode?: string;
|
|
1366
|
+
leavesOnly?: boolean;
|
|
1367
|
+
fuzzy?: boolean;
|
|
1368
|
+
highlight?: boolean;
|
|
1369
|
+
hideExpanders?: boolean;
|
|
1370
|
+
autoExpand?: boolean;
|
|
1371
|
+
noData?: boolean;
|
|
1372
|
+
}
|
|
1270
1373
|
/** Possible values for {@link WunderbaumNode.makeVisible()}. */
|
|
1271
1374
|
export interface MakeVisibleOptions {
|
|
1272
1375
|
/** Do not animate expand (currently not implemented). @default false */
|
|
@@ -1276,12 +1379,20 @@ declare module "types" {
|
|
|
1276
1379
|
/** Do not send events. @default false */
|
|
1277
1380
|
noEvents?: boolean;
|
|
1278
1381
|
}
|
|
1279
|
-
/**
|
|
1280
|
-
export
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1382
|
+
/** Possible values for {@link Wunderbaum.navigate()}. */
|
|
1383
|
+
export interface NavigateOptions {
|
|
1384
|
+
activate?: boolean;
|
|
1385
|
+
event?: Event;
|
|
1386
|
+
}
|
|
1387
|
+
/** Possible values for {@link WunderbaumNode.render()}. */
|
|
1388
|
+
export interface RenderOptions {
|
|
1389
|
+
change?: ChangeType;
|
|
1390
|
+
after?: any;
|
|
1391
|
+
isNew?: boolean;
|
|
1392
|
+
preventScroll?: boolean;
|
|
1393
|
+
isDataChange?: boolean;
|
|
1394
|
+
top?: number;
|
|
1395
|
+
resizeCols?: boolean;
|
|
1285
1396
|
}
|
|
1286
1397
|
/** Possible values for {@link scrollIntoView()}. */
|
|
1287
1398
|
export interface ScrollIntoViewOptions {
|
|
@@ -1348,6 +1459,19 @@ declare module "types" {
|
|
|
1348
1459
|
/** Used as tooltip. */
|
|
1349
1460
|
details?: string;
|
|
1350
1461
|
}
|
|
1462
|
+
/** Possible values for {@link Wunderbaum.updateColumns()}. */
|
|
1463
|
+
export interface UpdateColumnsOptions {
|
|
1464
|
+
calculateCols?: boolean;
|
|
1465
|
+
updateRows?: boolean;
|
|
1466
|
+
}
|
|
1467
|
+
/** Possible values for {@link Wunderbaum.visitRows()} and {@link Wunderbaum.visitRowsUp()}. */
|
|
1468
|
+
export interface VisitRowsOptions {
|
|
1469
|
+
reverse?: boolean;
|
|
1470
|
+
includeSelf?: boolean;
|
|
1471
|
+
includeHidden?: boolean;
|
|
1472
|
+
wrap?: boolean;
|
|
1473
|
+
start?: WunderbaumNode | null;
|
|
1474
|
+
}
|
|
1351
1475
|
export type DropRegionType = "over" | "before" | "after";
|
|
1352
1476
|
export type DropRegionTypeSet = Set<DropRegionType>;
|
|
1353
1477
|
export type DndOptionsType = {
|
|
@@ -1619,7 +1743,7 @@ declare module "debounce" {
|
|
|
1619
1743
|
export function throttle<F extends Procedure>(func: F, wait?: number, options?: ThrottleOptions): DebouncedFunction<F>;
|
|
1620
1744
|
}
|
|
1621
1745
|
declare module "wb_ext_filter" {
|
|
1622
|
-
import { NodeFilterCallback } from "types";
|
|
1746
|
+
import { FilterNodesOptions, NodeFilterCallback } from "types";
|
|
1623
1747
|
import { Wunderbaum } from "wunderbaum";
|
|
1624
1748
|
import { WunderbaumExtension } from "wb_extension_base";
|
|
1625
1749
|
export class FilterExtension extends WunderbaumExtension {
|
|
@@ -1633,15 +1757,15 @@ declare module "wb_ext_filter" {
|
|
|
1633
1757
|
/**
|
|
1634
1758
|
* [ext-filter] Dim or hide nodes.
|
|
1635
1759
|
*
|
|
1636
|
-
* @param {boolean} [
|
|
1760
|
+
* @param {boolean} [options={autoExpand: false, leavesOnly: false}]
|
|
1637
1761
|
*/
|
|
1638
|
-
filterNodes(filter: string | NodeFilterCallback,
|
|
1762
|
+
filterNodes(filter: string | NodeFilterCallback, options: FilterNodesOptions): void;
|
|
1639
1763
|
/**
|
|
1640
1764
|
* [ext-filter] Dim or hide whole branches.
|
|
1641
1765
|
*
|
|
1642
|
-
* @param {boolean} [
|
|
1766
|
+
* @param {boolean} [options={autoExpand: false}]
|
|
1643
1767
|
*/
|
|
1644
|
-
filterBranches(filter: string | NodeFilterCallback,
|
|
1768
|
+
filterBranches(filter: string | NodeFilterCallback, options: FilterNodesOptions): void;
|
|
1645
1769
|
/**
|
|
1646
1770
|
* [ext-filter] Re-apply current filter.
|
|
1647
1771
|
*/
|
|
@@ -1804,7 +1928,7 @@ declare module "wb_ext_edit" {
|
|
|
1804
1928
|
* @returns
|
|
1805
1929
|
*/
|
|
1806
1930
|
stopEditTitle(apply: boolean): void;
|
|
1807
|
-
_stopEditTitle(apply: boolean,
|
|
1931
|
+
_stopEditTitle(apply: boolean, options: any): void;
|
|
1808
1932
|
/**
|
|
1809
1933
|
* Create a new child or sibling node and start edit mode.
|
|
1810
1934
|
*/
|
|
@@ -1827,7 +1951,7 @@ declare module "wunderbaum" {
|
|
|
1827
1951
|
import "./wunderbaum.scss";
|
|
1828
1952
|
import * as util from "util";
|
|
1829
1953
|
import { ExtensionsDict, WunderbaumExtension } from "wb_extension_base";
|
|
1830
|
-
import { ApplyCommandType, ChangeType, ColumnDefinitionList, ExpandAllOptions, FilterModeType, MatcherCallback,
|
|
1954
|
+
import { ApplyCommandType, ChangeType, ColumnDefinitionList, ExpandAllOptions, FilterModeType, MatcherCallback, NavModeEnum, NodeStatusType, NodeStringCallback, NodeTypeDefinitionMap, ScrollToOptions, SetActiveOptions, SetModifiedOptions, SetStatusOptions, WbEventInfo, ApplyCommandOptions, AddChildrenOptions, UpdateColumnsOptions, VisitRowsOptions } from "types";
|
|
1831
1955
|
import { WunderbaumNode } from "wb_node";
|
|
1832
1956
|
import { WunderbaumOptions } from "wb_options";
|
|
1833
1957
|
/**
|
|
@@ -1848,8 +1972,8 @@ declare module "wunderbaum" {
|
|
|
1848
1972
|
readonly element: HTMLDivElement;
|
|
1849
1973
|
/** The `div.wb-header` element if any. */
|
|
1850
1974
|
readonly headerElement: HTMLDivElement;
|
|
1851
|
-
/** The `div.wb-
|
|
1852
|
-
readonly
|
|
1975
|
+
/** The `div.wb-list-container` element that contains the `nodeListElement`. */
|
|
1976
|
+
readonly listContainerElement: HTMLDivElement;
|
|
1853
1977
|
/** The `div.wb-node-list` element that contains all visible div.wb-row child elements. */
|
|
1854
1978
|
readonly nodeListElement: HTMLDivElement;
|
|
1855
1979
|
/** Contains additional data that was sent as response to an Ajax source load request. */
|
|
@@ -1870,7 +1994,7 @@ declare module "wunderbaum" {
|
|
|
1870
1994
|
/** Current node hat has keyboard focus if any. */
|
|
1871
1995
|
focusNode: WunderbaumNode | null;
|
|
1872
1996
|
/** Shared properties, referenced by `node.type`. */
|
|
1873
|
-
types:
|
|
1997
|
+
types: NodeTypeDefinitionMap;
|
|
1874
1998
|
/** List of column definitions. */
|
|
1875
1999
|
columns: ColumnDefinitionList;
|
|
1876
2000
|
protected _columnsById: {
|
|
@@ -1967,16 +2091,16 @@ declare module "wunderbaum" {
|
|
|
1967
2091
|
*
|
|
1968
2092
|
* @see {@link WunderbaumNode.addChildren}
|
|
1969
2093
|
*/
|
|
1970
|
-
addChildren(nodeData: any, options?:
|
|
2094
|
+
addChildren(nodeData: any, options?: AddChildrenOptions): WunderbaumNode;
|
|
1971
2095
|
/**
|
|
1972
2096
|
* Apply a modification (or navigation) operation on the **tree or active node**.
|
|
1973
2097
|
*/
|
|
1974
|
-
applyCommand(cmd: ApplyCommandType, options?:
|
|
2098
|
+
applyCommand(cmd: ApplyCommandType, options?: ApplyCommandOptions): any;
|
|
1975
2099
|
/**
|
|
1976
2100
|
* Apply a modification (or navigation) operation on a **node**.
|
|
1977
2101
|
* @see {@link WunderbaumNode.applyCommand}
|
|
1978
2102
|
*/
|
|
1979
|
-
applyCommand(cmd: ApplyCommandType, node: WunderbaumNode, options?:
|
|
2103
|
+
applyCommand(cmd: ApplyCommandType, node: WunderbaumNode, options?: ApplyCommandOptions): any;
|
|
1980
2104
|
/** Delete all nodes. */
|
|
1981
2105
|
clear(): void;
|
|
1982
2106
|
/**
|
|
@@ -2103,15 +2227,7 @@ declare module "wunderbaum" {
|
|
|
2103
2227
|
* @returns {object} Return a {node: WunderbaumNode, region: TYPE} object
|
|
2104
2228
|
* TYPE: 'title' | 'prefix' | 'expander' | 'checkbox' | 'icon' | undefined
|
|
2105
2229
|
*/
|
|
2106
|
-
static getEventInfo(event: Event):
|
|
2107
|
-
tree: Wunderbaum;
|
|
2108
|
-
node: WunderbaumNode;
|
|
2109
|
-
region: NodeRegion;
|
|
2110
|
-
colDef: any;
|
|
2111
|
-
colIdx: number;
|
|
2112
|
-
colId: any;
|
|
2113
|
-
colElem: HTMLSpanElement;
|
|
2114
|
-
};
|
|
2230
|
+
static getEventInfo(event: Event): WbEventInfo;
|
|
2115
2231
|
/**
|
|
2116
2232
|
* Return readable string representation for this instance.
|
|
2117
2233
|
* @internal
|
|
@@ -2163,11 +2279,11 @@ declare module "wunderbaum" {
|
|
|
2163
2279
|
/** Set or remove keybaord focus to the tree container. */
|
|
2164
2280
|
setFocus(flag?: boolean): void;
|
|
2165
2281
|
/** Schedule an update request to reflect a tree change. */
|
|
2166
|
-
setModified(change: ChangeType, options?:
|
|
2282
|
+
setModified(change: ChangeType, options?: SetModifiedOptions): void;
|
|
2167
2283
|
/** Schedule an update request to reflect a single node modification.
|
|
2168
2284
|
* @see {@link WunderbaumNode.setModified}
|
|
2169
2285
|
*/
|
|
2170
|
-
setModified(change: ChangeType, node: WunderbaumNode, options?:
|
|
2286
|
+
setModified(change: ChangeType, node: WunderbaumNode, options?: SetModifiedOptions): void;
|
|
2171
2287
|
/** Disable mouse and keyboard interaction (return prev. state). */
|
|
2172
2288
|
setEnabled(flag?: boolean): boolean;
|
|
2173
2289
|
/** Return false if tree is disabled. */
|
|
@@ -2181,13 +2297,15 @@ declare module "wunderbaum" {
|
|
|
2181
2297
|
/** Set the tree's navigation mode. */
|
|
2182
2298
|
setCellNav(flag?: boolean): void;
|
|
2183
2299
|
/** Set the tree's navigation mode option. */
|
|
2184
|
-
setNavigationOption(mode:
|
|
2300
|
+
setNavigationOption(mode: NavModeEnum, reset?: boolean): void;
|
|
2185
2301
|
/** Display tree status (ok, loading, error, noData) using styles and a dummy root node. */
|
|
2186
2302
|
setStatus(status: NodeStatusType, options?: SetStatusOptions): WunderbaumNode | null;
|
|
2187
2303
|
/** Add or redefine node type definitions. */
|
|
2188
2304
|
setTypes(types: any, replace?: boolean): void;
|
|
2189
|
-
/** Update column headers and width.
|
|
2190
|
-
|
|
2305
|
+
/** Update column headers and width.
|
|
2306
|
+
* Return true if at least one column width changed.
|
|
2307
|
+
*/
|
|
2308
|
+
updateColumns(options?: UpdateColumnsOptions): boolean;
|
|
2191
2309
|
/** Create/update header markup from `this.columns` definition.
|
|
2192
2310
|
* @internal
|
|
2193
2311
|
*/
|
|
@@ -2240,12 +2358,12 @@ declare module "wunderbaum" {
|
|
|
2240
2358
|
* {start: First tree node, reverse: false, includeSelf: true, includeHidden: false, wrap: false}
|
|
2241
2359
|
* @returns {boolean} false if iteration was canceled
|
|
2242
2360
|
*/
|
|
2243
|
-
visitRows(callback: (node: WunderbaumNode) => any, options?:
|
|
2361
|
+
visitRows(callback: (node: WunderbaumNode) => any, options?: VisitRowsOptions): boolean;
|
|
2244
2362
|
/**
|
|
2245
2363
|
* Call fn(node) for all nodes in vertical order, bottom up.
|
|
2246
2364
|
* @internal
|
|
2247
2365
|
*/
|
|
2248
|
-
protected _visitRowsUp(callback: (node: WunderbaumNode) => any,
|
|
2366
|
+
protected _visitRowsUp(callback: (node: WunderbaumNode) => any, options: VisitRowsOptions): boolean;
|
|
2249
2367
|
/**
|
|
2250
2368
|
* Reload the tree with a new source.
|
|
2251
2369
|
*
|