wj-elements 0.7.2 → 0.7.4

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/wje-tree.js CHANGED
@@ -5,7 +5,7 @@ import WJElement from "./wje-element.js";
5
5
  const styles = "/*\n[ WJ Tree ]\n*/\n\n:host {\n position: relative;\n width: 100%;\n font-size: 0;\n}\n";
6
6
  class Tree extends WJElement {
7
7
  /**
8
- * Creates an instance of Toast.
8
+ * Creates an instance of Tree.
9
9
  */
10
10
  constructor() {
11
11
  super();
@@ -22,24 +22,89 @@ class Tree extends WJElement {
22
22
  * @param {Event} e The click event object.
23
23
  */
24
24
  __publicField(this, "handleClick", (e) => {
25
+ var _a;
25
26
  if (e == null ? void 0 : e.preventDefault) e.preventDefault();
26
- let selectedItem = e.target.closest("wje-tree-item");
27
- let isClickButton = e.composedPath().some((el) => {
28
- var _a;
29
- return (_a = el == null ? void 0 : el.classList) == null ? void 0 : _a.contains("toggle");
27
+ if (this.reorder && this.isReorderHandleEvent(e)) return;
28
+ const selectedItem = this.getTreeItemFromEvent(e);
29
+ if (!selectedItem) return;
30
+ const isClickButton = (((_a = e.composedPath) == null ? void 0 : _a.call(e)) || []).some((el) => {
31
+ var _a2;
32
+ return (_a2 = el == null ? void 0 : el.classList) == null ? void 0 : _a2.contains("toggle");
30
33
  });
31
34
  if (isClickButton) return;
32
35
  if (this.selection === "single") {
33
- if (selectedItem) {
34
- for (let item of this.getAllItems()) {
35
- item.selected = item === selectedItem;
36
- }
36
+ for (let item of this.getAllItems()) {
37
+ item.selected = item === selectedItem;
37
38
  }
38
39
  } else if (this.selection === "multiple") {
39
40
  selectedItem.selected = !selectedItem.selected;
40
41
  this.updateCheckboxState(selectedItem);
41
42
  }
42
43
  });
44
+ /**
45
+ * Starts dragging a tree item when the drag begins from the configured start slot handle.
46
+ * @param {DragEvent} e The drag event.
47
+ * @returns {void}
48
+ */
49
+ __publicField(this, "handleDragStart", (e) => {
50
+ var _a;
51
+ if (!this.reorder || !this.isReorderHandleEvent(e)) return;
52
+ const item = this.getTreeItemFromEvent(e);
53
+ if (!item) return;
54
+ this.draggedItem = item;
55
+ item.classList.add("wje-tree-dragging");
56
+ if (e.dataTransfer) {
57
+ e.dataTransfer.effectAllowed = "move";
58
+ e.dataTransfer.setData("text/plain", ((_a = item.textContent) == null ? void 0 : _a.trim()) || "");
59
+ }
60
+ });
61
+ /**
62
+ * Updates the current drop target and exposes a visual drop position.
63
+ * @param {DragEvent} e The drag event.
64
+ * @returns {void}
65
+ */
66
+ __publicField(this, "handleDragOver", (e) => {
67
+ if (!this.reorder || !this.draggedItem) return;
68
+ const target = this.getTreeItemFromEvent(e);
69
+ if (!this.canDrop(this.draggedItem, target)) {
70
+ this.clearDropState();
71
+ return;
72
+ }
73
+ e.preventDefault();
74
+ if (e.dataTransfer) e.dataTransfer.dropEffect = "move";
75
+ const position = this.getDropPosition(e, target);
76
+ this.setDropState(target, position);
77
+ });
78
+ /**
79
+ * Completes a tree item move.
80
+ * @param {DragEvent} e The drop event.
81
+ * @returns {void}
82
+ */
83
+ __publicField(this, "handleDrop", (e) => {
84
+ if (!this.reorder || !this.draggedItem) return;
85
+ e.preventDefault();
86
+ const target = this.dropTarget || this.getTreeItemFromEvent(e);
87
+ const position = this.dropPosition || this.getDropPosition(e, target);
88
+ const detail = this.moveItem(this.draggedItem, target, position);
89
+ if (detail) {
90
+ this.dispatchEvent(new CustomEvent("wje-tree:move", {
91
+ detail,
92
+ bubbles: true,
93
+ composed: true
94
+ }));
95
+ }
96
+ this.clearDragState();
97
+ });
98
+ /**
99
+ * Clears drag state after the browser drag operation ends.
100
+ * @returns {void}
101
+ */
102
+ __publicField(this, "handleDragEnd", () => {
103
+ this.clearDragState();
104
+ });
105
+ this.draggedItem = null;
106
+ this.dropTarget = null;
107
+ this.dropPosition = null;
43
108
  }
44
109
  /**
45
110
  * Sets the selection attribute for the element.
@@ -56,6 +121,21 @@ class Tree extends WJElement {
56
121
  get selection() {
57
122
  return this.getAttribute("selection") || "single";
58
123
  }
124
+ /**
125
+ * Enables reordering tree items by dragging an element assigned to the start slot.
126
+ * @param {boolean} value Whether reordering is enabled.
127
+ */
128
+ set reorder(value) {
129
+ if (value) this.setAttribute("reorder", "");
130
+ else this.removeAttribute("reorder");
131
+ }
132
+ /**
133
+ * Indicates whether tree items can be reordered with the start slot handle.
134
+ * @returns {boolean}
135
+ */
136
+ get reorder() {
137
+ return this.hasAttribute("reorder");
138
+ }
59
139
  /**
60
140
  * Returns the CSS stylesheet for the component.
61
141
  * @static
@@ -78,17 +158,21 @@ class Tree extends WJElement {
78
158
  * @returns {void} This method does not return a value.
79
159
  */
80
160
  beforeDraw() {
161
+ const template = this.querySelector("template");
81
162
  const items = this.querySelectorAll("wje-tree-item");
82
163
  items == null ? void 0 : items.forEach((item) => {
164
+ var _a;
83
165
  item.selection = this.selection;
84
- this.getExpandCollapseIcon(item, "expand");
85
- this.getExpandCollapseIcon(item, "collapse");
86
- this.getSlots(item, "start");
87
- this.getSlots(item, "end");
166
+ (_a = item.syncNestingState) == null ? void 0 : _a.call(item);
167
+ this.appendTemplateSlot(item, template, "expand");
168
+ this.appendTemplateSlot(item, template, "collapse");
169
+ this.appendTemplateSlot(item, template, "start");
170
+ this.appendTemplateSlot(item, template, "end");
171
+ if (this.reorder) this.setupReorderHandle(item);
88
172
  });
89
173
  }
90
174
  /**
91
- * Draw method for the toast notification.
175
+ * Draw method for the tree.
92
176
  * @returns {object} Document fragment
93
177
  */
94
178
  draw() {
@@ -109,6 +193,10 @@ class Tree extends WJElement {
109
193
  */
110
194
  afterDraw() {
111
195
  this.addEventListener("click", this.handleClick);
196
+ this.addEventListener("dragstart", this.handleDragStart);
197
+ this.addEventListener("dragover", this.handleDragOver);
198
+ this.addEventListener("drop", this.handleDrop);
199
+ this.addEventListener("dragend", this.handleDragEnd);
112
200
  this.syncAria();
113
201
  }
114
202
  /**
@@ -122,6 +210,10 @@ class Tree extends WJElement {
122
210
  }
123
211
  beforeDisconnect() {
124
212
  this.removeEventListener("click", this.handleClick);
213
+ this.removeEventListener("dragstart", this.handleDragStart);
214
+ this.removeEventListener("dragover", this.handleDragOver);
215
+ this.removeEventListener("drop", this.handleDrop);
216
+ this.removeEventListener("dragend", this.handleDragEnd);
125
217
  }
126
218
  /**
127
219
  * Retrieves all items that match the selector 'wje-tree-item' within the current context.
@@ -131,30 +223,266 @@ class Tree extends WJElement {
131
223
  return [...this.querySelectorAll("wje-tree-item")];
132
224
  }
133
225
  /**
134
- * Retrieves and appends an expand/collapse icon to a given item based on the provided status.
135
- * @param {HTMLElement} item The DOM element to which the icon will be appended.
136
- * @param {string} status The status indicating which icon to retrieve (e.g., "expand" or "collapse").
137
- * @returns {void} This method does not return a value. If the icon matching the given status is not found, a warning is logged.
226
+ * Retrieves and appends a template slot to a tree item.
227
+ * @param {HTMLElement} item The DOM element to which the slot content will be appended.
228
+ * @param {HTMLTemplateElement|null} template Template that may provide reusable slot content.
229
+ * @param {string} slotName Name of the projected slot content to clone.
230
+ * @returns {void}
231
+ */
232
+ appendTemplateSlot(item, template, slotName) {
233
+ const slot = template == null ? void 0 : template.content.querySelector(`[slot="${slotName}"]`);
234
+ if (!slot) return;
235
+ const templateSlotClass = this.getTemplateSlotClass(slotName);
236
+ const existing = item.querySelector(`:scope > [slot="${slotName}"].${templateSlotClass}`);
237
+ if (existing) return;
238
+ const slotClone = slot.cloneNode(true);
239
+ slotClone.classList.add("wje-tree-template-slot", templateSlotClass);
240
+ item.append(slotClone);
241
+ }
242
+ /**
243
+ * Returns the internal class used to identify cloned template slot content.
244
+ * @param {string} slotName Name of the projected slot.
245
+ * @returns {string}
246
+ */
247
+ getTemplateSlotClass(slotName) {
248
+ return `wje-tree-template-slot-${slotName}`;
249
+ }
250
+ /**
251
+ * Marks direct start slot content as the drag handle for reorderable trees.
252
+ * @param {HTMLElement} item Host item that receives draggable start content.
253
+ * @returns {void}
254
+ */
255
+ setupReorderHandle(item) {
256
+ const handles = item.querySelectorAll(':scope > [slot="start"]');
257
+ handles.forEach((handle) => {
258
+ handle.setAttribute("draggable", "true");
259
+ handle.classList.add("wje-tree-drag-handle");
260
+ if (!handle.hasAttribute("aria-label")) {
261
+ handle.setAttribute("aria-label", "Move tree item");
262
+ }
263
+ });
264
+ }
265
+ /**
266
+ * Finds a tree item from a composed event path.
267
+ * @param {Event} e User interaction that may originate inside shadow DOM.
268
+ * @returns {HTMLElement|null}
138
269
  */
139
- getExpandCollapseIcon(item, status) {
270
+ getTreeItemFromEvent(e) {
271
+ var _a, _b, _c;
272
+ const path = ((_a = e.composedPath) == null ? void 0 : _a.call(e)) || [];
273
+ const pathItem = path.find((el) => this.isTreeItem(el) && this.contains(el));
274
+ if (pathItem) return pathItem;
275
+ const targetItem = (_c = (_b = e.target) == null ? void 0 : _b.closest) == null ? void 0 : _c.call(_b, "wje-tree-item");
276
+ return targetItem && this.contains(targetItem) ? targetItem : null;
277
+ }
278
+ /**
279
+ * Checks whether the event started from a reorder handle.
280
+ * @param {Event} e User interaction to inspect.
281
+ * @returns {boolean}
282
+ */
283
+ isReorderHandleEvent(e) {
140
284
  var _a;
141
- let icon = (_a = this.querySelector("template")) == null ? void 0 : _a.content.querySelector(`[slot="${status}"]`);
142
- if (!icon) {
143
- console.warn(`Icon with slot "${status}" was not found.`);
144
- return;
285
+ return (((_a = e.composedPath) == null ? void 0 : _a.call(e)) || []).some((el) => {
286
+ var _a2;
287
+ return (_a2 = el == null ? void 0 : el.classList) == null ? void 0 : _a2.contains("wje-tree-drag-handle");
288
+ });
289
+ }
290
+ /**
291
+ * Checks whether a node is a tree item element.
292
+ * @param {object} node The node to inspect.
293
+ * @returns {boolean}
294
+ */
295
+ isTreeItem(node) {
296
+ return node instanceof Element && node.localName === "wje-tree-item";
297
+ }
298
+ /**
299
+ * Returns direct tree item children for a tree or tree item parent.
300
+ * @param {HTMLElement} parent The parent element.
301
+ * @returns {HTMLElement[]}
302
+ */
303
+ getDirectTreeItems(parent) {
304
+ return Array.from((parent == null ? void 0 : parent.children) || []).filter((child) => this.isTreeItem(child));
305
+ }
306
+ /**
307
+ * Gets the index of a tree item among direct tree item siblings.
308
+ * @param {HTMLElement} item Element whose sibling position should be resolved.
309
+ * @returns {number}
310
+ */
311
+ getTreeItemIndex(item) {
312
+ return this.getDirectTreeItems(item.parentElement).indexOf(item);
313
+ }
314
+ /**
315
+ * Determines whether the dragged item can be dropped on the target.
316
+ * @param {HTMLElement} draggedItem Item currently being moved.
317
+ * @param {HTMLElement} targetItem Candidate item under the pointer.
318
+ * @returns {boolean}
319
+ */
320
+ canDrop(draggedItem, targetItem) {
321
+ return !!draggedItem && !!targetItem && draggedItem !== targetItem && !draggedItem.contains(targetItem);
322
+ }
323
+ /**
324
+ * Resolves the drop position against the visible tree item row.
325
+ * @param {DragEvent} e Browser drag event carrying pointer coordinates.
326
+ * @param {HTMLElement|null} target Item used to calculate row boundaries.
327
+ * @returns {'before'|'inside'|'after'}
328
+ */
329
+ getDropPosition(e, target) {
330
+ var _a, _b, _c;
331
+ const row = (_a = target == null ? void 0 : target.shadowRoot) == null ? void 0 : _a.querySelector(".item");
332
+ const rect = ((_b = row == null ? void 0 : row.getBoundingClientRect) == null ? void 0 : _b.call(row)) || ((_c = target == null ? void 0 : target.getBoundingClientRect) == null ? void 0 : _c.call(target));
333
+ if (!rect) return "after";
334
+ const topBoundary = rect.top + rect.height * 0.25;
335
+ const bottomBoundary = rect.bottom - rect.height * 0.25;
336
+ if (e.clientY < topBoundary) return "before";
337
+ if (e.clientY > bottomBoundary) return "after";
338
+ return "inside";
339
+ }
340
+ /**
341
+ * Applies the visual drop position to the current target item.
342
+ * @param {HTMLElement} target Item currently showing insertion feedback.
343
+ * @param {string} position Resolved insertion area for the target row.
344
+ * @returns {void}
345
+ */
346
+ setDropState(target, position) {
347
+ if (this.dropTarget !== target || this.dropPosition !== position) {
348
+ this.clearDropState();
349
+ this.dropTarget = target;
350
+ this.dropPosition = position;
351
+ target.classList.add(this.getDropPositionClass(position));
145
352
  }
146
- let iconClone = icon.cloneNode(true);
147
- item.append(iconClone);
148
353
  }
149
- getSlots(item, slotName) {
354
+ /**
355
+ * Clears visual drop target state.
356
+ * @returns {void}
357
+ */
358
+ clearDropState() {
359
+ var _a;
360
+ (_a = this.dropTarget) == null ? void 0 : _a.classList.remove(
361
+ this.getDropPositionClass("before"),
362
+ this.getDropPositionClass("inside"),
363
+ this.getDropPositionClass("after")
364
+ );
365
+ this.dropTarget = null;
366
+ this.dropPosition = null;
367
+ }
368
+ /**
369
+ * Clears the active drag state.
370
+ * @returns {void}
371
+ */
372
+ clearDragState() {
150
373
  var _a;
151
- let slot = (_a = this.querySelector("template")) == null ? void 0 : _a.content.querySelector(`[slot="${slotName}"]`);
152
- if (!slot) {
153
- console.warn(`Icon with slot "${slotName}" was not found.`);
154
- return;
374
+ (_a = this.draggedItem) == null ? void 0 : _a.classList.remove("wje-tree-dragging");
375
+ this.clearDropState();
376
+ this.draggedItem = null;
377
+ }
378
+ /**
379
+ * Returns the internal class used to render a drop marker.
380
+ * @param {'before'|'inside'|'after'} position Drop marker position.
381
+ * @returns {string}
382
+ */
383
+ getDropPositionClass(position) {
384
+ return `wje-tree-drop-${position}`;
385
+ }
386
+ /**
387
+ * Moves a tree item relative to another tree item and syncs nesting metadata.
388
+ * @param {HTMLElement} draggedItem The item being moved.
389
+ * @param {HTMLElement} targetItem Item that receives or anchors the moved item.
390
+ * @param {'before'|'inside'|'after'} position The target position.
391
+ * @returns {object|null} Move detail, or null when the move is invalid.
392
+ */
393
+ moveItem(draggedItem, targetItem, position = "after") {
394
+ var _a, _b, _c;
395
+ if (!this.canDrop(draggedItem, targetItem)) return null;
396
+ const fromParent = draggedItem.parentElement;
397
+ const fromParentItem = (_a = fromParent == null ? void 0 : fromParent.closest) == null ? void 0 : _a.call(fromParent, "wje-tree-item");
398
+ const fromIndex = this.getTreeItemIndex(draggedItem);
399
+ if (position === "inside") {
400
+ targetItem.appendChild(draggedItem);
401
+ (_b = targetItem.setChildrenExpanded) == null ? void 0 : _b.call(targetItem, true);
402
+ } else {
403
+ const parent = targetItem.parentElement;
404
+ const reference = position === "before" ? targetItem : targetItem.nextSibling;
405
+ parent.insertBefore(draggedItem, reference);
155
406
  }
156
- let slotClone = slot.cloneNode(true);
157
- item.append(slotClone);
407
+ this.syncTreeItems();
408
+ const toParent = draggedItem.parentElement;
409
+ const toParentItem = (_c = toParent == null ? void 0 : toParent.closest) == null ? void 0 : _c.call(toParent, "wje-tree-item");
410
+ const toIndex = this.getTreeItemIndex(draggedItem);
411
+ const orderElements = this.getOrderElements(toParent);
412
+ const order = orderElements.map((item) => item.innerText.trim());
413
+ this.refreshMovedItems([fromParentItem, toParentItem, targetItem]);
414
+ return {
415
+ item: draggedItem,
416
+ target: targetItem,
417
+ position,
418
+ from: fromIndex,
419
+ to: toIndex,
420
+ order,
421
+ orderElements,
422
+ orderIds: this.getOrderIds(toParent),
423
+ itemId: this.getItemId(draggedItem),
424
+ targetId: this.getItemId(targetItem),
425
+ fromParentItem,
426
+ toParentItem,
427
+ fromParentId: this.getItemId(fromParentItem),
428
+ toParentId: this.getItemId(toParentItem),
429
+ fromParent,
430
+ toParent,
431
+ fromIndex,
432
+ toIndex
433
+ };
434
+ }
435
+ /**
436
+ * Returns cloned direct tree item children for an event detail.
437
+ * @param {HTMLElement} parent Parent whose direct tree item children should be serialized.
438
+ * @returns {HTMLElement[]}
439
+ */
440
+ getOrderElements(parent) {
441
+ return this.getDirectTreeItems(parent).map((item) => {
442
+ const clone = item.cloneNode(true);
443
+ clone.querySelectorAll(".wje-tree-template-slot").forEach((slot) => slot.remove());
444
+ return clone;
445
+ });
446
+ }
447
+ /**
448
+ * Returns stable ids for direct tree item children when they are available.
449
+ * @param {HTMLElement} parent Parent whose direct tree item children should be serialized.
450
+ * @returns {Array<string|null>}
451
+ */
452
+ getOrderIds(parent) {
453
+ return this.getDirectTreeItems(parent).map((item) => this.getItemId(item));
454
+ }
455
+ /**
456
+ * Gets an application-facing id from a tree item.
457
+ * @param {HTMLElement|null} item Tree item to read.
458
+ * @returns {string|null}
459
+ */
460
+ getItemId(item) {
461
+ if (!this.isTreeItem(item)) return null;
462
+ return item.getAttribute("value") || item.id || null;
463
+ }
464
+ /**
465
+ * Syncs item selection mode and nesting metadata after a DOM move.
466
+ * @returns {void}
467
+ */
468
+ syncTreeItems() {
469
+ this.getAllItems().forEach((item) => {
470
+ var _a, _b;
471
+ item.selection = this.selection;
472
+ (_a = item.syncNestingState) == null ? void 0 : _a.call(item);
473
+ (_b = item.syncAria) == null ? void 0 : _b.call(item);
474
+ });
475
+ }
476
+ /**
477
+ * Redraws affected parent items so expand/collapse affordances match current children.
478
+ * @param {HTMLElement[]} items Items that may need refresh.
479
+ * @returns {void}
480
+ */
481
+ refreshMovedItems(items) {
482
+ [...new Set(items)].forEach((item) => {
483
+ var _a;
484
+ if (this.isTreeItem(item)) (_a = item.refresh) == null ? void 0 : _a.call(item);
485
+ });
158
486
  }
159
487
  /**
160
488
  * Updates the state of a checkbox, syncing the state both upwards to parent elements
@@ -1 +1 @@
1
- {"version":3,"file":"wje-tree.js","sources":["../packages/wje-tree/tree.element.js","../packages/wje-tree/tree.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n/**\n * `Tree` is a custom web component that represents a hierarchical tree structure.\n * It extends from `WJElement`.\n * @summary This element visually represents a tree structure, supporting single or multiple selection modes and hierarchy management.\n * @documentation https://elements.webjet.sk/components/tree\n * @status stable\n * @augments {WJElement}\n * @csspart native - The native container part of the tree.\n * @slot - The default slot to place `wje-tree-item` child components.\n * @tag wje-tree\n */\n\nexport default class Tree extends WJElement {\n /**\n * Creates an instance of Toast.\n */\n constructor() {\n super();\n }\n\n /**\n * Sets the selection attribute for the element.\n * @param {string} value The value to set as the selection attribute.\n */\n set selection(value) {\n this.setAttribute('selection', value);\n }\n\n /**\n * Gets the current selection mode for the element.\n * If no selection is explicitly set, it defaults to 'single'.\n * @returns {string} The current selection mode, either set by the element's attribute or the default value 'single'.\n */\n get selection() {\n return this.getAttribute('selection') || 'single';\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Tree';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * A method called before the drawing or rendering process of tree items.\n * It iterates through all `wje-tree-item` elements, updating their selection state\n * and managing their expand/collapse icons accordingly.\n * @returns {void} This method does not return a value.\n */\n beforeDraw() {\n const items = this.querySelectorAll('wje-tree-item');\n items?.forEach((item) => {\n item.selection = this.selection;\n\n this.getExpandCollapseIcon(item, 'expand');\n this.getExpandCollapseIcon(item, 'collapse');\n\n this.getSlots(item, 'start');\n this.getSlots(item, 'end');\n });\n }\n\n /**\n * Draw method for the toast notification.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tree');\n\n let slot = document.createElement('slot');\n\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the draw process of the component is completed.\n * Typically used to add event listeners or perform operations\n * that are dependent on the component's drawn state.\n * @returns {void} This method does not return a value.\n */\n afterDraw() {\n this.addEventListener('click', this.handleClick);\n this.syncAria();\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n this.setAriaState({\n role: 'tree',\n multiselectable: this.selection === 'multiple' ? 'true' : undefined,\n });\n }\n\n beforeDisconnect() {\n this.removeEventListener('click', this.handleClick);\n }\n\n /**\n * Handles the click event triggered by the user interaction.\n * Identifies the closest tree item element to the event target and sets it\n * as the selected item. Ensures that only one item is selected at a time, resetting\n * the selection state for all other items.\n * @param {Event} e The click event object.\n */\n handleClick = (e) => {\n if (e?.preventDefault) e.preventDefault();\n\n let selectedItem = e.target.closest('wje-tree-item');\n let isClickButton = e.composedPath().some((el) => el?.classList?.contains('toggle'));\n if (isClickButton) return;\n\n if (this.selection === 'single') {\n if (selectedItem) {\n for (let item of this.getAllItems()) {\n item.selected = item === selectedItem;\n }\n }\n } else if (this.selection === 'multiple') {\n // let children = selectedItem.getAllChildrenFlat();\n selectedItem.selected = !selectedItem.selected;\n\n this.updateCheckboxState(selectedItem);\n }\n };\n\n /**\n * Retrieves all items that match the selector 'wje-tree-item' within the current context.\n * @returns {Array<Element>} An array of all matching DOM elements.\n */\n getAllItems() {\n return [...this.querySelectorAll('wje-tree-item')];\n }\n\n /**\n * Retrieves and appends an expand/collapse icon to a given item based on the provided status.\n * @param {HTMLElement} item The DOM element to which the icon will be appended.\n * @param {string} status The status indicating which icon to retrieve (e.g., \"expand\" or \"collapse\").\n * @returns {void} This method does not return a value. If the icon matching the given status is not found, a warning is logged.\n */\n getExpandCollapseIcon(item, status) {\n let icon = this.querySelector('template')?.content.querySelector(`[slot=\"${status}\"]`);\n if (!icon) {\n console.warn(`Icon with slot \"${status}\" was not found.`);\n return;\n }\n\n let iconClone = icon.cloneNode(true);\n item.append(iconClone);\n }\n\n getSlots(item, slotName) {\n let slot = this.querySelector('template')?.content.querySelector(`[slot=\"${slotName}\"]`);\n if (!slot) {\n console.warn(`Icon with slot \"${slotName}\" was not found.`);\n return;\n }\n\n let slotClone = slot.cloneNode(true);\n item.append(slotClone);\n }\n\n /**\n * Updates the state of a checkbox, syncing the state both upwards to parent elements\n * and downwards to child elements as necessary.\n * @param {object} changedItem The specific item whose checkbox state has changed.\n * @param {boolean} [isInitialSync] Indicates whether the state update is part of the initial synchronization process.\n * @returns {void} This method does not return a value.\n */\n updateCheckboxState(changedItem, isInitialSync = false) {\n this.isInitialSync = isInitialSync;\n this.propagateStateDownwards(changedItem);\n this.propagateStateUpwards(changedItem);\n }\n\n /**\n * Updates the state of the parent item based on the state of its child items.\n * Recursively propagates changes up to all parent items to reflect the selection\n * or indeterminate state accurately.\n * @param {object} item The current tree item whose parent state needs to be updated.\n * It is expected to have properties `selected`, `indeterminate`,\n * and a method `getChildrenItems({ includeDisabled: boolean })`.\n * @returns {void} This method does not return a value.\n */\n updateParentState(item) {\n const children = item.getChildrenItems({ includeDisabled: false });\n\n if (children.length) {\n const areAllChildrenChecked = children.every((child) => child.selected);\n const areSomeChildrenChecked = children.some((child) => child.selected);\n const areSomeChildrenIndeterminate = children.some((child) => child.indeterminate);\n\n item.selected = areAllChildrenChecked;\n item.indeterminate = areSomeChildrenIndeterminate || (areSomeChildrenChecked && !areAllChildrenChecked);\n } else {\n item.indeterminate = false;\n }\n\n const parent = item.parentElement?.closest('wje-tree-item');\n if (parent) {\n this.updateParentState(parent);\n }\n }\n\n /**\n * Propagates the state changes of an item upwards through its ancestors in the hierarchy.\n * Calls the `updateParentState` method for each parent element until no parent exists.\n * @param {HTMLElement} item The current item whose state to propagate to its parent.\n * @returns {void} This method does not return a value.\n */\n propagateStateUpwards(item) {\n const parent = item.parentElement?.closest('wje-tree-item');\n\n if (parent) {\n this.updateParentState(parent);\n this.propagateStateUpwards(parent);\n }\n }\n\n /**\n * Propagates the selected state of an item to its children recursively. Depending on the `isInitialSync` flag,\n * it also determines how the state should be applied to the child items and updates the parent state if needed.\n * @param {object} item The item whose state is being propagated to its child items. The item must have properties\n * such as `selected` and methods like `getChildrenItems` to retrieve its child elements.\n * @returns {void} This method does not return a value.\n */\n propagateStateDownwards(item) {\n const isChecked = item.selected;\n\n item.getChildrenItems().forEach((child) => {\n child.selected = this.isInitialSync ? isChecked || child.selected : !child.disabled && isChecked;\n this.propagateStateDownwards(child);\n });\n\n if (this.isInitialSync) {\n this.updateParentState(item);\n }\n }\n}\n","import Tree from './tree.element.js';\n\nexport default Tree;\n\nTree.define('wje-tree', Tree);\n"],"names":[],"mappings":";;;;;AAee,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA,EAIxC,cAAc;AACV,UAAK;AAwBT;AA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wBAAwB,KAAK;AAAA,IACtC,CAAC;AAED,QAAI,KAAK,eAAe;AACpB,WAAK,kBAAkB,IAAI;AAAA,IAC/B;AAAA,EACJ;AACJ;ACvQA,KAAK,OAAO,YAAY,IAAI;"}
1
+ {"version":3,"file":"wje-tree.js","sources":["../packages/wje-tree/tree.element.js","../packages/wje-tree/tree.js"],"sourcesContent":["import { default as WJElement } from '../wje-element/element.js';\nimport styles from './styles/styles.css?inline';\n\n// @fires wje-tree:move - Dispatched when a tree item is moved.\n/**\n * `Tree` is a custom web component that represents a hierarchical tree structure.\n * It extends from `WJElement`.\n * @summary This element visually represents a tree structure, supporting single or multiple selection modes and hierarchy management.\n * @documentation https://elements.webjet.sk/components/tree\n * @status stable\n * @augments {WJElement}\n * @attribute {boolean} reorder - Enables moving tree items by dragging direct start slot content.\n * @csspart native - The native container part of the tree.\n * @slot - The default slot to place `wje-tree-item` child components.\n * @tag wje-tree\n */\n\nexport default class Tree extends WJElement {\n /**\n * Creates an instance of Tree.\n */\n constructor() {\n super();\n\n this.draggedItem = null;\n this.dropTarget = null;\n this.dropPosition = null;\n }\n\n /**\n * Sets the selection attribute for the element.\n * @param {string} value The value to set as the selection attribute.\n */\n set selection(value) {\n this.setAttribute('selection', value);\n }\n\n /**\n * Gets the current selection mode for the element.\n * If no selection is explicitly set, it defaults to 'single'.\n * @returns {string} The current selection mode, either set by the element's attribute or the default value 'single'.\n */\n get selection() {\n return this.getAttribute('selection') || 'single';\n }\n\n /**\n * Enables reordering tree items by dragging an element assigned to the start slot.\n * @param {boolean} value Whether reordering is enabled.\n */\n set reorder(value) {\n if (value) this.setAttribute('reorder', '');\n else this.removeAttribute('reorder');\n }\n\n /**\n * Indicates whether tree items can be reordered with the start slot handle.\n * @returns {boolean}\n */\n get reorder() {\n return this.hasAttribute('reorder');\n }\n\n /**\n * The class name for the component.\n * @type {string}\n */\n className = 'Tree';\n\n /**\n * Returns the CSS stylesheet for the component.\n * @static\n * @returns {CSSStyleSheet} The CSS stylesheet\n */\n static get cssStyleSheet() {\n return styles;\n }\n\n /**\n * Setup attributes for the Button element.\n */\n setupAttributes() {\n this.isShadowRoot = 'open';\n this.syncAria();\n }\n\n /**\n * A method called before the drawing or rendering process of tree items.\n * It iterates through all `wje-tree-item` elements, updating their selection state\n * and managing their expand/collapse icons accordingly.\n * @returns {void} This method does not return a value.\n */\n beforeDraw() {\n const template = this.querySelector('template');\n const items = this.querySelectorAll('wje-tree-item');\n items?.forEach((item) => {\n item.selection = this.selection;\n item.syncNestingState?.();\n\n this.appendTemplateSlot(item, template, 'expand');\n this.appendTemplateSlot(item, template, 'collapse');\n this.appendTemplateSlot(item, template, 'start');\n this.appendTemplateSlot(item, template, 'end');\n\n if (this.reorder) this.setupReorderHandle(item);\n });\n }\n\n /**\n * Draw method for the tree.\n * @returns {object} Document fragment\n */\n draw() {\n let fragment = document.createDocumentFragment();\n\n let native = document.createElement('div');\n native.setAttribute('part', 'native');\n native.classList.add('native-tree');\n\n let slot = document.createElement('slot');\n\n native.appendChild(slot);\n\n fragment.appendChild(native);\n\n return fragment;\n }\n\n /**\n * Called after the draw process of the component is completed.\n * Typically used to add event listeners or perform operations\n * that are dependent on the component's drawn state.\n * @returns {void} This method does not return a value.\n */\n afterDraw() {\n this.addEventListener('click', this.handleClick);\n this.addEventListener('dragstart', this.handleDragStart);\n this.addEventListener('dragover', this.handleDragOver);\n this.addEventListener('drop', this.handleDrop);\n this.addEventListener('dragend', this.handleDragEnd);\n this.syncAria();\n }\n\n /**\n * Syncs ARIA attributes on the host element.\n */\n syncAria() {\n this.setAriaState({\n role: 'tree',\n multiselectable: this.selection === 'multiple' ? 'true' : undefined,\n });\n }\n\n beforeDisconnect() {\n this.removeEventListener('click', this.handleClick);\n this.removeEventListener('dragstart', this.handleDragStart);\n this.removeEventListener('dragover', this.handleDragOver);\n this.removeEventListener('drop', this.handleDrop);\n this.removeEventListener('dragend', this.handleDragEnd);\n }\n\n /**\n * Handles the click event triggered by the user interaction.\n * Identifies the closest tree item element to the event target and sets it\n * as the selected item. Ensures that only one item is selected at a time, resetting\n * the selection state for all other items.\n * @param {Event} e The click event object.\n */\n handleClick = (e) => {\n if (e?.preventDefault) e.preventDefault();\n if (this.reorder && this.isReorderHandleEvent(e)) return;\n\n const selectedItem = this.getTreeItemFromEvent(e);\n if (!selectedItem) return;\n\n const isClickButton = (e.composedPath?.() || []).some((el) => el?.classList?.contains('toggle'));\n if (isClickButton) return;\n\n if (this.selection === 'single') {\n for (let item of this.getAllItems()) {\n item.selected = item === selectedItem;\n }\n } else if (this.selection === 'multiple') {\n // let children = selectedItem.getAllChildrenFlat();\n selectedItem.selected = !selectedItem.selected;\n\n this.updateCheckboxState(selectedItem);\n }\n };\n\n /**\n * Starts dragging a tree item when the drag begins from the configured start slot handle.\n * @param {DragEvent} e The drag event.\n * @returns {void}\n */\n handleDragStart = (e) => {\n if (!this.reorder || !this.isReorderHandleEvent(e)) return;\n\n const item = this.getTreeItemFromEvent(e);\n if (!item) return;\n\n this.draggedItem = item;\n item.classList.add('wje-tree-dragging');\n\n if (e.dataTransfer) {\n e.dataTransfer.effectAllowed = 'move';\n e.dataTransfer.setData('text/plain', item.textContent?.trim() || '');\n }\n };\n\n /**\n * Updates the current drop target and exposes a visual drop position.\n * @param {DragEvent} e The drag event.\n * @returns {void}\n */\n handleDragOver = (e) => {\n if (!this.reorder || !this.draggedItem) return;\n\n const target = this.getTreeItemFromEvent(e);\n\n if (!this.canDrop(this.draggedItem, target)) {\n this.clearDropState();\n return;\n }\n\n e.preventDefault();\n if (e.dataTransfer) e.dataTransfer.dropEffect = 'move';\n\n const position = this.getDropPosition(e, target);\n this.setDropState(target, position);\n };\n\n /**\n * Completes a tree item move.\n * @param {DragEvent} e The drop event.\n * @returns {void}\n */\n handleDrop = (e) => {\n if (!this.reorder || !this.draggedItem) return;\n\n e.preventDefault();\n\n const target = this.dropTarget || this.getTreeItemFromEvent(e);\n const position = this.dropPosition || this.getDropPosition(e, target);\n const detail = this.moveItem(this.draggedItem, target, position);\n\n if (detail) {\n this.dispatchEvent(new CustomEvent('wje-tree:move', {\n detail,\n bubbles: true,\n composed: true,\n }));\n }\n\n this.clearDragState();\n };\n\n /**\n * Clears drag state after the browser drag operation ends.\n * @returns {void}\n */\n handleDragEnd = () => {\n this.clearDragState();\n };\n\n /**\n * Retrieves all items that match the selector 'wje-tree-item' within the current context.\n * @returns {Array<Element>} An array of all matching DOM elements.\n */\n getAllItems() {\n return [...this.querySelectorAll('wje-tree-item')];\n }\n\n /**\n * Retrieves and appends a template slot to a tree item.\n * @param {HTMLElement} item The DOM element to which the slot content will be appended.\n * @param {HTMLTemplateElement|null} template Template that may provide reusable slot content.\n * @param {string} slotName Name of the projected slot content to clone.\n * @returns {void}\n */\n appendTemplateSlot(item, template, slotName) {\n const slot = template?.content.querySelector(`[slot=\"${slotName}\"]`);\n if (!slot) return;\n\n const templateSlotClass = this.getTemplateSlotClass(slotName);\n const existing = item.querySelector(`:scope > [slot=\"${slotName}\"].${templateSlotClass}`);\n if (existing) return;\n\n const slotClone = slot.cloneNode(true);\n slotClone.classList.add('wje-tree-template-slot', templateSlotClass);\n item.append(slotClone);\n }\n\n /**\n * Returns the internal class used to identify cloned template slot content.\n * @param {string} slotName Name of the projected slot.\n * @returns {string}\n */\n getTemplateSlotClass(slotName) {\n return `wje-tree-template-slot-${slotName}`;\n }\n\n /**\n * Marks direct start slot content as the drag handle for reorderable trees.\n * @param {HTMLElement} item Host item that receives draggable start content.\n * @returns {void}\n */\n setupReorderHandle(item) {\n const handles = item.querySelectorAll(':scope > [slot=\"start\"]');\n\n handles.forEach((handle) => {\n handle.setAttribute('draggable', 'true');\n handle.classList.add('wje-tree-drag-handle');\n\n if (!handle.hasAttribute('aria-label')) {\n handle.setAttribute('aria-label', 'Move tree item');\n }\n });\n }\n\n /**\n * Finds a tree item from a composed event path.\n * @param {Event} e User interaction that may originate inside shadow DOM.\n * @returns {HTMLElement|null}\n */\n getTreeItemFromEvent(e) {\n const path = e.composedPath?.() || [];\n const pathItem = path.find((el) => this.isTreeItem(el) && this.contains(el));\n if (pathItem) return pathItem;\n\n const targetItem = e.target?.closest?.('wje-tree-item');\n return targetItem && this.contains(targetItem) ? targetItem : null;\n }\n\n /**\n * Checks whether the event started from a reorder handle.\n * @param {Event} e User interaction to inspect.\n * @returns {boolean}\n */\n isReorderHandleEvent(e) {\n return (e.composedPath?.() || []).some((el) => el?.classList?.contains('wje-tree-drag-handle'));\n }\n\n /**\n * Checks whether a node is a tree item element.\n * @param {object} node The node to inspect.\n * @returns {boolean}\n */\n isTreeItem(node) {\n return node instanceof Element && node.localName === 'wje-tree-item';\n }\n\n /**\n * Returns direct tree item children for a tree or tree item parent.\n * @param {HTMLElement} parent The parent element.\n * @returns {HTMLElement[]}\n */\n getDirectTreeItems(parent) {\n return Array.from(parent?.children || []).filter((child) => this.isTreeItem(child));\n }\n\n /**\n * Gets the index of a tree item among direct tree item siblings.\n * @param {HTMLElement} item Element whose sibling position should be resolved.\n * @returns {number}\n */\n getTreeItemIndex(item) {\n return this.getDirectTreeItems(item.parentElement).indexOf(item);\n }\n\n /**\n * Determines whether the dragged item can be dropped on the target.\n * @param {HTMLElement} draggedItem Item currently being moved.\n * @param {HTMLElement} targetItem Candidate item under the pointer.\n * @returns {boolean}\n */\n canDrop(draggedItem, targetItem) {\n return !!draggedItem && !!targetItem && draggedItem !== targetItem && !draggedItem.contains(targetItem);\n }\n\n /**\n * Resolves the drop position against the visible tree item row.\n * @param {DragEvent} e Browser drag event carrying pointer coordinates.\n * @param {HTMLElement|null} target Item used to calculate row boundaries.\n * @returns {'before'|'inside'|'after'}\n */\n getDropPosition(e, target) {\n const row = target?.shadowRoot?.querySelector('.item');\n const rect = row?.getBoundingClientRect?.() || target?.getBoundingClientRect?.();\n\n if (!rect) return 'after';\n\n const topBoundary = rect.top + rect.height * 0.25;\n const bottomBoundary = rect.bottom - rect.height * 0.25;\n\n if (e.clientY < topBoundary) return 'before';\n if (e.clientY > bottomBoundary) return 'after';\n\n return 'inside';\n }\n\n /**\n * Applies the visual drop position to the current target item.\n * @param {HTMLElement} target Item currently showing insertion feedback.\n * @param {string} position Resolved insertion area for the target row.\n * @returns {void}\n */\n setDropState(target, position) {\n if (this.dropTarget !== target || this.dropPosition !== position) {\n this.clearDropState();\n this.dropTarget = target;\n this.dropPosition = position;\n target.classList.add(this.getDropPositionClass(position));\n }\n }\n\n /**\n * Clears visual drop target state.\n * @returns {void}\n */\n clearDropState() {\n this.dropTarget?.classList.remove(\n this.getDropPositionClass('before'),\n this.getDropPositionClass('inside'),\n this.getDropPositionClass('after')\n );\n this.dropTarget = null;\n this.dropPosition = null;\n }\n\n /**\n * Clears the active drag state.\n * @returns {void}\n */\n clearDragState() {\n this.draggedItem?.classList.remove('wje-tree-dragging');\n this.clearDropState();\n this.draggedItem = null;\n }\n\n /**\n * Returns the internal class used to render a drop marker.\n * @param {'before'|'inside'|'after'} position Drop marker position.\n * @returns {string}\n */\n getDropPositionClass(position) {\n return `wje-tree-drop-${position}`;\n }\n\n /**\n * Moves a tree item relative to another tree item and syncs nesting metadata.\n * @param {HTMLElement} draggedItem The item being moved.\n * @param {HTMLElement} targetItem Item that receives or anchors the moved item.\n * @param {'before'|'inside'|'after'} position The target position.\n * @returns {object|null} Move detail, or null when the move is invalid.\n */\n moveItem(draggedItem, targetItem, position = 'after') {\n if (!this.canDrop(draggedItem, targetItem)) return null;\n\n const fromParent = draggedItem.parentElement;\n const fromParentItem = fromParent?.closest?.('wje-tree-item');\n const fromIndex = this.getTreeItemIndex(draggedItem);\n\n if (position === 'inside') {\n targetItem.appendChild(draggedItem);\n targetItem.setChildrenExpanded?.(true);\n } else {\n const parent = targetItem.parentElement;\n const reference = position === 'before' ? targetItem : targetItem.nextSibling;\n parent.insertBefore(draggedItem, reference);\n }\n\n this.syncTreeItems();\n\n const toParent = draggedItem.parentElement;\n const toParentItem = toParent?.closest?.('wje-tree-item');\n const toIndex = this.getTreeItemIndex(draggedItem);\n const orderElements = this.getOrderElements(toParent);\n const order = orderElements.map((item) => item.innerText.trim());\n\n this.refreshMovedItems([fromParentItem, toParentItem, targetItem]);\n\n return {\n item: draggedItem,\n target: targetItem,\n position,\n from: fromIndex,\n to: toIndex,\n order,\n orderElements,\n orderIds: this.getOrderIds(toParent),\n itemId: this.getItemId(draggedItem),\n targetId: this.getItemId(targetItem),\n fromParentItem,\n toParentItem,\n fromParentId: this.getItemId(fromParentItem),\n toParentId: this.getItemId(toParentItem),\n fromParent,\n toParent,\n fromIndex,\n toIndex,\n };\n }\n\n /**\n * Returns cloned direct tree item children for an event detail.\n * @param {HTMLElement} parent Parent whose direct tree item children should be serialized.\n * @returns {HTMLElement[]}\n */\n getOrderElements(parent) {\n return this.getDirectTreeItems(parent).map((item) => {\n const clone = item.cloneNode(true);\n clone.querySelectorAll('.wje-tree-template-slot').forEach((slot) => slot.remove());\n return clone;\n });\n }\n\n /**\n * Returns stable ids for direct tree item children when they are available.\n * @param {HTMLElement} parent Parent whose direct tree item children should be serialized.\n * @returns {Array<string|null>}\n */\n getOrderIds(parent) {\n return this.getDirectTreeItems(parent).map((item) => this.getItemId(item));\n }\n\n /**\n * Gets an application-facing id from a tree item.\n * @param {HTMLElement|null} item Tree item to read.\n * @returns {string|null}\n */\n getItemId(item) {\n if (!this.isTreeItem(item)) return null;\n return item.getAttribute('value') || item.id || null;\n }\n\n /**\n * Syncs item selection mode and nesting metadata after a DOM move.\n * @returns {void}\n */\n syncTreeItems() {\n this.getAllItems().forEach((item) => {\n item.selection = this.selection;\n item.syncNestingState?.();\n item.syncAria?.();\n });\n }\n\n /**\n * Redraws affected parent items so expand/collapse affordances match current children.\n * @param {HTMLElement[]} items Items that may need refresh.\n * @returns {void}\n */\n refreshMovedItems(items) {\n [...new Set(items)].forEach((item) => {\n if (this.isTreeItem(item)) item.refresh?.();\n });\n }\n\n /**\n * Updates the state of a checkbox, syncing the state both upwards to parent elements\n * and downwards to child elements as necessary.\n * @param {object} changedItem The specific item whose checkbox state has changed.\n * @param {boolean} [isInitialSync] Indicates whether the state update is part of the initial synchronization process.\n * @returns {void} This method does not return a value.\n */\n updateCheckboxState(changedItem, isInitialSync = false) {\n this.isInitialSync = isInitialSync;\n this.propagateStateDownwards(changedItem);\n this.propagateStateUpwards(changedItem);\n }\n\n /**\n * Updates the state of the parent item based on the state of its child items.\n * Recursively propagates changes up to all parent items to reflect the selection\n * or indeterminate state accurately.\n * @param {object} item The current tree item whose parent state needs to be updated.\n * It is expected to have properties `selected`, `indeterminate`,\n * and a method `getChildrenItems({ includeDisabled: boolean })`.\n * @returns {void} This method does not return a value.\n */\n updateParentState(item) {\n const children = item.getChildrenItems({ includeDisabled: false });\n\n if (children.length) {\n const areAllChildrenChecked = children.every((child) => child.selected);\n const areSomeChildrenChecked = children.some((child) => child.selected);\n const areSomeChildrenIndeterminate = children.some((child) => child.indeterminate);\n\n item.selected = areAllChildrenChecked;\n item.indeterminate = areSomeChildrenIndeterminate || (areSomeChildrenChecked && !areAllChildrenChecked);\n } else {\n item.indeterminate = false;\n }\n\n const parent = item.parentElement?.closest('wje-tree-item');\n if (parent) {\n this.updateParentState(parent);\n }\n }\n\n /**\n * Propagates the state changes of an item upwards through its ancestors in the hierarchy.\n * Calls the `updateParentState` method for each parent element until no parent exists.\n * @param {HTMLElement} item The current item whose state to propagate to its parent.\n * @returns {void} This method does not return a value.\n */\n propagateStateUpwards(item) {\n const parent = item.parentElement?.closest('wje-tree-item');\n\n if (parent) {\n this.updateParentState(parent);\n this.propagateStateUpwards(parent);\n }\n }\n\n /**\n * Propagates the selected state of an item to its children recursively. Depending on the `isInitialSync` flag,\n * it also determines how the state should be applied to the child items and updates the parent state if needed.\n * @param {object} item The item whose state is being propagated to its child items. The item must have properties\n * such as `selected` and methods like `getChildrenItems` to retrieve its child elements.\n * @returns {void} This method does not return a value.\n */\n propagateStateDownwards(item) {\n const isChecked = item.selected;\n\n item.getChildrenItems().forEach((child) => {\n child.selected = this.isInitialSync ? isChecked || child.selected : !child.disabled && isChecked;\n this.propagateStateDownwards(child);\n });\n\n if (this.isInitialSync) {\n this.updateParentState(item);\n }\n }\n}\n","import Tree from './tree.element.js';\n\nexport default Tree;\n\nTree.define('wje-tree', Tree);\n"],"names":["_a"],"mappings":";;;;;AAiBe,MAAM,aAAa,UAAU;AAAA;AAAA;AAAA;AAAA,EAIxC,cAAc;AACV,UAAK;AA6CT;AAAA;AAAA;AAAA;AAAA,qCAAY;AAqGZ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uCAAc,CAAC,MAAM;;AACjB,UAAI,uBAAG,eAAgB,GAAE,eAAc;AACvC,UAAI,KAAK,WAAW,KAAK,qBAAqB,CAAC,EAAG;AAElD,YAAM,eAAe,KAAK,qBAAqB,CAAC;AAChD,UAAI,CAAC,aAAc;AAEnB,YAAM,mBAAiB,OAAE,iBAAF,+BAAsB,CAAA,GAAI,KAAK,CAAC,OAAE;;AAAK,gBAAAA,MAAA,yBAAI,cAAJ,gBAAAA,IAAe,SAAS;AAAA,OAAS;AAC/F,UAAI,cAAe;AAEnB,UAAI,KAAK,cAAc,UAAU;AAC7B,iBAAS,QAAQ,KAAK,eAAe;AACjC,eAAK,WAAW,SAAS;AAAA,QAC7B;AAAA,MACJ,WAAW,KAAK,cAAc,YAAY;AAEtC,qBAAa,WAAW,CAAC,aAAa;AAEtC,aAAK,oBAAoB,YAAY;AAAA,MACzC;AAAA,IACJ;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA,2CAAkB,CAAC,MAAM;;AACrB,UAAI,CAAC,KAAK,WAAW,CAAC,KAAK,qBAAqB,CAAC,EAAG;AAEpD,YAAM,OAAO,KAAK,qBAAqB,CAAC;AACxC,UAAI,CAAC,KAAM;AAEX,WAAK,cAAc;AACnB,WAAK,UAAU,IAAI,mBAAmB;AAEtC,UAAI,EAAE,cAAc;AAChB,UAAE,aAAa,gBAAgB;AAC/B,UAAE,aAAa,QAAQ,gBAAc,UAAK,gBAAL,mBAAkB,WAAU,EAAE;AAAA,MAC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,+BAA+B,SAAS,KAAK,CAAC,UAAU,MAAM,aAAa;AAEjF,WAAK,WAAW;AAChB,WAAK,gBAAgB,gCAAiC,0BAA0B,CAAC;AAAA,IACrF,OAAO;AACH,WAAK,gBAAgB;AAAA,IACzB;AAEA,UAAM,UAAS,UAAK,kBAAL,mBAAoB,QAAQ;AAC3C,QAAI,QAAQ;AACR,WAAK,kBAAkB,MAAM;AAAA,IACjC;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,sBAAsB,MAAM;;AACxB,UAAM,UAAS,UAAK,kBAAL,mBAAoB,QAAQ;AAE3C,QAAI,QAAQ;AACR,WAAK,kBAAkB,MAAM;AAC7B,WAAK,sBAAsB,MAAM;AAAA,IACrC;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,wBAAwB,MAAM;AAC1B,UAAM,YAAY,KAAK;AAEvB,SAAK,iBAAgB,EAAG,QAAQ,CAAC,UAAU;AACvC,YAAM,WAAW,KAAK,gBAAgB,aAAa,MAAM,WAAW,CAAC,MAAM,YAAY;AACvF,WAAK,wBAAwB,KAAK;AAAA,IACtC,CAAC;AAED,QAAI,KAAK,eAAe;AACpB,WAAK,kBAAkB,IAAI;AAAA,IAC/B;AAAA,EACJ;AACJ;ACvnBA,KAAK,OAAO,YAAY,IAAI;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wj-elements",
3
3
  "description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
4
- "version": "0.7.2",
4
+ "version": "0.7.4",
5
5
  "homepage": "https://github.com/lencys/wj-elements",
6
6
  "author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
7
7
  "license": "MIT",