@genexus/genexus-ide-ui 0.0.29 → 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.
- package/dist/cjs/ch-action-group_2.cjs.entry.js +2 -9
- package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ch-dropdown-item.cjs.entry.js +8 -8
- package/dist/cjs/ch-dropdown.cjs.entry.js +11 -10
- package/dist/cjs/ch-suggest_4.cjs.entry.js +1 -0
- package/dist/cjs/ch-test-action-group.cjs.entry.js +2 -2
- package/dist/cjs/ch-test-tree-x.cjs.entry.js +150 -80
- package/dist/cjs/ch-tree-x_3.cjs.entry.js +211 -132
- package/dist/cjs/ch-window_2.cjs.entry.js +28 -12
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +3 -3
- package/dist/cjs/gxg-combo-box_6.cjs.entry.js +10 -4
- package/dist/cjs/gxg-date-picker.cjs.entry.js +4 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/team-dev-commit/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
- package/dist/collection/components/team-dev-commit/team-dev-commit.css +3 -0
- package/dist/collection/components/team-dev-commit/team-dev-commit.js +2 -2
- package/dist/components/action-group-item.js +1 -9
- package/dist/components/action-group.js +1 -1
- package/dist/components/ch-suggest2.js +1 -0
- package/dist/components/ch-test-action-group.js +2 -2
- package/dist/components/ch-test-tree-x.js +157 -83
- package/dist/components/ch-window2.js +31 -13
- package/dist/components/checkbox.js +1 -1
- package/dist/components/combo-box-item.js +2 -2
- package/dist/components/combo-box.js +8 -2
- package/dist/components/dropdown-item.js +8 -8
- package/dist/components/dropdown.js +11 -10
- package/dist/components/gx-ide-team-dev-commit.js +3 -3
- package/dist/components/gxg-date-picker.js +4 -4
- package/dist/components/tree-x-list-item.js +31 -17
- package/dist/components/tree-x-list.js +9 -4
- package/dist/components/tree-x.js +182 -117
- package/dist/esm/ch-action-group_2.entry.js +2 -9
- package/dist/esm/ch-checkbox.entry.js +1 -1
- package/dist/esm/ch-dropdown-item.entry.js +8 -8
- package/dist/esm/ch-dropdown.entry.js +11 -10
- package/dist/esm/ch-suggest_4.entry.js +1 -0
- package/dist/esm/ch-test-action-group.entry.js +2 -2
- package/dist/esm/ch-test-tree-x.entry.js +150 -80
- package/dist/esm/ch-tree-x_3.entry.js +211 -132
- package/dist/esm/ch-window_2.entry.js +28 -12
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-team-dev-commit.entry.js +3 -3
- package/dist/esm/gxg-combo-box_6.entry.js +10 -4
- package/dist/esm/gxg-date-picker.entry.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.css +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/team-dev-commit/langs/team-dev-commit.lang.en.json +1 -1
- package/dist/genexus-ide-ui/p-1fe05a05.entry.js +1 -0
- package/dist/genexus-ide-ui/p-24f47ee2.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-54bab171.entry.js → p-28d0afda.entry.js} +1 -1
- package/dist/genexus-ide-ui/{p-6050cdba.entry.js → p-48412811.entry.js} +1 -1
- package/dist/genexus-ide-ui/p-714bd8ea.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8c2ab053.entry.js +1 -0
- package/dist/genexus-ide-ui/p-976e8118.entry.js +1 -0
- package/dist/genexus-ide-ui/p-a5463fc9.entry.js +1 -0
- package/dist/genexus-ide-ui/p-b54f448c.entry.js +1 -0
- package/dist/genexus-ide-ui/p-bb1809cb.entry.js +1 -0
- package/dist/genexus-ide-ui/p-cf41f154.entry.js +1 -0
- package/dist/genexus-ide-ui/p-e8a21ed7.entry.js +1 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/action-group-item/action-group-item.css +0 -1
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/checkbox/checkbox.css +5 -3
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown/dropdown.css +15 -33
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/dropdown-item/dropdown-item.css +0 -4
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-x.css +0 -10
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x/tree-x.css +20 -3
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x-list-item/tree-x-list-item.css +25 -8
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/window/ch-window.css +51 -2
- package/dist/node_modules/@genexus/gemini/dist/collection/components/combo-box-item/combo-box-item.css +1 -1
- package/package.json +3 -3
- package/dist/genexus-ide-ui/p-097a3eeb.entry.js +0 -1
- package/dist/genexus-ide-ui/p-3d9a4ede.entry.js +0 -1
- package/dist/genexus-ide-ui/p-4bbe1c18.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5c64c57f.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5ff04ebe.entry.js +0 -1
- package/dist/genexus-ide-ui/p-757f8567.entry.js +0 -1
- package/dist/genexus-ide-ui/p-8d46f8d8.entry.js +0 -1
- package/dist/genexus-ide-ui/p-a0e85c2a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-e4cac203.entry.js +0 -1
- package/dist/genexus-ide-ui/p-f8561da6.entry.js +0 -1
|
@@ -5,23 +5,41 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-5a32426a.js');
|
|
6
6
|
const helpers = require('./helpers-8845f008.js');
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const scrollToEdge = (event, container, scrollSpeed, scrollThreshold) => {
|
|
9
|
+
const mousePositionY = event.clientY - container.getBoundingClientRect().top;
|
|
10
|
+
const containerHeight = container.clientHeight;
|
|
11
|
+
const mouseAtTheTop = mousePositionY <= scrollThreshold;
|
|
12
|
+
const mouseAtTheBottom = mousePositionY > containerHeight - scrollThreshold;
|
|
13
|
+
if (mouseAtTheTop || mouseAtTheBottom) {
|
|
14
|
+
const scrollAmount = mouseAtTheTop
|
|
15
|
+
? mousePositionY - scrollThreshold
|
|
16
|
+
: mousePositionY - (containerHeight - scrollThreshold);
|
|
17
|
+
// Adjust container scroll position
|
|
18
|
+
container.scrollTop += scrollAmount / scrollSpeed;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
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%}";
|
|
9
23
|
|
|
10
24
|
const TREE_ITEM_TAG_NAME$1 = "ch-tree-x-list-item";
|
|
11
25
|
const TREE_LIST_TAG_NAME = "ch-tree-x-list";
|
|
12
26
|
// Selectors
|
|
13
27
|
const TREE_LIST_AND_ITEM_SELECTOR = TREE_LIST_TAG_NAME + "," + TREE_ITEM_TAG_NAME$1;
|
|
14
28
|
// const CHECKED_ITEMS = `${TREE_ITEM_TAG_NAME}[checked]`;
|
|
29
|
+
const TEXT_FORMAT = "text/plain";
|
|
15
30
|
const ARROW_DOWN_KEY = "ArrowDown";
|
|
16
31
|
const ARROW_UP_KEY = "ArrowUp";
|
|
17
32
|
const EDIT_KEY = "F2";
|
|
18
33
|
const isExecutedInTree = (event, el) => event.composedPath().includes(el);
|
|
19
34
|
const treeItemIsInEditMode = () => document.activeElement.editing;
|
|
35
|
+
const getDroppableZoneKey = (newContainerId, draggedItems) => `"newContainerId":"${newContainerId}","metadata":"${JSON.stringify(draggedItems)}"`;
|
|
20
36
|
const POSITION_X_DRAG_CUSTOM_VAR = "--ch-tree-x-dragging-item-x";
|
|
21
37
|
const POSITION_Y_DRAG_CUSTOM_VAR = "--ch-tree-x-dragging-item-y";
|
|
22
38
|
const ChTreeX = class {
|
|
23
39
|
constructor(hostRef) {
|
|
24
40
|
index.registerInstance(this, hostRef);
|
|
41
|
+
this.droppableZoneEnter = index.createEvent(this, "droppableZoneEnter", 7);
|
|
42
|
+
this.expandedItemChange = index.createEvent(this, "expandedItemChange", 7);
|
|
25
43
|
this.selectedItemsChange = index.createEvent(this, "selectedItemsChange", 7);
|
|
26
44
|
this.itemsDropped = index.createEvent(this, "itemsDropped", 7);
|
|
27
45
|
// @todo TODO: Check if key codes works in Safari
|
|
@@ -50,13 +68,18 @@ const ChTreeX = class {
|
|
|
50
68
|
document.activeElement.editing = true;
|
|
51
69
|
}
|
|
52
70
|
};
|
|
71
|
+
this.draggingSelectedItems = false;
|
|
53
72
|
this.needForRAF = true; // To prevent redundant RAF (request animation frame) calls
|
|
54
|
-
this.lastPageX = 0;
|
|
55
|
-
this.lastPageY = 0;
|
|
56
73
|
this.selectedItemsInfo = new Map();
|
|
74
|
+
/**
|
|
75
|
+
* Cache to avoid duplicate requests when checking the droppable zone in the
|
|
76
|
+
* same drag event.
|
|
77
|
+
*/
|
|
78
|
+
this.validDroppableZoneCache = new Map();
|
|
57
79
|
this.draggedIds = [];
|
|
58
80
|
this.draggedParentIds = [];
|
|
59
|
-
this.
|
|
81
|
+
this.draggingInTheDocument = false;
|
|
82
|
+
this.draggingInTree = false;
|
|
60
83
|
/**
|
|
61
84
|
* Level in the tree at which the control is placed.
|
|
62
85
|
*/
|
|
@@ -70,54 +93,41 @@ const ChTreeX = class {
|
|
|
70
93
|
* over in a subtree to open it when dragging.
|
|
71
94
|
*/
|
|
72
95
|
this.openSubTreeCountdown = 750;
|
|
96
|
+
/**
|
|
97
|
+
* `true` to scroll in the tree when dragging an item near the edges of the
|
|
98
|
+
* tree.
|
|
99
|
+
*/
|
|
100
|
+
this.scrollToEdgeOnDrag = true;
|
|
73
101
|
/**
|
|
74
102
|
* `true` to display the relation between tree items and tree lists using
|
|
75
103
|
* lines.
|
|
76
104
|
*/
|
|
77
|
-
this.showLines =
|
|
105
|
+
this.showLines = "none";
|
|
78
106
|
/**
|
|
79
107
|
* This property lets you specify if the tree is waiting to process the drop
|
|
80
108
|
* of items.
|
|
81
109
|
*/
|
|
82
110
|
this.waitDropProcessing = false;
|
|
83
|
-
this.trackItemDragEnter = (event) => {
|
|
84
|
-
event.stopPropagation();
|
|
85
|
-
const currentTarget = event.target;
|
|
86
|
-
// Don't mark droppable zones if they are the dragged items or their direct parents
|
|
87
|
-
if (!this.validDroppableZone(currentTarget.id)) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
// Check if it is a valid item
|
|
91
|
-
if (currentTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const treeItem = currentTarget;
|
|
95
|
-
treeItem.dragState = "enter";
|
|
96
|
-
this.openSubTreeAfterCountdown(treeItem);
|
|
97
|
-
};
|
|
98
|
-
this.validDroppableZone = (draggedItemId) => !this.draggedIds.includes(draggedItemId) &&
|
|
99
|
-
!this.draggedParentIds.includes(draggedItemId);
|
|
100
|
-
this.trackItemDragLeave = (event) => {
|
|
101
|
-
const currentTarget = event.target;
|
|
102
|
-
if (currentTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const treeItem = currentTarget;
|
|
106
|
-
treeItem.dragState = "none";
|
|
107
|
-
this.cancelSubTreeOpening(treeItem);
|
|
108
|
-
};
|
|
109
111
|
this.trackItemDrag = (event) => {
|
|
110
112
|
event.preventDefault();
|
|
111
|
-
this.
|
|
112
|
-
this.lastPageY = event.pageY;
|
|
113
|
+
this.lastDragEvent = event;
|
|
113
114
|
if (!this.needForRAF) {
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
117
|
this.needForRAF = false; // No need to call RAF up until next frame
|
|
117
118
|
requestAnimationFrame(() => {
|
|
118
119
|
this.needForRAF = true; // RAF now consumes the movement instruction so a new one can come
|
|
119
|
-
this.el.style.setProperty(POSITION_X_DRAG_CUSTOM_VAR, `${this.
|
|
120
|
-
this.el.style.setProperty(POSITION_Y_DRAG_CUSTOM_VAR, `${this.
|
|
120
|
+
this.el.style.setProperty(POSITION_X_DRAG_CUSTOM_VAR, `${this.lastDragEvent.pageX}px`);
|
|
121
|
+
this.el.style.setProperty(POSITION_Y_DRAG_CUSTOM_VAR, `${this.lastDragEvent.pageY}px`);
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
this.fixScrollPositionOnDrag = () => {
|
|
125
|
+
if (!this.draggingInTree || !this.lastDragEvent) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
requestAnimationFrame(() => {
|
|
129
|
+
scrollToEdge(this.lastDragEvent, this.el, 10, 30);
|
|
130
|
+
requestAnimationFrame(this.fixScrollPositionOnDrag);
|
|
121
131
|
});
|
|
122
132
|
};
|
|
123
133
|
this.handleKeyDownEvents = (event) => {
|
|
@@ -152,37 +162,26 @@ const ChTreeX = class {
|
|
|
152
162
|
itemRef.scrollIntoView();
|
|
153
163
|
});
|
|
154
164
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// const treeItem = allTreeItems.find(item => treeItemId === item.id);
|
|
176
|
-
// if (treeItem) {
|
|
177
|
-
// treeItem.expanded = expand ?? !treeItem.expanded;
|
|
178
|
-
// modifiedTreeItems.push({
|
|
179
|
-
// id: treeItem.id,
|
|
180
|
-
// expanded: treeItem.expanded
|
|
181
|
-
// });
|
|
182
|
-
// }
|
|
183
|
-
// });
|
|
184
|
-
// return modifiedTreeItems;
|
|
185
|
-
// }
|
|
165
|
+
/**
|
|
166
|
+
* Update the information about the valid droppable zones.
|
|
167
|
+
* @param requestTimestamp Time where the request to the server was made. Useful to avoid having old information.
|
|
168
|
+
* @param newContainerId ID of the container where the drag is trying to be made.
|
|
169
|
+
* @param draggedItems Information about the dragged items.
|
|
170
|
+
* @param validDrop Current state of the droppable zone.
|
|
171
|
+
*/
|
|
172
|
+
async updateValidDroppableZone(requestTimestamp, newContainerId, draggedItems, validDrop) {
|
|
173
|
+
var _a;
|
|
174
|
+
if (!this.draggingInTheDocument ||
|
|
175
|
+
requestTimestamp <= this.dragStartTimestamp) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const droppableZoneKey = getDroppableZoneKey(newContainerId, draggedItems);
|
|
179
|
+
this.validDroppableZoneCache.set(droppableZoneKey, validDrop ? "valid" : "invalid");
|
|
180
|
+
const shouldUpdateDragEnterInCurrentContainer = ((_a = this.lastOpenSubTreeItem) === null || _a === void 0 ? void 0 : _a.id) === newContainerId;
|
|
181
|
+
if (shouldUpdateDragEnterInCurrentContainer) {
|
|
182
|
+
this.lastOpenSubTreeItem.dragState = "enter";
|
|
183
|
+
}
|
|
184
|
+
}
|
|
186
185
|
// /**
|
|
187
186
|
// * Returns an array of the selected tree items, providing the id, caption and
|
|
188
187
|
// * selected status.
|
|
@@ -198,98 +197,160 @@ const ChTreeX = class {
|
|
|
198
197
|
// selected: item.selected
|
|
199
198
|
// }));
|
|
200
199
|
// }
|
|
200
|
+
// We can't use capture, because the dataTransfer info would not be defined
|
|
201
|
+
// Also, we cant use capture and setTimeout with 0 seconds, because the
|
|
202
|
+
// getData method can only be accessed during the dragstart and drop event
|
|
203
|
+
handleDragStart(event) {
|
|
204
|
+
// Reset the validity of the droppable zones with each new drag start
|
|
205
|
+
this.validDroppableZoneCache.clear();
|
|
206
|
+
this.draggingInTheDocument = true;
|
|
207
|
+
this.dragStartTimestamp = new Date().getTime();
|
|
208
|
+
this.draggedItems = JSON.parse(event.dataTransfer.getData(TEXT_FORMAT));
|
|
209
|
+
}
|
|
210
|
+
handleDragEnd() {
|
|
211
|
+
this.draggingInTheDocument = false;
|
|
212
|
+
}
|
|
213
|
+
handleDragEnter(event) {
|
|
214
|
+
this.cancelSubTreeOpening(null, true);
|
|
215
|
+
event.stopPropagation();
|
|
216
|
+
const containerTarget = event.target;
|
|
217
|
+
// Check if it is a valid item
|
|
218
|
+
if (containerTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
this.lastOpenSubTreeItem = containerTarget;
|
|
222
|
+
this.openSubTreeAfterCountdown(containerTarget);
|
|
223
|
+
if (this.validDroppableZone(event) === "valid") {
|
|
224
|
+
containerTarget.dragState = "enter";
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
handleDragLeave(event) {
|
|
228
|
+
const currentTarget = event.target;
|
|
229
|
+
if (currentTarget.tagName.toLowerCase() !== TREE_ITEM_TAG_NAME$1) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const treeItem = currentTarget;
|
|
233
|
+
treeItem.dragState = "none";
|
|
234
|
+
this.cancelSubTreeOpening(treeItem);
|
|
235
|
+
}
|
|
236
|
+
cancelSubTreeOpening(treeItem, forceClear = false) {
|
|
237
|
+
if (this.lastOpenSubTreeItem === treeItem || forceClear) {
|
|
238
|
+
clearTimeout(this.openSubTreeTimeout);
|
|
239
|
+
this.lastOpenSubTreeItem = null;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
handleItemDrop(event) {
|
|
243
|
+
event.stopPropagation();
|
|
244
|
+
this.cancelSubTreeOpening(null, true);
|
|
245
|
+
const newContainer = event.target;
|
|
246
|
+
const draggedItems = JSON.parse(event.dataTransfer.getData(TEXT_FORMAT));
|
|
247
|
+
// The droppable zone must be checked, even if it was marked as not valid
|
|
248
|
+
// @todo Try to drop an item with high delays in droppable zone checking
|
|
249
|
+
if (this.validDroppableZone(event) !== "valid") {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
this.itemsDropped.emit({
|
|
253
|
+
newContainer: { id: newContainer.id, metadata: newContainer.metadata },
|
|
254
|
+
draggedItems: draggedItems,
|
|
255
|
+
dropInTheSameTree: this.draggingInTree
|
|
256
|
+
});
|
|
257
|
+
}
|
|
201
258
|
handleItemDragStart(event) {
|
|
202
259
|
document.body.addEventListener("dragover", this.trackItemDrag, {
|
|
203
260
|
capture: true
|
|
204
261
|
});
|
|
205
262
|
this.currentDraggedItem = event.target;
|
|
206
263
|
this.updateDragInfo(event.detail);
|
|
207
|
-
this.
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
this.el.addEventListener("dragleave", this.trackItemDragLeave, {
|
|
212
|
-
capture: true,
|
|
213
|
-
passive: true
|
|
214
|
-
});
|
|
215
|
-
// Wait until the custom var values are updated to avoid flickering
|
|
216
|
-
setTimeout(() => {
|
|
217
|
-
this.draggingItem = true;
|
|
218
|
-
}, 10);
|
|
264
|
+
this.draggingInTree = true;
|
|
265
|
+
if (this.scrollToEdgeOnDrag) {
|
|
266
|
+
this.fixScrollPositionOnDrag();
|
|
267
|
+
}
|
|
219
268
|
}
|
|
220
269
|
handleItemDragEnd() {
|
|
221
|
-
this.
|
|
270
|
+
this.draggingInTree = false;
|
|
222
271
|
document.body.removeEventListener("dragover", this.trackItemDrag, {
|
|
223
272
|
capture: true
|
|
224
273
|
});
|
|
225
|
-
this.el.removeEventListener("dragenter", this.trackItemDragEnter, {
|
|
226
|
-
capture: true
|
|
227
|
-
});
|
|
228
|
-
this.el.removeEventListener("dragleave", this.trackItemDragLeave, {
|
|
229
|
-
capture: true
|
|
230
|
-
});
|
|
231
274
|
// Reset not allowed droppable ids
|
|
232
275
|
this.resetVariables();
|
|
233
276
|
}
|
|
234
|
-
handleItemDrop(event) {
|
|
235
|
-
event.stopPropagation();
|
|
236
|
-
this.cancelSubTreeOpening(null, true);
|
|
237
|
-
const selectedItemEl = event.target;
|
|
238
|
-
if (!this.validDroppableZone(selectedItemEl.id)) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
this.itemsDropped.emit(event.detail);
|
|
242
|
-
}
|
|
243
277
|
handleSelectedItemChange(event) {
|
|
244
278
|
event.stopPropagation();
|
|
245
279
|
const selectedItemInfo = event.detail;
|
|
246
280
|
const selectedItemEl = event.target;
|
|
247
281
|
this.handleItemSelection(selectedItemEl, selectedItemInfo);
|
|
248
282
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
283
|
+
validDroppableZone(event) {
|
|
284
|
+
const containerTarget = event.target;
|
|
285
|
+
// When dragging in the same tree, don't mark droppable zones if they are
|
|
286
|
+
// the dragged items or their direct parents
|
|
287
|
+
if (this.draggingInTree &&
|
|
288
|
+
(this.draggedIds.includes(containerTarget.id) ||
|
|
289
|
+
this.draggedParentIds.includes(containerTarget.id))) {
|
|
290
|
+
return "invalid";
|
|
291
|
+
}
|
|
292
|
+
const cacheKey = getDroppableZoneKey(containerTarget.id, this.draggedItems);
|
|
293
|
+
const droppableZoneState = this.validDroppableZoneCache.get(cacheKey);
|
|
294
|
+
if (droppableZoneState != null) {
|
|
295
|
+
return droppableZoneState;
|
|
296
|
+
}
|
|
297
|
+
this.validDroppableZoneCache.set(cacheKey, "checking");
|
|
298
|
+
this.droppableZoneEnter.emit({
|
|
299
|
+
newContainer: {
|
|
300
|
+
id: containerTarget.id,
|
|
301
|
+
metadata: containerTarget.metadata
|
|
302
|
+
},
|
|
303
|
+
draggedItems: this.draggedItems
|
|
304
|
+
});
|
|
305
|
+
return "checking";
|
|
306
|
+
}
|
|
307
|
+
openSubTreeAfterCountdown(currentTarget) {
|
|
308
|
+
if (currentTarget.leaf || currentTarget.expanded) {
|
|
252
309
|
return;
|
|
253
310
|
}
|
|
254
|
-
this.lastOpenSubTreeItem = treeItem;
|
|
255
311
|
this.openSubTreeTimeout = setTimeout(() => {
|
|
256
|
-
|
|
312
|
+
currentTarget.expanded = true;
|
|
313
|
+
this.expandedItemChange.emit({ id: currentTarget.id, expanded: true });
|
|
257
314
|
}, this.openSubTreeCountdown);
|
|
258
315
|
}
|
|
259
|
-
cancelSubTreeOpening(treeItem, forceClear = false) {
|
|
260
|
-
if (this.lastOpenSubTreeItem === treeItem || forceClear) {
|
|
261
|
-
clearTimeout(this.openSubTreeTimeout);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
316
|
resetVariables() {
|
|
265
317
|
this.draggedIds = [];
|
|
266
318
|
this.draggedParentIds = [];
|
|
267
319
|
}
|
|
268
320
|
/**
|
|
269
|
-
* Update the dataTransfer in the drag event to store the ids
|
|
270
|
-
* items. Also it updates the visual information of the dragged
|
|
321
|
+
* Update the dataTransfer in the drag event to store the ids and metadata of
|
|
322
|
+
* the dragged items. Also it updates the visual information of the dragged
|
|
323
|
+
* items.
|
|
271
324
|
*/
|
|
272
325
|
updateDragInfo(dragInfo) {
|
|
273
326
|
const draggedElement = dragInfo.elem;
|
|
274
327
|
const isDraggingSelectedItems = this.selectedItemsInfo.has(draggedElement.id);
|
|
275
|
-
|
|
328
|
+
this.draggingSelectedItems = isDraggingSelectedItems;
|
|
329
|
+
let dataTransferInfo = [];
|
|
276
330
|
if (isDraggingSelectedItems) {
|
|
277
331
|
const selectedItemKeys = [...this.selectedItemsInfo.keys()];
|
|
278
332
|
const selectedItemCount = selectedItemKeys.length;
|
|
279
333
|
this.draggedIds = selectedItemKeys;
|
|
280
|
-
|
|
334
|
+
dataTransferInfo = [...this.selectedItemsInfo.values()].map(el => ({
|
|
335
|
+
id: el.id,
|
|
336
|
+
metadata: el.metadata
|
|
337
|
+
}));
|
|
281
338
|
this.dragInfo =
|
|
282
339
|
selectedItemCount === 1
|
|
283
340
|
? draggedElement.caption
|
|
284
341
|
: selectedItemCount.toString();
|
|
285
342
|
}
|
|
286
343
|
else {
|
|
287
|
-
|
|
288
|
-
|
|
344
|
+
dataTransferInfo = [
|
|
345
|
+
{ id: draggedElement.id, metadata: draggedElement.metadata }
|
|
346
|
+
];
|
|
347
|
+
this.draggedIds = [draggedElement.id];
|
|
289
348
|
this.dragInfo = draggedElement.caption;
|
|
290
349
|
}
|
|
291
350
|
this.getDirectParentsOfDraggableItems(isDraggingSelectedItems);
|
|
292
|
-
|
|
351
|
+
// Update drag event info
|
|
352
|
+
const data = JSON.stringify(dataTransferInfo);
|
|
353
|
+
dragInfo.dataTransfer.setData(TEXT_FORMAT, data);
|
|
293
354
|
}
|
|
294
355
|
getDirectParentsOfDraggableItems(draggingSelectedItems) {
|
|
295
356
|
if (!draggingSelectedItems) {
|
|
@@ -346,9 +407,10 @@ const ChTreeX = class {
|
|
|
346
407
|
}
|
|
347
408
|
render() {
|
|
348
409
|
return (index.h(index.Host, { class: {
|
|
349
|
-
"ch-tree-x-dragging-item": this.
|
|
410
|
+
"ch-tree-x-dragging-item": this.draggingInTheDocument,
|
|
411
|
+
"ch-tree-x--dragging-selected-items": this.draggingInTree && this.draggingSelectedItems,
|
|
350
412
|
"ch-tree-x-waiting-drop-processing": this.waitDropProcessing
|
|
351
|
-
} }, index.h("slot", null), this.
|
|
413
|
+
} }, index.h("slot", null), this.draggingInTree && (index.h("span", { "aria-hidden": "true", class: "ch-tree-x-drag-info" }, this.dragInfo))));
|
|
352
414
|
}
|
|
353
415
|
get el() { return index.getElement(this); }
|
|
354
416
|
static get watchers() { return {
|
|
@@ -374,8 +436,13 @@ const ChTreeListX = class {
|
|
|
374
436
|
* `true` to display the relation between tree items and tree lists using
|
|
375
437
|
* lines.
|
|
376
438
|
*/
|
|
377
|
-
this.showLines =
|
|
439
|
+
this.showLines = "none";
|
|
378
440
|
this.updateLastItemDashedLine = () => {
|
|
441
|
+
// @todo WA to avoid StencilJS' bug. The showLines Watch is dispatched
|
|
442
|
+
// before the componentDidLoad lifecycle method completes
|
|
443
|
+
if (!this.slotRef) {
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
379
446
|
const treeItems = this.slotRef.assignedElements();
|
|
380
447
|
if (treeItems.length === 0) {
|
|
381
448
|
return;
|
|
@@ -389,7 +456,7 @@ const ChTreeListX = class {
|
|
|
389
456
|
}
|
|
390
457
|
handleShowLinesChange(newValue) {
|
|
391
458
|
// Displayed items may have changed since the last time that `showLines === true`
|
|
392
|
-
if (newValue) {
|
|
459
|
+
if (newValue !== "none" && this.level !== 0) {
|
|
393
460
|
this.updateLastItemDashedLine();
|
|
394
461
|
}
|
|
395
462
|
}
|
|
@@ -406,7 +473,7 @@ const ChTreeListX = class {
|
|
|
406
473
|
this.showLines = mainTreeRef$1.showLines;
|
|
407
474
|
}
|
|
408
475
|
render() {
|
|
409
|
-
return (index.h(index.Host, { role: this.level === 0 ? "tree" : "group" }, index.h("slot", { onSlotchange: this.showLines && this.level !== 0
|
|
476
|
+
return (index.h(index.Host, { role: this.level === 0 ? "tree" : "group" }, index.h("slot", { onSlotchange: this.showLines !== "none" && this.level !== 0
|
|
410
477
|
? this.updateLastItemDashedLine
|
|
411
478
|
: null, ref: el => (this.slotRef = el) })));
|
|
412
479
|
}
|
|
@@ -417,7 +484,7 @@ const ChTreeListX = class {
|
|
|
417
484
|
};
|
|
418
485
|
ChTreeListX.style = treeXListCss;
|
|
419
486
|
|
|
420
|
-
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:
|
|
487
|
+
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}";
|
|
421
488
|
|
|
422
489
|
const resetDragImage = new Image();
|
|
423
490
|
// Selectors
|
|
@@ -439,7 +506,6 @@ const ChTreeXListItem = class {
|
|
|
439
506
|
this.checkboxChange = index.createEvent(this, "checkboxChange", 7);
|
|
440
507
|
this.itemDragStart = index.createEvent(this, "itemDragStart", 7);
|
|
441
508
|
this.itemDragEnd = index.createEvent(this, "itemDragEnd", 7);
|
|
442
|
-
this.itemDrop = index.createEvent(this, "itemDrop", 7);
|
|
443
509
|
this.loadLazyContent = index.createEvent(this, "loadLazyContent", 7);
|
|
444
510
|
this.modifyCaption = index.createEvent(this, "modifyCaption", 7);
|
|
445
511
|
this.selectedItemChange = index.createEvent(this, "selectedItemChange", 7);
|
|
@@ -456,6 +522,11 @@ const ChTreeXListItem = class {
|
|
|
456
522
|
* Only works if `checkbox = true`
|
|
457
523
|
*/
|
|
458
524
|
this.checked = false;
|
|
525
|
+
/**
|
|
526
|
+
* Set this attribute if you want to set a custom render for the control, by
|
|
527
|
+
* passing a slot.
|
|
528
|
+
*/
|
|
529
|
+
this.customRender = false;
|
|
459
530
|
/**
|
|
460
531
|
* This attribute lets you specify if the element is disabled.
|
|
461
532
|
* If disabled, it will not fire any user interaction related event
|
|
@@ -521,7 +592,7 @@ const ChTreeXListItem = class {
|
|
|
521
592
|
* `true` to display the relation between tree items and tree lists using
|
|
522
593
|
* lines.
|
|
523
594
|
*/
|
|
524
|
-
this.showLines =
|
|
595
|
+
this.showLines = "none";
|
|
525
596
|
/**
|
|
526
597
|
* Set this attribute if you want all the children item's checkboxes to be
|
|
527
598
|
* checked when the parent item checkbox is checked, or to be unchecked when
|
|
@@ -578,6 +649,7 @@ const ChTreeXListItem = class {
|
|
|
578
649
|
goToReference: false,
|
|
579
650
|
id: this.el.id,
|
|
580
651
|
itemRef: this.el,
|
|
652
|
+
metadata: this.metadata,
|
|
581
653
|
parentId: this.el.parentElement.parentElement.id,
|
|
582
654
|
selected: true
|
|
583
655
|
});
|
|
@@ -630,14 +702,14 @@ const ChTreeXListItem = class {
|
|
|
630
702
|
};
|
|
631
703
|
this.renderImg = (cssClass, src) => (index.h("img", { "aria-hidden": "true", class: cssClass, part: cssClass, alt: "", src: src, loading: "lazy" }));
|
|
632
704
|
this.handleDragStart = (event) => {
|
|
633
|
-
event.stopPropagation();
|
|
634
705
|
// Disallow drag when editing the caption
|
|
635
706
|
if (this.editing) {
|
|
636
707
|
event.preventDefault();
|
|
637
708
|
return;
|
|
638
709
|
}
|
|
710
|
+
// Remove drag image
|
|
639
711
|
event.dataTransfer.setDragImage(resetDragImage, 0, 0);
|
|
640
|
-
|
|
712
|
+
event.dataTransfer.effectAllowed = "move";
|
|
641
713
|
this.dragState = "start";
|
|
642
714
|
this.itemDragStart.emit({
|
|
643
715
|
elem: this.el,
|
|
@@ -650,13 +722,8 @@ const ChTreeXListItem = class {
|
|
|
650
722
|
this.dragState = "none";
|
|
651
723
|
this.itemDragEnd.emit();
|
|
652
724
|
};
|
|
653
|
-
this.handleDrop = (
|
|
654
|
-
event.stopPropagation();
|
|
725
|
+
this.handleDrop = () => {
|
|
655
726
|
this.dragState = "none";
|
|
656
|
-
this.itemDrop.emit({
|
|
657
|
-
dropItemId: this.el.id,
|
|
658
|
-
dataTransfer: event.dataTransfer
|
|
659
|
-
});
|
|
660
727
|
};
|
|
661
728
|
}
|
|
662
729
|
updateChildrenCheckedValue(newValue) {
|
|
@@ -859,6 +926,7 @@ const ChTreeXListItem = class {
|
|
|
859
926
|
goToReference: false,
|
|
860
927
|
id: this.el.id,
|
|
861
928
|
itemRef: this.el,
|
|
929
|
+
metadata: this.metadata,
|
|
862
930
|
parentId: this.el.parentElement.parentElement.id,
|
|
863
931
|
selected: selected
|
|
864
932
|
});
|
|
@@ -871,6 +939,7 @@ const ChTreeXListItem = class {
|
|
|
871
939
|
goToReference: goToReference,
|
|
872
940
|
id: this.el.id,
|
|
873
941
|
itemRef: this.el,
|
|
942
|
+
metadata: this.metadata,
|
|
874
943
|
parentId: this.el.parentElement.parentElement.id,
|
|
875
944
|
selected: true
|
|
876
945
|
});
|
|
@@ -921,11 +990,13 @@ const ChTreeXListItem = class {
|
|
|
921
990
|
const expandableButtonNotVisible = !this.leaf && !this.showExpandableButton;
|
|
922
991
|
const acceptDrop = !this.leaf && this.dragState !== "start";
|
|
923
992
|
const hasContent = !this.leaf && !this.lazyLoad;
|
|
993
|
+
const showAllLines = this.showLines === "all" && this.level !== 0;
|
|
994
|
+
const showLastLine = this.showLines === "last" && this.level !== 0 && this.lastItem;
|
|
924
995
|
return (index.h(index.Host, { role: "treeitem", "aria-selected": this.selected ? "true" : null, class: {
|
|
925
996
|
[TREE_ITEM_TAG_NAME + "--downloading"]: this.downloading,
|
|
926
997
|
[TREE_ITEM_TAG_NAME + "--editing"]: this.editing,
|
|
927
998
|
[TREE_ITEM_TAG_NAME + "--drag-" + this.dragState]: this.dragState !== "none" && this.dragState !== "start",
|
|
928
|
-
[TREE_ITEM_TAG_NAME + "--
|
|
999
|
+
[TREE_ITEM_TAG_NAME + "--deny-drop"]: this.leaf
|
|
929
1000
|
}, style: { "--level": `${this.level}` },
|
|
930
1001
|
// Drag and drop
|
|
931
1002
|
onDrop: acceptDrop ? this.handleDrop : null }, index.h("button", { "aria-controls": hasContent ? EXPANDABLE_ID : null, "aria-expanded": hasContent ? this.expanded.toString() : null, class: {
|
|
@@ -945,10 +1016,18 @@ const ChTreeXListItem = class {
|
|
|
945
1016
|
"expandable-button": true,
|
|
946
1017
|
"expandable-button--expanded": this.expanded,
|
|
947
1018
|
"expandable-button--collapsed": !this.expanded
|
|
948
|
-
}, part: `expandable-button${this.disabled ? " disabled" : ""}${this.expanded ? " expanded" : " collapsed"}`, disabled: this.disabled, onClick: this.toggleExpand })), this.checkbox && (index.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 })), index.h("
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1019
|
+
}, part: `expandable-button${this.disabled ? " disabled" : ""}${this.expanded ? " expanded" : " collapsed"}`, disabled: this.disabled, onClick: this.toggleExpand })), this.checkbox && (index.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 ? (index.h("slot", { name: "custom-content" })) : ([
|
|
1020
|
+
index.h("div", { class: {
|
|
1021
|
+
action: true,
|
|
1022
|
+
"readonly-mode": !this.editing
|
|
1023
|
+
}, part: `action ${!this.editing ? "readonly-mode" : ""}`, onDblClick: !this.leaf && !this.editing ? this.handleActionDblClick : null }, this.leftImgSrc && this.renderImg("left-img", this.leftImgSrc), this.editing ? (index.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 &&
|
|
1024
|
+
this.renderImg("right-img", this.rightImgSrc)),
|
|
1025
|
+
this.showDownloadingSpinner && !this.leaf && this.downloading && (index.h("div", { class: "downloading", part: "downloading" }))
|
|
1026
|
+
]), (showAllLines || showLastLine) && (index.h("div", { class: {
|
|
1027
|
+
"dashed-line": true,
|
|
1028
|
+
"last-all-line": showAllLines && this.lastItem,
|
|
1029
|
+
"last-line": showLastLine
|
|
1030
|
+
}, part: `dashed-line${this.lastItem ? " last-all-line" : ""}` }))), hasContent && (index.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" : ""}` }, index.h("slot", { name: "tree" })))));
|
|
952
1031
|
}
|
|
953
1032
|
get el() { return index.getElement(this); }
|
|
954
1033
|
static get watchers() { return {
|