@genexus/genexus-ide-ui 0.0.15 → 0.0.17
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-directory-selector.cjs.entry.js +0 -1
- package/dist/cjs/gx-ide-entity-selector.cjs.entry.js +12 -2
- package/dist/cjs/gx-ide-new-kb.cjs.entry.js +16 -17
- package/dist/cjs/gx-ide-template.cjs.entry.js +2 -2
- package/dist/cjs/gx-ide-top-bar.cjs.entry.js +37 -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 +386 -281
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/_template/template.js +9 -10
- package/dist/collection/components/directory-selector/directory-selector.js +0 -1
- package/dist/collection/components/entity-selector/entity-selector.js +39 -2
- package/dist/collection/components/new-kb/new-kb.js +16 -35
- 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-directory-selector.js +0 -1
- package/dist/components/gx-ide-entity-selector.js +13 -3
- package/dist/components/gx-ide-new-kb.js +20 -28
- package/dist/components/gx-ide-template.js +7 -13
- package/dist/components/gxg-menu.js +2 -2
- package/dist/components/gxg-test.js +4 -23
- package/dist/components/gxg-tree-item2.js +344 -277
- package/dist/components/gxg-tree2.js +47 -8
- 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-directory-selector.entry.js +0 -1
- package/dist/esm/gx-ide-entity-selector.entry.js +13 -3
- package/dist/esm/gx-ide-new-kb.entry.js +16 -17
- package/dist/esm/gx-ide-template.entry.js +2 -2
- package/dist/esm/gx-ide-top-bar.entry.js +33 -0
- 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 +387 -282
- 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/p-1042318d.entry.js +1 -0
- package/dist/genexus-ide-ui/p-1d4cf2ae.entry.js +1 -0
- package/dist/genexus-ide-ui/p-48482e25.entry.js +1 -0
- package/dist/genexus-ide-ui/p-49433b58.entry.js +1 -0
- package/dist/genexus-ide-ui/p-79cf24a3.entry.js +1 -0
- package/dist/genexus-ide-ui/p-b196d91d.entry.js +1 -0
- package/dist/genexus-ide-ui/p-c5c6e102.entry.js +1 -0
- package/dist/genexus-ide-ui/p-cd503583.entry.js +1 -0
- package/dist/genexus-ide-ui/p-e4ee28c7.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/components/_template/template.d.ts +2 -2
- package/dist/types/components/entity-selector/entity-selector.d.ts +10 -0
- package/dist/types/components/new-kb/new-kb.d.ts +0 -4
- package/dist/types/components.d.ts +12 -12
- package/package.json +3 -3
- package/dist/genexus-ide-ui/p-0f5d0ccc.entry.js +0 -1
- package/dist/genexus-ide-ui/p-18936375.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-eb8e9655.entry.js +0 -1
- package/dist/genexus-ide-ui/p-f58b607d.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,12 +71,19 @@ 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 //
|
|
66
87
|
selectionChangedHandler(e) {
|
|
67
88
|
//Unselect all items, except the one that triggered this event. This action should be done once, by the master tree.
|
|
68
89
|
if ((this.masterTree && !this.multiSelection) ||
|
|
@@ -74,7 +95,24 @@ const GxgTree = class {
|
|
|
74
95
|
});
|
|
75
96
|
}
|
|
76
97
|
}
|
|
98
|
+
const itemData = e.detail;
|
|
99
|
+
if (this.masterTree) {
|
|
100
|
+
this.emitTreeItemNewState(itemData, "selectionChanged");
|
|
101
|
+
}
|
|
77
102
|
}
|
|
103
|
+
checkboxToggledHandler(e) {
|
|
104
|
+
const itemData = e.detail;
|
|
105
|
+
if (this.masterTree) {
|
|
106
|
+
this.emitTreeItemNewState(itemData, "checkboxToggled");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
toggleIconClickedHandler(e) {
|
|
110
|
+
const itemData = e.detail;
|
|
111
|
+
if (this.masterTree) {
|
|
112
|
+
this.emitTreeItemNewState(itemData, "toggleIconClicked");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// 8.PUBLIC METHODS API //
|
|
78
116
|
/**
|
|
79
117
|
* Returns an array of the selected tree-items, providing the id, checked status, selected status, and label.
|
|
80
118
|
*/
|
|
@@ -158,6 +196,7 @@ const GxgTree = class {
|
|
|
158
196
|
});
|
|
159
197
|
return toggledTreeItems;
|
|
160
198
|
}
|
|
199
|
+
// 10.RENDER() FUNCTION //
|
|
161
200
|
render() {
|
|
162
201
|
return (h(Host, null, h("div", { class: {
|
|
163
202
|
tree: true,
|
|
@@ -167,7 +206,7 @@ const GxgTree = class {
|
|
|
167
206
|
};
|
|
168
207
|
GxgTree.style = gxgTreeCss;
|
|
169
208
|
|
|
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}";
|
|
209
|
+
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
210
|
|
|
172
211
|
const GxgTreeItem = class {
|
|
173
212
|
constructor(hostRef) {
|
|
@@ -176,12 +215,29 @@ const GxgTreeItem = class {
|
|
|
176
215
|
this.selectionChanged = createEvent(this, "selectionChanged", 7);
|
|
177
216
|
this.doubleClicked = createEvent(this, "doubleClicked", 7);
|
|
178
217
|
this.checkboxToggled = createEvent(this, "checkboxToggled", 7);
|
|
218
|
+
this.lazyChanged = createEvent(this, "lazyChanged", 7);
|
|
219
|
+
this.lazy = false; //True if not leaf but no children.
|
|
220
|
+
this.parentTreeIsMasterTree = false;
|
|
221
|
+
this.numberOfParentTrees = 1;
|
|
222
|
+
this.firstItem = false;
|
|
223
|
+
this.lastItem = false;
|
|
224
|
+
this.leftPadding = "0px";
|
|
225
|
+
this.verticalLineStartPosition = "0px";
|
|
226
|
+
this.horizontalLineWidth = "24px";
|
|
227
|
+
this.horizontalLineStartPosition = "0px";
|
|
179
228
|
this.parts = {
|
|
180
229
|
item: "item",
|
|
181
230
|
checkbox: "checkbox",
|
|
182
231
|
toggleButton: "toggle-button",
|
|
183
232
|
};
|
|
184
|
-
//
|
|
233
|
+
// 3.STATE() VARIABLES //
|
|
234
|
+
this.horizontalLinePaddingLeft = 0;
|
|
235
|
+
this.lastTreeItem = false;
|
|
236
|
+
this.lastTreeItemOfParentTree = false;
|
|
237
|
+
this.numberOfVisibleDescendantItems = 0;
|
|
238
|
+
this.time = 0;
|
|
239
|
+
this.downloading = false;
|
|
240
|
+
// 4.PUBLIC PROPERTY API | WATCH'S //
|
|
185
241
|
/**
|
|
186
242
|
* 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
243
|
*/
|
|
@@ -214,24 +270,15 @@ const GxgTreeItem = class {
|
|
|
214
270
|
* This property is for internal use, when using the treeModel.
|
|
215
271
|
*/
|
|
216
272
|
this.numberOfChildren = 0;
|
|
273
|
+
/**
|
|
274
|
+
* This property is for internal use. It indicates that the item has children.
|
|
275
|
+
*/
|
|
217
276
|
this.hasChildTree = false;
|
|
277
|
+
/**
|
|
278
|
+
* This property is for internal use. It indicates that the checkbox has an indeterminate state.
|
|
279
|
+
*/
|
|
218
280
|
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";
|
|
281
|
+
// 9.LOCAL METHODS //
|
|
235
282
|
this.evaluateId = () => {
|
|
236
283
|
if (!this.id) {
|
|
237
284
|
this.id = this.el.getAttribute("id");
|
|
@@ -255,31 +302,6 @@ const GxgTreeItem = class {
|
|
|
255
302
|
this.initiateMutationObserver = () => {
|
|
256
303
|
this.observer.observe(this.el, { childList: true, subtree: true });
|
|
257
304
|
};
|
|
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
305
|
/**
|
|
284
306
|
* @description Set some properties based on the parent tree configuration, unless this item has this properties already set.
|
|
285
307
|
*/
|
|
@@ -344,296 +366,375 @@ const GxgTreeItem = class {
|
|
|
344
366
|
this.leftPadding = `${value}px`;
|
|
345
367
|
this.horizontalLineStartPosition = `${horizontalLineStartPosition}px`;
|
|
346
368
|
};
|
|
347
|
-
this.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
this.
|
|
354
|
-
id: this.
|
|
355
|
-
label: this.
|
|
369
|
+
this.liTextClickedHandler = (e) => {
|
|
370
|
+
const toggleWasClicked = e.target.classList.contains("toggle-icon");
|
|
371
|
+
const checkboxClicked = e.target.nodeName === "GXG-FORM-CHECKBOX";
|
|
372
|
+
if (toggleWasClicked || checkboxClicked)
|
|
373
|
+
return;
|
|
374
|
+
if (e.ctrlKey || !this.selected) {
|
|
375
|
+
this.selectionChanged.emit({
|
|
376
|
+
id: this.id,
|
|
377
|
+
label: this.label,
|
|
356
378
|
checked: this.checked,
|
|
357
|
-
selected: this.selected,
|
|
379
|
+
selected: !this.selected,
|
|
380
|
+
ctrlKey: e.ctrlKey,
|
|
358
381
|
});
|
|
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
|
+
if (e.ctrlKey) {
|
|
384
|
+
this.selected = !this.selected;
|
|
380
385
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
this.
|
|
386
|
-
|
|
387
|
-
this.defineLineHeight();
|
|
388
|
-
this.defineStartPosition();
|
|
389
|
-
this.cascadeConfig();
|
|
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({
|
|
386
|
+
else if (!this.selected) {
|
|
387
|
+
this.selected = true;
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
this.liTextDoubleClicked = () => {
|
|
391
|
+
this.doubleClicked.emit({
|
|
428
392
|
id: this.id,
|
|
429
|
-
label: this.label,
|
|
430
|
-
checked: this.checked,
|
|
431
|
-
selected: !this.selected,
|
|
432
|
-
ctrlKey: e.ctrlKey,
|
|
433
393
|
});
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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;
|
|
394
|
+
!this.leaf && this.toggleClickedHandler();
|
|
395
|
+
};
|
|
396
|
+
this.liTextKeyDownPressed = (e) => {
|
|
397
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
398
|
+
e.preventDefault(); //prevents scrolling
|
|
462
399
|
}
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
childTreeFirstChildrenLiText.focus();
|
|
400
|
+
//ENTER
|
|
401
|
+
if (e.key === "Enter") {
|
|
402
|
+
//Enter should check/uncheck the checkbox (if present)
|
|
403
|
+
this.checkboxClickedHandler();
|
|
468
404
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
if (hasParent) {
|
|
481
|
-
parentGxgTreeItemLiText.focus();
|
|
405
|
+
//LEFT/RIGHT NAVIGATION
|
|
406
|
+
if (e.key === "ArrowRight" && !this.leaf) {
|
|
407
|
+
//Toggle the tree
|
|
408
|
+
if (!this.opened) {
|
|
409
|
+
this.opened = true;
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
const childTree = this.el.querySelector("gxg-tree");
|
|
413
|
+
const childTreeFirstChildren = childTree.querySelector("gxg-tree-item");
|
|
414
|
+
const childTreeFirstChildrenLiText = childTreeFirstChildren.shadowRoot.querySelector(".li-text");
|
|
415
|
+
childTreeFirstChildrenLiText.focus();
|
|
482
416
|
}
|
|
483
417
|
}
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
418
|
+
if (e.key === "ArrowLeft") {
|
|
419
|
+
let hasParent = false;
|
|
420
|
+
const parentGxgTreeItem = this.el.parentElement.parentElement;
|
|
421
|
+
let parentGxgTreeItemLiText = null;
|
|
422
|
+
if (parentGxgTreeItem.tagName === "GXG-TREE-ITEM") {
|
|
423
|
+
hasParent = true;
|
|
424
|
+
parentGxgTreeItemLiText = parentGxgTreeItem.shadowRoot.querySelector(".li-text");
|
|
488
425
|
}
|
|
489
|
-
|
|
426
|
+
if (this.leaf) {
|
|
490
427
|
if (hasParent) {
|
|
491
428
|
parentGxgTreeItemLiText.focus();
|
|
492
429
|
}
|
|
493
430
|
}
|
|
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
431
|
else {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
prevItem = parentParentItem.shadowRoot.querySelector("li .li-text");
|
|
432
|
+
const li = this.el.shadowRoot.querySelector("li");
|
|
433
|
+
if (li.classList.contains("tree-open")) {
|
|
434
|
+
this.opened = false;
|
|
516
435
|
}
|
|
517
436
|
else {
|
|
518
|
-
|
|
437
|
+
if (hasParent) {
|
|
438
|
+
parentGxgTreeItemLiText.focus();
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
// UP/DOWN NAVIGATION
|
|
444
|
+
if (e.key === "ArrowUp" || (e.key === "Tab" && e.shiftKey)) {
|
|
445
|
+
e.preventDefault();
|
|
446
|
+
if (!this.firstItem) {
|
|
447
|
+
//Is not the first element of the parent
|
|
448
|
+
//Set focus on the prev item
|
|
449
|
+
let prevItem;
|
|
450
|
+
const prevElementSibling = this.el.previousElementSibling;
|
|
451
|
+
if (e.shiftKey && e.key !== "Tab") {
|
|
452
|
+
//if shift key was pressed, navigate to the previous sibling
|
|
519
453
|
if (prevElementSibling !== null) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
454
|
+
prevItem = prevElementSibling.shadowRoot.querySelector("li .li-text");
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
if (prevElementSibling === null) {
|
|
459
|
+
const parentItem = this.el.parentElement;
|
|
460
|
+
const parentParentItem = parentItem.parentElement;
|
|
461
|
+
prevItem = parentParentItem.shadowRoot.querySelector("li .li-text");
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
prevItem = prevElementSibling.shadowRoot.querySelector("li .li-text");
|
|
465
|
+
if (prevElementSibling !== null) {
|
|
466
|
+
//If the preceding tree-item has tree inside...
|
|
467
|
+
const prevElementSiblingHasChildTree = prevElementSibling
|
|
468
|
+
.hasChildTree;
|
|
469
|
+
if (prevElementSiblingHasChildTree) {
|
|
470
|
+
const prevElementSiblingHasOpenTree = prevElementSibling
|
|
471
|
+
.opened;
|
|
472
|
+
if (prevElementSiblingHasOpenTree) {
|
|
473
|
+
//If preceding tree-item tree is opened, then the prev item is the last item of that tree
|
|
474
|
+
const prevElemSiblingTreeItem = this.el
|
|
475
|
+
.previousElementSibling;
|
|
476
|
+
const prevElemSiblingTreeItemTree = prevElemSiblingTreeItem.querySelector("gxg-tree");
|
|
477
|
+
//
|
|
478
|
+
if (prevElemSiblingTreeItemTree.lastElementChild
|
|
479
|
+
.hasChildTree) {
|
|
480
|
+
if (prevElemSiblingTreeItemTree.lastElementChild.shadowRoot
|
|
481
|
+
.querySelector("li")
|
|
482
|
+
.classList.contains("tree-open")) {
|
|
483
|
+
prevItem = prevElemSiblingTreeItemTree.lastElementChild
|
|
484
|
+
.querySelector("gxg-tree")
|
|
485
|
+
.lastElementChild.shadowRoot.querySelector("li .li-text");
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
prevItem = prevElemSiblingTreeItemTree.lastElementChild.shadowRoot.querySelector("li .li-text");
|
|
489
|
+
}
|
|
540
490
|
}
|
|
541
491
|
else {
|
|
542
492
|
prevItem = prevElemSiblingTreeItemTree.lastElementChild.shadowRoot.querySelector("li .li-text");
|
|
543
493
|
}
|
|
494
|
+
//
|
|
544
495
|
}
|
|
545
496
|
else {
|
|
546
|
-
|
|
497
|
+
//The preciding item has a tree, but it is closed
|
|
498
|
+
prevItem = this.el.previousElementSibling.shadowRoot.querySelector("li .li-text");
|
|
547
499
|
}
|
|
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
500
|
}
|
|
554
501
|
}
|
|
555
502
|
}
|
|
556
503
|
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
504
|
+
if (prevItem !== null && prevItem !== undefined) {
|
|
505
|
+
prevItem.focus();
|
|
506
|
+
}
|
|
560
507
|
}
|
|
561
508
|
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
509
|
+
if (e.key === "ArrowDown" || (e.key === "Tab" && !e.shiftKey)) {
|
|
510
|
+
e.preventDefault();
|
|
511
|
+
if (!this.lastTreeItemOfParentTree) {
|
|
512
|
+
//Set focus on the next item
|
|
513
|
+
let nextItem;
|
|
514
|
+
if (e.shiftKey) {
|
|
515
|
+
//if shift key was pressed, navigate to the next sibling
|
|
516
|
+
if (this.el.nextElementSibling !== null) {
|
|
517
|
+
nextItem = this.el.nextElementSibling.shadowRoot.querySelector("li .li-text");
|
|
518
|
+
}
|
|
572
519
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
520
|
+
else {
|
|
521
|
+
if (this.lastTreeItem) {
|
|
522
|
+
if (this.hasChildTree && this.opened) {
|
|
523
|
+
nextItem = this.el.firstElementChild.firstElementChild.shadowRoot.querySelector(".li-text");
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
const thisTree = this.el.parentElement;
|
|
527
|
+
const thisTreeParent = thisTree.parentElement;
|
|
528
|
+
const thisTreeParentNextTree = thisTreeParent.nextElementSibling;
|
|
529
|
+
if (thisTreeParentNextTree === null) {
|
|
530
|
+
if (thisTreeParent.parentElement.parentElement
|
|
531
|
+
.nextElementSibling !== null) {
|
|
532
|
+
nextItem = thisTreeParent.parentElement.parentElement.nextElementSibling.shadowRoot.querySelector(".li-text");
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
nextItem = thisTreeParentNextTree.shadowRoot.querySelector(".li-text");
|
|
537
|
+
}
|
|
538
|
+
}
|
|
578
539
|
}
|
|
579
540
|
else {
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if (thisTreeParent.parentElement.parentElement
|
|
585
|
-
.nextElementSibling !== null) {
|
|
586
|
-
nextItem = thisTreeParent.parentElement.parentElement.nextElementSibling.shadowRoot.querySelector(".li-text");
|
|
587
|
-
}
|
|
541
|
+
if (this.hasChildTree && this.opened) {
|
|
542
|
+
nextItem = this.el
|
|
543
|
+
.querySelector("gxg-tree gxg-tree-item")
|
|
544
|
+
.shadowRoot.querySelector("li .li-text");
|
|
588
545
|
}
|
|
589
546
|
else {
|
|
590
|
-
nextItem =
|
|
547
|
+
nextItem = this.el.nextElementSibling.shadowRoot.querySelector(".li-text");
|
|
591
548
|
}
|
|
592
549
|
}
|
|
593
550
|
}
|
|
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
|
-
}
|
|
551
|
+
if (nextItem !== null && nextItem !== undefined) {
|
|
552
|
+
nextItem.focus();
|
|
603
553
|
}
|
|
604
554
|
}
|
|
605
|
-
|
|
606
|
-
|
|
555
|
+
else {
|
|
556
|
+
//Last element of parent tree
|
|
557
|
+
if (!this.leaf && this.opened) {
|
|
558
|
+
const childTreeFirstTreeItem = this.el.firstElementChild.firstElementChild.shadowRoot.querySelector("li .li-text");
|
|
559
|
+
childTreeFirstTreeItem.focus();
|
|
560
|
+
}
|
|
607
561
|
}
|
|
608
562
|
}
|
|
563
|
+
};
|
|
564
|
+
this.returnToggleIconType = () => {
|
|
565
|
+
//Returns the type of icon : expand or collapse
|
|
566
|
+
if (!this.opened || this.lazy) {
|
|
567
|
+
return "gemini-tools/add";
|
|
568
|
+
}
|
|
609
569
|
else {
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
570
|
+
return "gemini-tools/minus";
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
/**
|
|
574
|
+
* When a checkbox is clicked, it state changes and so it's children, and parent items do.
|
|
575
|
+
* First evaluate the children, and then the parent items.
|
|
576
|
+
*/
|
|
577
|
+
this.checkboxClickedHandler = () => {
|
|
578
|
+
if (this.checkbox) {
|
|
579
|
+
this.checked = !this.checked;
|
|
580
|
+
if (!this.leaf) {
|
|
581
|
+
this.toggleChildrenCheckboxes(this.checked);
|
|
614
582
|
}
|
|
583
|
+
const parentItems = this.getParentItems();
|
|
584
|
+
parentItems.forEach((parentItem) => {
|
|
585
|
+
parentItem.evaluateCheckboxStatus();
|
|
586
|
+
});
|
|
615
587
|
}
|
|
588
|
+
};
|
|
589
|
+
this.toggleChildrenCheckboxes = (checked) => {
|
|
590
|
+
this.indeterminate = false;
|
|
591
|
+
const allChildren = this.el.querySelectorAll("gxg-tree-item");
|
|
592
|
+
if (allChildren === null || allChildren === void 0 ? void 0 : allChildren.length) {
|
|
593
|
+
Array.from(allChildren).forEach((item) => {
|
|
594
|
+
item.indeterminate = false;
|
|
595
|
+
item.checked = checked;
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
this.getParentItems = () => {
|
|
600
|
+
var _a;
|
|
601
|
+
const parentItems = [];
|
|
602
|
+
let parentItem = this.el.parentElement.parentElement;
|
|
603
|
+
while ((parentItem === null || parentItem === void 0 ? void 0 : parentItem.nodeName) === "GXG-TREE-ITEM") {
|
|
604
|
+
parentItems.push(parentItem);
|
|
605
|
+
parentItem = (_a = parentItem.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
606
|
+
}
|
|
607
|
+
return parentItems;
|
|
608
|
+
};
|
|
609
|
+
this.getParentsNumber = () => {
|
|
610
|
+
var _a;
|
|
611
|
+
let count = 0;
|
|
612
|
+
let parentElement = this.el.parentElement;
|
|
613
|
+
while ((parentElement === null || parentElement === void 0 ? void 0 : parentElement.nodeName) === "GXG-TREE") {
|
|
614
|
+
count++;
|
|
615
|
+
parentElement = (_a = parentElement.parentElement) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
616
|
+
}
|
|
617
|
+
return count;
|
|
618
|
+
};
|
|
619
|
+
this.getChildrenNumber = () => {
|
|
620
|
+
if (this.numberOfChildren === 0) {
|
|
621
|
+
//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.
|
|
622
|
+
return this.el.querySelectorAll("gxg-tree-item").length;
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
this.toggleClickedHandler = () => {
|
|
626
|
+
if (this.lazy && !this.opened) {
|
|
627
|
+
this.downloading = true;
|
|
628
|
+
this.toggleIconClicked.emit({
|
|
629
|
+
checked: this.checked,
|
|
630
|
+
description: this.description,
|
|
631
|
+
icon: this.icon,
|
|
632
|
+
id: this.id,
|
|
633
|
+
indeterminate: this.indeterminate,
|
|
634
|
+
label: this.label,
|
|
635
|
+
lazy: this.lazy,
|
|
636
|
+
leaf: this.leaf,
|
|
637
|
+
opened: this.opened,
|
|
638
|
+
selected: this.selected,
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
if (!this.lazy) {
|
|
642
|
+
this.opened = !this.opened;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
checkedHandler(newValue, oldValue) {
|
|
647
|
+
if (oldValue !== undefined) {
|
|
648
|
+
this.checkboxToggled.emit({
|
|
649
|
+
checked: newValue,
|
|
650
|
+
description: this.description,
|
|
651
|
+
icon: this.icon,
|
|
652
|
+
id: this.id,
|
|
653
|
+
indeterminate: this.indeterminate,
|
|
654
|
+
label: this.label,
|
|
655
|
+
lazy: this.lazy,
|
|
656
|
+
leaf: this.leaf,
|
|
657
|
+
opened: this.opened,
|
|
658
|
+
selected: this.selected,
|
|
659
|
+
});
|
|
616
660
|
}
|
|
617
661
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
662
|
+
openedHandler(newValue, oldValue) {
|
|
663
|
+
if (oldValue !== undefined) {
|
|
664
|
+
this.toggleIconClicked.emit({
|
|
665
|
+
checked: this.checked,
|
|
666
|
+
description: this.description,
|
|
667
|
+
icon: this.icon,
|
|
668
|
+
id: this.id,
|
|
669
|
+
indeterminate: this.indeterminate,
|
|
670
|
+
label: this.label,
|
|
671
|
+
lazy: this.lazy,
|
|
672
|
+
leaf: this.leaf,
|
|
673
|
+
opened: newValue,
|
|
674
|
+
selected: this.selected,
|
|
675
|
+
});
|
|
622
676
|
}
|
|
623
|
-
|
|
624
|
-
|
|
677
|
+
}
|
|
678
|
+
// 6.COMPONENT LIFECYCLE METHODS //
|
|
679
|
+
componentWillLoad() {
|
|
680
|
+
//Count number of parent trees in order to set the appropriate padding-left
|
|
681
|
+
this.numberOfParentTrees = this.getParentsNumber();
|
|
682
|
+
this.numberOfChildren = this.getChildrenNumber();
|
|
683
|
+
//If is last item of tree
|
|
684
|
+
const nextItem = this.el.nextElementSibling;
|
|
685
|
+
if (nextItem === null) {
|
|
686
|
+
this.lastTreeItem = true;
|
|
625
687
|
}
|
|
688
|
+
if (this.numberOfParentTrees === 1) {
|
|
689
|
+
this.parentTreeIsMasterTree = true;
|
|
690
|
+
const prevItem = this.el.previousElementSibling;
|
|
691
|
+
if (prevItem === null) {
|
|
692
|
+
//If is first item of parent tree...
|
|
693
|
+
this.firstItem = true;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
if (!this.el.nextElementSibling) {
|
|
697
|
+
this.lastItem = true;
|
|
698
|
+
}
|
|
699
|
+
this.evaluateId();
|
|
700
|
+
this.evaluateLazy();
|
|
701
|
+
this.defineLineHeight();
|
|
702
|
+
this.defineStartPosition();
|
|
703
|
+
this.cascadeConfig();
|
|
704
|
+
this.attachExportParts();
|
|
705
|
+
this.initiateMutationObserver();
|
|
626
706
|
}
|
|
627
|
-
|
|
628
|
-
|
|
707
|
+
// 7.LISTENERS //
|
|
708
|
+
// 8.PUBLIC METHODS API //
|
|
709
|
+
async reRender() {
|
|
710
|
+
this.defineLineHeight();
|
|
711
|
+
}
|
|
712
|
+
evaluateCheckboxStatus() {
|
|
629
713
|
const allChildren = this.el.querySelectorAll("gxg-tree-item");
|
|
714
|
+
let checked = 0;
|
|
630
715
|
if (allChildren === null || allChildren === void 0 ? void 0 : allChildren.length) {
|
|
631
716
|
Array.from(allChildren).forEach((item) => {
|
|
632
|
-
item.
|
|
633
|
-
|
|
717
|
+
if (item.checked) {
|
|
718
|
+
checked++;
|
|
719
|
+
}
|
|
634
720
|
});
|
|
721
|
+
if (allChildren.length === checked) {
|
|
722
|
+
//all checked
|
|
723
|
+
this.checked = true;
|
|
724
|
+
this.indeterminate = false;
|
|
725
|
+
}
|
|
726
|
+
else if (checked === 0) {
|
|
727
|
+
//all unchecked
|
|
728
|
+
this.checked = false;
|
|
729
|
+
this.indeterminate = false;
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
//indeterminate
|
|
733
|
+
this.indeterminate = true;
|
|
734
|
+
}
|
|
635
735
|
}
|
|
636
736
|
}
|
|
737
|
+
// 10.RENDER() FUNCTION //
|
|
637
738
|
render() {
|
|
638
739
|
return (h(Host, { class: { leaf: this.leaf, "not-leaf": !this.leaf }, exportParts: this.exportparts ? this.exportparts : null }, h("li", { class: {
|
|
639
740
|
"tree-open": this.opened,
|
|
@@ -665,6 +766,10 @@ const GxgTreeItem = class {
|
|
|
665
766
|
}
|
|
666
767
|
static get assetsDirs() { return ["tree-item-assets"]; }
|
|
667
768
|
get el() { return getElement(this); }
|
|
769
|
+
static get watchers() { return {
|
|
770
|
+
"checked": ["checkedHandler"],
|
|
771
|
+
"opened": ["openedHandler"]
|
|
772
|
+
}; }
|
|
668
773
|
};
|
|
669
774
|
GxgTreeItem.style = gxgTreeItemCss;
|
|
670
775
|
|