desy-html 13.0.1 → 14.0.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/docs/_include.template-header.njk +5 -0
- package/docs/_macro.example-render.njk +5 -0
- package/docs/componentes.html +3 -0
- package/docs/ds/_ds.example.checkboxes.njk +1 -1
- package/docs/ds/_ds.example.date-input.njk +3 -3
- package/docs/ds/_ds.example.file-upload.njk +1 -1
- package/docs/ds/_ds.example.input-group.njk +1 -1
- package/docs/ds/_ds.example.input.njk +5 -5
- package/docs/ds/_ds.example.radios.njk +1 -1
- package/docs/ds/_ds.example.searchbar.njk +1 -1
- package/docs/ds/_ds.example.select.njk +5 -5
- package/docs/ds/_ds.example.textarea.njk +7 -7
- package/docs/examples-treegrid.html +8 -0
- package/docs/index.html +8 -0
- package/gulpfile.js +15 -1
- package/package.json +2 -1
- package/src/css/styles.css +1 -0
- package/src/js/aria/MenuNavigation.js +12 -3
- package/src/js/aria/tree.js +320 -31
- package/src/js/aria/treegrid.js +508 -0
- package/src/js/aria/treeitem.js +25 -19
- package/src/js/desy-html.js +37 -31
- package/src/js/index.js +12 -10
- package/src/templates/components/character-count/_examples.character-count.njk +3 -15
- package/src/templates/components/checkboxes/_examples.checkboxes.njk +67 -86
- package/src/templates/components/date-input/_examples.date-input.njk +15 -15
- package/src/templates/components/datepicker/_examples.datepicker.njk +7 -6
- package/src/templates/components/datepicker/_template.datepicker.njk +0 -1
- package/src/templates/components/description-list/_examples.description-list.njk +2 -2
- package/src/templates/components/dialog/_examples.dialog.njk +2 -2
- package/src/templates/components/dropdown/_examples.dropdown.njk +3 -3
- package/src/templates/components/error-message/_examples.error-message.njk +4 -2
- package/src/templates/components/error-summary/params.error-summary.yaml +0 -3
- package/src/templates/components/fieldset/_examples.fieldset.njk +2 -29
- package/src/templates/components/file-upload/_examples.file-upload.njk +4 -15
- package/src/templates/components/header-advanced/_template.header-advanced.njk +1 -0
- package/src/templates/components/hint/params.hint.yaml +0 -14
- package/src/templates/components/input/_examples.input.njk +9 -45
- package/src/templates/components/input-group/_examples.input-group.njk +19 -18
- package/src/templates/components/item/_examples.item.njk +1 -0
- package/src/templates/components/media-object/_examples.media-object.njk +6 -5
- package/src/templates/components/menubar/_template.menubar.njk +2 -2
- package/src/templates/components/menubar/params.menubar.yaml +0 -10
- package/src/templates/components/modal/_examples.modal.njk +1 -1
- package/src/templates/components/notification/_examples.notification.njk +8 -2
- package/src/templates/components/pill/_examples.pill.njk +2 -1
- package/src/templates/components/radios/_examples.radios.njk +56 -91
- package/src/templates/components/searchbar/_examples.searchbar.njk +2 -1
- package/src/templates/components/select/_examples.select.njk +3 -29
- package/src/templates/components/status-item/_examples.status-item.njk +1 -0
- package/src/templates/components/table-advanced/params.table-advanced.yaml +1 -1
- package/src/templates/components/textarea/_examples.textarea.njk +3 -14
- package/src/templates/components/tree/_examples.tree.njk +157 -3
- package/src/templates/components/tree/_template.tree.njk +112 -101
- package/src/templates/components/tree/params.tree.yaml +4 -0
- package/src/templates/components/treegrid/_examples.treegrid.njk +1240 -0
- package/src/templates/components/treegrid/_macro.treegrid.njk +3 -0
- package/src/templates/components/treegrid/_styles.treegrid.css +39 -0
- package/src/templates/components/treegrid/_template.treegrid.njk +91 -0
- package/src/templates/components/treegrid/params.treegrid.yaml +132 -0
package/src/js/aria/tree.js
CHANGED
|
@@ -20,57 +20,290 @@ export function Tree(aria) {
|
|
|
20
20
|
* An element with the role=tree attribute
|
|
21
21
|
*/
|
|
22
22
|
aria.Tree = function (node) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
// Check whether node is a DOM element
|
|
24
|
+
if (typeof node !== 'object') {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
this.domNode = node;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
this.treeitems = [];
|
|
31
|
+
this.firstChars = [];
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
this.firstTreeitem = null;
|
|
34
|
+
this.lastTreeitem = null;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
this.lazyRendering = false;
|
|
37
|
+
this.treeData = null;
|
|
38
|
+
this.params = null;
|
|
39
|
+
};
|
|
37
40
|
|
|
38
41
|
aria.Tree.prototype.init = function () {
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
// Only if lazyRendering
|
|
44
|
+
const treeDataRaw = this.domNode.getAttribute('data-tree');
|
|
45
|
+
if (treeDataRaw) {
|
|
46
|
+
this.treeData = JSON.parse(treeDataRaw);
|
|
47
|
+
this.lazyRendering = true;
|
|
48
|
+
const paramsRaw = this.domNode.getAttribute('data-params');
|
|
49
|
+
if (paramsRaw) {
|
|
50
|
+
this.params = JSON.parse(paramsRaw);
|
|
51
|
+
this.describedBy = this.params.describedBy ?? "";
|
|
52
|
+
if (this.params.fieldset.describedBy)
|
|
53
|
+
this.describedBy = this.params.fieldset.describedBy;
|
|
54
|
+
this.hasFieldset = this.params.fieldset ?? false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// initialize pop up menus
|
|
59
|
+
if (!this.domNode.getAttribute('role')) {
|
|
60
|
+
this.domNode.setAttribute('role', 'tree');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.findTreeitems(this.domNode, this, false);
|
|
64
|
+
|
|
65
|
+
this.updateVisibleTreeitems();
|
|
66
|
+
|
|
67
|
+
this.firstTreeitem.domNode.tabIndex = 0;
|
|
68
|
+
|
|
69
|
+
};
|
|
41
70
|
|
|
42
|
-
var elem = node.firstElementChild;
|
|
43
|
-
var ti = group;
|
|
44
71
|
|
|
45
|
-
|
|
72
|
+
aria.Tree.prototype.findTreeitems = function (node, tree, group) {
|
|
73
|
+
var elem = node.firstElementChild;
|
|
74
|
+
var ti = group;
|
|
46
75
|
|
|
47
|
-
|
|
76
|
+
while (elem) {
|
|
77
|
+
if (elem.tagName.toLowerCase() === 'li') {
|
|
78
|
+
if (elem.dataset.treeProcessed !== 'true' || !this.lazyRendering) {
|
|
48
79
|
ti = new aria.Treeitem(elem, tree, group);
|
|
49
80
|
ti.init();
|
|
50
81
|
tree.treeitems.push(ti);
|
|
51
82
|
tree.firstChars.push(ti.label.substring(0, 1).toLowerCase());
|
|
83
|
+
if (this.lazyRendering) {
|
|
84
|
+
elem.dataset.treeProcessed = 'true';
|
|
85
|
+
elem.addEventListener('click', (event) => event.stopPropagation());
|
|
86
|
+
}
|
|
52
87
|
}
|
|
88
|
+
}
|
|
53
89
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
90
|
+
if (elem.firstElementChild) {
|
|
91
|
+
this.findTreeitems(elem, tree, ti);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
elem = elem.nextElementSibling;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
57
97
|
|
|
58
|
-
|
|
98
|
+
function checkboxItem(item, id, name, type, params, describedBy, hasFieldset) {
|
|
99
|
+
name = name || item.name || '';
|
|
100
|
+
var hasHint = item.hint && (item.hint.text || item.hint.html);
|
|
101
|
+
var itemHintId = hasHint ? id + '-item-hint' : '';
|
|
102
|
+
var itemDescribed = (!hasFieldset ? describedBy : '') + (itemHintId ? ' ' + itemHintId : '');
|
|
103
|
+
itemDescribed = itemDescribed.trim();
|
|
104
|
+
|
|
105
|
+
// Wrapper
|
|
106
|
+
var html = '<div' +
|
|
107
|
+
((params.hasDividers ? ' class="border-t border-b border-neutral-base -mb-px' : '') +
|
|
108
|
+
(item.classes ? ' ' + item.classes : '') + '"').replace('""', '') +
|
|
109
|
+
'>' +
|
|
110
|
+
'<div class="relative flex items-start py-xs">';
|
|
111
|
+
|
|
112
|
+
// Checkbox / Radio branch
|
|
113
|
+
if (type === 'checkbox' || type === 'radio' || typeof type === 'undefined') {
|
|
114
|
+
html += '<div class="flex items-center mx-sm">' +
|
|
115
|
+
'<input ' +
|
|
116
|
+
'class="w-6 h-6 transition duration-150 ease-in-out border-black ' +
|
|
117
|
+
'focus:border-black focus:shadow-outline-focus-input ' +
|
|
118
|
+
'focus:ring-4 focus:ring-offset-0 focus:ring-warning-base ' +
|
|
119
|
+
'disabled:bg-neutral-base disabled:border-neutral-base text-primary-base' +
|
|
120
|
+
((item.isIndeterminate && item.indeterminateChecked)
|
|
121
|
+
? ' c-checkboxes__indeterminate-active'
|
|
122
|
+
: '') + '"' +
|
|
123
|
+
' id="' + id + '-input"' +
|
|
124
|
+
' name="' + name + '"' +
|
|
125
|
+
(type === 'checkbox' ? ' type="checkbox" role="checkbox"' : ' type="radio"') +
|
|
126
|
+
' value="' + (item.value || '') + '"' +
|
|
127
|
+
(item.checked ? ' checked' : '') +
|
|
128
|
+
(item.disabled ? ' disabled' : '') +
|
|
129
|
+
(itemDescribed ? ' aria-describedby="' + itemDescribed + '"' : '') +
|
|
130
|
+
(params.errorMessage ? ' aria-invalid="true"' : '');
|
|
131
|
+
|
|
132
|
+
if (item.isIndeterminate || item.indeterminateChecked) {
|
|
133
|
+
html += ' onclick="' +
|
|
134
|
+
"if (this.readOnly) this.checked=this.readOnly=false; " +
|
|
135
|
+
"else if (!this.checked) this.readOnly=this.indeterminate=true;" +
|
|
136
|
+
'"';
|
|
59
137
|
}
|
|
138
|
+
html += '>' +
|
|
139
|
+
'</div>' + // cierre flex items-center
|
|
140
|
+
'<div class="flex-1 pt-0.5 leading-5">';
|
|
141
|
+
|
|
142
|
+
// Label
|
|
143
|
+
var lblCls = (item.label && item.label.classes)
|
|
144
|
+
? item.label.classes
|
|
145
|
+
: 'block relative -top-xs -left-8 pl-8 py-xs';
|
|
146
|
+
html += '<label for="' + id + '-input" class="' + lblCls + '">';
|
|
147
|
+
html += item.html ? item.html : (item.text || '');
|
|
148
|
+
html += '</label>';
|
|
149
|
+
|
|
150
|
+
// Hint
|
|
151
|
+
if (hasHint) {
|
|
152
|
+
html += '<div id="' + itemHintId + '"' +
|
|
153
|
+
(item.hint.classes ? ' class="' + item.hint.classes + '"' : '') +
|
|
154
|
+
'>';
|
|
155
|
+
html += item.hint.html || item.hint.text;
|
|
156
|
+
html += '</div>';
|
|
157
|
+
}
|
|
158
|
+
html += '</div>'; // cierre flex-1
|
|
60
159
|
}
|
|
61
160
|
|
|
62
|
-
//
|
|
63
|
-
if (
|
|
64
|
-
|
|
161
|
+
// Navigation branch
|
|
162
|
+
if (type === 'navigation') {
|
|
163
|
+
if (item.href) {
|
|
164
|
+
html += '<a' +
|
|
165
|
+
(id ? ' id="' + id + '-link"' : '') +
|
|
166
|
+
' href="' + item.href + '"' +
|
|
167
|
+
' class="block px-xs focus:bg-warning-base focus:outline-none ' +
|
|
168
|
+
'focus:shadow-outline-focus focus:text-black' +
|
|
169
|
+
(item.classes ? ' ' + item.classes : '') +
|
|
170
|
+
(!item.disabled ? ' hover:text-primary-base hover:underline'
|
|
171
|
+
: ' no-underline pointer-events-none') + '"' +
|
|
172
|
+
(item.title ? ' title="' + item.title + '"' : '') +
|
|
173
|
+
(item.active ? ' aria-current="page"' : '') +
|
|
174
|
+
(item.disabled ? ' aria-disabled="true" tabindex="-1"' : '') +
|
|
175
|
+
(item.target ? ' target="' + item.target + '"' : '') +
|
|
176
|
+
'>';
|
|
177
|
+
html += item.active
|
|
178
|
+
? '<strong class="font-bold">' +
|
|
179
|
+
(item.html || item.text) +
|
|
180
|
+
'</strong>'
|
|
181
|
+
: (item.html || item.text);
|
|
182
|
+
html += '</a>';
|
|
183
|
+
} else {
|
|
184
|
+
html += '<span' +
|
|
185
|
+
(id ? ' id="' + id + '-link"' : '') +
|
|
186
|
+
' class="block px-xs' +
|
|
187
|
+
(item.classes ? ' ' + item.classes : '') + '"' +
|
|
188
|
+
(item.title ? ' title="' + item.title + '"' : '') +
|
|
189
|
+
'>';
|
|
190
|
+
html += item.active
|
|
191
|
+
? '<strong class="font-bold">' +
|
|
192
|
+
(item.html || item.text) +
|
|
193
|
+
'</strong>'
|
|
194
|
+
: (item.html || item.text);
|
|
195
|
+
html += '</span>';
|
|
196
|
+
}
|
|
65
197
|
}
|
|
66
198
|
|
|
67
|
-
|
|
199
|
+
html += '</div></div>';
|
|
200
|
+
return html;
|
|
201
|
+
}
|
|
68
202
|
|
|
69
|
-
|
|
203
|
+
aria.Tree.prototype.childrenTree = function (itemNode, id, name, type, lazyRendering, onlySub, params, describedBy, hasFieldset) {
|
|
204
|
+
var html = '';
|
|
205
|
+
|
|
206
|
+
if (!onlySub) {
|
|
207
|
+
if (itemNode.sub) {
|
|
208
|
+
html += '<div class="w-full h-full">' +
|
|
209
|
+
'<div class="flex items-center relative ' +
|
|
210
|
+
'focus:bg-warning-base focus:outline-none ' +
|
|
211
|
+
'focus:shadow-outline-focus focus:text-black text-left' +
|
|
212
|
+
(itemNode.classes ? ' ' + itemNode.classes : '') + '"';
|
|
213
|
+
for (var a in itemNode.attributes || {}) {
|
|
214
|
+
html += ' ' + a + '="' + itemNode.attributes[a] + '"';
|
|
215
|
+
}
|
|
216
|
+
html += '>' +
|
|
217
|
+
'<span class="c-tree__icon absolute top-3 -left-4 flex items-center ' +
|
|
218
|
+
'w-4 h-2.5 text-primary-base font-bold ' +
|
|
219
|
+
"after:content-[''] after:absolute after:-left-2 after:p-4\">" +
|
|
220
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" ' +
|
|
221
|
+
'width="10" height="10" aria-hidden="true" ' +
|
|
222
|
+
'class="c-tree__minus">' +
|
|
223
|
+
'<path fill="currentColor" d="M9.286 5.714H.714a.714.714 0 010-1.428h8.572a.714.714 0 010 1.428z"/>' +
|
|
224
|
+
'</svg>' +
|
|
225
|
+
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" ' +
|
|
226
|
+
'width="10" height="10" aria-hidden="true" ' +
|
|
227
|
+
'class="c-tree__plus">' +
|
|
228
|
+
'<path fill="currentColor" d="M9.286 4.286H5.893a.179.179 0 01-.179-.179V.714a.714.714 0 00-1.428 0v3.393a.179.179 0 01-.179.179H.714a.714.714 0 000 1.428h3.393a.179.179 0 01.179.179v3.393a.714.714 0 001.428 0V5.893a.179.179 0 01.179-.179h3.393a.714.714 0 000-1.428z"/>' +
|
|
229
|
+
'</svg>' +
|
|
230
|
+
'</span>' +
|
|
231
|
+
checkboxItem(itemNode, id, name, type, params, describedBy, hasFieldset) +
|
|
232
|
+
'</div>' +
|
|
233
|
+
'</div>';
|
|
234
|
+
} else {
|
|
235
|
+
html += checkboxItem(itemNode, id, name, type, params, describedBy, hasFieldset);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
70
238
|
|
|
71
|
-
|
|
239
|
+
if (itemNode.sub && itemNode.sub.items) {
|
|
240
|
+
html += '<ul role="group" class="c-tree__itemgroup' +
|
|
241
|
+
(itemNode.sub.classes ? ' ' + itemNode.sub.classes : '') + '"';
|
|
242
|
+
for (var b in itemNode.sub.attributes || {}) {
|
|
243
|
+
html += ' ' + b + '="' + itemNode.sub.attributes[b] + '"';
|
|
244
|
+
}
|
|
245
|
+
html += '>';
|
|
246
|
+
|
|
247
|
+
if (!lazyRendering || onlySub) {
|
|
248
|
+
var subLevel = 'sub-';
|
|
249
|
+
itemNode.sub.items.forEach((subitem, idx) => {
|
|
250
|
+
if (!subitem) return;
|
|
251
|
+
var subId = subitem.id
|
|
252
|
+
? subitem.id
|
|
253
|
+
: subLevel + id + '-' + idx;
|
|
254
|
+
var clsBase = (type === 'navigation')
|
|
255
|
+
? 'c-tree__item ml-5 my-sm origin-top-left focus:outline-none'
|
|
256
|
+
: 'c-tree__item ml-8 origin-top-left focus:outline-none';
|
|
257
|
+
var expanded = subitem.sub
|
|
258
|
+
? ' aria-expanded="' + (subitem.expanded ? 'true' : 'false') + '"'
|
|
259
|
+
: '';
|
|
260
|
+
|
|
261
|
+
html += '<li class="' + clsBase + '" ' +
|
|
262
|
+
'id="' + subId + '" ' +
|
|
263
|
+
'role="treeitem" ' +
|
|
264
|
+
'data-module="c-tree__item"' +
|
|
265
|
+
expanded +
|
|
266
|
+
'>';
|
|
267
|
+
|
|
268
|
+
if (subitem.sub) {
|
|
269
|
+
html += this.childrenTree(
|
|
270
|
+
subitem,
|
|
271
|
+
subId,
|
|
272
|
+
name,
|
|
273
|
+
type,
|
|
274
|
+
lazyRendering,
|
|
275
|
+
false,
|
|
276
|
+
params,
|
|
277
|
+
describedBy,
|
|
278
|
+
hasFieldset
|
|
279
|
+
);
|
|
280
|
+
} else {
|
|
281
|
+
html += '<div class="block' +
|
|
282
|
+
(subitem.classes ? ' ' + subitem.classes : '') +
|
|
283
|
+
(subitem.active ? ' font-bold' : '') +
|
|
284
|
+
'"' +
|
|
285
|
+
(subitem.title ? ' title="' + subitem.title + '"' : '') +
|
|
286
|
+
(subitem.active ? ' aria-current="page"' : '') +
|
|
287
|
+
'>';
|
|
288
|
+
if (subitem.active) {
|
|
289
|
+
html += '<div class="font-bold">' +
|
|
290
|
+
checkboxItem(subitem, subId, name, type, params, describedBy, hasFieldset) +
|
|
291
|
+
'</div>';
|
|
292
|
+
} else {
|
|
293
|
+
html += checkboxItem(subitem, subId, name, type, params, describedBy, hasFieldset);
|
|
294
|
+
}
|
|
295
|
+
html += '</div>';
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
html += '</li>';
|
|
299
|
+
});
|
|
300
|
+
}
|
|
72
301
|
|
|
73
|
-
|
|
302
|
+
html += '</ul>';
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return html;
|
|
306
|
+
}
|
|
74
307
|
|
|
75
308
|
aria.Tree.prototype.setFocusToItem = function (treeitem) {
|
|
76
309
|
|
|
@@ -80,8 +313,12 @@ export function Tree(aria) {
|
|
|
80
313
|
if (ti === treeitem) {
|
|
81
314
|
ti.domNode.tabIndex = 0;
|
|
82
315
|
ti.domNode.focus();
|
|
83
|
-
|
|
84
|
-
|
|
316
|
+
|
|
317
|
+
var input = ti.domNode.querySelector('input');
|
|
318
|
+
if (input) {
|
|
319
|
+
ti.domNode.setAttribute('aria-checked', input.checked ? 'true' : 'false');
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
85
322
|
ti.domNode.tabIndex = -1;
|
|
86
323
|
}
|
|
87
324
|
}
|
|
@@ -145,7 +382,58 @@ export function Tree(aria) {
|
|
|
145
382
|
aria.Tree.prototype.expandTreeitem = function (currentItem) {
|
|
146
383
|
|
|
147
384
|
if (currentItem.isExpandable) {
|
|
148
|
-
currentItem.domNode
|
|
385
|
+
var node = currentItem.domNode;
|
|
386
|
+
node.setAttribute('aria-expanded', 'true');
|
|
387
|
+
|
|
388
|
+
if (this.lazyRendering && !node.dataset.childrenInjected) {
|
|
389
|
+
|
|
390
|
+
function findNodeById(data, targetId, parentId = '') {
|
|
391
|
+
for (let i = 0; i < data.length; i++) {
|
|
392
|
+
const item = data[i];
|
|
393
|
+
|
|
394
|
+
const currentId = item.id || (parentId ? 'sub-' + parentId + '-' + i : i);
|
|
395
|
+
|
|
396
|
+
if (currentId === targetId) {
|
|
397
|
+
return item;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if (item.sub?.items?.length) {
|
|
401
|
+
const result = findNodeById(item.sub.items, targetId, currentId);
|
|
402
|
+
if (result) return result;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return null;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
var itemNode = findNodeById(this.treeData || [], node.id);
|
|
410
|
+
|
|
411
|
+
if (itemNode && itemNode.sub && itemNode.sub.items && itemNode.sub.items.length) {
|
|
412
|
+
var group = node.querySelector('ul[role="group"]');
|
|
413
|
+
|
|
414
|
+
var html = this.childrenTree(
|
|
415
|
+
itemNode,
|
|
416
|
+
node.id,
|
|
417
|
+
this.params.name,
|
|
418
|
+
this.params.type,
|
|
419
|
+
this.lazyRendering,
|
|
420
|
+
true,
|
|
421
|
+
this.params,
|
|
422
|
+
this.describedBy,
|
|
423
|
+
this.hasFieldset
|
|
424
|
+
);
|
|
425
|
+
var listItems = html
|
|
426
|
+
.replace(/^<ul[^>]*>/, '')
|
|
427
|
+
.replace(/<\/ul>$/, '');
|
|
428
|
+
group.insertAdjacentHTML('beforeend', listItems);
|
|
429
|
+
node.dataset.childrenInjected = 'true';
|
|
430
|
+
}
|
|
431
|
+
this.findTreeitems(this.domNode, this, currentItem);
|
|
432
|
+
// To sort because when add children dinnamically, the order is not guaranteed as should be.
|
|
433
|
+
this.treeitems.sort((a, b) => a.domNode.compareDocumentPosition(b.domNode) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1);
|
|
434
|
+
this.firstChars = this.treeitems.map(ti => ti.label.substring(0, 1).toLowerCase());
|
|
435
|
+
}
|
|
436
|
+
|
|
149
437
|
this.updateVisibleTreeitems();
|
|
150
438
|
}
|
|
151
439
|
|
|
@@ -171,9 +459,10 @@ export function Tree(aria) {
|
|
|
171
459
|
} else {
|
|
172
460
|
groupTreeitem = currentItem.groupTreeitem;
|
|
173
461
|
}
|
|
174
|
-
|
|
175
462
|
if (groupTreeitem) {
|
|
176
|
-
groupTreeitem.domNode
|
|
463
|
+
var node = groupTreeitem.domNode;
|
|
464
|
+
node.setAttribute('aria-expanded', false);
|
|
465
|
+
|
|
177
466
|
this.updateVisibleTreeitems();
|
|
178
467
|
this.setFocusToItem(groupTreeitem);
|
|
179
468
|
}
|