wunderbaum 0.0.2 → 0.0.3
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 +1 -1
- package/dist/wunderbaum.d.ts +233 -85
- package/dist/wunderbaum.esm.js +512 -346
- package/dist/wunderbaum.esm.min.js +20 -20
- package/dist/wunderbaum.esm.min.js.map +1 -1
- package/dist/wunderbaum.umd.js +512 -346
- package/dist/wunderbaum.umd.min.js +26 -26
- package/dist/wunderbaum.umd.min.js.map +1 -1
- package/package.json +2 -2
- package/src/common.ts +31 -0
- package/src/util.ts +1 -0
- package/src/wb_ext_edit.ts +10 -1
- package/src/wb_ext_keynav.ts +8 -4
- package/src/wb_node.ts +124 -54
- package/src/wunderbaum.scss +8 -4
- package/src/wunderbaum.ts +433 -318
package/dist/wunderbaum.css
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Wunderbaum style sheet (generated from wunderbaum.scss)
|
|
3
3
|
* Copyright (c) 2021-2022, Martin Wendt. Released under the MIT license.
|
|
4
4
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
5
|
-
*/div.wunderbaum{box-sizing:border-box;height:100%;margin:0;padding:0;font-family:Helvetica,sans-serif;font-size:14px;color:#56534c;border:1px solid #56534c;overflow:hidden}div.wunderbaum div.wb-scroll-container{position:relative;overflow:auto;min-height:4px}div.wunderbaum div.wb-row{position:absolute;width:100%;height:22px;line-height:22px;border:1px solid transparent}div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-active,div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-selected,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-active,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-selected{background-color:#f0f0f0;border-color:#acacac}div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-active:hover,div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-selected:hover,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-active:hover,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-selected:hover{background-color:#eaeaea}div.wunderbaum div.wb-node-list div.wb-row:hover{background-color:#f7fcfe}div.wunderbaum div.wb-node-list div.wb-row.wb-active,div.wunderbaum div.wb-node-list div.wb-row.wb-selected{background-color:#e5f3fb}div.wunderbaum div.wb-node-list div.wb-row.wb-active:hover,div.wunderbaum div.wb-node-list div.wb-row.wb-selected:hover{background-color:#dceff8}div.wunderbaum div.wb-node-list div.wb-row.wb-focus:not(.wb-active){border-style:dotted;border-color:#70c0e7}div.wunderbaum div.wb-node-list div.wb-row.wb-active{border-style:solid;border-color:#70c0e7}div.wunderbaum div.wb-node-list div.wb-row.wb-active:hover{border-color:#26a0da}div.wunderbaum div.wb-node-list div.wb-row.wb-loading{font-style:italic}div.wunderbaum div.wb-node-list div.wb-row.wb-dirty,div.wunderbaum div.wb-node-list div.wb-row .wb-col.wb-dirty{font-style:italic;background:repeating-linear-gradient(45deg, #f7fcfe, #f7fcfe 5px, #dedede 5px, #dedede 10px);animation:wb-dirty-animation 2s linear infinite}div.wunderbaum div.wb-node-list div.wb-row.wb-error,div.wunderbaum div.wb-node-list div.wb-row.wb-status-error{color:#b5373b}div.wunderbaum div.wb-header{position:relative;height:22px;border-bottom:1px solid #56534c;padding:0;background-color:#dedede}div.wunderbaum div.wb-header span.wb-col{font-weight:bold}div.wunderbaum span.wb-col{position:absolute;display:inline-block;height:20px;line-height:20px;padding:0 2px;border-right:1px solid #dedede;overflow:visible}div.wunderbaum span.wb-col:last-of-type{border-right:none}div.wunderbaum span.wb-col span.wb-col-title{width:100%;overflow:hidden;text-overflow:ellipsis}div.wunderbaum span.wb-col span.wb-col-resizer{position:absolute;top:0;right:-1px;width:3px;border:none;border-right:2px solid #56534c;height:100%;cursor:col-resize}div.wunderbaum span.wb-node{user-select:none}div.wunderbaum i.wb-checkbox,div.wunderbaum i.wb-expander,div.wunderbaum i.wb-icon,div.wunderbaum i.wb-indent{height:20px;width:20px;padding:2px 2px;display:inline-block}div.wunderbaum i.bi::before{vertical-align:baseline}div.wunderbaum img.wb-icon{width:16px;height:16px;padding:2px 2px}div.wunderbaum i.wb-indent::before{content:"\00a0"}div.wunderbaum i.wb-expander.wb-spin,div.wunderbaum i.wb-icon.wb-spin{height:unset;width:unset;padding:0 3px;animation:wb-spin-animation 2s linear infinite}div.wunderbaum span.wb-title{min-width:1em;display:inline-block;vertical-align:top;overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}div.wunderbaum.wb-grid div.wb-header div.wb-row span.wb-col:hover{background-color:#c5c5c5}div.wunderbaum.wb-grid.wb-cell-mode div.wb-header div.wb-row span.wb-col.wb-active{background-color:#dceff8}div.wunderbaum.wb-grid div.wb-node-list div.wb-row{border-bottom-color:#dedede}div.wunderbaum.wb-grid div.wb-node-list div.wb-row:hover:not(.wb-active):not(.wb-selected){background-color:#f7fcfe}div.wunderbaum.wb-grid div.wb-node-list div.wb-row.wb-active{border-bottom-color:#70c0e7}div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col{border-right:1px solid #dedede}div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col input.wb-input-edit,div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=color],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=date],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=datetime],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=datetime-local],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=email],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=month],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=number],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=password],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=search],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=tel],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=text],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=time],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=url],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=week],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>select{width:100%}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row{background-color:#fcfcfc}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row span.wb-col.wb-active{background-color:#f7fcfe}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row.wb-active{background-color:#f7fcfe}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row.wb-active span.wb-col.wb-active{background-color:#26a0da}div.wunderbaum.wb-grid.wb-cell-mode.wb-cell-edit-mode div.wb-row.wb-active span.wb-col.wb-active{background-color:#b5373b}div.wunderbaum.wb-grid.wb-alternate div.wb-node-list div.wb-row:nth-of-type(even):not(.wb-active):not(.wb-selected){background-color:#fcfcfc}div.wunderbaum.wb-grid.wb-alternate div.wb-node-list div.wb-row:nth-of-type(even):not(.wb-active):not(.wb-selected):hover{background-color:#f7fcfe}div.wunderbaum.wb-grid:not(:focus-within) div.wb-node-list div.wb-row,div.wunderbaum.wb-grid:not(:focus) div.wb-node-list div.wb-row{border-bottom-color:#dedede}div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row,div.wunderbaum.wb-ext-filter-hide div.wb-node-list div.wb-row{color:#dedede}div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row.wb-submatch,div.wunderbaum.wb-ext-filter-hide div.wb-node-list div.wb-row.wb-submatch{color:#868581}div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row.wb-match,div.wunderbaum.wb-ext-filter-hide div.wb-node-list div.wb-row.wb-match{color:#56534c}div.wunderbaum div.wb-row.wb-drag-source{opacity:0.5}div.wunderbaum div.wb-row.wb-drag-source .wb-node{background-color:#d3d2ce}div.wunderbaum div.wb-row.wb-drop-target{overflow:visible}div.wunderbaum div.wb-row.wb-drop-target .wb-node{background-color:#d4ecf8;overflow:visible}div.wunderbaum div.wb-row.wb-drop-target .wb-node .wb-icon{position:relative;overflow:visible}div.wunderbaum div.wb-row.wb-drop-target .wb-node .wb-icon::after{position:absolute;z-index:1000;content:url(../docs/assets/drop_marker_16x32.png);left:0;top:3px}div.wunderbaum div.wb-row.wb-drop-target.wb-drop-before .wb-node .wb-icon::after{content:url(../docs/assets/drop_marker_insert_16x64.png);left:0;top:-8px}div.wunderbaum div.wb-row.wb-drop-target.wb-drop-after .wb-node .wb-icon::after{content:url(../docs/assets/drop_marker_insert_16x64.png);left:0;top:14px}div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+1){background:#ffffe8}div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+2){background:#f0fff0}div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+3){background:#fff0ff}div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+4){background:#eafdfd}div.wunderbaum.wb-fade-expander i.wb-expander{transition:
|
|
5
|
+
*/div.wunderbaum{box-sizing:border-box;height:100%;margin:0;padding:0;font-family:Helvetica,sans-serif;font-size:14px;color:#56534c;border:1px solid #56534c;overflow:hidden}div.wunderbaum div.wb-scroll-container{position:relative;overflow:auto;min-height:4px}div.wunderbaum div.wb-row{position:absolute;width:100%;height:22px;line-height:22px;border:1px solid transparent}div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-active,div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-selected,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-active,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-selected{background-color:#f0f0f0;border-color:#acacac}div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-active:hover,div.wunderbaum:not(:focus-within) div.wb-node-list div.wb-row.wb-selected:hover,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-active:hover,div.wunderbaum:not(:focus) div.wb-node-list div.wb-row.wb-selected:hover{background-color:#eaeaea}div.wunderbaum div.wb-node-list div.wb-row:hover{background-color:#f7fcfe}div.wunderbaum div.wb-node-list div.wb-row.wb-active,div.wunderbaum div.wb-node-list div.wb-row.wb-selected{background-color:#e5f3fb}div.wunderbaum div.wb-node-list div.wb-row.wb-active:hover,div.wunderbaum div.wb-node-list div.wb-row.wb-selected:hover{background-color:#dceff8}div.wunderbaum div.wb-node-list div.wb-row.wb-focus:not(.wb-active){border-style:dotted;border-color:#70c0e7}div.wunderbaum div.wb-node-list div.wb-row.wb-active{border-style:solid;border-color:#70c0e7}div.wunderbaum div.wb-node-list div.wb-row.wb-active:hover{border-color:#26a0da}div.wunderbaum div.wb-node-list div.wb-row.wb-loading{font-style:italic}div.wunderbaum div.wb-node-list div.wb-row.wb-dirty,div.wunderbaum div.wb-node-list div.wb-row .wb-col.wb-dirty{font-style:italic;background:repeating-linear-gradient(45deg, #f7fcfe, #f7fcfe 5px, #dedede 5px, #dedede 10px);animation:wb-dirty-animation 2s linear infinite}div.wunderbaum div.wb-node-list div.wb-row.wb-error,div.wunderbaum div.wb-node-list div.wb-row.wb-status-error{color:#b5373b}div.wunderbaum div.wb-header{position:relative;height:22px;border-bottom:1px solid #56534c;padding:0;background-color:#dedede}div.wunderbaum div.wb-header span.wb-col{font-weight:bold}div.wunderbaum span.wb-col{position:absolute;display:inline-block;height:20px;line-height:20px;padding:0 2px;border-right:1px solid #dedede;overflow:visible}div.wunderbaum span.wb-col:last-of-type{border-right:none}div.wunderbaum span.wb-col span.wb-col-title{width:100%;overflow:hidden;text-overflow:ellipsis}div.wunderbaum span.wb-col span.wb-col-resizer{position:absolute;top:0;right:-1px;width:3px;border:none;border-right:2px solid #56534c;height:100%;cursor:col-resize}div.wunderbaum span.wb-node{user-select:none}div.wunderbaum i.wb-checkbox,div.wunderbaum i.wb-expander,div.wunderbaum i.wb-icon,div.wunderbaum i.wb-indent{height:20px;width:20px;padding:2px 2px;display:inline-block}div.wunderbaum i.bi::before{vertical-align:baseline}div.wunderbaum img.wb-icon{width:16px;height:16px;padding:2px 2px}div.wunderbaum i.wb-indent::before{content:"\00a0"}div.wunderbaum i.wb-expander.wb-spin,div.wunderbaum i.wb-icon.wb-spin{height:unset;width:unset;padding:0 3px;animation:wb-spin-animation 2s linear infinite}div.wunderbaum span.wb-title{min-width:1em;display:inline-block;vertical-align:top;overflow-x:hidden;white-space:nowrap;text-overflow:ellipsis}div.wunderbaum.wb-grid div.wb-header div.wb-row span.wb-col:hover{background-color:#c5c5c5}div.wunderbaum.wb-grid.wb-cell-mode div.wb-header div.wb-row span.wb-col.wb-active{background-color:#dceff8}div.wunderbaum.wb-grid div.wb-node-list div.wb-row{border-bottom-color:#dedede}div.wunderbaum.wb-grid div.wb-node-list div.wb-row:hover:not(.wb-active):not(.wb-selected){background-color:#f7fcfe}div.wunderbaum.wb-grid div.wb-node-list div.wb-row.wb-active{border-bottom-color:#70c0e7}div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col{border-right:1px solid #dedede}div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col input.wb-input-edit,div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=color],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=date],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=datetime],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=datetime-local],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=email],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=month],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=number],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=password],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=search],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=tel],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=text],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=time],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=url],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>input[type=week],div.wunderbaum.wb-grid div.wb-node-list div.wb-row span.wb-col>select{width:100%}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row{background-color:#fcfcfc}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row span.wb-col.wb-active{background-color:#f7fcfe}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row.wb-active{background-color:#f7fcfe}div.wunderbaum.wb-grid.wb-cell-mode div.wb-row.wb-active span.wb-col.wb-active{background-color:#26a0da}div.wunderbaum.wb-grid.wb-cell-mode.wb-cell-edit-mode div.wb-row.wb-active span.wb-col.wb-active{background-color:#b5373b}div.wunderbaum.wb-grid.wb-alternate div.wb-node-list div.wb-row:nth-of-type(even):not(.wb-active):not(.wb-selected){background-color:#fcfcfc}div.wunderbaum.wb-grid.wb-alternate div.wb-node-list div.wb-row:nth-of-type(even):not(.wb-active):not(.wb-selected):hover{background-color:#f7fcfe}div.wunderbaum.wb-grid:not(:focus-within) div.wb-node-list div.wb-row,div.wunderbaum.wb-grid:not(:focus) div.wb-node-list div.wb-row{border-bottom-color:#dedede}div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row,div.wunderbaum.wb-ext-filter-hide div.wb-node-list div.wb-row{color:#dedede}div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row.wb-submatch,div.wunderbaum.wb-ext-filter-hide div.wb-node-list div.wb-row.wb-submatch{color:#868581}div.wunderbaum.wb-ext-filter-dim div.wb-node-list div.wb-row.wb-match,div.wunderbaum.wb-ext-filter-hide div.wb-node-list div.wb-row.wb-match{color:#56534c}div.wunderbaum div.wb-row.wb-drag-source{opacity:0.5}div.wunderbaum div.wb-row.wb-drag-source .wb-node{background-color:#d3d2ce}div.wunderbaum div.wb-row.wb-drop-target{overflow:visible}div.wunderbaum div.wb-row.wb-drop-target .wb-node{background-color:#d4ecf8;overflow:visible}div.wunderbaum div.wb-row.wb-drop-target .wb-node .wb-icon{position:relative;overflow:visible}div.wunderbaum div.wb-row.wb-drop-target .wb-node .wb-icon::after{position:absolute;z-index:1000;content:url(../docs/assets/drop_marker_16x32.png);left:0;top:3px}div.wunderbaum div.wb-row.wb-drop-target.wb-drop-before .wb-node .wb-icon::after{content:url(../docs/assets/drop_marker_insert_16x64.png);left:0;top:-8px}div.wunderbaum div.wb-row.wb-drop-target.wb-drop-after .wb-node .wb-icon::after{content:url(../docs/assets/drop_marker_insert_16x64.png);left:0;top:14px}div.wunderbaum.wb-rainbow i.wb-expander:nth-child(4n+1),div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+1){background:#ffffe8}div.wunderbaum.wb-rainbow i.wb-expander:nth-child(4n+2),div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+2){background:#f0fff0}div.wunderbaum.wb-rainbow i.wb-expander:nth-child(4n+3),div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+3){background:#fff0ff}div.wunderbaum.wb-rainbow i.wb-expander:nth-child(4n+4),div.wunderbaum.wb-rainbow i.wb-indent:nth-child(4n+4){background:#eafdfd}div.wunderbaum.wb-fade-expander i.wb-expander{transition:color 1.5s;color:rgba(86,83,76,0)}div.wunderbaum.wb-fade-expander div.wb-row.wb-loading i.wb-expander,div.wunderbaum.wb-fade-expander:hover i.wb-expander,div.wunderbaum.wb-fade-expander:focus i.wb-expander,div.wunderbaum.wb-fade-expander:focus-within i.wb-expander,div.wunderbaum.wb-fade-expander [class*="wb-statusnode-"] i.wb-expander{transition:color 0.6s;color:#56534c}div.wunderbaum div.wb-row.wb-skeleton span.wb-title,div.wunderbaum div.wb-row.wb-skeleton i.wb-icon{animation:wb-skeleton-animation 1s linear infinite alternate;border-radius:0.25em;color:transparent;opacity:0.7}div.wunderbaum.wb-checkbox-auto-hide i.wb-checkbox{visibility:hidden}div.wunderbaum.wb-checkbox-auto-hide .wb-row:hover i.wb-checkbox,div.wunderbaum.wb-checkbox-auto-hide .wb-row.wb-selected i.wb-checkbox{visibility:unset}div.wunderbaum.wb-checkbox-auto-hide:focus .wb-row.wb-active i.wb-checkbox,div.wunderbaum.wb-checkbox-auto-hide:focus-within .wb-row.wb-active i.wb-checkbox{visibility:unset}.wb-helper-center{text-align:center}.wb-helper-disabled{color:#8c877c}.wb-helper-hidden{display:none}.wb-helper-invalid{color:#b5373b}.wb-helper-lazy-expander{color:#26a0da}.wb-helper-link{cursor:pointer}.wb-helper-start{text-align:left}.wb-helper-end{text-align:right}.wb-rtl .wb-helper-start{text-align:right}.wb-rtl .wb-helper-end{text-align:left}.wb-col input[type="checkbox"]:indeterminate{color:#8c877c;background-color:red}.wb-col input:invalid{color:#b5373b;background-color:#f5ddde}@keyframes wb-spin-animation{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes wb-skeleton-animation{0%{background-color:#a3b8c2}100%{background-color:#f0f3f5}}@keyframes wb-dirty-animation{0%{background-position:0 0}100%{background-position:-70px 0}}
|
package/dist/wunderbaum.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare module "util" {
|
|
|
4
4
|
* Copyright (c) 2021-2022, Martin Wendt. Released under the MIT license.
|
|
5
5
|
* @VERSION, @DATE (https://github.com/mar10/wunderbaum)
|
|
6
6
|
*/
|
|
7
|
+
/** @module util */
|
|
7
8
|
/** Readable names for `MouseEvent.button` */
|
|
8
9
|
export const MOUSE_BUTTONS: {
|
|
9
10
|
[key: number]: string;
|
|
@@ -618,27 +619,47 @@ declare module "wb_node" {
|
|
|
618
619
|
*/
|
|
619
620
|
import "./wunderbaum.scss";
|
|
620
621
|
import { Wunderbaum } from "wunderbaum";
|
|
621
|
-
import { ChangeType, MatcherType, NodeAnyCallback, NodeStatusType, NodeVisitCallback, NodeVisitResponse, ApplyCommandType, AddNodeType } from "common";
|
|
622
|
+
import { ChangeType, MatcherType, NodeAnyCallback, NodeStatusType, NodeVisitCallback, NodeVisitResponse, ApplyCommandType, AddNodeType, SetActiveOptions, SetExpandedOptions, SetSelectedOptions } from "common";
|
|
622
623
|
import { WbNodeData } from "wb_options";
|
|
624
|
+
/**
|
|
625
|
+
* A single tree node.
|
|
626
|
+
*
|
|
627
|
+
* **NOTE:** <br>
|
|
628
|
+
* Generally you should not modify properties directly, since this may break
|
|
629
|
+
* the internal bookkeeping.
|
|
630
|
+
*/
|
|
623
631
|
export class WunderbaumNode {
|
|
624
632
|
static sequence: number;
|
|
625
633
|
/** Reference to owning tree. */
|
|
626
634
|
tree: Wunderbaum;
|
|
627
635
|
/** Parent node (null for the invisible root node `tree.root`). */
|
|
628
636
|
parent: WunderbaumNode;
|
|
637
|
+
/** Name of the node.
|
|
638
|
+
* @see Use {@link setTitle} to modify. */
|
|
629
639
|
title: string;
|
|
640
|
+
/** Unique key. Passed with constructor or defaults to `SEQUENCE`.
|
|
641
|
+
* @see Use {@link setKey} to modify. */
|
|
630
642
|
readonly key: string;
|
|
643
|
+
/** Reference key. Unlike {@link key}, a `refKey` may occur multiple
|
|
644
|
+
* times within a tree (in this case we have 'clone nodes').
|
|
645
|
+
* @see Use {@link setKey} to modify.
|
|
646
|
+
*/
|
|
631
647
|
readonly refKey: string | undefined;
|
|
632
648
|
children: WunderbaumNode[] | null;
|
|
633
649
|
checkbox?: boolean;
|
|
634
650
|
colspan?: boolean;
|
|
635
651
|
icon?: boolean | string;
|
|
636
652
|
lazy: boolean;
|
|
653
|
+
/** Expansion state.
|
|
654
|
+
* @see {@link isExpandable}, {@link isExpanded}, {@link setExpanded}. */
|
|
637
655
|
expanded: boolean;
|
|
656
|
+
/** Selection state.
|
|
657
|
+
* @see {@link isSelected}, {@link setSelected}. */
|
|
638
658
|
selected: boolean;
|
|
639
659
|
type?: string;
|
|
640
660
|
tooltip?: string;
|
|
641
|
-
/** Additional classes added to `div.wb-row`.
|
|
661
|
+
/** Additional classes added to `div.wb-row`.
|
|
662
|
+
* @see {@link addClass}, {@link removeClass}, {@link toggleClass}. */
|
|
642
663
|
extraClasses: Set<string>;
|
|
643
664
|
/** Custom data that was passed to the constructor */
|
|
644
665
|
data: any;
|
|
@@ -651,6 +672,7 @@ declare module "wb_node" {
|
|
|
651
672
|
match?: boolean;
|
|
652
673
|
subMatchCount?: number;
|
|
653
674
|
subMatchBadge?: HTMLElement;
|
|
675
|
+
/** @internal */
|
|
654
676
|
titleWithHighlight?: string;
|
|
655
677
|
_filterAutoExpanded?: boolean;
|
|
656
678
|
_rowIdx: number | undefined;
|
|
@@ -690,7 +712,8 @@ declare module "wb_node" {
|
|
|
690
712
|
addNode(nodeData: WbNodeData, mode?: string): WunderbaumNode;
|
|
691
713
|
/**
|
|
692
714
|
* Apply a modification (or navigation) operation.
|
|
693
|
-
*
|
|
715
|
+
*
|
|
716
|
+
* @see {@link Wunderbaum.applyCommand}
|
|
694
717
|
*/
|
|
695
718
|
applyCommand(cmd: ApplyCommandType, opts: any): any;
|
|
696
719
|
addClass(className: string | string[] | Set<string>): void;
|
|
@@ -714,8 +737,7 @@ declare module "wb_node" {
|
|
|
714
737
|
findFirst(match: string | MatcherType): WunderbaumNode | null;
|
|
715
738
|
/** Find a node relative to self.
|
|
716
739
|
*
|
|
717
|
-
* @
|
|
718
|
-
* or a keyword ('down', 'first', 'last', 'left', 'parent', 'right', 'up').
|
|
740
|
+
* @see {@link Wunderbaum.findRelatedNode|tree.findRelatedNode()}
|
|
719
741
|
*/
|
|
720
742
|
findRelatedNode(where: string, includeHidden?: boolean): any;
|
|
721
743
|
/** Return the `<span class='wb-col'>` element with a given index or id.
|
|
@@ -876,26 +898,45 @@ declare module "wb_node" {
|
|
|
876
898
|
*
|
|
877
899
|
* Evaluation sequence:
|
|
878
900
|
*
|
|
879
|
-
* If `tree.options.<name>` is a callback that returns something, use that.
|
|
880
|
-
* Else if `node.<name>` is defined, use that.
|
|
881
|
-
* Else if `tree.types[<node.type>]` is a value, use that.
|
|
882
|
-
* Else if `tree.options.<name>` is a value, use that.
|
|
883
|
-
* Else use `defaultValue`.
|
|
901
|
+
* - If `tree.options.<name>` is a callback that returns something, use that.
|
|
902
|
+
* - Else if `node.<name>` is defined, use that.
|
|
903
|
+
* - Else if `tree.types[<node.type>]` is a value, use that.
|
|
904
|
+
* - Else if `tree.options.<name>` is a value, use that.
|
|
905
|
+
* - Else use `defaultValue`.
|
|
884
906
|
*
|
|
885
907
|
* @param name name of the option property (on node and tree)
|
|
886
908
|
* @param defaultValue return this if nothing else matched
|
|
909
|
+
* {@link Wunderbaum.getOption|Wunderbaum.getOption()}
|
|
887
910
|
*/
|
|
888
911
|
getOption(name: string, defaultValue?: any): any;
|
|
912
|
+
/** Make sure that this node is visible in the viewport.
|
|
913
|
+
* @see {@link Wunderbaum.scrollTo|Wunderbaum.scrollTo()}
|
|
914
|
+
*/
|
|
889
915
|
scrollIntoView(options?: any): Promise<void>;
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
setExpanded(flag?: boolean, options?: any): Promise<void>;
|
|
893
|
-
setIcon(): void;
|
|
894
|
-
setFocus(flag?: boolean, options?: any): void;
|
|
895
|
-
setSelected(flag?: boolean, options?: any): void;
|
|
896
|
-
/** Show node status (ok, loading, error, noData) using styles and a dummy child node.
|
|
916
|
+
/**
|
|
917
|
+
* Activate this node, deactivate previous, send events, activate column and scroll int viewport.
|
|
897
918
|
*/
|
|
919
|
+
setActive(flag?: boolean, options?: SetActiveOptions): Promise<void>;
|
|
920
|
+
/**
|
|
921
|
+
* Expand or collapse this node.
|
|
922
|
+
*/
|
|
923
|
+
setExpanded(flag?: boolean, options?: SetExpandedOptions): Promise<void>;
|
|
924
|
+
/**
|
|
925
|
+
* Set keyboard focus here.
|
|
926
|
+
* @see {@link setActive}
|
|
927
|
+
*/
|
|
928
|
+
setFocus(flag?: boolean, options?: any): void;
|
|
929
|
+
/** Set a new icon path or class. */
|
|
930
|
+
setIcon(): void;
|
|
931
|
+
/** Change node's {@link key} and/or {@link refKey}. */
|
|
932
|
+
setKey(key: string | null, refKey: string | null): void;
|
|
933
|
+
/** Schedule a render, typically called to update after a status or data change. */
|
|
934
|
+
setModified(change?: ChangeType): void;
|
|
935
|
+
/** Modify the check/uncheck state. */
|
|
936
|
+
setSelected(flag?: boolean, options?: SetSelectedOptions): void;
|
|
937
|
+
/** Display node status (ok, loading, error, noData) using styles and a dummy child node. */
|
|
898
938
|
setStatus(status: NodeStatusType, message?: string, details?: string): WunderbaumNode | null;
|
|
939
|
+
/** Rename this node. */
|
|
899
940
|
setTitle(title: string): void;
|
|
900
941
|
/**
|
|
901
942
|
* Trigger `modifyChild` event on a parent to signal that a child was modified.
|
|
@@ -907,9 +948,12 @@ declare module "wb_node" {
|
|
|
907
948
|
* @param {string} operation Type of change: 'add', 'remove', 'rename', 'move', 'data', ...
|
|
908
949
|
* @param {object} [extra]
|
|
909
950
|
*/
|
|
910
|
-
triggerModify(operation: string, extra
|
|
911
|
-
/**
|
|
912
|
-
*
|
|
951
|
+
triggerModify(operation: string, extra?: any): void;
|
|
952
|
+
/**
|
|
953
|
+
* Call fn(node) for all child nodes in hierarchical order (depth-first).
|
|
954
|
+
*
|
|
955
|
+
* Stop iteration, if fn() returns false. Skip current branch, if fn()
|
|
956
|
+
* returns "skip".<br>
|
|
913
957
|
* Return false if iteration was stopped.
|
|
914
958
|
*
|
|
915
959
|
* @param {function} callback the callback function.
|
|
@@ -924,7 +968,8 @@ declare module "wb_node" {
|
|
|
924
968
|
* @param callback the callback function. Return false to stop iteration
|
|
925
969
|
*/
|
|
926
970
|
visitParents(callback: (node: WunderbaumNode) => boolean | void, includeSelf?: boolean): boolean;
|
|
927
|
-
/**
|
|
971
|
+
/**
|
|
972
|
+
* Call fn(node) for all sibling nodes.<br>
|
|
928
973
|
* Stop iteration, if fn() returns false.<br>
|
|
929
974
|
* Return false if iteration was stopped.
|
|
930
975
|
*
|
|
@@ -1023,6 +1068,32 @@ declare module "common" {
|
|
|
1023
1068
|
cellNav = "cellNav",
|
|
1024
1069
|
cellEdit = "cellEdit"
|
|
1025
1070
|
}
|
|
1071
|
+
export type SetActiveOptions = {
|
|
1072
|
+
/** Generate (de)activate event, even if node already has this status. */
|
|
1073
|
+
retrigger?: boolean;
|
|
1074
|
+
/** Don not generate (de)activate event. */
|
|
1075
|
+
noEvents?: boolean;
|
|
1076
|
+
/** Optional original event that will be passed to the (de)activat handler. */
|
|
1077
|
+
event?: Event;
|
|
1078
|
+
/** Call {@link setColumn}. */
|
|
1079
|
+
colIdx?: number;
|
|
1080
|
+
};
|
|
1081
|
+
export type SetExpandedOptions = {
|
|
1082
|
+
/** Ignore {@link minExpandLevel}. @default false */
|
|
1083
|
+
force?: boolean;
|
|
1084
|
+
/** Avoid smooth scrolling. @default false */
|
|
1085
|
+
noAnimation?: boolean;
|
|
1086
|
+
/** Do not send events. @default false */
|
|
1087
|
+
noEvents?: boolean;
|
|
1088
|
+
/** Scroll to bring expanded nodes into viewport. @default false */
|
|
1089
|
+
scrollIntoView?: boolean;
|
|
1090
|
+
};
|
|
1091
|
+
export type SetSelectedOptions = {
|
|
1092
|
+
/** Ignore restrictions. @default false */
|
|
1093
|
+
force?: boolean;
|
|
1094
|
+
/** Do not send events. @default false */
|
|
1095
|
+
noEvents?: boolean;
|
|
1096
|
+
};
|
|
1026
1097
|
/** Define which keys are handled by embedded <input> control, and should
|
|
1027
1098
|
* *not* be passed to tree navigation handler in cell-edit mode: */
|
|
1028
1099
|
export const INPUT_KEYS: {
|
|
@@ -1364,68 +1435,79 @@ declare module "wunderbaum" {
|
|
|
1364
1435
|
* See also [[WunderbaumOptions]].
|
|
1365
1436
|
*/
|
|
1366
1437
|
export class Wunderbaum {
|
|
1438
|
+
protected static sequence: number;
|
|
1439
|
+
/** Wunderbaum release version number "MAJOR.MINOR.PATCH". */
|
|
1367
1440
|
static version: string;
|
|
1368
|
-
static sequence: number;
|
|
1369
1441
|
/** The invisible root node, that holds all visible top level nodes. */
|
|
1370
1442
|
readonly root: WunderbaumNode;
|
|
1443
|
+
/** Unique tree ID as passed to constructor. Defaults to `"wb_SEQUENCE"`. */
|
|
1371
1444
|
readonly id: string;
|
|
1445
|
+
/** The `div` container element that was passed to the constructor. */
|
|
1372
1446
|
readonly element: HTMLDivElement;
|
|
1447
|
+
/** The `div.wb-header` element if any. */
|
|
1373
1448
|
readonly headerElement: HTMLDivElement | null;
|
|
1449
|
+
/** The `div.wb-scroll-container` element that contains the `nodeListElement`. */
|
|
1374
1450
|
readonly scrollContainer: HTMLDivElement;
|
|
1451
|
+
/** The `div.wb-node-list` element that contains all visible div.wb-row child elements. */
|
|
1375
1452
|
readonly nodeListElement: HTMLDivElement;
|
|
1376
|
-
readonly _updateViewportThrottled: DebouncedFunction<(...args: any) => void>;
|
|
1453
|
+
protected readonly _updateViewportThrottled: DebouncedFunction<(...args: any) => void>;
|
|
1377
1454
|
protected extensionList: WunderbaumExtension[];
|
|
1378
1455
|
protected extensions: ExtensionsDict;
|
|
1379
1456
|
/** Merged options from constructor args and tree- and extension defaults. */
|
|
1380
1457
|
options: WunderbaumOptions;
|
|
1381
1458
|
protected keyMap: Map<string, WunderbaumNode>;
|
|
1382
1459
|
protected refKeyMap: Map<string, Set<WunderbaumNode>>;
|
|
1383
|
-
protected
|
|
1460
|
+
protected treeRowCount: number;
|
|
1461
|
+
protected _disableUpdateCount: number;
|
|
1462
|
+
/** Currently active node if any. */
|
|
1384
1463
|
activeNode: WunderbaumNode | null;
|
|
1464
|
+
/** Current node hat has keyboard focus if any. */
|
|
1385
1465
|
focusNode: WunderbaumNode | null;
|
|
1386
|
-
_disableUpdate: number;
|
|
1387
|
-
_disableUpdateCount: number;
|
|
1388
1466
|
/** Shared properties, referenced by `node.type`. */
|
|
1389
1467
|
types: {
|
|
1390
1468
|
[key: string]: any;
|
|
1391
1469
|
};
|
|
1392
1470
|
/** List of column definitions. */
|
|
1393
1471
|
columns: any[];
|
|
1394
|
-
_columnsById: {
|
|
1472
|
+
protected _columnsById: {
|
|
1395
1473
|
[key: string]: any;
|
|
1396
1474
|
};
|
|
1397
|
-
protected resizeObserver:
|
|
1398
|
-
protected
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1475
|
+
protected resizeObserver: ResizeObserver;
|
|
1476
|
+
protected changeRedrawRequestPending: boolean;
|
|
1477
|
+
/** A Promise that is resolved when the tree was initialized (similar to `init(e)` event). */
|
|
1478
|
+
readonly ready: Promise<any>;
|
|
1479
|
+
/** Expose some useful methods of the util.ts module as `Wunderbaum.util`. */
|
|
1480
|
+
static util: typeof util;
|
|
1481
|
+
/** Expose some useful methods of the util.ts module as `tree._util`. */
|
|
1482
|
+
_util: typeof util;
|
|
1402
1483
|
filterMode: FilterModeType;
|
|
1484
|
+
/** @internal Use `setColumn()`/`getActiveColElem()`*/
|
|
1403
1485
|
activeColIdx: number;
|
|
1486
|
+
/** @internal */
|
|
1404
1487
|
navMode: NavigationMode;
|
|
1488
|
+
/** @internal */
|
|
1405
1489
|
lastQuicksearchTime: number;
|
|
1490
|
+
/** @internal */
|
|
1406
1491
|
lastQuicksearchTerm: string;
|
|
1407
1492
|
protected lastClickTime: number;
|
|
1408
|
-
readonly ready: Promise<any>;
|
|
1409
|
-
static util: typeof util;
|
|
1410
|
-
_util: typeof util;
|
|
1411
1493
|
constructor(options: WunderbaumOptions);
|
|
1412
|
-
/**
|
|
1413
|
-
|
|
1494
|
+
/**
|
|
1495
|
+
* Return a Wunderbaum instance, from element, id, index, or event.
|
|
1414
1496
|
*
|
|
1415
|
-
*
|
|
1416
|
-
* getTree();
|
|
1417
|
-
* getTree(1);
|
|
1418
|
-
* getTree(event);
|
|
1419
|
-
* getTree("foo");
|
|
1497
|
+
* ```js
|
|
1498
|
+
* getTree(); // Get first Wunderbaum instance on page
|
|
1499
|
+
* getTree(1); // Get second Wunderbaum instance on page
|
|
1500
|
+
* getTree(event); // Get tree for this mouse- or keyboard event
|
|
1501
|
+
* getTree("foo"); // Get tree for this `tree.options.id`
|
|
1420
1502
|
* getTree("#tree"); // Get tree for this matching element
|
|
1503
|
+
* ```
|
|
1421
1504
|
*/
|
|
1422
1505
|
static getTree(el?: Element | Event | number | string | WunderbaumNode): Wunderbaum | null;
|
|
1423
|
-
/**
|
|
1424
|
-
*
|
|
1425
|
-
* @param el
|
|
1506
|
+
/**
|
|
1507
|
+
* Return a WunderbaumNode instance from element or event.
|
|
1426
1508
|
*/
|
|
1427
1509
|
static getNode(el: Element | Event): WunderbaumNode | null;
|
|
1428
|
-
/** */
|
|
1510
|
+
/** @internal */
|
|
1429
1511
|
protected _registerExtension(extension: WunderbaumExtension): void;
|
|
1430
1512
|
/** Called on tree (re)init after markup is created, before loading. */
|
|
1431
1513
|
protected _initExtensions(): void;
|
|
@@ -1435,37 +1517,47 @@ declare module "wunderbaum" {
|
|
|
1435
1517
|
_unregisterNode(node: WunderbaumNode): void;
|
|
1436
1518
|
/** Call all hook methods of all registered extensions.*/
|
|
1437
1519
|
protected _callHook(hook: keyof WunderbaumExtension, data?: any): any;
|
|
1438
|
-
/**
|
|
1520
|
+
/**
|
|
1521
|
+
* Call tree method or extension method if defined.
|
|
1522
|
+
*
|
|
1439
1523
|
* Example:
|
|
1440
1524
|
* ```js
|
|
1441
1525
|
* tree._callMethod("edit.startEdit", "arg1", "arg2")
|
|
1442
1526
|
* ```
|
|
1443
1527
|
*/
|
|
1444
1528
|
_callMethod(name: string, ...args: any[]): any;
|
|
1445
|
-
/**
|
|
1529
|
+
/**
|
|
1530
|
+
* Call event handler if defined in tree or tree.EXTENSION options.
|
|
1531
|
+
*
|
|
1446
1532
|
* Example:
|
|
1447
1533
|
* ```js
|
|
1448
1534
|
* tree._callEvent("edit.beforeEdit", {foo: 42})
|
|
1449
1535
|
* ```
|
|
1450
1536
|
*/
|
|
1451
1537
|
_callEvent(name: string, extra?: any): any;
|
|
1452
|
-
/** Return the
|
|
1538
|
+
/** Return the node for given row index. */
|
|
1539
|
+
protected _getNodeByRowIdx(idx: number): WunderbaumNode | null;
|
|
1540
|
+
/** Return the topmost visible node in the viewport. */
|
|
1453
1541
|
protected _firstNodeInView(complete?: boolean): WunderbaumNode;
|
|
1454
|
-
/** Return the lowest visible node in the viewport */
|
|
1542
|
+
/** Return the lowest visible node in the viewport. */
|
|
1455
1543
|
protected _lastNodeInView(complete?: boolean): WunderbaumNode;
|
|
1456
|
-
/** Return preceeding visible node in the viewport */
|
|
1544
|
+
/** Return preceeding visible node in the viewport. */
|
|
1457
1545
|
protected _getPrevNodeInView(node?: WunderbaumNode, ofs?: number): WunderbaumNode;
|
|
1458
|
-
/** Return following visible node in the viewport */
|
|
1546
|
+
/** Return following visible node in the viewport. */
|
|
1459
1547
|
protected _getNextNodeInView(node?: WunderbaumNode, ofs?: number): WunderbaumNode;
|
|
1548
|
+
/**
|
|
1549
|
+
* Append (or insert) a list of toplevel nodes.
|
|
1550
|
+
*
|
|
1551
|
+
* @see {@link WunderbaumNode.addChildren}
|
|
1552
|
+
*/
|
|
1460
1553
|
addChildren(nodeData: any, options?: any): WunderbaumNode;
|
|
1461
1554
|
/**
|
|
1462
|
-
* Apply a modification (or navigation) operation on the tree or active node
|
|
1463
|
-
* @returns
|
|
1555
|
+
* Apply a modification (or navigation) operation on the **tree or active node**.
|
|
1464
1556
|
*/
|
|
1465
1557
|
applyCommand(cmd: ApplyCommandType, opts?: any): any;
|
|
1466
1558
|
/**
|
|
1467
|
-
* Apply a modification (or navigation) operation on a node
|
|
1468
|
-
* @
|
|
1559
|
+
* Apply a modification (or navigation) operation on a **node**.
|
|
1560
|
+
* @see {@link WunderbaumNode.applyCommand}
|
|
1469
1561
|
*/
|
|
1470
1562
|
applyCommand(cmd: ApplyCommandType, node: WunderbaumNode, opts?: any): any;
|
|
1471
1563
|
/** Delete all nodes. */
|
|
@@ -1481,10 +1573,11 @@ declare module "wunderbaum" {
|
|
|
1481
1573
|
/**
|
|
1482
1574
|
* Return `tree.option.NAME` (also resolving if this is a callback).
|
|
1483
1575
|
*
|
|
1484
|
-
* See also
|
|
1485
|
-
* `tree.types[node.type].NAME`.
|
|
1576
|
+
* See also {@link WunderbaumNode.getOption|WunderbaumNode.getOption()}
|
|
1577
|
+
* to consider `node.NAME` setting and `tree.types[node.type].NAME`.
|
|
1486
1578
|
*
|
|
1487
|
-
* @param name option name (use dot notation to access extension option, e.g.
|
|
1579
|
+
* @param name option name (use dot notation to access extension option, e.g.
|
|
1580
|
+
* `filter.mode`)
|
|
1488
1581
|
*/
|
|
1489
1582
|
getOption(name: string, defaultValue?: any): any;
|
|
1490
1583
|
/**
|
|
@@ -1501,26 +1594,33 @@ declare module "wunderbaum" {
|
|
|
1501
1594
|
expandAll(flag?: boolean): Promise<void>;
|
|
1502
1595
|
/** Return the number of nodes in the data model.*/
|
|
1503
1596
|
count(visible?: boolean): number;
|
|
1597
|
+
/** @internal sanity check. */
|
|
1504
1598
|
_check(): void;
|
|
1505
|
-
/**
|
|
1599
|
+
/**
|
|
1600
|
+
* Find all nodes that matches condition.
|
|
1506
1601
|
*
|
|
1507
1602
|
* @param match title string to search for, or a
|
|
1508
1603
|
* callback function that returns `true` if a node is matched.
|
|
1509
|
-
*
|
|
1604
|
+
*
|
|
1605
|
+
* @see {@link WunderbaumNode.findAll}
|
|
1510
1606
|
*/
|
|
1511
1607
|
findAll(match: string | MatcherType): WunderbaumNode[];
|
|
1512
|
-
/**
|
|
1608
|
+
/**
|
|
1609
|
+
* Find first node that matches condition.
|
|
1513
1610
|
*
|
|
1514
1611
|
* @param match title string to search for, or a
|
|
1515
1612
|
* callback function that returns `true` if a node is matched.
|
|
1516
|
-
* @see
|
|
1613
|
+
* @see {@link WunderbaumNode.findFirst}
|
|
1614
|
+
*
|
|
1517
1615
|
*/
|
|
1518
1616
|
findFirst(match: string | MatcherType): WunderbaumNode;
|
|
1519
|
-
/**
|
|
1617
|
+
/**
|
|
1618
|
+
* Find the next visible node that starts with `match`, starting at `startNode`
|
|
1520
1619
|
* and wrap-around at the end.
|
|
1521
1620
|
*/
|
|
1522
1621
|
findNextNode(match: string | MatcherType, startNode?: WunderbaumNode | null): WunderbaumNode | null;
|
|
1523
|
-
/**
|
|
1622
|
+
/**
|
|
1623
|
+
* Find a node relative to another node.
|
|
1524
1624
|
*
|
|
1525
1625
|
* @param node
|
|
1526
1626
|
* @param where 'down', 'first', 'last', 'left', 'parent', 'right', or 'up'.
|
|
@@ -1530,7 +1630,7 @@ declare module "wunderbaum" {
|
|
|
1530
1630
|
*/
|
|
1531
1631
|
findRelatedNode(node: WunderbaumNode, where: string, includeHidden?: boolean): any;
|
|
1532
1632
|
/**
|
|
1533
|
-
* Return the active cell of the currently active node or null.
|
|
1633
|
+
* Return the active cell (`span.wb-col`) of the currently active node or null.
|
|
1534
1634
|
*/
|
|
1535
1635
|
getActiveColElem(): HTMLSpanElement;
|
|
1536
1636
|
/**
|
|
@@ -1567,15 +1667,19 @@ declare module "wunderbaum" {
|
|
|
1567
1667
|
toString(): string;
|
|
1568
1668
|
/** Return true if any node is currently in edit-title mode. */
|
|
1569
1669
|
isEditing(): boolean;
|
|
1570
|
-
/**
|
|
1670
|
+
/**
|
|
1671
|
+
* Return true if any node is currently beeing loaded, i.e. a Ajax request is pending.
|
|
1571
1672
|
*/
|
|
1572
1673
|
isLoading(): boolean;
|
|
1573
|
-
/** Alias for
|
|
1674
|
+
/** Alias for {@link Wunderbaum.logDebug}.
|
|
1675
|
+
* @alias Wunderbaum.logDebug
|
|
1676
|
+
*/
|
|
1574
1677
|
log: (...args: any[]) => void;
|
|
1575
1678
|
/** Log to console if opts.debugLevel >= 4 */
|
|
1576
1679
|
logDebug(...args: any[]): void;
|
|
1577
1680
|
/** Log error to console. */
|
|
1578
1681
|
logError(...args: any[]): void;
|
|
1682
|
+
/** Log to console if opts.debugLevel >= 3 */
|
|
1579
1683
|
logInfo(...args: any[]): void;
|
|
1580
1684
|
/** @internal */
|
|
1581
1685
|
logTime(label: string): string;
|
|
@@ -1583,10 +1687,6 @@ declare module "wunderbaum" {
|
|
|
1583
1687
|
logTimeEnd(label: string): void;
|
|
1584
1688
|
/** Log to console if opts.debugLevel >= 2 */
|
|
1585
1689
|
logWarn(...args: any[]): void;
|
|
1586
|
-
/** */
|
|
1587
|
-
protected render(opts?: any): boolean;
|
|
1588
|
-
/**Recalc and apply header columns from `this.columns`. */
|
|
1589
|
-
renderHeader(): void;
|
|
1590
1690
|
/**
|
|
1591
1691
|
* Make sure that this node is scrolled into the viewport.
|
|
1592
1692
|
*
|
|
@@ -1596,30 +1696,60 @@ declare module "wunderbaum" {
|
|
|
1596
1696
|
* any case, even if `this` is outside the scroll pane.
|
|
1597
1697
|
*/
|
|
1598
1698
|
scrollTo(opts: any): void;
|
|
1599
|
-
/**
|
|
1600
|
-
|
|
1601
|
-
|
|
1699
|
+
/**
|
|
1700
|
+
* Set column #colIdx to 'active'.
|
|
1701
|
+
*
|
|
1702
|
+
* This higlights the column header and -cells by adding the `wb-active` class.
|
|
1703
|
+
* Available in cell-nav and cell-edit mode, not in row-mode.
|
|
1704
|
+
*/
|
|
1602
1705
|
setColumn(colIdx: number): void;
|
|
1603
|
-
/** */
|
|
1706
|
+
/** Set or remove keybaord focus to the tree container. */
|
|
1604
1707
|
setFocus(flag?: boolean): void;
|
|
1605
|
-
/** */
|
|
1708
|
+
/** Schedule an update request to reflect a tree change. */
|
|
1606
1709
|
setModified(change: ChangeType, options?: any): void;
|
|
1607
|
-
/** */
|
|
1710
|
+
/** Schedule an update request to reflect a single node modification. */
|
|
1608
1711
|
setModified(change: ChangeType, node: WunderbaumNode, options?: any): void;
|
|
1712
|
+
/** Set the tree's navigation mode. */
|
|
1713
|
+
setNavigationMode(mode: NavigationMode): void;
|
|
1714
|
+
/** Display tree status (ok, loading, error, noData) using styles and a dummy root node. */
|
|
1609
1715
|
setStatus(status: NodeStatusType, message?: string, details?: string): WunderbaumNode | null;
|
|
1610
1716
|
/** Update column headers and width. */
|
|
1611
|
-
updateColumns(opts
|
|
1612
|
-
/**
|
|
1717
|
+
updateColumns(opts?: any): void;
|
|
1718
|
+
/** Create/update header markup from `this.columns` definition.
|
|
1719
|
+
* @internal
|
|
1720
|
+
*/
|
|
1721
|
+
protected _renderHeaderMarkup(): void;
|
|
1722
|
+
/** Render header and all rows that are visible in the viewport (async, throttled). */
|
|
1613
1723
|
updateViewport(immediate?: boolean): void;
|
|
1724
|
+
/**
|
|
1725
|
+
* This is the actual update method, which is wrapped inside a throttle method.
|
|
1726
|
+
* This protected method should not be called directly but via
|
|
1727
|
+
* `tree.updateViewport()` or `tree.setModified()`.
|
|
1728
|
+
* It calls `updateColumns()` and `_updateRows()`.
|
|
1729
|
+
* @internal
|
|
1730
|
+
*/
|
|
1614
1731
|
protected _updateViewport(): void;
|
|
1615
|
-
/**
|
|
1732
|
+
/**
|
|
1733
|
+
* Assert that TR order matches the natural node order
|
|
1734
|
+
* @internal
|
|
1735
|
+
*/
|
|
1736
|
+
protected _validateRows(): boolean;
|
|
1737
|
+
protected _updateRows(opts?: any): boolean;
|
|
1738
|
+
/**
|
|
1739
|
+
* Call callback(node) for all nodes in hierarchical order (depth-first).
|
|
1616
1740
|
*
|
|
1617
1741
|
* @param {function} callback the callback function.
|
|
1618
|
-
* Return false to stop iteration, return "skip" to skip this node and
|
|
1742
|
+
* Return false to stop iteration, return "skip" to skip this node and
|
|
1743
|
+
* children only.
|
|
1619
1744
|
* @returns {boolean} false, if the iterator was stopped.
|
|
1620
1745
|
*/
|
|
1621
1746
|
visit(callback: (node: WunderbaumNode) => any): import("common").NodeVisitResponse;
|
|
1622
|
-
/**
|
|
1747
|
+
/**
|
|
1748
|
+
* Call fn(node) for all nodes in vertical order, top down (or bottom up).
|
|
1749
|
+
*
|
|
1750
|
+
* Note that this considers expansion state, i.e. children of collapsed nodes
|
|
1751
|
+
* are skipped.
|
|
1752
|
+
*
|
|
1623
1753
|
* Stop iteration, if fn() returns false.<br>
|
|
1624
1754
|
* Return false if iteration was stopped.
|
|
1625
1755
|
*
|
|
@@ -1631,14 +1761,32 @@ declare module "wunderbaum" {
|
|
|
1631
1761
|
* @returns {boolean} false if iteration was canceled
|
|
1632
1762
|
*/
|
|
1633
1763
|
visitRows(callback: (node: WunderbaumNode) => any, opts?: any): boolean;
|
|
1634
|
-
/**
|
|
1764
|
+
/**
|
|
1765
|
+
* Call fn(node) for all nodes in vertical order, bottom up.
|
|
1635
1766
|
* @internal
|
|
1636
1767
|
*/
|
|
1637
1768
|
protected _visitRowsUp(callback: (node: WunderbaumNode) => any, opts: any): boolean;
|
|
1638
|
-
/**
|
|
1769
|
+
/**
|
|
1770
|
+
* Reload the tree with a new source.
|
|
1771
|
+
*
|
|
1772
|
+
* Previous data is cleared.
|
|
1773
|
+
* Pass `options.columns` to define a header (may also be part of `source.columns`).
|
|
1774
|
+
*/
|
|
1639
1775
|
load(source: any, options?: any): Promise<void>;
|
|
1640
1776
|
/**
|
|
1777
|
+
* Disable render requests during operations that would trigger many updates.
|
|
1641
1778
|
*
|
|
1779
|
+
* ```js
|
|
1780
|
+
* try {
|
|
1781
|
+
* tree.enableUpdate(false);
|
|
1782
|
+
* // ... (long running operation that would trigger many updates)
|
|
1783
|
+
* foo();
|
|
1784
|
+
* // ... NOTE: make sure that async operations have finished
|
|
1785
|
+
* await foo();
|
|
1786
|
+
* } finally {
|
|
1787
|
+
* tree.enableUpdate(true);
|
|
1788
|
+
* }
|
|
1789
|
+
* ```
|
|
1642
1790
|
*/
|
|
1643
1791
|
enableUpdate(flag: boolean): void;
|
|
1644
1792
|
/**
|