@genexus/genexus-ide-ui 0.0.30 → 0.0.31

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.
Files changed (78) hide show
  1. package/dist/cjs/ch-action-group_2.cjs.entry.js +2 -9
  2. package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
  3. package/dist/cjs/ch-dropdown-item.cjs.entry.js +8 -8
  4. package/dist/cjs/ch-dropdown.cjs.entry.js +11 -10
  5. package/dist/cjs/ch-suggest_4.cjs.entry.js +1 -0
  6. package/dist/cjs/ch-test-action-group.cjs.entry.js +2 -2
  7. package/dist/cjs/ch-test-tree-x.cjs.entry.js +150 -80
  8. package/dist/cjs/ch-tree-x_3.cjs.entry.js +211 -132
  9. package/dist/cjs/ch-window_2.cjs.entry.js +28 -12
  10. package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
  11. package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +1 -1
  12. package/dist/cjs/gxg-combo-box_6.cjs.entry.js +10 -4
  13. package/dist/cjs/gxg-date-picker.cjs.entry.js +4 -4
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/collection/components/team-dev-commit/team-dev-commit.js +1 -1
  16. package/dist/components/action-group-item.js +1 -9
  17. package/dist/components/action-group.js +1 -1
  18. package/dist/components/ch-suggest2.js +1 -0
  19. package/dist/components/ch-test-action-group.js +2 -2
  20. package/dist/components/ch-test-tree-x.js +157 -83
  21. package/dist/components/ch-window2.js +31 -13
  22. package/dist/components/checkbox.js +1 -1
  23. package/dist/components/combo-box-item.js +2 -2
  24. package/dist/components/combo-box.js +8 -2
  25. package/dist/components/dropdown-item.js +8 -8
  26. package/dist/components/dropdown.js +11 -10
  27. package/dist/components/gx-ide-team-dev-commit.js +1 -1
  28. package/dist/components/gxg-date-picker.js +4 -4
  29. package/dist/components/tree-x-list-item.js +31 -17
  30. package/dist/components/tree-x-list.js +9 -4
  31. package/dist/components/tree-x.js +182 -117
  32. package/dist/esm/ch-action-group_2.entry.js +2 -9
  33. package/dist/esm/ch-checkbox.entry.js +1 -1
  34. package/dist/esm/ch-dropdown-item.entry.js +8 -8
  35. package/dist/esm/ch-dropdown.entry.js +11 -10
  36. package/dist/esm/ch-suggest_4.entry.js +1 -0
  37. package/dist/esm/ch-test-action-group.entry.js +2 -2
  38. package/dist/esm/ch-test-tree-x.entry.js +150 -80
  39. package/dist/esm/ch-tree-x_3.entry.js +211 -132
  40. package/dist/esm/ch-window_2.entry.js +28 -12
  41. package/dist/esm/genexus-ide-ui.js +1 -1
  42. package/dist/esm/gx-ide-team-dev-commit.entry.js +1 -1
  43. package/dist/esm/gxg-combo-box_6.entry.js +10 -4
  44. package/dist/esm/gxg-date-picker.entry.js +4 -4
  45. package/dist/esm/loader.js +1 -1
  46. package/dist/genexus-ide-ui/genexus-ide-ui.css +1 -1
  47. package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
  48. package/dist/genexus-ide-ui/p-1fe05a05.entry.js +1 -0
  49. package/dist/genexus-ide-ui/p-24f47ee2.entry.js +1 -0
  50. package/dist/genexus-ide-ui/{p-54bab171.entry.js → p-28d0afda.entry.js} +1 -1
  51. package/dist/genexus-ide-ui/{p-6050cdba.entry.js → p-48412811.entry.js} +1 -1
  52. package/dist/genexus-ide-ui/p-714bd8ea.entry.js +1 -0
  53. package/dist/genexus-ide-ui/p-8c2ab053.entry.js +1 -0
  54. package/dist/genexus-ide-ui/p-976e8118.entry.js +1 -0
  55. package/dist/genexus-ide-ui/p-a5463fc9.entry.js +1 -0
  56. package/dist/genexus-ide-ui/{p-cda1623a.entry.js → p-b54f448c.entry.js} +1 -1
  57. package/dist/genexus-ide-ui/p-bb1809cb.entry.js +1 -0
  58. package/dist/genexus-ide-ui/p-cf41f154.entry.js +1 -0
  59. package/dist/genexus-ide-ui/p-e8a21ed7.entry.js +1 -0
  60. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group-item/action-group-item.css +0 -1
  61. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/checkbox/checkbox.css +5 -3
  62. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown/dropdown.css +15 -33
  63. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown-item/dropdown-item.css +0 -4
  64. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-x.css +0 -10
  65. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x/tree-x.css +20 -3
  66. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x-list-item/tree-x-list-item.css +25 -8
  67. package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/window/ch-window.css +51 -2
  68. package/dist/node_modules/@genexus/gemini/dist/collection/components/combo-box-item/combo-box-item.css +1 -1
  69. package/package.json +3 -3
  70. package/dist/genexus-ide-ui/p-097a3eeb.entry.js +0 -1
  71. package/dist/genexus-ide-ui/p-3d9a4ede.entry.js +0 -1
  72. package/dist/genexus-ide-ui/p-4bbe1c18.entry.js +0 -1
  73. package/dist/genexus-ide-ui/p-5c64c57f.entry.js +0 -1
  74. package/dist/genexus-ide-ui/p-5ff04ebe.entry.js +0 -1
  75. package/dist/genexus-ide-ui/p-757f8567.entry.js +0 -1
  76. package/dist/genexus-ide-ui/p-8d46f8d8.entry.js +0 -1
  77. package/dist/genexus-ide-ui/p-a0e85c2a.entry.js +0 -1
  78. package/dist/genexus-ide-ui/p-f8561da6.entry.js +0 -1
@@ -1,23 +1,41 @@
1
1
  import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, w as writeTask } from './index-0da01575.js';
2
2
  import { m as mouseEventModifierKey } from './helpers-56190205.js';
3
3
 
4
- const treeXCss = "ch-tree-x{display:flex}ch-tree-x.ch-tree-x-dragging-item :not(.ch-tree-x-list-item--accept-drop){pointer-events:none}ch-tree-x.ch-tree-x-dragging-item .ch-tree-x-list-item--accept-drop{pointer-events:all}ch-tree-x.ch-tree-x-waiting-drop-processing{cursor:wait}ch-tree-x.ch-tree-x-waiting-drop-processing>ch-tree-x-list{pointer-events:none}.ch-tree-x-drag-info{--rtl-offset:16px;position:fixed;left:0;top:0;transform:translate(calc(var(--ch-tree-x-dragging-item-x) + var(--rtl-offset)), calc(var(--ch-tree-x-dragging-item-y) + 8px));pointer-events:none;z-index:1}html[dir=rtl] .ch-tree-x-drag-info{--rtl-offset:-100%}";
4
+ const scrollToEdge = (event, container, scrollSpeed, scrollThreshold) => {
5
+ const mousePositionY = event.clientY - container.getBoundingClientRect().top;
6
+ const containerHeight = container.clientHeight;
7
+ const mouseAtTheTop = mousePositionY <= scrollThreshold;
8
+ const mouseAtTheBottom = mousePositionY > containerHeight - scrollThreshold;
9
+ if (mouseAtTheTop || mouseAtTheBottom) {
10
+ const scrollAmount = mouseAtTheTop
11
+ ? mousePositionY - scrollThreshold
12
+ : mousePositionY - (containerHeight - scrollThreshold);
13
+ // Adjust container scroll position
14
+ container.scrollTop += scrollAmount / scrollSpeed;
15
+ }
16
+ };
17
+
18
+ const treeXCss = "ch-tree-x{display:flex;position:relative;overflow:auto}ch-tree-x>ch-tree-x-list{position:absolute;inset:0;min-width:max-content}ch-tree-x.ch-tree-x-dragging-item ch-tree-x-list-item{pointer-events:var(--ch-tree-x-pointer-events, all)}ch-tree-x.ch-tree-x-dragging-item .ch-tree-x-list-item--deny-drop,ch-tree-x.ch-tree-x-dragging-item ch-tree-x-list{pointer-events:none}ch-tree-x.ch-tree-x--dragging-selected-items ch-tree-x-list-item[selected]{--ch-tree-x-pointer-events:none}ch-tree-x.ch-tree-x-waiting-drop-processing{cursor:wait}ch-tree-x.ch-tree-x-waiting-drop-processing>ch-tree-x-list{pointer-events:none}.ch-tree-x-drag-info{--rtl-offset:16px;position:fixed;left:0;top:0;transform:translate(calc(var(--ch-tree-x-dragging-item-x) + var(--rtl-offset)), calc(var(--ch-tree-x-dragging-item-y) + 8px));pointer-events:none;z-index:1;animation:ch-tree-x-drag-info-fade-in 10ms}@keyframes ch-tree-x-drag-info-fade-in{0%,100%{opacity:0}}html[dir=rtl] .ch-tree-x-drag-info{--rtl-offset:-100%}";
5
19
 
6
20
  const TREE_ITEM_TAG_NAME$1 = "ch-tree-x-list-item";
7
21
  const TREE_LIST_TAG_NAME = "ch-tree-x-list";
8
22
  // Selectors
9
23
  const TREE_LIST_AND_ITEM_SELECTOR = TREE_LIST_TAG_NAME + "," + TREE_ITEM_TAG_NAME$1;
10
24
  // const CHECKED_ITEMS = `${TREE_ITEM_TAG_NAME}[checked]`;
25
+ const TEXT_FORMAT = "text/plain";
11
26
  const ARROW_DOWN_KEY = "ArrowDown";
12
27
  const ARROW_UP_KEY = "ArrowUp";
13
28
  const EDIT_KEY = "F2";
14
29
  const isExecutedInTree = (event, el) => event.composedPath().includes(el);
15
30
  const treeItemIsInEditMode = () => document.activeElement.editing;
31
+ const getDroppableZoneKey = (newContainerId, draggedItems) => `"newContainerId":"${newContainerId}","metadata":"${JSON.stringify(draggedItems)}"`;
16
32
  const POSITION_X_DRAG_CUSTOM_VAR = "--ch-tree-x-dragging-item-x";
17
33
  const POSITION_Y_DRAG_CUSTOM_VAR = "--ch-tree-x-dragging-item-y";
18
34
  const ChTreeX = class {
19
35
  constructor(hostRef) {
20
36
  registerInstance(this, hostRef);
37
+ this.droppableZoneEnter = createEvent(this, "droppableZoneEnter", 7);
38
+ this.expandedItemChange = createEvent(this, "expandedItemChange", 7);
21
39
  this.selectedItemsChange = createEvent(this, "selectedItemsChange", 7);
22
40
  this.itemsDropped = createEvent(this, "itemsDropped", 7);
23
41
  // @todo TODO: Check if key codes works in Safari
@@ -46,13 +64,18 @@ const ChTreeX = class {
46
64
  document.activeElement.editing = true;
47
65
  }
48
66
  };
67
+ this.draggingSelectedItems = false;
49
68
  this.needForRAF = true; // To prevent redundant RAF (request animation frame) calls
50
- this.lastPageX = 0;
51
- this.lastPageY = 0;
52
69
  this.selectedItemsInfo = new Map();
70
+ /**
71
+ * Cache to avoid duplicate requests when checking the droppable zone in the
72
+ * same drag event.
73
+ */
74
+ this.validDroppableZoneCache = new Map();
53
75
  this.draggedIds = [];
54
76
  this.draggedParentIds = [];
55
- this.draggingItem = false;
77
+ this.draggingInTheDocument = false;
78
+ this.draggingInTree = false;
56
79
  /**
57
80
  * Level in the tree at which the control is placed.
58
81
  */
@@ -66,54 +89,41 @@ const ChTreeX = class {
66
89
  * over in a subtree to open it when dragging.
67
90
  */
68
91
  this.openSubTreeCountdown = 750;
92
+ /**
93
+ * `true` to scroll in the tree when dragging an item near the edges of the
94
+ * tree.
95
+ */
96
+ this.scrollToEdgeOnDrag = true;
69
97
  /**
70
98
  * `true` to display the relation between tree items and tree lists using
71
99
  * lines.
72
100
  */
73
- this.showLines = false;
101
+ this.showLines = "none";
74
102
  /**
75
103
  * This property lets you specify if the tree is waiting to process the drop
76
104
  * of items.
77
105
  */
78
106
  this.waitDropProcessing = false;
79
- this.trackItemDragEnter = (event) => {
80
- event.stopPropagation();
81
- const currentTarget = event.target;
82
- // Don't mark droppable zones if they are the dragged items or their direct parents
83
- if (!this.validDroppableZone(currentTarget.id)) {
84
- return;
85
- }
86
- // Check if it is a valid item
87
- if (currentTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
88
- return;
89
- }
90
- const treeItem = currentTarget;
91
- treeItem.dragState = "enter";
92
- this.openSubTreeAfterCountdown(treeItem);
93
- };
94
- this.validDroppableZone = (draggedItemId) => !this.draggedIds.includes(draggedItemId) &&
95
- !this.draggedParentIds.includes(draggedItemId);
96
- this.trackItemDragLeave = (event) => {
97
- const currentTarget = event.target;
98
- if (currentTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
99
- return;
100
- }
101
- const treeItem = currentTarget;
102
- treeItem.dragState = "none";
103
- this.cancelSubTreeOpening(treeItem);
104
- };
105
107
  this.trackItemDrag = (event) => {
106
108
  event.preventDefault();
107
- this.lastPageX = event.pageX;
108
- this.lastPageY = event.pageY;
109
+ this.lastDragEvent = event;
109
110
  if (!this.needForRAF) {
110
111
  return;
111
112
  }
112
113
  this.needForRAF = false; // No need to call RAF up until next frame
113
114
  requestAnimationFrame(() => {
114
115
  this.needForRAF = true; // RAF now consumes the movement instruction so a new one can come
115
- this.el.style.setProperty(POSITION_X_DRAG_CUSTOM_VAR, `${this.lastPageX}px`);
116
- this.el.style.setProperty(POSITION_Y_DRAG_CUSTOM_VAR, `${this.lastPageY}px`);
116
+ this.el.style.setProperty(POSITION_X_DRAG_CUSTOM_VAR, `${this.lastDragEvent.pageX}px`);
117
+ this.el.style.setProperty(POSITION_Y_DRAG_CUSTOM_VAR, `${this.lastDragEvent.pageY}px`);
118
+ });
119
+ };
120
+ this.fixScrollPositionOnDrag = () => {
121
+ if (!this.draggingInTree || !this.lastDragEvent) {
122
+ return;
123
+ }
124
+ requestAnimationFrame(() => {
125
+ scrollToEdge(this.lastDragEvent, this.el, 10, 30);
126
+ requestAnimationFrame(this.fixScrollPositionOnDrag);
117
127
  });
118
128
  };
119
129
  this.handleKeyDownEvents = (event) => {
@@ -148,37 +158,26 @@ const ChTreeX = class {
148
158
  itemRef.scrollIntoView();
149
159
  });
150
160
  }
151
- // /**
152
- // * This method is used to toggle a tree item by the tree item id/ids.
153
- // *
154
- // * @param treeItemIds An array id the tree items to be toggled.
155
- // * @param expand A boolean indicating that the tree item should be expanded or collapsed. (optional)
156
- // * @returns The modified items after the method was called.
157
- // */
158
- // @Method()
159
- // async toggleItems(
160
- // treeItemIds: string[],
161
- // expand?: boolean
162
- // ): Promise<ExpandedTreeItemInfo[]> {
163
- // if (!treeItemIds) {
164
- // return [];
165
- // }
166
- // const allTreeItems = Array.from(
167
- // this.el.querySelectorAll(TREE_ITEM_TAG_NAME)
168
- // );
169
- // const modifiedTreeItems: ExpandedTreeItemInfo[] = [];
170
- // treeItemIds.forEach(treeItemId => {
171
- // const treeItem = allTreeItems.find(item => treeItemId === item.id);
172
- // if (treeItem) {
173
- // treeItem.expanded = expand ?? !treeItem.expanded;
174
- // modifiedTreeItems.push({
175
- // id: treeItem.id,
176
- // expanded: treeItem.expanded
177
- // });
178
- // }
179
- // });
180
- // return modifiedTreeItems;
181
- // }
161
+ /**
162
+ * Update the information about the valid droppable zones.
163
+ * @param requestTimestamp Time where the request to the server was made. Useful to avoid having old information.
164
+ * @param newContainerId ID of the container where the drag is trying to be made.
165
+ * @param draggedItems Information about the dragged items.
166
+ * @param validDrop Current state of the droppable zone.
167
+ */
168
+ async updateValidDroppableZone(requestTimestamp, newContainerId, draggedItems, validDrop) {
169
+ var _a;
170
+ if (!this.draggingInTheDocument ||
171
+ requestTimestamp <= this.dragStartTimestamp) {
172
+ return;
173
+ }
174
+ const droppableZoneKey = getDroppableZoneKey(newContainerId, draggedItems);
175
+ this.validDroppableZoneCache.set(droppableZoneKey, validDrop ? "valid" : "invalid");
176
+ const shouldUpdateDragEnterInCurrentContainer = ((_a = this.lastOpenSubTreeItem) === null || _a === void 0 ? void 0 : _a.id) === newContainerId;
177
+ if (shouldUpdateDragEnterInCurrentContainer) {
178
+ this.lastOpenSubTreeItem.dragState = "enter";
179
+ }
180
+ }
182
181
  // /**
183
182
  // * Returns an array of the selected tree items, providing the id, caption and
184
183
  // * selected status.
@@ -194,98 +193,160 @@ const ChTreeX = class {
194
193
  // selected: item.selected
195
194
  // }));
196
195
  // }
196
+ // We can't use capture, because the dataTransfer info would not be defined
197
+ // Also, we cant use capture and setTimeout with 0 seconds, because the
198
+ // getData method can only be accessed during the dragstart and drop event
199
+ handleDragStart(event) {
200
+ // Reset the validity of the droppable zones with each new drag start
201
+ this.validDroppableZoneCache.clear();
202
+ this.draggingInTheDocument = true;
203
+ this.dragStartTimestamp = new Date().getTime();
204
+ this.draggedItems = JSON.parse(event.dataTransfer.getData(TEXT_FORMAT));
205
+ }
206
+ handleDragEnd() {
207
+ this.draggingInTheDocument = false;
208
+ }
209
+ handleDragEnter(event) {
210
+ this.cancelSubTreeOpening(null, true);
211
+ event.stopPropagation();
212
+ const containerTarget = event.target;
213
+ // Check if it is a valid item
214
+ if (containerTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
215
+ return;
216
+ }
217
+ this.lastOpenSubTreeItem = containerTarget;
218
+ this.openSubTreeAfterCountdown(containerTarget);
219
+ if (this.validDroppableZone(event) === "valid") {
220
+ containerTarget.dragState = "enter";
221
+ }
222
+ }
223
+ handleDragLeave(event) {
224
+ const currentTarget = event.target;
225
+ if (currentTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
226
+ return;
227
+ }
228
+ const treeItem = currentTarget;
229
+ treeItem.dragState = "none";
230
+ this.cancelSubTreeOpening(treeItem);
231
+ }
232
+ cancelSubTreeOpening(treeItem, forceClear = false) {
233
+ if (this.lastOpenSubTreeItem === treeItem || forceClear) {
234
+ clearTimeout(this.openSubTreeTimeout);
235
+ this.lastOpenSubTreeItem = null;
236
+ }
237
+ }
238
+ handleItemDrop(event) {
239
+ event.stopPropagation();
240
+ this.cancelSubTreeOpening(null, true);
241
+ const newContainer = event.target;
242
+ const draggedItems = JSON.parse(event.dataTransfer.getData(TEXT_FORMAT));
243
+ // The droppable zone must be checked, even if it was marked as not valid
244
+ // @todo Try to drop an item with high delays in droppable zone checking
245
+ if (this.validDroppableZone(event) !== "valid") {
246
+ return;
247
+ }
248
+ this.itemsDropped.emit({
249
+ newContainer: { id: newContainer.id, metadata: newContainer.metadata },
250
+ draggedItems: draggedItems,
251
+ dropInTheSameTree: this.draggingInTree
252
+ });
253
+ }
197
254
  handleItemDragStart(event) {
198
255
  document.body.addEventListener("dragover", this.trackItemDrag, {
199
256
  capture: true
200
257
  });
201
258
  this.currentDraggedItem = event.target;
202
259
  this.updateDragInfo(event.detail);
203
- this.el.addEventListener("dragenter", this.trackItemDragEnter, {
204
- capture: true,
205
- passive: true
206
- });
207
- this.el.addEventListener("dragleave", this.trackItemDragLeave, {
208
- capture: true,
209
- passive: true
210
- });
211
- // Wait until the custom var values are updated to avoid flickering
212
- setTimeout(() => {
213
- this.draggingItem = true;
214
- }, 10);
260
+ this.draggingInTree = true;
261
+ if (this.scrollToEdgeOnDrag) {
262
+ this.fixScrollPositionOnDrag();
263
+ }
215
264
  }
216
265
  handleItemDragEnd() {
217
- this.draggingItem = false;
266
+ this.draggingInTree = false;
218
267
  document.body.removeEventListener("dragover", this.trackItemDrag, {
219
268
  capture: true
220
269
  });
221
- this.el.removeEventListener("dragenter", this.trackItemDragEnter, {
222
- capture: true
223
- });
224
- this.el.removeEventListener("dragleave", this.trackItemDragLeave, {
225
- capture: true
226
- });
227
270
  // Reset not allowed droppable ids
228
271
  this.resetVariables();
229
272
  }
230
- handleItemDrop(event) {
231
- event.stopPropagation();
232
- this.cancelSubTreeOpening(null, true);
233
- const selectedItemEl = event.target;
234
- if (!this.validDroppableZone(selectedItemEl.id)) {
235
- return;
236
- }
237
- this.itemsDropped.emit(event.detail);
238
- }
239
273
  handleSelectedItemChange(event) {
240
274
  event.stopPropagation();
241
275
  const selectedItemInfo = event.detail;
242
276
  const selectedItemEl = event.target;
243
277
  this.handleItemSelection(selectedItemEl, selectedItemInfo);
244
278
  }
245
- openSubTreeAfterCountdown(treeItem) {
246
- this.cancelSubTreeOpening(treeItem);
247
- if (treeItem.leaf || treeItem.expanded) {
279
+ validDroppableZone(event) {
280
+ const containerTarget = event.target;
281
+ // When dragging in the same tree, don't mark droppable zones if they are
282
+ // the dragged items or their direct parents
283
+ if (this.draggingInTree &&
284
+ (this.draggedIds.includes(containerTarget.id) ||
285
+ this.draggedParentIds.includes(containerTarget.id))) {
286
+ return "invalid";
287
+ }
288
+ const cacheKey = getDroppableZoneKey(containerTarget.id, this.draggedItems);
289
+ const droppableZoneState = this.validDroppableZoneCache.get(cacheKey);
290
+ if (droppableZoneState != null) {
291
+ return droppableZoneState;
292
+ }
293
+ this.validDroppableZoneCache.set(cacheKey, "checking");
294
+ this.droppableZoneEnter.emit({
295
+ newContainer: {
296
+ id: containerTarget.id,
297
+ metadata: containerTarget.metadata
298
+ },
299
+ draggedItems: this.draggedItems
300
+ });
301
+ return "checking";
302
+ }
303
+ openSubTreeAfterCountdown(currentTarget) {
304
+ if (currentTarget.leaf || currentTarget.expanded) {
248
305
  return;
249
306
  }
250
- this.lastOpenSubTreeItem = treeItem;
251
307
  this.openSubTreeTimeout = setTimeout(() => {
252
- treeItem.expanded = true;
308
+ currentTarget.expanded = true;
309
+ this.expandedItemChange.emit({ id: currentTarget.id, expanded: true });
253
310
  }, this.openSubTreeCountdown);
254
311
  }
255
- cancelSubTreeOpening(treeItem, forceClear = false) {
256
- if (this.lastOpenSubTreeItem === treeItem || forceClear) {
257
- clearTimeout(this.openSubTreeTimeout);
258
- }
259
- }
260
312
  resetVariables() {
261
313
  this.draggedIds = [];
262
314
  this.draggedParentIds = [];
263
315
  }
264
316
  /**
265
- * Update the dataTransfer in the drag event to store the ids of the dragged
266
- * items. Also it updates the visual information of the dragged items.
317
+ * Update the dataTransfer in the drag event to store the ids and metadata of
318
+ * the dragged items. Also it updates the visual information of the dragged
319
+ * items.
267
320
  */
268
321
  updateDragInfo(dragInfo) {
269
322
  const draggedElement = dragInfo.elem;
270
323
  const isDraggingSelectedItems = this.selectedItemsInfo.has(draggedElement.id);
271
- let joinedDraggedIds;
324
+ this.draggingSelectedItems = isDraggingSelectedItems;
325
+ let dataTransferInfo = [];
272
326
  if (isDraggingSelectedItems) {
273
327
  const selectedItemKeys = [...this.selectedItemsInfo.keys()];
274
328
  const selectedItemCount = selectedItemKeys.length;
275
329
  this.draggedIds = selectedItemKeys;
276
- joinedDraggedIds = selectedItemKeys.join(",");
330
+ dataTransferInfo = [...this.selectedItemsInfo.values()].map(el => ({
331
+ id: el.id,
332
+ metadata: el.metadata
333
+ }));
277
334
  this.dragInfo =
278
335
  selectedItemCount === 1
279
336
  ? draggedElement.caption
280
337
  : selectedItemCount.toString();
281
338
  }
282
339
  else {
283
- joinedDraggedIds = draggedElement.id;
284
- this.draggedIds = [joinedDraggedIds];
340
+ dataTransferInfo = [
341
+ { id: draggedElement.id, metadata: draggedElement.metadata }
342
+ ];
343
+ this.draggedIds = [draggedElement.id];
285
344
  this.dragInfo = draggedElement.caption;
286
345
  }
287
346
  this.getDirectParentsOfDraggableItems(isDraggingSelectedItems);
288
- dragInfo.dataTransfer.setData("text/plain", joinedDraggedIds);
347
+ // Update drag event info
348
+ const data = JSON.stringify(dataTransferInfo);
349
+ dragInfo.dataTransfer.setData(TEXT_FORMAT, data);
289
350
  }
290
351
  getDirectParentsOfDraggableItems(draggingSelectedItems) {
291
352
  if (!draggingSelectedItems) {
@@ -342,9 +403,10 @@ const ChTreeX = class {
342
403
  }
343
404
  render() {
344
405
  return (h(Host, { class: {
345
- "ch-tree-x-dragging-item": this.draggingItem,
406
+ "ch-tree-x-dragging-item": this.draggingInTheDocument,
407
+ "ch-tree-x--dragging-selected-items": this.draggingInTree && this.draggingSelectedItems,
346
408
  "ch-tree-x-waiting-drop-processing": this.waitDropProcessing
347
- } }, h("slot", null), this.draggingItem && (h("span", { "aria-hidden": "true", class: "ch-tree-x-drag-info" }, this.dragInfo))));
409
+ } }, h("slot", null), this.draggingInTree && (h("span", { "aria-hidden": "true", class: "ch-tree-x-drag-info" }, this.dragInfo))));
348
410
  }
349
411
  get el() { return getElement(this); }
350
412
  static get watchers() { return {
@@ -370,8 +432,13 @@ const ChTreeListX = class {
370
432
  * `true` to display the relation between tree items and tree lists using
371
433
  * lines.
372
434
  */
373
- this.showLines = true;
435
+ this.showLines = "none";
374
436
  this.updateLastItemDashedLine = () => {
437
+ // @todo WA to avoid StencilJS' bug. The showLines Watch is dispatched
438
+ // before the componentDidLoad lifecycle method completes
439
+ if (!this.slotRef) {
440
+ return;
441
+ }
375
442
  const treeItems = this.slotRef.assignedElements();
376
443
  if (treeItems.length === 0) {
377
444
  return;
@@ -385,7 +452,7 @@ const ChTreeListX = class {
385
452
  }
386
453
  handleShowLinesChange(newValue) {
387
454
  // Displayed items may have changed since the last time that `showLines === true`
388
- if (newValue) {
455
+ if (newValue !== "none" && this.level !== 0) {
389
456
  this.updateLastItemDashedLine();
390
457
  }
391
458
  }
@@ -402,7 +469,7 @@ const ChTreeListX = class {
402
469
  this.showLines = mainTreeRef$1.showLines;
403
470
  }
404
471
  render() {
405
- return (h(Host, { role: this.level === 0 ? "tree" : "group" }, h("slot", { onSlotchange: this.showLines && this.level !== 0
472
+ return (h(Host, { role: this.level === 0 ? "tree" : "group" }, h("slot", { onSlotchange: this.showLines !== "none" && this.level !== 0
406
473
  ? this.updateLastItemDashedLine
407
474
  : null, ref: el => (this.slotRef = el) })));
408
475
  }
@@ -413,7 +480,7 @@ const ChTreeListX = class {
413
480
  };
414
481
  ChTreeListX.style = treeXListCss;
415
482
 
416
- const treeXListItemCss = ":where(button){all:unset;display:flex;cursor:pointer;user-select:none;touch-action:manipulation;-webkit-user-drag:element}*,::before,::after{box-sizing:border-box}:host{--checkbox-size:1em;--expandable-button-width:12px;--tab-width:calc(\n var(--checkbox-size) + var(--expandable-button-width) +\n (5px * 2)\n );display:grid;grid-template-rows:min-content}.header{--own-offset:0px;display:flex;align-items:center;min-height:calc(1em + 6px);padding-inline-start:var(--padding-inline-start)}.header--disabled{opacity:0.5;pointer-events:none}.header--even{--padding-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width)\n )}.header--even+.expandable{--parent-padding-inline-start--even:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width)\n )}.header--even .dashed-line{--inset-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) +\n var(--parent-checkbox-offset) + var(--parent-expandable-offset)\n )}.header--even-expandable{--padding-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--even-expandable+.expandable{--parent-padding-inline-start--even:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--odd{--padding-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width)\n )}.header--odd+.expandable{--parent-padding-inline-start--odd:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width)\n )}.header--odd .dashed-line{--inset-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) +\n var(--parent-checkbox-offset) + var(--parent-expandable-offset)\n )}.header--odd-expandable{--padding-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--odd-expandable+.expandable{--parent-padding-inline-start--odd:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--level-0{--padding-inline-start:0px}.header--level-0+.expandable{--parent-padding-inline-start--even:0px}.header--expandable-offset{--own-offset:calc(\n var(--expandable-button-width) + 5px\n )}.header--expandable-offset+.expandable{--parent-expandable-offset:calc(var(--expandable-button-width) / 2)}.header--checkbox-offset+.expandable{--parent-checkbox-offset:calc(var(--checkbox-size) / 2);--parent-negative-checkbox-offset:calc(var(--checkbox-size) / 2)}.dashed-line{position:absolute;inset-inline-start:var(--inset-inline-start);height:1px;width:calc( var(--tab-width) - var(--parent-checkbox-offset) - var(--parent-expandable-offset) - var(--own-offset) - 4px );border:0 dashed #a9a9a9;border-block-end-width:1px;pointer-events:none;content-visibility:hidden;contain-intrinsic-size:auto 100px}.last-dashed-line{inset-block-start:0;height:calc(100% - var(--distance-to-checkbox));border-inline-start-width:1px;border-end-start-radius:2px;pointer-events:none}.expandable-button{display:grid;place-items:center;width:var(--expandable-button-width);height:var(--expandable-button-width);margin-inline-end:5px;z-index:1}.expandable-button::before{content:\"\";width:calc(100% - 2px);height:calc(100% - 2px);background-color:currentColor;-webkit-mask-size:calc(var(--expandable-button-width) - 2px)}.expandable-button--collapsed::before{-webkit-mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14.15,8.5H8.54v5.61h-1V8.5H1.93v-1H7.54V1.89h1V7.5h5.61Z\"/></svg>')}.expandable-button--expanded::before{-webkit-mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14.15,8.5H1.93v-1H14.15Z\"/></svg>')}.expandable-button:focus-visible{outline:1px solid #000}.checkbox{margin-inline-end:5px}.action{display:grid;grid-template:\"left-img text right-img\"/max-content 1fr max-content;align-items:center;height:100%;flex:1}.readonly-mode{padding-block:0.75px}.left-img,.right-img{display:block;width:0.875em;height:0.875em}.left-img{grid-area:left-img;margin-inline-end:6px}.right-img{grid-area:right-img;margin-inline-start:6px}.edit-name{grid-area:text;width:100%;height:100%;background-color:unset;padding:0;margin:0;border:1px solid currentColor;font:unset;outline:unset}.downloading{width:0.75em;height:0.75em;margin-inline-start:8px;border:2px solid currentColor;border-inline-start-color:transparent;border-radius:50%;opacity:0.75;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.expandable{--parent-expandable-offset:0px;--parent-negative-checkbox-offset:0px;--parent-checkbox-offset:0px;display:grid;grid-template-rows:0fr;content-visibility:auto;contain-intrinsic-size:auto 100px}.expanded{grid-template-rows:1fr}:not(.expanded) ::slotted([slot=tree]){display:none;overflow:hidden;content-visibility:hidden}";
483
+ const treeXListItemCss = ":where(button){all:unset;display:flex;cursor:pointer;user-select:none;touch-action:manipulation;-webkit-user-drag:element}*,::before,::after{box-sizing:border-box}:host{--checkbox-size:1em;--expandable-button-width:0.75em;--ch-tree-x-list-item-dashed-line--offset:0px;--tab-width:calc(\n var(--checkbox-size) + var(--expandable-button-width) +\n (5px * 2)\n );display:grid;grid-template-rows:min-content;overflow:hidden}.header{--own-offset:0px;display:flex;align-items:center;min-height:calc(1em + 6px);padding-inline-start:var(--padding-inline-start)}.header--disabled{opacity:0.5;pointer-events:none}.header--even{--padding-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width)\n )}.header--even+.expandable{--parent-padding-inline-start--even:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width)\n )}.header--even .dashed-line{--inset-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) +\n var(--parent-checkbox-offset) + var(--parent-expandable-offset)\n )}.header--even-expandable{--padding-inline-start:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--even-expandable+.expandable{--parent-padding-inline-start--even:calc(\n var(--parent-padding-inline-start--odd, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--odd{--padding-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width)\n )}.header--odd+.expandable{--parent-padding-inline-start--odd:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width)\n )}.header--odd .dashed-line{--inset-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) +\n var(--parent-checkbox-offset) + var(--parent-expandable-offset)\n )}.header--odd-expandable{--padding-inline-start:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--odd-expandable+.expandable{--parent-padding-inline-start--odd:calc(\n var(--parent-padding-inline-start--even, 0px) + var(--tab-width) - calc(\n var(--expandable-button-width) + 5px\n )\n )}.header--level-0{--padding-inline-start:0px}.header--level-0+.expandable{--parent-padding-inline-start--even:0px}.header--expandable-offset{--own-offset:calc(\n var(--expandable-button-width) + 5px\n )}.header--expandable-offset+.expandable{--parent-expandable-offset:calc(var(--expandable-button-width) / 2)}.header--checkbox-offset+.expandable{--parent-checkbox-offset:calc(var(--checkbox-size) / 2);--parent-negative-checkbox-offset:calc(var(--checkbox-size) / 2)}.dashed-line{position:absolute;inset-inline-start:calc( var(--inset-inline-start) + var(--ch-tree-x-list-item-dashed-line--offset) );height:1px;width:calc( var(--tab-width) - var(--parent-checkbox-offset) - var(--parent-expandable-offset) - var(--own-offset) - var(--ch-tree-x-list-item-dashed-line--offset) - 4px );border:0 dashed #a9a9a9;border-block-end-width:1px;pointer-events:none;content-visibility:hidden;z-index:1}.last-all-line{inset-block-start:0;height:calc(100% - var(--distance-to-checkbox));border-inline-start-width:1px;border-end-start-radius:2px}.last-line{inset-block-start:0;height:100%;border-inline-start-width:1px;border-style:solid;border-block-end:unset}.expandable-button{display:grid;place-items:center;width:var(--expandable-button-width);height:var(--expandable-button-width);margin-inline-end:5px;z-index:1;content-visibility:auto;contain-intrinsic-size:auto var(--expandable-button-width)}.expandable-button::before{content:\"\";width:calc(100% - 2px);height:calc(100% - 2px);background-color:currentColor;-webkit-mask-size:calc(var(--expandable-button-width) - 2px)}.expandable-button--collapsed::before{-webkit-mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14.15,8.5H8.54v5.61h-1V8.5H1.93v-1H7.54V1.89h1V7.5h5.61Z\"/></svg>')}.expandable-button--expanded::before{-webkit-mask-image:url('data:image/svg+xml,<svg viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M14.15,8.5H1.93v-1H14.15Z\"/></svg>')}.expandable-button:focus-visible{outline:1px solid #000}.checkbox{margin-inline-end:5px}.checkbox::part(container){width:var(--checkbox-size);height:var(--checkbox-size)}.action{display:grid;grid-template:\"left-img text right-img\"/max-content 1fr max-content;align-items:center;height:100%;flex:1}.readonly-mode{padding-block:0.75px}.left-img,.right-img{display:block;width:0.875em;height:0.875em;content-visibility:auto;contain-intrinsic-size:auto 0.875em}.left-img{grid-area:left-img;margin-inline-end:5px}.right-img{grid-area:right-img;margin-inline-start:5px}.edit-name{grid-area:text;width:100%;height:100%;background-color:unset;padding:0;margin:0;border:1px solid currentColor;font:unset;outline:unset}.downloading{width:0.75em;height:0.75em;margin-inline-start:8px;border:2px solid currentColor;border-inline-start-color:transparent;border-radius:50%;opacity:0.75;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.expandable{--parent-expandable-offset:0px;--parent-negative-checkbox-offset:0px;--parent-checkbox-offset:0px;display:grid;grid-template-rows:0fr;content-visibility:auto;contain-intrinsic-size:auto 100px}.expanded{grid-template-rows:1fr}:not(.expanded) ::slotted([slot=tree]){display:none;overflow:hidden;content-visibility:hidden}";
417
484
 
418
485
  const resetDragImage = new Image();
419
486
  // Selectors
@@ -435,7 +502,6 @@ const ChTreeXListItem = class {
435
502
  this.checkboxChange = createEvent(this, "checkboxChange", 7);
436
503
  this.itemDragStart = createEvent(this, "itemDragStart", 7);
437
504
  this.itemDragEnd = createEvent(this, "itemDragEnd", 7);
438
- this.itemDrop = createEvent(this, "itemDrop", 7);
439
505
  this.loadLazyContent = createEvent(this, "loadLazyContent", 7);
440
506
  this.modifyCaption = createEvent(this, "modifyCaption", 7);
441
507
  this.selectedItemChange = createEvent(this, "selectedItemChange", 7);
@@ -452,6 +518,11 @@ const ChTreeXListItem = class {
452
518
  * Only works if `checkbox = true`
453
519
  */
454
520
  this.checked = false;
521
+ /**
522
+ * Set this attribute if you want to set a custom render for the control, by
523
+ * passing a slot.
524
+ */
525
+ this.customRender = false;
455
526
  /**
456
527
  * This attribute lets you specify if the element is disabled.
457
528
  * If disabled, it will not fire any user interaction related event
@@ -517,7 +588,7 @@ const ChTreeXListItem = class {
517
588
  * `true` to display the relation between tree items and tree lists using
518
589
  * lines.
519
590
  */
520
- this.showLines = true;
591
+ this.showLines = "none";
521
592
  /**
522
593
  * Set this attribute if you want all the children item's checkboxes to be
523
594
  * checked when the parent item checkbox is checked, or to be unchecked when
@@ -574,6 +645,7 @@ const ChTreeXListItem = class {
574
645
  goToReference: false,
575
646
  id: this.el.id,
576
647
  itemRef: this.el,
648
+ metadata: this.metadata,
577
649
  parentId: this.el.parentElement.parentElement.id,
578
650
  selected: true
579
651
  });
@@ -626,14 +698,14 @@ const ChTreeXListItem = class {
626
698
  };
627
699
  this.renderImg = (cssClass, src) => (h("img", { "aria-hidden": "true", class: cssClass, part: cssClass, alt: "", src: src, loading: "lazy" }));
628
700
  this.handleDragStart = (event) => {
629
- event.stopPropagation();
630
701
  // Disallow drag when editing the caption
631
702
  if (this.editing) {
632
703
  event.preventDefault();
633
704
  return;
634
705
  }
706
+ // Remove drag image
635
707
  event.dataTransfer.setDragImage(resetDragImage, 0, 0);
636
- // this.el.style.cursor = "move";
708
+ event.dataTransfer.effectAllowed = "move";
637
709
  this.dragState = "start";
638
710
  this.itemDragStart.emit({
639
711
  elem: this.el,
@@ -646,13 +718,8 @@ const ChTreeXListItem = class {
646
718
  this.dragState = "none";
647
719
  this.itemDragEnd.emit();
648
720
  };
649
- this.handleDrop = (event) => {
650
- event.stopPropagation();
721
+ this.handleDrop = () => {
651
722
  this.dragState = "none";
652
- this.itemDrop.emit({
653
- dropItemId: this.el.id,
654
- dataTransfer: event.dataTransfer
655
- });
656
723
  };
657
724
  }
658
725
  updateChildrenCheckedValue(newValue) {
@@ -855,6 +922,7 @@ const ChTreeXListItem = class {
855
922
  goToReference: false,
856
923
  id: this.el.id,
857
924
  itemRef: this.el,
925
+ metadata: this.metadata,
858
926
  parentId: this.el.parentElement.parentElement.id,
859
927
  selected: selected
860
928
  });
@@ -867,6 +935,7 @@ const ChTreeXListItem = class {
867
935
  goToReference: goToReference,
868
936
  id: this.el.id,
869
937
  itemRef: this.el,
938
+ metadata: this.metadata,
870
939
  parentId: this.el.parentElement.parentElement.id,
871
940
  selected: true
872
941
  });
@@ -917,11 +986,13 @@ const ChTreeXListItem = class {
917
986
  const expandableButtonNotVisible = !this.leaf && !this.showExpandableButton;
918
987
  const acceptDrop = !this.leaf && this.dragState !== "start";
919
988
  const hasContent = !this.leaf && !this.lazyLoad;
989
+ const showAllLines = this.showLines === "all" && this.level !== 0;
990
+ const showLastLine = this.showLines === "last" && this.level !== 0 && this.lastItem;
920
991
  return (h(Host, { role: "treeitem", "aria-selected": this.selected ? "true" : null, class: {
921
992
  [TREE_ITEM_TAG_NAME + "--downloading"]: this.downloading,
922
993
  [TREE_ITEM_TAG_NAME + "--editing"]: this.editing,
923
994
  [TREE_ITEM_TAG_NAME + "--drag-" + this.dragState]: this.dragState !== "none" && this.dragState !== "start",
924
- [TREE_ITEM_TAG_NAME + "--accept-drop"]: acceptDrop
995
+ [TREE_ITEM_TAG_NAME + "--deny-drop"]: this.leaf
925
996
  }, style: { "--level": `${this.level}` },
926
997
  // Drag and drop
927
998
  onDrop: acceptDrop ? this.handleDrop : null }, h("button", { "aria-controls": hasContent ? EXPANDABLE_ID : null, "aria-expanded": hasContent ? this.expanded.toString() : null, class: {
@@ -941,10 +1012,18 @@ const ChTreeXListItem = class {
941
1012
  "expandable-button": true,
942
1013
  "expandable-button--expanded": this.expanded,
943
1014
  "expandable-button--collapsed": !this.expanded
944
- }, part: `expandable-button${this.disabled ? " disabled" : ""}${this.expanded ? " expanded" : " collapsed"}`, disabled: this.disabled, onClick: this.toggleExpand })), this.checkbox && (h("ch-checkbox", { accessibleName: this.caption, class: "checkbox", part: `checkbox${this.disabled ? " disabled" : ""}${this.checked ? " checked" : ""}${this.indeterminate ? " indeterminate" : ""}`, checkedValue: "true", disabled: this.disabled, indeterminate: this.indeterminate, unCheckedValue: "false", value: `${this.checked}`, onInput: this.handleCheckedChange })), h("div", { class: {
945
- action: true,
946
- "readonly-mode": !this.editing
947
- }, onDblClick: !this.leaf ? this.handleActionDblClick : null }, this.leftImgSrc && this.renderImg("left-img", this.leftImgSrc), this.editing ? (h("input", { class: "edit-name", part: "edit-name", disabled: this.disabled, type: "text", value: this.caption, onBlur: this.removeEditMode(false), onKeyDown: this.checkIfShouldRemoveEditMode, ref: el => (this.inputRef = el) })) : (this.caption), this.rightImgSrc && this.renderImg("right-img", this.rightImgSrc)), this.showDownloadingSpinner && !this.leaf && this.downloading && (h("div", { class: "downloading", part: "downloading" })), this.showLines && this.level !== 0 && (h("div", { class: { "dashed-line": true, "last-dashed-line": this.lastItem }, part: `dashed-line${this.lastItem ? " last-dashed-line" : ""}` }))), hasContent && (h("div", { "aria-busy": this.downloading.toString(), "aria-live": this.downloading ? "polite" : null, id: EXPANDABLE_ID, class: { expandable: true, expanded: this.expanded }, part: `expandable${this.expanded ? " expanded" : ""}` }, h("slot", { name: "tree" })))));
1015
+ }, part: `expandable-button${this.disabled ? " disabled" : ""}${this.expanded ? " expanded" : " collapsed"}`, disabled: this.disabled, onClick: this.toggleExpand })), this.checkbox && (h("ch-checkbox", { accessibleName: this.caption, class: "checkbox", part: `checkbox${this.disabled ? " disabled" : ""}${this.checked ? " checked" : ""}${this.indeterminate ? " indeterminate" : ""}`, checkedValue: "true", disabled: this.disabled, indeterminate: this.indeterminate, unCheckedValue: "false", value: `${this.checked}`, onInput: this.handleCheckedChange })), this.customRender ? (h("slot", { name: "custom-content" })) : ([
1016
+ h("div", { class: {
1017
+ action: true,
1018
+ "readonly-mode": !this.editing
1019
+ }, part: `action ${!this.editing ? "readonly-mode" : ""}`, onDblClick: !this.leaf && !this.editing ? this.handleActionDblClick : null }, this.leftImgSrc && this.renderImg("left-img", this.leftImgSrc), this.editing ? (h("input", { class: "edit-name", part: "edit-name", disabled: this.disabled, type: "text", value: this.caption, onBlur: this.removeEditMode(false), onKeyDown: this.checkIfShouldRemoveEditMode, ref: el => (this.inputRef = el) })) : (this.caption), this.rightImgSrc &&
1020
+ this.renderImg("right-img", this.rightImgSrc)),
1021
+ this.showDownloadingSpinner && !this.leaf && this.downloading && (h("div", { class: "downloading", part: "downloading" }))
1022
+ ]), (showAllLines || showLastLine) && (h("div", { class: {
1023
+ "dashed-line": true,
1024
+ "last-all-line": showAllLines && this.lastItem,
1025
+ "last-line": showLastLine
1026
+ }, part: `dashed-line${this.lastItem ? " last-all-line" : ""}` }))), hasContent && (h("div", { "aria-busy": this.downloading.toString(), "aria-live": this.downloading ? "polite" : null, id: EXPANDABLE_ID, class: { expandable: true, expanded: this.expanded }, part: `expandable${this.expanded ? " expanded" : ""}` }, h("slot", { name: "tree" })))));
948
1027
  }
949
1028
  get el() { return getElement(this); }
950
1029
  static get watchers() { return {