@genexus/genexus-ide-ui 0.0.60 → 0.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ch-checkbox.cjs.entry.js +93 -0
- package/dist/cjs/{ch-checkbox_3.cjs.entry.js → ch-tree-x_3.cjs.entry.js} +475 -87
- package/dist/cjs/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-container.cjs.entry.js +13 -5
- package/dist/cjs/gx-ide-file-selector.cjs.entry.js +47 -0
- package/dist/cjs/gx-ide-kb-manager-export.cjs.entry.js +11 -9
- package/dist/cjs/gx-ide-kb-manager-import.cjs.entry.js +343 -0
- package/dist/cjs/gx-ide-list-selector_2.cjs.entry.js +236 -0
- package/dist/cjs/gx-ide-new-kb.cjs.entry.js +8 -9
- package/dist/cjs/gx-ide-object-selector.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-references.cjs.entry.js +2 -2
- package/dist/cjs/gx-ide-status-buttons_2.cjs.entry.js +148 -0
- package/dist/cjs/gx-ide-team-dev-commit.cjs.entry.js +2 -2
- package/dist/cjs/gx-ide-team-dev-update.cjs.entry.js +2 -2
- package/dist/cjs/gx-ide-template.cjs.entry.js +1 -1
- package/dist/cjs/gx-ide-ww-images.cjs.entry.js +1 -1
- package/dist/cjs/{helpers-9523495a.js → helpers-b62ea39c.js} +12 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +4 -1
- package/dist/collection/common/helpers.js +11 -0
- package/dist/collection/components/_template/template.js +1 -1
- package/dist/collection/components/container/container.css +24 -16
- package/dist/collection/components/container/container.js +66 -22
- package/dist/collection/components/file-selector/file-selector.css +366 -0
- package/dist/collection/components/file-selector/file-selector.js +185 -0
- package/dist/collection/components/kb-manager-export/gx-ide-assets/kb-manager-export/langs/kb-manager-export.lang.en.json +1 -0
- package/dist/collection/components/kb-manager-export/helpers.js +0 -1
- package/dist/collection/components/kb-manager-export/kb-manager-export.css +5 -2
- package/dist/collection/components/kb-manager-export/kb-manager-export.js +12 -9
- package/dist/collection/components/kb-manager-import/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.en.json +31 -0
- package/dist/collection/components/kb-manager-import/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.ja.json +3 -0
- package/dist/collection/components/kb-manager-import/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.zh.json +3 -0
- package/dist/collection/components/kb-manager-import/helpers.js +128 -0
- package/dist/collection/components/kb-manager-import/kb-manager-import.css +233 -0
- package/dist/collection/components/kb-manager-import/kb-manager-import.js +415 -0
- package/dist/collection/components/list-selector/list-selector-item/list-selector-item.css +51 -14
- package/dist/collection/components/list-selector/list-selector-item/list-selector-item.js +160 -24
- package/dist/collection/components/list-selector/list-selector.css +6 -0
- package/dist/collection/components/list-selector/list-selector.js +234 -33
- package/dist/collection/components/new-kb/new-kb.css +13 -0
- package/dist/collection/components/new-kb/new-kb.js +7 -8
- package/dist/collection/components/references/references.js +2 -2
- package/dist/collection/components/status-buttons/gx-ide-status-buttons.css +93 -0
- package/dist/collection/components/status-buttons/gx-ide-status-buttons.js +325 -0
- package/dist/collection/components/team-dev-commit/team-dev-commit.js +1 -1
- package/dist/collection/components/team-dev-update/team-dev-update.js +1 -1
- package/dist/components/container.js +16 -6
- package/dist/components/form-text.js +1 -1
- package/dist/components/gx-ide-file-selector.d.ts +11 -0
- package/dist/components/gx-ide-file-selector.js +105 -0
- package/dist/components/gx-ide-kb-manager-export.js +13 -11
- package/dist/components/gx-ide-kb-manager-import.d.ts +11 -0
- package/dist/components/gx-ide-kb-manager-import.js +499 -0
- package/dist/components/gx-ide-list-selector-item.js +1 -102
- package/dist/components/gx-ide-list-selector.js +1 -73
- package/dist/components/gx-ide-new-kb.js +8 -9
- package/dist/components/gx-ide-references.js +2 -2
- package/dist/components/gx-ide-status-buttons.d.ts +11 -0
- package/dist/components/gx-ide-status-buttons.js +6 -0
- package/dist/components/gx-ide-status-buttons2.js +131 -0
- package/dist/components/gx-ide-team-dev-commit.js +1 -1
- package/dist/components/gx-ide-team-dev-update.js +1 -1
- package/dist/components/gx-ide-template.js +1 -1
- package/dist/components/gxg-ide-loader.js +1 -111
- package/dist/components/helpers2.js +12 -1
- package/dist/{esm/gxg-ide-loader.entry.js → components/ide-loader.js} +46 -7
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/components/list-selector-item.js +158 -0
- package/dist/components/list-selector.js +146 -0
- package/dist/esm/ch-checkbox.entry.js +89 -0
- package/dist/esm/{ch-checkbox_3.entry.js → ch-tree-x_3.entry.js} +476 -88
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-container.entry.js +13 -5
- package/dist/esm/gx-ide-file-selector.entry.js +43 -0
- package/dist/esm/gx-ide-kb-manager-export.entry.js +11 -9
- package/dist/esm/gx-ide-kb-manager-import.entry.js +339 -0
- package/dist/esm/gx-ide-list-selector_2.entry.js +231 -0
- package/dist/esm/gx-ide-new-kb.entry.js +8 -9
- package/dist/esm/gx-ide-object-selector.entry.js +1 -1
- package/dist/esm/gx-ide-references.entry.js +2 -2
- package/dist/esm/gx-ide-status-buttons_2.entry.js +143 -0
- package/dist/esm/gx-ide-team-dev-commit.entry.js +2 -2
- package/dist/esm/gx-ide-team-dev-update.entry.js +2 -2
- package/dist/esm/gx-ide-template.entry.js +1 -1
- package/dist/esm/gx-ide-ww-images.entry.js +1 -1
- package/dist/esm/{helpers-b99024f5.js → helpers-c29a9591.js} +12 -1
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/kb-manager-export/langs/kb-manager-export.lang.en.json +1 -0
- package/dist/genexus-ide-ui/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.en.json +31 -0
- package/dist/genexus-ide-ui/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.ja.json +3 -0
- package/dist/genexus-ide-ui/gx-ide-assets/kb-manager-import/langs/kb-manager-import.lang.zh.json +3 -0
- package/dist/genexus-ide-ui/p-163a93a4.entry.js +1 -0
- package/dist/genexus-ide-ui/p-1ff3cf87.entry.js +1 -0
- package/dist/genexus-ide-ui/p-2142874f.entry.js +1 -0
- package/dist/genexus-ide-ui/p-2b7d4cca.entry.js +1 -0
- package/dist/genexus-ide-ui/p-481312bc.entry.js +1 -0
- package/dist/genexus-ide-ui/p-8738b63b.entry.js +1 -0
- package/dist/genexus-ide-ui/p-9e530c7d.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-c63d5b08.js → p-9ee8b615.js} +1 -1
- package/dist/genexus-ide-ui/{p-cef1a182.entry.js → p-a3171fdf.entry.js} +1 -1
- package/dist/genexus-ide-ui/p-ac3b8e90.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-750c726a.entry.js → p-b2ea372b.entry.js} +1 -1
- package/dist/genexus-ide-ui/p-b685ffba.entry.js +1 -0
- package/dist/genexus-ide-ui/p-c7e11c6b.entry.js +1 -0
- package/dist/genexus-ide-ui/p-d04d634e.entry.js +1 -0
- package/dist/genexus-ide-ui/{p-462a8f83.entry.js → p-d8096d40.entry.js} +1 -1
- package/dist/genexus-ide-ui/p-f83093aa.entry.js +1 -0
- package/dist/types/common/helpers.d.ts +2 -0
- package/dist/types/common/types.d.ts +16 -0
- package/dist/types/components/container/container.d.ts +12 -4
- package/dist/types/components/file-selector/file-selector.d.ts +38 -0
- package/dist/types/components/kb-manager-export/kb-manager-export.d.ts +3 -2
- package/dist/types/components/kb-manager-import/helpers.d.ts +10 -0
- package/dist/types/components/kb-manager-import/kb-manager-import.d.ts +110 -0
- package/dist/types/components/list-selector/list-selector-item/list-selector-item.d.ts +38 -7
- package/dist/types/components/list-selector/list-selector.d.ts +47 -8
- package/dist/types/components/status-buttons/gx-ide-status-buttons.d.ts +63 -0
- package/dist/types/components.d.ts +410 -28
- package/package.json +3 -3
- package/dist/cjs/gx-ide-list-selector-item.cjs.entry.js +0 -89
- package/dist/cjs/gx-ide-list-selector.cjs.entry.js +0 -51
- package/dist/cjs/gxg-ide-loader.cjs.entry.js +0 -78
- package/dist/cjs/gxg-tree-view.cjs.entry.js +0 -481
- package/dist/esm/gx-ide-list-selector-item.entry.js +0 -85
- package/dist/esm/gx-ide-list-selector.entry.js +0 -47
- package/dist/esm/gxg-tree-view.entry.js +0 -477
- package/dist/genexus-ide-ui/p-00ee4c20.entry.js +0 -1
- package/dist/genexus-ide-ui/p-16d35368.entry.js +0 -1
- package/dist/genexus-ide-ui/p-3e16a46a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-83f6db54.entry.js +0 -1
- package/dist/genexus-ide-ui/p-845f47ff.entry.js +0 -1
- package/dist/genexus-ide-ui/p-85164984.entry.js +0 -1
- package/dist/genexus-ide-ui/p-a4b359b1.entry.js +0 -1
- package/dist/genexus-ide-ui/p-a5833100.entry.js +0 -1
- package/dist/genexus-ide-ui/p-cddb793a.entry.js +0 -1
- package/dist/genexus-ide-ui/p-dd676f91.entry.js +0 -1
- package/dist/genexus-ide-ui/p-ffddd3ad.entry.js +0 -1
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
|
|
2
|
+
import { L as Locale } from './locale-e183487a.js';
|
|
3
|
+
import { c as config } from './config-9b4321f9.js';
|
|
4
|
+
import { c as countTreeItems } from './helpers-c29a9591.js';
|
|
5
|
+
|
|
6
|
+
const convertImportItemToTreeItem = (importCatIcon, importItems) => {
|
|
7
|
+
const importTreeItems = [];
|
|
8
|
+
importItems.forEach(importItem => {
|
|
9
|
+
importTreeItems.push({
|
|
10
|
+
id: importItem.id,
|
|
11
|
+
caption: importItem.name,
|
|
12
|
+
leftImgSrc: importCatIcon,
|
|
13
|
+
checkbox: true,
|
|
14
|
+
expanded: true,
|
|
15
|
+
leaf: true,
|
|
16
|
+
class: "object"
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return importTreeItems;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @description This function converts ReferenceData[] data to TreeItemData[]
|
|
23
|
+
*/
|
|
24
|
+
const convertImportCategoryToTreeView = (importCategoryData) => {
|
|
25
|
+
const treeData = [];
|
|
26
|
+
if (!importCategoryData) {
|
|
27
|
+
return treeData;
|
|
28
|
+
}
|
|
29
|
+
importCategoryData.forEach(importCat => {
|
|
30
|
+
const importCategoryTreeItem = {
|
|
31
|
+
id: importCat.id,
|
|
32
|
+
caption: `${importCat.name} (${importCat.items.length})`,
|
|
33
|
+
leftImgSrc: importCat.icon,
|
|
34
|
+
checkbox: true,
|
|
35
|
+
expanded: true,
|
|
36
|
+
leaf: false,
|
|
37
|
+
class: "category",
|
|
38
|
+
items: convertImportItemToTreeItem(importCat.icon, importCat.items)
|
|
39
|
+
};
|
|
40
|
+
treeData.push(importCategoryTreeItem);
|
|
41
|
+
});
|
|
42
|
+
return treeData;
|
|
43
|
+
};
|
|
44
|
+
const createImportResultDataMessages = (importItemId, messagesArray) => {
|
|
45
|
+
const messages = [];
|
|
46
|
+
messagesArray.forEach((message, i) => {
|
|
47
|
+
messages.push({
|
|
48
|
+
id: `${importItemId}-message-${i}}]`,
|
|
49
|
+
caption: message,
|
|
50
|
+
leftImgSrc: "gx-test/test-results",
|
|
51
|
+
leaf: true
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
return messages;
|
|
55
|
+
};
|
|
56
|
+
const updateImportStatusTree = (importItemResultFullData, importTreeActualState) => {
|
|
57
|
+
var _a;
|
|
58
|
+
const objectCategoryIndex = importTreeActualState.findIndex(objectCategoryItem => {
|
|
59
|
+
return objectCategoryItem.id === importItemResultFullData.categoryId;
|
|
60
|
+
});
|
|
61
|
+
if (objectCategoryIndex === -1) {
|
|
62
|
+
// object category node does not exists. We have to create it, and insert the import result tree node inside.
|
|
63
|
+
const importTreeItem = {
|
|
64
|
+
id: importItemResultFullData.categoryId,
|
|
65
|
+
// the count is (1), because this is the first item for this category
|
|
66
|
+
caption: `${importItemResultFullData.categoryName} (1)`,
|
|
67
|
+
leftImgSrc: importItemResultFullData.categoryIcon,
|
|
68
|
+
class: `tree-view-item tree-view-item--${importItemResultFullData.status}`,
|
|
69
|
+
expanded: true,
|
|
70
|
+
items: [
|
|
71
|
+
{
|
|
72
|
+
id: importItemResultFullData.id,
|
|
73
|
+
caption: importItemResultFullData.name,
|
|
74
|
+
items: createImportResultDataMessages(importItemResultFullData.id, importItemResultFullData.messages),
|
|
75
|
+
class: `tree-view-item tree-view-item--${importItemResultFullData.status}`,
|
|
76
|
+
expanded: true,
|
|
77
|
+
leaf: importItemResultFullData.messages.length === 0
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
};
|
|
81
|
+
importTreeActualState.push(importTreeItem);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Object category node already exists. Just create the import result node, and insert into the parent category node (if it doesn't exists already).
|
|
85
|
+
// first search for the importItemResult node...
|
|
86
|
+
const importItemIndex = (_a = importTreeActualState[objectCategoryIndex].items) === null || _a === void 0 ? void 0 : _a.findIndex(importItem => {
|
|
87
|
+
return importItem.id === importItemResultFullData.id;
|
|
88
|
+
});
|
|
89
|
+
if (importItemIndex === -1) {
|
|
90
|
+
// ImportItem does not exists already
|
|
91
|
+
const importTreeItem = {
|
|
92
|
+
id: importItemResultFullData.id,
|
|
93
|
+
caption: importItemResultFullData.name,
|
|
94
|
+
expanded: true,
|
|
95
|
+
items: createImportResultDataMessages(importItemResultFullData.id, importItemResultFullData.messages),
|
|
96
|
+
class: `tree-view-item tree-view-item--${importItemResultFullData.status}`
|
|
97
|
+
};
|
|
98
|
+
// Insert the import node into the category node
|
|
99
|
+
importTreeActualState[objectCategoryIndex].items.push(importTreeItem);
|
|
100
|
+
// Then, update the category node caption (the name is the same, but the (count) should be the actual items.length, because we have just added a new child import node. )
|
|
101
|
+
importTreeActualState[objectCategoryIndex].caption = `${importItemResultFullData.categoryName} (${importTreeActualState[objectCategoryIndex].items.length})`;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return importTreeActualState;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* This function takes an ImportItemResultData item, and updates it to a ImportCategoryFullData, which has the same information, plus the category parent needed information, that will be used for creating the "virtual" parent category node on the "Import Status" section.
|
|
108
|
+
*/
|
|
109
|
+
const createImportResultFullData = (importItemResultData, importCategoryData) => {
|
|
110
|
+
const importCategoryFullData = Object.assign({ categoryId: undefined, categoryName: undefined, categoryIcon: undefined }, importItemResultData);
|
|
111
|
+
importCategoryDataFor: for (let i = 0; i < importCategoryData.length; i++) {
|
|
112
|
+
const categoryNode = importCategoryData[i];
|
|
113
|
+
for (let j = 0; j < categoryNode.items.length; j++) {
|
|
114
|
+
if (categoryNode.items[j].id === importItemResultData.id) {
|
|
115
|
+
importCategoryFullData.categoryId = categoryNode.id;
|
|
116
|
+
importCategoryFullData.categoryName = categoryNode.name;
|
|
117
|
+
importCategoryFullData.categoryIcon = categoryNode.icon;
|
|
118
|
+
break importCategoryDataFor;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return importCategoryFullData;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* @description This function adds an ImportItemResultData item to the "importTreeState", and returns the updated tree with the new item added.
|
|
126
|
+
*/
|
|
127
|
+
const addImportItemResultDataItem = (importItemResultData, importCategoryData, importTreeActualState) => {
|
|
128
|
+
let updatedImportStatusTree = [...importTreeActualState];
|
|
129
|
+
// first, update importItemResultData with the category data. It will be needed later.
|
|
130
|
+
const importItemResultFullData = createImportResultFullData(importItemResultData, importCategoryData);
|
|
131
|
+
updatedImportStatusTree = updateImportStatusTree(importItemResultFullData, updatedImportStatusTree);
|
|
132
|
+
return updatedImportStatusTree;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const kbManagerImportCss = ".gxi-hidden{display:none !important}.gxi-full-height{height:100%}.gxi-overflow-auto{overflow:auto}.gxi-display-flex{display:flex}.align-start{display:flex;align-items:start}.align-center{display:flex;align-items:center}.align-end{display:flex;align-items:end}.grid{display:grid;grid-row-gap:var(--gx-ide-grid-row-gap);grid-column-gap:var(--gx-ide-grid-column-gap);grid-template-rows:auto}ch-grid-cell{display:flex}ch-grid{overflow:auto;height:100%}ch-grid-column{z-index:99;border-bottom:1px solid var(--gray-01)}gxg-tabs{box-shadow:none}:host(.gx-ide-component){box-shadow:var(--box-shadow-01) !important;height:100% !important;display:flex !important;flex-direction:column !important}:host(:focus-within) gx-ide-top-bar::part(wrapper){background-color:var(--color-secondary-enabled)}.gx-ide-main-wrapper{color:var(--gx-ide-component-text-color);font-weight:var(--font-weight-regular);font-size:var(--font-size-lg);line-height:1.6em;height:100%;background-color:var(--gx-ide-component-background-color);display:flex;flex-direction:column;flex-grow:1}.gx-ide-main{flex-grow:1;overflow-y:auto;}.gx-ide-main::-webkit-scrollbar{width:6px;height:6px}.gx-ide-main::-webkit-scrollbar-track{background-color:var(--gray-02);border-radius:10px}.gx-ide-main::-webkit-scrollbar-thumb{background:var(--gray-05);border-radius:10px}.gx-ide-main::-webkit-scrollbar-thumb:hover{background:var(--gray-04);cursor:pointer}.gx-ide-main .gxg-scroll{display:block;overflow-y:auto;padding-inline-end:2px}.gx-ide-overflow{overflow-y:auto;}.gx-ide-overflow::-webkit-scrollbar{width:6px;height:6px}.gx-ide-overflow::-webkit-scrollbar-track{background-color:var(--gray-02);border-radius:10px}.gx-ide-overflow::-webkit-scrollbar-thumb{background:var(--gray-05);border-radius:10px}.gx-ide-overflow::-webkit-scrollbar-thumb:hover{background:var(--gray-04);cursor:pointer}.gx-ide-overflow .gxg-scroll{display:block;overflow-y:auto;padding-inline-end:2px}:host{display:block}.header{display:flex;flex-direction:row;gap:var(--gx-ide-grid-column-gap)}.header .select-file{flex:1}.main{min-height:250px;display:grid;grid-template-columns:1fr 1fr}.main .left-grid-item{border-right:1px solid var(--gx-ide-container-border-color)}.main .tree-container{height:100%;max-height:300px;display:flex;}.main .tree-container--empty{align-items:center;justify-content:center}.main .tree-container--import-status .tree-view-item--success::part(action){grid-template:\"first-img left-img text right-img\"/max-content max-content 1fr max-content}.main .tree-container--import-status .tree-view-item--success::part(action)::before{grid-area:first-img;content:\"\";width:var(--spacing-comp-02);height:var(--spacing-comp-02);border-radius:50%;background-color:var(--gray-03);background-color:var(--color-success-dark)}.main .tree-container--import-status .tree-view-item--warning::part(action){grid-template:\"first-img left-img text right-img\"/max-content max-content 1fr max-content}.main .tree-container--import-status .tree-view-item--warning::part(action)::before{grid-area:first-img;content:\"\";width:var(--spacing-comp-02);height:var(--spacing-comp-02);border-radius:50%;background-color:var(--gray-03);background-color:var(--color-warning-dark)}.main .tree-container--import-status .tree-view-item--error::part(action){grid-template:\"first-img left-img text right-img\"/max-content max-content 1fr max-content}.main .tree-container--import-status .tree-view-item--error::part(action)::before{grid-area:first-img;content:\"\";width:var(--spacing-comp-02);height:var(--spacing-comp-02);border-radius:50%;background-color:var(--gray-03);background-color:var(--color-error-dark)}.main .tree-container--no-warnings .tree-view-item--warning{display:none}.main .tree-container--no-errors .tree-view-item--error{display:none}.main .tree-container--no-successes .tree-view-item--success{display:none}.ghost-element{display:block;width:0;height:24px;}";
|
|
136
|
+
|
|
137
|
+
const GxIdeKbManagerImport = class {
|
|
138
|
+
constructor(hostRef) {
|
|
139
|
+
registerInstance(this, hostRef);
|
|
140
|
+
this.componentDidRenderFirstTime = createEvent(this, "componentDidRenderFirstTime", 7);
|
|
141
|
+
this.componentDidLoadEvent = createEvent(this, "componentDidLoadEvent", 7);
|
|
142
|
+
this.renderedFirstTime = false;
|
|
143
|
+
/* ImportCategoryBasicData Holds the original name of category data, and its id. Used to create parent nodes on the imported tree*/
|
|
144
|
+
this.importCategoryData = [];
|
|
145
|
+
this.objectsInFileTotalNodes = 0;
|
|
146
|
+
// 9.LOCAL METHODS //
|
|
147
|
+
this.evaluateObjects = () => {
|
|
148
|
+
var _a;
|
|
149
|
+
this.noObjects = !!(((_a = this.objectsTreeState) === null || _a === void 0 ? void 0 : _a.length) === 0 || !this.objectsTreeState);
|
|
150
|
+
};
|
|
151
|
+
this.evaluateImport = () => {
|
|
152
|
+
var _a;
|
|
153
|
+
this.noImport = !!(((_a = this.importTreeState) === null || _a === void 0 ? void 0 : _a.length) === 0 || !this.importTreeState);
|
|
154
|
+
};
|
|
155
|
+
this.selectFileHandler = () => {
|
|
156
|
+
this.fileInputEl.openFile();
|
|
157
|
+
};
|
|
158
|
+
this.loadFileHandler = async () => {
|
|
159
|
+
if (this.loadCallback && this.selectedFile) {
|
|
160
|
+
this.importCategoryData = await this.loadCallback(this.selectedFile);
|
|
161
|
+
const importCategoryTreeData = convertImportCategoryToTreeView(this.importCategoryData);
|
|
162
|
+
this.objectsTreeState = importCategoryTreeData;
|
|
163
|
+
if (this.importCategoryData.length > 0) {
|
|
164
|
+
// clear input
|
|
165
|
+
this.selectedFile = null;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
this.fileSelectedHandler = (fileEvent) => {
|
|
170
|
+
this.selectedFile = fileEvent.detail[0];
|
|
171
|
+
};
|
|
172
|
+
this.evaluateHeaderActiveButton = () => {
|
|
173
|
+
if (!this.selectedFile) {
|
|
174
|
+
this.headerButtonsGroup.activeButtonId = "select-file-btn";
|
|
175
|
+
this.fileInputEl.value = undefined;
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
this.headerButtonsGroup.activeButtonId = "load-file-btn";
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
this.importObjectsHandler = async () => {
|
|
182
|
+
if (this.importCallback) {
|
|
183
|
+
this.importingObjects = true;
|
|
184
|
+
this.objectsButtonsGroup.activeButtonId = "cancel-import-btn";
|
|
185
|
+
const result = await this.importCallback(this.checkedObjectsIds);
|
|
186
|
+
if (result || result === false) {
|
|
187
|
+
this.importingObjects = false;
|
|
188
|
+
this.objectsButtonsGroup.activeButtonId = "import-btn";
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
this.objectsTreeCheckedItemsChangedHandler = (event) => {
|
|
193
|
+
const allItemsWithCheckbox = [...event.detail.values()];
|
|
194
|
+
const checkedItems = allItemsWithCheckbox.filter(node => node.item.checked);
|
|
195
|
+
// objects checked
|
|
196
|
+
const checkedObjects = checkedItems.filter(node => node.item.class === "object");
|
|
197
|
+
const checkedObjectsIds = [];
|
|
198
|
+
if (checkedObjects.length > 0) {
|
|
199
|
+
checkedObjects.forEach(objectChecked => {
|
|
200
|
+
checkedObjectsIds.push(objectChecked.item.id);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
this.checkedObjectsIds = checkedObjectsIds;
|
|
204
|
+
};
|
|
205
|
+
this.cancelImportHandler = () => {
|
|
206
|
+
if (this.cancelCallback) {
|
|
207
|
+
this.cancelCallback();
|
|
208
|
+
// returns boolean
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
this.optionsHandler = () => {
|
|
212
|
+
if (this.optionsCallback) {
|
|
213
|
+
this.optionsCallback();
|
|
214
|
+
// returns boolean
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
this.clearStatusHandler = () => {
|
|
218
|
+
this.importTreeState = [];
|
|
219
|
+
this.statusInfo.error.number = 0;
|
|
220
|
+
this.statusInfo.warning.number = 0;
|
|
221
|
+
this.statusInfo.success.number = 0;
|
|
222
|
+
};
|
|
223
|
+
this.selectAllClickedHandler = () => {
|
|
224
|
+
const checked = this.checkAllCheckboxEl.checked;
|
|
225
|
+
if (checked && this.objectsTreeEl) {
|
|
226
|
+
console.log("check");
|
|
227
|
+
this.objectsTreeEl.updateAllItemsProperties({ checked: true });
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
this.statusButtonsSelectionChangedHandler = (e) => {
|
|
231
|
+
const activeStates = e.detail;
|
|
232
|
+
const newStatusInfo = Object.assign({}, this.statusInfo);
|
|
233
|
+
newStatusInfo.warning.display = false;
|
|
234
|
+
newStatusInfo.error.display = false;
|
|
235
|
+
newStatusInfo.success.display = false;
|
|
236
|
+
activeStates.forEach(activeState => {
|
|
237
|
+
const status = activeState.itemId;
|
|
238
|
+
newStatusInfo[status].display = true;
|
|
239
|
+
this.statusInfo = newStatusInfo;
|
|
240
|
+
});
|
|
241
|
+
this.evaluateHiddenImportsMessage();
|
|
242
|
+
};
|
|
243
|
+
this.evaluateHiddenImportsMessage = () => {
|
|
244
|
+
/* to do*/
|
|
245
|
+
};
|
|
246
|
+
this.checkedObjectsIds = [];
|
|
247
|
+
this.noObjects = undefined;
|
|
248
|
+
this.showHiddenImportsMessage = false;
|
|
249
|
+
this.statusInfo = {
|
|
250
|
+
error: {
|
|
251
|
+
display: true,
|
|
252
|
+
number: 0
|
|
253
|
+
},
|
|
254
|
+
warning: {
|
|
255
|
+
display: true,
|
|
256
|
+
number: 0
|
|
257
|
+
},
|
|
258
|
+
success: {
|
|
259
|
+
display: true,
|
|
260
|
+
number: 0
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
this.objectsTreeState = [];
|
|
264
|
+
this.noImport = undefined;
|
|
265
|
+
this.importTreeState = [];
|
|
266
|
+
this.importingObjects = false;
|
|
267
|
+
this.selectedFile = undefined;
|
|
268
|
+
this.optionsCallback = undefined;
|
|
269
|
+
this.importCallback = undefined;
|
|
270
|
+
this.loadCallback = undefined;
|
|
271
|
+
this.cancelCallback = undefined;
|
|
272
|
+
this.statusMinimal = false;
|
|
273
|
+
}
|
|
274
|
+
watchObjectsTreeStateHandler(newState) {
|
|
275
|
+
this.noObjects = !!(newState.length === 0 || !newState);
|
|
276
|
+
this.objectsInFileTotalNodes = countTreeItems(newState);
|
|
277
|
+
}
|
|
278
|
+
watchImportTreeStateHandler(newState) {
|
|
279
|
+
this.noImport = !!(newState.length === 0 || !newState);
|
|
280
|
+
}
|
|
281
|
+
watchSelectedFileHandler() {
|
|
282
|
+
this.evaluateHeaderActiveButton();
|
|
283
|
+
}
|
|
284
|
+
// 6.COMPONENT LIFECYCLE EVENTS //
|
|
285
|
+
async componentWillLoad() {
|
|
286
|
+
this._componentLocale = await Locale.getComponentStrings(this.el);
|
|
287
|
+
this.componentDidLoadEvent.emit(true);
|
|
288
|
+
this.evaluateObjects();
|
|
289
|
+
this.evaluateImport();
|
|
290
|
+
}
|
|
291
|
+
componentDidRender() {
|
|
292
|
+
if (!this.renderedFirstTime) {
|
|
293
|
+
this.componentDidRenderFirstTime.emit(this._componentLocale.componentName);
|
|
294
|
+
this.renderedFirstTime = true;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
// 7.LISTENERS //
|
|
298
|
+
// 8.PUBLIC METHODS API //
|
|
299
|
+
/**
|
|
300
|
+
* Add the result of importing an item
|
|
301
|
+
*/
|
|
302
|
+
async addResultItem(item) {
|
|
303
|
+
this.importTreeState = addImportItemResultDataItem(item, this.importCategoryData, this.importTreeState);
|
|
304
|
+
this.statusInfo[`${item.status}`].number += item.messages.length;
|
|
305
|
+
}
|
|
306
|
+
// 10.RENDER() FUNCTION //
|
|
307
|
+
render() {
|
|
308
|
+
return (h(Host, { class: "gx-ide-component" }, h("div", { class: "gx-ide-main-wrapper" }, h("gx-ide-container", { noContentPadding: true, noFooterPadding: true }, h("header", { class: "header", slot: "header" }, h("gxg-form-text", { type: "file", class: "select-file", label: this._componentLocale.header.fileNameLabel, placeholder: this._componentLocale.header.fileNamePlaceholder, part: "file-name", acceptFile: ".xpz, .xml", clearButton: true, iconPosition: "start", onFileSelected: this.fileSelectedHandler, ref: (el) => (this.fileInputEl = el) }), h("gxg-button-group", {
|
|
309
|
+
// default-selected-btn-id="select-file-btn"
|
|
310
|
+
ref: (el) => (this.headerButtonsGroup = el)
|
|
311
|
+
}, h("button", { id: "select-file-btn", part: "select-file-button", onClick: this.selectFileHandler }, this._componentLocale.header.selectFileButton), h("button", { id: "load-file-btn", part: "load-file-button", disabled: !this.selectedFile, onClick: this.loadFileHandler }, this._componentLocale.header.loadButton))), h("main", { class: "main" }, h("gx-ide-container", { containerTitle: this._componentLocale.main.objectsInFile.title, noContentPadding: true, noBorderFooter: true, class: "left-grid-item", slimmerFooter: true, inactiveTitle: this.noObjects, footerSubtleShadow: !this.noObjects }, h("div", { class: {
|
|
312
|
+
"tree-container": true,
|
|
313
|
+
"tree-container--objects-in-file": true,
|
|
314
|
+
"tree-container--empty": this.noObjects
|
|
315
|
+
} }, !this.noObjects ? (h("gxg-tree-view", { positionRelative: true, treeModel: this.objectsTreeState, toggleCheckboxes: true, onCheckedItemsChange: this.objectsTreeCheckedItemsChangedHandler, ref: el => (this.objectsTreeEl = el) })) : (h("gxg-text", { textAlign: config.gxgMessage.common.textAlign, padding: config.gxgMessage.common.textAlign, type: config.gxgMessage.common.type, maxWidth: config.gxgMessage.common.maxWidth, part: "objects-in-file-empty-status-message" }, "There are no Objects. ", h("br", null), h("gxg-text", { type: "text-link-no-line", onClick: this.selectFileHandler }, "Begin by selecting a file.")))), h("gxg-form-checkbox", { label: this.objectsTreeState.length > 0 &&
|
|
316
|
+
this.objectsInFileTotalNodes ===
|
|
317
|
+
this.checkedObjectsIds.length
|
|
318
|
+
? this._componentLocale.main.objectsInFile.deselectAll
|
|
319
|
+
: this._componentLocale.main.objectsInFile.selectAll, part: "select-all-checkbox", slot: "footer-start", disabled: this.importingObjects || this.objectsTreeState.length === 0, ref: el => (this.checkAllCheckboxEl = el), onClick: this.selectAllClickedHandler }), h("gxg-button-group", { slot: "footer-end", ref: (el) => (this.objectsButtonsGroup = el) }, h("button", { id: "import-btn", part: "import-button", disabled: this.importingObjects ||
|
|
320
|
+
this.checkedObjectsIds.length === 0, onClick: this.importObjectsHandler }, this._componentLocale.main.objectsInFile.importButton), h("button", { id: "cancel-import-btn", part: "cancel-import-button", disabled: !this.importingObjects, onClick: this.cancelImportHandler }, this._componentLocale.main.objectsInFile.cancelButton)), h("gxg-button", { type: "secondary-icon-only", icon: "gemini-tools/settings", slot: "footer-end", part: "select-kb-btn", onClick: this.optionsHandler }, this._componentLocale.header.optionsButton)), h("gx-ide-container", { containerTitle: this._componentLocale.main.importStatus.title, noContentPadding: true, noBorderFooter: true, slimmerFooter: true, inactiveTitle: this.noImport, footerSubtleShadow: !this.noImport, class: "right-grid-item" }, h("div", { class: {
|
|
321
|
+
"tree-container": true,
|
|
322
|
+
"tree-container--import-status": true,
|
|
323
|
+
"tree-container--empty": this.noImport,
|
|
324
|
+
"tree-container--no-warnings": !this.statusInfo.warning.display,
|
|
325
|
+
"tree-container--no-errors": !this.statusInfo.error.display,
|
|
326
|
+
"tree-container--no-successes": this.statusInfo.success.display === false
|
|
327
|
+
} }, !this.noImport ? (h("gxg-tree-view", { positionRelative: true, treeModel: this.importTreeState, toggleCheckboxes: true, ref: el => (this.objectsTreeEl = el) })) : (h("gxg-text", { textAlign: config.gxgMessage.common.textAlign, padding: config.gxgMessage.common.textAlign, type: config.gxgMessage.common.type, maxWidth: config.gxgMessage.common.maxWidth, part: "objects-in-file-empty-status-message" }, "There are no Imported files."))), h("gxg-text", { type: "button-like", slot: "footer-end", part: "select-kb-btn", onClick: this.clearStatusHandler, disabled: this.noImport }, this._componentLocale.main.importStatus.clearButton), h("span", { class: "ghost-element", slot: "footer-start" }))), h("footer", { slot: "footer-start" }, h("gx-ide-status-buttons", { errors: this.statusInfo.error.number, warnings: this.statusInfo.warning.number, successes: this.statusInfo.success.number, compact: true, noBorderTop: true, noBorderBottom: true, noBorderStart: true, minimal: this.statusMinimal, onSelectionChanged: this.statusButtonsSelectionChangedHandler }))), h("gxg-ide-loader", { description: "Importing objects..." }))));
|
|
328
|
+
}
|
|
329
|
+
static get assetsDirs() { return ["gx-ide-assets/kb-manager-import"]; }
|
|
330
|
+
get el() { return getElement(this); }
|
|
331
|
+
static get watchers() { return {
|
|
332
|
+
"objectsTreeState": ["watchObjectsTreeStateHandler"],
|
|
333
|
+
"importTreeState": ["watchImportTreeStateHandler"],
|
|
334
|
+
"selectedFile": ["watchSelectedFileHandler"]
|
|
335
|
+
}; }
|
|
336
|
+
};
|
|
337
|
+
GxIdeKbManagerImport.style = kbManagerImportCss;
|
|
338
|
+
|
|
339
|
+
export { GxIdeKbManagerImport as gx_ide_kb_manager_import };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-0da01575.js';
|
|
2
|
+
|
|
3
|
+
const listSelectorCss = "*,::after,::before{box-sizing:border-box}:host{display:flex;flex-direction:column;max-height:100%;font-family:var(--font-family-primary)}gxg-title{display:block;margin-block-end:var(--gxg-label-margin-vertical)}.list{background-color:unset;border:none;color:inherit;font:inherit;margin:0;padding:0;outline:0;list-style-type:none;margin:0;padding:0;color:var(--gx-ide-component-text-color);background-color:var(--gx-ide-component-background-color);font-size:var(--gx-ide-component-text-size);font-weight:var(--font-weight-regular);display:block;background-color:var(--color-background);max-height:100%;overflow-y:auto;border:1px solid var(--gx-ide-container-border-color)}.list::-webkit-scrollbar{width:6px;height:6px}.list::-webkit-scrollbar-track{background-color:var(--gray-02);border-radius:10px}.list::-webkit-scrollbar-thumb{background:var(--gray-05);border-radius:10px}.list::-webkit-scrollbar-thumb:hover{background:var(--gray-04);cursor:pointer}.list .gxg-scroll{display:block;overflow-y:auto;padding-inline-end:2px}:host([no-list-border]) .list{border:none}";
|
|
4
|
+
|
|
5
|
+
const GxIdeListSelector = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.selectionChanged = createEvent(this, "selectionChanged", 7);
|
|
9
|
+
// 8.PUBLIC METHODS API //
|
|
10
|
+
// 9.LOCAL METHODS //
|
|
11
|
+
/**
|
|
12
|
+
* It evaluates the checked items, and checks or unchecks if needed
|
|
13
|
+
*/
|
|
14
|
+
this.evaluateChecked = () => {
|
|
15
|
+
const allListItems = Array.from(this.el.querySelectorAll("gx-ide-list-selector-item"));
|
|
16
|
+
const checkedItems = allListItems.filter(item => item.itemChecked);
|
|
17
|
+
/**
|
|
18
|
+
* INDEX
|
|
19
|
+
* 1.required and no one checked
|
|
20
|
+
* 2.single-selection, and more than one checked
|
|
21
|
+
*/
|
|
22
|
+
/* 1.required and no one checked*/
|
|
23
|
+
if (this.required && checkedItems.length === 0) {
|
|
24
|
+
allListItems[0].itemChecked = true;
|
|
25
|
+
}
|
|
26
|
+
else if (this.type === "single-selection" && checkedItems.length > 1) {
|
|
27
|
+
/* 2.single-selection, and more than one checked*/
|
|
28
|
+
checkedItems.forEach((item, i) => {
|
|
29
|
+
if (i !== 0) {
|
|
30
|
+
item.itemChecked = false;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* It evaluates the initial value/s
|
|
37
|
+
*/
|
|
38
|
+
this.evaluateInitialValue = () => {
|
|
39
|
+
const checkedItems = this.getChecked();
|
|
40
|
+
if (this.type === "single-selection" && checkedItems.length > 0) {
|
|
41
|
+
this.value = checkedItems[0].itemValue;
|
|
42
|
+
}
|
|
43
|
+
else if (this.type === "multi-selection" && checkedItems.length > 0) {
|
|
44
|
+
const values = [];
|
|
45
|
+
checkedItems.forEach(checked => {
|
|
46
|
+
values.push(checked.itemValue);
|
|
47
|
+
});
|
|
48
|
+
this.value = values;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
this.getChecked = () => {
|
|
52
|
+
const checkedItems = [];
|
|
53
|
+
const allItems = this.el.querySelectorAll("gx-ide-list-selector-item");
|
|
54
|
+
allItems.forEach(item => {
|
|
55
|
+
if (item.itemChecked) {
|
|
56
|
+
checkedItems.push(item);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
return checkedItems;
|
|
60
|
+
};
|
|
61
|
+
this.listTitle = undefined;
|
|
62
|
+
this.ordered = false;
|
|
63
|
+
this.readonly = false;
|
|
64
|
+
this.type = "single-selection";
|
|
65
|
+
this.required = false;
|
|
66
|
+
this.ellipsis = false;
|
|
67
|
+
this.value = undefined;
|
|
68
|
+
this.iconsColor = "auto";
|
|
69
|
+
this.iconsSize = "regular";
|
|
70
|
+
this.listName = undefined;
|
|
71
|
+
this.noItemsBorder = false;
|
|
72
|
+
this.noListBorder = false;
|
|
73
|
+
}
|
|
74
|
+
// 6.COMPONENT LIFECYCLE METHODS //
|
|
75
|
+
componentWillLoad() {
|
|
76
|
+
this.evaluateChecked();
|
|
77
|
+
this.evaluateInitialValue();
|
|
78
|
+
}
|
|
79
|
+
// 7.LISTENERS //
|
|
80
|
+
itemSelectionChangedHandler(event) {
|
|
81
|
+
event.stopPropagation();
|
|
82
|
+
const checkedItemsInfo = [];
|
|
83
|
+
const checkedItems = this.getChecked();
|
|
84
|
+
const newValue = [];
|
|
85
|
+
checkedItems.forEach(item => {
|
|
86
|
+
const value = item.itemValue;
|
|
87
|
+
newValue.push(value);
|
|
88
|
+
checkedItemsInfo.push({
|
|
89
|
+
itemId: item.itemId,
|
|
90
|
+
itemValue: value
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
/* update this.value*/
|
|
94
|
+
if (this.type === "single-selection" && newValue.length > 0) {
|
|
95
|
+
this.value = newValue[0] || undefined;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
/* multi-selection*/
|
|
99
|
+
this.value = newValue;
|
|
100
|
+
}
|
|
101
|
+
/* emit selectionChanged*/
|
|
102
|
+
this.selectionChanged.emit(checkedItemsInfo);
|
|
103
|
+
}
|
|
104
|
+
// 10.RENDER() FUNCTION //
|
|
105
|
+
render() {
|
|
106
|
+
return (h(Host, { exportparts: "input:input" }, this.listTitle ? (h("gxg-title", { type: "title-04" }, this.listTitle)) : null, this.ordered ? (h("ol", { class: "list", part: "list" }, h("slot", null))) : (h("ul", { class: "list", part: "list" }, h("slot", null)))));
|
|
107
|
+
}
|
|
108
|
+
get el() { return getElement(this); }
|
|
109
|
+
};
|
|
110
|
+
GxIdeListSelector.style = listSelectorCss;
|
|
111
|
+
|
|
112
|
+
const listSelectorItemCss = "*,::after,::before{box-sizing:border-box}gx-ide-list-selector-item{display:block;max-width:100%;display:flex;font-size:inherit}gx-ide-list-selector-item:hover .label{background-color:var(--gxg-background-color--hover);cursor:pointer}gx-ide-list-selector-item:hover input:checked+.label{background-color:var(--gxg-background-color--selected-hover)}gx-ide-list-selector-item:not(:first-child){border-block-start:1px solid var(--gx-ide-container-border-color)}gx-ide-list-selector-item:not(:first-child):has(input:checked){border-block-color:var(--gxg-border-color--selected)}gx-ide-list-selector-item[readonly]:not([readonly=false]) .label{pointer-events:none;background-color:transparent}gx-ide-list-selector-item[ellipsis]:not([ellipsis=false]) .label__description{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}input{width:0;height:0;opacity:0;margin:0}input:focus+.label{outline:var(--border-width-md) solid var(--color-primary-active);outline-offset:-2px}input:checked+.label{background-color:var(--gxg-background-color--selected)}.label{width:100%}.label__wrapper{display:flex;min-height:28px;align-items:center;gap:var(--spacing-comp-02);padding:var(--spacing-comp-01) var(--spacing-comp-02);width:100%}.label__wrapper__description{flex:1}gx-ide-list-selector-item[no-border]{border-block-start:none}.label__universal-slot{display:flex;align-items:center;justify-content:center}";
|
|
113
|
+
|
|
114
|
+
const GxIdeListSelectorItem = class {
|
|
115
|
+
constructor(hostRef) {
|
|
116
|
+
registerInstance(this, hostRef);
|
|
117
|
+
this.itemSelectionChanged = createEvent(this, "itemSelectionChanged", 7);
|
|
118
|
+
this.hasUniversalSlot = false;
|
|
119
|
+
// 6.COMPONENT LIFECYCLE METHODS //
|
|
120
|
+
// 7.LISTENERS //
|
|
121
|
+
// 8.PUBLIC METHODS API //
|
|
122
|
+
// 9.LOCAL METHODS //
|
|
123
|
+
/**
|
|
124
|
+
* Checks if this item parentElement is a gx-ide-list-selector, and assigns a reference
|
|
125
|
+
*/
|
|
126
|
+
this.evaluateParentIsListSelector = () => {
|
|
127
|
+
const parentList = this.el.parentElement;
|
|
128
|
+
this.parentIsListSelector = (parentList === null || parentList === void 0 ? void 0 : parentList.nodeName) === "GX-IDE-LIST-SELECTOR";
|
|
129
|
+
this.parentIsListSelector && (this.parentList = parentList);
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Determines the type of item, based on the parent list-selector 'type' property value
|
|
133
|
+
*/
|
|
134
|
+
this.evaluateType = () => {
|
|
135
|
+
const parentList = this.el
|
|
136
|
+
.parentElement;
|
|
137
|
+
this.type = parentList.type === "single-selection" ? "radio" : "checkbox";
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Evaluates if is selectable, considering the parent list-selector 'selectable' property value, only if it is undefined on this item
|
|
141
|
+
*/
|
|
142
|
+
this.evaluateSelectable = () => {
|
|
143
|
+
if (this.readonly === undefined && this.parentIsListSelector) {
|
|
144
|
+
this.readonly = this.parentList.readonly;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Evaluates if text should truncate with ellipsis, considering the parent list-selector 'ellipsis' property value, only if it is undefined on this item
|
|
149
|
+
*/
|
|
150
|
+
this.evaluateEllipsis = () => {
|
|
151
|
+
if (this.ellipsis === undefined && this.parentIsListSelector) {
|
|
152
|
+
this.ellipsis = this.parentList.ellipsis;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Evaluates if this item should be initially checked, only if the parent list-selector listValue equals this item value.
|
|
157
|
+
*/
|
|
158
|
+
this.evaluateChecked = () => {
|
|
159
|
+
if (this.checked === undefined &&
|
|
160
|
+
this.parentIsListSelector &&
|
|
161
|
+
this.parentList.value !== undefined &&
|
|
162
|
+
this.parentList.value === this.itemValue) {
|
|
163
|
+
this.checked = true;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
this.evaluateBorder = () => {
|
|
167
|
+
if (this.parentIsListSelector) {
|
|
168
|
+
this.noBorder = this.parentList.noItemsBorder;
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
this.evaluateUniversalSlot = () => {
|
|
172
|
+
this.hasUniversalSlot = !!this.el.querySelector("[slot=universal]");
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Gets the listName required value, that is needed for the list selection to properly work
|
|
176
|
+
*/
|
|
177
|
+
this.assignName = () => {
|
|
178
|
+
this.parentIsListSelector &&
|
|
179
|
+
this.parentList.listName &&
|
|
180
|
+
(this.name = this.parentList.listName);
|
|
181
|
+
};
|
|
182
|
+
this.evaluateIconColor = () => {
|
|
183
|
+
this.parentIsListSelector &&
|
|
184
|
+
this.parentList.iconsColor &&
|
|
185
|
+
this.iconColor === undefined &&
|
|
186
|
+
(this.iconColor = this.parentList.iconsColor);
|
|
187
|
+
};
|
|
188
|
+
this.evaluateIconSize = () => {
|
|
189
|
+
this.parentIsListSelector &&
|
|
190
|
+
this.parentList.iconsSize &&
|
|
191
|
+
(this.iconSize = this.parentList.iconsSize);
|
|
192
|
+
};
|
|
193
|
+
this.onChangeHandler = (e) => {
|
|
194
|
+
this.itemChecked = e.target.checked;
|
|
195
|
+
this.itemSelectionChanged.emit({
|
|
196
|
+
itemId: this.itemId,
|
|
197
|
+
itemValue: this.itemValue
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
this.itemId = undefined;
|
|
201
|
+
this.itemValue = undefined;
|
|
202
|
+
this.itemChecked = false;
|
|
203
|
+
this.readonly = undefined;
|
|
204
|
+
this.ellipsis = undefined;
|
|
205
|
+
this.icon = undefined;
|
|
206
|
+
this.iconColor = undefined;
|
|
207
|
+
this.iconSize = undefined;
|
|
208
|
+
this.noBorder = false;
|
|
209
|
+
}
|
|
210
|
+
// 5.EVENTS (EMIT) //
|
|
211
|
+
componentWillLoad() {
|
|
212
|
+
this.evaluateParentIsListSelector();
|
|
213
|
+
this.evaluateType();
|
|
214
|
+
this.evaluateSelectable();
|
|
215
|
+
this.evaluateEllipsis();
|
|
216
|
+
this.evaluateChecked();
|
|
217
|
+
this.evaluateIconColor();
|
|
218
|
+
this.evaluateIconSize();
|
|
219
|
+
this.evaluateBorder();
|
|
220
|
+
this.evaluateUniversalSlot();
|
|
221
|
+
this.assignName();
|
|
222
|
+
}
|
|
223
|
+
// 10.RENDER() FUNCTION //
|
|
224
|
+
render() {
|
|
225
|
+
return (h(Host, { role: "listitem" }, h("input", { type: this.type, id: this.itemId, name: this.name, value: this.itemValue, checked: this.itemChecked, onChange: this.onChangeHandler, disabled: this.readonly, part: "input" }), h("label", { class: "label", htmlFor: this.itemId, part: "label" }, h("div", { class: "label__wrapper" }, this.icon ? (h("gxg-icon", { class: "label__icon", type: this.icon, size: this.iconSize, color: this.iconColor, part: "icon" })) : null, this.hasUniversalSlot ? (h("span", { class: "label__universal-slot", part: "universal-slot" }, h("slot", { name: "universal" }))) : null, h("span", { class: "label__description", part: "description" }, this.itemValue)))));
|
|
226
|
+
}
|
|
227
|
+
get el() { return getElement(this); }
|
|
228
|
+
};
|
|
229
|
+
GxIdeListSelectorItem.style = listSelectorItemCss;
|
|
230
|
+
|
|
231
|
+
export { GxIdeListSelector as gx_ide_list_selector, GxIdeListSelectorItem as gx_ide_list_selector_item };
|