@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
|
@@ -3,8 +3,94 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-5a32426a.js');
|
|
6
|
+
const reserverdNames = require('./reserverd-names-1b00889a.js');
|
|
6
7
|
const helpers = require('./helpers-291cb1cb.js');
|
|
7
8
|
|
|
9
|
+
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)}";
|
|
10
|
+
|
|
11
|
+
const CHECKBOX_ID = "checkbox";
|
|
12
|
+
const PARTS = (checked, indeterminate) => `${checked ? " checked" : ""}${indeterminate ? " indeterminate" : ""}`;
|
|
13
|
+
const CheckBox = class {
|
|
14
|
+
constructor(hostRef) {
|
|
15
|
+
index.registerInstance(this, hostRef);
|
|
16
|
+
this.click = index.createEvent(this, "click", 7);
|
|
17
|
+
this.input = index.createEvent(this, "input", 7);
|
|
18
|
+
/**
|
|
19
|
+
* This attribute lets you specify if the element is disabled.
|
|
20
|
+
* If disabled, it will not fire any user interaction related event
|
|
21
|
+
* (for example, click event).
|
|
22
|
+
*/
|
|
23
|
+
this.disabled = false;
|
|
24
|
+
/**
|
|
25
|
+
* True to highlight control when an action is fired.
|
|
26
|
+
*/
|
|
27
|
+
this.highlightable = false;
|
|
28
|
+
/**
|
|
29
|
+
* `true` if the control's value is indeterminate.
|
|
30
|
+
*/
|
|
31
|
+
this.indeterminate = false;
|
|
32
|
+
/**
|
|
33
|
+
* This attribute indicates that the user cannot modify the value of the control.
|
|
34
|
+
* Same as [readonly](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly)
|
|
35
|
+
* attribute for `input` elements.
|
|
36
|
+
*/
|
|
37
|
+
this.readonly = false;
|
|
38
|
+
this.getValue = (checked) => checked ? this.checkedValue : this.unCheckedValue;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if it is necessary to prevent the click from bubbling
|
|
41
|
+
*/
|
|
42
|
+
this.handleClick = (event) => {
|
|
43
|
+
if (this.readonly || this.disabled) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
};
|
|
48
|
+
this.handleChange = (event) => {
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
const inputRef = event.target;
|
|
51
|
+
const checked = inputRef.checked;
|
|
52
|
+
const value = this.getValue(checked);
|
|
53
|
+
this.checked = checked;
|
|
54
|
+
this.value = value;
|
|
55
|
+
inputRef.value = value; // Update input's value before emitting the event
|
|
56
|
+
this.input.emit(event);
|
|
57
|
+
if (this.highlightable) {
|
|
58
|
+
this.click.emit();
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
valueChanged() {
|
|
63
|
+
this.checked = this.value === this.checkedValue;
|
|
64
|
+
}
|
|
65
|
+
componentWillLoad() {
|
|
66
|
+
this.checked = this.value === this.checkedValue;
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
var _a;
|
|
70
|
+
const additionalParts = PARTS(this.checked, this.indeterminate);
|
|
71
|
+
return (index.h(index.Host, { class: {
|
|
72
|
+
[reserverdNames.DISABLED_CLASS]: this.disabled,
|
|
73
|
+
"ch-checkbox--actionable": (!this.readonly && !this.disabled) ||
|
|
74
|
+
(this.readonly && this.highlightable)
|
|
75
|
+
} }, index.h("div", { class: {
|
|
76
|
+
container: true,
|
|
77
|
+
"container--checked": this.checked
|
|
78
|
+
}, part: `container${additionalParts}` }, index.h("input", { "aria-label": ((_a = this.accessibleName) === null || _a === void 0 ? void 0 : _a.trim()) !== "" &&
|
|
79
|
+
this.accessibleName !== this.caption
|
|
80
|
+
? this.accessibleName
|
|
81
|
+
: 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 }), index.h("div", { class: {
|
|
82
|
+
option: true,
|
|
83
|
+
"option--checked": this.checked && !this.indeterminate,
|
|
84
|
+
"option--indeterminate": this.indeterminate
|
|
85
|
+
}, part: `option${additionalParts}`, "aria-hidden": "true" })), this.caption && (index.h("label", { class: "label", part: "label", htmlFor: CHECKBOX_ID, onClick: this.handleClick }, this.caption))));
|
|
86
|
+
}
|
|
87
|
+
get element() { return index.getElement(this); }
|
|
88
|
+
static get watchers() { return {
|
|
89
|
+
"value": ["valueChanged"]
|
|
90
|
+
}; }
|
|
91
|
+
};
|
|
92
|
+
CheckBox.style = checkboxCss;
|
|
93
|
+
|
|
8
94
|
const scrollToEdge = (event, container, scrollSpeed, scrollThreshold) => {
|
|
9
95
|
const mousePositionY = event.clientY - container.getBoundingClientRect().top;
|
|
10
96
|
const containerHeight = container.clientHeight;
|
|
@@ -19,10 +105,10 @@ const scrollToEdge = (event, container, scrollSpeed, scrollThreshold) => {
|
|
|
19
105
|
}
|
|
20
106
|
};
|
|
21
107
|
|
|
22
|
-
const
|
|
108
|
+
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%}";
|
|
23
109
|
|
|
24
|
-
const TREE_ITEM_TAG_NAME$1 = "ch-tree-
|
|
25
|
-
const TREE_TAG_NAME = "ch-tree-
|
|
110
|
+
const TREE_ITEM_TAG_NAME$1 = "ch-tree-view-item";
|
|
111
|
+
const TREE_TAG_NAME = "ch-tree-view";
|
|
26
112
|
// Selectors
|
|
27
113
|
// const CHECKED_ITEMS = `${TREE_ITEM_TAG_NAME}[checked]`;
|
|
28
114
|
const TEXT_FORMAT = "text/plain";
|
|
@@ -33,9 +119,9 @@ const isTreeItem = (element) => element.tagName.toLowerCase() === TREE_ITEM_TAG_
|
|
|
33
119
|
const getFocusedTreeItem = () => helpers.focusComposedPath().find(isTreeItem);
|
|
34
120
|
const canMoveTreeItemFocus = (treeItem) => treeItem && !treeItem.editing;
|
|
35
121
|
const getDroppableZoneKey = (newContainerId, draggedItems) => `"newContainerId":"${newContainerId}","metadata":"${JSON.stringify(draggedItems)}"`;
|
|
36
|
-
const POSITION_X_DRAG_CUSTOM_VAR = "--ch-tree-
|
|
37
|
-
const POSITION_Y_DRAG_CUSTOM_VAR = "--ch-tree-
|
|
38
|
-
const
|
|
122
|
+
const POSITION_X_DRAG_CUSTOM_VAR = "--ch-tree-view-dragging-item-x";
|
|
123
|
+
const POSITION_Y_DRAG_CUSTOM_VAR = "--ch-tree-view-dragging-item-y";
|
|
124
|
+
const ChTreeView = class {
|
|
39
125
|
constructor(hostRef) {
|
|
40
126
|
index.registerInstance(this, hostRef);
|
|
41
127
|
this.droppableZoneEnter = index.createEvent(this, "droppableZoneEnter", 7);
|
|
@@ -133,7 +219,7 @@ const ChTreeX = class {
|
|
|
133
219
|
// async getCheckedItems(): Promise<CheckedTreeItemInfo[]> {
|
|
134
220
|
// const checkedItems = Array.from(
|
|
135
221
|
// this.el.querySelectorAll(CHECKED_ITEMS)
|
|
136
|
-
// ) as
|
|
222
|
+
// ) as HTMLChTreeViewItemElement[];
|
|
137
223
|
// return checkedItems.map(item => ({
|
|
138
224
|
// id: item.id,
|
|
139
225
|
// caption: item.caption,
|
|
@@ -471,22 +557,22 @@ const ChTreeX = class {
|
|
|
471
557
|
}
|
|
472
558
|
render() {
|
|
473
559
|
return (index.h(index.Host, { class: {
|
|
474
|
-
"ch-tree-
|
|
475
|
-
"ch-tree-
|
|
476
|
-
"ch-tree-
|
|
477
|
-
"ch-tree-
|
|
478
|
-
} }, index.h("div", { role: "tree", part: "tree-x-container", "aria-multiselectable": this.multiSelection.toString(), class: "ch-tree-
|
|
560
|
+
"ch-tree-view-dragging-item": this.draggingInTheDocument,
|
|
561
|
+
"ch-tree-view-not-dragging-item": !this.draggingInTheDocument,
|
|
562
|
+
"ch-tree-view--dragging-selected-items": this.draggingInTree && this.draggingSelectedItems,
|
|
563
|
+
"ch-tree-view-waiting-drop-processing": this.waitDropProcessing
|
|
564
|
+
} }, index.h("div", { role: "tree", part: "tree-x-container", "aria-multiselectable": this.multiSelection.toString(), class: "ch-tree-view-container" }, index.h("slot", null)), this.draggingInTree && (index.h("span", { "aria-hidden": "true", class: "ch-tree-view-drag-info" }, this.dragInfo))));
|
|
479
565
|
}
|
|
480
566
|
get el() { return index.getElement(this); }
|
|
481
567
|
};
|
|
482
|
-
|
|
568
|
+
ChTreeView.style = treeViewCss;
|
|
483
569
|
|
|
484
|
-
const
|
|
570
|
+
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}";
|
|
485
571
|
|
|
486
572
|
const resetDragImage = new Image();
|
|
487
573
|
const INITIAL_LEVEL = 0;
|
|
488
574
|
// Selectors
|
|
489
|
-
const TREE_ITEM_TAG_NAME = "ch-tree-
|
|
575
|
+
const TREE_ITEM_TAG_NAME = "ch-tree-view-item";
|
|
490
576
|
const DIRECT_TREE_ITEM_CHILDREN = `:scope>${TREE_ITEM_TAG_NAME}`;
|
|
491
577
|
const FIRST_ENABLED_SUB_ITEM = `${TREE_ITEM_TAG_NAME}:not([disabled])`;
|
|
492
578
|
const LAST_SUB_ITEM = `:scope>${TREE_ITEM_TAG_NAME}:last-child`;
|
|
@@ -505,7 +591,7 @@ const CHECKBOX_EXPORT_PARTS = [
|
|
|
505
591
|
]
|
|
506
592
|
.map(getCheckboxExportPart)
|
|
507
593
|
.join(",");
|
|
508
|
-
const
|
|
594
|
+
const ChTreeViewItem = class {
|
|
509
595
|
constructor(hostRef) {
|
|
510
596
|
index.registerInstance(this, hostRef);
|
|
511
597
|
this.checkboxChange = index.createEvent(this, "checkboxChange", 7);
|
|
@@ -1064,11 +1150,44 @@ const ChTreeXListItem = class {
|
|
|
1064
1150
|
"showLines": ["handleShowLinesChange"]
|
|
1065
1151
|
}; }
|
|
1066
1152
|
};
|
|
1067
|
-
|
|
1153
|
+
ChTreeViewItem.style = treeViewItemCss;
|
|
1068
1154
|
|
|
1069
|
-
const
|
|
1155
|
+
const filterWithCamelCase = (stringToFilter, filter, camelCase) => camelCase
|
|
1156
|
+
? stringToFilter.includes(filter)
|
|
1157
|
+
: stringToFilter.toLowerCase().includes(filter.toLowerCase());
|
|
1158
|
+
const filterWithString = (stringToFilter, filter, filterOptions) => filterOptions.regularExpression
|
|
1159
|
+
? stringToFilter.match(filter) !== null
|
|
1160
|
+
: filterWithCamelCase(stringToFilter, filter, filterOptions.camelCase);
|
|
1161
|
+
const filterDictionary = {
|
|
1162
|
+
caption: (item, filterInfo) => {
|
|
1163
|
+
var _a;
|
|
1164
|
+
return filterInfo.filter
|
|
1165
|
+
? filterWithString((_a = item.caption) !== null && _a !== void 0 ? _a : "", filterInfo.filter, filterInfo.filterOptions)
|
|
1166
|
+
: true;
|
|
1167
|
+
},
|
|
1168
|
+
checked: (item, filterInfo) => {
|
|
1169
|
+
var _a, _b;
|
|
1170
|
+
return ((_a = item.checkbox) !== null && _a !== void 0 ? _a : filterInfo.defaultCheckbox) &&
|
|
1171
|
+
!item.indeterminate &&
|
|
1172
|
+
((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
|
|
1173
|
+
},
|
|
1174
|
+
"id-list": (item, filterInfo) => filterInfo.filterList.includes(item.id),
|
|
1175
|
+
metadata: (item, filterInfo) => {
|
|
1176
|
+
var _a;
|
|
1177
|
+
return filterInfo.filter
|
|
1178
|
+
? filterWithString((_a = item.metadata) !== null && _a !== void 0 ? _a : "", filterInfo.filter, filterInfo.filterOptions)
|
|
1179
|
+
: true;
|
|
1180
|
+
},
|
|
1181
|
+
none: () => true,
|
|
1182
|
+
unchecked: (item, filterInfo) => {
|
|
1183
|
+
var _a, _b;
|
|
1184
|
+
return ((_a = item.checkbox) !== null && _a !== void 0 ? _a : filterInfo.defaultCheckbox) &&
|
|
1185
|
+
!item.indeterminate &&
|
|
1186
|
+
!((_b = item.checked) !== null && _b !== void 0 ? _b : filterInfo.defaultChecked);
|
|
1187
|
+
}
|
|
1188
|
+
};
|
|
1070
1189
|
|
|
1071
|
-
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}";
|
|
1190
|
+
const treeViewRenderCss = "ch-tree-view-render{display:contents}";
|
|
1072
1191
|
|
|
1073
1192
|
const DEFAULT_DRAG_DISABLED_VALUE = false;
|
|
1074
1193
|
const DEFAULT_DROP_DISABLED_VALUE = false;
|
|
@@ -1079,7 +1198,13 @@ const DEFAULT_INDETERMINATE_VALUE = false;
|
|
|
1079
1198
|
const DEFAULT_LAZY_VALUE = false;
|
|
1080
1199
|
const DEFAULT_ORDER_VALUE = 0;
|
|
1081
1200
|
const DEFAULT_SELECTED_VALUE = false;
|
|
1082
|
-
const
|
|
1201
|
+
const defaultRenderItem = (itemModel, treeState, lastItem, level) => {
|
|
1202
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1203
|
+
return (treeState.filterType === "none" || itemModel.render !== false) && (index.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 &&
|
|
1204
|
+
itemModel.items != null &&
|
|
1205
|
+
itemModel.items.map((subModel, index) => defaultRenderItem(subModel, treeState, treeState.showLines && index === itemModel.items.length - 1, level + 1))));
|
|
1206
|
+
};
|
|
1207
|
+
const ChTreeViewRender = class {
|
|
1083
1208
|
constructor(hostRef) {
|
|
1084
1209
|
index.registerInstance(this, hostRef);
|
|
1085
1210
|
this.checkedItemsChange = index.createEvent(this, "checkedItemsChange", 7);
|
|
@@ -1090,16 +1215,11 @@ const GxgTreeView = class {
|
|
|
1090
1215
|
this.flattenedTreeModel = new Map();
|
|
1091
1216
|
this.flattenedCheckboxTreeModel = new Map();
|
|
1092
1217
|
this.selectedItems = new Set();
|
|
1093
|
-
this.iconAssetsPath = index.getAssetPath(`./icon-assets`);
|
|
1094
1218
|
/**
|
|
1095
1219
|
* This property lets you specify if the tree is waiting to process the drop
|
|
1096
1220
|
* of items.
|
|
1097
1221
|
*/
|
|
1098
1222
|
this.waitDropProcessing = false;
|
|
1099
|
-
/**
|
|
1100
|
-
* Removes the default padding on '.ch-tree-x-container' (Added by Gemini)
|
|
1101
|
-
*/
|
|
1102
|
-
this.noPadding = false;
|
|
1103
1223
|
/**
|
|
1104
1224
|
* Set this attribute if you want display a checkbox in all items by default.
|
|
1105
1225
|
*/
|
|
@@ -1110,10 +1230,6 @@ const GxgTreeView = class {
|
|
|
1110
1230
|
* Only works if `checkbox = true`
|
|
1111
1231
|
*/
|
|
1112
1232
|
this.checked = false;
|
|
1113
|
-
/**
|
|
1114
|
-
* A CSS class to set as the `ch-tree-x` element class.
|
|
1115
|
-
*/
|
|
1116
|
-
this.cssClass = "tree-view";
|
|
1117
1233
|
/**
|
|
1118
1234
|
* This attribute lets you specify if the drag operation is disabled in all
|
|
1119
1235
|
* items by default. If `true`, the items can't be dragged.
|
|
@@ -1129,15 +1245,44 @@ const GxgTreeView = class {
|
|
|
1129
1245
|
* items by default. If `true`, the items can edit its caption in place.
|
|
1130
1246
|
*/
|
|
1131
1247
|
this.editableItems = DEFAULT_EDITABLE_ITEMS_VALUE;
|
|
1248
|
+
/**
|
|
1249
|
+
* This property lets you determine the list of items that will be filtered.
|
|
1250
|
+
* Only works if `filterType = "id-list"`.
|
|
1251
|
+
*/
|
|
1252
|
+
this.filterList = [];
|
|
1253
|
+
/**
|
|
1254
|
+
* This property lets you determine the options that will be applied to the
|
|
1255
|
+
* filter.
|
|
1256
|
+
* Only works if `filterType = "caption" | "metadata"`.
|
|
1257
|
+
*/
|
|
1258
|
+
this.filterOptions = {};
|
|
1259
|
+
/**
|
|
1260
|
+
* This attribute lets you define what kind of filter is applied to items.
|
|
1261
|
+
* Only items that satisfy the filter predicate will be displayed.
|
|
1262
|
+
*
|
|
1263
|
+
* | Value | Details |
|
|
1264
|
+
* | ----------- | ---------------------------------------------------------------------------------------------- |
|
|
1265
|
+
* | `checked` | Show only the items that have a checkbox and are checked. |
|
|
1266
|
+
* | `unchecked` | Show only the items that have a checkbox and are not checked. |
|
|
1267
|
+
* | `caption` | Show only the items whose `caption` satisfies the regex determinate by the `filter` property. |
|
|
1268
|
+
* | `metadata` | Show only the items whose `metadata` satisfies the regex determinate by the `filter` property. |
|
|
1269
|
+
* | `id-list` | Show only the items that are contained in the array determinate by the `filterList` property. |
|
|
1270
|
+
* | `none` | Show all items. |
|
|
1271
|
+
*/
|
|
1272
|
+
this.filterType = "none";
|
|
1132
1273
|
/**
|
|
1133
1274
|
* Set this attribute if you want to allow multi selection of the items.
|
|
1134
1275
|
*/
|
|
1135
1276
|
this.multiSelection = false;
|
|
1277
|
+
/**
|
|
1278
|
+
* This property allows us to implement custom rendering of tree items.
|
|
1279
|
+
*/
|
|
1280
|
+
this.renderItem = defaultRenderItem;
|
|
1136
1281
|
/**
|
|
1137
1282
|
* `true` to display the relation between tree items and tree lists using
|
|
1138
1283
|
* lines.
|
|
1139
1284
|
*/
|
|
1140
|
-
this.showLines = "
|
|
1285
|
+
this.showLines = "none";
|
|
1141
1286
|
/**
|
|
1142
1287
|
* Set this attribute if you want all the children item's checkboxes to be
|
|
1143
1288
|
* checked when the parent item checkbox is checked, or to be unchecked when
|
|
@@ -1158,7 +1303,7 @@ const GxgTreeView = class {
|
|
|
1158
1303
|
const requestTimestamp = new Date().getTime();
|
|
1159
1304
|
const dropInformation = event.detail;
|
|
1160
1305
|
const promise = this.checkDroppableZoneCallback(dropInformation);
|
|
1161
|
-
promise.then(
|
|
1306
|
+
promise.then(validDrop => {
|
|
1162
1307
|
this.updateValidDropZone(requestTimestamp, dropInformation.newContainer.id, dropInformation.draggedItems, validDrop);
|
|
1163
1308
|
});
|
|
1164
1309
|
};
|
|
@@ -1166,7 +1311,7 @@ const GxgTreeView = class {
|
|
|
1166
1311
|
event.stopPropagation();
|
|
1167
1312
|
const itemsToProcess = new Map(event.detail);
|
|
1168
1313
|
// Remove no longer selected items
|
|
1169
|
-
this.selectedItems.forEach(
|
|
1314
|
+
this.selectedItems.forEach(selectedItemId => {
|
|
1170
1315
|
const itemUIModel = this.flattenedTreeModel.get(selectedItemId).item;
|
|
1171
1316
|
const itemIsStillSelected = itemsToProcess.get(selectedItemId);
|
|
1172
1317
|
// The item does not need to be added. Remove it from the processed list
|
|
@@ -1246,6 +1391,10 @@ const GxgTreeView = class {
|
|
|
1246
1391
|
this.sortItems(newParentUIModel.items);
|
|
1247
1392
|
// Open the item to visualize the new subitems
|
|
1248
1393
|
newParentUIModel.expanded = true;
|
|
1394
|
+
// Re-sync checked items
|
|
1395
|
+
this.emitCheckedItemsChange();
|
|
1396
|
+
// Update filters
|
|
1397
|
+
this.processFilters();
|
|
1249
1398
|
// There is no need to force and update, since the waitDropProcessing
|
|
1250
1399
|
// prop was modified
|
|
1251
1400
|
});
|
|
@@ -1261,46 +1410,51 @@ const GxgTreeView = class {
|
|
|
1261
1410
|
// Reference the new parent in the item
|
|
1262
1411
|
itemUIModelExtended.parentItem = newParentUIModel;
|
|
1263
1412
|
};
|
|
1264
|
-
this.renderSubModel = (treeSubModel, lastItem, level) => {
|
|
1265
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1266
|
-
return (index.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
|
|
1267
|
-
? resolveImgPath(this.iconAssetsPath, treeSubModel.leftImgSrc)
|
|
1268
|
-
: 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 &&
|
|
1269
|
-
treeSubModel.items != null &&
|
|
1270
|
-
treeSubModel.items.map((subModel, index) => this.renderSubModel(subModel, this.showLines && index === treeSubModel.items.length - 1, level + 1))));
|
|
1271
|
-
};
|
|
1272
1413
|
this.flattenItemUIModel = (parentModel) => (item) => {
|
|
1273
|
-
var _a;
|
|
1414
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1274
1415
|
this.flattenedTreeModel.set(item.id, {
|
|
1275
1416
|
parentItem: parentModel,
|
|
1276
|
-
item: item
|
|
1417
|
+
item: item
|
|
1277
1418
|
});
|
|
1278
1419
|
// Add the items that have a checkbox in a separate Map
|
|
1279
1420
|
if ((_a = item.checkbox) !== null && _a !== void 0 ? _a : this.checkbox) {
|
|
1280
1421
|
this.flattenedCheckboxTreeModel.set(item.id, {
|
|
1281
1422
|
parentItem: parentModel,
|
|
1282
|
-
item: item
|
|
1423
|
+
item: item
|
|
1283
1424
|
});
|
|
1284
1425
|
}
|
|
1285
1426
|
// Make sure the properties are with their default values to avoid issues
|
|
1286
1427
|
// when reusing DOM nodes
|
|
1287
|
-
item.class
|
|
1288
|
-
item.expanded =
|
|
1289
|
-
|
|
1290
|
-
item.
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
: item.indeterminate;
|
|
1294
|
-
item.lazy = item.lazy == null ? DEFAULT_LAZY_VALUE : item.lazy;
|
|
1295
|
-
item.order = item.order == null ? DEFAULT_ORDER_VALUE : item.order;
|
|
1296
|
-
item.selected =
|
|
1297
|
-
item.selected == null ? DEFAULT_SELECTED_VALUE : item.selected;
|
|
1428
|
+
item.class || (item.class = DEFAULT_CLASS_VALUE);
|
|
1429
|
+
(_b = item.expanded) !== null && _b !== void 0 ? _b : (item.expanded = DEFAULT_EXPANDED_VALUE);
|
|
1430
|
+
(_c = item.indeterminate) !== null && _c !== void 0 ? _c : (item.indeterminate = DEFAULT_INDETERMINATE_VALUE);
|
|
1431
|
+
(_d = item.lazy) !== null && _d !== void 0 ? _d : (item.lazy = DEFAULT_LAZY_VALUE);
|
|
1432
|
+
(_e = item.order) !== null && _e !== void 0 ? _e : (item.order = DEFAULT_ORDER_VALUE);
|
|
1433
|
+
(_f = item.selected) !== null && _f !== void 0 ? _f : (item.selected = DEFAULT_SELECTED_VALUE);
|
|
1298
1434
|
if (item.selected) {
|
|
1299
1435
|
this.selectedItems.add(item.id);
|
|
1300
1436
|
}
|
|
1301
1437
|
this.flattenSubModel(item);
|
|
1302
1438
|
};
|
|
1303
1439
|
}
|
|
1440
|
+
handleFilterChange() {
|
|
1441
|
+
if (this.filterType === "caption" || this.filterType === "metadata") {
|
|
1442
|
+
this.processFilters();
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
handleFilterListChange() {
|
|
1446
|
+
if (this.filterType === "id-list") {
|
|
1447
|
+
this.processFilters();
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
handleFilterOptionsChange() {
|
|
1451
|
+
if (this.filterType === "caption" || this.filterType === "metadata") {
|
|
1452
|
+
this.processFilters();
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
handleFilterTypeChange() {
|
|
1456
|
+
this.processFilters();
|
|
1457
|
+
}
|
|
1304
1458
|
handleTreeModelChange() {
|
|
1305
1459
|
this.flattenModel();
|
|
1306
1460
|
}
|
|
@@ -1323,6 +1477,8 @@ const GxgTreeView = class {
|
|
|
1323
1477
|
this.flattenSubModel(itemToLazyLoadContent);
|
|
1324
1478
|
// Re-sync checked items
|
|
1325
1479
|
this.emitCheckedItemsChange();
|
|
1480
|
+
// Update filters
|
|
1481
|
+
this.processFilters();
|
|
1326
1482
|
// Force re-render
|
|
1327
1483
|
index.forceUpdate(this);
|
|
1328
1484
|
}
|
|
@@ -1361,13 +1517,13 @@ const GxgTreeView = class {
|
|
|
1361
1517
|
return [];
|
|
1362
1518
|
}
|
|
1363
1519
|
const modifiedTreeItems = [];
|
|
1364
|
-
treeItemIds.forEach(
|
|
1520
|
+
treeItemIds.forEach(treeItemId => {
|
|
1365
1521
|
const itemInfo = this.flattenedTreeModel.get(treeItemId).item;
|
|
1366
1522
|
if (itemInfo) {
|
|
1367
1523
|
itemInfo.expanded = expand !== null && expand !== void 0 ? expand : !itemInfo.expanded;
|
|
1368
1524
|
modifiedTreeItems.push({
|
|
1369
1525
|
id: itemInfo.id,
|
|
1370
|
-
expanded: itemInfo.expanded
|
|
1526
|
+
expanded: itemInfo.expanded
|
|
1371
1527
|
});
|
|
1372
1528
|
}
|
|
1373
1529
|
});
|
|
@@ -1379,7 +1535,7 @@ const GxgTreeView = class {
|
|
|
1379
1535
|
* Given a subset of item's properties, it updates all item UI models.
|
|
1380
1536
|
*/
|
|
1381
1537
|
async updateAllItemsProperties(properties) {
|
|
1382
|
-
[...this.flattenedTreeModel.values()].forEach(
|
|
1538
|
+
[...this.flattenedTreeModel.values()].forEach(itemUIModel => {
|
|
1383
1539
|
if (properties.expanded != null) {
|
|
1384
1540
|
itemUIModel.item.expanded = properties.expanded;
|
|
1385
1541
|
}
|
|
@@ -1388,6 +1544,10 @@ const GxgTreeView = class {
|
|
|
1388
1544
|
itemUIModel.item.indeterminate = false;
|
|
1389
1545
|
}
|
|
1390
1546
|
});
|
|
1547
|
+
// Update filters
|
|
1548
|
+
if (properties.checked != null) {
|
|
1549
|
+
this.processFilters();
|
|
1550
|
+
}
|
|
1391
1551
|
index.forceUpdate(this);
|
|
1392
1552
|
}
|
|
1393
1553
|
/**
|
|
@@ -1395,10 +1555,12 @@ const GxgTreeView = class {
|
|
|
1395
1555
|
* of the items in the list.
|
|
1396
1556
|
*/
|
|
1397
1557
|
async updateItemsProperties(items, properties) {
|
|
1398
|
-
items.forEach(
|
|
1558
|
+
items.forEach(item => {
|
|
1399
1559
|
const itemUIModel = this.flattenedTreeModel.get(item);
|
|
1400
1560
|
this.updateItemProperty(itemUIModel, properties);
|
|
1401
1561
|
});
|
|
1562
|
+
// Update filters
|
|
1563
|
+
this.processFilters();
|
|
1402
1564
|
index.forceUpdate(this);
|
|
1403
1565
|
}
|
|
1404
1566
|
/**
|
|
@@ -1416,7 +1578,7 @@ const GxgTreeView = class {
|
|
|
1416
1578
|
return;
|
|
1417
1579
|
}
|
|
1418
1580
|
const itemInfo = itemUIModel.item;
|
|
1419
|
-
Object.keys(properties).forEach(
|
|
1581
|
+
Object.keys(properties).forEach(propertyName => {
|
|
1420
1582
|
itemInfo[propertyName] = properties[propertyName];
|
|
1421
1583
|
});
|
|
1422
1584
|
}
|
|
@@ -1434,6 +1596,12 @@ const GxgTreeView = class {
|
|
|
1434
1596
|
itemInfo.checked = detail.checked;
|
|
1435
1597
|
itemInfo.indeterminate = detail.indeterminate;
|
|
1436
1598
|
this.emitCheckedItemsChange();
|
|
1599
|
+
// Update filters
|
|
1600
|
+
if (this.filterType === "checked" || this.filterType === "unchecked") {
|
|
1601
|
+
this.processFilters();
|
|
1602
|
+
// Force re-render
|
|
1603
|
+
index.forceUpdate(this);
|
|
1604
|
+
}
|
|
1437
1605
|
}
|
|
1438
1606
|
loadLazyChildrenHandler(event) {
|
|
1439
1607
|
if (!this.lazyLoadTreeItemsCallback) {
|
|
@@ -1443,7 +1611,7 @@ const GxgTreeView = class {
|
|
|
1443
1611
|
const treeItemId = event.detail;
|
|
1444
1612
|
const promise = this.lazyLoadTreeItemsCallback(treeItemId);
|
|
1445
1613
|
event.target.downloading = true;
|
|
1446
|
-
promise.then(
|
|
1614
|
+
promise.then(result => {
|
|
1447
1615
|
this.loadLazyContent(treeItemId, result);
|
|
1448
1616
|
});
|
|
1449
1617
|
}
|
|
@@ -1465,9 +1633,11 @@ const GxgTreeView = class {
|
|
|
1465
1633
|
// treeModel to force a re-render
|
|
1466
1634
|
itemRef.caption = newCaption;
|
|
1467
1635
|
const promise = this.modifyItemCaptionCallback(itemId, newCaption);
|
|
1468
|
-
promise.then(
|
|
1636
|
+
promise.then(status => {
|
|
1469
1637
|
if (status.success) {
|
|
1470
1638
|
this.sortItems(itemUIModel.parentItem.items);
|
|
1639
|
+
// Update filters
|
|
1640
|
+
this.processFilters();
|
|
1471
1641
|
// Force re-render
|
|
1472
1642
|
index.forceUpdate(this);
|
|
1473
1643
|
}
|
|
@@ -1486,10 +1656,10 @@ const GxgTreeView = class {
|
|
|
1486
1656
|
// New copy of the checked items
|
|
1487
1657
|
const allItemsWithCheckbox = new Map(this.flattenedCheckboxTreeModel);
|
|
1488
1658
|
// Update the checked value if not defined
|
|
1489
|
-
allItemsWithCheckbox.forEach(
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1659
|
+
allItemsWithCheckbox.forEach(itemUIModel => {
|
|
1660
|
+
var _a;
|
|
1661
|
+
var _b;
|
|
1662
|
+
(_a = (_b = itemUIModel.item).checked) !== null && _a !== void 0 ? _a : (_b.checked = this.checked);
|
|
1493
1663
|
});
|
|
1494
1664
|
this.checkedItemsChange.emit(allItemsWithCheckbox);
|
|
1495
1665
|
}
|
|
@@ -1523,19 +1693,55 @@ const GxgTreeView = class {
|
|
|
1523
1693
|
// Re-sync checked items
|
|
1524
1694
|
this.emitCheckedItemsChange();
|
|
1525
1695
|
}
|
|
1696
|
+
filterSubModel(item, filterInfo) {
|
|
1697
|
+
let aSubItemIsRendered = false;
|
|
1698
|
+
// Check if a subitem is rendered
|
|
1699
|
+
if (item.leaf !== true && item.items != null) {
|
|
1700
|
+
item.items.forEach(subItem => {
|
|
1701
|
+
const itemSatisfiesFilter = this.filterSubModel(subItem, filterInfo);
|
|
1702
|
+
aSubItemIsRendered || (aSubItemIsRendered = itemSatisfiesFilter);
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
// The current item is rendered if it satisfies the filter condition or a
|
|
1706
|
+
// subitem exists that needs to be rendered
|
|
1707
|
+
const satisfiesFilter = filterDictionary[this.filterType](item, filterInfo) || aSubItemIsRendered;
|
|
1708
|
+
item.render = satisfiesFilter; // Update item render
|
|
1709
|
+
return satisfiesFilter;
|
|
1710
|
+
}
|
|
1711
|
+
processFilters() {
|
|
1712
|
+
if (this.filterType === "none") {
|
|
1713
|
+
return;
|
|
1714
|
+
}
|
|
1715
|
+
this.filterSubModel({
|
|
1716
|
+
id: null,
|
|
1717
|
+
caption: null,
|
|
1718
|
+
items: this.treeModel
|
|
1719
|
+
}, {
|
|
1720
|
+
defaultCheckbox: this.checkbox,
|
|
1721
|
+
defaultChecked: this.checked,
|
|
1722
|
+
filter: this.filter,
|
|
1723
|
+
filterList: this.filterList,
|
|
1724
|
+
filterOptions: this.filterOptions
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1526
1727
|
componentWillLoad() {
|
|
1527
1728
|
this.flattenModel();
|
|
1729
|
+
this.processFilters();
|
|
1528
1730
|
}
|
|
1529
1731
|
render() {
|
|
1530
|
-
return (index.h("ch-tree-
|
|
1732
|
+
return (index.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))));
|
|
1531
1733
|
}
|
|
1532
|
-
static get assetsDirs() { return ["assets"]; }
|
|
1533
1734
|
static get watchers() { return {
|
|
1735
|
+
"filter": ["handleFilterChange"],
|
|
1736
|
+
"filterList": ["handleFilterListChange"],
|
|
1737
|
+
"filterOptions": ["handleFilterOptionsChange"],
|
|
1738
|
+
"filterType": ["handleFilterTypeChange"],
|
|
1534
1739
|
"treeModel": ["handleTreeModelChange"]
|
|
1535
1740
|
}; }
|
|
1536
1741
|
};
|
|
1537
|
-
|
|
1742
|
+
ChTreeViewRender.style = treeViewRenderCss;
|
|
1538
1743
|
|
|
1539
|
-
exports.
|
|
1540
|
-
exports.
|
|
1541
|
-
exports.
|
|
1744
|
+
exports.ch_checkbox = CheckBox;
|
|
1745
|
+
exports.ch_tree_view = ChTreeView;
|
|
1746
|
+
exports.ch_tree_view_item = ChTreeViewItem;
|
|
1747
|
+
exports.ch_tree_view_render = ChTreeViewRender;
|