@genexus/genexus-ide-ui 0.0.16 → 0.0.18
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-grid_7.cjs.entry.js +73 -27
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/{gx-ide-container_2.cjs.entry.js → gx-ide-container.cjs.entry.js} +0 -31
- package/dist/cjs/gx-ide-new-kb.cjs.entry.js +16 -17
- package/dist/cjs/gx-ide-references.cjs.entry.js +115 -90
- package/dist/cjs/gx-ide-template.cjs.entry.js +2 -2
- package/dist/cjs/gx-ide-test.cjs.entry.js +40 -3
- package/dist/cjs/{gxg-form-radio-group.cjs.entry.js → gx-ide-top-bar_2.cjs.entry.js} +31 -0
- package/dist/cjs/gxg-combo-box_8.cjs.entry.js +3 -8
- package/dist/cjs/gxg-menu.cjs.entry.js +2 -2
- package/dist/cjs/gxg-test.cjs.entry.js +4 -23
- package/dist/cjs/gxg-tree_2.cjs.entry.js +381 -295
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/update-tree-model-445c63a8.js +53 -0
- package/dist/collection/common/render-tree.js +1 -1
- package/dist/collection/common/update-tree-model.js +22 -0
- package/dist/collection/components/_template/template.js +9 -10
- package/dist/collection/components/_test/test.js +129 -2
- package/dist/collection/components/new-kb/new-kb.js +16 -35
- package/dist/collection/components/references/references.js +119 -113
- package/dist/collection/pages/assets/common.js +105 -95
- package/dist/components/ch-grid2.js +74 -28
- package/dist/components/combo-box.js +4 -3
- package/dist/components/form-radio.js +0 -5
- package/dist/components/gx-ide-new-kb.js +20 -28
- package/dist/components/gx-ide-references.js +131 -111
- package/dist/components/gx-ide-template.js +7 -13
- package/dist/components/gx-ide-test.js +45 -4
- package/dist/components/gxg-menu.js +2 -2
- package/dist/components/gxg-test.js +4 -23
- package/dist/components/gxg-tree-item2.js +326 -284
- package/dist/components/gxg-tree2.js +60 -15
- package/dist/components/update-tree-model.js +50 -0
- package/dist/esm/ch-grid_7.entry.js +73 -27
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/{gx-ide-container_2.entry.js → gx-ide-container.entry.js} +1 -31
- package/dist/esm/gx-ide-new-kb.entry.js +16 -17
- package/dist/esm/gx-ide-references.entry.js +115 -90
- package/dist/esm/gx-ide-template.entry.js +2 -2
- package/dist/esm/gx-ide-test.entry.js +40 -3
- package/dist/esm/{gxg-form-radio-group.entry.js → gx-ide-top-bar_2.entry.js} +32 -2
- package/dist/esm/gxg-combo-box_8.entry.js +3 -8
- package/dist/esm/gxg-menu.entry.js +2 -2
- package/dist/esm/gxg-test.entry.js +4 -23
- package/dist/esm/gxg-tree_2.entry.js +382 -296
- package/dist/esm/loader.js +1 -1
- package/dist/esm/update-tree-model-80419058.js +50 -0
- 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/p-1042318d.entry.js +1 -0
- package/dist/genexus-ide-ui/p-1d4cf2ae.entry.js +1 -0
- package/dist/genexus-ide-ui/p-254f9ce7.entry.js +1 -0
- package/dist/genexus-ide-ui/p-49433b58.entry.js +1 -0
- package/dist/genexus-ide-ui/p-67cf60f5.js +1 -0
- package/dist/genexus-ide-ui/p-7007965c.entry.js +1 -0
- package/dist/genexus-ide-ui/p-78a90113.entry.js +1 -0
- package/dist/genexus-ide-ui/p-79cf24a3.entry.js +1 -0
- package/dist/genexus-ide-ui/p-b66a4121.entry.js +1 -0
- package/dist/genexus-ide-ui/p-cd503583.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-1e412d88.entry.js → p-fcc98e20.entry.js} +1 -1
- package/dist/node_modules/@genexus/gemini/dist/collection/components/tree-item/gxg-tree-item.css +2 -2
- package/dist/types/common/update-tree-model.d.ts +2 -0
- package/dist/types/components/_template/template.d.ts +2 -2
- package/dist/types/components/_test/test.d.ts +19 -1
- package/dist/types/components/new-kb/new-kb.d.ts +0 -4
- package/dist/types/components/references/references.d.ts +28 -24
- package/dist/types/components.d.ts +41 -21
- package/package.json +3 -3
- package/dist/cjs/render-tree-25d5b8a1.js +0 -29
- package/dist/components/render-tree.js +0 -27
- package/dist/esm/render-tree-fc8636a3.js +0 -27
- package/dist/genexus-ide-ui/p-0f5d0ccc.entry.js +0 -1
- package/dist/genexus-ide-ui/p-2761a056.entry.js +0 -1
- package/dist/genexus-ide-ui/p-62814082.entry.js +0 -1
- package/dist/genexus-ide-ui/p-97430828.entry.js +0 -1
- package/dist/genexus-ide-ui/p-9e32e006.entry.js +0 -1
- package/dist/genexus-ide-ui/p-a5fee36d.entry.js +0 -1
- package/dist/genexus-ide-ui/p-abee8c7b.js +0 -1
- package/dist/genexus-ide-ui/p-be9406e7.entry.js +0 -1
- package/dist/genexus-ide-ui/p-eb8e9655.entry.js +0 -1
- package/dist/genexus-ide-ui/p-f6536bbc.entry.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, g as getElement
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-4f0a5746.js';
|
|
2
2
|
import { e as exportParts } from './export-parts-7f208d57.js';
|
|
3
3
|
|
|
4
4
|
const gxgTreeCss = ":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}:host{display:block;--gxg-tree-item-inner-spacing:var(--spacing-comp-01);overflow:auto;height:100%}:host::-webkit-scrollbar{width:6px;height:6px}:host::-webkit-scrollbar-track{background-color:var(--gray-02);border-radius:10px}:host::-webkit-scrollbar-thumb{background:var(--gray-05);border-radius:10px}:host::-webkit-scrollbar-thumb:hover{background:var(--gray-04);cursor:pointer}:host .gxg-scroll{display:block;overflow-y:auto;padding-right:2px}:host ul{margin:0;padding-left:0;width:100%}";
|
|
@@ -6,7 +6,24 @@ const gxgTreeCss = ":root{--ui-animaton-speed:0.2s}.gxg-title-01{font-family:var
|
|
|
6
6
|
const GxgTree = class {
|
|
7
7
|
constructor(hostRef) {
|
|
8
8
|
registerInstance(this, hostRef);
|
|
9
|
-
|
|
9
|
+
this.treeItemStateChanged = createEvent(this, "treeItemStateChanged", 7);
|
|
10
|
+
/*
|
|
11
|
+
INDEX:
|
|
12
|
+
1.OWN PROPERTIES
|
|
13
|
+
2.REFERENCE TO ELEMENTS
|
|
14
|
+
3.STATE() VARIABLES
|
|
15
|
+
4.PUBLIC PROPERTY API | WATCH'S
|
|
16
|
+
5.EVENTS (EMIT)
|
|
17
|
+
6.COMPONENT LIFECYCLE METHODS
|
|
18
|
+
7.LISTENERS
|
|
19
|
+
8.PUBLIC METHODS API
|
|
20
|
+
9.LOCAL METHODS
|
|
21
|
+
10.RENDER() FUNCTION
|
|
22
|
+
*/
|
|
23
|
+
// 1.OWN PROPERTIES //
|
|
24
|
+
this.masterTree = false;
|
|
25
|
+
// 3.STATE() VARIABLES //
|
|
26
|
+
// 4.PUBLIC PROPERTY API | WATCH'S //
|
|
10
27
|
/**
|
|
11
28
|
* Set this attribute if you want all the items to have a checkbox.
|
|
12
29
|
*/
|
|
@@ -27,10 +44,7 @@ const GxgTree = class {
|
|
|
27
44
|
* Set this attribute if you want to allow multi selection of the items. This property should only be set on the master tree.
|
|
28
45
|
*/
|
|
29
46
|
this.multiSelection = false;
|
|
30
|
-
|
|
31
|
-
* Indicates if this the is master tree
|
|
32
|
-
*/
|
|
33
|
-
this.masterTree = false;
|
|
47
|
+
// 9.LOCAL METHODS //
|
|
34
48
|
/**
|
|
35
49
|
* This method evaluates if this tree is the master tree
|
|
36
50
|
*/
|
|
@@ -57,24 +71,54 @@ const GxgTree = class {
|
|
|
57
71
|
: this.toggleCheckboxes;
|
|
58
72
|
}
|
|
59
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* @description This functions is supposed to be called from any of the listeners that are attached to the tree-item events that are emitted when the state changes (toggleIconClicked, selectionChanged, checkboxToggled). When an item state is changed, this function emits the update item data, so that the host can update the tree model, if any, if desired.
|
|
76
|
+
*/
|
|
77
|
+
this.emitTreeItemNewState = (itemData, emittedBy) => {
|
|
78
|
+
this.treeItemStateChanged.emit({ itemData, emittedBy: emittedBy });
|
|
79
|
+
};
|
|
60
80
|
}
|
|
81
|
+
// 6.COMPONENT LIFECYCLE METHODS //
|
|
61
82
|
componentWillLoad() {
|
|
62
|
-
//this.initialConfig();
|
|
63
83
|
this.initialConfig();
|
|
64
84
|
this.evaluateIsMasterTree();
|
|
65
85
|
}
|
|
86
|
+
// 7.LISTENERS //
|
|
87
|
+
checkboxToggledHandler(e) {
|
|
88
|
+
const itemData = e.detail;
|
|
89
|
+
if (this.masterTree) {
|
|
90
|
+
this.emitTreeItemNewState(itemData, "checkboxToggled");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
doubleClickedHandler(e) {
|
|
94
|
+
const itemData = e.detail;
|
|
95
|
+
if (this.masterTree) {
|
|
96
|
+
this.emitTreeItemNewState(itemData, "doubleClicked");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
66
99
|
selectionChangedHandler(e) {
|
|
67
100
|
//Unselect all items, except the one that triggered this event. This action should be done once, by the master tree.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
101
|
+
const allChildren = this.el.querySelectorAll("gxg-tree-item");
|
|
102
|
+
if ((this.masterTree && this.multiSelection && !e.detail.ctrl) ||
|
|
103
|
+
(this.masterTree && !this.multiSelection)) {
|
|
104
|
+
Array.from(allChildren).forEach((item) => {
|
|
105
|
+
if (item !== e.detail.ref) {
|
|
73
106
|
item.selected = false;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
const itemData = e.detail;
|
|
111
|
+
if (this.masterTree) {
|
|
112
|
+
this.emitTreeItemNewState(itemData, "selectionChanged");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
toggleIconClickedHandler(e) {
|
|
116
|
+
const itemData = e.detail;
|
|
117
|
+
if (this.masterTree) {
|
|
118
|
+
this.emitTreeItemNewState(itemData, "toggleIconClicked");
|
|
76
119
|
}
|
|
77
120
|
}
|
|
121
|
+
// 8.PUBLIC METHODS API //
|
|
78
122
|
/**
|
|
79
123
|
* Returns an array of the selected tree-items, providing the id, checked status, selected status, and label.
|
|
80
124
|
*/
|
|
@@ -158,6 +202,7 @@ const GxgTree = class {
|
|
|
158
202
|
});
|
|
159
203
|
return toggledTreeItems;
|
|
160
204
|
}
|
|
205
|
+
// 10.RENDER() FUNCTION //
|
|
161
206
|
render() {
|
|
162
207
|
return (h(Host, null, h("div", { class: {
|
|
163
208
|
tree: true,
|
|
@@ -167,21 +212,38 @@ const GxgTree = class {
|
|
|
167
212
|
};
|
|
168
213
|
GxgTree.style = gxgTreeCss;
|
|
169
214
|
|
|
170
|
-
const gxgTreeItemCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0;}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px;}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}: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}:host{--text-color:var(--color-on-background);--font-family:\"Source Sans Pro\", sans-serif;--font-weight:normal;--font-size:12px;--guide-color:var(--gray-06);--item-hover-color:var(--gray-01);--item-active-color:var(--silverGray);color:var(--color-on-background);width:100%;display:block}:host li{list-style:none;font-family:var(--font-family);font-size:var(--font-size);font-weight:var(--font-weight);color:var(--text-color);overflow:hidden}:host li>::slotted(gxg-tree){display:none}:host li.tree-open>::slotted(gxg-tree){display:block}:host li.tree-closed .vertical-line{display:none}:host li .li-text{min-height:24px;cursor:pointer;display:flex;align-items:center;position:relative;padding-inline-end:var(--spacing-comp-01)}:host li .li-text:hover{background-color:var(--item-hover-color)}:host li .li-text:active{background-color:var(--gxg-color-selected)}:host li .li-text:focus{outline-style:solid;outline-color:var(--color-primary-active);outline-width:var(--border-width-md);outline-offset:-2px}:host li .li-text--selected{background-color:var(--gxg-color-selected)}:host li .li-text>*{flex-shrink:0}:host li .vertical-line{position:absolute;width:1px;height:0;top:23px;left:15px;z-index:1;background-image:linear-gradient(var(--guide-color) 28%, rgba(255, 255, 255, 0) 0%);background-position:right;background-size:1px 4px;background-repeat:repeat-y}:host li .horizontal-line{position:absolute;height:1px;top:11px;z-index:1;background-image:linear-gradient(to right, var(--guide-color) 33%, rgba(255, 255, 255, 0) 0%);background-position:bottom;background-size:3px 1px;background-repeat:repeat-x}:host li .horizontal-line.display-none{display:none}:host li .closed-opened-icons{position:relative;display:flex;margin-left:-2px}:host li .toggle-icon{position:relative;z-index:2;transform:scale(0.75, 0.75);margin-inline-end:var(--spacing-comp-00);transition-property:opacity;transition-duration:0.5s;transition-timing-function:ease;background-color:var(--color-hover)}:host li .toggle-icon:hover{background-color:var(--color-background)}:host .checkbox{margin-inline-end:var(--spacing-comp-01)}:host .icon--left{margin:0 var(--spacing-comp-01) 0 var(--spacing-comp-00)}:host .right-icon{margin-inline-start:auto;position:relative;top:0;transition-property:top;transition-duration:0.5s;transition-timing-function:ease}:host .loading{opacity:1;display:inline;z-index:1;margin-inline-end:var(--spacing-comp-01);border-radius:50%;width:8px;height:8px;border:0.18rem solid var(--gray-04);border-top-color:var(--gray-01);animation:spin 1s infinite linear}:host .loading--double{border-style:double;border-width:0.5rem}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host([disabled]) li .text{color:var(--darkGray)}:host([disabled]) .toggle-icon{pointer-events:none}";
|
|
215
|
+
const gxgTreeItemCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0;}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px;}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}: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}:host{--text-color:var(--color-on-background);--font-family:\"Source Sans Pro\", sans-serif;--font-weight:normal;--font-size:12px;--guide-color:var(--gray-06);--item-hover-color:var(--gray-01);--item-active-color:var(--silverGray);color:var(--color-on-background);width:100%;display:block}:host li{list-style:none;font-family:var(--font-family);font-size:var(--font-size);font-weight:var(--font-weight);color:var(--text-color);overflow:hidden}:host li>::slotted(gxg-tree){display:none}:host li.tree-open>::slotted(gxg-tree){display:block}:host li.tree-closed .vertical-line{display:none}:host li .li-text{min-height:24px;cursor:pointer;display:flex;align-items:center;position:relative;padding-inline-end:var(--spacing-comp-01)}:host li .li-text:hover{background-color:var(--item-hover-color)}:host li .li-text:active{background-color:var(--gxg-background-color-item-selected)}:host li .li-text:focus{outline-style:solid;outline-color:var(--color-primary-active);outline-width:var(--border-width-md);outline-offset:-2px}:host li .li-text--selected{background-color:var(--gxg-background-color-item-selected)}:host li .li-text>*{flex-shrink:0}:host li .vertical-line{position:absolute;width:1px;height:0;top:23px;left:15px;z-index:1;background-image:linear-gradient(var(--guide-color) 28%, rgba(255, 255, 255, 0) 0%);background-position:right;background-size:1px 4px;background-repeat:repeat-y}:host li .horizontal-line{position:absolute;height:1px;top:11px;z-index:1;background-image:linear-gradient(to right, var(--guide-color) 33%, rgba(255, 255, 255, 0) 0%);background-position:bottom;background-size:3px 1px;background-repeat:repeat-x}:host li .horizontal-line.display-none{display:none}:host li .closed-opened-icons{position:relative;display:flex;margin-left:-2px}:host li .toggle-icon{position:relative;z-index:2;transform:scale(0.75, 0.75);margin-inline-end:var(--spacing-comp-00);transition-property:opacity;transition-duration:0.5s;transition-timing-function:ease;background-color:var(--color-hover)}:host li .toggle-icon:hover{background-color:var(--color-background)}:host .checkbox{margin-inline-end:var(--spacing-comp-01)}:host .icon--left{margin:0 var(--spacing-comp-01) 0 var(--spacing-comp-00)}:host .right-icon{margin-inline-start:auto;position:relative;top:0;transition-property:top;transition-duration:0.5s;transition-timing-function:ease}:host .loading{opacity:1;display:inline;z-index:1;margin-inline-end:var(--spacing-comp-01);border-radius:50%;width:8px;height:8px;border:0.18rem solid var(--gray-04);border-top-color:var(--gray-01);animation:spin 1s infinite linear}:host .loading--double{border-style:double;border-width:0.5rem}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host([disabled]) li .text{color:var(--darkGray)}:host([disabled]) .toggle-icon{pointer-events:none}";
|
|
171
216
|
|
|
172
217
|
const GxgTreeItem = class {
|
|
173
218
|
constructor(hostRef) {
|
|
174
219
|
registerInstance(this, hostRef);
|
|
175
|
-
this.toggleIconClicked = createEvent(this, "toggleIconClicked", 7);
|
|
176
|
-
this.selectionChanged = createEvent(this, "selectionChanged", 7);
|
|
177
|
-
this.doubleClicked = createEvent(this, "doubleClicked", 7);
|
|
178
220
|
this.checkboxToggled = createEvent(this, "checkboxToggled", 7);
|
|
221
|
+
this.doubleClicked = createEvent(this, "doubleClicked", 7);
|
|
222
|
+
this.lazyChanged = createEvent(this, "lazyChanged", 7);
|
|
223
|
+
this.selectionChanged = createEvent(this, "selectionChanged", 7);
|
|
224
|
+
this.toggleIconClicked = createEvent(this, "toggleIconClicked", 7);
|
|
225
|
+
this.lazy = false; //True if not leaf but no children.
|
|
226
|
+
this.parentTreeIsMasterTree = false;
|
|
227
|
+
this.numberOfParentTrees = 1;
|
|
228
|
+
this.firstItem = false;
|
|
229
|
+
this.lastItem = false;
|
|
230
|
+
this.leftPadding = "0px";
|
|
231
|
+
this.verticalLineStartPosition = "0px";
|
|
232
|
+
this.horizontalLineWidth = "24px";
|
|
233
|
+
this.horizontalLineStartPosition = "0px";
|
|
179
234
|
this.parts = {
|
|
180
235
|
item: "item",
|
|
181
236
|
checkbox: "checkbox",
|
|
182
237
|
toggleButton: "toggle-button",
|
|
183
238
|
};
|
|
184
|
-
//
|
|
239
|
+
// 3.STATE() VARIABLES //
|
|
240
|
+
this.horizontalLinePaddingLeft = 0;
|
|
241
|
+
this.lastTreeItem = false;
|
|
242
|
+
this.lastTreeItemOfParentTree = false;
|
|
243
|
+
this.numberOfVisibleDescendantItems = 0;
|
|
244
|
+
this.time = 0;
|
|
245
|
+
this.downloading = false;
|
|
246
|
+
// 4.PUBLIC PROPERTY API | WATCH'S //
|
|
185
247
|
/**
|
|
186
248
|
* Set this attribute if you want this item to display a checkbox. This attribute is affected by the parent tree-item checkbox attribute, unless it is set in this item.
|
|
187
249
|
*/
|
|
@@ -214,24 +276,15 @@ const GxgTreeItem = class {
|
|
|
214
276
|
* This property is for internal use, when using the treeModel.
|
|
215
277
|
*/
|
|
216
278
|
this.numberOfChildren = 0;
|
|
279
|
+
/**
|
|
280
|
+
* This property is for internal use. It indicates that the item has children.
|
|
281
|
+
*/
|
|
217
282
|
this.hasChildTree = false;
|
|
283
|
+
/**
|
|
284
|
+
* This property is for internal use. It indicates that the checkbox has an indeterminate state.
|
|
285
|
+
*/
|
|
218
286
|
this.indeterminate = false;
|
|
219
|
-
//
|
|
220
|
-
this.horizontalLinePaddingLeft = 0;
|
|
221
|
-
this.lastTreeItem = false;
|
|
222
|
-
this.lastTreeItemOfParentTree = false;
|
|
223
|
-
this.numberOfVisibleDescendantItems = 0;
|
|
224
|
-
this.time = 0;
|
|
225
|
-
this.downloading = false;
|
|
226
|
-
this.lazy = false; //True if not leaf but no children.
|
|
227
|
-
this.parentTreeIsMasterTree = false;
|
|
228
|
-
this.numberOfParentTrees = 1;
|
|
229
|
-
this.firstItem = false;
|
|
230
|
-
this.lastItem = false;
|
|
231
|
-
this.leftPadding = "0px";
|
|
232
|
-
this.verticalLineStartPosition = "0px";
|
|
233
|
-
this.horizontalLineWidth = "24px";
|
|
234
|
-
this.horizontalLineStartPosition = "0px";
|
|
287
|
+
// 9.LOCAL METHODS //
|
|
235
288
|
this.evaluateId = () => {
|
|
236
289
|
if (!this.id) {
|
|
237
290
|
this.id = this.el.getAttribute("id");
|
|
@@ -255,31 +308,6 @@ const GxgTreeItem = class {
|
|
|
255
308
|
this.initiateMutationObserver = () => {
|
|
256
309
|
this.observer.observe(this.el, { childList: true, subtree: true });
|
|
257
310
|
};
|
|
258
|
-
this.evaluateCheckboxStatus = () => {
|
|
259
|
-
const allChildren = this.el.querySelectorAll("gxg-tree-item");
|
|
260
|
-
let checked = 0;
|
|
261
|
-
if (allChildren === null || allChildren === void 0 ? void 0 : allChildren.length) {
|
|
262
|
-
Array.from(allChildren).forEach((item) => {
|
|
263
|
-
if (item.checked) {
|
|
264
|
-
checked++;
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
if (allChildren.length === checked) {
|
|
268
|
-
//all checked
|
|
269
|
-
this.checked = true;
|
|
270
|
-
this.indeterminate = false;
|
|
271
|
-
}
|
|
272
|
-
else if (checked === 0) {
|
|
273
|
-
//all unchecked
|
|
274
|
-
this.checked = false;
|
|
275
|
-
this.indeterminate = false;
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
//indeterminate
|
|
279
|
-
this.indeterminate = true;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
311
|
/**
|
|
284
312
|
* @description Set some properties based on the parent tree configuration, unless this item has this properties already set.
|
|
285
313
|
*/
|
|
@@ -344,296 +372,350 @@ const GxgTreeItem = class {
|
|
|
344
372
|
this.leftPadding = `${value}px`;
|
|
345
373
|
this.horizontalLineStartPosition = `${horizontalLineStartPosition}px`;
|
|
346
374
|
};
|
|
347
|
-
this.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
this.
|
|
354
|
-
id: this.el.id,
|
|
355
|
-
label: this.el.label,
|
|
356
|
-
checked: this.checked,
|
|
357
|
-
selected: this.selected,
|
|
358
|
-
});
|
|
375
|
+
this.liTextClickedHandler = (e) => {
|
|
376
|
+
const toggleWasClicked = e.target.classList.contains("toggle-icon");
|
|
377
|
+
const checkboxClicked = e.target.nodeName === "GXG-FORM-CHECKBOX";
|
|
378
|
+
if (toggleWasClicked || checkboxClicked)
|
|
379
|
+
return;
|
|
380
|
+
if (e.ctrlKey) {
|
|
381
|
+
this.selected = !this.selected;
|
|
359
382
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
checkboxToggledHandler() {
|
|
363
|
-
this.evaluateCheckboxStatus();
|
|
364
|
-
}
|
|
365
|
-
componentWillLoad() {
|
|
366
|
-
//Count number of parent trees in order to set the appropriate padding-left
|
|
367
|
-
this.numberOfParentTrees = this.getParentsNumber();
|
|
368
|
-
this.numberOfChildren = this.getChildrenNumber();
|
|
369
|
-
//If is last item of tree
|
|
370
|
-
const nextItem = this.el.nextElementSibling;
|
|
371
|
-
if (nextItem === null) {
|
|
372
|
-
this.lastTreeItem = true;
|
|
373
|
-
}
|
|
374
|
-
if (this.numberOfParentTrees === 1) {
|
|
375
|
-
this.parentTreeIsMasterTree = true;
|
|
376
|
-
const prevItem = this.el.previousElementSibling;
|
|
377
|
-
if (prevItem === null) {
|
|
378
|
-
//If is first item of parent tree...
|
|
379
|
-
this.firstItem = true;
|
|
383
|
+
else {
|
|
384
|
+
this.selected = true;
|
|
380
385
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
this.
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
this.attachExportParts();
|
|
391
|
-
this.initiateMutationObserver();
|
|
392
|
-
}
|
|
393
|
-
getParentsNumber() {
|
|
394
|
-
var _a;
|
|
395
|
-
let count = 0;
|
|
396
|
-
let parentElement = this.el.parentElement;
|
|
397
|
-
while ((parentElement === null || parentElement === void 0 ? void 0 : parentElement.nodeName) === "GXG-TREE") {
|
|
398
|
-
count++;
|
|
399
|
-
parentElement = (_a = parentElement.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
400
|
-
}
|
|
401
|
-
return count;
|
|
402
|
-
}
|
|
403
|
-
getChildrenNumber() {
|
|
404
|
-
if (this.numberOfChildren === 0) {
|
|
405
|
-
//If this.numberOfChildren === 0 it might be because the whole tree was created with markup, and not by passing a model. In that case, count the children with querySelectorAll.
|
|
406
|
-
return this.el.querySelectorAll("gxg-tree-item").length;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
toggleClickedHandler(e) {
|
|
410
|
-
this.toggleIconClicked.emit({ id: this.id, lazy: this.lazy });
|
|
411
|
-
if (this.lazy && !this.opened) {
|
|
412
|
-
this.downloading = true;
|
|
413
|
-
}
|
|
414
|
-
if (!this.lazy) {
|
|
415
|
-
this.opened = !this.opened;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
async reRender() {
|
|
419
|
-
this.defineLineHeight();
|
|
420
|
-
}
|
|
421
|
-
liTextClickedHandler(e) {
|
|
422
|
-
const toggleWasClicked = e.target.classList.contains("toggle-icon");
|
|
423
|
-
const checkboxClicked = e.target.nodeName === "GXG-FORM-CHECKBOX";
|
|
424
|
-
if (toggleWasClicked || checkboxClicked)
|
|
425
|
-
return;
|
|
426
|
-
if (e.ctrlKey || !this.selected) {
|
|
427
|
-
this.selectionChanged.emit({
|
|
428
|
-
id: this.id,
|
|
429
|
-
label: this.label,
|
|
430
|
-
checked: this.checked,
|
|
431
|
-
selected: !this.selected,
|
|
432
|
-
ctrlKey: e.ctrlKey,
|
|
433
|
-
});
|
|
434
|
-
}
|
|
435
|
-
if (e.ctrlKey) {
|
|
436
|
-
this.selected = !this.selected;
|
|
437
|
-
}
|
|
438
|
-
else if (!this.selected) {
|
|
439
|
-
this.selected = true;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
liTextDoubleClicked(e) {
|
|
443
|
-
this.doubleClicked.emit({
|
|
444
|
-
id: this.id,
|
|
445
|
-
});
|
|
446
|
-
!this.leaf && this.toggleClickedHandler(e);
|
|
447
|
-
}
|
|
448
|
-
liTextKeyDownPressed(e) {
|
|
449
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
450
|
-
e.preventDefault(); //prevents scrolling
|
|
451
|
-
}
|
|
452
|
-
//ENTER
|
|
453
|
-
if (e.key === "Enter") {
|
|
454
|
-
//Enter should check/uncheck the checkbox (if present)
|
|
455
|
-
this.checkboxClickedHandler();
|
|
456
|
-
}
|
|
457
|
-
//LEFT/RIGHT NAVIGATION
|
|
458
|
-
if (e.key === "ArrowRight" && !this.leaf) {
|
|
459
|
-
//Toggle the tree
|
|
460
|
-
if (!this.opened) {
|
|
461
|
-
this.opened = true;
|
|
386
|
+
this.selectionChanged.emit(this.getItemData(e.ctrlKey));
|
|
387
|
+
};
|
|
388
|
+
this.liTextDoubleClicked = () => {
|
|
389
|
+
this.doubleClicked.emit(this.getItemData(false));
|
|
390
|
+
!this.leaf && this.toggleClickedHandler();
|
|
391
|
+
};
|
|
392
|
+
this.liTextKeyDownPressed = (e) => {
|
|
393
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
394
|
+
e.preventDefault(); //prevents scrolling
|
|
462
395
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
childTreeFirstChildrenLiText.focus();
|
|
396
|
+
//ENTER
|
|
397
|
+
if (e.key === "Enter") {
|
|
398
|
+
//Enter should check/uncheck the checkbox (if present)
|
|
399
|
+
this.checkboxClickedHandler();
|
|
468
400
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
if (hasParent) {
|
|
481
|
-
parentGxgTreeItemLiText.focus();
|
|
401
|
+
//LEFT/RIGHT NAVIGATION
|
|
402
|
+
if (e.key === "ArrowRight" && !this.leaf) {
|
|
403
|
+
//Toggle the tree
|
|
404
|
+
if (!this.opened) {
|
|
405
|
+
this.opened = true;
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
const childTree = this.el.querySelector("gxg-tree");
|
|
409
|
+
const childTreeFirstChildren = childTree.querySelector("gxg-tree-item");
|
|
410
|
+
const childTreeFirstChildrenLiText = childTreeFirstChildren.shadowRoot.querySelector(".li-text");
|
|
411
|
+
childTreeFirstChildrenLiText.focus();
|
|
482
412
|
}
|
|
483
413
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
414
|
+
if (e.key === "ArrowLeft") {
|
|
415
|
+
let hasParent = false;
|
|
416
|
+
const parentGxgTreeItem = this.el.parentElement.parentElement;
|
|
417
|
+
let parentGxgTreeItemLiText = null;
|
|
418
|
+
if (parentGxgTreeItem.tagName === "GXG-TREE-ITEM") {
|
|
419
|
+
hasParent = true;
|
|
420
|
+
parentGxgTreeItemLiText = parentGxgTreeItem.shadowRoot.querySelector(".li-text");
|
|
488
421
|
}
|
|
489
|
-
|
|
422
|
+
if (this.leaf) {
|
|
490
423
|
if (hasParent) {
|
|
491
424
|
parentGxgTreeItemLiText.focus();
|
|
492
425
|
}
|
|
493
426
|
}
|
|
494
|
-
}
|
|
495
|
-
this.toggleIconClicked.emit({ id: this.id }); //this recalculates the vertical line height
|
|
496
|
-
}
|
|
497
|
-
// UP/DOWN NAVIGATION
|
|
498
|
-
if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
|
|
499
|
-
e.preventDefault();
|
|
500
|
-
if (!this.firstItem) {
|
|
501
|
-
//Is not the first element of the parent
|
|
502
|
-
//Set focus on the prev item
|
|
503
|
-
let prevItem;
|
|
504
|
-
const prevElementSibling = this.el.previousElementSibling;
|
|
505
|
-
if (e.shiftKey && e.key !== "Tab") {
|
|
506
|
-
//if shift key was pressed, navigate to the previous sibling
|
|
507
|
-
if (prevElementSibling !== null) {
|
|
508
|
-
prevItem = prevElementSibling.shadowRoot.querySelector("li .li-text");
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
427
|
else {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
prevItem = parentParentItem.shadowRoot.querySelector("li .li-text");
|
|
428
|
+
const li = this.el.shadowRoot.querySelector("li");
|
|
429
|
+
if (li.classList.contains("tree-open")) {
|
|
430
|
+
this.opened = false;
|
|
516
431
|
}
|
|
517
432
|
else {
|
|
518
|
-
|
|
433
|
+
if (hasParent) {
|
|
434
|
+
parentGxgTreeItemLiText.focus();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
// UP/DOWN NAVIGATION
|
|
440
|
+
if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
|
|
441
|
+
e.preventDefault();
|
|
442
|
+
if (!this.firstItem) {
|
|
443
|
+
//Is not the first element of the parent
|
|
444
|
+
//Set focus on the prev item
|
|
445
|
+
let prevItem;
|
|
446
|
+
const prevElementSibling = this.el.previousElementSibling;
|
|
447
|
+
if (e.shiftKey && e.key !== "Tab") {
|
|
448
|
+
//if shift key was pressed, navigate to the previous sibling
|
|
519
449
|
if (prevElementSibling !== null) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
450
|
+
prevItem = prevElementSibling.shadowRoot.querySelector("li .li-text");
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
else {
|
|
454
|
+
if (prevElementSibling === null) {
|
|
455
|
+
const parentItem = this.el.parentElement;
|
|
456
|
+
const parentParentItem = parentItem.parentElement;
|
|
457
|
+
prevItem = parentParentItem.shadowRoot.querySelector("li .li-text");
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
prevItem = prevElementSibling.shadowRoot.querySelector("li .li-text");
|
|
461
|
+
if (prevElementSibling !== null) {
|
|
462
|
+
//If the preceding tree-item has tree inside...
|
|
463
|
+
const prevElementSiblingHasChildTree = prevElementSibling
|
|
464
|
+
.hasChildTree;
|
|
465
|
+
if (prevElementSiblingHasChildTree) {
|
|
466
|
+
const prevElementSiblingHasOpenTree = prevElementSibling
|
|
467
|
+
.opened;
|
|
468
|
+
if (prevElementSiblingHasOpenTree) {
|
|
469
|
+
//If preceding tree-item tree is opened, then the prev item is the last item of that tree
|
|
470
|
+
const prevElemSiblingTreeItem = this.el
|
|
471
|
+
.previousElementSibling;
|
|
472
|
+
const prevElemSiblingTreeItemTree = prevElemSiblingTreeItem.querySelector("gxg-tree");
|
|
473
|
+
//
|
|
474
|
+
if (prevElemSiblingTreeItemTree.lastElementChild
|
|
475
|
+
.hasChildTree) {
|
|
476
|
+
if (prevElemSiblingTreeItemTree.lastElementChild.shadowRoot
|
|
477
|
+
.querySelector("li")
|
|
478
|
+
.classList.contains("tree-open")) {
|
|
479
|
+
prevItem = prevElemSiblingTreeItemTree.lastElementChild
|
|
480
|
+
.querySelector("gxg-tree")
|
|
481
|
+
.lastElementChild.shadowRoot.querySelector("li .li-text");
|
|
482
|
+
}
|
|
483
|
+
else {
|
|
484
|
+
prevItem = prevElemSiblingTreeItemTree.lastElementChild.shadowRoot.querySelector("li .li-text");
|
|
485
|
+
}
|
|
540
486
|
}
|
|
541
487
|
else {
|
|
542
488
|
prevItem = prevElemSiblingTreeItemTree.lastElementChild.shadowRoot.querySelector("li .li-text");
|
|
543
489
|
}
|
|
490
|
+
//
|
|
544
491
|
}
|
|
545
492
|
else {
|
|
546
|
-
|
|
493
|
+
//The preciding item has a tree, but it is closed
|
|
494
|
+
prevItem = this.el.previousElementSibling.shadowRoot.querySelector("li .li-text");
|
|
547
495
|
}
|
|
548
|
-
//
|
|
549
|
-
}
|
|
550
|
-
else {
|
|
551
|
-
//The preciding item has a tree, but it is closed
|
|
552
|
-
prevItem = this.el.previousElementSibling.shadowRoot.querySelector("li .li-text");
|
|
553
496
|
}
|
|
554
497
|
}
|
|
555
498
|
}
|
|
556
499
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
500
|
+
if (prevItem !== null && prevItem !== undefined) {
|
|
501
|
+
prevItem.focus();
|
|
502
|
+
}
|
|
560
503
|
}
|
|
561
504
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
505
|
+
if (e.key === "ArrowDown" || (e.key === "Tab" && !e.shiftKey)) {
|
|
506
|
+
e.preventDefault();
|
|
507
|
+
if (!this.lastTreeItemOfParentTree) {
|
|
508
|
+
//Set focus on the next item
|
|
509
|
+
let nextItem;
|
|
510
|
+
if (e.shiftKey) {
|
|
511
|
+
//if shift key was pressed, navigate to the next sibling
|
|
512
|
+
if (this.el.nextElementSibling !== null) {
|
|
513
|
+
nextItem = this.el.nextElementSibling.shadowRoot.querySelector("li .li-text");
|
|
514
|
+
}
|
|
572
515
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
516
|
+
else {
|
|
517
|
+
if (this.lastTreeItem) {
|
|
518
|
+
if (this.hasChildTree && this.opened) {
|
|
519
|
+
nextItem = this.el.firstElementChild.firstElementChild.shadowRoot.querySelector(".li-text");
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
const thisTree = this.el.parentElement;
|
|
523
|
+
const thisTreeParent = thisTree.parentElement;
|
|
524
|
+
const thisTreeParentNextTree = thisTreeParent.nextElementSibling;
|
|
525
|
+
if (thisTreeParentNextTree === null) {
|
|
526
|
+
if (thisTreeParent.parentElement.parentElement
|
|
527
|
+
.nextElementSibling !== null) {
|
|
528
|
+
nextItem = thisTreeParent.parentElement.parentElement.nextElementSibling.shadowRoot.querySelector(".li-text");
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
nextItem = thisTreeParentNextTree.shadowRoot.querySelector(".li-text");
|
|
533
|
+
}
|
|
534
|
+
}
|
|
578
535
|
}
|
|
579
536
|
else {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (thisTreeParent.parentElement.parentElement
|
|
585
|
-
.nextElementSibling !== null) {
|
|
586
|
-
nextItem = thisTreeParent.parentElement.parentElement.nextElementSibling.shadowRoot.querySelector(".li-text");
|
|
587
|
-
}
|
|
537
|
+
if (this.hasChildTree && this.opened) {
|
|
538
|
+
nextItem = this.el
|
|
539
|
+
.querySelector("gxg-tree gxg-tree-item")
|
|
540
|
+
.shadowRoot.querySelector("li .li-text");
|
|
588
541
|
}
|
|
589
542
|
else {
|
|
590
|
-
nextItem =
|
|
543
|
+
nextItem = this.el.nextElementSibling.shadowRoot.querySelector(".li-text");
|
|
591
544
|
}
|
|
592
545
|
}
|
|
593
546
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
nextItem = this.el
|
|
597
|
-
.querySelector("gxg-tree gxg-tree-item")
|
|
598
|
-
.shadowRoot.querySelector("li .li-text");
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
nextItem = this.el.nextElementSibling.shadowRoot.querySelector(".li-text");
|
|
602
|
-
}
|
|
547
|
+
if (nextItem !== null && nextItem !== undefined) {
|
|
548
|
+
nextItem.focus();
|
|
603
549
|
}
|
|
604
550
|
}
|
|
605
|
-
|
|
606
|
-
|
|
551
|
+
else {
|
|
552
|
+
//Last element of parent tree
|
|
553
|
+
if (!this.leaf && this.opened) {
|
|
554
|
+
const childTreeFirstTreeItem = this.el.firstElementChild.firstElementChild.shadowRoot.querySelector("li .li-text");
|
|
555
|
+
childTreeFirstTreeItem.focus();
|
|
556
|
+
}
|
|
607
557
|
}
|
|
608
558
|
}
|
|
559
|
+
};
|
|
560
|
+
this.returnToggleIconType = () => {
|
|
561
|
+
//Returns the type of icon : expand or collapse
|
|
562
|
+
if (!this.opened || this.lazy) {
|
|
563
|
+
return "gemini-tools/add";
|
|
564
|
+
}
|
|
609
565
|
else {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
566
|
+
return "gemini-tools/minus";
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* When a checkbox is clicked, it state changes and so it's children, and parent items do.
|
|
571
|
+
* First evaluate the children, and then the parent items.
|
|
572
|
+
*/
|
|
573
|
+
this.checkboxClickedHandler = () => {
|
|
574
|
+
if (this.checkbox) {
|
|
575
|
+
this.checked = !this.checked;
|
|
576
|
+
if (!this.leaf) {
|
|
577
|
+
this.toggleChildrenCheckboxes(this.checked);
|
|
614
578
|
}
|
|
579
|
+
const parentItems = this.getParentItems();
|
|
580
|
+
parentItems.forEach((parentItem) => {
|
|
581
|
+
parentItem.evaluateCheckboxStatus();
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
this.toggleChildrenCheckboxes = (checked) => {
|
|
586
|
+
this.indeterminate = false;
|
|
587
|
+
const allChildren = this.el.querySelectorAll("gxg-tree-item");
|
|
588
|
+
if (allChildren === null || allChildren === void 0 ? void 0 : allChildren.length) {
|
|
589
|
+
Array.from(allChildren).forEach((item) => {
|
|
590
|
+
item.indeterminate = false;
|
|
591
|
+
item.checked = checked;
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
};
|
|
595
|
+
this.getParentItems = () => {
|
|
596
|
+
var _a;
|
|
597
|
+
const parentItems = [];
|
|
598
|
+
let parentItem = this.el.parentElement.parentElement;
|
|
599
|
+
while ((parentItem === null || parentItem === void 0 ? void 0 : parentItem.nodeName) === "GXG-TREE-ITEM") {
|
|
600
|
+
parentItems.push(parentItem);
|
|
601
|
+
parentItem = (_a = parentItem.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
602
|
+
}
|
|
603
|
+
return parentItems;
|
|
604
|
+
};
|
|
605
|
+
this.getParentsNumber = () => {
|
|
606
|
+
var _a;
|
|
607
|
+
let count = 0;
|
|
608
|
+
let parentElement = this.el.parentElement;
|
|
609
|
+
while ((parentElement === null || parentElement === void 0 ? void 0 : parentElement.nodeName) === "GXG-TREE") {
|
|
610
|
+
count++;
|
|
611
|
+
parentElement = (_a = parentElement.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
612
|
+
}
|
|
613
|
+
return count;
|
|
614
|
+
};
|
|
615
|
+
this.getChildrenNumber = () => {
|
|
616
|
+
if (this.numberOfChildren === 0) {
|
|
617
|
+
//If this.numberOfChildren === 0 it might be because the whole tree was created with markup, and not by passing a model. In that case, count the children with querySelectorAll.
|
|
618
|
+
return this.el.querySelectorAll("gxg-tree-item").length;
|
|
615
619
|
}
|
|
620
|
+
};
|
|
621
|
+
this.toggleClickedHandler = () => {
|
|
622
|
+
if (this.lazy && !this.opened) {
|
|
623
|
+
this.downloading = true;
|
|
624
|
+
this.toggleIconClicked.emit(this.getItemData());
|
|
625
|
+
}
|
|
626
|
+
if (!this.lazy) {
|
|
627
|
+
this.opened = !this.opened;
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
this.getItemData = (ctrl = false) => {
|
|
631
|
+
return {
|
|
632
|
+
ref: this.el,
|
|
633
|
+
checkbox: this.checkbox,
|
|
634
|
+
checked: this.checked,
|
|
635
|
+
ctrl: ctrl,
|
|
636
|
+
description: this.description,
|
|
637
|
+
disabled: this.disabled,
|
|
638
|
+
icon: this.icon,
|
|
639
|
+
id: this.id,
|
|
640
|
+
indeterminate: this.indeterminate,
|
|
641
|
+
label: this.label,
|
|
642
|
+
lazy: this.lazy,
|
|
643
|
+
leaf: this.leaf,
|
|
644
|
+
opened: this.opened,
|
|
645
|
+
selected: this.selected,
|
|
646
|
+
};
|
|
647
|
+
};
|
|
648
|
+
}
|
|
649
|
+
checkedHandler(newValue, oldValue) {
|
|
650
|
+
if (oldValue !== undefined) {
|
|
651
|
+
this.checkboxToggled.emit(this.getItemData(false));
|
|
616
652
|
}
|
|
617
653
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
return "gemini-tools/add";
|
|
654
|
+
openedHandler(newValue, oldValue) {
|
|
655
|
+
if (oldValue !== undefined) {
|
|
656
|
+
this.toggleIconClicked.emit(this.getItemData(false));
|
|
622
657
|
}
|
|
623
|
-
|
|
624
|
-
|
|
658
|
+
}
|
|
659
|
+
// 6.COMPONENT LIFECYCLE METHODS //
|
|
660
|
+
componentWillLoad() {
|
|
661
|
+
//Count number of parent trees in order to set the appropriate padding-left
|
|
662
|
+
this.numberOfParentTrees = this.getParentsNumber();
|
|
663
|
+
this.numberOfChildren = this.getChildrenNumber();
|
|
664
|
+
//If is last item of tree
|
|
665
|
+
const nextItem = this.el.nextElementSibling;
|
|
666
|
+
if (nextItem === null) {
|
|
667
|
+
this.lastTreeItem = true;
|
|
668
|
+
}
|
|
669
|
+
if (this.numberOfParentTrees === 1) {
|
|
670
|
+
this.parentTreeIsMasterTree = true;
|
|
671
|
+
const prevItem = this.el.previousElementSibling;
|
|
672
|
+
if (prevItem === null) {
|
|
673
|
+
//If is first item of parent tree...
|
|
674
|
+
this.firstItem = true;
|
|
675
|
+
}
|
|
625
676
|
}
|
|
677
|
+
if (!this.el.nextElementSibling) {
|
|
678
|
+
this.lastItem = true;
|
|
679
|
+
}
|
|
680
|
+
this.evaluateId();
|
|
681
|
+
this.evaluateLazy();
|
|
682
|
+
this.defineLineHeight();
|
|
683
|
+
this.defineStartPosition();
|
|
684
|
+
this.cascadeConfig();
|
|
685
|
+
this.attachExportParts();
|
|
686
|
+
this.initiateMutationObserver();
|
|
626
687
|
}
|
|
627
|
-
|
|
628
|
-
|
|
688
|
+
// 7.LISTENERS //
|
|
689
|
+
// 8.PUBLIC METHODS API //
|
|
690
|
+
async reRender() {
|
|
691
|
+
this.defineLineHeight();
|
|
692
|
+
}
|
|
693
|
+
evaluateCheckboxStatus() {
|
|
629
694
|
const allChildren = this.el.querySelectorAll("gxg-tree-item");
|
|
695
|
+
let checked = 0;
|
|
630
696
|
if (allChildren === null || allChildren === void 0 ? void 0 : allChildren.length) {
|
|
631
697
|
Array.from(allChildren).forEach((item) => {
|
|
632
|
-
item.
|
|
633
|
-
|
|
698
|
+
if (item.checked) {
|
|
699
|
+
checked++;
|
|
700
|
+
}
|
|
634
701
|
});
|
|
702
|
+
if (allChildren.length === checked) {
|
|
703
|
+
//all checked
|
|
704
|
+
this.checked = true;
|
|
705
|
+
this.indeterminate = false;
|
|
706
|
+
}
|
|
707
|
+
else if (checked === 0) {
|
|
708
|
+
//all unchecked
|
|
709
|
+
this.checked = false;
|
|
710
|
+
this.indeterminate = false;
|
|
711
|
+
}
|
|
712
|
+
else {
|
|
713
|
+
//indeterminate
|
|
714
|
+
this.indeterminate = true;
|
|
715
|
+
}
|
|
635
716
|
}
|
|
636
717
|
}
|
|
718
|
+
// 10.RENDER() FUNCTION //
|
|
637
719
|
render() {
|
|
638
720
|
return (h(Host, { class: { leaf: this.leaf, "not-leaf": !this.leaf }, exportParts: this.exportparts ? this.exportparts : null }, h("li", { class: {
|
|
639
721
|
"tree-open": this.opened,
|
|
@@ -665,6 +747,10 @@ const GxgTreeItem = class {
|
|
|
665
747
|
}
|
|
666
748
|
static get assetsDirs() { return ["tree-item-assets"]; }
|
|
667
749
|
get el() { return getElement(this); }
|
|
750
|
+
static get watchers() { return {
|
|
751
|
+
"checked": ["checkedHandler"],
|
|
752
|
+
"opened": ["openedHandler"]
|
|
753
|
+
}; }
|
|
668
754
|
};
|
|
669
755
|
GxgTreeItem.style = gxgTreeItemCss;
|
|
670
756
|
|