wunderbaum 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/wunderbaum.css +1 -1
- package/dist/wunderbaum.d.ts +468 -329
- package/dist/wunderbaum.esm.js +599 -374
- package/dist/wunderbaum.esm.min.js +29 -23
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +599 -374
- package/dist/wunderbaum.umd.min.js +35 -30
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +3 -3
- package/src/common.ts +18 -142
- package/src/types.ts +470 -0
- package/src/util.ts +18 -1
- package/src/wb_ext_dnd.ts +2 -154
- package/src/wb_ext_edit.ts +3 -3
- package/src/wb_ext_filter.ts +5 -5
- package/src/wb_ext_keynav.ts +93 -57
- package/src/wb_node.ts +149 -80
- package/src/wb_options.ts +35 -53
- package/src/wunderbaum.scss +82 -62
- package/src/wunderbaum.ts +279 -199
package/dist/wunderbaum.d.ts
CHANGED
|
@@ -95,6 +95,8 @@ declare module "util" {
|
|
|
95
95
|
* @param value a value that matches the target element.
|
|
96
96
|
*/
|
|
97
97
|
export function setValueToElem(elem: HTMLElement, value: any): void;
|
|
98
|
+
/** Show/hide element by setting the `display`style to 'none'. */
|
|
99
|
+
export function setElemDisplay(elem: string | Element, flag: boolean): void;
|
|
98
100
|
/** Create and return an unconnected `HTMLElement` from a HTML string. */
|
|
99
101
|
export function elemFromHtml(html: string): HTMLElement;
|
|
100
102
|
/** Return a HtmlElement from selector or cast an existing element. */
|
|
@@ -214,6 +216,56 @@ declare module "util" {
|
|
|
214
216
|
*/
|
|
215
217
|
export function adaptiveThrottle(this: unknown, callback: (...args: any[]) => void, options: any): (...args: any[]) => void;
|
|
216
218
|
}
|
|
219
|
+
declare module "common" {
|
|
220
|
+
/*!
|
|
221
|
+
* Wunderbaum - common
|
|
222
|
+
* Copyright (c) 2021-2022, Martin Wendt. Released under the MIT license.
|
|
223
|
+
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
224
|
+
*/
|
|
225
|
+
import { MatcherType } from "types";
|
|
226
|
+
export const DEFAULT_DEBUGLEVEL = 4;
|
|
227
|
+
export const ROW_HEIGHT = 22;
|
|
228
|
+
export const ICON_WIDTH = 20;
|
|
229
|
+
export const ROW_EXTRA_PAD = 7;
|
|
230
|
+
export const RENDER_MIN_PREFETCH = 5;
|
|
231
|
+
export const RENDER_MAX_PREFETCH = 5;
|
|
232
|
+
export const TEST_IMG: RegExp;
|
|
233
|
+
export let iconMap: {
|
|
234
|
+
error: string;
|
|
235
|
+
loading: string;
|
|
236
|
+
noData: string;
|
|
237
|
+
expanderExpanded: string;
|
|
238
|
+
expanderCollapsed: string;
|
|
239
|
+
expanderLazy: string;
|
|
240
|
+
checkChecked: string;
|
|
241
|
+
checkUnchecked: string;
|
|
242
|
+
checkUnknown: string;
|
|
243
|
+
radioChecked: string;
|
|
244
|
+
radioUnchecked: string;
|
|
245
|
+
radioUnknown: string;
|
|
246
|
+
folder: string;
|
|
247
|
+
folderOpen: string;
|
|
248
|
+
doc: string;
|
|
249
|
+
};
|
|
250
|
+
export const KEY_NODATA = "__not_found__";
|
|
251
|
+
/** Define which keys are handled by embedded <input> control, and should
|
|
252
|
+
* *not* be passed to tree navigation handler in cell-edit mode. */
|
|
253
|
+
export const INPUT_KEYS: {
|
|
254
|
+
[key: string]: Array<string>;
|
|
255
|
+
};
|
|
256
|
+
/** Dict keys that are evaluated by source loader (others are added to `tree.data` instead). */
|
|
257
|
+
export const RESERVED_TREE_SOURCE_KEYS: Set<string>;
|
|
258
|
+
/** Key codes that trigger grid navigation, even when inside an input element. */
|
|
259
|
+
export const INPUT_BREAKOUT_KEYS: Set<string>;
|
|
260
|
+
/** Map `KeyEvent.key` to navigation action. */
|
|
261
|
+
export const KEY_TO_ACTION_DICT: {
|
|
262
|
+
[key: string]: string;
|
|
263
|
+
};
|
|
264
|
+
/** Return a callback that returns true if the node title contains a substring (case-insensitive). */
|
|
265
|
+
export function makeNodeTitleMatcher(s: string): MatcherType;
|
|
266
|
+
/** Return a callback that returns true if the node title starts with a string (case-insensitive). */
|
|
267
|
+
export function makeNodeTitleStartMatcher(s: string): MatcherType;
|
|
268
|
+
}
|
|
217
269
|
declare module "deferred" {
|
|
218
270
|
/*!
|
|
219
271
|
* Wunderbaum - deferred
|
|
@@ -256,174 +308,13 @@ declare module "deferred" {
|
|
|
256
308
|
finally(cb: finallyCallbackType): Promise<any>;
|
|
257
309
|
}
|
|
258
310
|
}
|
|
259
|
-
declare module "wb_extension_base" {
|
|
260
|
-
import { Wunderbaum } from "wunderbaum";
|
|
261
|
-
export type ExtensionsDict = {
|
|
262
|
-
[key: string]: WunderbaumExtension;
|
|
263
|
-
};
|
|
264
|
-
export abstract class WunderbaumExtension {
|
|
265
|
-
enabled: boolean;
|
|
266
|
-
readonly id: string;
|
|
267
|
-
readonly tree: Wunderbaum;
|
|
268
|
-
readonly treeOpts: any;
|
|
269
|
-
readonly extensionOpts: any;
|
|
270
|
-
constructor(tree: Wunderbaum, id: string, defaults: any);
|
|
271
|
-
/** Called on tree (re)init after all extensions are added, but before loading.*/
|
|
272
|
-
init(): void;
|
|
273
|
-
getPluginOption(name: string, defaultValue?: any): any;
|
|
274
|
-
setPluginOption(name: string, value: any): void;
|
|
275
|
-
setEnabled(flag?: boolean): void;
|
|
276
|
-
onKeyEvent(data: any): boolean | undefined;
|
|
277
|
-
onRender(data: any): boolean | undefined;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
declare module "wb_ext_dnd" {
|
|
281
|
-
import { Wunderbaum } from "wunderbaum";
|
|
282
|
-
import { WunderbaumExtension } from "wb_extension_base";
|
|
283
|
-
import { WunderbaumNode } from "wb_node";
|
|
284
|
-
import { WbNodeEventType } from "common";
|
|
285
|
-
export type DropRegionType = "over" | "before" | "after";
|
|
286
|
-
type DropRegionTypeSet = Set<DropRegionType>;
|
|
287
|
-
export type DndOptionsType = {
|
|
288
|
-
/**
|
|
289
|
-
* Expand nodes after n milliseconds of hovering
|
|
290
|
-
* Default: 1500
|
|
291
|
-
*/
|
|
292
|
-
autoExpandMS: 1500;
|
|
293
|
-
/**
|
|
294
|
-
* true: Drag multiple (i.e. selected) nodes. Also a callback() is allowed
|
|
295
|
-
* Default: false
|
|
296
|
-
*/
|
|
297
|
-
multiSource: false;
|
|
298
|
-
/**
|
|
299
|
-
* Restrict the possible cursor shapes and modifier operations (can also be set in the dragStart event)
|
|
300
|
-
* Default: "all"
|
|
301
|
-
*/
|
|
302
|
-
effectAllowed: "all";
|
|
303
|
-
/**
|
|
304
|
-
* Default dropEffect ('copy', 'link', or 'move') when no modifier is pressed (overide in dragDrag, dragOver).
|
|
305
|
-
* Default: "move"
|
|
306
|
-
*/
|
|
307
|
-
dropEffectDefault: string;
|
|
308
|
-
/**
|
|
309
|
-
* Prevent dropping nodes from different Wunderbaum trees
|
|
310
|
-
* Default: false
|
|
311
|
-
*/
|
|
312
|
-
preventForeignNodes: boolean;
|
|
313
|
-
/**
|
|
314
|
-
* Prevent dropping items on unloaded lazy Wunderbaum tree nodes
|
|
315
|
-
* Default: true
|
|
316
|
-
*/
|
|
317
|
-
preventLazyParents: boolean;
|
|
318
|
-
/**
|
|
319
|
-
* Prevent dropping items other than Wunderbaum tree nodes
|
|
320
|
-
* Default: false
|
|
321
|
-
*/
|
|
322
|
-
preventNonNodes: boolean;
|
|
323
|
-
/**
|
|
324
|
-
* Prevent dropping nodes on own descendants
|
|
325
|
-
* Default: true
|
|
326
|
-
*/
|
|
327
|
-
preventRecursion: boolean;
|
|
328
|
-
/**
|
|
329
|
-
* Prevent dropping nodes under same direct parent
|
|
330
|
-
* Default: false
|
|
331
|
-
*/
|
|
332
|
-
preventSameParent: false;
|
|
333
|
-
/**
|
|
334
|
-
* Prevent dropping nodes 'before self', etc. (move only)
|
|
335
|
-
* Default: true
|
|
336
|
-
*/
|
|
337
|
-
preventVoidMoves: boolean;
|
|
338
|
-
/**
|
|
339
|
-
* Enable auto-scrolling while dragging
|
|
340
|
-
* Default: true
|
|
341
|
-
*/
|
|
342
|
-
scroll: boolean;
|
|
343
|
-
/**
|
|
344
|
-
* Active top/bottom margin in pixel
|
|
345
|
-
* Default: 20
|
|
346
|
-
*/
|
|
347
|
-
scrollSensitivity: 20;
|
|
348
|
-
/**
|
|
349
|
-
* Pixel per event
|
|
350
|
-
* Default: 5
|
|
351
|
-
*/
|
|
352
|
-
scrollSpeed: 5;
|
|
353
|
-
/**
|
|
354
|
-
* Optional callback passed to `toDict` on dragStart @since 2.38
|
|
355
|
-
* Default: null
|
|
356
|
-
*/
|
|
357
|
-
sourceCopyHook: null;
|
|
358
|
-
/**
|
|
359
|
-
* Callback(sourceNode, data), return true, to enable dnd drag
|
|
360
|
-
* Default: null
|
|
361
|
-
*/
|
|
362
|
-
dragStart?: WbNodeEventType;
|
|
363
|
-
/**
|
|
364
|
-
* Callback(sourceNode, data)
|
|
365
|
-
* Default: null
|
|
366
|
-
*/
|
|
367
|
-
dragDrag: null;
|
|
368
|
-
/**
|
|
369
|
-
* Callback(sourceNode, data)
|
|
370
|
-
* Default: null
|
|
371
|
-
*/
|
|
372
|
-
dragEnd: null;
|
|
373
|
-
/**
|
|
374
|
-
* Callback(targetNode, data), return true, to enable dnd drop
|
|
375
|
-
* Default: null
|
|
376
|
-
*/
|
|
377
|
-
dragEnter: null;
|
|
378
|
-
/**
|
|
379
|
-
* Callback(targetNode, data)
|
|
380
|
-
* Default: null
|
|
381
|
-
*/
|
|
382
|
-
dragOver: null;
|
|
383
|
-
/**
|
|
384
|
-
* Callback(targetNode, data), return false to prevent autoExpand
|
|
385
|
-
* Default: null
|
|
386
|
-
*/
|
|
387
|
-
dragExpand: null;
|
|
388
|
-
/**
|
|
389
|
-
* Callback(targetNode, data)
|
|
390
|
-
* Default: null
|
|
391
|
-
*/
|
|
392
|
-
dragDrop: null;
|
|
393
|
-
/**
|
|
394
|
-
* Callback(targetNode, data)
|
|
395
|
-
* Default: null
|
|
396
|
-
*/
|
|
397
|
-
dragLeave: null;
|
|
398
|
-
};
|
|
399
|
-
export class DndExtension extends WunderbaumExtension {
|
|
400
|
-
protected srcNode: WunderbaumNode | null;
|
|
401
|
-
protected lastTargetNode: WunderbaumNode | null;
|
|
402
|
-
protected lastEnterStamp: number;
|
|
403
|
-
protected lastAllowedDropRegions: DropRegionTypeSet | null;
|
|
404
|
-
protected lastDropEffect: string | null;
|
|
405
|
-
protected lastDropRegion: DropRegionType | false;
|
|
406
|
-
constructor(tree: Wunderbaum);
|
|
407
|
-
init(): void;
|
|
408
|
-
/** Cleanup classes after target node is no longer hovered. */
|
|
409
|
-
protected _leaveNode(): void;
|
|
410
|
-
/** */
|
|
411
|
-
protected unifyDragover(res: any): DropRegionTypeSet | false;
|
|
412
|
-
/** */
|
|
413
|
-
protected _calcDropRegion(e: DragEvent, allowed: DropRegionTypeSet | null): DropRegionType | false;
|
|
414
|
-
protected autoScroll(event: DragEvent): number;
|
|
415
|
-
protected onDragEvent(e: DragEvent): boolean;
|
|
416
|
-
protected onDropEvent(e: DragEvent): boolean;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
311
|
declare module "wb_options" {
|
|
420
312
|
/*!
|
|
421
313
|
* Wunderbaum - utils
|
|
422
314
|
* Copyright (c) 2021-2022, Martin Wendt. Released under the MIT license.
|
|
423
315
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
424
316
|
*/
|
|
425
|
-
import { BoolOptionResolver,
|
|
426
|
-
import { DndOptionsType } from "wb_ext_dnd";
|
|
317
|
+
import { BoolOptionResolver, ColumnDefinitionList, DndOptionsType, NavigationOptions, NodeTypeDefinitions, WbNodeEventType, WbRenderEventType, WbTreeEventType } from "types";
|
|
427
318
|
export interface WbNodeData {
|
|
428
319
|
title: string;
|
|
429
320
|
key?: string;
|
|
@@ -433,39 +324,6 @@ declare module "wb_options" {
|
|
|
433
324
|
checkbox?: boolean | string;
|
|
434
325
|
children?: Array<WbNodeData>;
|
|
435
326
|
}
|
|
436
|
-
export interface ColumnDefinition {
|
|
437
|
-
/** Column ID (pass "*" for the main tree nodes column ) */
|
|
438
|
-
id: string;
|
|
439
|
-
/** Column header (defaults to id) */
|
|
440
|
-
title: string;
|
|
441
|
-
/** Column width or weight.
|
|
442
|
-
* Either an absolute pixel value (e.g. `"50px"`) or a relative weight (e.g. `1`)
|
|
443
|
-
* that is used to calculate the width inside the remaining available space.
|
|
444
|
-
* Default: `"*"`, which is interpreted as `1`.
|
|
445
|
-
*/
|
|
446
|
-
width?: string | number;
|
|
447
|
-
/** Only used for columns with a relative weight.
|
|
448
|
-
* Default: `4px`.
|
|
449
|
-
*/
|
|
450
|
-
minWidth?: string | number;
|
|
451
|
-
/** Optional class names that are added to all `span.wb-col` elements of that column.*/
|
|
452
|
-
classes?: string;
|
|
453
|
-
/** Optional HTML content that is rendered into all `span.wb-col` elements of that column.*/
|
|
454
|
-
html: string;
|
|
455
|
-
}
|
|
456
|
-
export interface TypeDefinition {
|
|
457
|
-
/** En/disable checkbox for matching nodes.*/
|
|
458
|
-
checkbox?: boolean | BoolOptionResolver;
|
|
459
|
-
/** Optional class names that are added to all `div.wb-row` elements of matching nodes.*/
|
|
460
|
-
classes?: string;
|
|
461
|
-
/**Default icon for matching nodes.*/
|
|
462
|
-
icon?: boolean | string | BoolOptionResolver;
|
|
463
|
-
/**
|
|
464
|
-
* See also {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
|
|
465
|
-
* to evaluate `node.NAME` setting and `tree.types[node.type].NAME`.
|
|
466
|
-
*/
|
|
467
|
-
_any: any;
|
|
468
|
-
}
|
|
469
327
|
/**
|
|
470
328
|
* Available options for [[Wunderbaum]].
|
|
471
329
|
*
|
|
@@ -522,9 +380,7 @@ declare module "wb_options" {
|
|
|
522
380
|
*
|
|
523
381
|
* Default: `{}`.
|
|
524
382
|
*/
|
|
525
|
-
types?:
|
|
526
|
-
[key: string]: TypeDefinition;
|
|
527
|
-
};
|
|
383
|
+
types?: NodeTypeDefinitions;
|
|
528
384
|
/**
|
|
529
385
|
* A list of maps that define column headers. If this option is set,
|
|
530
386
|
* Wunderbaum becomes a treegrid control instead of a plain tree.
|
|
@@ -532,7 +388,7 @@ declare module "wb_options" {
|
|
|
532
388
|
* response.
|
|
533
389
|
* Default: `[]` meaning this is a plain tree.
|
|
534
390
|
*/
|
|
535
|
-
columns?:
|
|
391
|
+
columns?: ColumnDefinitionList;
|
|
536
392
|
/**
|
|
537
393
|
* If true, add a `wb-skeleton` class to all nodes, that will result in a
|
|
538
394
|
* 'glow' effect. Typically used with initial dummy nodes, while loading the
|
|
@@ -551,14 +407,10 @@ declare module "wb_options" {
|
|
|
551
407
|
debugLevel: number;
|
|
552
408
|
/**
|
|
553
409
|
* Number of levels that are forced to be expanded, and have no expander icon.
|
|
410
|
+
* E.g. 1 would keep all toplevel nodes expanded.
|
|
554
411
|
* Default: 0
|
|
555
412
|
*/
|
|
556
413
|
minExpandLevel?: number;
|
|
557
|
-
/**
|
|
558
|
-
* Height of the header row div.
|
|
559
|
-
* Default: 22
|
|
560
|
-
*/
|
|
561
|
-
headerHeightPx: number;
|
|
562
414
|
/**
|
|
563
415
|
* Height of a node row div.
|
|
564
416
|
* Default: 22
|
|
@@ -573,13 +425,17 @@ declare module "wb_options" {
|
|
|
573
425
|
* HTMLElement that receives the top nodes breadcrumb.
|
|
574
426
|
* Default: undefined
|
|
575
427
|
*/
|
|
576
|
-
|
|
428
|
+
connectTopBreadcrumb?: HTMLElement;
|
|
577
429
|
/**
|
|
578
|
-
* Default:
|
|
430
|
+
* Default: NavigationOptions.startRow
|
|
579
431
|
*/
|
|
580
|
-
|
|
432
|
+
navigationModeOption?: NavigationOptions;
|
|
581
433
|
/**
|
|
582
|
-
* Show/hide header (
|
|
434
|
+
* Show/hide header (default: null)
|
|
435
|
+
* null: assume false for plain tree and true for grids.
|
|
436
|
+
* string: use text as header (only for plain trees)
|
|
437
|
+
* true: display a header (use tree's id as text for plain trees)
|
|
438
|
+
* false: do not display a header
|
|
583
439
|
*/
|
|
584
440
|
header?: boolean | string | null;
|
|
585
441
|
/**
|
|
@@ -587,7 +443,9 @@ declare module "wb_options" {
|
|
|
587
443
|
*/
|
|
588
444
|
showSpinner?: boolean;
|
|
589
445
|
/**
|
|
590
|
-
*
|
|
446
|
+
* If true, render a checkbox before the node tile to allow selection with the
|
|
447
|
+
* mouse.
|
|
448
|
+
* Default: false.
|
|
591
449
|
*/
|
|
592
450
|
checkbox?: boolean | "radio" | BoolOptionResolver;
|
|
593
451
|
/**
|
|
@@ -628,6 +486,15 @@ declare module "wb_options" {
|
|
|
628
486
|
click?: (e: WbTreeEventType) => void;
|
|
629
487
|
/**
|
|
630
488
|
*
|
|
489
|
+
* Return `false` to prevent default handling, e.g. activating the node.
|
|
490
|
+
* @category Callback
|
|
491
|
+
*/
|
|
492
|
+
beforeActivate?: (e: WbNodeEventType) => void;
|
|
493
|
+
/**
|
|
494
|
+
/**
|
|
495
|
+
*
|
|
496
|
+
* Return `false` to prevent default handling, e.g. deactivating the node
|
|
497
|
+
* and activating the next.
|
|
631
498
|
* @category Callback
|
|
632
499
|
*/
|
|
633
500
|
deactivate?: (e: WbNodeEventType) => void;
|
|
@@ -698,7 +565,7 @@ declare module "wb_options" {
|
|
|
698
565
|
* See also `Custom Rendering` for details.
|
|
699
566
|
* @category Callback
|
|
700
567
|
*/
|
|
701
|
-
render?: (e:
|
|
568
|
+
render?: (e: WbRenderEventType) => void;
|
|
702
569
|
/**
|
|
703
570
|
*
|
|
704
571
|
* @category Callback
|
|
@@ -725,7 +592,7 @@ declare module "wb_node" {
|
|
|
725
592
|
*/
|
|
726
593
|
import "./wunderbaum.scss";
|
|
727
594
|
import { Wunderbaum } from "wunderbaum";
|
|
728
|
-
import { ChangeType, MatcherType, NodeAnyCallback, NodeStatusType, NodeVisitCallback, NodeVisitResponse,
|
|
595
|
+
import { AddNodeType, ApplyCommandType, ChangeType, MakeVisibleOptions, MatcherType, NodeAnyCallback, NodeStatusType, NodeVisitCallback, NodeVisitResponse, ScrollIntoViewOptions, SetActiveOptions, SetExpandedOptions, SetSelectedOptions, SetStatusOptions } from "types";
|
|
729
596
|
import { WbNodeData } from "wb_options";
|
|
730
597
|
/**
|
|
731
598
|
* A single tree node.
|
|
@@ -753,6 +620,7 @@ declare module "wb_node" {
|
|
|
753
620
|
readonly refKey: string | undefined;
|
|
754
621
|
children: WunderbaumNode[] | null;
|
|
755
622
|
checkbox?: boolean;
|
|
623
|
+
/** If true, (in grid mode) no cells are rendered, except for the node title.*/
|
|
756
624
|
colspan?: boolean;
|
|
757
625
|
icon?: boolean | string;
|
|
758
626
|
lazy: boolean;
|
|
@@ -831,7 +699,7 @@ declare module "wb_node" {
|
|
|
831
699
|
* as space-separated string, array of strings, or set of strings.
|
|
832
700
|
*/
|
|
833
701
|
setClass(className: string | string[] | Set<string>, flag?: boolean): void;
|
|
834
|
-
/** */
|
|
702
|
+
/** Call `setExpanded()` on al child nodes*/
|
|
835
703
|
expandAll(flag?: boolean): Promise<void>;
|
|
836
704
|
/**Find all nodes that match condition (excluding self).
|
|
837
705
|
*
|
|
@@ -895,6 +763,10 @@ declare module "wb_node" {
|
|
|
895
763
|
* (See also [[isDescendantOf]].)
|
|
896
764
|
*/
|
|
897
765
|
isChildOf(other: WunderbaumNode): boolean;
|
|
766
|
+
/** Return true if this node's title spans all columns, i.e. the node has no
|
|
767
|
+
* grid cells.
|
|
768
|
+
*/
|
|
769
|
+
isColspan(): boolean;
|
|
898
770
|
/** Return true if this node is a direct or indirect sub node of `other`.
|
|
899
771
|
* (See also [[isChildOf]].)
|
|
900
772
|
*/
|
|
@@ -962,7 +834,7 @@ declare module "wb_node" {
|
|
|
962
834
|
* @param {object} [opts] passed to `setExpanded()`.
|
|
963
835
|
* Defaults to {noAnimation: false, noEvents: false, scrollIntoView: true}
|
|
964
836
|
*/
|
|
965
|
-
makeVisible(opts
|
|
837
|
+
makeVisible(opts?: MakeVisibleOptions): Promise<any>;
|
|
966
838
|
/** Move this node to targetNode. */
|
|
967
839
|
moveTo(targetNode: WunderbaumNode, mode?: AddNodeType, map?: NodeAnyCallback): void;
|
|
968
840
|
/** Set focus relative to this node and optionally activate.
|
|
@@ -984,24 +856,22 @@ declare module "wb_node" {
|
|
|
984
856
|
removeChildren(): void;
|
|
985
857
|
/** Remove all HTML markup from the DOM. */
|
|
986
858
|
removeMarkup(): void;
|
|
987
|
-
protected _getRenderInfo():
|
|
988
|
-
[key: string]: any;
|
|
989
|
-
};
|
|
859
|
+
protected _getRenderInfo(): any;
|
|
990
860
|
protected _createIcon(parentElem: HTMLElement, replaceChild?: HTMLElement): HTMLElement | null;
|
|
991
861
|
/**
|
|
992
862
|
* Create a whole new `<div class="wb-row">` element.
|
|
993
|
-
* @see {@link
|
|
863
|
+
* @see {@link WunderbaumNode.render}
|
|
994
864
|
*/
|
|
995
865
|
protected _render_markup(opts: any): void;
|
|
996
866
|
/**
|
|
997
867
|
* Render `node.title`, `.icon` into an existing row.
|
|
998
868
|
*
|
|
999
|
-
* @see {@link
|
|
869
|
+
* @see {@link WunderbaumNode.render}
|
|
1000
870
|
*/
|
|
1001
871
|
protected _render_data(opts: any): void;
|
|
1002
872
|
/**
|
|
1003
873
|
* Update row classes to reflect active, focuses, etc.
|
|
1004
|
-
* @see {@link
|
|
874
|
+
* @see {@link WunderbaumNode.render}
|
|
1005
875
|
*/
|
|
1006
876
|
protected _render_status(opts: any): void;
|
|
1007
877
|
/**
|
|
@@ -1052,11 +922,11 @@ declare module "wb_node" {
|
|
|
1052
922
|
/** Make sure that this node is visible in the viewport.
|
|
1053
923
|
* @see {@link Wunderbaum.scrollTo|Wunderbaum.scrollTo()}
|
|
1054
924
|
*/
|
|
1055
|
-
scrollIntoView(options?:
|
|
925
|
+
scrollIntoView(options?: ScrollIntoViewOptions): Promise<void>;
|
|
1056
926
|
/**
|
|
1057
927
|
* Activate this node, deactivate previous, send events, activate column and scroll int viewport.
|
|
1058
928
|
*/
|
|
1059
|
-
setActive(flag?: boolean, options?: SetActiveOptions): Promise<
|
|
929
|
+
setActive(flag?: boolean, options?: SetActiveOptions): Promise<any>;
|
|
1060
930
|
/**
|
|
1061
931
|
* Expand or collapse this node.
|
|
1062
932
|
*/
|
|
@@ -1065,7 +935,7 @@ declare module "wb_node" {
|
|
|
1065
935
|
* Set keyboard focus here.
|
|
1066
936
|
* @see {@link setActive}
|
|
1067
937
|
*/
|
|
1068
|
-
setFocus(flag?: boolean
|
|
938
|
+
setFocus(flag?: boolean): void;
|
|
1069
939
|
/** Set a new icon path or class. */
|
|
1070
940
|
setIcon(): void;
|
|
1071
941
|
/** Change node's {@link key} and/or {@link refKey}. */
|
|
@@ -1081,7 +951,7 @@ declare module "wb_node" {
|
|
|
1081
951
|
/** Modify the check/uncheck state. */
|
|
1082
952
|
setSelected(flag?: boolean, options?: SetSelectedOptions): void;
|
|
1083
953
|
/** Display node status (ok, loading, error, noData) using styles and a dummy child node. */
|
|
1084
|
-
setStatus(status: NodeStatusType,
|
|
954
|
+
setStatus(status: NodeStatusType, options?: SetStatusOptions): WunderbaumNode | null;
|
|
1085
955
|
/** Rename this node. */
|
|
1086
956
|
setTitle(title: string): void;
|
|
1087
957
|
/**
|
|
@@ -1129,32 +999,127 @@ declare module "wb_node" {
|
|
|
1129
999
|
isMatched(): boolean;
|
|
1130
1000
|
}
|
|
1131
1001
|
}
|
|
1132
|
-
declare module "
|
|
1002
|
+
declare module "types" {
|
|
1003
|
+
/*!
|
|
1004
|
+
* Wunderbaum - types
|
|
1005
|
+
* Copyright (c) 2021-2022, Martin Wendt. Released under the MIT license.
|
|
1006
|
+
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
1007
|
+
*/
|
|
1133
1008
|
import { WunderbaumNode } from "wb_node";
|
|
1134
1009
|
import { Wunderbaum } from "wunderbaum";
|
|
1135
1010
|
export type MatcherType = (node: WunderbaumNode) => boolean;
|
|
1136
1011
|
export type BoolOptionResolver = (node: WunderbaumNode) => boolean;
|
|
1137
|
-
export const DEFAULT_DEBUGLEVEL = 4;
|
|
1138
|
-
export const ROW_HEIGHT = 22;
|
|
1139
|
-
export const ICON_WIDTH = 20;
|
|
1140
|
-
export const ROW_EXTRA_PAD = 7;
|
|
1141
|
-
export const RENDER_MIN_PREFETCH = 5;
|
|
1142
|
-
export const RENDER_MAX_PREFETCH = 5;
|
|
1143
|
-
export const TEST_IMG: RegExp;
|
|
1144
1012
|
export type NodeAnyCallback = (node: WunderbaumNode) => any;
|
|
1145
1013
|
export type NodeVisitResponse = "skip" | boolean | void;
|
|
1146
1014
|
export type NodeVisitCallback = (node: WunderbaumNode) => NodeVisitResponse;
|
|
1147
|
-
export
|
|
1015
|
+
export interface WbTreeEventType {
|
|
1016
|
+
/** Name of the event. */
|
|
1148
1017
|
type: string;
|
|
1149
|
-
|
|
1018
|
+
/** The affected tree. */
|
|
1150
1019
|
tree: Wunderbaum;
|
|
1020
|
+
/** Originating HTML event, e.g. `click` if any. */
|
|
1021
|
+
event?: Event;
|
|
1022
|
+
}
|
|
1023
|
+
export interface WbNodeEventType extends WbTreeEventType {
|
|
1024
|
+
/** The affected target node. */
|
|
1025
|
+
node: WunderbaumNode;
|
|
1026
|
+
/**
|
|
1027
|
+
* Contains the node's type information, i.e. `tree.types[node.type]` if
|
|
1028
|
+
* defined. Set to `{}` otherwise. @see {@link Wunderbaum.types}
|
|
1029
|
+
*/
|
|
1030
|
+
typeInfo: NodeTypeDefinition;
|
|
1031
|
+
}
|
|
1032
|
+
export interface WbRenderEventType extends WbNodeEventType {
|
|
1033
|
+
/**
|
|
1034
|
+
* True if the node's markup was not yet created. In this case the render
|
|
1035
|
+
* event should create embeddeb input controls (in addition to update the
|
|
1036
|
+
* values according to to current node data).
|
|
1037
|
+
*/
|
|
1038
|
+
isNew: boolean;
|
|
1039
|
+
/** True if the node only displays the title and is stretched over all remaining columns. */
|
|
1040
|
+
isColspan: boolean;
|
|
1041
|
+
/** The node's `<span class='wb-node'>` element. */
|
|
1042
|
+
nodeElem: HTMLSpanElement;
|
|
1043
|
+
/**
|
|
1044
|
+
* Array of node's `<span class='wb-col'>` elements.
|
|
1045
|
+
* The first element is `<span class='wb-node wb-col'>`, which contains the
|
|
1046
|
+
* node title and icon (`idx: 0`, id: '*'`).
|
|
1047
|
+
*/
|
|
1048
|
+
allColInfosById: ColumnEventInfos;
|
|
1049
|
+
/**
|
|
1050
|
+
* Array of node's `<span class='wb-node'>` elements, *that should be rendered*.
|
|
1051
|
+
* In contrast to `allColInfosById`, the node title is not part of this array.
|
|
1052
|
+
* If node.isColspan() is true, this array is empty (`[]`).
|
|
1053
|
+
*/
|
|
1054
|
+
renderColInfosById: ColumnEventInfos;
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Contains the node's type information, i.e. `tree.types[node.type]` if
|
|
1058
|
+
* defined. @see {@link Wunderbaum.types}
|
|
1059
|
+
*/
|
|
1060
|
+
export interface NodeTypeDefinition {
|
|
1061
|
+
/** En/disable checkbox for matching nodes.*/
|
|
1062
|
+
checkbox?: boolean | BoolOptionResolver;
|
|
1063
|
+
/** En/disable checkbox for matching nodes.*/
|
|
1064
|
+
colspan?: boolean | BoolOptionResolver;
|
|
1065
|
+
/** Optional class names that are added to all `div.wb-row` elements of matching nodes.*/
|
|
1066
|
+
classes?: string;
|
|
1067
|
+
/**Default icon for matching nodes.*/
|
|
1068
|
+
icon?: boolean | string | BoolOptionResolver;
|
|
1069
|
+
/**
|
|
1070
|
+
* See also {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
|
|
1071
|
+
* to evaluate `node.NAME` setting and `tree.types[node.type].NAME`.
|
|
1072
|
+
*/
|
|
1151
1073
|
[key: string]: unknown;
|
|
1074
|
+
}
|
|
1075
|
+
export type NodeTypeDefinitions = {
|
|
1076
|
+
[type: string]: NodeTypeDefinition;
|
|
1152
1077
|
};
|
|
1153
|
-
|
|
1154
|
-
|
|
1078
|
+
/**
|
|
1079
|
+
* @see {@link `Wunderbaum.columns`}
|
|
1080
|
+
*/
|
|
1081
|
+
export interface ColumnDefinition {
|
|
1082
|
+
/** Column ID as defined in `tree.columns` definition ("*" for title column). */
|
|
1083
|
+
id: string;
|
|
1084
|
+
/** Column header (defaults to id) */
|
|
1085
|
+
title: string;
|
|
1086
|
+
/** Column header tooltip (optional) */
|
|
1087
|
+
tooltip?: string;
|
|
1088
|
+
/** Column width or weight.
|
|
1089
|
+
* Either an absolute pixel value (e.g. `"50px"`) or a relative weight (e.g. `1`)
|
|
1090
|
+
* that is used to calculate the width inside the remaining available space.
|
|
1091
|
+
* Default: `"*"`, which is interpreted as `1`.
|
|
1092
|
+
*/
|
|
1093
|
+
width?: string | number;
|
|
1094
|
+
/** Only used for columns with a relative weight.
|
|
1095
|
+
* Default: `4px`.
|
|
1096
|
+
*/
|
|
1097
|
+
minWidth?: string | number;
|
|
1098
|
+
/** Optional class names that are added to all `span.wb-col` elements of that column.*/
|
|
1099
|
+
classes?: string;
|
|
1100
|
+
/** Optional HTML content that is rendered into all `span.wb-col` elements of that column.*/
|
|
1101
|
+
html?: string;
|
|
1102
|
+
_weight?: number;
|
|
1103
|
+
_widthPx?: number;
|
|
1104
|
+
_ofsPx?: number;
|
|
1105
|
+
}
|
|
1106
|
+
export type ColumnDefinitionList = Array<ColumnDefinition>;
|
|
1107
|
+
export interface ColumnEventInfo {
|
|
1108
|
+
/** Column ID as defined in `tree.columns` definition ("*" for title column). */
|
|
1109
|
+
id: string;
|
|
1110
|
+
/** Column index (0: leftmost title column). */
|
|
1111
|
+
idx: number;
|
|
1112
|
+
/** The cell's `<span class='wb-col'>` element (null for plain trees). */
|
|
1113
|
+
elem: HTMLSpanElement | null;
|
|
1114
|
+
/** The value of `tree.columns[]` for the current index. */
|
|
1115
|
+
info: ColumnDefinition;
|
|
1116
|
+
}
|
|
1117
|
+
export type ColumnEventInfos = {
|
|
1118
|
+
[colId: string]: ColumnEventInfo;
|
|
1155
1119
|
};
|
|
1156
1120
|
export type WbTreeCallbackType = (e: WbTreeEventType) => any;
|
|
1157
1121
|
export type WbNodeCallbackType = (e: WbNodeEventType) => any;
|
|
1122
|
+
export type WbRenderCallbackType = (e: WbRenderEventType) => void;
|
|
1158
1123
|
export type FilterModeType = null | "dim" | "hide";
|
|
1159
1124
|
export type ApplyCommandType = "moveUp" | "moveDown" | "indent" | "outdent" | "remove" | "rename" | "addChild" | "addSibling" | "cut" | "copy" | "paste" | "down" | "first" | "last" | "left" | "pageDown" | "pageUp" | "parent" | "right" | "up";
|
|
1160
1125
|
export type NodeFilterResponse = "skip" | "branch" | boolean | void;
|
|
@@ -1195,87 +1160,222 @@ declare module "common" {
|
|
|
1195
1160
|
prefix = "prefix",
|
|
1196
1161
|
title = "title"
|
|
1197
1162
|
}
|
|
1198
|
-
export let iconMap: {
|
|
1199
|
-
error: string;
|
|
1200
|
-
loading: string;
|
|
1201
|
-
noData: string;
|
|
1202
|
-
expanderExpanded: string;
|
|
1203
|
-
expanderCollapsed: string;
|
|
1204
|
-
expanderLazy: string;
|
|
1205
|
-
checkChecked: string;
|
|
1206
|
-
checkUnchecked: string;
|
|
1207
|
-
checkUnknown: string;
|
|
1208
|
-
radioChecked: string;
|
|
1209
|
-
radioUnchecked: string;
|
|
1210
|
-
radioUnknown: string;
|
|
1211
|
-
folder: string;
|
|
1212
|
-
folderOpen: string;
|
|
1213
|
-
doc: string;
|
|
1214
|
-
};
|
|
1215
|
-
export const KEY_NODATA = "__not_found__";
|
|
1216
1163
|
/** Initial navigation mode and possible transition. */
|
|
1217
|
-
export enum
|
|
1164
|
+
export enum NavigationOptions {
|
|
1218
1165
|
startRow = "startRow",
|
|
1219
1166
|
cell = "cell",
|
|
1220
1167
|
startCell = "startCell",
|
|
1221
1168
|
row = "row"
|
|
1222
1169
|
}
|
|
1223
|
-
/**
|
|
1224
|
-
export
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1170
|
+
/** Possible values for `node.makeVisible()`. */
|
|
1171
|
+
export interface MakeVisibleOptions {
|
|
1172
|
+
/** Do not animate expand (currently not implemented). @default false */
|
|
1173
|
+
noAnimation?: boolean;
|
|
1174
|
+
/** Scroll node into visible viewport area if required. @default true */
|
|
1175
|
+
scrollIntoView?: boolean;
|
|
1176
|
+
/** Do not send events. @default false */
|
|
1177
|
+
noEvents?: boolean;
|
|
1178
|
+
}
|
|
1179
|
+
/** Possible values for `node.scrollIntoView()`. */
|
|
1180
|
+
export interface ScrollIntoViewOptions {
|
|
1181
|
+
/** Do not animate (currently not implemented). @default false */
|
|
1182
|
+
noAnimation?: boolean;
|
|
1183
|
+
/** Do not send events. @default false */
|
|
1184
|
+
noEvents?: boolean;
|
|
1185
|
+
/** Keep this node visible at the top in any case. */
|
|
1186
|
+
topNode?: WunderbaumNode;
|
|
1187
|
+
/** Add N pixel offset at top. */
|
|
1188
|
+
ofsY?: number;
|
|
1189
|
+
}
|
|
1190
|
+
/** Possible values for `tree.scrollTo()`. */
|
|
1191
|
+
export interface ScrollToOptions extends ScrollIntoViewOptions {
|
|
1192
|
+
/** Which node to scroll into the viewport.*/
|
|
1193
|
+
node: WunderbaumNode;
|
|
1228
1194
|
}
|
|
1229
|
-
/** Define which keys are handled by embedded <input> control, and should
|
|
1230
|
-
* *not* be passed to tree navigation handler in cell-edit mode. */
|
|
1231
|
-
export const INPUT_KEYS: {
|
|
1232
|
-
text: string[];
|
|
1233
|
-
number: string[];
|
|
1234
|
-
checkbox: any[];
|
|
1235
|
-
link: any[];
|
|
1236
|
-
radiobutton: string[];
|
|
1237
|
-
"select-one": string[];
|
|
1238
|
-
"select-multiple": string[];
|
|
1239
|
-
};
|
|
1240
|
-
/** Key codes that trigger grid navigation, even when inside an input element. */
|
|
1241
|
-
export const NAVIGATE_IN_INPUT_KEYS: Set<string>;
|
|
1242
1195
|
/** Possible values for `node.setActive()`. */
|
|
1243
|
-
export
|
|
1244
|
-
/** Generate (de)activate event, even if node already has this status. */
|
|
1196
|
+
export interface SetActiveOptions {
|
|
1197
|
+
/** Generate (de)activate event, even if node already has this status (default: false). */
|
|
1245
1198
|
retrigger?: boolean;
|
|
1246
|
-
/** Do not generate (de)activate event. */
|
|
1199
|
+
/** Do not generate (de)activate event (default: false). */
|
|
1247
1200
|
noEvents?: boolean;
|
|
1201
|
+
/** Set node as focused node (default: true). */
|
|
1202
|
+
focusNode?: boolean;
|
|
1203
|
+
/** Set node as focused node (default: false). */
|
|
1204
|
+
focusTree?: boolean;
|
|
1248
1205
|
/** Optional original event that will be passed to the (de)activate handler. */
|
|
1249
1206
|
event?: Event;
|
|
1250
1207
|
/** Call {@link setColumn}. */
|
|
1251
1208
|
colIdx?: number;
|
|
1252
|
-
}
|
|
1209
|
+
}
|
|
1253
1210
|
/** Possible values for `node.setExpanded()`. */
|
|
1254
|
-
export
|
|
1211
|
+
export interface SetExpandedOptions {
|
|
1255
1212
|
/** Ignore {@link minExpandLevel}. @default false */
|
|
1256
1213
|
force?: boolean;
|
|
1257
|
-
/**
|
|
1214
|
+
/** Immediately update viewport (async otherwise). @default false */
|
|
1215
|
+
immediate?: boolean;
|
|
1216
|
+
/** Do not animate expand (currently not implemented). @default false */
|
|
1258
1217
|
noAnimation?: boolean;
|
|
1259
1218
|
/** Do not send events. @default false */
|
|
1260
1219
|
noEvents?: boolean;
|
|
1261
|
-
/** Scroll to bring expanded nodes into viewport. @default false */
|
|
1220
|
+
/** Scroll up to bring expanded nodes into viewport. @default false */
|
|
1262
1221
|
scrollIntoView?: boolean;
|
|
1263
|
-
}
|
|
1222
|
+
}
|
|
1223
|
+
/** Possible values for `node.setSetModified()`. */
|
|
1224
|
+
export interface SetModifiedOptions {
|
|
1225
|
+
/** Force immediate redraw instead of throttled/async mode. @default false */
|
|
1226
|
+
immediate?: boolean;
|
|
1227
|
+
/** Remove HTML markup of all rendered nodes before redraw. @default false */
|
|
1228
|
+
removeMarkup?: boolean;
|
|
1229
|
+
}
|
|
1264
1230
|
/** Possible values for `node.setSelected()`. */
|
|
1265
|
-
export
|
|
1231
|
+
export interface SetSelectedOptions {
|
|
1266
1232
|
/** Ignore restrictions. @default false */
|
|
1267
1233
|
force?: boolean;
|
|
1268
1234
|
/** Do not send events. @default false */
|
|
1269
1235
|
noEvents?: boolean;
|
|
1236
|
+
}
|
|
1237
|
+
/** Possible values for `node.setSetModified()`. */
|
|
1238
|
+
export interface SetStatusOptions {
|
|
1239
|
+
/** Displayed as status node title. */
|
|
1240
|
+
message?: string;
|
|
1241
|
+
/** Used as tooltip. */
|
|
1242
|
+
details?: string;
|
|
1243
|
+
}
|
|
1244
|
+
export type DropRegionType = "over" | "before" | "after";
|
|
1245
|
+
export type DropRegionTypeSet = Set<DropRegionType>;
|
|
1246
|
+
export type DndOptionsType = {
|
|
1247
|
+
/**
|
|
1248
|
+
* Expand nodes after n milliseconds of hovering
|
|
1249
|
+
* Default: 1500
|
|
1250
|
+
*/
|
|
1251
|
+
autoExpandMS: 1500;
|
|
1252
|
+
/**
|
|
1253
|
+
* true: Drag multiple (i.e. selected) nodes. Also a callback() is allowed
|
|
1254
|
+
* Default: false
|
|
1255
|
+
*/
|
|
1256
|
+
multiSource: false;
|
|
1257
|
+
/**
|
|
1258
|
+
* Restrict the possible cursor shapes and modifier operations (can also be set in the dragStart event)
|
|
1259
|
+
* Default: "all"
|
|
1260
|
+
*/
|
|
1261
|
+
effectAllowed: "all";
|
|
1262
|
+
/**
|
|
1263
|
+
* Default dropEffect ('copy', 'link', or 'move') when no modifier is pressed (overide in dragDrag, dragOver).
|
|
1264
|
+
* Default: "move"
|
|
1265
|
+
*/
|
|
1266
|
+
dropEffectDefault: string;
|
|
1267
|
+
/**
|
|
1268
|
+
* Prevent dropping nodes from different Wunderbaum trees
|
|
1269
|
+
* Default: false
|
|
1270
|
+
*/
|
|
1271
|
+
preventForeignNodes: boolean;
|
|
1272
|
+
/**
|
|
1273
|
+
* Prevent dropping items on unloaded lazy Wunderbaum tree nodes
|
|
1274
|
+
* Default: true
|
|
1275
|
+
*/
|
|
1276
|
+
preventLazyParents: boolean;
|
|
1277
|
+
/**
|
|
1278
|
+
* Prevent dropping items other than Wunderbaum tree nodes
|
|
1279
|
+
* Default: false
|
|
1280
|
+
*/
|
|
1281
|
+
preventNonNodes: boolean;
|
|
1282
|
+
/**
|
|
1283
|
+
* Prevent dropping nodes on own descendants
|
|
1284
|
+
* Default: true
|
|
1285
|
+
*/
|
|
1286
|
+
preventRecursion: boolean;
|
|
1287
|
+
/**
|
|
1288
|
+
* Prevent dropping nodes under same direct parent
|
|
1289
|
+
* Default: false
|
|
1290
|
+
*/
|
|
1291
|
+
preventSameParent: false;
|
|
1292
|
+
/**
|
|
1293
|
+
* Prevent dropping nodes 'before self', etc. (move only)
|
|
1294
|
+
* Default: true
|
|
1295
|
+
*/
|
|
1296
|
+
preventVoidMoves: boolean;
|
|
1297
|
+
/**
|
|
1298
|
+
* Enable auto-scrolling while dragging
|
|
1299
|
+
* Default: true
|
|
1300
|
+
*/
|
|
1301
|
+
scroll: boolean;
|
|
1302
|
+
/**
|
|
1303
|
+
* Active top/bottom margin in pixel
|
|
1304
|
+
* Default: 20
|
|
1305
|
+
*/
|
|
1306
|
+
scrollSensitivity: 20;
|
|
1307
|
+
/**
|
|
1308
|
+
* Pixel per event
|
|
1309
|
+
* Default: 5
|
|
1310
|
+
*/
|
|
1311
|
+
scrollSpeed: 5;
|
|
1312
|
+
/**
|
|
1313
|
+
* Optional callback passed to `toDict` on dragStart @since 2.38
|
|
1314
|
+
* Default: null
|
|
1315
|
+
*/
|
|
1316
|
+
sourceCopyHook: null;
|
|
1317
|
+
/**
|
|
1318
|
+
* Callback(sourceNode, data), return true, to enable dnd drag
|
|
1319
|
+
* Default: null
|
|
1320
|
+
*/
|
|
1321
|
+
dragStart?: WbNodeEventType;
|
|
1322
|
+
/**
|
|
1323
|
+
* Callback(sourceNode, data)
|
|
1324
|
+
* Default: null
|
|
1325
|
+
*/
|
|
1326
|
+
dragDrag: null;
|
|
1327
|
+
/**
|
|
1328
|
+
* Callback(sourceNode, data)
|
|
1329
|
+
* Default: null
|
|
1330
|
+
*/
|
|
1331
|
+
dragEnd: null;
|
|
1332
|
+
/**
|
|
1333
|
+
* Callback(targetNode, data), return true, to enable dnd drop
|
|
1334
|
+
* Default: null
|
|
1335
|
+
*/
|
|
1336
|
+
dragEnter: null;
|
|
1337
|
+
/**
|
|
1338
|
+
* Callback(targetNode, data)
|
|
1339
|
+
* Default: null
|
|
1340
|
+
*/
|
|
1341
|
+
dragOver: null;
|
|
1342
|
+
/**
|
|
1343
|
+
* Callback(targetNode, data), return false to prevent autoExpand
|
|
1344
|
+
* Default: null
|
|
1345
|
+
*/
|
|
1346
|
+
dragExpand: null;
|
|
1347
|
+
/**
|
|
1348
|
+
* Callback(targetNode, data)
|
|
1349
|
+
* Default: null
|
|
1350
|
+
*/
|
|
1351
|
+
dragDrop: null;
|
|
1352
|
+
/**
|
|
1353
|
+
* Callback(targetNode, data)
|
|
1354
|
+
* Default: null
|
|
1355
|
+
*/
|
|
1356
|
+
dragLeave: null;
|
|
1270
1357
|
};
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1358
|
+
}
|
|
1359
|
+
declare module "wb_extension_base" {
|
|
1360
|
+
import { Wunderbaum } from "wunderbaum";
|
|
1361
|
+
export type ExtensionsDict = {
|
|
1362
|
+
[key: string]: WunderbaumExtension;
|
|
1274
1363
|
};
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1364
|
+
export abstract class WunderbaumExtension {
|
|
1365
|
+
enabled: boolean;
|
|
1366
|
+
readonly id: string;
|
|
1367
|
+
readonly tree: Wunderbaum;
|
|
1368
|
+
readonly treeOpts: any;
|
|
1369
|
+
readonly extensionOpts: any;
|
|
1370
|
+
constructor(tree: Wunderbaum, id: string, defaults: any);
|
|
1371
|
+
/** Called on tree (re)init after all extensions are added, but before loading.*/
|
|
1372
|
+
init(): void;
|
|
1373
|
+
getPluginOption(name: string, defaultValue?: any): any;
|
|
1374
|
+
setPluginOption(name: string, value: any): void;
|
|
1375
|
+
setEnabled(flag?: boolean): void;
|
|
1376
|
+
onKeyEvent(data: any): boolean | undefined;
|
|
1377
|
+
onRender(data: any): boolean | undefined;
|
|
1378
|
+
}
|
|
1279
1379
|
}
|
|
1280
1380
|
declare module "debounce" {
|
|
1281
1381
|
/*!
|
|
@@ -1412,7 +1512,7 @@ declare module "debounce" {
|
|
|
1412
1512
|
export function throttle<F extends Procedure>(func: F, wait?: number, options?: ThrottleOptions): DebouncedFunction<F>;
|
|
1413
1513
|
}
|
|
1414
1514
|
declare module "wb_ext_filter" {
|
|
1415
|
-
import { NodeFilterCallback } from "
|
|
1515
|
+
import { NodeFilterCallback } from "types";
|
|
1416
1516
|
import { Wunderbaum } from "wunderbaum";
|
|
1417
1517
|
import { WunderbaumExtension } from "wb_extension_base";
|
|
1418
1518
|
export class FilterExtension extends WunderbaumExtension {
|
|
@@ -1450,7 +1550,8 @@ declare module "wb_ext_keynav" {
|
|
|
1450
1550
|
import { WunderbaumExtension } from "wb_extension_base";
|
|
1451
1551
|
export class KeynavExtension extends WunderbaumExtension {
|
|
1452
1552
|
constructor(tree: Wunderbaum);
|
|
1453
|
-
protected _getEmbeddedInputElem(elem: any
|
|
1553
|
+
protected _getEmbeddedInputElem(elem: any): HTMLInputElement | null;
|
|
1554
|
+
protected _isCurInputFocused(): boolean;
|
|
1454
1555
|
onKeyEvent(data: any): boolean | undefined;
|
|
1455
1556
|
}
|
|
1456
1557
|
}
|
|
@@ -1465,6 +1566,31 @@ declare module "wb_ext_logger" {
|
|
|
1465
1566
|
onKeyEvent(data: any): boolean | undefined;
|
|
1466
1567
|
}
|
|
1467
1568
|
}
|
|
1569
|
+
declare module "wb_ext_dnd" {
|
|
1570
|
+
import { Wunderbaum } from "wunderbaum";
|
|
1571
|
+
import { WunderbaumExtension } from "wb_extension_base";
|
|
1572
|
+
import { WunderbaumNode } from "wb_node";
|
|
1573
|
+
import { DropRegionType, DropRegionTypeSet } from "types";
|
|
1574
|
+
export class DndExtension extends WunderbaumExtension {
|
|
1575
|
+
protected srcNode: WunderbaumNode | null;
|
|
1576
|
+
protected lastTargetNode: WunderbaumNode | null;
|
|
1577
|
+
protected lastEnterStamp: number;
|
|
1578
|
+
protected lastAllowedDropRegions: DropRegionTypeSet | null;
|
|
1579
|
+
protected lastDropEffect: string | null;
|
|
1580
|
+
protected lastDropRegion: DropRegionType | false;
|
|
1581
|
+
constructor(tree: Wunderbaum);
|
|
1582
|
+
init(): void;
|
|
1583
|
+
/** Cleanup classes after target node is no longer hovered. */
|
|
1584
|
+
protected _leaveNode(): void;
|
|
1585
|
+
/** */
|
|
1586
|
+
protected unifyDragover(res: any): DropRegionTypeSet | false;
|
|
1587
|
+
/** */
|
|
1588
|
+
protected _calcDropRegion(e: DragEvent, allowed: DropRegionTypeSet | null): DropRegionType | false;
|
|
1589
|
+
protected autoScroll(event: DragEvent): number;
|
|
1590
|
+
protected onDragEvent(e: DragEvent): boolean;
|
|
1591
|
+
protected onDropEvent(e: DragEvent): boolean;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1468
1594
|
declare module "drag_observer" {
|
|
1469
1595
|
export type DragCallbackArgType = {
|
|
1470
1596
|
/** "dragstart", "drag", or "dragstop". */
|
|
@@ -1545,7 +1671,7 @@ declare module "wb_ext_edit" {
|
|
|
1545
1671
|
import { Wunderbaum } from "wunderbaum";
|
|
1546
1672
|
import { WunderbaumExtension } from "wb_extension_base";
|
|
1547
1673
|
import { WunderbaumNode } from "wb_node";
|
|
1548
|
-
import { AddNodeType } from "
|
|
1674
|
+
import { AddNodeType } from "types";
|
|
1549
1675
|
import { WbNodeData } from "wb_options";
|
|
1550
1676
|
export class EditExtension extends WunderbaumExtension {
|
|
1551
1677
|
protected debouncedOnChange: (e: Event) => void;
|
|
@@ -1589,7 +1715,7 @@ declare module "wunderbaum" {
|
|
|
1589
1715
|
import "./wunderbaum.scss";
|
|
1590
1716
|
import * as util from "util";
|
|
1591
1717
|
import { ExtensionsDict, WunderbaumExtension } from "wb_extension_base";
|
|
1592
|
-
import {
|
|
1718
|
+
import { ApplyCommandType, ChangeType, ColumnDefinitionList, FilterModeType, MatcherType, NavigationOptions, NodeStatusType, NodeTypeDefinitions, ScrollToOptions, SetActiveOptions, SetStatusOptions, TargetType as NodeRegion } from "types";
|
|
1593
1719
|
import { WunderbaumNode } from "wb_node";
|
|
1594
1720
|
import { WunderbaumOptions } from "wb_options";
|
|
1595
1721
|
/**
|
|
@@ -1609,11 +1735,15 @@ declare module "wunderbaum" {
|
|
|
1609
1735
|
/** The `div` container element that was passed to the constructor. */
|
|
1610
1736
|
readonly element: HTMLDivElement;
|
|
1611
1737
|
/** The `div.wb-header` element if any. */
|
|
1612
|
-
readonly headerElement: HTMLDivElement
|
|
1738
|
+
readonly headerElement: HTMLDivElement;
|
|
1613
1739
|
/** The `div.wb-scroll-container` element that contains the `nodeListElement`. */
|
|
1614
1740
|
readonly scrollContainerElement: HTMLDivElement;
|
|
1615
1741
|
/** The `div.wb-node-list` element that contains all visible div.wb-row child elements. */
|
|
1616
1742
|
readonly nodeListElement: HTMLDivElement;
|
|
1743
|
+
/** Contains additional data that was sent as response to an Ajax source load request. */
|
|
1744
|
+
readonly data: {
|
|
1745
|
+
[key: string]: any;
|
|
1746
|
+
};
|
|
1617
1747
|
protected readonly _updateViewportThrottled: (...args: any) => void;
|
|
1618
1748
|
protected extensionList: WunderbaumExtension[];
|
|
1619
1749
|
protected extensions: ExtensionsDict;
|
|
@@ -1628,16 +1758,15 @@ declare module "wunderbaum" {
|
|
|
1628
1758
|
/** Current node hat has keyboard focus if any. */
|
|
1629
1759
|
focusNode: WunderbaumNode | null;
|
|
1630
1760
|
/** Shared properties, referenced by `node.type`. */
|
|
1631
|
-
types:
|
|
1632
|
-
[key: string]: any;
|
|
1633
|
-
};
|
|
1761
|
+
types: NodeTypeDefinitions;
|
|
1634
1762
|
/** List of column definitions. */
|
|
1635
|
-
columns:
|
|
1763
|
+
columns: ColumnDefinitionList;
|
|
1636
1764
|
protected _columnsById: {
|
|
1637
1765
|
[key: string]: any;
|
|
1638
1766
|
};
|
|
1639
1767
|
protected resizeObserver: ResizeObserver;
|
|
1640
1768
|
protected changeRedrawRequestPending: boolean;
|
|
1769
|
+
protected changeScrollRequestPending: boolean;
|
|
1641
1770
|
/** A Promise that is resolved when the tree was initialized (similar to `init(e)` event). */
|
|
1642
1771
|
readonly ready: Promise<any>;
|
|
1643
1772
|
/** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
|
|
@@ -1648,7 +1777,7 @@ declare module "wunderbaum" {
|
|
|
1648
1777
|
/** @internal Use `setColumn()`/`getActiveColElem()`*/
|
|
1649
1778
|
activeColIdx: number;
|
|
1650
1779
|
/** @internal */
|
|
1651
|
-
|
|
1780
|
+
_cellNavMode: boolean;
|
|
1652
1781
|
/** @internal */
|
|
1653
1782
|
lastQuicksearchTime: number;
|
|
1654
1783
|
/** @internal */
|
|
@@ -1745,14 +1874,19 @@ declare module "wunderbaum" {
|
|
|
1745
1874
|
*/
|
|
1746
1875
|
getOption(name: string, defaultValue?: any): any;
|
|
1747
1876
|
/**
|
|
1748
|
-
*
|
|
1749
|
-
*
|
|
1750
|
-
* @param value
|
|
1877
|
+
* Set tree option.
|
|
1878
|
+
* Use dot notation to set plugin option, e.g. "filter.mode".
|
|
1751
1879
|
*/
|
|
1752
1880
|
setOption(name: string, value: any): void;
|
|
1753
|
-
/**Return true if the tree (or one of its nodes) has the input focus. */
|
|
1881
|
+
/** Return true if the tree (or one of its nodes) has the input focus. */
|
|
1754
1882
|
hasFocus(): boolean;
|
|
1755
|
-
/**
|
|
1883
|
+
/**
|
|
1884
|
+
* Return true if the tree displays a header. Grids have a header unless the
|
|
1885
|
+
* `header` option is set to `false`. Plain trees have a header if the `header`
|
|
1886
|
+
* option is a string or `true`.
|
|
1887
|
+
*/
|
|
1888
|
+
hasHeader(): boolean;
|
|
1889
|
+
/** Run code, but defer rendering of viewport until done. */
|
|
1756
1890
|
runWithoutUpdate(func: () => any, hint?: any): void;
|
|
1757
1891
|
/** Recursively expand all expandable nodes (triggers lazy load id needed). */
|
|
1758
1892
|
expandAll(flag?: boolean): Promise<void>;
|
|
@@ -1864,28 +1998,18 @@ declare module "wunderbaum" {
|
|
|
1864
1998
|
logWarn(...args: any[]): void;
|
|
1865
1999
|
/**
|
|
1866
2000
|
* Make sure that this node is vertically scrolled into the viewport.
|
|
1867
|
-
*
|
|
1868
|
-
* @param {object} [options=null] {topNode: null, effects: ..., parent: ...}
|
|
1869
|
-
* this node will remain visible in
|
|
1870
|
-
* any case, even if `this` is outside the scroll pane.
|
|
1871
2001
|
*/
|
|
1872
|
-
scrollTo(
|
|
2002
|
+
scrollTo(nodeOrOpts: ScrollToOptions | WunderbaumNode): void;
|
|
1873
2003
|
/**
|
|
1874
2004
|
* Make sure that this node is horizontally scrolled into the viewport.
|
|
1875
|
-
*
|
|
1876
|
-
* Used for `fixedCol` mode.
|
|
1877
|
-
*
|
|
1878
|
-
* @param {boolean | PlainObject} [effects=false] animation options.
|
|
1879
|
-
* @param {object} [options=null] {topNode: null, effects: ..., parent: ...}
|
|
1880
|
-
* this node will remain visible in
|
|
1881
|
-
* any case, even if `this` is outside the scroll pane.
|
|
2005
|
+
* Called by {@link setColumn}.
|
|
1882
2006
|
*/
|
|
1883
|
-
scrollToHorz(
|
|
2007
|
+
protected scrollToHorz(): void;
|
|
1884
2008
|
/**
|
|
1885
2009
|
* Set column #colIdx to 'active'.
|
|
1886
2010
|
*
|
|
1887
2011
|
* This higlights the column header and -cells by adding the `wb-active` class.
|
|
1888
|
-
* Available in cell-nav
|
|
2012
|
+
* Available in cell-nav mode only.
|
|
1889
2013
|
*/
|
|
1890
2014
|
setColumn(colIdx: number): void;
|
|
1891
2015
|
/** Set or remove keybaord focus to the tree container. */
|
|
@@ -1896,18 +2020,22 @@ declare module "wunderbaum" {
|
|
|
1896
2020
|
setModified(change: ChangeType, options?: any): void;
|
|
1897
2021
|
/** Schedule an update request to reflect a single node modification. */
|
|
1898
2022
|
setModified(change: ChangeType, node: WunderbaumNode, options?: any): void;
|
|
1899
|
-
/** Get the tree's navigation mode. */
|
|
1900
|
-
getNavigationMode(): NavigationMode;
|
|
1901
|
-
/** Set the tree's navigation mode. */
|
|
1902
|
-
setNavigationMode(mode: NavigationMode): void;
|
|
1903
2023
|
/** Disable mouse and keyboard interaction (return prev. state). */
|
|
1904
2024
|
setEnabled(flag?: boolean): boolean;
|
|
1905
2025
|
/** Return false if tree is disabled. */
|
|
1906
2026
|
isEnabled(): boolean;
|
|
1907
|
-
/** Return true if tree has
|
|
2027
|
+
/** Return true if tree has more than one column, i.e. has additional data columns. */
|
|
1908
2028
|
isGrid(): boolean;
|
|
2029
|
+
/** Return true if cell-navigation mode is acive. */
|
|
2030
|
+
isCellNav(): boolean;
|
|
2031
|
+
/** Return true if row-navigation mode is acive. */
|
|
2032
|
+
isRowNav(): boolean;
|
|
2033
|
+
/** Set the tree's navigation mode. */
|
|
2034
|
+
setCellNav(flag?: boolean): void;
|
|
2035
|
+
/** Set the tree's navigation mode option. */
|
|
2036
|
+
setNavigationOption(mode: NavigationOptions, reset?: boolean): void;
|
|
1909
2037
|
/** Display tree status (ok, loading, error, noData) using styles and a dummy root node. */
|
|
1910
|
-
setStatus(status: NodeStatusType,
|
|
2038
|
+
setStatus(status: NodeStatusType, options?: SetStatusOptions): WunderbaumNode | null;
|
|
1911
2039
|
/** Add or redefine node type definitions. */
|
|
1912
2040
|
setTypes(types: any, replace?: boolean): void;
|
|
1913
2041
|
/** Update column headers and width. */
|
|
@@ -1916,16 +2044,27 @@ declare module "wunderbaum" {
|
|
|
1916
2044
|
* @internal
|
|
1917
2045
|
*/
|
|
1918
2046
|
protected _renderHeaderMarkup(): void;
|
|
1919
|
-
/**
|
|
1920
|
-
|
|
2047
|
+
/**
|
|
2048
|
+
* Render pending changes that were scheduled using {@link WunderbaumNode.setModified} if any.
|
|
2049
|
+
*
|
|
2050
|
+
* This is hardly ever neccessary, since we normally either
|
|
2051
|
+
* - call `setModified(ChangeType.TYPE)` (async, throttled), or
|
|
2052
|
+
* - call `setModified(ChangeType.TYPE, {immediate: true})` (synchronous)
|
|
2053
|
+
*
|
|
2054
|
+
* `updatePendingModifications()` will only force immediate execution of
|
|
2055
|
+
* pending async changes if any.
|
|
2056
|
+
*/
|
|
2057
|
+
updatePendingModifications(): void;
|
|
1921
2058
|
/**
|
|
1922
2059
|
* This is the actual update method, which is wrapped inside a throttle method.
|
|
1923
|
-
* This protected method should not be called directly but via
|
|
1924
|
-
* `tree.updateViewport()` or `tree.setModified()`.
|
|
1925
2060
|
* It calls `updateColumns()` and `_updateRows()`.
|
|
2061
|
+
*
|
|
2062
|
+
* This protected method should not be called directly but via
|
|
2063
|
+
* {@link WunderbaumNode.setModified}`, {@link Wunderbaum.setModified},
|
|
2064
|
+
* or {@link Wunderbaum.updatePendingModifications}.
|
|
1926
2065
|
* @internal
|
|
1927
2066
|
*/
|
|
1928
|
-
protected
|
|
2067
|
+
protected _updateViewportImmediately(): void;
|
|
1929
2068
|
protected _updateRows(opts?: any): boolean;
|
|
1930
2069
|
/**
|
|
1931
2070
|
* Call callback(node) for all nodes in hierarchical order (depth-first).
|
|
@@ -1935,7 +2074,7 @@ declare module "wunderbaum" {
|
|
|
1935
2074
|
* children only.
|
|
1936
2075
|
* @returns {boolean} false, if the iterator was stopped.
|
|
1937
2076
|
*/
|
|
1938
|
-
visit(callback: (node: WunderbaumNode) => any): import("
|
|
2077
|
+
visit(callback: (node: WunderbaumNode) => any): import("types").NodeVisitResponse;
|
|
1939
2078
|
/**
|
|
1940
2079
|
* Call fn(node) for all nodes in vertical order, top down (or bottom up).
|
|
1941
2080
|
*
|