wunderbaum 0.9.0 → 0.10.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/LICENSE +1 -1
- package/dist/wunderbaum.css +9 -2
- package/dist/wunderbaum.css.map +1 -1
- package/dist/wunderbaum.d.ts +62 -2
- package/dist/wunderbaum.esm.js +159 -25
- package/dist/wunderbaum.esm.min.js +21 -21
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +159 -25
- package/dist/wunderbaum.umd.min.js +30 -30
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/common.ts +2 -0
- package/src/drag_observer.ts +32 -3
- package/src/types.ts +19 -0
- package/src/util.ts +53 -1
- package/src/wb_ext_filter.ts +4 -0
- package/src/wb_ext_grid.ts +66 -6
- package/src/wb_options.ts +5 -0
- package/src/wunderbaum.scss +11 -3
- package/src/wunderbaum.ts +19 -2
package/LICENSE
CHANGED
package/dist/wunderbaum.css
CHANGED
|
@@ -94,6 +94,8 @@ div.wunderbaum div.wb-header {
|
|
|
94
94
|
position: sticky;
|
|
95
95
|
top: 0;
|
|
96
96
|
z-index: 2;
|
|
97
|
+
-webkit-user-select: none; /* Safari */
|
|
98
|
+
user-select: none;
|
|
97
99
|
}
|
|
98
100
|
div.wunderbaum div.wb-header,
|
|
99
101
|
div.wunderbaum div.wb-list-container {
|
|
@@ -202,6 +204,10 @@ div.wunderbaum div.wb-header span.wb-col-resizer {
|
|
|
202
204
|
border: none;
|
|
203
205
|
border-right: 2px solid var(--wb-border-color);
|
|
204
206
|
height: 100%;
|
|
207
|
+
-webkit-user-select: none;
|
|
208
|
+
user-select: none;
|
|
209
|
+
}
|
|
210
|
+
div.wunderbaum div.wb-header span.wb-col-resizer.wb-col-resizer-active {
|
|
205
211
|
cursor: col-resize;
|
|
206
212
|
}
|
|
207
213
|
div.wunderbaum span.wb-col {
|
|
@@ -218,6 +224,7 @@ div.wunderbaum span.wb-col:last-of-type {
|
|
|
218
224
|
border-right: none;
|
|
219
225
|
}
|
|
220
226
|
div.wunderbaum span.wb-node {
|
|
227
|
+
-webkit-user-select: none;
|
|
221
228
|
user-select: none;
|
|
222
229
|
/* Fix Bootstrap Icon alignment */
|
|
223
230
|
}
|
|
@@ -438,12 +445,12 @@ div.wunderbaum.wb-checkbox-auto-hide:focus .wb-row.wb-active i.wb-checkbox, div.
|
|
|
438
445
|
}
|
|
439
446
|
|
|
440
447
|
.wb-no-select {
|
|
441
|
-
user-select: none;
|
|
442
448
|
-webkit-user-select: none;
|
|
449
|
+
user-select: none;
|
|
443
450
|
}
|
|
444
451
|
.wb-no-select span.wb-title {
|
|
445
|
-
user-select: contain;
|
|
446
452
|
-webkit-user-select: contain;
|
|
453
|
+
user-select: contain;
|
|
447
454
|
}
|
|
448
455
|
|
|
449
456
|
/* RTL support */
|
package/dist/wunderbaum.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../src/wunderbaum.scss"],"names":[],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AA2EA;AAAA;EAME;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAMF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EAGA;AAsBA;
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../src/wunderbaum.scss"],"names":[],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AA2EA;AAAA;EAME;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAMF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;EAGA;AAsBA;AAyBA;AA8QA;AAoHA;AA8BA;AAgEA;AAEA;AAUA;AAoBA;AAYA;;AAvjBA;EAEE;;AAIF;EACE;EACA;;AAGF;EACE;EAEA;;AAMF;EACE;EACA;EACA;EACA;EACA;;AAGF;AAAA;EAEE;;AAKF;EACE;EACA;EACA;EACA;EACA;;AAMA;EACE;EACA;EACA;EACA;;AAIA;EACE;;AAKF;EAEE;;AAGF;EAEE;;AAGF;EACE;;AAOA;EAEE;EACA;;AAEA;EACE;;AAaN;EAEE;EACA;;AAEA;EACE;;AAON;EACE;;AAEA;EACE;;AAOF;EACE;;AAGF;EAEE;;AAGA;EACE;;AAKJ;EACE;EACA;;AAGF;EAEE;EACA;;AAEA;EAEE;;AAIJ;EACE;;AAGF;AAAA;AAAA;EAGE;EAcA;EASA;;AAGF;EAEE;;AAON;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EAIA;;AAIF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EAEA;EACA;EAEA;EACA;EACA;EACA;EACA;;AACA;EACE;;AAMN;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAIJ;EACE;EACA;AAqBA;;AAhBA;AAAA;AAAA;AAAA;EAIE;EACA;EACA;EACA;;AAGF;AAAA;EAEE;EACA;;AAIF;EACE;;AAGF;EACE;EACA;EACA;;AAMA;EACE;;AAIJ;AAAA;EAEE;EACA;EACA;EACA;;AAGF;EACE;EAEA;EACA;EACA;EACA;EACA;;AAUI;EACE;;AAON;EACE;;AAIJ;EACE;;AAEA;EACE;;AAIF;EACE;;AAGF;EACE;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EAgBE;EACA;EACA;;AAGF;AAAA;EAEE;;AAcA;EACE;;AAWJ;EACE;;AAGF;EACE;;AAEA;EACE;;AAON;EACE;;AAEA;EACE;;AAQJ;EACE;;AASJ;EACE;;AAEA;EACE;;AAGF;EACE;;AAMJ;EACE;;AAaJ;EACE;;AAEA;EACE;;AAIJ;EACE;;AAEA;EACE;EACA;;AAGA;EACE;EACA;;AAEA;EAGE;EACA;EAGA;EACA;EACA;;AAgBR;AAAA;EAIE;EACA;EACA;;AAKF;EACE;;AAUE;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAFF;AAAA;EAEE;;AAOJ;EAIE;EACA;;AAGF;AAAA;EAKE;EACA;;AAMF;AAAA;EAEE;EACA;EACA;EACA;;AAOF;EACE;;AAGF;AAAA;EAEE;;AAKA;EACE;;;AAMR;AAEA;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;;AAQJ;AACA;AAAA;EAEE;;;AAGF;AAAA;EAEE;;;AAIA;AAAA;EAEE;;AAGF;AAAA;EAEE;;;AAIJ;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;EACA;;;AAIJ;AAAA;AAAA;AAMA;EACE;EACA;;;AAGF;EAGE;;;AAGF;EACE;;;AAKF;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE","file":"wunderbaum.css"}
|
package/dist/wunderbaum.d.ts
CHANGED
|
@@ -294,7 +294,7 @@ declare module "util" {
|
|
|
294
294
|
export function extend(...args: any[]): any;
|
|
295
295
|
/** Return true if `obj` is of type `array`. */
|
|
296
296
|
export function isArray(obj: any): boolean;
|
|
297
|
-
/** Return true if `obj` is of type `Object` and has no
|
|
297
|
+
/** Return true if `obj` is of type `Object` and has no properties. */
|
|
298
298
|
export function isEmptyObject(obj: any): boolean;
|
|
299
299
|
/** Return true if `obj` is of type `function`. */
|
|
300
300
|
export function isFunction(obj: any): boolean;
|
|
@@ -374,6 +374,26 @@ declare module "util" {
|
|
|
374
374
|
export function getOption(opts: any, name: string, defaultValue?: any): any;
|
|
375
375
|
/** Convert an Array or space-separated string to a Set. */
|
|
376
376
|
export function toSet(val: any): Set<string>;
|
|
377
|
+
/** Convert a pixel string to number.
|
|
378
|
+
* We accept a number or a string like '123px'. If undefined, the first default
|
|
379
|
+
* value that is a number or a string ending with 'px' is returned.
|
|
380
|
+
*
|
|
381
|
+
* Example:
|
|
382
|
+
* ```js
|
|
383
|
+
* let x = undefined;
|
|
384
|
+
* let y = "123px";
|
|
385
|
+
* const width = util.toPixel(x, y, 100); // returns 123
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
export function toPixel(...defaults: (string | number | undefined | null)[]): number;
|
|
389
|
+
/** Return the the boolean value of the first non-null element.
|
|
390
|
+
* Example:
|
|
391
|
+
* ```js
|
|
392
|
+
* const opts = { flag: true };
|
|
393
|
+
* const value = util.toBool(opts.foo, opts.flag, false); // returns true
|
|
394
|
+
* ```
|
|
395
|
+
*/
|
|
396
|
+
export function toBool(...boolDefaults: (boolean | undefined | null)[]): boolean;
|
|
377
397
|
/** Return a canonical string representation for an object's type (e.g. 'array', 'number', ...). */
|
|
378
398
|
export function type(obj: any): string;
|
|
379
399
|
/**
|
|
@@ -416,6 +436,8 @@ declare module "common" {
|
|
|
416
436
|
export const RENDER_MAX_PREFETCH = 5;
|
|
417
437
|
/** Skip rendering new rows when we have at least N nodes rendeed above and below the viewport. */
|
|
418
438
|
export const RENDER_MIN_PREFETCH = 5;
|
|
439
|
+
/** Minimum column width if not set otherwise. */
|
|
440
|
+
export const DEFAULT_MIN_COL_WIDTH = 4;
|
|
419
441
|
/** Regular expression to detect if a string describes an image URL (in contrast
|
|
420
442
|
* to a class name). Strings are considered image urls if they contain '.' or '/'.
|
|
421
443
|
*/
|
|
@@ -1217,6 +1239,11 @@ declare module "wb_options" {
|
|
|
1217
1239
|
* Default: false
|
|
1218
1240
|
*/
|
|
1219
1241
|
fixedCol?: boolean;
|
|
1242
|
+
/**
|
|
1243
|
+
* Default value for ColumnDefinition.resizable option.
|
|
1244
|
+
* Default: false
|
|
1245
|
+
*/
|
|
1246
|
+
resizableColumns?: boolean;
|
|
1220
1247
|
/**
|
|
1221
1248
|
* Default: "multi"
|
|
1222
1249
|
*/
|
|
@@ -1386,6 +1413,8 @@ declare module "types" {
|
|
|
1386
1413
|
export type TristateType = boolean | undefined;
|
|
1387
1414
|
/** Show/hide checkbox or display a radiobutton icon instead. */
|
|
1388
1415
|
export type CheckboxOption = boolean | "radio";
|
|
1416
|
+
/** A value that can either be true, false, or undefined. */
|
|
1417
|
+
export type SortOrderType = "asc" | "desc" | undefined;
|
|
1389
1418
|
/** An icon may either be
|
|
1390
1419
|
* a string-tag that references an entry in the `iconMap` (e.g. `"folderOpen"`)),
|
|
1391
1420
|
* an HTML string that contains a `<` and is used as-is,
|
|
@@ -1667,6 +1696,23 @@ declare module "types" {
|
|
|
1667
1696
|
* Default: `4px`.
|
|
1668
1697
|
*/
|
|
1669
1698
|
minWidth?: string | number;
|
|
1699
|
+
/** Allow user to resize the column.
|
|
1700
|
+
* Default: false.
|
|
1701
|
+
*/
|
|
1702
|
+
resizable?: boolean;
|
|
1703
|
+
/** Optional custom column width when user resized by mouse drag.
|
|
1704
|
+
* Default: unset.
|
|
1705
|
+
*/
|
|
1706
|
+
customWidthPx?: number;
|
|
1707
|
+
/** Allow user to sort the column. Default: false. <br>
|
|
1708
|
+
* **Note:** Sorting is not implemented yet.
|
|
1709
|
+
*/
|
|
1710
|
+
sortable?: boolean;
|
|
1711
|
+
/** Optional custom column sort orde when user clicked the sort icon.
|
|
1712
|
+
* Default: unset. <br>
|
|
1713
|
+
* **Note:** Sorting is not implemented yet.
|
|
1714
|
+
*/
|
|
1715
|
+
sortOrder?: SortOrderType;
|
|
1670
1716
|
/** Optional class names that are added to all `span.wb-col` header AND data
|
|
1671
1717
|
* elements of that column.
|
|
1672
1718
|
*/
|
|
@@ -2372,8 +2418,15 @@ declare module "drag_observer" {
|
|
|
2372
2418
|
export type DragCallbackArgType = {
|
|
2373
2419
|
/** "dragstart", "drag", or "dragstop". */
|
|
2374
2420
|
type: string;
|
|
2375
|
-
/** Original
|
|
2421
|
+
/** Original mousedown or touch event that triggered the dragstart event. */
|
|
2422
|
+
startEvent: MouseEvent | TouchEvent;
|
|
2423
|
+
/** Original mouse or touch event that triggered the current drag event.
|
|
2424
|
+
* Note that this is not the same as `startEvent`, but a mousemove in case of
|
|
2425
|
+
* a dragstart threshold.
|
|
2426
|
+
*/
|
|
2376
2427
|
event: MouseEvent | TouchEvent;
|
|
2428
|
+
/** Custom data that was passed to the DragObserver, typically on dragstart. */
|
|
2429
|
+
customData: any;
|
|
2377
2430
|
/** Element which is currently dragged. */
|
|
2378
2431
|
dragElem: HTMLElement | null;
|
|
2379
2432
|
/** Relative horizontal drag distance since start. */
|
|
@@ -2403,6 +2456,7 @@ declare module "drag_observer" {
|
|
|
2403
2456
|
protected _handler: any;
|
|
2404
2457
|
protected root: EventTarget;
|
|
2405
2458
|
protected start: {
|
|
2459
|
+
event: MouseEvent | TouchEvent | null;
|
|
2406
2460
|
x: number;
|
|
2407
2461
|
y: number;
|
|
2408
2462
|
altKey: boolean;
|
|
@@ -2412,6 +2466,7 @@ declare module "drag_observer" {
|
|
|
2412
2466
|
};
|
|
2413
2467
|
protected dragElem: HTMLElement | null;
|
|
2414
2468
|
protected dragging: boolean;
|
|
2469
|
+
protected customData: object;
|
|
2415
2470
|
protected events: string[];
|
|
2416
2471
|
protected opts: DragObserverOptionsType;
|
|
2417
2472
|
constructor(opts: DragObserverOptionsType);
|
|
@@ -2437,6 +2492,9 @@ declare module "wb_ext_grid" {
|
|
|
2437
2492
|
protected observer: DragObserver;
|
|
2438
2493
|
constructor(tree: Wunderbaum);
|
|
2439
2494
|
init(): void;
|
|
2495
|
+
/**
|
|
2496
|
+
* Hanldes drag and sragstop events for column resizing.
|
|
2497
|
+
*/
|
|
2440
2498
|
protected handleDrag(e: DragCallbackArgType): void;
|
|
2441
2499
|
}
|
|
2442
2500
|
}
|
|
@@ -2871,6 +2929,8 @@ declare module "wunderbaum" {
|
|
|
2871
2929
|
logTimeEnd(label: string): void;
|
|
2872
2930
|
/** Write to `console.warn` with tree name as prefix with if opts.debugLevel >= 2. */
|
|
2873
2931
|
logWarn(...args: any[]): void;
|
|
2932
|
+
/** Reset column widths to default. */
|
|
2933
|
+
resetColumns(): void;
|
|
2874
2934
|
/**
|
|
2875
2935
|
* Make sure that this node is vertically scrolled into the viewport.
|
|
2876
2936
|
*
|
package/dist/wunderbaum.esm.js
CHANGED
|
@@ -288,7 +288,7 @@ function throttle(func, wait = 0, options = {}) {
|
|
|
288
288
|
/*!
|
|
289
289
|
* Wunderbaum - util
|
|
290
290
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
291
|
-
* v0.
|
|
291
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
292
292
|
*/
|
|
293
293
|
/** @module util */
|
|
294
294
|
/** Readable names for `MouseEvent.button` */
|
|
@@ -764,7 +764,7 @@ function extend(...args) {
|
|
|
764
764
|
function isArray(obj) {
|
|
765
765
|
return Array.isArray(obj);
|
|
766
766
|
}
|
|
767
|
-
/** Return true if `obj` is of type `Object` and has no
|
|
767
|
+
/** Return true if `obj` is of type `Object` and has no properties. */
|
|
768
768
|
function isEmptyObject(obj) {
|
|
769
769
|
return Object.keys(obj).length === 0 && obj.constructor === Object;
|
|
770
770
|
}
|
|
@@ -937,6 +937,54 @@ function toSet(val) {
|
|
|
937
937
|
}
|
|
938
938
|
throw new Error("Cannot convert to Set<string>: " + val);
|
|
939
939
|
}
|
|
940
|
+
/** Convert a pixel string to number.
|
|
941
|
+
* We accept a number or a string like '123px'. If undefined, the first default
|
|
942
|
+
* value that is a number or a string ending with 'px' is returned.
|
|
943
|
+
*
|
|
944
|
+
* Example:
|
|
945
|
+
* ```js
|
|
946
|
+
* let x = undefined;
|
|
947
|
+
* let y = "123px";
|
|
948
|
+
* const width = util.toPixel(x, y, 100); // returns 123
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
function toPixel(
|
|
952
|
+
// val: string | number | undefined | null,
|
|
953
|
+
...defaults) {
|
|
954
|
+
// if (typeof val === "number") {
|
|
955
|
+
// return val;
|
|
956
|
+
// }
|
|
957
|
+
for (const d of defaults) {
|
|
958
|
+
if (typeof d === "number") {
|
|
959
|
+
return d;
|
|
960
|
+
}
|
|
961
|
+
if (typeof d === "string" && d.endsWith("px")) {
|
|
962
|
+
return parseInt(d, 10);
|
|
963
|
+
}
|
|
964
|
+
assert(d == null, `Expected a number or string like '123px': ${d}`);
|
|
965
|
+
}
|
|
966
|
+
throw new Error(`Expected a string like '123px': ${defaults}`);
|
|
967
|
+
}
|
|
968
|
+
/** Return the the boolean value of the first non-null element.
|
|
969
|
+
* Example:
|
|
970
|
+
* ```js
|
|
971
|
+
* const opts = { flag: true };
|
|
972
|
+
* const value = util.toBool(opts.foo, opts.flag, false); // returns true
|
|
973
|
+
* ```
|
|
974
|
+
*/
|
|
975
|
+
function toBool(
|
|
976
|
+
// val: boolean | undefined | null,
|
|
977
|
+
...boolDefaults) {
|
|
978
|
+
// if (val != null) {
|
|
979
|
+
// return !!val;
|
|
980
|
+
// }
|
|
981
|
+
for (const d of boolDefaults) {
|
|
982
|
+
if (d != null) {
|
|
983
|
+
return !!d;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
throw new Error("No default boolean value provided");
|
|
987
|
+
}
|
|
940
988
|
// /** Check if a string is contained in an Array or Set. */
|
|
941
989
|
// export function isAnyOf(s: string, items: Array<string>|Set<string>): boolean {
|
|
942
990
|
// return Array.prototype.includes.call(items, s)
|
|
@@ -1078,6 +1126,8 @@ var util = /*#__PURE__*/Object.freeze({
|
|
|
1078
1126
|
setValueToElem: setValueToElem,
|
|
1079
1127
|
sleep: sleep,
|
|
1080
1128
|
throttle: throttle,
|
|
1129
|
+
toBool: toBool,
|
|
1130
|
+
toPixel: toPixel,
|
|
1081
1131
|
toSet: toSet,
|
|
1082
1132
|
toggleCheckbox: toggleCheckbox,
|
|
1083
1133
|
type: type
|
|
@@ -1086,7 +1136,7 @@ var util = /*#__PURE__*/Object.freeze({
|
|
|
1086
1136
|
/*!
|
|
1087
1137
|
* Wunderbaum - types
|
|
1088
1138
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1089
|
-
* v0.
|
|
1139
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
1090
1140
|
*/
|
|
1091
1141
|
/**
|
|
1092
1142
|
* Possible values for {@link WunderbaumNode.update()} and {@link Wunderbaum.update()}.
|
|
@@ -1150,7 +1200,7 @@ var NavModeEnum;
|
|
|
1150
1200
|
/*!
|
|
1151
1201
|
* Wunderbaum - wb_extension_base
|
|
1152
1202
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1153
|
-
* v0.
|
|
1203
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
1154
1204
|
*/
|
|
1155
1205
|
class WunderbaumExtension {
|
|
1156
1206
|
constructor(tree, id, defaults) {
|
|
@@ -1209,7 +1259,7 @@ class WunderbaumExtension {
|
|
|
1209
1259
|
/*!
|
|
1210
1260
|
* Wunderbaum - ext-filter
|
|
1211
1261
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1212
|
-
* v0.
|
|
1262
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
1213
1263
|
*/
|
|
1214
1264
|
const START_MARKER = "\uFFF7";
|
|
1215
1265
|
const END_MARKER = "\uFFF8";
|
|
@@ -1236,6 +1286,7 @@ class FilterExtension extends WunderbaumExtension {
|
|
|
1236
1286
|
const connectInput = this.getPluginOption("connectInput");
|
|
1237
1287
|
if (connectInput) {
|
|
1238
1288
|
this.queryInput = elemFromSelector(connectInput);
|
|
1289
|
+
assert(this.queryInput, `Invalid 'filter.connectInput' option: ${connectInput}.`);
|
|
1239
1290
|
onEvent(this.queryInput, "input", debounce((e) => {
|
|
1240
1291
|
// this.tree.log("query", e);
|
|
1241
1292
|
this.filterNodes(this.queryInput.value.trim(), {});
|
|
@@ -1533,7 +1584,7 @@ function _markFuzzyMatchedChars(text, matches, escapeTitles = true) {
|
|
|
1533
1584
|
/*!
|
|
1534
1585
|
* Wunderbaum - ext-keynav
|
|
1535
1586
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1536
|
-
* v0.
|
|
1587
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
1537
1588
|
*/
|
|
1538
1589
|
const QUICKSEARCH_DELAY = 500;
|
|
1539
1590
|
class KeynavExtension extends WunderbaumExtension {
|
|
@@ -1897,7 +1948,7 @@ class KeynavExtension extends WunderbaumExtension {
|
|
|
1897
1948
|
/*!
|
|
1898
1949
|
* Wunderbaum - ext-logger
|
|
1899
1950
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1900
|
-
* v0.
|
|
1951
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
1901
1952
|
*/
|
|
1902
1953
|
class LoggerExtension extends WunderbaumExtension {
|
|
1903
1954
|
constructor(tree) {
|
|
@@ -1939,7 +1990,7 @@ class LoggerExtension extends WunderbaumExtension {
|
|
|
1939
1990
|
/*!
|
|
1940
1991
|
* Wunderbaum - common
|
|
1941
1992
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
1942
|
-
* v0.
|
|
1993
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
1943
1994
|
*/
|
|
1944
1995
|
const DEFAULT_DEBUGLEVEL = 3; // Replaced by rollup script
|
|
1945
1996
|
/**
|
|
@@ -1957,6 +2008,8 @@ const ICON_WIDTH = 20;
|
|
|
1957
2008
|
const TITLE_SPAN_PAD_Y = 7;
|
|
1958
2009
|
/** Render row markup for N nodes above and below the visible viewport. */
|
|
1959
2010
|
const RENDER_MAX_PREFETCH = 5;
|
|
2011
|
+
/** Minimum column width if not set otherwise. */
|
|
2012
|
+
const DEFAULT_MIN_COL_WIDTH = 4;
|
|
1960
2013
|
/** Regular expression to detect if a string describes an image URL (in contrast
|
|
1961
2014
|
* to a class name). Strings are considered image urls if they contain '.' or '/'.
|
|
1962
2015
|
*/
|
|
@@ -2262,7 +2315,7 @@ function decompressSourceData(source) {
|
|
|
2262
2315
|
/*!
|
|
2263
2316
|
* Wunderbaum - ext-dnd
|
|
2264
2317
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2265
|
-
* v0.
|
|
2318
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
2266
2319
|
*/
|
|
2267
2320
|
const nodeMimeType = "application/x-wunderbaum-node";
|
|
2268
2321
|
class DndExtension extends WunderbaumExtension {
|
|
@@ -2707,7 +2760,7 @@ class DndExtension extends WunderbaumExtension {
|
|
|
2707
2760
|
/*!
|
|
2708
2761
|
* Wunderbaum - drag_observer
|
|
2709
2762
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2710
|
-
* v0.
|
|
2763
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
2711
2764
|
*/
|
|
2712
2765
|
/**
|
|
2713
2766
|
* Convert mouse- and touch events to 'dragstart', 'drag', and 'dragstop'.
|
|
@@ -2715,6 +2768,7 @@ class DndExtension extends WunderbaumExtension {
|
|
|
2715
2768
|
class DragObserver {
|
|
2716
2769
|
constructor(opts) {
|
|
2717
2770
|
this.start = {
|
|
2771
|
+
event: null,
|
|
2718
2772
|
x: 0,
|
|
2719
2773
|
y: 0,
|
|
2720
2774
|
altKey: false,
|
|
@@ -2724,6 +2778,7 @@ class DragObserver {
|
|
|
2724
2778
|
};
|
|
2725
2779
|
this.dragElem = null;
|
|
2726
2780
|
this.dragging = false;
|
|
2781
|
+
this.customData = {};
|
|
2727
2782
|
// TODO: touch events
|
|
2728
2783
|
this.events = ["mousedown", "mouseup", "mousemove", "keydown"];
|
|
2729
2784
|
if (!opts.root) {
|
|
@@ -2751,22 +2806,32 @@ class DragObserver {
|
|
|
2751
2806
|
stopDrag(cb_event) {
|
|
2752
2807
|
if (this.dragging && this.opts.dragstop && cb_event) {
|
|
2753
2808
|
cb_event.type = "dragstop";
|
|
2754
|
-
|
|
2809
|
+
try {
|
|
2810
|
+
this.opts.dragstop(cb_event);
|
|
2811
|
+
}
|
|
2812
|
+
catch (err) {
|
|
2813
|
+
console.error("dragstop error", err); // eslint-disable-line no-console
|
|
2814
|
+
}
|
|
2755
2815
|
}
|
|
2756
2816
|
this.dragElem = null;
|
|
2757
2817
|
this.dragging = false;
|
|
2818
|
+
this.start.event = null;
|
|
2819
|
+
this.customData = {};
|
|
2758
2820
|
}
|
|
2759
2821
|
handleEvent(e) {
|
|
2760
2822
|
const type = e.type;
|
|
2761
2823
|
const opts = this.opts;
|
|
2762
2824
|
const cb_event = {
|
|
2763
2825
|
type: e.type,
|
|
2826
|
+
startEvent: type === "mousedown" ? e : this.start.event,
|
|
2764
2827
|
event: e,
|
|
2828
|
+
customData: this.customData,
|
|
2765
2829
|
dragElem: this.dragElem,
|
|
2766
2830
|
dx: e.pageX - this.start.x,
|
|
2767
2831
|
dy: e.pageY - this.start.y,
|
|
2768
2832
|
apply: undefined,
|
|
2769
2833
|
};
|
|
2834
|
+
// console.log("handleEvent", type, cb_event);
|
|
2770
2835
|
switch (type) {
|
|
2771
2836
|
case "keydown":
|
|
2772
2837
|
this.stopDrag(cb_event);
|
|
@@ -2791,6 +2856,7 @@ class DragObserver {
|
|
|
2791
2856
|
}
|
|
2792
2857
|
}
|
|
2793
2858
|
}
|
|
2859
|
+
this.start.event = e;
|
|
2794
2860
|
this.start.x = e.pageX;
|
|
2795
2861
|
this.start.y = e.pageY;
|
|
2796
2862
|
this.start.altKey = e.altKey;
|
|
@@ -2843,7 +2909,7 @@ class DragObserver {
|
|
|
2843
2909
|
/*!
|
|
2844
2910
|
* Wunderbaum - ext-grid
|
|
2845
2911
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2846
|
-
* v0.
|
|
2912
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
2847
2913
|
*/
|
|
2848
2914
|
class GridExtension extends WunderbaumExtension {
|
|
2849
2915
|
constructor(tree) {
|
|
@@ -2852,11 +2918,43 @@ class GridExtension extends WunderbaumExtension {
|
|
|
2852
2918
|
});
|
|
2853
2919
|
this.observer = new DragObserver({
|
|
2854
2920
|
root: window.document,
|
|
2855
|
-
selector: "span.wb-col-resizer",
|
|
2921
|
+
selector: "span.wb-col-resizer-active",
|
|
2856
2922
|
thresh: 4,
|
|
2857
2923
|
// throttle: 400,
|
|
2858
2924
|
dragstart: (e) => {
|
|
2859
|
-
|
|
2925
|
+
const info = Wunderbaum.getEventInfo(e.startEvent);
|
|
2926
|
+
const colDef = info.colDef;
|
|
2927
|
+
const allow = colDef &&
|
|
2928
|
+
this.tree.element.contains(e.dragElem) &&
|
|
2929
|
+
toBool(colDef.resizable, tree.options.resizableColumns, false);
|
|
2930
|
+
// this.tree.log("dragstart", colDef, e, info);
|
|
2931
|
+
this.tree.element.classList.toggle("wb-col-resizing", !!allow);
|
|
2932
|
+
info.colElem.classList.toggle("wb-col-resizing", !!allow);
|
|
2933
|
+
// We start dagging, so we remember the actual width in *pixels*
|
|
2934
|
+
// (which may be 'auto' or '100%').
|
|
2935
|
+
// Since we we re-create the markup on each update, we also cannot store
|
|
2936
|
+
// the original event or DOM element, but only the colDef object.
|
|
2937
|
+
if (allow) {
|
|
2938
|
+
// Store initial target column infos in customData
|
|
2939
|
+
e.customData.colDef = colDef;
|
|
2940
|
+
e.customData.orgCustomWidthPx = colDef.customWidthPx;
|
|
2941
|
+
const curWidthPx = Number.parseInt(info.colElem.style.width, 10);
|
|
2942
|
+
e.customData.orgWidthPx = curWidthPx;
|
|
2943
|
+
// Set custom width to current width, so that we can modify it
|
|
2944
|
+
colDef.customWidthPx = curWidthPx;
|
|
2945
|
+
// this.tree.log(
|
|
2946
|
+
// `dragstart customWidthPx=${colDef.customWidthPx}`,
|
|
2947
|
+
// e,
|
|
2948
|
+
// info
|
|
2949
|
+
// );
|
|
2950
|
+
this.tree.update(ChangeType.colStructure);
|
|
2951
|
+
// this.tree.log(
|
|
2952
|
+
// `dragstart 2 customWidthPx=${colDef.customWidthPx}`,
|
|
2953
|
+
// e,
|
|
2954
|
+
// info
|
|
2955
|
+
// );
|
|
2956
|
+
}
|
|
2957
|
+
return allow;
|
|
2860
2958
|
},
|
|
2861
2959
|
drag: (e) => {
|
|
2862
2960
|
// TODO: throttle
|
|
@@ -2870,17 +2968,39 @@ class GridExtension extends WunderbaumExtension {
|
|
|
2870
2968
|
init() {
|
|
2871
2969
|
super.init();
|
|
2872
2970
|
}
|
|
2971
|
+
/**
|
|
2972
|
+
* Hanldes drag and sragstop events for column resizing.
|
|
2973
|
+
*/
|
|
2873
2974
|
handleDrag(e) {
|
|
2874
|
-
const
|
|
2875
|
-
|
|
2876
|
-
this.tree.log(`${e.type}(
|
|
2975
|
+
const custom = e.customData;
|
|
2976
|
+
const colDef = custom.colDef;
|
|
2977
|
+
// this.tree.log(`${e.type} (dx=${e.dx})`, e, info);
|
|
2978
|
+
if (e.type === "dragstop" || e.type === "drag") {
|
|
2979
|
+
this.tree.element.classList.remove("wb-col-resizing");
|
|
2980
|
+
// info.colElem!.classList.remove("wb-col-resizing");
|
|
2981
|
+
if (e.apply || e.type === "drag") {
|
|
2982
|
+
const minWidth = toPixel(colDef.minWidth, DEFAULT_MIN_COL_WIDTH);
|
|
2983
|
+
const newWidth = Math.max(minWidth, custom.orgWidthPx + e.dx);
|
|
2984
|
+
colDef.customWidthPx = newWidth;
|
|
2985
|
+
// this.tree.log(
|
|
2986
|
+
// `${e.type} minWidth=${minWidth}, newWidth=${newWidth}`,
|
|
2987
|
+
// colDef
|
|
2988
|
+
// );
|
|
2989
|
+
}
|
|
2990
|
+
else {
|
|
2991
|
+
// Drag was cancelled
|
|
2992
|
+
this.tree.log("Column resize cancelled", e);
|
|
2993
|
+
colDef.customWidthPx = custom.orgCustomWidthPx; // Restore original width or undefined
|
|
2994
|
+
}
|
|
2995
|
+
this.tree.update(ChangeType.colStructure);
|
|
2996
|
+
}
|
|
2877
2997
|
}
|
|
2878
2998
|
}
|
|
2879
2999
|
|
|
2880
3000
|
/*!
|
|
2881
3001
|
* Wunderbaum - deferred
|
|
2882
3002
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2883
|
-
* v0.
|
|
3003
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
2884
3004
|
*/
|
|
2885
3005
|
/**
|
|
2886
3006
|
* Implement a ES6 Promise, that exposes a resolve() and reject() method.
|
|
@@ -2933,7 +3053,7 @@ class Deferred {
|
|
|
2933
3053
|
/*!
|
|
2934
3054
|
* Wunderbaum - wunderbaum_node
|
|
2935
3055
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
2936
|
-
* v0.
|
|
3056
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
2937
3057
|
*/
|
|
2938
3058
|
/** WunderbaumNode properties that can be passed with source data.
|
|
2939
3059
|
* (Any other source properties will be stored as `node.data.PROP`.)
|
|
@@ -5342,7 +5462,7 @@ WunderbaumNode.sequence = 0;
|
|
|
5342
5462
|
/*!
|
|
5343
5463
|
* Wunderbaum - ext-edit
|
|
5344
5464
|
* Copyright (c) 2021-2024, Martin Wendt. Released under the MIT license.
|
|
5345
|
-
* v0.
|
|
5465
|
+
* v0.10.1, Sat, 20 Jul 2024 13:53:46 GMT (https://github.com/mar10/wunderbaum)
|
|
5346
5466
|
*/
|
|
5347
5467
|
// const START_MARKER = "\uFFF7";
|
|
5348
5468
|
class EditExtension extends WunderbaumExtension {
|
|
@@ -5673,8 +5793,8 @@ class EditExtension extends WunderbaumExtension {
|
|
|
5673
5793
|
* https://github.com/mar10/wunderbaum
|
|
5674
5794
|
*
|
|
5675
5795
|
* Released under the MIT license.
|
|
5676
|
-
* @version v0.
|
|
5677
|
-
* @date
|
|
5796
|
+
* @version v0.10.1
|
|
5797
|
+
* @date Sat, 20 Jul 2024 13:53:46 GMT
|
|
5678
5798
|
*/
|
|
5679
5799
|
// import "./wunderbaum.scss";
|
|
5680
5800
|
class WbSystemRoot extends WunderbaumNode {
|
|
@@ -6997,6 +7117,13 @@ class Wunderbaum {
|
|
|
6997
7117
|
console.warn(this.toString(), ...args); // eslint-disable-line no-console
|
|
6998
7118
|
}
|
|
6999
7119
|
}
|
|
7120
|
+
/** Reset column widths to default. */
|
|
7121
|
+
resetColumns() {
|
|
7122
|
+
this.columns.forEach((col) => {
|
|
7123
|
+
delete col.customWidthPx;
|
|
7124
|
+
});
|
|
7125
|
+
this.update(ChangeType.colStructure);
|
|
7126
|
+
}
|
|
7000
7127
|
/**
|
|
7001
7128
|
* Make sure that this node is vertically scrolled into the viewport.
|
|
7002
7129
|
*
|
|
@@ -7354,7 +7481,7 @@ class Wunderbaum {
|
|
|
7354
7481
|
this._columnsById = {};
|
|
7355
7482
|
for (const col of columns) {
|
|
7356
7483
|
this._columnsById[col.id] = col;
|
|
7357
|
-
const cw = col.width;
|
|
7484
|
+
const cw = col.customWidthPx ? `${col.customWidthPx}px` : col.width;
|
|
7358
7485
|
if (col.id === "*" && col !== col0) {
|
|
7359
7486
|
throw new Error(`Column id '*' must be defined only once: '${col.title}'.`);
|
|
7360
7487
|
}
|
|
@@ -7460,7 +7587,13 @@ class Wunderbaum {
|
|
|
7460
7587
|
}
|
|
7461
7588
|
let resizer = "";
|
|
7462
7589
|
if (i < colCount - 1) {
|
|
7463
|
-
|
|
7590
|
+
if (toBool(col.resizable, this.options.resizableColumns, false)) {
|
|
7591
|
+
resizer =
|
|
7592
|
+
'<span class="wb-col-resizer wb-col-resizer-active"></span>';
|
|
7593
|
+
}
|
|
7594
|
+
else {
|
|
7595
|
+
resizer = '<span class="wb-col-resizer"></span>';
|
|
7596
|
+
}
|
|
7464
7597
|
}
|
|
7465
7598
|
colElem.innerHTML = `<span class="wb-col-title"${tooltip}>${title}</span>${resizer}`;
|
|
7466
7599
|
if (this.isCellNav()) {
|
|
@@ -7541,6 +7674,7 @@ class Wunderbaum {
|
|
|
7541
7674
|
// console.profileEnd(`_updateViewportImmediately()`)
|
|
7542
7675
|
}
|
|
7543
7676
|
if (this.options.connectTopBreadcrumb) {
|
|
7677
|
+
assert(this.options.connectTopBreadcrumb.textContent != null, `Invalid 'connectTopBreadcrumb' option (input element expected).`);
|
|
7544
7678
|
let path = (_a = this.getTopmostVpNode(true)) === null || _a === void 0 ? void 0 : _a.getPath(false, "title", " > ");
|
|
7545
7679
|
path = path ? path + " >" : "";
|
|
7546
7680
|
this.options.connectTopBreadcrumb.textContent = path;
|
|
@@ -7910,7 +8044,7 @@ class Wunderbaum {
|
|
|
7910
8044
|
}
|
|
7911
8045
|
Wunderbaum.sequence = 0;
|
|
7912
8046
|
/** Wunderbaum release version number "MAJOR.MINOR.PATCH". */
|
|
7913
|
-
Wunderbaum.version = "v0.
|
|
8047
|
+
Wunderbaum.version = "v0.10.1"; // Set to semver by 'grunt release'
|
|
7914
8048
|
/** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
|
|
7915
8049
|
Wunderbaum.util = util;
|
|
7916
8050
|
|