wunderbaum 0.0.1-0 → 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/src/wb_options.ts CHANGED
@@ -7,8 +7,10 @@
7
7
  import {
8
8
  BoolOptionResolver,
9
9
  NavigationModeOption,
10
- WbEventType,
10
+ WbNodeEventType,
11
+ WbTreeEventType,
11
12
  } from "./common";
13
+ import { DndOptionsType } from "./wb_ext_dnd";
12
14
 
13
15
  export interface WbNodeData {
14
16
  title: string;
@@ -16,7 +18,7 @@ export interface WbNodeData {
16
18
  refKey?: string;
17
19
  expanded?: boolean;
18
20
  selected?: boolean;
19
- checkbox?: boolean | "radio" | BoolOptionResolver;
21
+ checkbox?: boolean | string;
20
22
  children?: Array<WbNodeData>;
21
23
  // ...any?: Any;
22
24
  }
@@ -62,56 +64,167 @@ export interface WunderbaumOptions {
62
64
  *
63
65
  * Default: `{}`.
64
66
  */
65
- types: any; //[key: string]: any;
67
+ types?: any; //[key: string]: any;
66
68
  /**
67
69
  * A list of maps that define column headers. If this option is set,
68
- * Wunderbaum becomes a tree-grid control instead of a plain tree.
70
+ * Wunderbaum becomes a treegrid control instead of a plain tree.
69
71
  * Column definitions can be passed as tree option, or be part of a `source`
70
72
  * response.
71
73
  * Default: `[]` meaning this is a plain tree.
72
74
  */
73
75
  columns?: Array<any>;
74
76
  /**
75
- *
77
+ * If true, add a `wb-skeleton` class to all nodes, that will result in a
78
+ * 'glow' effect. Typically used with initial dummy nodes, while loading the
79
+ * real data.
76
80
  * Default: false.
77
81
  */
78
- skeleton: false;
82
+ skeleton?: false;
79
83
  /**
80
- *
81
- * Default: false.
84
+ * Translation map for some system messages.
82
85
  */
83
- strings: any; //[key: string] string;
86
+ strings?: any; //[key: string] string;
84
87
  /**
88
+ * 0:quiet, 1:errors, 2:warnings, 3:info, 4:verbose
89
+ * Default: 3 (4 in local debug environment)
85
90
  */
86
- debugLevel: 3;
87
- minExpandLevel: 0;
88
- escapeTitles: true;
89
- headerHeightPx: 22;
90
- autoCollapse: false;
91
- // --- Extensions ---
92
- dnd: any; // = {};
93
- filter: any; // = {};
91
+ debugLevel: number;
94
92
  /**
95
- * A list of maps that define column headers. If this option is set,
96
- * Wunderbaum becomes a tree grid control instead of a plain tree.
97
- * Column definitions can be passed as tree option, or be part of a `source`
98
- * response.
93
+ * Number of levels that are forced to be expanded, and have no expander icon.
94
+ * Default: 0
95
+ */
96
+ minExpandLevel?: number;
97
+ // escapeTitles: boolean;
98
+ /**
99
+ * Height of the header row div.
100
+ * Default: 22
101
+ */
102
+ headerHeightPx: number;
103
+ /**
104
+ * Height of a node row div.
105
+ * Default: 22
106
+ */
107
+ rowHeightPx?: number;
108
+ /**
109
+ * Collapse siblings when a node is expanded.
110
+ * Default: false
111
+ */
112
+ autoCollapse?: boolean;
113
+ /**
114
+ * Default: NavigationModeOption.startRow
99
115
  */
100
116
  navigationMode?: NavigationModeOption;
117
+ /**
118
+ * Show/hide header (pass bool or string)
119
+ */
120
+ header?: boolean | string | null;
121
+ /**
122
+ *
123
+ */
124
+ showSpinner?: boolean;
125
+ /**
126
+ * Default: true
127
+ */
128
+ checkbox?: boolean | "radio" | BoolOptionResolver;
129
+ /**
130
+ * Default: 200
131
+ */
132
+ updateThrottleWait?: number;
133
+ // --- KeyNav ---
134
+ /**
135
+ * Default: true
136
+ */
137
+ quicksearch?: boolean;
138
+
139
+ // --- Extensions ---
140
+ dnd?: DndOptionsType; // = {};
141
+ filter: any; // = {};
142
+ grid: any; // = {};
101
143
  // --- Events ---
102
144
  /**
103
145
  * Called after initial data was loaded and tree markup was rendered.
146
+ * Check `e.error` for status.
104
147
  * @category Callback
105
148
  */
106
- init?: (e: WbEventType) => void;
149
+ init?: (e: WbTreeEventType) => void;
107
150
  /**
108
- * Called after data was loaded from local storage.
151
+ *
152
+ * @category Callback
153
+ */
154
+ update?: (e: WbTreeEventType) => void;
155
+ /**
156
+ *
157
+ * @category Callback
158
+ */
159
+ activate?: (e: WbNodeEventType) => void;
160
+ /**
161
+ *
162
+ * @category Callback
163
+ */
164
+ deactivate?: (e: WbNodeEventType) => void;
165
+ /**
166
+ *
167
+ * @category Callback
168
+ */
169
+ change?: (e: WbNodeEventType) => void;
170
+ /**
171
+ *
172
+ * @category Callback
173
+ */
174
+ click?: (e: WbTreeEventType) => void;
175
+ /**
176
+ *
177
+ * @category Callback
178
+ */
179
+ discard?: (e: WbNodeEventType) => void;
180
+ /**
181
+ *
182
+ * @category Callback
183
+ */
184
+ error?: (e: WbTreeEventType) => void;
185
+ /**
186
+ *
187
+ * @category Callback
188
+ */
189
+ enhanceTitle?: (e: WbNodeEventType) => void;
190
+ /**
191
+ *
192
+ * Check `e.flag` for status.
109
193
  * @category Callback
110
194
  */
111
- update?: (e: WbEventType) => void;
195
+ focus?: (e: WbTreeEventType) => void;
196
+ /**
197
+ *
198
+ * @category Callback
199
+ */
200
+ keydown?: (e: WbNodeEventType) => void;
112
201
  /**
113
202
  * Called after data was loaded from local storage.
203
+ */
204
+ load?: (e: WbNodeEventType) => void;
205
+ /**
206
+ * @category Callback
207
+ */
208
+ modifyChild?: (e: WbNodeEventType) => void;
209
+ /**
210
+ *
211
+ * @category Callback
212
+ */
213
+ receive?: (e: WbNodeEventType) => void;
214
+ /**
215
+ *
216
+ * @category Callback
217
+ */
218
+ render?: (e: WbNodeEventType) => void;
219
+ /**
220
+ *
221
+ * @category Callback
222
+ */
223
+ renderStatusNode?: (e: WbNodeEventType) => void;
224
+ /**
225
+ *
226
+ * Check `e.flag` for status.
114
227
  * @category Callback
115
228
  */
116
- modifyChild?: (e: WbEventType) => void;
229
+ select?: (e: WbNodeEventType) => void;
117
230
  }
@@ -177,7 +177,7 @@ div.wunderbaum {
177
177
  span.wb-col {
178
178
  position: absolute;
179
179
  display: inline-block;
180
- text-overflow: ellipsis;
180
+ // text-overflow: ellipsis;
181
181
  height: $row-inner-height;
182
182
  line-height: $row-inner-height;
183
183
  padding: 0 $col-padding-x;
@@ -185,6 +185,25 @@ div.wunderbaum {
185
185
  &:last-of-type {
186
186
  border-right: none;
187
187
  }
188
+ overflow: visible; // allow resizer to overlap next col
189
+
190
+ span.wb-col-title {
191
+ width: 100%;
192
+ overflow: hidden;
193
+ text-overflow: ellipsis;
194
+ }
195
+ span.wb-col-resizer {
196
+ position: absolute;
197
+ top: 0;
198
+ // left: auto;
199
+ right: -1px;
200
+ width: 3px;
201
+ // float: right;
202
+ border: none;
203
+ border-right: 2px solid $border-color;
204
+ height: 100%;
205
+ cursor: col-resize;
206
+ }
188
207
  }
189
208
 
190
209
  span.wb-node {
@@ -373,6 +392,7 @@ div.wunderbaum {
373
392
 
374
393
  &.wb-rainbow {
375
394
  @for $i from 1 through length($level-rainbow) {
395
+ i.wb-expander:nth-child(#{length($level-rainbow)}n + #{$i}),
376
396
  i.wb-indent:nth-child(#{length($level-rainbow)}n + #{$i}) {
377
397
  background: nth($level-rainbow, $i);
378
398
  }
@@ -382,16 +402,19 @@ div.wunderbaum {
382
402
  /* Fade out expanders, when container is not hovered or active */
383
403
  &.wb-fade-expander {
384
404
  i.wb-expander {
385
- transition: opacity 1.5s;
386
- opacity: 0;
405
+ // only text-alpha is animated, since we want to keep the background color
406
+ // transition: opacity 1.5s;
407
+ // opacity: 0;
408
+ transition: color 1.5s;
409
+ color: rgba($node-text-color, 0);
387
410
  }
388
411
  div.wb-row.wb-loading i.wb-expander,
389
412
  &:hover i.wb-expander,
390
413
  &:focus i.wb-expander,
391
414
  &:focus-within i.wb-expander,
392
415
  [class*="wb-statusnode-"] i.wb-expander {
393
- transition: opacity 0.6s;
394
- opacity: 1;
416
+ transition: color 0.6s;
417
+ color: $node-text-color;
395
418
  }
396
419
  }
397
420