wunderbaum 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wunderbaum.css +10 -1
- package/dist/wunderbaum.css.map +1 -1
- package/dist/wunderbaum.d.ts +214 -59
- package/dist/wunderbaum.esm.js +417 -222
- package/dist/wunderbaum.esm.min.js +42 -42
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +417 -222
- package/dist/wunderbaum.umd.min.js +45 -45
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +30 -28
- package/src/common.ts +58 -16
- package/src/debounce.ts +5 -0
- package/src/deferred.ts +1 -1
- package/src/drag_observer.ts +1 -1
- package/src/types.ts +163 -21
- package/src/util.ts +1 -14
- package/src/wb_ext_dnd.ts +3 -3
- package/src/wb_ext_edit.ts +2 -2
- package/src/wb_ext_filter.ts +119 -44
- package/src/wb_ext_grid.ts +1 -1
- package/src/wb_ext_keynav.ts +1 -1
- package/src/wb_ext_logger.ts +1 -1
- package/src/wb_extension_base.ts +4 -3
- package/src/wb_node.ts +27 -98
- package/src/wb_options.ts +7 -5
- package/src/wunderbaum.scss +12 -4
- package/src/wunderbaum.ts +272 -48
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wunderbaum",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"title": "A treegrid control.",
|
|
5
5
|
"description": "JavaScript tree/grid/treegrid control.",
|
|
6
6
|
"homepage": "https://github.com/mar10/wunderbaum",
|
|
@@ -47,40 +47,42 @@
|
|
|
47
47
|
"control"
|
|
48
48
|
],
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@rollup/plugin-
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"
|
|
57
|
-
"eslint": "^8.
|
|
58
|
-
"
|
|
59
|
-
"eslint
|
|
60
|
-
"eslint-
|
|
50
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
51
|
+
"@eslint/js": "^9.20.0",
|
|
52
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
53
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
54
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
55
|
+
"@types/jest": "^29.5.14",
|
|
56
|
+
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
|
57
|
+
"@typescript-eslint/parser": "^8.24.0",
|
|
58
|
+
"concurrently": "^9.1.2",
|
|
59
|
+
"eslint": "^9.20.1",
|
|
60
|
+
"eslint-config-jquery": "^3.0.2",
|
|
61
|
+
"eslint-config-prettier": "^10.0.1",
|
|
62
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
61
63
|
"grunt": "^1.6.1",
|
|
62
|
-
"grunt-contrib-connect": "^
|
|
64
|
+
"grunt-contrib-connect": "^5.0.1",
|
|
63
65
|
"grunt-contrib-qunit": "^10.1.1",
|
|
64
66
|
"grunt-contrib-watch": "^1.1.0",
|
|
65
67
|
"grunt-exec": "^3.0.0",
|
|
66
68
|
"grunt-yabs": "^1.3.0",
|
|
67
69
|
"http-server": "^14.1.1",
|
|
68
|
-
"nodemon": "^
|
|
69
|
-
"postcss": "^8.2
|
|
70
|
+
"nodemon": "^3.1.9",
|
|
71
|
+
"postcss": "^8.5.2",
|
|
70
72
|
"postcss-url": "^10.1.3",
|
|
71
|
-
"prettier": "^
|
|
72
|
-
"pretty-quick": "^
|
|
73
|
-
"puppeteer": "^
|
|
74
|
-
"qunit": "^2.
|
|
75
|
-
"rollup": "^
|
|
76
|
-
"rollup-plugin-scss": "^4.0.
|
|
77
|
-
"sass": "^1.
|
|
78
|
-
"terser": "^5.
|
|
79
|
-
"ts-jest": "^29.
|
|
80
|
-
"ts-node": "^10.9.
|
|
81
|
-
"tslib": "^2.
|
|
82
|
-
"typedoc": "^0.
|
|
83
|
-
"typescript": "^5.
|
|
73
|
+
"prettier": "^3.5.1",
|
|
74
|
+
"pretty-quick": "^4.0.0",
|
|
75
|
+
"puppeteer": "^24.2.0",
|
|
76
|
+
"qunit": "^2.24.1",
|
|
77
|
+
"rollup": "^4.34.6",
|
|
78
|
+
"rollup-plugin-scss": "^4.0.1",
|
|
79
|
+
"sass": "^1.84.0",
|
|
80
|
+
"terser": "^5.39.0",
|
|
81
|
+
"ts-jest": "^29.2.5",
|
|
82
|
+
"ts-node": "^10.9.2",
|
|
83
|
+
"tslib": "^2.8.1",
|
|
84
|
+
"typedoc": "^0.27.7",
|
|
85
|
+
"typescript": "^5.7",
|
|
84
86
|
"yarn-audit-fix": "^10.1.1"
|
|
85
87
|
},
|
|
86
88
|
"nodemonConfig": {
|
package/src/common.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Wunderbaum - common
|
|
3
|
-
* Copyright (c) 2021-
|
|
3
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
4
4
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
ApplyCommandType,
|
|
9
|
+
NavigationType,
|
|
10
|
+
SourceListType,
|
|
11
|
+
SourceObjectType,
|
|
12
|
+
IconMapType,
|
|
13
|
+
MatcherCallback,
|
|
14
|
+
} from "./types";
|
|
8
15
|
import * as util from "./util";
|
|
9
16
|
import { WunderbaumNode } from "./wb_node";
|
|
10
17
|
|
|
@@ -36,10 +43,13 @@ export const TEST_IMG = new RegExp(/\.|\//);
|
|
|
36
43
|
// export const INVALID_REQUEST_TARGET_ERROR = "$request_target_invalid";
|
|
37
44
|
|
|
38
45
|
/**
|
|
39
|
-
* Default node icons
|
|
40
|
-
*
|
|
46
|
+
* Default node icons for icon libraries
|
|
47
|
+
*
|
|
48
|
+
* - 'bootstrap': {@link https://icons.getbootstrap.com}
|
|
49
|
+
* - 'fontawesome6' {@link https://fontawesome.com/icons}
|
|
50
|
+
*
|
|
41
51
|
*/
|
|
42
|
-
export const iconMaps: { [key: string]:
|
|
52
|
+
export const iconMaps: { [key: string]: IconMapType } = {
|
|
43
53
|
bootstrap: {
|
|
44
54
|
error: "bi bi-exclamation-triangle",
|
|
45
55
|
// loading: "bi bi-hourglass-split wb-busy",
|
|
@@ -137,7 +147,24 @@ export const RESERVED_TREE_SOURCE_KEYS: Set<string> = new Set([
|
|
|
137
147
|
// ]);
|
|
138
148
|
|
|
139
149
|
/** Map `KeyEvent.key` to navigation action. */
|
|
140
|
-
export const
|
|
150
|
+
export const KEY_TO_NAVIGATION_MAP: { [key: string]: NavigationType } = {
|
|
151
|
+
ArrowDown: "down",
|
|
152
|
+
ArrowLeft: "left",
|
|
153
|
+
ArrowRight: "right",
|
|
154
|
+
ArrowUp: "up",
|
|
155
|
+
Backspace: "parent",
|
|
156
|
+
End: "lastCol",
|
|
157
|
+
Home: "firstCol",
|
|
158
|
+
"Control+End": "last",
|
|
159
|
+
"Control+Home": "first",
|
|
160
|
+
"Meta+ArrowDown": "last", // macOs
|
|
161
|
+
"Meta+ArrowUp": "first", // macOs
|
|
162
|
+
PageDown: "pageDown",
|
|
163
|
+
PageUp: "pageUp",
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/** Map `KeyEvent.key` to navigation action. */
|
|
167
|
+
export const KEY_TO_COMMAND_MAP: { [key: string]: ApplyCommandType } = {
|
|
141
168
|
" ": "toggleSelect",
|
|
142
169
|
"+": "expand",
|
|
143
170
|
Add: "expand",
|
|
@@ -205,10 +232,12 @@ export function nodeTitleSorter(a: WunderbaumNode, b: WunderbaumNode): number {
|
|
|
205
232
|
/**
|
|
206
233
|
* Convert 'flat' to 'nested' format.
|
|
207
234
|
*
|
|
208
|
-
*
|
|
209
|
-
* [
|
|
210
|
-
*
|
|
211
|
-
* [
|
|
235
|
+
* Flat node entry format:
|
|
236
|
+
* [PARENT_IDX, {KEY_VALUE_ARGS}]
|
|
237
|
+
* or, if N _positional re defined:
|
|
238
|
+
* [PARENT_IDX, POSITIONAL_ARG_1, POSITIONAL_ARG_2, ..., POSITIONAL_ARG_N]
|
|
239
|
+
* Even if _positional additional are defined, KEY_VALUE_ARGS can be appended:
|
|
240
|
+
* [PARENT_IDX, POSITIONAL_ARG_1, ..., {KEY_VALUE_ARGS}]
|
|
212
241
|
*
|
|
213
242
|
* 1. Parent-referencing list is converted to a list of nested dicts with
|
|
214
243
|
* optional `children` properties.
|
|
@@ -216,11 +245,12 @@ export function nodeTitleSorter(a: WunderbaumNode, b: WunderbaumNode): number {
|
|
|
216
245
|
*/
|
|
217
246
|
function unflattenSource(source: SourceObjectType): void {
|
|
218
247
|
const { _format, _keyMap = {}, _positional = [], children } = source;
|
|
248
|
+
const _positionalCount = _positional.length;
|
|
219
249
|
|
|
220
250
|
if (_format !== "flat") {
|
|
221
251
|
throw new Error(`Expected source._format: "flat", but got ${_format}`);
|
|
222
252
|
}
|
|
223
|
-
if (
|
|
253
|
+
if (_positionalCount && _positional.includes("children")) {
|
|
224
254
|
throw new Error(
|
|
225
255
|
`source._positional must not include "children": ${_positional}`
|
|
226
256
|
);
|
|
@@ -236,7 +266,7 @@ function unflattenSource(source: SourceObjectType): void {
|
|
|
236
266
|
longToShort[value] = key;
|
|
237
267
|
}
|
|
238
268
|
}
|
|
239
|
-
const positionalShort = _positional.map((e: string) => longToShort[e]);
|
|
269
|
+
const positionalShort = _positional.map((e: string) => longToShort[e] ?? e);
|
|
240
270
|
const newChildren: SourceListType = [];
|
|
241
271
|
const keyToNodeMap: { [key: string]: number } = {};
|
|
242
272
|
const indexToNodeMap: { [key: number]: any } = {};
|
|
@@ -247,21 +277,33 @@ function unflattenSource(source: SourceObjectType): void {
|
|
|
247
277
|
// Node entry format:
|
|
248
278
|
// [PARENT_ID, [POSITIONAL_ARGS]]
|
|
249
279
|
// or
|
|
250
|
-
// [PARENT_ID,
|
|
251
|
-
|
|
280
|
+
// [PARENT_ID, POSITIONAL_ARG_1, POSITIONAL_ARG_2, ..., {KEY_VALUE_ARGS}]
|
|
281
|
+
let kwargs;
|
|
282
|
+
const [parentId, ...args] = <any>nodeTuple;
|
|
283
|
+
if (args.length === _positionalCount) {
|
|
284
|
+
kwargs = {};
|
|
285
|
+
} else if (args.length === _positionalCount + 1) {
|
|
286
|
+
kwargs = args.pop();
|
|
287
|
+
if (typeof kwargs !== "object") {
|
|
288
|
+
throw new Error(
|
|
289
|
+
`unflattenSource: Expected dict as last tuple element: ${nodeTuple}`
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
} else {
|
|
293
|
+
throw new Error(`unflattenSource: unexpected tuple length: ${nodeTuple}`);
|
|
294
|
+
}
|
|
252
295
|
|
|
253
296
|
// Free up some memory as we go
|
|
254
297
|
nodeTuple[1] = null;
|
|
255
298
|
if (nodeTuple[2] != null) {
|
|
256
299
|
nodeTuple[2] = null;
|
|
257
300
|
}
|
|
258
|
-
// console.log("flatten", parentId, args, kwargs)
|
|
259
|
-
|
|
260
301
|
// We keep `kwargs` as our new node definition. Then we add all positional
|
|
261
302
|
// values to this object:
|
|
262
303
|
args.forEach((val: string, positionalIdx: number) => {
|
|
263
304
|
kwargs[positionalShort[positionalIdx]] = val;
|
|
264
305
|
});
|
|
306
|
+
args.length = 0;
|
|
265
307
|
|
|
266
308
|
// Find the parent node. `null` means 'toplevel'. PARENT_ID may be the numeric
|
|
267
309
|
// index of the source.children list. If PARENT_ID is a string, we search
|
package/src/debounce.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/*!
|
|
2
|
+
* Wunderbaum - debounce.ts
|
|
3
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
4
|
+
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
5
|
+
*/
|
|
6
|
+
/*
|
|
2
7
|
* debounce & throttle, taken from https://github.com/lodash/lodash v4.17.21
|
|
3
8
|
* MIT License: https://raw.githubusercontent.com/lodash/lodash/4.17.21-npm/LICENSE
|
|
4
9
|
* Modified for TypeScript type annotations.
|
package/src/deferred.ts
CHANGED
package/src/drag_observer.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Wunderbaum - types
|
|
3
|
-
* Copyright (c) 2021-
|
|
3
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
4
4
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ export type SortOrderType = "asc" | "desc" | undefined;
|
|
|
22
22
|
* or a boolean value that indicates if the default icon should be used or hidden.
|
|
23
23
|
*/
|
|
24
24
|
export type IconOption = boolean | string;
|
|
25
|
-
/** Show/hide tooltip or display a string. */
|
|
25
|
+
/** Show/hide default tooltip or display a string. */
|
|
26
26
|
export type TooltipOption = boolean | string;
|
|
27
27
|
|
|
28
28
|
/*
|
|
@@ -93,7 +93,10 @@ export type NodeToDictCallback = (
|
|
|
93
93
|
dict: WbNodeData,
|
|
94
94
|
node: WunderbaumNode
|
|
95
95
|
) => NodeVisitResponse;
|
|
96
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* A callback that receives a node instance and may returnsa `false` to prevent
|
|
98
|
+
* (de)selection.
|
|
99
|
+
*/
|
|
97
100
|
export type NodeSelectCallback = (node: WunderbaumNode) => boolean | void;
|
|
98
101
|
|
|
99
102
|
/**
|
|
@@ -113,23 +116,56 @@ export type DynamicTooltipOption = TooltipOption | BoolOrStringOptionResolver;
|
|
|
113
116
|
// type WithWildcards<T> = T & { [key: string]: unknown };
|
|
114
117
|
/** A plain object (dictionary) that represents a node instance. */
|
|
115
118
|
export interface WbNodeData {
|
|
119
|
+
/** Defines if the `selected` state is displayed as checkbox, radio button,
|
|
120
|
+
* or hidden.
|
|
121
|
+
* Defaults to {@link WunderbaumOptions.checkbox}.
|
|
122
|
+
*/
|
|
116
123
|
checkbox?: CheckboxOption;
|
|
124
|
+
/** Optional list of child nodes.
|
|
125
|
+
* If `children` is an empty array, the node is considered a leaf.
|
|
126
|
+
* If `lazy` is true and `children is undefined or null, the node, is
|
|
127
|
+
* considered unloaded. Otherwise, the node is considered a leaf.
|
|
128
|
+
*/
|
|
117
129
|
children?: Array<WbNodeData>;
|
|
130
|
+
/** Additional classes that are added to `<div class='wb-row'>`. */
|
|
118
131
|
classes?: string;
|
|
132
|
+
/** Only show title in a single, merged column. */
|
|
119
133
|
colspan?: boolean;
|
|
134
|
+
/** Expand this node. */
|
|
120
135
|
expanded?: boolean;
|
|
136
|
+
/** Defaults to standard icons (doc, folder, folderOpen, ...)
|
|
137
|
+
* from {@link WunderbaumOptions.iconMap}.
|
|
138
|
+
* Can be overridden by {@link WunderbaumOptions.icon}.
|
|
139
|
+
*/
|
|
121
140
|
icon?: IconOption;
|
|
141
|
+
/** Tooltip for the node icon only. Defaults to {@link WunderbaumOptions.iconTooltip}. */
|
|
122
142
|
iconTooltip?: TooltipOption;
|
|
143
|
+
/** The node's key. Must be unique for the whole tree. Defaults to a sequence number. */
|
|
123
144
|
key?: string;
|
|
145
|
+
/** If true (and children are undefined or null), the node is considered lazy
|
|
146
|
+
* and {@link WunderbaumOptions.lazyLoad} is called when expanded.
|
|
147
|
+
*/
|
|
124
148
|
lazy?: boolean;
|
|
125
149
|
/** Make child nodes single-select radio buttons. */
|
|
126
150
|
radiogroup?: boolean;
|
|
151
|
+
/** Node's reference key. Unlike {@link WunderbaumNode.key}, this value
|
|
152
|
+
* may be non-unique. Nodes within the tree that share the same refKey are considered
|
|
153
|
+
* clones.
|
|
154
|
+
*/
|
|
127
155
|
refKey?: string;
|
|
156
|
+
/** The node's selection status, typically displayed as a checkbox. */
|
|
128
157
|
selected?: boolean;
|
|
158
|
+
/** The node's status, typically displayed as merged single row.
|
|
159
|
+
* @see {@link Wunderbaum.setStatus}
|
|
160
|
+
*/
|
|
129
161
|
statusNodeType?: NodeStatusType;
|
|
162
|
+
/** The node's title. Will be html escaped to prevent XSS. */
|
|
130
163
|
title: string;
|
|
164
|
+
/** Pass true to set node tooltip to the node's title. Defaults to {@link WunderbaumOptions.tooltip}. */
|
|
131
165
|
tooltip?: TooltipOption;
|
|
166
|
+
/** Inherit shared settings from the matching entry in {@link WunderbaumOptions.types}. */
|
|
132
167
|
type?: string;
|
|
168
|
+
/** Set to `true` to prevent selection. Defaults to {@link WunderbaumOptions.unselectable}. */
|
|
133
169
|
unselectable?: boolean;
|
|
134
170
|
/** @internal */
|
|
135
171
|
_treeId?: string;
|
|
@@ -137,6 +173,32 @@ export interface WbNodeData {
|
|
|
137
173
|
[key: string]: unknown;
|
|
138
174
|
}
|
|
139
175
|
|
|
176
|
+
/** A plain object (dictionary) that defines node icons. */
|
|
177
|
+
export interface IconMapType {
|
|
178
|
+
error: string;
|
|
179
|
+
loading: string;
|
|
180
|
+
noData: string;
|
|
181
|
+
expanderExpanded: string;
|
|
182
|
+
expanderCollapsed: string;
|
|
183
|
+
expanderLazy: string;
|
|
184
|
+
checkChecked: string;
|
|
185
|
+
checkUnchecked: string;
|
|
186
|
+
checkUnknown: string;
|
|
187
|
+
radioChecked: string;
|
|
188
|
+
radioUnchecked: string;
|
|
189
|
+
radioUnknown: string;
|
|
190
|
+
folder: string;
|
|
191
|
+
folderOpen: string;
|
|
192
|
+
folderLazy: string;
|
|
193
|
+
doc: string;
|
|
194
|
+
colSortable: string;
|
|
195
|
+
colSortAsc: string;
|
|
196
|
+
colSortDesc: string;
|
|
197
|
+
colFilter: string;
|
|
198
|
+
colFilterActive: string;
|
|
199
|
+
colMenu: string;
|
|
200
|
+
[key: string]: string;
|
|
201
|
+
}
|
|
140
202
|
/* -----------------------------------------------------------------------------
|
|
141
203
|
* EVENT CALLBACK TYPES
|
|
142
204
|
* ---------------------------------------------------------------------------*/
|
|
@@ -435,6 +497,21 @@ export interface ColumnDefinition {
|
|
|
435
497
|
|
|
436
498
|
export type ColumnDefinitionList = Array<ColumnDefinition>;
|
|
437
499
|
|
|
500
|
+
/**
|
|
501
|
+
* Used by {@link Wunderbaum.getState} and {@link Wunderbaum.setState}.
|
|
502
|
+
*/
|
|
503
|
+
export interface TreeStateDefinition {
|
|
504
|
+
/** The active node's key if any. */
|
|
505
|
+
activeKey: string | null;
|
|
506
|
+
/** The active column index if any. */
|
|
507
|
+
activeColIdx: number | null;
|
|
508
|
+
/** List of selected node's keys. */
|
|
509
|
+
selectedKeys: Array<string> | undefined;
|
|
510
|
+
/** List of expanded node's keys. */
|
|
511
|
+
expandedKeys: Array<string> | undefined;
|
|
512
|
+
/** List of checked node's keys. */
|
|
513
|
+
}
|
|
514
|
+
|
|
438
515
|
/**
|
|
439
516
|
* Column information (passed to the `render` event).
|
|
440
517
|
*/
|
|
@@ -482,29 +559,43 @@ export interface WbEventInfo {
|
|
|
482
559
|
// export type WbNodeCallbackType = (e: WbNodeEventType) => any;
|
|
483
560
|
// export type WbRenderCallbackType = (e: WbRenderEventType) => void;
|
|
484
561
|
|
|
485
|
-
export type FilterModeType = null | "dim" | "hide";
|
|
562
|
+
export type FilterModeType = null | "mark" | "dim" | "hide";
|
|
486
563
|
export type SelectModeType = "single" | "multi" | "hier";
|
|
564
|
+
|
|
565
|
+
export type NavigationType =
|
|
566
|
+
| "down"
|
|
567
|
+
| "first"
|
|
568
|
+
| "firstCol"
|
|
569
|
+
| "last"
|
|
570
|
+
| "lastCol"
|
|
571
|
+
| "left"
|
|
572
|
+
| "nextMatch"
|
|
573
|
+
| "pageDown"
|
|
574
|
+
| "pageUp"
|
|
575
|
+
| "parent"
|
|
576
|
+
| "prevMatch"
|
|
577
|
+
| "right"
|
|
578
|
+
| "up";
|
|
579
|
+
|
|
487
580
|
export type ApplyCommandType =
|
|
581
|
+
| NavigationType
|
|
488
582
|
| "addChild"
|
|
489
583
|
| "addSibling"
|
|
584
|
+
| "collapse"
|
|
585
|
+
| "collapseAll"
|
|
490
586
|
| "copy"
|
|
491
587
|
| "cut"
|
|
492
|
-
| "
|
|
493
|
-
| "
|
|
588
|
+
| "edit"
|
|
589
|
+
| "expand"
|
|
590
|
+
| "expandAll"
|
|
494
591
|
| "indent"
|
|
495
|
-
| "last"
|
|
496
|
-
| "left"
|
|
497
592
|
| "moveDown"
|
|
498
593
|
| "moveUp"
|
|
499
594
|
| "outdent"
|
|
500
|
-
| "pageDown"
|
|
501
|
-
| "pageUp"
|
|
502
|
-
| "parent"
|
|
503
595
|
| "paste"
|
|
504
596
|
| "remove"
|
|
505
597
|
| "rename"
|
|
506
|
-
| "
|
|
507
|
-
| "up";
|
|
598
|
+
| "toggleSelect";
|
|
508
599
|
|
|
509
600
|
export type NodeFilterResponse = "skip" | "branch" | boolean | void;
|
|
510
601
|
export type NodeFilterCallback = (node: WunderbaumNode) => NodeFilterResponse;
|
|
@@ -531,7 +622,7 @@ export enum ChangeType {
|
|
|
531
622
|
scroll = "scroll",
|
|
532
623
|
}
|
|
533
624
|
|
|
534
|
-
|
|
625
|
+
/** @internal */
|
|
535
626
|
export enum RenderFlag {
|
|
536
627
|
clearMarkup = "clearMarkup",
|
|
537
628
|
header = "header",
|
|
@@ -561,12 +652,33 @@ export enum NodeRegion {
|
|
|
561
652
|
|
|
562
653
|
/** Initial navigation mode and possible transition. */
|
|
563
654
|
export enum NavModeEnum {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
655
|
+
/** Start with row mode, but allow cell-nav mode */
|
|
656
|
+
startRow = "startRow",
|
|
657
|
+
/** Cell-nav mode only */
|
|
658
|
+
cell = "cell",
|
|
659
|
+
/** Start in cell-nav mode, but allow row mode */
|
|
660
|
+
startCell = "startCell",
|
|
661
|
+
/** Row mode only */
|
|
662
|
+
row = "row",
|
|
568
663
|
}
|
|
569
664
|
|
|
665
|
+
/** Translatable strings. */
|
|
666
|
+
export type TranslationsType = {
|
|
667
|
+
/** @default "Loading..." */
|
|
668
|
+
loading: string;
|
|
669
|
+
/** @default "Error" */
|
|
670
|
+
loadError: string;
|
|
671
|
+
/** @default "No data" */
|
|
672
|
+
noData: string;
|
|
673
|
+
/** @default " » " */
|
|
674
|
+
breadcrumbDelimiter: string;
|
|
675
|
+
/** @default "Found ${matches} of ${count}" */
|
|
676
|
+
queryResult: string;
|
|
677
|
+
/** @default "No result" */
|
|
678
|
+
noMatch: string;
|
|
679
|
+
/** @default "${match} of ${matches}" */
|
|
680
|
+
matchIndex: string;
|
|
681
|
+
};
|
|
570
682
|
/* -----------------------------------------------------------------------------
|
|
571
683
|
* METHOD OPTIONS TYPES
|
|
572
684
|
* ---------------------------------------------------------------------------*/
|
|
@@ -653,6 +765,22 @@ export interface FilterNodesOptions {
|
|
|
653
765
|
noData?: boolean | string;
|
|
654
766
|
}
|
|
655
767
|
|
|
768
|
+
/** Possible values for {@link Wunderbaum.getState}. */
|
|
769
|
+
export interface GetStateOptions {
|
|
770
|
+
// /** Include the activated key. @default true */
|
|
771
|
+
// activeKey?: boolean;
|
|
772
|
+
/** Include the expanded keys. @default true */
|
|
773
|
+
expandedKeys?: boolean;
|
|
774
|
+
/** Include the selected keys. @default true */
|
|
775
|
+
selectedKeys?: boolean;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/** Possible values for {@link Wunderbaum.setState}. */
|
|
779
|
+
export interface SetStateOptions {
|
|
780
|
+
/** Recursively load lazy nodes as needed. @default false */
|
|
781
|
+
expandLazy?: boolean;
|
|
782
|
+
}
|
|
783
|
+
|
|
656
784
|
/** Possible values for {@link WunderbaumNode.makeVisible}. */
|
|
657
785
|
export interface MakeVisibleOptions {
|
|
658
786
|
/** Do not animate expand (currently not implemented). @default false */
|
|
@@ -857,6 +985,19 @@ export interface VisitRowsOptions {
|
|
|
857
985
|
/* -----------------------------------------------------------------------------
|
|
858
986
|
* wb_ext_filter
|
|
859
987
|
* ---------------------------------------------------------------------------*/
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Passed as tree option.filer.connect to configure automatic integration of
|
|
991
|
+
* filter UI controls. @experimental
|
|
992
|
+
*/
|
|
993
|
+
export interface FilterConnectType {
|
|
994
|
+
inputElem: string | HTMLInputElement | null;
|
|
995
|
+
modeButton?: string | HTMLButtonElement | null;
|
|
996
|
+
nextButton?: string | HTMLButtonElement | HTMLAnchorElement | null;
|
|
997
|
+
prevButton?: string | HTMLButtonElement | HTMLAnchorElement | null;
|
|
998
|
+
matchInfoElem?: string | HTMLElement | null;
|
|
999
|
+
}
|
|
1000
|
+
|
|
860
1001
|
/**
|
|
861
1002
|
* Passed as tree options to configure default filtering behavior.
|
|
862
1003
|
*
|
|
@@ -865,10 +1006,12 @@ export interface VisitRowsOptions {
|
|
|
865
1006
|
*/
|
|
866
1007
|
export type FilterOptionsType = {
|
|
867
1008
|
/**
|
|
868
|
-
* Element or selector of
|
|
1009
|
+
* Element or selector of input controls and buttons for filter query strings.
|
|
1010
|
+
* @experimental
|
|
1011
|
+
* @since 0.13
|
|
869
1012
|
* @default null
|
|
870
1013
|
*/
|
|
871
|
-
|
|
1014
|
+
connect?: null | FilterConnectType;
|
|
872
1015
|
/**
|
|
873
1016
|
* Re-apply last filter if lazy data is loaded
|
|
874
1017
|
* @default true
|
|
@@ -965,7 +1108,6 @@ export type InsertNodeType =
|
|
|
965
1108
|
| "after"
|
|
966
1109
|
| "prependChild"
|
|
967
1110
|
| "appendChild";
|
|
968
|
-
// export type DndModeType = "before" | "after" | "over";
|
|
969
1111
|
|
|
970
1112
|
export type DropEffectType = "none" | "copy" | "link" | "move";
|
|
971
1113
|
export type DropEffectAllowedType =
|
package/src/util.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Wunderbaum - util
|
|
3
|
-
* Copyright (c) 2021-
|
|
3
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
4
4
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -424,19 +424,6 @@ export function elemFromSelector<T = HTMLElement>(obj: string | T): T | null {
|
|
|
424
424
|
return obj as T;
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
-
// /** Return a EventTarget from selector or cast an existing element. */
|
|
428
|
-
// export function eventTargetFromSelector(
|
|
429
|
-
// obj: string | EventTarget
|
|
430
|
-
// ): EventTarget | null {
|
|
431
|
-
// if (!obj) {
|
|
432
|
-
// return null;
|
|
433
|
-
// }
|
|
434
|
-
// if (typeof obj === "string") {
|
|
435
|
-
// return document.querySelector(obj) as EventTarget;
|
|
436
|
-
// }
|
|
437
|
-
// return obj as EventTarget;
|
|
438
|
-
// }
|
|
439
|
-
|
|
440
427
|
/**
|
|
441
428
|
* Return a canonical descriptive string for a keyboard or mouse event.
|
|
442
429
|
*
|
package/src/wb_ext_dnd.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Wunderbaum - ext-dnd
|
|
3
|
-
* Copyright (c) 2021-
|
|
3
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
4
4
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
5
5
|
*/
|
|
6
6
|
import * as util from "./util";
|
|
@@ -143,8 +143,8 @@ export class DndExtension extends WunderbaumExtension<DndOptionsType> {
|
|
|
143
143
|
return dy < 0.25 * rowHeight
|
|
144
144
|
? "before"
|
|
145
145
|
: dy > 0.75 * rowHeight
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
? "after"
|
|
147
|
+
: "over";
|
|
148
148
|
} else if (allowed.size === 1 && allowed.has("over")) {
|
|
149
149
|
return "over";
|
|
150
150
|
} else {
|
package/src/wb_ext_edit.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Wunderbaum - ext-edit
|
|
3
|
-
* Copyright (c) 2021-
|
|
3
|
+
* Copyright (c) 2021-2025, Martin Wendt. Released under the MIT license.
|
|
4
4
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -381,7 +381,7 @@ export class EditExtension extends WunderbaumExtension<EditOptionsType> {
|
|
|
381
381
|
this.relatedNode = node;
|
|
382
382
|
|
|
383
383
|
// Don't filter new nodes:
|
|
384
|
-
newNode.match =
|
|
384
|
+
newNode.match = -1;
|
|
385
385
|
|
|
386
386
|
newNode.makeVisible({ noAnimation: true }).then(() => {
|
|
387
387
|
this.startEditTitle(newNode);
|