@genexus/genexus-ide-ui 0.0.57 → 0.0.58
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-checkbox_4.cjs.entry.js → ch-checkbox_3.cjs.entry.js} +54 -43
- package/dist/cjs/ch-suggest_4.cjs.entry.js +2 -2
- package/dist/cjs/ch-test-suggest.cjs.entry.js +84 -0
- package/dist/cjs/ch-test-tree-x.cjs.entry.js +31 -16
- package/dist/cjs/ch-tooltip.cjs.entry.js +85 -0
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-references.cjs.entry.js +76 -116
- package/dist/cjs/gx-ide-test.cjs.entry.js +51 -5
- package/dist/cjs/gxg-label_2.cjs.entry.js +15 -2
- package/dist/cjs/gxg-tree-view.cjs.entry.js +36 -14
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/common/helpers.js +3 -0
- package/dist/collection/components/references/helpers.js +16 -19
- package/dist/collection/components/references/references.css +8 -0
- package/dist/collection/components/references/references.js +60 -98
- package/dist/components/ch-suggest2.js +2 -2
- package/dist/components/ch-test-suggest.js +119 -0
- package/dist/components/ch-test-tree-x.js +38 -28
- package/dist/components/ch-tooltip.js +115 -0
- package/dist/components/gx-ide-references.js +122 -150
- package/dist/components/gx-ide-test.js +48 -2
- package/dist/components/gxg-tree-view.js +1 -434
- package/dist/components/index.js +2 -1
- package/dist/components/tooltip.js +17 -3
- package/dist/components/tree-view.js +453 -0
- package/dist/components/tree-x-list-item.js +35 -23
- package/dist/components/tree-x.js +21 -7
- package/dist/esm/{ch-checkbox_4.entry.js → ch-checkbox_3.entry.js} +55 -43
- package/dist/esm/ch-suggest_4.entry.js +2 -2
- package/dist/esm/ch-test-suggest.entry.js +80 -0
- package/dist/esm/ch-test-tree-x.entry.js +32 -17
- package/dist/esm/ch-tooltip.entry.js +81 -0
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-references.entry.js +76 -116
- package/dist/esm/gx-ide-test.entry.js +48 -2
- package/dist/esm/gxg-label_2.entry.js +15 -2
- package/dist/esm/gxg-tree-view.entry.js +37 -15
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/p-109209dc.entry.js +1 -0
- package/dist/genexus-ide-ui/p-123b8351.entry.js +1 -0
- package/dist/genexus-ide-ui/p-71c6da54.entry.js +1 -0
- package/dist/genexus-ide-ui/p-86b98a99.entry.js +1 -0
- package/dist/genexus-ide-ui/p-cd00ba19.entry.js +1 -0
- package/dist/genexus-ide-ui/p-ce9fef1a.entry.js +1 -0
- package/dist/genexus-ide-ui/p-d47ed4e3.entry.js +1 -0
- package/dist/genexus-ide-ui/p-d7b452ef.entry.js +1 -0
- package/dist/genexus-ide-ui/p-f62d9b6d.entry.js +1 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-suggest/test-suggest.css +114 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tooltip/tooltip.css +120 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/{tree-x → tree-view/tree-x}/tree-x.css +2 -3
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/{tree-x-list-item → tree-view/tree-x-list-item}/tree-x-list-item.css +3 -6
- package/dist/node_modules/@genexus/gemini/dist/collection/components/tooltip/tooltip.css +11 -0
- package/dist/node_modules/@genexus/gemini/dist/collection/components/tree-view/tree-view.css +58 -12
- package/dist/types/common/helpers.d.ts +1 -0
- package/dist/types/components/references/helpers.d.ts +3 -3
- package/dist/types/components/references/references.d.ts +7 -19
- package/package.json +3 -3
- package/dist/cjs/update-tree-model-8b154db1.js +0 -53
- package/dist/components/ch-tree-x-list.js +0 -6
- package/dist/components/tree-x-list.js +0 -31
- package/dist/components/update-tree-model.js +0 -50
- package/dist/esm/update-tree-model-6c612f05.js +0 -50
- package/dist/genexus-ide-ui/p-1f3a81e3.entry.js +0 -1
- package/dist/genexus-ide-ui/p-46d393f5.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5669baf5.entry.js +0 -1
- package/dist/genexus-ide-ui/p-60b2bd2f.entry.js +0 -1
- package/dist/genexus-ide-ui/p-71ecc7fd.js +0 -1
- package/dist/genexus-ide-ui/p-c7425416.entry.js +0 -1
- package/dist/genexus-ide-ui/p-dd2e0590.entry.js +0 -1
- package/dist/genexus-ide-ui/p-ed5cf480.entry.js +0 -1
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-x-list/tree-x-list.css +0 -6
|
@@ -105,7 +105,7 @@ const scrollToEdge = (event, container, scrollSpeed, scrollThreshold) => {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
|
|
108
|
-
const treeXCss = "ch-tree-x{display:flex;position:relative;width:100%;overflow:auto}ch-tree-x>.ch-tree-x-container{position:absolute;inset:0}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
|
|
108
|
+
const treeXCss = "ch-tree-x{display:flex;position:relative;width:100%;overflow:auto}ch-tree-x>.ch-tree-x-container{position:absolute;inset:0}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{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-container{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%}";
|
|
109
109
|
|
|
110
110
|
const TREE_ITEM_TAG_NAME$1 = "ch-tree-x-list-item";
|
|
111
111
|
const TREE_TAG_NAME = "ch-tree-x";
|
|
@@ -126,6 +126,7 @@ const ChTreeX = class {
|
|
|
126
126
|
index.registerInstance(this, hostRef);
|
|
127
127
|
this.droppableZoneEnter = index.createEvent(this, "droppableZoneEnter", 7);
|
|
128
128
|
this.expandedItemChange = index.createEvent(this, "expandedItemChange", 7);
|
|
129
|
+
this.itemContextmenu = index.createEvent(this, "itemContextmenu", 7);
|
|
129
130
|
this.selectedItemsChange = index.createEvent(this, "selectedItemsChange", 7);
|
|
130
131
|
this.itemsDropped = index.createEvent(this, "itemsDropped", 7);
|
|
131
132
|
// @todo TODO: Check if key codes works in Safari
|
|
@@ -148,7 +149,7 @@ const ChTreeX = class {
|
|
|
148
149
|
},
|
|
149
150
|
[EDIT_KEY]: event => {
|
|
150
151
|
const treeItem = getFocusedTreeItem();
|
|
151
|
-
if (!treeItem) {
|
|
152
|
+
if (!treeItem || !treeItem.editable) {
|
|
152
153
|
return;
|
|
153
154
|
}
|
|
154
155
|
event.preventDefault();
|
|
@@ -225,6 +226,19 @@ const ChTreeX = class {
|
|
|
225
226
|
// selected: item.selected
|
|
226
227
|
// }));
|
|
227
228
|
// }
|
|
229
|
+
handleContextMenuEvent(event) {
|
|
230
|
+
const treeItem = event.target.closest(TREE_ITEM_TAG_NAME$1);
|
|
231
|
+
if (!treeItem) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
event.preventDefault();
|
|
235
|
+
this.itemContextmenu.emit({
|
|
236
|
+
id: treeItem.id,
|
|
237
|
+
itemRef: treeItem,
|
|
238
|
+
metadata: treeItem.metadata,
|
|
239
|
+
contextmenuEvent: event
|
|
240
|
+
});
|
|
241
|
+
}
|
|
228
242
|
// Set edit mode in items
|
|
229
243
|
handleKeyDownEvents(event) {
|
|
230
244
|
const keyHandler = this.keyDownEvents[event.key];
|
|
@@ -353,11 +367,11 @@ const ChTreeX = class {
|
|
|
353
367
|
if (!itemRef) {
|
|
354
368
|
return;
|
|
355
369
|
}
|
|
356
|
-
let parentItem = itemRef.parentElement
|
|
370
|
+
let parentItem = itemRef.parentElement;
|
|
357
371
|
// Expand all parents
|
|
358
372
|
while (parentItem.tagName.toLowerCase() === TREE_ITEM_TAG_NAME$1) {
|
|
359
373
|
parentItem.expanded = true;
|
|
360
|
-
parentItem = parentItem.parentElement
|
|
374
|
+
parentItem = parentItem.parentElement;
|
|
361
375
|
}
|
|
362
376
|
// Wait until the parents are expanded
|
|
363
377
|
requestAnimationFrame(() => {
|
|
@@ -487,7 +501,7 @@ const ChTreeX = class {
|
|
|
487
501
|
}
|
|
488
502
|
getDirectParentsOfDraggableItems(draggingSelectedItems) {
|
|
489
503
|
if (!draggingSelectedItems) {
|
|
490
|
-
const parentTreeItemElem = this.currentDraggedItem.parentElement
|
|
504
|
+
const parentTreeItemElem = this.currentDraggedItem.parentElement;
|
|
491
505
|
if (parentTreeItemElem.tagName.toLowerCase() === TREE_ITEM_TAG_NAME$1) {
|
|
492
506
|
this.draggedParentIds.push(parentTreeItemElem.id);
|
|
493
507
|
}
|
|
@@ -536,34 +550,21 @@ const ChTreeX = class {
|
|
|
536
550
|
"ch-tree-x-not-dragging-item": !this.draggingInTheDocument,
|
|
537
551
|
"ch-tree-x--dragging-selected-items": this.draggingInTree && this.draggingSelectedItems,
|
|
538
552
|
"ch-tree-x-waiting-drop-processing": this.waitDropProcessing
|
|
539
|
-
} }, index.h("div", { role: "tree", "aria-multiselectable": this.multiSelection.toString(), class: "ch-tree-x-container" }, index.h("slot", null)), this.draggingInTree && (index.h("span", { "aria-hidden": "true", class: "ch-tree-x-drag-info" }, this.dragInfo))));
|
|
553
|
+
} }, index.h("div", { role: "tree", part: "tree-x-container", "aria-multiselectable": this.multiSelection.toString(), class: "ch-tree-x-container" }, index.h("slot", null)), this.draggingInTree && (index.h("span", { "aria-hidden": "true", class: "ch-tree-x-drag-info" }, this.dragInfo))));
|
|
540
554
|
}
|
|
541
555
|
get el() { return index.getElement(this); }
|
|
542
556
|
};
|
|
543
557
|
ChTreeX.style = treeXCss;
|
|
544
558
|
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const ChTreeListX = class {
|
|
548
|
-
constructor(hostRef) {
|
|
549
|
-
index.registerInstance(this, hostRef);
|
|
550
|
-
}
|
|
551
|
-
render() {
|
|
552
|
-
return (index.h(index.Host, { role: "group" }, index.h("slot", null)));
|
|
553
|
-
}
|
|
554
|
-
get el() { return index.getElement(this); }
|
|
555
|
-
};
|
|
556
|
-
ChTreeListX.style = treeXListCss;
|
|
557
|
-
|
|
558
|
-
const treeXListItemCss = ":where(button){all:unset;display:flex;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 color-mix(in srgb, currentColor 65%, transparent);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;cursor:pointer;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;cursor:pointer}.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%;padding:0;margin:0;background-color:unset;color:unset;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}";
|
|
559
|
+
const treeXListItemCss = ":where(button){all:unset;display:flex;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 color-mix(in srgb, currentColor 65%, transparent);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;cursor:pointer;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;cursor:pointer}.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%;padding:0;margin:0;background-color:unset;color:unset;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-auto-rows:min-content;position:relative;content-visibility:auto;contain-intrinsic-size:auto 100px}.expandable--collapsed{display:none;overflow:hidden;content-visibility:hidden}";
|
|
559
560
|
|
|
560
561
|
const resetDragImage = new Image();
|
|
561
562
|
const INITIAL_LEVEL = 0;
|
|
562
563
|
// Selectors
|
|
563
564
|
const TREE_ITEM_TAG_NAME = "ch-tree-x-list-item";
|
|
564
|
-
const DIRECT_TREE_ITEM_CHILDREN = `:scope
|
|
565
|
+
const DIRECT_TREE_ITEM_CHILDREN = `:scope>${TREE_ITEM_TAG_NAME}`;
|
|
565
566
|
const FIRST_ENABLED_SUB_ITEM = `${TREE_ITEM_TAG_NAME}:not([disabled])`;
|
|
566
|
-
const LAST_SUB_ITEM = `:scope
|
|
567
|
+
const LAST_SUB_ITEM = `:scope>${TREE_ITEM_TAG_NAME}:last-child`;
|
|
567
568
|
// Keys
|
|
568
569
|
const EXPANDABLE_ID = "expandable";
|
|
569
570
|
const ENTER_KEY = "Enter";
|
|
@@ -587,6 +588,7 @@ const ChTreeXListItem = class {
|
|
|
587
588
|
this.itemDragEnd = index.createEvent(this, "itemDragEnd", 7);
|
|
588
589
|
this.loadLazyContent = index.createEvent(this, "loadLazyContent", 7);
|
|
589
590
|
this.modifyCaption = index.createEvent(this, "modifyCaption", 7);
|
|
591
|
+
this.openReference = index.createEvent(this, "openReference", 7);
|
|
590
592
|
this.selectedItemChange = index.createEvent(this, "selectedItemChange", 7);
|
|
591
593
|
this.selectedItemSync = index.createEvent(this, "selectedItemSync", 7);
|
|
592
594
|
/**
|
|
@@ -733,16 +735,15 @@ const ChTreeXListItem = class {
|
|
|
733
735
|
this.expanded = !this.expanded;
|
|
734
736
|
}
|
|
735
737
|
this.selected = true;
|
|
736
|
-
this.selectedItemChange.emit(this.getSelectedInfo(helpers.mouseEventModifierKey(event),
|
|
738
|
+
this.selectedItemChange.emit(this.getSelectedInfo(helpers.mouseEventModifierKey(event), true));
|
|
737
739
|
};
|
|
738
|
-
this.getSelectedInfo = (ctrlKeyPressed,
|
|
740
|
+
this.getSelectedInfo = (ctrlKeyPressed, selected) => ({
|
|
739
741
|
ctrlKeyPressed: ctrlKeyPressed,
|
|
740
742
|
expanded: this.expanded,
|
|
741
|
-
goToReference: goToReference,
|
|
742
743
|
id: this.el.id,
|
|
743
744
|
itemRef: this.el,
|
|
744
745
|
metadata: this.metadata,
|
|
745
|
-
parentId: this.el.parentElement.
|
|
746
|
+
parentId: this.el.parentElement.id,
|
|
746
747
|
selected: selected
|
|
747
748
|
});
|
|
748
749
|
this.handleActionDblClick = (event) => {
|
|
@@ -751,8 +752,11 @@ const ChTreeXListItem = class {
|
|
|
751
752
|
this.toggleSelected();
|
|
752
753
|
return;
|
|
753
754
|
}
|
|
755
|
+
this.emitOpenReference();
|
|
754
756
|
// The Control key is not pressed, so the control can be expanded
|
|
755
|
-
this.
|
|
757
|
+
if (!this.leaf) {
|
|
758
|
+
this.toggleExpand(event);
|
|
759
|
+
}
|
|
756
760
|
};
|
|
757
761
|
/**
|
|
758
762
|
* Event triggered by the following actions on the main button:
|
|
@@ -772,6 +776,7 @@ const ChTreeXListItem = class {
|
|
|
772
776
|
this.toggleOrSelect(event);
|
|
773
777
|
return;
|
|
774
778
|
}
|
|
779
|
+
this.emitOpenReference();
|
|
775
780
|
// Enter or space
|
|
776
781
|
this.toggleExpand(event);
|
|
777
782
|
};
|
|
@@ -857,7 +862,6 @@ const ChTreeXListItem = class {
|
|
|
857
862
|
}
|
|
858
863
|
handleSelectedChange(newValue) {
|
|
859
864
|
this.selectedItemSync.emit(this.getSelectedInfo(true, // Does not matter in this case
|
|
860
|
-
false, // Does not matter in this case
|
|
861
865
|
newValue));
|
|
862
866
|
}
|
|
863
867
|
handleShowLinesChange(newShowLines) {
|
|
@@ -921,8 +925,7 @@ const ChTreeXListItem = class {
|
|
|
921
925
|
return;
|
|
922
926
|
}
|
|
923
927
|
// Otherwise, ask the parent to focus the next sibling
|
|
924
|
-
const parentItem = this.el.parentElement
|
|
925
|
-
.parentElement;
|
|
928
|
+
const parentItem = this.el.parentElement;
|
|
926
929
|
parentItem.focusNextSibling(ctrlKeyPressed);
|
|
927
930
|
}
|
|
928
931
|
/**
|
|
@@ -942,8 +945,7 @@ const ChTreeXListItem = class {
|
|
|
942
945
|
return;
|
|
943
946
|
}
|
|
944
947
|
// Otherwise, set focus in the parent element
|
|
945
|
-
const parentItem = this.el.parentElement
|
|
946
|
-
.parentElement;
|
|
948
|
+
const parentItem = this.el.parentElement;
|
|
947
949
|
// Check if the parent is not disabled
|
|
948
950
|
if (parentItem.disabled) {
|
|
949
951
|
parentItem.focusPreviousItem(ctrlKeyPressed);
|
|
@@ -981,7 +983,7 @@ const ChTreeXListItem = class {
|
|
|
981
983
|
this.headerRef.focus();
|
|
982
984
|
// Normal navigation auto selects the item.
|
|
983
985
|
if (!ctrlKeyPressed) {
|
|
984
|
-
this.setSelected(
|
|
986
|
+
this.setSelected();
|
|
985
987
|
}
|
|
986
988
|
}
|
|
987
989
|
getDirectTreeItems() {
|
|
@@ -1014,34 +1016,41 @@ const ChTreeXListItem = class {
|
|
|
1014
1016
|
toggleSelected() {
|
|
1015
1017
|
const selected = !this.selected;
|
|
1016
1018
|
this.selected = selected;
|
|
1017
|
-
this.selectedItemChange.emit(this.getSelectedInfo(true,
|
|
1019
|
+
this.selectedItemChange.emit(this.getSelectedInfo(true, selected));
|
|
1018
1020
|
}
|
|
1019
|
-
setSelected(
|
|
1021
|
+
setSelected() {
|
|
1020
1022
|
this.selected = true;
|
|
1021
|
-
this.selectedItemChange.emit(this.getSelectedInfo(false,
|
|
1023
|
+
this.selectedItemChange.emit(this.getSelectedInfo(false, true));
|
|
1022
1024
|
}
|
|
1023
1025
|
toggleOrSelect(event) {
|
|
1024
1026
|
if (helpers.mouseEventModifierKey(event)) {
|
|
1025
1027
|
this.toggleSelected();
|
|
1026
1028
|
}
|
|
1027
1029
|
else {
|
|
1028
|
-
this.setSelected(
|
|
1030
|
+
this.setSelected();
|
|
1029
1031
|
}
|
|
1030
1032
|
}
|
|
1033
|
+
emitOpenReference() {
|
|
1034
|
+
this.openReference.emit({
|
|
1035
|
+
id: this.el.id,
|
|
1036
|
+
leaf: this.leaf,
|
|
1037
|
+
metadata: this.metadata
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1031
1040
|
componentWillLoad() {
|
|
1032
|
-
const
|
|
1041
|
+
const parentElementItem = this.el
|
|
1042
|
+
.parentElement;
|
|
1033
1043
|
// Check if must lazy load
|
|
1034
1044
|
this.lazyLoadItems(this.expanded);
|
|
1035
1045
|
// Sync selected state with the main tree
|
|
1036
1046
|
if (this.selected) {
|
|
1037
|
-
this.selectedItemChange.emit(this.getSelectedInfo(true,
|
|
1047
|
+
this.selectedItemChange.emit(this.getSelectedInfo(true, true));
|
|
1038
1048
|
}
|
|
1039
1049
|
// No need to update more the status
|
|
1040
1050
|
if (this.level === INITIAL_LEVEL) {
|
|
1041
1051
|
return;
|
|
1042
1052
|
}
|
|
1043
1053
|
// Update checkbox status
|
|
1044
|
-
const parentElementItem = parentElement.parentElement;
|
|
1045
1054
|
if (parentElementItem.checkbox) {
|
|
1046
1055
|
this.checked = parentElementItem.checked;
|
|
1047
1056
|
}
|
|
@@ -1097,14 +1106,17 @@ const ChTreeXListItem = class {
|
|
|
1097
1106
|
index.h("div", { class: {
|
|
1098
1107
|
action: true,
|
|
1099
1108
|
"readonly-mode": !this.editing
|
|
1100
|
-
}, part: `action
|
|
1109
|
+
}, part: `action${!this.editing ? " readonly-mode" : ""}${!this.leaf && this.expanded ? " expanded" : ""}`, onDblClick: !this.editing ? this.handleActionDblClick : null }, this.leftImgSrc && this.renderImg("left-img", this.leftImgSrc), this.editable && 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 &&
|
|
1101
1110
|
this.renderImg("right-img", this.rightImgSrc)),
|
|
1102
1111
|
this.showDownloadingSpinner && !this.leaf && this.downloading && (index.h("div", { class: "downloading", part: "downloading" }))
|
|
1103
1112
|
]), (showAllLines || showLastLine) && (index.h("div", { class: {
|
|
1104
1113
|
"dashed-line": true,
|
|
1105
1114
|
"last-all-line": showAllLines && this.lastItem,
|
|
1106
1115
|
"last-line": showLastLine
|
|
1107
|
-
}, 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: {
|
|
1116
|
+
}, part: `dashed-line${this.lastItem ? " last-all-line" : ""}` }))), hasContent && (index.h("div", { role: "group", "aria-busy": this.downloading.toString(), "aria-live": this.downloading ? "polite" : null, id: EXPANDABLE_ID, class: {
|
|
1117
|
+
expandable: true,
|
|
1118
|
+
"expandable--collapsed": !this.expanded
|
|
1119
|
+
}, part: `expandable${this.expanded ? " expanded" : " collapsed"}` }, index.h("slot", null)))));
|
|
1108
1120
|
}
|
|
1109
1121
|
get el() { return index.getElement(this); }
|
|
1110
1122
|
static get watchers() { return {
|
|
@@ -1120,5 +1132,4 @@ ChTreeXListItem.style = treeXListItemCss;
|
|
|
1120
1132
|
|
|
1121
1133
|
exports.ch_checkbox = CheckBox;
|
|
1122
1134
|
exports.ch_tree_x = ChTreeX;
|
|
1123
|
-
exports.ch_tree_x_list = ChTreeListX;
|
|
1124
1135
|
exports.ch_tree_x_list_item = ChTreeXListItem;
|
|
@@ -202,7 +202,7 @@ const ChSuggest = class {
|
|
|
202
202
|
windowClosedHandler() {
|
|
203
203
|
this.textInput.focus();
|
|
204
204
|
this.windowHidden = true;
|
|
205
|
-
this.
|
|
205
|
+
this.slot.innerHTML = "";
|
|
206
206
|
}
|
|
207
207
|
// 9.PUBLIC METHODS API //
|
|
208
208
|
/**
|
|
@@ -214,7 +214,7 @@ const ChSuggest = class {
|
|
|
214
214
|
}
|
|
215
215
|
// 10.RENDER() FUNCTION //
|
|
216
216
|
render() {
|
|
217
|
-
return (index.h(index.Host, null, index.h("div", { class: "main-wrapper", part: "main-wrapper" }, index.h("div", { class: "label-input-wrapper", part: "label-input-wrapper" }, this.showLabel && this.label && (index.h("label", { id: "label", htmlFor: "input", part: "label" }, this.label)), index.h("input", { type: "text", id: "input", part: "input", class: "input", ref: el => (this.textInput = el), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.onFocusHandler, value: this.value, autocomplete: "off", "aria-controls": "ch-window", "aria-label": !this.showLabel && this.label ? this.label : undefined, "aria-labelledby": this.showLabel && this.label ? "label" : undefined, "aria-expanded": this.windowHidden.toString() })), index.h("ch-window", { id: "ch-window", container: this.textInput, "close-on-outside-click": true, "close-on-escape": true, xAlign: "inside-start", yAlign: "outside-end", ref: el => (this.chWindow = el), showHeader: this.showHeader, caption: this.suggestTitle, exportparts: "\n header:header, \n caption:title, \n close:close-button,\n window:dropdown" }, index.h("slot", { onSlotchange: this.evaluateSlotIsEmpty })))));
|
|
217
|
+
return (index.h(index.Host, null, index.h("div", { class: "main-wrapper", part: "main-wrapper" }, index.h("div", { class: "label-input-wrapper", part: "label-input-wrapper" }, this.showLabel && this.label && (index.h("label", { id: "label", htmlFor: "input", part: "label" }, this.label)), index.h("input", { type: "text", id: "input", part: "input", class: "input", ref: el => (this.textInput = el), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.onFocusHandler, value: this.value, autocomplete: "off", "aria-controls": "ch-window", "aria-label": !this.showLabel && this.label ? this.label : undefined, "aria-labelledby": this.showLabel && this.label ? "label" : undefined, "aria-expanded": this.windowHidden.toString() })), index.h("ch-window", { id: "ch-window", container: this.textInput, "close-on-outside-click": true, "close-on-escape": true, xAlign: "inside-start", yAlign: "outside-end", ref: el => (this.chWindow = el), showHeader: this.showHeader, caption: this.suggestTitle, exportparts: "\n header:header, \n caption:title, \n close:close-button,\n window:dropdown" }, index.h("slot", { onSlotchange: this.evaluateSlotIsEmpty, ref: el => (this.slot = el) })))));
|
|
218
218
|
}
|
|
219
219
|
static get delegatesFocus() { return true; }
|
|
220
220
|
get el() { return index.getElement(this); }
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-5a32426a.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @description This function converts SelectorCategoryData[] SuggestData
|
|
9
|
+
*/
|
|
10
|
+
const convertObjectDataToSuggestData = (selectorCategoriesData) => {
|
|
11
|
+
const suggestData = {
|
|
12
|
+
suggestItems: null,
|
|
13
|
+
suggestLists: []
|
|
14
|
+
};
|
|
15
|
+
if (selectorCategoriesData.length) {
|
|
16
|
+
selectorCategoriesData.forEach(selectorCategory => {
|
|
17
|
+
const suggestList = {
|
|
18
|
+
label: selectorCategory.name,
|
|
19
|
+
items: []
|
|
20
|
+
};
|
|
21
|
+
selectorCategory.items.forEach((objectData) => {
|
|
22
|
+
const suggestItem = {
|
|
23
|
+
value: objectData.id,
|
|
24
|
+
description: objectData.description,
|
|
25
|
+
icon: objectData.icon
|
|
26
|
+
};
|
|
27
|
+
suggestList.items.push(suggestItem);
|
|
28
|
+
});
|
|
29
|
+
suggestData.suggestLists.push(suggestList);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return suggestData;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
36
|
+
const renderSuggestLists = (suggestData) => {
|
|
37
|
+
if (suggestData === null || suggestData === void 0 ? void 0 : suggestData.suggestLists.length) {
|
|
38
|
+
const randomNumber = Math.random();
|
|
39
|
+
const result = suggestData.suggestLists.map((list) => {
|
|
40
|
+
return (index.h("ch-suggest-list", { label: list.label, key: randomNumber }, list.items.map((item) => {
|
|
41
|
+
return renderSuggestListsItem(item);
|
|
42
|
+
})));
|
|
43
|
+
});
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
48
|
+
const renderSuggestListsItem = (suggestItem) => {
|
|
49
|
+
return (index.h("ch-suggest-list-item", { value: suggestItem.value }, [suggestItem.description || suggestItem.value]));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const testSuggestCss = ":host{display:block}:root{--highlight-color:rgb(163, 25, 161)}ch-suggest{display:block}ch-suggest::part(title){display:block;font-weight:bold}ch-suggest::part(label){font-weight:500}ch-suggest[label-position=\"start\"]::part(label){margin-inline-end:8px;display:flex;align-items:center}ch-suggest[label-position=\"above\"]::part(label){margin-block-end:4px}ch-suggest::part(close-button){display:block;width:16px;height:16px}ch-suggest::part(close-button)::after{content:\"✖\";line-height:8px;height:100%;display:block;border:1px solid black;cursor:pointer;text-align:center;line-height:16px}ch-suggest::part(header){display:flex;justify-content:space-between;align-items:center;margin-block-end:8px}ch-suggest::part(ch-window-close){width:10px;height:10px}ch-suggest::part(input){padding:4px 8px;border:1px solid black}ch-suggest::part(input):focus{outline:2px solid var(--highlight-color);border-color:var(--highlight-color)}ch-suggest-list{background-color:rgba(234, 234, 234, 0.224);border:1px solid rgba(128, 128, 128, 0.275);border-radius:4px;padding:8px;margin-block-end:4px}ch-suggest-list::part(title){font-size:14px;font-weight:bold;text-transform:uppercase;margin:4px 0 8px 0}ch-suggest-list-item::part(button){padding:4px 8px;cursor:pointer;gap:4px}ch-suggest-list-item ch-icon{--icon-size:16px;margin-inline-end:2px}ch-suggest-list-item:hover{background-color:var(--ch-color--violet-100)}ch-suggest-list-item:focus,ch-suggest-list-item[selected]:focus{outline:2px solid var(--highlight-color)}ch-suggest-list-item[selected]{background-color:rgba(241, 184, 243, 0.42);outline:none}ch-suggest-list-item::part(button):focus{outline:2px solid var(--highlight-color);border-color:var(--highlight-color)}ch-suggest-list-item::part(content-wrapper){display:flex;gap:8px}ch-suggest::part(dropdown){margin-block-start:4px;border:1px solid black;background-color:white;padding:8px}:focus{outline-style:none !important}";
|
|
53
|
+
|
|
54
|
+
const ChTestSuggest = class {
|
|
55
|
+
constructor(hostRef) {
|
|
56
|
+
index.registerInstance(this, hostRef);
|
|
57
|
+
// 5.EVENTS (EMIT) //
|
|
58
|
+
// 6.COMPONENT LIFECYCLE EVENTS //
|
|
59
|
+
// 7.LISTENERS //
|
|
60
|
+
// 8.PUBLIC METHODS API //
|
|
61
|
+
// 9.LOCAL METHODS //
|
|
62
|
+
/**
|
|
63
|
+
* This handler gets fired every time the value of the 'Select Object' ch-suggest changes.
|
|
64
|
+
*/
|
|
65
|
+
this.selectObjectValueChangedHandler = async (e) => {
|
|
66
|
+
const value = e.detail;
|
|
67
|
+
this.selectorSourceCallback(value)
|
|
68
|
+
.then(result => {
|
|
69
|
+
/* show suggestions*/
|
|
70
|
+
this.objectsSuggestions = convertObjectDataToSuggestData(result);
|
|
71
|
+
})
|
|
72
|
+
.catch(() => {
|
|
73
|
+
// to do
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// 10.RENDER() FUNCTION //
|
|
78
|
+
render() {
|
|
79
|
+
return (index.h(index.Host, null, index.h("ch-suggest", { onValueChanged: this.selectObjectValueChangedHandler, part: "object-selector-suggest", exportparts: "dropdown:select-object-dropdown" }, renderSuggestLists(this.objectsSuggestions))));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
ChTestSuggest.style = testSuggestCss;
|
|
83
|
+
|
|
84
|
+
exports.ch_test_suggest = ChTestSuggest;
|
|
@@ -9,17 +9,21 @@ const testTreeXCss = "ch-test-tree-x{display:contents}";
|
|
|
9
9
|
const DEFAULT_DRAG_DISABLED_VALUE = false;
|
|
10
10
|
const DEFAULT_DROP_DISABLED_VALUE = false;
|
|
11
11
|
const DEFAULT_CLASS_VALUE = "tree-view-item";
|
|
12
|
+
const DEFAULT_EDITABLE_ITEMS_VALUE = true;
|
|
12
13
|
const DEFAULT_EXPANDED_VALUE = false;
|
|
13
14
|
const DEFAULT_INDETERMINATE_VALUE = false;
|
|
14
15
|
const DEFAULT_LAZY_VALUE = false;
|
|
16
|
+
const DEFAULT_ORDER_VALUE = 0;
|
|
15
17
|
const DEFAULT_SELECTED_VALUE = false;
|
|
16
18
|
const ChTestTreeX = class {
|
|
17
19
|
constructor(hostRef) {
|
|
18
20
|
index.registerInstance(this, hostRef);
|
|
21
|
+
this.itemContextmenu = index.createEvent(this, "itemContextmenu", 7);
|
|
22
|
+
this.itemOpenReference = index.createEvent(this, "itemOpenReference", 7);
|
|
23
|
+
this.selectedItemsChange = index.createEvent(this, "selectedItemsChange", 7);
|
|
19
24
|
// UI Models
|
|
20
25
|
this.flattenedTreeModel = new Map();
|
|
21
26
|
this.selectedItems = new Set();
|
|
22
|
-
this.flattenedLazyTreeModel = new Map();
|
|
23
27
|
/**
|
|
24
28
|
* This property lets you specify if the tree is waiting to process the drop
|
|
25
29
|
* of items.
|
|
@@ -27,12 +31,12 @@ const ChTestTreeX = class {
|
|
|
27
31
|
this.waitDropProcessing = false;
|
|
28
32
|
/**
|
|
29
33
|
* This attribute lets you specify if the drag operation is disabled in all
|
|
30
|
-
* items by default. If `true`, the
|
|
34
|
+
* items by default. If `true`, the items can't be dragged.
|
|
31
35
|
*/
|
|
32
36
|
this.dragDisabled = DEFAULT_DRAG_DISABLED_VALUE;
|
|
33
37
|
/**
|
|
34
38
|
* This attribute lets you specify if the drop operation is disabled in all
|
|
35
|
-
* items by default. If `true`, the
|
|
39
|
+
* items by default. If `true`, the items won't accept any drops.
|
|
36
40
|
*/
|
|
37
41
|
this.dropDisabled = DEFAULT_DROP_DISABLED_VALUE;
|
|
38
42
|
/**
|
|
@@ -43,6 +47,11 @@ const ChTestTreeX = class {
|
|
|
43
47
|
* Set this attribute if you want to allow multi selection of the items.
|
|
44
48
|
*/
|
|
45
49
|
this.multiSelection = false;
|
|
50
|
+
/**
|
|
51
|
+
* This attribute lets you specify if the edit operation is enabled in all
|
|
52
|
+
* items by default. If `true`, the items can edit its caption in place.
|
|
53
|
+
*/
|
|
54
|
+
this.editableItems = DEFAULT_EDITABLE_ITEMS_VALUE;
|
|
46
55
|
/**
|
|
47
56
|
* `true` to display the relation between tree items and tree lists using
|
|
48
57
|
* lines.
|
|
@@ -62,6 +71,7 @@ const ChTestTreeX = class {
|
|
|
62
71
|
});
|
|
63
72
|
};
|
|
64
73
|
this.handleSelectedItemsChange = (event) => {
|
|
74
|
+
event.stopPropagation();
|
|
65
75
|
const itemsToProcess = new Map(event.detail);
|
|
66
76
|
// Remove no longer selected items
|
|
67
77
|
this.selectedItems.forEach(selectedItemId => {
|
|
@@ -85,12 +95,17 @@ const ChTestTreeX = class {
|
|
|
85
95
|
newSelectedItem.expanded = newSelectedItemInfo.expanded;
|
|
86
96
|
this.selectedItems.add(itemId);
|
|
87
97
|
});
|
|
98
|
+
this.selectedItemsChange.emit(event.detail);
|
|
88
99
|
};
|
|
89
100
|
this.handleExpandedItemChange = (event) => {
|
|
90
101
|
const detail = event.detail;
|
|
91
102
|
const itemInfo = this.flattenedTreeModel.get(detail.id).item;
|
|
92
103
|
itemInfo.expanded = detail.expanded;
|
|
93
104
|
};
|
|
105
|
+
this.handleItemContextmenu = (event) => {
|
|
106
|
+
event.stopPropagation();
|
|
107
|
+
this.itemContextmenu.emit(event.detail);
|
|
108
|
+
};
|
|
94
109
|
this.handleItemsDropped = (event) => {
|
|
95
110
|
if (!this.dropItemsCallback) {
|
|
96
111
|
return;
|
|
@@ -155,13 +170,13 @@ const ChTestTreeX = class {
|
|
|
155
170
|
itemUIModelExtended.parentItem = newParentUIModel;
|
|
156
171
|
};
|
|
157
172
|
this.renderSubModel = (treeSubModel, lastItem, level) => {
|
|
158
|
-
var _a, _b;
|
|
159
|
-
return (index.h("ch-tree-x-list-item", { id: treeSubModel.id, caption: treeSubModel.caption, checkbox: treeSubModel.checkbox, checked: treeSubModel.checked, class: treeSubModel.class, disabled: treeSubModel.disabled, downloading: treeSubModel.downloading, dragDisabled: (_a = treeSubModel.dragDisabled) !== null && _a !== void 0 ? _a : this.dragDisabled, dropDisabled: (_b = treeSubModel.dropDisabled) !== null && _b !== void 0 ? _b : this.dropDisabled, expanded: treeSubModel.expanded, indeterminate: treeSubModel.indeterminate, lastItem: lastItem, lazyLoad: treeSubModel.lazy, leaf: treeSubModel.leaf, leftImgSrc: treeSubModel.leftImgSrc, level: level, metadata: treeSubModel.metadata, rightImgSrc: treeSubModel.rightImgSrc, selected: treeSubModel.selected, showExpandableButton: treeSubModel.showExpandableButton, showLines: this.showLines, toggleCheckboxes: treeSubModel.toggleCheckboxes }, !treeSubModel.leaf &&
|
|
173
|
+
var _a, _b, _c;
|
|
174
|
+
return (index.h("ch-tree-x-list-item", { id: treeSubModel.id, caption: treeSubModel.caption, checkbox: treeSubModel.checkbox, checked: treeSubModel.checked, class: treeSubModel.class, disabled: treeSubModel.disabled, downloading: treeSubModel.downloading, dragDisabled: (_a = treeSubModel.dragDisabled) !== null && _a !== void 0 ? _a : this.dragDisabled, dropDisabled: (_b = treeSubModel.dropDisabled) !== null && _b !== void 0 ? _b : this.dropDisabled, editable: (_c = treeSubModel.editable) !== null && _c !== void 0 ? _c : this.editableItems, expanded: treeSubModel.expanded, indeterminate: treeSubModel.indeterminate, lastItem: lastItem, lazyLoad: treeSubModel.lazy, leaf: treeSubModel.leaf, leftImgSrc: treeSubModel.leftImgSrc, level: level, metadata: treeSubModel.metadata, rightImgSrc: treeSubModel.rightImgSrc, selected: treeSubModel.selected, showExpandableButton: treeSubModel.showExpandableButton, showLines: this.showLines, toggleCheckboxes: treeSubModel.toggleCheckboxes }, !treeSubModel.leaf &&
|
|
160
175
|
treeSubModel.items != null &&
|
|
161
|
-
treeSubModel.items.
|
|
176
|
+
treeSubModel.items.map((subModel, index) => this.renderSubModel(subModel, this.showLines && index === treeSubModel.items.length - 1, level + 1))));
|
|
162
177
|
};
|
|
163
178
|
this.flattenItemUIModel = (parentModel) => (item) => {
|
|
164
|
-
var _a, _b, _c, _d;
|
|
179
|
+
var _a, _b, _c, _d, _e;
|
|
165
180
|
this.flattenedTreeModel.set(item.id, {
|
|
166
181
|
parentItem: parentModel,
|
|
167
182
|
item: item
|
|
@@ -172,10 +187,8 @@ const ChTestTreeX = class {
|
|
|
172
187
|
(_a = item.expanded) !== null && _a !== void 0 ? _a : (item.expanded = DEFAULT_EXPANDED_VALUE);
|
|
173
188
|
(_b = item.indeterminate) !== null && _b !== void 0 ? _b : (item.indeterminate = DEFAULT_INDETERMINATE_VALUE);
|
|
174
189
|
(_c = item.lazy) !== null && _c !== void 0 ? _c : (item.lazy = DEFAULT_LAZY_VALUE);
|
|
175
|
-
(_d = item.
|
|
176
|
-
|
|
177
|
-
this.flattenedLazyTreeModel.set(item.id, item);
|
|
178
|
-
}
|
|
190
|
+
(_d = item.order) !== null && _d !== void 0 ? _d : (item.order = DEFAULT_ORDER_VALUE);
|
|
191
|
+
(_e = item.selected) !== null && _e !== void 0 ? _e : (item.selected = DEFAULT_SELECTED_VALUE);
|
|
179
192
|
if (item.selected) {
|
|
180
193
|
this.selectedItems.add(item.id);
|
|
181
194
|
}
|
|
@@ -190,9 +203,8 @@ const ChTestTreeX = class {
|
|
|
190
203
|
* lazy state, updates the item's UI Model.
|
|
191
204
|
*/
|
|
192
205
|
async loadLazyContent(itemId, items, downloading = false, lazy = false) {
|
|
193
|
-
const itemToLazyLoadContent = this.
|
|
206
|
+
const itemToLazyLoadContent = this.flattenedTreeModel.get(itemId).item;
|
|
194
207
|
// Establish that the content was lazy loaded
|
|
195
|
-
this.flattenedLazyTreeModel.delete(itemId);
|
|
196
208
|
itemToLazyLoadContent.downloading = downloading;
|
|
197
209
|
itemToLazyLoadContent.lazy = lazy;
|
|
198
210
|
// Check if there is items to add
|
|
@@ -343,11 +355,15 @@ const ChTestTreeX = class {
|
|
|
343
355
|
}
|
|
344
356
|
});
|
|
345
357
|
}
|
|
358
|
+
handleOpenReference(event) {
|
|
359
|
+
event.stopPropagation();
|
|
360
|
+
this.itemOpenReference.emit(event.detail);
|
|
361
|
+
}
|
|
346
362
|
flattenSubModel(model) {
|
|
347
363
|
const items = model.items;
|
|
348
364
|
if (!items) {
|
|
349
365
|
// Make sure that subtrees don't have an undefined array
|
|
350
|
-
if (model.leaf
|
|
366
|
+
if (model.leaf !== true) {
|
|
351
367
|
model.items = [];
|
|
352
368
|
}
|
|
353
369
|
return;
|
|
@@ -363,14 +379,13 @@ const ChTestTreeX = class {
|
|
|
363
379
|
}
|
|
364
380
|
flattenModel() {
|
|
365
381
|
this.flattenedTreeModel.clear();
|
|
366
|
-
this.flattenedLazyTreeModel.clear();
|
|
367
382
|
this.flattenSubModel({ id: null, caption: null, items: this.treeModel });
|
|
368
383
|
}
|
|
369
384
|
componentWillLoad() {
|
|
370
385
|
this.flattenModel();
|
|
371
386
|
}
|
|
372
387
|
render() {
|
|
373
|
-
return (index.h(
|
|
388
|
+
return (index.h("ch-tree-x", { class: this.cssClass || null, multiSelection: this.multiSelection, waitDropProcessing: this.waitDropProcessing, onDroppableZoneEnter: this.handleDroppableZoneEnter, onExpandedItemChange: this.handleExpandedItemChange, onItemContextmenu: this.handleItemContextmenu, onItemsDropped: this.handleItemsDropped, onSelectedItemsChange: this.handleSelectedItemsChange, ref: el => (this.treeRef = el) }, this.treeModel.map((subModel, index) => this.renderSubModel(subModel, this.showLines && index === this.treeModel.length - 1, 0))));
|
|
374
389
|
}
|
|
375
390
|
static get watchers() { return {
|
|
376
391
|
"treeModel": ["handleTreeModelChange"]
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-5a32426a.js');
|
|
6
|
+
const helpers = require('./helpers-291cb1cb.js');
|
|
7
|
+
|
|
8
|
+
const tooltipCss = "*,::after,::before{box-sizing:border-box}ch-tooltip{--ch-tooltip-separation:12px;--ch-tooltip-separation-x:var(--ch-tooltip-separation);--ch-tooltip-separation-y:var(--ch-tooltip-separation);--ch-tooltip-arrow-size:10px;--ch-tooltip-based:calc( 1px - var(--ch-tooltip-arrow-size));--ch-tooltip-centered:calc( 50% - var(--ch-tooltip-arrow-size) / 2);--ch-tooltip-75:calc( 75% - var(--ch-tooltip-arrow-size) / 2);--ch-tooltip-25:calc( 25% - var(--ch-tooltip-arrow-size) / 2);display:flex;position:relative;width:100%;height:100%}ch-tooltip:not([hidden]){display:contents}ch-window[y-align=outside-start]{--ch-window-separation:var(--ch-tooltip-separation-y);--ch-window-separation-y:calc(var(--ch-tooltip-separation-y) * -1)}ch-window[y-align=outside-end]{--ch-window-separation:var(--ch-tooltip-separation-y);--ch-window-separation-y:var(--ch-tooltip-separation-y)}ch-window[x-align=outside-start]+:not(ch-window[y-align=outside-start],ch-window[y-align=outside-end]){--ch-window-separation:var(--ch-tooltip-separation-x);--ch-window-separation-x:calc(var(--ch-tooltip-separation-x) * -1)}ch-window[x-align=outside-end]+:not(ch-window[y-align=outside-start],ch-window[y-align=outside-end]){--ch-window-separation:var(--ch-tooltip-separation-x);--ch-window-separation-x:var(--ch-tooltip-separation-x)}ch-window[y-align=outside-start] .tooltip-content::after,ch-window[y-align=outside-start][x-align=outside-start] .tooltip-content::after,ch-window[y-align=outside-start][x-align=outside-end] .tooltip-content::after{clip-path:polygon(0 0, 50% 100%, 100% 0);inset-block-end:var(--ch-tooltip-based)}ch-window[y-align=outside-start][x-align=outside-start] .tooltip-content::after,ch-window[y-align=outside-start][x-align=outside-start][x-align=outside-start] .tooltip-content::after,ch-window[y-align=outside-start][x-align=outside-end][x-align=outside-start] .tooltip-content::after{inset-inline-end:0}ch-window[y-align=outside-start][x-align=outside-end] .tooltip-content::after,ch-window[y-align=outside-start][x-align=outside-start][x-align=outside-end] .tooltip-content::after,ch-window[y-align=outside-start][x-align=outside-end][x-align=outside-end] .tooltip-content::after{inset-inline-start:0}ch-window[y-align=outside-end] .tooltip-content::after,ch-window[y-align=outside-end][x-align=outside-end] .tooltip-content::after,ch-window[y-align=outside-end][x-align=outside-start] .tooltip-content::after{clip-path:polygon(50% 0, 100% 100%, 0 100%);inset-block-start:var(--ch-tooltip-based)}ch-window[y-align=outside-end][x-align=outside-start] .tooltip-content::after,ch-window[y-align=outside-end][x-align=outside-end][x-align=outside-start] .tooltip-content::after,ch-window[y-align=outside-end][x-align=outside-start][x-align=outside-start] .tooltip-content::after{inset-inline-end:0}ch-window[y-align=outside-end][x-align=outside-end] .tooltip-content::after,ch-window[y-align=outside-end][x-align=outside-end][x-align=outside-end] .tooltip-content::after,ch-window[y-align=outside-end][x-align=outside-start][x-align=outside-end] .tooltip-content::after{inset-inline-start:0}ch-window[x-align=outside-start] .tooltip-content::after{clip-path:polygon(100% 50%, 0 0, 0 100%);inset-inline-end:var(--ch-tooltip-based)}ch-window[x-align=outside-end] .tooltip-content::after{clip-path:polygon(100% 0, 0 50%, 100% 100%);inset-inline-start:var(--ch-tooltip-based)}ch-window[x-align=center] .tooltip-content::after{inset-inline-start:var(--ch-tooltip-centered)}ch-window[x-align=inside-start] .tooltip-content::after{inset-inline-start:var(--ch-tooltip-75)}ch-window[x-align=inside-end] .tooltip-content::after{inset-inline-start:var(--ch-tooltip-25)}ch-window[y-align=inside-start] .tooltip-content::after{inset-block-start:var(--ch-tooltip-75)}ch-window[y-align=center] .tooltip-content::after{inset-block-start:var(--ch-tooltip-centered)}ch-window[y-align=inside-end] .tooltip-content::after{inset-block-start:var(--ch-tooltip-25)}.tooltip-content::after{content:\" \";position:absolute;background-color:inherit;width:var(--ch-tooltip-arrow-size);height:var(--ch-tooltip-arrow-size)}";
|
|
9
|
+
|
|
10
|
+
const mapTooltipAlignToChWindowAlign = {
|
|
11
|
+
OutsideStart: "outside-start",
|
|
12
|
+
InsideStart: "inside-start",
|
|
13
|
+
Center: "center",
|
|
14
|
+
InsideEnd: "inside-end",
|
|
15
|
+
OutsideEnd: "outside-end"
|
|
16
|
+
};
|
|
17
|
+
const EXPORT_PARTS = "window:section,mask";
|
|
18
|
+
const ChTooltip = class {
|
|
19
|
+
constructor(hostRef) {
|
|
20
|
+
index.registerInstance(this, hostRef);
|
|
21
|
+
/** Determines if the window and the tooltip is hidden or visible.
|
|
22
|
+
* Inherited from ch-window.
|
|
23
|
+
*/
|
|
24
|
+
this.hidden = true;
|
|
25
|
+
/**
|
|
26
|
+
* Specifies the tooltip description.
|
|
27
|
+
*/
|
|
28
|
+
this.tooltipId = "Tooltip";
|
|
29
|
+
/**
|
|
30
|
+
* Specifies the delay (in ms)
|
|
31
|
+
* for the tooltip to be displayed.
|
|
32
|
+
*/
|
|
33
|
+
this.delay = 100;
|
|
34
|
+
/**
|
|
35
|
+
* Specifies the position of the tooltip relative to
|
|
36
|
+
* the container element.
|
|
37
|
+
*/
|
|
38
|
+
this.position = "OutsideStart_Center";
|
|
39
|
+
this.showWithDelay = () => {
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
this.hidden = false;
|
|
42
|
+
}, this.delay);
|
|
43
|
+
};
|
|
44
|
+
this.handleEnter = () => {
|
|
45
|
+
if (!this.hidden) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this.showWithDelay();
|
|
49
|
+
};
|
|
50
|
+
this.handleLeave = () => {
|
|
51
|
+
if (this.container === helpers.focusComposedPath()[0]) {
|
|
52
|
+
this.hidden = false;
|
|
53
|
+
}
|
|
54
|
+
this.hidden = true;
|
|
55
|
+
};
|
|
56
|
+
this.addListeners = () => {
|
|
57
|
+
this.container.addEventListener("focus", this.handleEnter);
|
|
58
|
+
this.container.addEventListener("focusout", this.handleLeave);
|
|
59
|
+
this.container.addEventListener("mouseenter", this.handleEnter);
|
|
60
|
+
this.container.addEventListener("mouseleave", this.handleLeave);
|
|
61
|
+
};
|
|
62
|
+
this.removeListeners = () => {
|
|
63
|
+
this.container.removeEventListener("focus", this.handleEnter);
|
|
64
|
+
this.container.removeEventListener("focusout", this.handleLeave);
|
|
65
|
+
this.container.removeEventListener("mouseenter", this.handleEnter);
|
|
66
|
+
this.container.removeEventListener("mouseleave", this.handleLeave);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
componentDidLoad() {
|
|
70
|
+
this.container = document.querySelector('[slot="container"] > :first-child');
|
|
71
|
+
this.addListeners();
|
|
72
|
+
}
|
|
73
|
+
disconnectedCallback() {
|
|
74
|
+
this.removeListeners();
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
const aligns = this.position.split("_");
|
|
78
|
+
const alignX = aligns[0];
|
|
79
|
+
const alignY = aligns[1];
|
|
80
|
+
return (index.h(index.Host, null, index.h("slot", { name: "container" }), index.h("ch-window", { exportparts: EXPORT_PARTS, "show-header": false, "show-footer": false, modal: false, "close-on-escape": true, hidden: this.hidden, container: this.container, xAlign: mapTooltipAlignToChWindowAlign[alignX], yAlign: mapTooltipAlignToChWindowAlign[alignY] }, index.h("div", { role: "tooltip", class: "tooltip-content", id: this.tooltipId }, index.h("slot", { name: "content" })))));
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
ChTooltip.style = tooltipCss;
|
|
84
|
+
|
|
85
|
+
exports.ch_tooltip = ChTooltip;
|