@genexus/genexus-ide-ui 0.0.62 → 0.0.63
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-tree-x_3.cjs.entry.js → ch-checkbox_4.cjs.entry.js} +277 -71
- package/dist/cjs/ch-next-data-modeling-render.cjs.entry.js +242 -0
- package/dist/cjs/{ch-next-data-modeling-item.cjs.entry.js → ch-next-data-modeling_2.cjs.entry.js} +20 -1
- package/dist/cjs/ch-tree-view-render-wrapper.cjs.entry.js +160 -0
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-kb-manager-export.cjs.entry.js +41 -39
- package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +23 -11
- package/dist/cjs/gx-ide-test.cjs.entry.js +107 -122
- package/dist/cjs/gxg-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/gxg-title-editable.cjs.entry.js +11 -4
- package/dist/cjs/{gxg-tree_2.cjs.entry.js → gxg-tree-item.cjs.entry.js} +0 -212
- package/dist/cjs/gxg-tree-view.cjs.entry.js +165 -0
- package/dist/cjs/gxg-tree.cjs.entry.js +218 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +5 -3
- package/dist/collection/components/_test/test.css +5 -0
- package/dist/collection/components/_test/test.js +109 -220
- package/dist/collection/components/kb-manager-export/helpers.js +7 -23
- package/dist/collection/components/kb-manager-export/kb-manager-export.css +20 -0
- package/dist/collection/components/kb-manager-export/kb-manager-export.js +42 -22
- package/dist/collection/components/kb-manager-import/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.en.json +1 -0
- package/dist/collection/components/kb-manager-import/kb-manager-import.js +23 -11
- package/dist/components/ch-next-data-modeling-item.js +1 -457
- package/dist/components/ch-next-data-modeling-render.js +295 -0
- package/dist/components/ch-next-data-modeling.js +1 -27
- package/dist/components/ch-tree-view-item.js +6 -0
- package/dist/components/ch-tree-view-render-wrapper.js +224 -0
- package/dist/components/ch-tree-view-render.js +6 -0
- package/dist/components/ch-tree-view.js +6 -0
- package/dist/components/gx-ide-kb-manager-export.js +75 -73
- package/dist/components/gx-ide-kb-manager-import.js +38 -20
- package/dist/components/gx-ide-references.js +21 -15
- package/dist/components/gx-ide-test.js +120 -160
- package/dist/components/gxg-color-picker.js +2 -2
- package/dist/components/gxg-title-editable.js +12 -4
- package/dist/components/gxg-tree-item.js +614 -1
- package/dist/components/gxg-tree-view.js +2 -2
- package/dist/components/gxg-tree.js +236 -1
- package/dist/components/index.js +5 -3
- package/dist/components/next-data-modeling-item.js +466 -0
- package/dist/{esm/ch-next-data-modeling.entry.js → components/next-data-modeling.js} +21 -7
- package/dist/components/{tree-x-list-item.js → tree-view-item.js} +9 -9
- package/dist/components/{ch-test-tree-x.js → tree-view-render.js} +168 -28
- package/dist/components/tree-view.js +410 -435
- package/dist/components/tree-view2.js +226 -0
- package/dist/esm/{ch-tree-x_3.entry.js → ch-checkbox_4.entry.js} +275 -70
- package/dist/esm/ch-next-data-modeling-render.entry.js +238 -0
- package/dist/esm/{ch-next-data-modeling-item.entry.js → ch-next-data-modeling_2.entry.js} +21 -3
- package/dist/esm/ch-tree-view-render-wrapper.entry.js +156 -0
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-kb-manager-export.entry.js +41 -39
- package/dist/esm/gx-ide-kb-manager-import.entry.js +23 -11
- package/dist/esm/gx-ide-test.entry.js +108 -123
- package/dist/esm/gxg-color-picker.entry.js +2 -2
- package/dist/esm/gxg-title-editable.entry.js +11 -4
- package/dist/{components/gxg-tree-item2.js → esm/gxg-tree-item.entry.js} +9 -79
- package/dist/esm/gxg-tree-view.entry.js +161 -0
- package/dist/{components/gxg-tree2.js → esm/gxg-tree.entry.js} +8 -32
- 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/kb-manager-import/langs/kb-manager-import.lang.en.json +1 -0
- package/dist/genexus-ide-ui/p-13177896.entry.js +1 -0
- package/dist/genexus-ide-ui/p-19fef562.entry.js +1 -0
- package/dist/genexus-ide-ui/p-2781b92a.entry.js +1 -0
- package/dist/genexus-ide-ui/p-2c17e71d.entry.js +1 -0
- package/dist/genexus-ide-ui/p-40a57a36.entry.js +1 -0
- package/dist/genexus-ide-ui/p-636d02fa.entry.js +1 -0
- package/dist/genexus-ide-ui/p-7b63be93.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8a7c4561.entry.js +1 -0
- package/dist/genexus-ide-ui/p-a2cb0e6b.entry.js +1 -0
- package/dist/genexus-ide-ui/p-a9c8b373.entry.js +1 -0
- package/dist/genexus-ide-ui/p-b819706e.entry.js +1 -0
- package/dist/genexus-ide-ui/p-bacd879c.entry.js +1 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/next/data-modeling-render/next-data-modeling-render.css +3 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/renders/tree-view/tree-view-render.css +3 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-view/tree-view-render-wrapper.css +0 -0
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-view/tree-view/tree-view.css +45 -0
- package/dist/node_modules/@genexus/gemini/dist/collection/components/title-editable/title-editable.css +17 -3
- package/dist/node_modules/@genexus/gemini/dist/collection/components/tree-view/tree-view.css +5 -2
- package/dist/types/common/helpers.d.ts +2 -2
- package/dist/types/components/_test/test.d.ts +3 -35
- package/dist/types/components/kb-manager-export/helpers.d.ts +4 -4
- package/dist/types/components/kb-manager-export/kb-manager-export.d.ts +10 -5
- package/dist/types/components/kb-manager-import/helpers.d.ts +3 -3
- package/dist/types/components/kb-manager-import/kb-manager-import.d.ts +7 -6
- package/dist/types/components/references/helpers.d.ts +2 -2
- package/dist/types/components/references/references.d.ts +3 -3
- package/dist/types/components.d.ts +3 -60
- package/package.json +3 -3
- package/dist/cjs/ch-checkbox.cjs.entry.js +0 -93
- package/dist/cjs/ch-next-data-modeling.cjs.entry.js +0 -19
- package/dist/cjs/ch-test-tree-x.cjs.entry.js +0 -458
- package/dist/components/ch-tree-x-list-item.js +0 -6
- package/dist/components/ch-tree-x.js +0 -6
- package/dist/components/tree-x.js +0 -504
- package/dist/esm/ch-checkbox.entry.js +0 -89
- package/dist/esm/ch-test-tree-x.entry.js +0 -454
- package/dist/esm/gxg-tree_2.entry.js +0 -757
- package/dist/genexus-ide-ui/p-092ccacd.entry.js +0 -1
- package/dist/genexus-ide-ui/p-1ad68b23.entry.js +0 -3
- package/dist/genexus-ide-ui/p-3442d19a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-39968306.entry.js +0 -1
- package/dist/genexus-ide-ui/p-5755f985.entry.js +0 -1
- package/dist/genexus-ide-ui/p-85597097.entry.js +0 -1
- package/dist/genexus-ide-ui/p-9e530c7d.entry.js +0 -1
- package/dist/genexus-ide-ui/p-ad5040e4.entry.js +0 -1
- package/dist/genexus-ide-ui/p-aeb3b032.entry.js +0 -1
- package/dist/genexus-ide-ui/p-c53522c9.entry.js +0 -1
- package/dist/genexus-ide-ui/p-d104f9a4.entry.js +0 -1
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/test/test-tree-x.css +0 -3
- package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-view/tree-x/tree-x.css +0 -45
- /package/dist/node_modules/@genexus/chameleon-controls-library/dist/collection/components/tree-view/{tree-x-list-item/tree-x-list-item.css → tree-view-item/tree-view-item.css} +0 -0
|
@@ -1,6 +1,92 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, w as writeTask,
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement, w as writeTask, f as forceUpdate } from './index-0da01575.js';
|
|
2
|
+
import { D as DISABLED_CLASS } from './reserverd-names-2a2d0fb3.js';
|
|
2
3
|
import { f as focusComposedPath, m as mouseEventModifierKey } from './helpers-1ecd5e26.js';
|
|
3
4
|
|
|
5
|
+
const checkboxCss = "*,::before,::after{box-sizing:border-box}:host{display:flex;align-items:center;align-self:stretch;outline:unset;touch-action:manipulation;user-select:none}:host(.ch-checkbox--actionable) :is(.input,.label){cursor:pointer}.container{position:relative;width:min(1em, 20px);height:min(1em, 20px);border:1px solid var(--option-border-color, currentColor);border-radius:18.75%}.container--checked{background-color:var(--option-checked-color, #ffffff00)}.container:focus-within{box-shadow:0 0 1px 1px color-mix(in srgb, currentColor 25%, transparent)}.input{display:flex;width:100%;height:100%;opacity:0;margin:0;padding:0}.option{position:absolute;left:50%;top:50%;transform:translate(-50%, -50%);width:50%;height:50%;background-color:currentColor;opacity:0;pointer-events:none}.option--checked{opacity:1;-webkit-mask:url(\"data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' %3E%3Cpath fill='currentColor' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26l2.974 2.99L8 2.193z' /%3E%3C/svg%3E\")}.option--indeterminate{opacity:1}.label{margin-inline-start:min(0.35em, 7px)}";
|
|
6
|
+
|
|
7
|
+
const CHECKBOX_ID = "checkbox";
|
|
8
|
+
const PARTS = (checked, indeterminate) => `${checked ? " checked" : ""}${indeterminate ? " indeterminate" : ""}`;
|
|
9
|
+
const CheckBox = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
registerInstance(this, hostRef);
|
|
12
|
+
this.click = createEvent(this, "click", 7);
|
|
13
|
+
this.input = createEvent(this, "input", 7);
|
|
14
|
+
/**
|
|
15
|
+
* This attribute lets you specify if the element is disabled.
|
|
16
|
+
* If disabled, it will not fire any user interaction related event
|
|
17
|
+
* (for example, click event).
|
|
18
|
+
*/
|
|
19
|
+
this.disabled = false;
|
|
20
|
+
/**
|
|
21
|
+
* True to highlight control when an action is fired.
|
|
22
|
+
*/
|
|
23
|
+
this.highlightable = false;
|
|
24
|
+
/**
|
|
25
|
+
* `true` if the control's value is indeterminate.
|
|
26
|
+
*/
|
|
27
|
+
this.indeterminate = false;
|
|
28
|
+
/**
|
|
29
|
+
* This attribute indicates that the user cannot modify the value of the control.
|
|
30
|
+
* Same as [readonly](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)
|
|
31
|
+
* attribute for `input` elements.
|
|
32
|
+
*/
|
|
33
|
+
this.readonly = false;
|
|
34
|
+
this.getValue = (checked) => checked ? this.checkedValue : this.unCheckedValue;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if it is necessary to prevent the click from bubbling
|
|
37
|
+
*/
|
|
38
|
+
this.handleClick = (event) => {
|
|
39
|
+
if (this.readonly || this.disabled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
};
|
|
44
|
+
this.handleChange = (event) => {
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
const inputRef = event.target;
|
|
47
|
+
const checked = inputRef.checked;
|
|
48
|
+
const value = this.getValue(checked);
|
|
49
|
+
this.checked = checked;
|
|
50
|
+
this.value = value;
|
|
51
|
+
inputRef.value = value; // Update input's value before emitting the event
|
|
52
|
+
this.input.emit(event);
|
|
53
|
+
if (this.highlightable) {
|
|
54
|
+
this.click.emit();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
valueChanged() {
|
|
59
|
+
this.checked = this.value === this.checkedValue;
|
|
60
|
+
}
|
|
61
|
+
componentWillLoad() {
|
|
62
|
+
this.checked = this.value === this.checkedValue;
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
var _a;
|
|
66
|
+
const additionalParts = PARTS(this.checked, this.indeterminate);
|
|
67
|
+
return (h(Host, { class: {
|
|
68
|
+
[DISABLED_CLASS]: this.disabled,
|
|
69
|
+
"ch-checkbox--actionable": (!this.readonly && !this.disabled) ||
|
|
70
|
+
(this.readonly && this.highlightable)
|
|
71
|
+
} }, h("div", { class: {
|
|
72
|
+
container: true,
|
|
73
|
+
"container--checked": this.checked
|
|
74
|
+
}, part: `container${additionalParts}` }, h("input", { "aria-label": ((_a = this.accessibleName) === null || _a === void 0 ? void 0 : _a.trim()) !== "" &&
|
|
75
|
+
this.accessibleName !== this.caption
|
|
76
|
+
? this.accessibleName
|
|
77
|
+
: null, id: this.caption ? CHECKBOX_ID : null, class: "input", part: "input", type: "checkbox", checked: this.checked, disabled: this.disabled || this.readonly, indeterminate: this.indeterminate, value: this.value, onClick: this.handleClick, onInput: this.handleChange }), h("div", { class: {
|
|
78
|
+
option: true,
|
|
79
|
+
"option--checked": this.checked && !this.indeterminate,
|
|
80
|
+
"option--indeterminate": this.indeterminate
|
|
81
|
+
}, part: `option${additionalParts}`, "aria-hidden": "true" })), this.caption && (h("label", { class: "label", part: "label", htmlFor: CHECKBOX_ID, onClick: this.handleClick }, this.caption))));
|
|
82
|
+
}
|
|
83
|
+
get element() { return getElement(this); }
|
|
84
|
+
static get watchers() { return {
|
|
85
|
+
"value": ["valueChanged"]
|
|
86
|
+
}; }
|
|
87
|
+
};
|
|
88
|
+
CheckBox.style = checkboxCss;
|
|
89
|
+
|
|
4
90
|
const scrollToEdge = (event, container, scrollSpeed, scrollThreshold) => {
|
|
5
91
|
const mousePositionY = event.clientY - container.getBoundingClientRect().top;
|
|
6
92
|
const containerHeight = container.clientHeight;
|
|
@@ -15,10 +101,10 @@ const scrollToEdge = (event, container, scrollSpeed, scrollThreshold) => {
|
|
|
15
101
|
}
|
|
16
102
|
};
|
|
17
103
|
|
|
18
|
-
const
|
|
104
|
+
const treeViewCss = "ch-tree-view{display:flex;position:relative;width:100%;overflow:auto}ch-tree-view>.ch-tree-view-container{position:absolute;inset:0}ch-tree-view.ch-tree-view-dragging-item ch-tree-view-item{pointer-events:var(--ch-tree-view-pointer-events, all)}ch-tree-view.ch-tree-view-dragging-item .ch-tree-view-list-item--deny-drop{pointer-events:none}ch-tree-view.ch-tree-view--dragging-selected-items ch-tree-view-item[selected]{--ch-tree-view-pointer-events:none}ch-tree-view.ch-tree-view-waiting-drop-processing{cursor:wait}ch-tree-view.ch-tree-view-waiting-drop-processing>.ch-tree-view-container{pointer-events:none}.ch-tree-view-drag-info{--rtl-offset:16px;position:fixed;left:0;top:0;transform:translate(calc(var(--ch-tree-view-dragging-item-x) + var(--rtl-offset)), calc(var(--ch-tree-view-dragging-item-y) + 8px));pointer-events:none;z-index:1;animation:ch-tree-view-drag-info-fade-in 10ms}@keyframes ch-tree-view-drag-info-fade-in{0%,100%{opacity:0}}html[dir=rtl] .ch-tree-view-drag-info{--rtl-offset:-100%}";
|
|
19
105
|
|
|
20
|
-
const TREE_ITEM_TAG_NAME$1 = "ch-tree-
|
|
21
|
-
const TREE_TAG_NAME = "ch-tree-
|
|
106
|
+
const TREE_ITEM_TAG_NAME$1 = "ch-tree-view-item";
|
|
107
|
+
const TREE_TAG_NAME = "ch-tree-view";
|
|
22
108
|
// Selectors
|
|
23
109
|
// const CHECKED_ITEMS = `${TREE_ITEM_TAG_NAME}[checked]`;
|
|
24
110
|
const TEXT_FORMAT = "text/plain";
|
|
@@ -29,9 +115,9 @@ const isTreeItem = (element) => element.tagName.toLowerCase() === TREE_ITEM_TAG_
|
|
|
29
115
|
const getFocusedTreeItem = () => focusComposedPath().find(isTreeItem);
|
|
30
116
|
const canMoveTreeItemFocus = (treeItem) => treeItem && !treeItem.editing;
|
|
31
117
|
const getDroppableZoneKey = (newContainerId, draggedItems) => `"newContainerId":"${newContainerId}","metadata":"${JSON.stringify(draggedItems)}"`;
|
|
32
|
-
const POSITION_X_DRAG_CUSTOM_VAR = "--ch-tree-
|
|
33
|
-
const POSITION_Y_DRAG_CUSTOM_VAR = "--ch-tree-
|
|
34
|
-
const
|
|
118
|
+
const POSITION_X_DRAG_CUSTOM_VAR = "--ch-tree-view-dragging-item-x";
|
|
119
|
+
const POSITION_Y_DRAG_CUSTOM_VAR = "--ch-tree-view-dragging-item-y";
|
|
120
|
+
const ChTreeView = class {
|
|
35
121
|
constructor(hostRef) {
|
|
36
122
|
registerInstance(this, hostRef);
|
|
37
123
|
this.droppableZoneEnter = createEvent(this, "droppableZoneEnter", 7);
|
|
@@ -129,7 +215,7 @@ const ChTreeX = class {
|
|
|
129
215
|
// async getCheckedItems(): Promise<CheckedTreeItemInfo[]> {
|
|
130
216
|
// const checkedItems = Array.from(
|
|
131
217
|
// this.el.querySelectorAll(CHECKED_ITEMS)
|
|
132
|
-
// ) as
|
|
218
|
+
// ) as HTMLChTreeViewItemElement[];
|
|
133
219
|
// return checkedItems.map(item => ({
|
|
134
220
|
// id: item.id,
|
|
135
221
|
// caption: item.caption,
|
|
@@ -467,22 +553,22 @@ const ChTreeX = class {
|
|
|
467
553
|
}
|
|
468
554
|
render() {
|
|
469
555
|
return (h(Host, { class: {
|
|
470
|
-
"ch-tree-
|
|
471
|
-
"ch-tree-
|
|
472
|
-
"ch-tree-
|
|
473
|
-
"ch-tree-
|
|
474
|
-
} }, h("div", { role: "tree", part: "tree-x-container", "aria-multiselectable": this.multiSelection.toString(), class: "ch-tree-
|
|
556
|
+
"ch-tree-view-dragging-item": this.draggingInTheDocument,
|
|
557
|
+
"ch-tree-view-not-dragging-item": !this.draggingInTheDocument,
|
|
558
|
+
"ch-tree-view--dragging-selected-items": this.draggingInTree && this.draggingSelectedItems,
|
|
559
|
+
"ch-tree-view-waiting-drop-processing": this.waitDropProcessing
|
|
560
|
+
} }, h("div", { role: "tree", part: "tree-x-container", "aria-multiselectable": this.multiSelection.toString(), class: "ch-tree-view-container" }, h("slot", null)), this.draggingInTree && (h("span", { "aria-hidden": "true", class: "ch-tree-view-drag-info" }, this.dragInfo))));
|
|
475
561
|
}
|
|
476
562
|
get el() { return getElement(this); }
|
|
477
563
|
};
|
|
478
|
-
|
|
564
|
+
ChTreeView.style = treeViewCss;
|
|
479
565
|
|
|
480
|
-
const
|
|
566
|
+
const treeViewItemCss = ":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}";
|
|
481
567
|
|
|
482
568
|
const resetDragImage = new Image();
|
|
483
569
|
const INITIAL_LEVEL = 0;
|
|
484
570
|
// Selectors
|
|
485
|
-
const TREE_ITEM_TAG_NAME = "ch-tree-
|
|
571
|
+
const TREE_ITEM_TAG_NAME = "ch-tree-view-item";
|
|
486
572
|
const DIRECT_TREE_ITEM_CHILDREN = `:scope>${TREE_ITEM_TAG_NAME}`;
|
|
487
573
|
const FIRST_ENABLED_SUB_ITEM = `${TREE_ITEM_TAG_NAME}:not([disabled])`;
|
|
488
574
|
const LAST_SUB_ITEM = `:scope>${TREE_ITEM_TAG_NAME}:last-child`;
|
|
@@ -501,7 +587,7 @@ const CHECKBOX_EXPORT_PARTS = [
|
|
|
501
587
|
]
|
|
502
588
|
.map(getCheckboxExportPart)
|
|
503
589
|
.join(",");
|
|
504
|
-
const
|
|
590
|
+
const ChTreeViewItem = class {
|
|
505
591
|
constructor(hostRef) {
|
|
506
592
|
registerInstance(this, hostRef);
|
|
507
593
|
this.checkboxChange = createEvent(this, "checkboxChange", 7);
|
|
@@ -1060,11 +1146,44 @@ const ChTreeXListItem = class {
|
|
|
1060
1146
|
"showLines": ["handleShowLinesChange"]
|
|
1061
1147
|
}; }
|
|
1062
1148
|
};
|
|
1063
|
-
|
|
1149
|
+
ChTreeViewItem.style = treeViewItemCss;
|
|
1064
1150
|
|
|
1065
|
-
const
|
|
1151
|
+
const filterWithCamelCase = (stringToFilter, filter, camelCase) => camelCase
|
|
1152
|
+
? stringToFilter.includes(filter)
|
|
1153
|
+
: stringToFilter.toLowerCase().includes(filter.toLowerCase());
|
|
1154
|
+
const filterWithString = (stringToFilter, filter, filterOptions) => filterOptions.regularExpression
|
|
1155
|
+
? stringToFilter.match(filter) !== null
|
|
1156
|
+
: filterWithCamelCase(stringToFilter, filter, filterOptions.camelCase);
|
|
1157
|
+
const filterDictionary = {
|
|
1158
|
+
caption: (item, filterInfo) => {
|
|
1159
|
+
var _a;
|
|
1160
|
+
return filterInfo.filter
|
|
1161
|
+
? filterWithString((_a = item.caption) !== null && _a !== void 0 ? _a : "", filterInfo.filter, filterInfo.filterOptions)
|
|
1162
|
+
: true;
|
|
1163
|
+
},
|
|
1164
|
+
checked: (item, filterInfo) => {
|
|
1165
|
+
var _a, _b;
|
|
1166
|
+
return ((_a = item.checkbox) !== null && _a !== void 0 ? _a : filterInfo.defaultCheckbox) &&
|
|
1167
|
+
!item.indeterminate &&
|
|
1168
|
+
((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
|
|
1169
|
+
},
|
|
1170
|
+
"id-list": (item, filterInfo) => filterInfo.filterList.includes(item.id),
|
|
1171
|
+
metadata: (item, filterInfo) => {
|
|
1172
|
+
var _a;
|
|
1173
|
+
return filterInfo.filter
|
|
1174
|
+
? filterWithString((_a = item.metadata) !== null && _a !== void 0 ? _a : "", filterInfo.filter, filterInfo.filterOptions)
|
|
1175
|
+
: true;
|
|
1176
|
+
},
|
|
1177
|
+
none: () => true,
|
|
1178
|
+
unchecked: (item, filterInfo) => {
|
|
1179
|
+
var _a, _b;
|
|
1180
|
+
return ((_a = item.checkbox) !== null && _a !== void 0 ? _a : filterInfo.defaultCheckbox) &&
|
|
1181
|
+
!item.indeterminate &&
|
|
1182
|
+
!((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1066
1185
|
|
|
1067
|
-
const treeViewCss = ":root{--ui-animaton-speed:0.2s}.gxg-title-01{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-title-01--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-title-02{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em}.gxg-title-02--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-bold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em;color:var(--color-on-primary)}.gxg-title-03{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-xs);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em}.gxg-title-03--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-xs);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;text-transform:uppercase;line-height:1.556em;color:var(--color-on-primary)}.gxg-title-04{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-title-04--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-md);letter-spacing:var(--letter-spacing-md);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-title-05{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;line-height:1.556em}.gxg-title-05--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-sm);color:var(--color-on-background);text-align:start;line-height:1.556em;color:var(--color-on-primary)}.gxg-text{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em}.gxg-text--negative{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-on-primary)}.gxg-text--gray{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--gray-05)}.gxg-quote{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;font-style:italic}.gxg-quote--negative{color:var(--color-on-primary)}.gxg-link{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block}.gxg-link:hover{color:var(--color-primary-hover)}.gxg-link:active{color:var(--color-primary-active)}.gxg-link-gray{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block;color:var(--gray-04)}.gxg-link-gray:hover{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-primary);text-decoration:underline;cursor:pointer;display:inline-block;color:var(--gray-04);color:var(--gray-06)}.gxg-alert-error{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-error-dark);display:inline-block}.gxg-alert-warning{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-warning-dark);display:inline-block}.gxg-alert-success{font-family:var(--font-family-primary);font-weight:var(--font-weight-regular);font-size:var(--font-size-sm);letter-spacing:var(--letter-spacing-xs);color:var(--color-on-background);text-align:start;line-height:1.455em;color:var(--color-success-dark);display:inline-block}.gxg-tab--disabled{color:var(--color-primary-disabled);pointer-events:none}.gxg-tab--disabled[disabled]{color:var(--color-primary-disabled);pointer-events:none}.gxg-label{font-family:var(--font-family-primary) !important;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm) !important;letter-spacing:var(--letter-spacing-xs);color:var(--color-primary-enabled);text-align:center;line-height:1.455em}.gxg-label:hover{color:var(--color-primary-hover)}.gxg-label:focus{color:var(--color-primary-active)}.gxg-label:active{color:var(--color-primary-active)}.gxg-label[disabled]{color:var(--color-primary-disabled)}.gxg-label--negative{color:var(--color-on-primary)}.gxg-label--negative[disabled]{color:var(--color-on-disabled)}.gxg-button-styles{font-family:var(--font-family-primary) !important;font-weight:var(--font-weight-semibold);font-size:var(--font-size-sm) !important;letter-spacing:var(--letter-spacing-xs);color:var(--color-primary-enabled);text-align:center;line-height:1.455em}.gxg-scrollbar{}.gxg-scrollbar::-webkit-scrollbar{width:var(--gxg-scrollbar-width, 6px)}.gxg-scrollbar::-webkit-scrollbar-track{background-color:var(--gxg-scrollbar-track-background, --gray-02);border-radius:var(--gxg-scrollbar-track-border-radius, 10px)}.gxg-scrollbar::-webkit-scrollbar-thumb{background:var(--gxg-scrollbar-track-thumb-background, --gray-05);border-radius:var(--gxg-scrollbar-track-thumb-radius, 10px)}.gxg-scrollbar::-webkit-scrollbar-thumb:hover{background:var(--gxg-scrollbar-track-thumb-hover-background, --gray-04);cursor:pointer}gxg-tree-view{font-family:var(--font-family-primary);font-size:var(--font-size-lg);font-weight:var(--font-weight-regular);color:var(--color-on-background);display:contents}.tree-view{}.tree-view::-webkit-scrollbar{width:var(--gxg-scrollbar-width, 6px)}.tree-view::-webkit-scrollbar-track{background-color:var(--gxg-scrollbar-track-background, --gray-02);border-radius:var(--gxg-scrollbar-track-border-radius, 10px)}.tree-view::-webkit-scrollbar-thumb{background:var(--gxg-scrollbar-track-thumb-background, --gray-05);border-radius:var(--gxg-scrollbar-track-thumb-radius, 10px)}.tree-view::-webkit-scrollbar-thumb:hover{background:var(--gxg-scrollbar-track-thumb-hover-background, --gray-04);cursor:pointer}.tree-view-item{--checkbox-size:var(--gxg-checkbox-size);--expandable-button-width:var(--spacing-comp-04);}.tree-view-item::part(dashed-line){border-color:var(--gray-02)}.tree-view-item::part(header){padding-inline-end:calc(var(--spacing-comp-02) * 0.65);height:var(--spacing-comp-05);display:flex;gap:5px}.tree-view-item::part(header):first-child{margin-inline-start:var(--spacing-comp-01)}.tree-view-item::part(header):before{content:\"\";display:block}.tree-view-item::part(header):hover{background-color:var(--gxg-background-color--hover);color:var(--gxg-color--hover)}.tree-view-item::part(header):focus{outline:var(--border-width-md) solid var(--gxg-border-color--focused);outline-offset:-2px}.tree-view-item[selected]::part(header){background-color:var(--gxg-background-color--selected)}.tree-view-item[selected]::part(header):hover{background-color:var(--gxg-background-color--selected-hover)}.tree-view-item::part(expandable-button){background-color:var(--gray-00);margin-inline-end:0}.tree-view-item::part(expandable-button)::before{background-color:var(--gray-04);-webkit-mask-position:center;-webkit-mask-repeat:no-repeat}.tree-view-item::part(expandable-button):hover{background-color:var(--color-background)}.tree-view-item::part(expandable-button):focus{outline:var(--border-width-md) solid var(--gxg-border-color--focused);outline-offset:0}.tree-view-item::part(action){text-transform:capitalize;display:flex;gap:var(--spacing-comp-01)}.tree-view-item::part(left-img){width:var(--spacing-comp-04);height:var(--spacing-comp-04);margin-inline-end:0}.tree-view-item::part(downloading){width:var(--spacing-comp-03);height:var(--spacing-comp-03);border:var(--border-width-md) solid var(--color-primary-enabled);border-inline-start-color:transparent}.tree-view-item::part(checkbox__container){border-color:var(--gray-04);background-color:var(--color-background)}.tree-view-item::part(checkbox__container):after{content:\"\";position:absolute;display:block;border:solid;border-color:transparent;z-index:0}.tree-view-item::part(checkbox__container):focus-within{box-shadow:none;outline:var(--border-width-md) solid var(--gxg-border-color--focused);outline-offset:-2px}.tree-view-item::part(checkbox){margin-inline-end:0}.tree-view-item::part(checkbox__option){display:none}.tree-view-item::part(checkbox__container checkbox__checked):after{left:5.5px;top:3px;width:4px;height:7px;border-width:0 2px 2px 0;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);border-color:var(--color-primary-active);transition-property:border-color;transition-duration:var(--ui-animaton-speed);transition-timing-function:ease}.tree-view-item::part(checkbox__container checkbox__indeterminate):after{left:50%;top:50%;width:8px;height:1.5px;border:0;background-color:var(--color-primary-active);-webkit-transform:rotate(0) translateY(-50%) translateX(-50%);-ms-transform:rotate(0) translateY(-50%) translateX(-50%);transform:rotate(0) translateY(-50%) translateX(-50%)}.tree-view-item::part(checkbox__input){position:relative;z-index:1}.tree-view-item--folder::part(action)::before,.tree-view-item--module::part(action)::before{grid-area:left-img;content:\"\";width:14px;height:14px;margin-inline-end:4px;background-repeat:no-repeat}.tree-view-item--folder::part(action)::before{background-image:url(\"/build/icon-assets/objects/folder.svg\")}.tree-view-item--folder::part(action expanded)::before{background-image:url(\"/build/icon-assets/objects/folder-open.svg\")}.tree-view-item--module::part(action)::before{background-image:url(\"/build/icon-assets/objects/module.svg\")}.tree-view-item--module::part(action expanded)::before{background-image:url(\"/build/icon-assets/objects/module-open.svg\")}.tree-view-item--pending-commit::part(action)::before{content:\"\";position:relative;z-index:1;grid-area:left-img;width:5px;height:5px;align-self:end;margin-block-end:3px;margin-inline-start:1px;background-color:var(--color-primary-enabled);border-radius:50%}.ch-tree-x-list-item--editing::part(header){border:2px solid transparent}.ch-tree-x-list-item .ch-tree-x-drag-info{padding-inline:6px;padding-block:2px;background-color:#cfdee6;border:1px solid #0266a0;border-radius:10px;font-size:8px}";
|
|
1186
|
+
const treeViewRenderCss = "ch-tree-view-render{display:contents}";
|
|
1068
1187
|
|
|
1069
1188
|
const DEFAULT_DRAG_DISABLED_VALUE = false;
|
|
1070
1189
|
const DEFAULT_DROP_DISABLED_VALUE = false;
|
|
@@ -1075,7 +1194,13 @@ const DEFAULT_INDETERMINATE_VALUE = false;
|
|
|
1075
1194
|
const DEFAULT_LAZY_VALUE = false;
|
|
1076
1195
|
const DEFAULT_ORDER_VALUE = 0;
|
|
1077
1196
|
const DEFAULT_SELECTED_VALUE = false;
|
|
1078
|
-
const
|
|
1197
|
+
const defaultRenderItem = (itemModel, treeState, lastItem, level) => {
|
|
1198
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1199
|
+
return (treeState.filterType === "none" || itemModel.render !== false) && (h("ch-tree-view-item", { id: itemModel.id, caption: itemModel.caption, checkbox: (_a = itemModel.checkbox) !== null && _a !== void 0 ? _a : treeState.checkbox, checked: (_b = itemModel.checked) !== null && _b !== void 0 ? _b : treeState.checked, class: itemModel.class, disabled: itemModel.disabled, downloading: itemModel.downloading, dragDisabled: (_c = itemModel.dragDisabled) !== null && _c !== void 0 ? _c : treeState.dragDisabled, dropDisabled: (_d = itemModel.dropDisabled) !== null && _d !== void 0 ? _d : treeState.dropDisabled, editable: (_e = itemModel.editable) !== null && _e !== void 0 ? _e : treeState.editableItems, expanded: itemModel.expanded, indeterminate: itemModel.indeterminate, lastItem: lastItem, lazyLoad: itemModel.lazy, leaf: itemModel.leaf, leftImgSrc: itemModel.leftImgSrc, level: level, metadata: itemModel.metadata, rightImgSrc: itemModel.rightImgSrc, selected: itemModel.selected, showExpandableButton: itemModel.showExpandableButton, showLines: treeState.showLines, toggleCheckboxes: (_f = itemModel.toggleCheckboxes) !== null && _f !== void 0 ? _f : treeState.toggleCheckboxes }, !itemModel.leaf &&
|
|
1200
|
+
itemModel.items != null &&
|
|
1201
|
+
itemModel.items.map((subModel, index) => defaultRenderItem(subModel, treeState, treeState.showLines && index === itemModel.items.length - 1, level + 1))));
|
|
1202
|
+
};
|
|
1203
|
+
const ChTreeViewRender = class {
|
|
1079
1204
|
constructor(hostRef) {
|
|
1080
1205
|
registerInstance(this, hostRef);
|
|
1081
1206
|
this.checkedItemsChange = createEvent(this, "checkedItemsChange", 7);
|
|
@@ -1086,16 +1211,11 @@ const GxgTreeView = class {
|
|
|
1086
1211
|
this.flattenedTreeModel = new Map();
|
|
1087
1212
|
this.flattenedCheckboxTreeModel = new Map();
|
|
1088
1213
|
this.selectedItems = new Set();
|
|
1089
|
-
this.iconAssetsPath = getAssetPath(`./icon-assets`);
|
|
1090
1214
|
/**
|
|
1091
1215
|
* This property lets you specify if the tree is waiting to process the drop
|
|
1092
1216
|
* of items.
|
|
1093
1217
|
*/
|
|
1094
1218
|
this.waitDropProcessing = false;
|
|
1095
|
-
/**
|
|
1096
|
-
* Removes the default padding on '.ch-tree-x-container' (Added by Gemini)
|
|
1097
|
-
*/
|
|
1098
|
-
this.noPadding = false;
|
|
1099
1219
|
/**
|
|
1100
1220
|
* Set this attribute if you want display a checkbox in all items by default.
|
|
1101
1221
|
*/
|
|
@@ -1106,10 +1226,6 @@ const GxgTreeView = class {
|
|
|
1106
1226
|
* Only works if `checkbox = true`
|
|
1107
1227
|
*/
|
|
1108
1228
|
this.checked = false;
|
|
1109
|
-
/**
|
|
1110
|
-
* A CSS class to set as the `ch-tree-x` element class.
|
|
1111
|
-
*/
|
|
1112
|
-
this.cssClass = "tree-view";
|
|
1113
1229
|
/**
|
|
1114
1230
|
* This attribute lets you specify if the drag operation is disabled in all
|
|
1115
1231
|
* items by default. If `true`, the items can't be dragged.
|
|
@@ -1125,15 +1241,44 @@ const GxgTreeView = class {
|
|
|
1125
1241
|
* items by default. If `true`, the items can edit its caption in place.
|
|
1126
1242
|
*/
|
|
1127
1243
|
this.editableItems = DEFAULT_EDITABLE_ITEMS_VALUE;
|
|
1244
|
+
/**
|
|
1245
|
+
* This property lets you determine the list of items that will be filtered.
|
|
1246
|
+
* Only works if `filterType = "id-list"`.
|
|
1247
|
+
*/
|
|
1248
|
+
this.filterList = [];
|
|
1249
|
+
/**
|
|
1250
|
+
* This property lets you determine the options that will be applied to the
|
|
1251
|
+
* filter.
|
|
1252
|
+
* Only works if `filterType = "caption" | "metadata"`.
|
|
1253
|
+
*/
|
|
1254
|
+
this.filterOptions = {};
|
|
1255
|
+
/**
|
|
1256
|
+
* This attribute lets you define what kind of filter is applied to items.
|
|
1257
|
+
* Only items that satisfy the filter predicate will be displayed.
|
|
1258
|
+
*
|
|
1259
|
+
* | Value | Details |
|
|
1260
|
+
* | ----------- | ---------------------------------------------------------------------------------------------- |
|
|
1261
|
+
* | `checked` | Show only the items that have a checkbox and are checked. |
|
|
1262
|
+
* | `unchecked` | Show only the items that have a checkbox and are not checked. |
|
|
1263
|
+
* | `caption` | Show only the items whose `caption` satisfies the regex determinate by the `filter` property. |
|
|
1264
|
+
* | `metadata` | Show only the items whose `metadata` satisfies the regex determinate by the `filter` property. |
|
|
1265
|
+
* | `id-list` | Show only the items that are contained in the array determinate by the `filterList` property. |
|
|
1266
|
+
* | `none` | Show all items. |
|
|
1267
|
+
*/
|
|
1268
|
+
this.filterType = "none";
|
|
1128
1269
|
/**
|
|
1129
1270
|
* Set this attribute if you want to allow multi selection of the items.
|
|
1130
1271
|
*/
|
|
1131
1272
|
this.multiSelection = false;
|
|
1273
|
+
/**
|
|
1274
|
+
* This property allows us to implement custom rendering of tree items.
|
|
1275
|
+
*/
|
|
1276
|
+
this.renderItem = defaultRenderItem;
|
|
1132
1277
|
/**
|
|
1133
1278
|
* `true` to display the relation between tree items and tree lists using
|
|
1134
1279
|
* lines.
|
|
1135
1280
|
*/
|
|
1136
|
-
this.showLines = "
|
|
1281
|
+
this.showLines = "none";
|
|
1137
1282
|
/**
|
|
1138
1283
|
* Set this attribute if you want all the children item's checkboxes to be
|
|
1139
1284
|
* checked when the parent item checkbox is checked, or to be unchecked when
|
|
@@ -1154,7 +1299,7 @@ const GxgTreeView = class {
|
|
|
1154
1299
|
const requestTimestamp = new Date().getTime();
|
|
1155
1300
|
const dropInformation = event.detail;
|
|
1156
1301
|
const promise = this.checkDroppableZoneCallback(dropInformation);
|
|
1157
|
-
promise.then(
|
|
1302
|
+
promise.then(validDrop => {
|
|
1158
1303
|
this.updateValidDropZone(requestTimestamp, dropInformation.newContainer.id, dropInformation.draggedItems, validDrop);
|
|
1159
1304
|
});
|
|
1160
1305
|
};
|
|
@@ -1162,7 +1307,7 @@ const GxgTreeView = class {
|
|
|
1162
1307
|
event.stopPropagation();
|
|
1163
1308
|
const itemsToProcess = new Map(event.detail);
|
|
1164
1309
|
// Remove no longer selected items
|
|
1165
|
-
this.selectedItems.forEach(
|
|
1310
|
+
this.selectedItems.forEach(selectedItemId => {
|
|
1166
1311
|
const itemUIModel = this.flattenedTreeModel.get(selectedItemId).item;
|
|
1167
1312
|
const itemIsStillSelected = itemsToProcess.get(selectedItemId);
|
|
1168
1313
|
// The item does not need to be added. Remove it from the processed list
|
|
@@ -1242,6 +1387,10 @@ const GxgTreeView = class {
|
|
|
1242
1387
|
this.sortItems(newParentUIModel.items);
|
|
1243
1388
|
// Open the item to visualize the new subitems
|
|
1244
1389
|
newParentUIModel.expanded = true;
|
|
1390
|
+
// Re-sync checked items
|
|
1391
|
+
this.emitCheckedItemsChange();
|
|
1392
|
+
// Update filters
|
|
1393
|
+
this.processFilters();
|
|
1245
1394
|
// There is no need to force and update, since the waitDropProcessing
|
|
1246
1395
|
// prop was modified
|
|
1247
1396
|
});
|
|
@@ -1257,46 +1406,51 @@ const GxgTreeView = class {
|
|
|
1257
1406
|
// Reference the new parent in the item
|
|
1258
1407
|
itemUIModelExtended.parentItem = newParentUIModel;
|
|
1259
1408
|
};
|
|
1260
|
-
this.renderSubModel = (treeSubModel, lastItem, level) => {
|
|
1261
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1262
|
-
return (h("ch-tree-x-list-item", { id: treeSubModel.id, caption: treeSubModel.caption, checkbox: (_a = treeSubModel.checkbox) !== null && _a !== void 0 ? _a : this.checkbox, checked: (_b = treeSubModel.checked) !== null && _b !== void 0 ? _b : this.checked, class: treeSubModel.class, disabled: treeSubModel.disabled, downloading: treeSubModel.downloading, dragDisabled: (_c = treeSubModel.dragDisabled) !== null && _c !== void 0 ? _c : this.dragDisabled, dropDisabled: (_d = treeSubModel.dropDisabled) !== null && _d !== void 0 ? _d : this.dropDisabled, editable: (_e = treeSubModel.editable) !== null && _e !== void 0 ? _e : this.editableItems, expanded: treeSubModel.expanded, indeterminate: treeSubModel.indeterminate, lastItem: lastItem, lazyLoad: treeSubModel.lazy, leaf: treeSubModel.leaf, leftImgSrc: treeSubModel.leftImgSrc
|
|
1263
|
-
? resolveImgPath(this.iconAssetsPath, treeSubModel.leftImgSrc)
|
|
1264
|
-
: null, level: level, metadata: treeSubModel.metadata, rightImgSrc: treeSubModel.rightImgSrc, selected: treeSubModel.selected, showExpandableButton: treeSubModel.showExpandableButton, showLines: this.showLines, toggleCheckboxes: (_f = treeSubModel.toggleCheckboxes) !== null && _f !== void 0 ? _f : this.toggleCheckboxes }, !treeSubModel.leaf &&
|
|
1265
|
-
treeSubModel.items != null &&
|
|
1266
|
-
treeSubModel.items.map((subModel, index) => this.renderSubModel(subModel, this.showLines && index === treeSubModel.items.length - 1, level + 1))));
|
|
1267
|
-
};
|
|
1268
1409
|
this.flattenItemUIModel = (parentModel) => (item) => {
|
|
1269
|
-
var _a;
|
|
1410
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1270
1411
|
this.flattenedTreeModel.set(item.id, {
|
|
1271
1412
|
parentItem: parentModel,
|
|
1272
|
-
item: item
|
|
1413
|
+
item: item
|
|
1273
1414
|
});
|
|
1274
1415
|
// Add the items that have a checkbox in a separate Map
|
|
1275
1416
|
if ((_a = item.checkbox) !== null && _a !== void 0 ? _a : this.checkbox) {
|
|
1276
1417
|
this.flattenedCheckboxTreeModel.set(item.id, {
|
|
1277
1418
|
parentItem: parentModel,
|
|
1278
|
-
item: item
|
|
1419
|
+
item: item
|
|
1279
1420
|
});
|
|
1280
1421
|
}
|
|
1281
1422
|
// Make sure the properties are with their default values to avoid issues
|
|
1282
1423
|
// when reusing DOM nodes
|
|
1283
|
-
item.class
|
|
1284
|
-
item.expanded =
|
|
1285
|
-
|
|
1286
|
-
item.
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
: item.indeterminate;
|
|
1290
|
-
item.lazy = item.lazy == null ? DEFAULT_LAZY_VALUE : item.lazy;
|
|
1291
|
-
item.order = item.order == null ? DEFAULT_ORDER_VALUE : item.order;
|
|
1292
|
-
item.selected =
|
|
1293
|
-
item.selected == null ? DEFAULT_SELECTED_VALUE : item.selected;
|
|
1424
|
+
item.class || (item.class = DEFAULT_CLASS_VALUE);
|
|
1425
|
+
(_b = item.expanded) !== null && _b !== void 0 ? _b : (item.expanded = DEFAULT_EXPANDED_VALUE);
|
|
1426
|
+
(_c = item.indeterminate) !== null && _c !== void 0 ? _c : (item.indeterminate = DEFAULT_INDETERMINATE_VALUE);
|
|
1427
|
+
(_d = item.lazy) !== null && _d !== void 0 ? _d : (item.lazy = DEFAULT_LAZY_VALUE);
|
|
1428
|
+
(_e = item.order) !== null && _e !== void 0 ? _e : (item.order = DEFAULT_ORDER_VALUE);
|
|
1429
|
+
(_f = item.selected) !== null && _f !== void 0 ? _f : (item.selected = DEFAULT_SELECTED_VALUE);
|
|
1294
1430
|
if (item.selected) {
|
|
1295
1431
|
this.selectedItems.add(item.id);
|
|
1296
1432
|
}
|
|
1297
1433
|
this.flattenSubModel(item);
|
|
1298
1434
|
};
|
|
1299
1435
|
}
|
|
1436
|
+
handleFilterChange() {
|
|
1437
|
+
if (this.filterType === "caption" || this.filterType === "metadata") {
|
|
1438
|
+
this.processFilters();
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
handleFilterListChange() {
|
|
1442
|
+
if (this.filterType === "id-list") {
|
|
1443
|
+
this.processFilters();
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
handleFilterOptionsChange() {
|
|
1447
|
+
if (this.filterType === "caption" || this.filterType === "metadata") {
|
|
1448
|
+
this.processFilters();
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
handleFilterTypeChange() {
|
|
1452
|
+
this.processFilters();
|
|
1453
|
+
}
|
|
1300
1454
|
handleTreeModelChange() {
|
|
1301
1455
|
this.flattenModel();
|
|
1302
1456
|
}
|
|
@@ -1319,6 +1473,8 @@ const GxgTreeView = class {
|
|
|
1319
1473
|
this.flattenSubModel(itemToLazyLoadContent);
|
|
1320
1474
|
// Re-sync checked items
|
|
1321
1475
|
this.emitCheckedItemsChange();
|
|
1476
|
+
// Update filters
|
|
1477
|
+
this.processFilters();
|
|
1322
1478
|
// Force re-render
|
|
1323
1479
|
forceUpdate(this);
|
|
1324
1480
|
}
|
|
@@ -1357,13 +1513,13 @@ const GxgTreeView = class {
|
|
|
1357
1513
|
return [];
|
|
1358
1514
|
}
|
|
1359
1515
|
const modifiedTreeItems = [];
|
|
1360
|
-
treeItemIds.forEach(
|
|
1516
|
+
treeItemIds.forEach(treeItemId => {
|
|
1361
1517
|
const itemInfo = this.flattenedTreeModel.get(treeItemId).item;
|
|
1362
1518
|
if (itemInfo) {
|
|
1363
1519
|
itemInfo.expanded = expand !== null && expand !== void 0 ? expand : !itemInfo.expanded;
|
|
1364
1520
|
modifiedTreeItems.push({
|
|
1365
1521
|
id: itemInfo.id,
|
|
1366
|
-
expanded: itemInfo.expanded
|
|
1522
|
+
expanded: itemInfo.expanded
|
|
1367
1523
|
});
|
|
1368
1524
|
}
|
|
1369
1525
|
});
|
|
@@ -1375,7 +1531,7 @@ const GxgTreeView = class {
|
|
|
1375
1531
|
* Given a subset of item's properties, it updates all item UI models.
|
|
1376
1532
|
*/
|
|
1377
1533
|
async updateAllItemsProperties(properties) {
|
|
1378
|
-
[...this.flattenedTreeModel.values()].forEach(
|
|
1534
|
+
[...this.flattenedTreeModel.values()].forEach(itemUIModel => {
|
|
1379
1535
|
if (properties.expanded != null) {
|
|
1380
1536
|
itemUIModel.item.expanded = properties.expanded;
|
|
1381
1537
|
}
|
|
@@ -1384,6 +1540,10 @@ const GxgTreeView = class {
|
|
|
1384
1540
|
itemUIModel.item.indeterminate = false;
|
|
1385
1541
|
}
|
|
1386
1542
|
});
|
|
1543
|
+
// Update filters
|
|
1544
|
+
if (properties.checked != null) {
|
|
1545
|
+
this.processFilters();
|
|
1546
|
+
}
|
|
1387
1547
|
forceUpdate(this);
|
|
1388
1548
|
}
|
|
1389
1549
|
/**
|
|
@@ -1391,10 +1551,12 @@ const GxgTreeView = class {
|
|
|
1391
1551
|
* of the items in the list.
|
|
1392
1552
|
*/
|
|
1393
1553
|
async updateItemsProperties(items, properties) {
|
|
1394
|
-
items.forEach(
|
|
1554
|
+
items.forEach(item => {
|
|
1395
1555
|
const itemUIModel = this.flattenedTreeModel.get(item);
|
|
1396
1556
|
this.updateItemProperty(itemUIModel, properties);
|
|
1397
1557
|
});
|
|
1558
|
+
// Update filters
|
|
1559
|
+
this.processFilters();
|
|
1398
1560
|
forceUpdate(this);
|
|
1399
1561
|
}
|
|
1400
1562
|
/**
|
|
@@ -1412,7 +1574,7 @@ const GxgTreeView = class {
|
|
|
1412
1574
|
return;
|
|
1413
1575
|
}
|
|
1414
1576
|
const itemInfo = itemUIModel.item;
|
|
1415
|
-
Object.keys(properties).forEach(
|
|
1577
|
+
Object.keys(properties).forEach(propertyName => {
|
|
1416
1578
|
itemInfo[propertyName] = properties[propertyName];
|
|
1417
1579
|
});
|
|
1418
1580
|
}
|
|
@@ -1430,6 +1592,12 @@ const GxgTreeView = class {
|
|
|
1430
1592
|
itemInfo.checked = detail.checked;
|
|
1431
1593
|
itemInfo.indeterminate = detail.indeterminate;
|
|
1432
1594
|
this.emitCheckedItemsChange();
|
|
1595
|
+
// Update filters
|
|
1596
|
+
if (this.filterType === "checked" || this.filterType === "unchecked") {
|
|
1597
|
+
this.processFilters();
|
|
1598
|
+
// Force re-render
|
|
1599
|
+
forceUpdate(this);
|
|
1600
|
+
}
|
|
1433
1601
|
}
|
|
1434
1602
|
loadLazyChildrenHandler(event) {
|
|
1435
1603
|
if (!this.lazyLoadTreeItemsCallback) {
|
|
@@ -1439,7 +1607,7 @@ const GxgTreeView = class {
|
|
|
1439
1607
|
const treeItemId = event.detail;
|
|
1440
1608
|
const promise = this.lazyLoadTreeItemsCallback(treeItemId);
|
|
1441
1609
|
event.target.downloading = true;
|
|
1442
|
-
promise.then(
|
|
1610
|
+
promise.then(result => {
|
|
1443
1611
|
this.loadLazyContent(treeItemId, result);
|
|
1444
1612
|
});
|
|
1445
1613
|
}
|
|
@@ -1461,9 +1629,11 @@ const GxgTreeView = class {
|
|
|
1461
1629
|
// treeModel to force a re-render
|
|
1462
1630
|
itemRef.caption = newCaption;
|
|
1463
1631
|
const promise = this.modifyItemCaptionCallback(itemId, newCaption);
|
|
1464
|
-
promise.then(
|
|
1632
|
+
promise.then(status => {
|
|
1465
1633
|
if (status.success) {
|
|
1466
1634
|
this.sortItems(itemUIModel.parentItem.items);
|
|
1635
|
+
// Update filters
|
|
1636
|
+
this.processFilters();
|
|
1467
1637
|
// Force re-render
|
|
1468
1638
|
forceUpdate(this);
|
|
1469
1639
|
}
|
|
@@ -1482,10 +1652,10 @@ const GxgTreeView = class {
|
|
|
1482
1652
|
// New copy of the checked items
|
|
1483
1653
|
const allItemsWithCheckbox = new Map(this.flattenedCheckboxTreeModel);
|
|
1484
1654
|
// Update the checked value if not defined
|
|
1485
|
-
allItemsWithCheckbox.forEach(
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1655
|
+
allItemsWithCheckbox.forEach(itemUIModel => {
|
|
1656
|
+
var _a;
|
|
1657
|
+
var _b;
|
|
1658
|
+
(_a = (_b = itemUIModel.item).checked) !== null && _a !== void 0 ? _a : (_b.checked = this.checked);
|
|
1489
1659
|
});
|
|
1490
1660
|
this.checkedItemsChange.emit(allItemsWithCheckbox);
|
|
1491
1661
|
}
|
|
@@ -1519,17 +1689,52 @@ const GxgTreeView = class {
|
|
|
1519
1689
|
// Re-sync checked items
|
|
1520
1690
|
this.emitCheckedItemsChange();
|
|
1521
1691
|
}
|
|
1692
|
+
filterSubModel(item, filterInfo) {
|
|
1693
|
+
let aSubItemIsRendered = false;
|
|
1694
|
+
// Check if a subitem is rendered
|
|
1695
|
+
if (item.leaf !== true && item.items != null) {
|
|
1696
|
+
item.items.forEach(subItem => {
|
|
1697
|
+
const itemSatisfiesFilter = this.filterSubModel(subItem, filterInfo);
|
|
1698
|
+
aSubItemIsRendered || (aSubItemIsRendered = itemSatisfiesFilter);
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
// The current item is rendered if it satisfies the filter condition or a
|
|
1702
|
+
// subitem exists that needs to be rendered
|
|
1703
|
+
const satisfiesFilter = filterDictionary[this.filterType](item, filterInfo) || aSubItemIsRendered;
|
|
1704
|
+
item.render = satisfiesFilter; // Update item render
|
|
1705
|
+
return satisfiesFilter;
|
|
1706
|
+
}
|
|
1707
|
+
processFilters() {
|
|
1708
|
+
if (this.filterType === "none") {
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
this.filterSubModel({
|
|
1712
|
+
id: null,
|
|
1713
|
+
caption: null,
|
|
1714
|
+
items: this.treeModel
|
|
1715
|
+
}, {
|
|
1716
|
+
defaultCheckbox: this.checkbox,
|
|
1717
|
+
defaultChecked: this.checked,
|
|
1718
|
+
filter: this.filter,
|
|
1719
|
+
filterList: this.filterList,
|
|
1720
|
+
filterOptions: this.filterOptions
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1522
1723
|
componentWillLoad() {
|
|
1523
1724
|
this.flattenModel();
|
|
1725
|
+
this.processFilters();
|
|
1524
1726
|
}
|
|
1525
1727
|
render() {
|
|
1526
|
-
return (h("ch-tree-
|
|
1728
|
+
return (h("ch-tree-view", { 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((itemModel, index) => this.renderItem(itemModel, this, this.showLines && index === this.treeModel.length - 1, 0))));
|
|
1527
1729
|
}
|
|
1528
|
-
static get assetsDirs() { return ["assets"]; }
|
|
1529
1730
|
static get watchers() { return {
|
|
1731
|
+
"filter": ["handleFilterChange"],
|
|
1732
|
+
"filterList": ["handleFilterListChange"],
|
|
1733
|
+
"filterOptions": ["handleFilterOptionsChange"],
|
|
1734
|
+
"filterType": ["handleFilterTypeChange"],
|
|
1530
1735
|
"treeModel": ["handleTreeModelChange"]
|
|
1531
1736
|
}; }
|
|
1532
1737
|
};
|
|
1533
|
-
|
|
1738
|
+
ChTreeViewRender.style = treeViewRenderCss;
|
|
1534
1739
|
|
|
1535
|
-
export {
|
|
1740
|
+
export { CheckBox as ch_checkbox, ChTreeView as ch_tree_view, ChTreeViewItem as ch_tree_view_item, ChTreeViewRender as ch_tree_view_render };
|