@genexus/genexus-ide-ui 1.0.39 → 1.0.40
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/genexus-ide-ui.cjs.js +1 -1
- package/dist/cjs/gx-ide-current-user-info.cjs.entry.js +42 -3
- package/dist/cjs/gx-ide-current-user-info.cjs.entry.js.map +1 -1
- package/dist/cjs/gx-ide-data-type-selector.cjs.entry.js +226 -0
- package/dist/cjs/gx-ide-data-type-selector.cjs.entry.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/current-user-info/current-user-info.css +7 -0
- package/dist/collection/components/current-user-info/current-user-info.js +4 -2
- package/dist/collection/components/current-user-info/current-user-info.js.map +1 -1
- package/dist/collection/components/current-user-info/helpers.js +38 -1
- package/dist/collection/components/current-user-info/helpers.js.map +1 -1
- package/dist/collection/components/data-type-selector/data-type-selector.css +24 -0
- package/dist/collection/components/data-type-selector/data-type-selector.js +275 -0
- package/dist/collection/components/data-type-selector/data-type-selector.js.map +1 -0
- package/dist/collection/components/data-type-selector/gx-ide-assets/data-type-selector/langs/data-type-selector.lang.en.json +13 -0
- package/dist/collection/components/data-type-selector/gx-ide-assets/data-type-selector/langs/data-type-selector.lang.ja.json +13 -0
- package/dist/collection/components/data-type-selector/gx-ide-assets/data-type-selector/langs/data-type-selector.lang.zh.json +13 -0
- package/dist/collection/components/data-type-selector/helpers.js +38 -0
- package/dist/collection/components/data-type-selector/helpers.js.map +1 -0
- package/dist/collection/components/kb-manager-import/kb-manager-import.js +1 -1
- package/dist/collection/components/team-dev/update/update.js +1 -1
- package/dist/collection/testing/locale.e2e.js +1 -0
- package/dist/collection/testing/locale.e2e.js.map +1 -1
- package/dist/components/gx-ide-current-user-info.js +42 -3
- package/dist/components/gx-ide-current-user-info.js.map +1 -1
- package/dist/components/gx-ide-data-type-selector.d.ts +11 -0
- package/dist/components/gx-ide-data-type-selector.js +258 -0
- package/dist/components/gx-ide-data-type-selector.js.map +1 -0
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-current-user-info.entry.js +42 -3
- package/dist/esm/gx-ide-current-user-info.entry.js.map +1 -1
- package/dist/esm/gx-ide-data-type-selector.entry.js +222 -0
- package/dist/esm/gx-ide-data-type-selector.entry.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js.map +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/data-type-selector/langs/data-type-selector.lang.en.json +13 -0
- package/dist/genexus-ide-ui/gx-ide-assets/data-type-selector/langs/data-type-selector.lang.ja.json +13 -0
- package/dist/genexus-ide-ui/gx-ide-assets/data-type-selector/langs/data-type-selector.lang.zh.json +13 -0
- package/dist/genexus-ide-ui/p-a3a43593.entry.js +255 -0
- package/dist/genexus-ide-ui/p-a3a43593.entry.js.map +1 -0
- package/dist/genexus-ide-ui/{p-dd890eed.entry.js → p-c2ec8185.entry.js} +85 -46
- package/dist/genexus-ide-ui/p-c2ec8185.entry.js.map +1 -0
- package/dist/types/components/current-user-info/helpers.d.ts +24 -1
- package/dist/types/components/data-type-selector/data-type-selector.d.ts +46 -0
- package/dist/types/components/data-type-selector/helpers.d.ts +4 -0
- package/dist/types/components.d.ts +39 -0
- package/package.json +2 -1
- package/dist/genexus-ide-ui/p-dd890eed.entry.js.map +0 -1
package/dist/genexus-ide-ui/gx-ide-assets/data-type-selector/langs/data-type-selector.lang.en.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"componentName": "Data Type Selector",
|
|
3
|
+
"loader": {
|
|
4
|
+
"title": "Loading Data Types",
|
|
5
|
+
"description": "Hango on please..."
|
|
6
|
+
},
|
|
7
|
+
"fixedTypes": {
|
|
8
|
+
"all": "All",
|
|
9
|
+
"recentlyUsed": "Recently Used"
|
|
10
|
+
},
|
|
11
|
+
"select": "Select",
|
|
12
|
+
"selectedCategory": "Selected Cateogry: "
|
|
13
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { r as t, h as e, H as s, g as i } from "./p-49712340.js";
|
|
2
|
+
|
|
3
|
+
import { g as o } from "./p-b81d21d5.js";
|
|
4
|
+
|
|
5
|
+
import { L as n } from "./p-311eedf3.js";
|
|
6
|
+
|
|
7
|
+
const mapCategoryToListItemGroup = t => {
|
|
8
|
+
const e = {
|
|
9
|
+
caption: t.name,
|
|
10
|
+
id: t.name,
|
|
11
|
+
type: "group",
|
|
12
|
+
expanded: true,
|
|
13
|
+
expandable: true,
|
|
14
|
+
items: t.types.map((t => ({
|
|
15
|
+
caption: t.name,
|
|
16
|
+
id: t.name,
|
|
17
|
+
additionalInformation: {
|
|
18
|
+
"stretch-start": {
|
|
19
|
+
center: [ {
|
|
20
|
+
imgSrc: t.icon
|
|
21
|
+
} ]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
type: "actionable"
|
|
25
|
+
})))
|
|
26
|
+
};
|
|
27
|
+
return e;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const mapDataTypesToList = t => t.map(((t, e) => ({
|
|
31
|
+
caption: t.name,
|
|
32
|
+
id: t.name,
|
|
33
|
+
additionalInformation: {
|
|
34
|
+
"stretch-start": {
|
|
35
|
+
center: [ {
|
|
36
|
+
imgSrc: t.icon || undefined
|
|
37
|
+
} ]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
type: "actionable",
|
|
41
|
+
order: e
|
|
42
|
+
})));
|
|
43
|
+
|
|
44
|
+
const r = ":host{position:relative;display:grid;block-size:100%;overflow:auto;grid-template-rows:1fr max-content;--control__border-width:var(--mer-border__width--sm);--control__border-radius:var(--mer-border__radius--sm)}.main{display:contents}.selected-category{margin:0;text-transform:capitalize;margin-inline-start:var(--mer-spacing--md);white-space:nowrap}.footer{overflow:auto}";
|
|
45
|
+
|
|
46
|
+
var a = undefined && undefined.__classPrivateFieldGet || function(t, e, s, i) {
|
|
47
|
+
if (s === "a" && !i) throw new TypeError("Private accessor was defined without a getter");
|
|
48
|
+
if (typeof e === "function" ? t !== e || !i : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
49
|
+
return s === "m" ? i : s === "a" ? i.call(t) : i ? i.value : e.get(t);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var c = undefined && undefined.__classPrivateFieldSet || function(t, e, s, i, o) {
|
|
53
|
+
if (i === "m") throw new TypeError("Private method is not writable");
|
|
54
|
+
if (i === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
|
|
55
|
+
if (typeof e === "function" ? t !== e || !o : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
56
|
+
return i === "a" ? o.call(t, s) : o ? o.value = s : e.set(t, s), s;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
var h, l, d, f, p, u, m, b;
|
|
60
|
+
|
|
61
|
+
const g = [ "resets/box-sizing", "components/tab", "components/tooltip", "components/list-box", "components/tree-view", "utils/form--full", "utils/layout", "utils/typography", "utils/spacing", "chameleon/scrollbar" ];
|
|
62
|
+
|
|
63
|
+
const y = "all";
|
|
64
|
+
|
|
65
|
+
const w = "recenttly-used";
|
|
66
|
+
|
|
67
|
+
const v = o({
|
|
68
|
+
category: "system",
|
|
69
|
+
name: "time",
|
|
70
|
+
colorType: "primary"
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const k = class {
|
|
74
|
+
constructor(s) {
|
|
75
|
+
t(this, s);
|
|
76
|
+
h.set(this, void 0);
|
|
77
|
+
l.set(this, false);
|
|
78
|
+
d.set(this, new Map);
|
|
79
|
+
f.set(this, (t => {
|
|
80
|
+
var e;
|
|
81
|
+
const s = (e = t.detail[0]) === null || e === void 0 ? void 0 : e.item.type;
|
|
82
|
+
if (s === "actionable") {
|
|
83
|
+
const e = t.detail[0].item.caption;
|
|
84
|
+
const s = t.detail[0].item.additionalInformation["stretch-start"].center[0];
|
|
85
|
+
const i = s.imgSrc;
|
|
86
|
+
this.dataTypeSelectedCallback({
|
|
87
|
+
name: e,
|
|
88
|
+
icon: i
|
|
89
|
+
});
|
|
90
|
+
a(this, p, "f").call(this, t.detail[0].item.caption, "actionable");
|
|
91
|
+
} else if (s === "group") {
|
|
92
|
+
a(this, p, "f").call(this, t.detail[0].item.caption, "group");
|
|
93
|
+
}
|
|
94
|
+
}));
|
|
95
|
+
p.set(this, ((t, e) => {
|
|
96
|
+
if (this.selectedCategory === w) {
|
|
97
|
+
this.recentlyUsedActionListModel.forEach((t => {
|
|
98
|
+
// clear selected
|
|
99
|
+
t.selected = false;
|
|
100
|
+
}));
|
|
101
|
+
const e = this.recentlyUsed.findIndex((e => e.name === t));
|
|
102
|
+
if (e !== -1) {
|
|
103
|
+
this.recentlyUsedActionListModel[e].selected = true;
|
|
104
|
+
}
|
|
105
|
+
} else if (e === "group" && a(this, d, "f").has(t)) {
|
|
106
|
+
const e = a(this, d, "f").get(t);
|
|
107
|
+
const s = Object.assign(Object.assign({}, e), {
|
|
108
|
+
expanded: e.expanded
|
|
109
|
+
});
|
|
110
|
+
a(this, d, "f").set(t, s);
|
|
111
|
+
}
|
|
112
|
+
}));
|
|
113
|
+
u.set(this, (() => {
|
|
114
|
+
if (!a(this, l, "f")) {
|
|
115
|
+
const t = [];
|
|
116
|
+
let e = 1;
|
|
117
|
+
const s = a(this, d, "f").size;
|
|
118
|
+
for (const i of a(this, d, "f").keys()) {
|
|
119
|
+
t.push(a(this, d, "f").get(i));
|
|
120
|
+
if (e !== s) {
|
|
121
|
+
t.push({
|
|
122
|
+
type: "separator"
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
e++;
|
|
126
|
+
}
|
|
127
|
+
this.categoriesListBoxModel = t;
|
|
128
|
+
c(this, l, true, "f");
|
|
129
|
+
this.selectedCategory = y;
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
m.set(this, (() => {
|
|
133
|
+
c(this, l, false, "f");
|
|
134
|
+
this.categoriesListBoxModel = this.recentlyUsedActionListModel;
|
|
135
|
+
this.selectedCategory = w;
|
|
136
|
+
}));
|
|
137
|
+
this.selectedCategoryHandler = t => {
|
|
138
|
+
this.selectedCategory = t.currentTarget.dataset.name;
|
|
139
|
+
const e = [ a(this, d, "f").get(this.selectedCategory) ];
|
|
140
|
+
this.categoriesListBoxModel = e;
|
|
141
|
+
c(this, l, false, "f");
|
|
142
|
+
};
|
|
143
|
+
b.set(this, (() => {
|
|
144
|
+
const t = this.selectedCategory === w ? "button-secondary" : "button-tertiary";
|
|
145
|
+
const s = this.selectedCategory === y ? "button-secondary" : "button-tertiary";
|
|
146
|
+
let i = this.selectedCategory;
|
|
147
|
+
if (this.selectedCategory === w) {
|
|
148
|
+
i = a(this, h, "f").fixedTypes.recentlyUsed;
|
|
149
|
+
} else if (this.selectedCategory === y) {
|
|
150
|
+
i = a(this, h, "f").fixedTypes.all;
|
|
151
|
+
} else {
|
|
152
|
+
i = this.selectedCategory;
|
|
153
|
+
}
|
|
154
|
+
return e("footer", {
|
|
155
|
+
class: "footer control-footer control-footer-start spacing-body-inline spacing-body-block scrollable\n "
|
|
156
|
+
}, e("div", {
|
|
157
|
+
class: "buttons-spacer"
|
|
158
|
+
}, this.recentlyUsed && this.recentlyUsed.length > 0 && e("button", {
|
|
159
|
+
class: `button-icon-only ${t}`,
|
|
160
|
+
"aria-label": `${a(this, h, "f").select} ${a(this, h, "f").fixedTypes.recentlyUsed}`,
|
|
161
|
+
title: `${a(this, h, "f").select} ${a(this, h, "f").fixedTypes.recentlyUsed}`,
|
|
162
|
+
onClick: a(this, m, "f")
|
|
163
|
+
}, e("ch-image", {
|
|
164
|
+
class: "icon-md",
|
|
165
|
+
src: v
|
|
166
|
+
})), e("button", {
|
|
167
|
+
class: `button-icon-only ${s}`,
|
|
168
|
+
onClick: a(this, u, "f"),
|
|
169
|
+
"aria-label": `${a(this, h, "f").select} ${a(this, h, "f").fixedTypes.all}`,
|
|
170
|
+
title: `${a(this, h, "f").select} ${a(this, h, "f").fixedTypes.all}`
|
|
171
|
+
}, "[*]"), this.categories.map((t => {
|
|
172
|
+
const s = t.name === this.selectedCategory ? "button-secondary" : "button-tertiary";
|
|
173
|
+
return e("button", {
|
|
174
|
+
class: `button-icon-only ${s}`,
|
|
175
|
+
"aria-label": t.name,
|
|
176
|
+
title: t.name,
|
|
177
|
+
onClick: this.selectedCategoryHandler,
|
|
178
|
+
"data-name": t.name
|
|
179
|
+
}, e("ch-image", {
|
|
180
|
+
class: "icon-md",
|
|
181
|
+
src: t.icon
|
|
182
|
+
}));
|
|
183
|
+
}))), e("p", {
|
|
184
|
+
class: "text-body-regular-s selected-category"
|
|
185
|
+
}, i));
|
|
186
|
+
}));
|
|
187
|
+
this.categoriesListBoxModel = [];
|
|
188
|
+
this.selectedCategory = undefined;
|
|
189
|
+
this.statusInfo = [];
|
|
190
|
+
this.recentlyUsedActionListModel = [];
|
|
191
|
+
this.loading = true;
|
|
192
|
+
this.categories = undefined;
|
|
193
|
+
this.dataTypeSelectedCallback = undefined;
|
|
194
|
+
this.recentlyUsed = [];
|
|
195
|
+
}
|
|
196
|
+
categoriesChanged(t) {
|
|
197
|
+
if (!(t === null || t === void 0 ? void 0 : t.length)) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
a(this, d, "f").clear();
|
|
201
|
+
t.forEach((t => {
|
|
202
|
+
const e = mapCategoryToListItemGroup(t);
|
|
203
|
+
a(this, d, "f").set(t.name, e);
|
|
204
|
+
}));
|
|
205
|
+
this.loading = false;
|
|
206
|
+
a(this, u, "f").call(this);
|
|
207
|
+
}
|
|
208
|
+
recentlyUsedChanged(t) {
|
|
209
|
+
this.recentlyUsedActionListModel = null;
|
|
210
|
+
this.recentlyUsedActionListModel = mapDataTypesToList(t);
|
|
211
|
+
}
|
|
212
|
+
async componentWillLoad() {
|
|
213
|
+
c(this, h, await n.getComponentStrings(this.el), "f");
|
|
214
|
+
// initialize models
|
|
215
|
+
this.recentlyUsed.length && this.recentlyUsedChanged(this.recentlyUsed);
|
|
216
|
+
}
|
|
217
|
+
render() {
|
|
218
|
+
return e(s, {
|
|
219
|
+
class: "widget"
|
|
220
|
+
}, e("ch-theme", {
|
|
221
|
+
model: g
|
|
222
|
+
}), this.loading ? e("gx-ide-loader", {
|
|
223
|
+
loaderTitle: a(this, h, "f").loader.title,
|
|
224
|
+
description: a(this, h, "f").loader.description,
|
|
225
|
+
show: true
|
|
226
|
+
}) : e("section", {
|
|
227
|
+
class: "main"
|
|
228
|
+
}, e("ch-action-list-render", {
|
|
229
|
+
class: "list-box",
|
|
230
|
+
model: this.categoriesListBoxModel,
|
|
231
|
+
selection: "single",
|
|
232
|
+
onSelectedItemsChange: a(this, f, "f")
|
|
233
|
+
}), a(this, b, "f").call(this)));
|
|
234
|
+
}
|
|
235
|
+
static get assetsDirs() {
|
|
236
|
+
return [ "gx-ide-assets/data-type-selector" ];
|
|
237
|
+
}
|
|
238
|
+
get el() {
|
|
239
|
+
return i(this);
|
|
240
|
+
}
|
|
241
|
+
static get watchers() {
|
|
242
|
+
return {
|
|
243
|
+
categories: [ "categoriesChanged" ],
|
|
244
|
+
recentlyUsed: [ "recentlyUsedChanged" ]
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
h = new WeakMap, l = new WeakMap, d = new WeakMap, f = new WeakMap, p = new WeakMap,
|
|
250
|
+
u = new WeakMap, m = new WeakMap, b = new WeakMap;
|
|
251
|
+
|
|
252
|
+
k.style = r;
|
|
253
|
+
|
|
254
|
+
export { k as gx_ide_data_type_selector };
|
|
255
|
+
//# sourceMappingURL=p-a3a43593.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["mapCategoryToListItemGroup","category","categoryGroup","caption","name","id","type","expanded","expandable","items","types","map","additionalInformation","center","imgSrc","icon","mapDataTypesToList","dataTypes","dataType","index","undefined","order","dataTypeSelectorCss","CSS_BUNDLES","ALL_CATEGORY_ID","RECENTLY_USED_CATEGORY_ID","CLOCK_ICON","getIconPath","colorType","GxIdeKbManagerImport","_GxIdeKbManagerImport__componentLocale","set","this","_GxIdeKbManagerImport_showAll","_GxIdeKbManagerImport_categoriesActionListItemGroupMap","Map","_GxIdeKbManagerImport_handleSelectionChange","event","eventType","_a","detail","item","itemAdditionalBase","dataTypeSelectedCallback","__classPrivateFieldGet","_GxIdeKbManagerImport_updateListBoxModelState","call","selectedCategory","recentlyUsedActionListModel","forEach","selected","selectedItemIndex","recentlyUsed","findIndex","has","group","get","groupUpdated","Object","assign","_GxIdeKbManagerImport_showAllObjects","allCategoriesActionListModel","counter","mapLength","size","key","keys","push","categoriesListBoxModel","__classPrivateFieldSet","_GxIdeKbManagerImport_showRecentlyObjects","selectedCategoryHandler","e","currentTarget","dataset","newSelectedCategory","_GxIdeKbManagerImport_renderFooter","recentlyUsedBtnClass","allBtnClass","selectedCategoryDescription","fixedTypes","all","h","class","length","select","title","onClick","src","categories","buttonClass","categoriesChanged","newCategories","clear","categoryListBoxModel","loading","recentlyUsedChanged","newRecentlyUsed","componentWillLoad","Locale","getComponentStrings","el","render","Host","model","loaderTitle","loader","description","show","selection","onSelectedItemsChange"],"sources":["src/components/data-type-selector/helpers.ts","src/components/data-type-selector/data-type-selector.scss?tag=gx-ide-data-type-selector&encapsulation=shadow","src/components/data-type-selector/data-type-selector.tsx"],"sourcesContent":["import { DataTypeCategoryData, DataTypeData } from \"./data-type-selector\";\nimport {\n ActionListItemGroup,\n ActionListModel\n} from \"@genexus/chameleon-controls-library/dist/types/components/action-list/types\";\n\nexport const mapCategoryToListItemGroup = (\n category: DataTypeCategoryData\n): ActionListItemGroup => {\n const categoryGroup: ActionListItemGroup = {\n caption: category.name,\n id: category.name,\n type: \"group\",\n expanded: true,\n expandable: true,\n items: category.types.map(type => {\n return {\n caption: type.name,\n id: type.name,\n additionalInformation: {\n \"stretch-start\": {\n center: [{ imgSrc: type.icon }]\n }\n },\n type: \"actionable\"\n };\n })\n };\n return categoryGroup;\n};\n\nexport const mapDataTypesToList = (\n dataTypes: DataTypeData[]\n): ActionListModel => {\n return dataTypes.map((dataType, index) => {\n return {\n caption: dataType.name,\n id: dataType.name,\n additionalInformation: {\n \"stretch-start\": {\n center: [{ imgSrc: dataType.icon || undefined }]\n }\n },\n type: \"actionable\",\n order: index\n };\n });\n};\n",":host {\n position: relative;\n display: grid;\n block-size: 100%;\n overflow: auto;\n grid-template-rows: 1fr max-content;\n\n // WA: Prevent a custom css rule on genexus-web from overriding --control__border-width value.\n // TDOO: remove this when the custom style is removed from genexus-web.\n // custom stlye is: .gx-struct-editor .tabular-grid-cell {\n // --control__border-width: 0;\n // }\n\n --control__border-width: var(--mer-border__width--sm);\n --control__border-radius: var(--mer-border__radius--sm);\n}\n\n.main {\n display: contents;\n}\n\n.selected-category {\n margin: 0;\n text-transform: capitalize;\n margin-inline-start: var(\n --mer-spacing--md\n ); // TODO: Create a semantic class in Mercury for this case.\n white-space: nowrap;\n}\n\n.footer {\n overflow: auto;\n}\n","// Stencil\nimport { Component, Host, h, Prop, Element, State, Watch } from \"@stencil/core\";\n// Other Libraries\nimport { MercuryBundles, getIconPath } from \"@genexus/mercury\";\nimport {\n ActionListItemActionable,\n ActionListItemModel,\n ActionListItemModelExtended,\n ActionListItemType,\n ActionListModel\n} from \"@genexus/chameleon-controls-library\";\nimport {\n ActionListItemAdditionalBase,\n ActionListItemGroup\n} from \"@genexus/chameleon-controls-library/dist/types/components/action-list/types\";\n// Gx Ide Ui\nimport { Locale } from \"../../common/locale\";\nimport { mapCategoryToListItemGroup, mapDataTypesToList } from \"./helpers\";\n\nconst CSS_BUNDLES: MercuryBundles = [\n \"resets/box-sizing\",\n \"components/tab\",\n \"components/tooltip\",\n \"components/list-box\",\n \"components/tree-view\",\n \"utils/form--full\",\n \"utils/layout\",\n \"utils/typography\",\n \"utils/spacing\",\n \"chameleon/scrollbar\"\n];\n\nconst ALL_CATEGORY_ID = \"all\";\nconst RECENTLY_USED_CATEGORY_ID = \"recenttly-used\";\n\nconst CLOCK_ICON = getIconPath({\n category: \"system\",\n name: \"time\",\n colorType: \"primary\"\n});\n\n@Component({\n tag: \"gx-ide-data-type-selector\",\n styleUrl: \"data-type-selector.scss\",\n shadow: true,\n assetsDirs: [\"gx-ide-assets/data-type-selector\"]\n})\nexport class GxIdeKbManagerImport {\n #_componentLocale: any;\n #showAll: boolean = false;\n #categoriesActionListItemGroupMap: Map<string, ActionListItemGroup> = new Map<\n string,\n ActionListItemGroup\n >();\n\n @Element() el: HTMLGxIdeDataTypeSelectorElement;\n\n @State() categoriesListBoxModel: ActionListItemModel[] = [];\n @State() selectedCategory: string;\n @State() statusInfo: StatusInfo[] = [];\n @State() recentlyUsedActionListModel: ActionListModel = [];\n @State() loading: boolean = true;\n\n /**\n * All possible types and its category\n */\n @Prop() readonly categories: DataTypeCategoryData[] = undefined;\n @Watch(\"categories\")\n categoriesChanged(newCategories: DataTypeCategoryData[]) {\n if (!newCategories?.length) {\n return;\n }\n this.#categoriesActionListItemGroupMap.clear();\n newCategories.forEach(category => {\n const categoryListBoxModel = mapCategoryToListItemGroup(category);\n this.#categoriesActionListItemGroupMap.set(\n category.name,\n categoryListBoxModel\n );\n });\n this.loading = false;\n this.#showAllObjects();\n }\n\n /**\n * Callback invoked when user select an item type\n */\n @Prop() readonly dataTypeSelectedCallback: DataTypeSelectedCallback;\n\n /**\n * All recently used types list\n */\n @Prop() readonly recentlyUsed: DataTypeData[] = [];\n @Watch(\"recentlyUsed\")\n recentlyUsedChanged(newRecentlyUsed: DataTypeData[]) {\n this.recentlyUsedActionListModel = null;\n this.recentlyUsedActionListModel = mapDataTypesToList(newRecentlyUsed);\n }\n\n async componentWillLoad() {\n this.#_componentLocale = await Locale.getComponentStrings(this.el);\n // initialize models\n this.recentlyUsed.length && this.recentlyUsedChanged(this.recentlyUsed);\n }\n\n #handleSelectionChange = (\n event: CustomEvent<ActionListItemModelExtended[]>\n ) => {\n const eventType = event.detail[0]?.item.type;\n if (eventType === \"actionable\") {\n const name = event.detail[0].item.caption;\n\n const itemAdditionalBase = event.detail[0].item.additionalInformation[\n \"stretch-start\"\n ].center[0] as ActionListItemAdditionalBase;\n const icon = itemAdditionalBase.imgSrc;\n\n this.dataTypeSelectedCallback({\n name: name,\n icon: icon\n });\n\n this.#updateListBoxModelState(event.detail[0].item.caption, \"actionable\");\n } else if (eventType === \"group\") {\n this.#updateListBoxModelState(event.detail[0].item.caption, \"group\");\n }\n };\n\n #updateListBoxModelState = (name: string, type: ActionListItemType) => {\n if (this.selectedCategory === RECENTLY_USED_CATEGORY_ID) {\n this.recentlyUsedActionListModel.forEach(item => {\n // clear selected\n (item as ActionListItemActionable).selected = false;\n });\n const selectedItemIndex = this.recentlyUsed.findIndex(\n item => item.name === name\n );\n if (selectedItemIndex !== -1) {\n (\n this.recentlyUsedActionListModel[\n selectedItemIndex\n ] as ActionListItemActionable\n ).selected = true;\n }\n } else if (\n type === \"group\" &&\n this.#categoriesActionListItemGroupMap.has(name)\n ) {\n const group = this.#categoriesActionListItemGroupMap.get(\n name\n ) as ActionListItemGroup;\n const groupUpdated = { ...group, expanded: group.expanded };\n this.#categoriesActionListItemGroupMap.set(name, groupUpdated);\n }\n };\n\n #showAllObjects = () => {\n if (!this.#showAll) {\n const allCategoriesActionListModel: ActionListItemModel[] = [];\n let counter = 1;\n const mapLength = this.#categoriesActionListItemGroupMap.size;\n for (const key of this.#categoriesActionListItemGroupMap.keys()) {\n allCategoriesActionListModel.push(\n this.#categoriesActionListItemGroupMap.get(key)\n );\n if (counter !== mapLength) {\n allCategoriesActionListModel.push({ type: \"separator\" });\n }\n counter++;\n }\n this.categoriesListBoxModel = allCategoriesActionListModel;\n this.#showAll = true;\n this.selectedCategory = ALL_CATEGORY_ID;\n }\n };\n\n #showRecentlyObjects = () => {\n this.#showAll = false;\n this.categoriesListBoxModel = this.recentlyUsedActionListModel;\n this.selectedCategory = RECENTLY_USED_CATEGORY_ID;\n };\n\n private selectedCategoryHandler = (e: MouseEvent) => {\n this.selectedCategory = (e.currentTarget as HTMLButtonElement).dataset.name;\n const newSelectedCategory = [\n this.#categoriesActionListItemGroupMap.get(this.selectedCategory)\n ];\n this.categoriesListBoxModel = newSelectedCategory;\n this.#showAll = false;\n };\n\n #renderFooter = () => {\n const recentlyUsedBtnClass =\n this.selectedCategory === RECENTLY_USED_CATEGORY_ID\n ? \"button-secondary\"\n : \"button-tertiary\";\n const allBtnClass =\n this.selectedCategory === ALL_CATEGORY_ID\n ? \"button-secondary\"\n : \"button-tertiary\";\n let selectedCategoryDescription = this.selectedCategory;\n if (this.selectedCategory === RECENTLY_USED_CATEGORY_ID) {\n selectedCategoryDescription =\n this.#_componentLocale.fixedTypes.recentlyUsed;\n } else if (this.selectedCategory === ALL_CATEGORY_ID) {\n selectedCategoryDescription = this.#_componentLocale.fixedTypes.all;\n } else {\n selectedCategoryDescription = this.selectedCategory;\n }\n\n return (\n <footer\n class=\"footer control-footer control-footer-start spacing-body-inline spacing-body-block scrollable\n \"\n >\n <div class=\"buttons-spacer\">\n {this.recentlyUsed && this.recentlyUsed.length > 0 && (\n <button\n class={`button-icon-only ${recentlyUsedBtnClass}`}\n aria-label={`${this.#_componentLocale.select} ${\n this.#_componentLocale.fixedTypes.recentlyUsed\n }`}\n title={`${this.#_componentLocale.select} ${\n this.#_componentLocale.fixedTypes.recentlyUsed\n }`}\n onClick={this.#showRecentlyObjects}\n >\n <ch-image class=\"icon-md\" src={CLOCK_ICON}></ch-image>\n </button>\n )}\n <button\n class={`button-icon-only ${allBtnClass}`}\n onClick={this.#showAllObjects}\n aria-label={`${this.#_componentLocale.select} ${\n this.#_componentLocale.fixedTypes.all\n }`}\n title={`${this.#_componentLocale.select} ${\n this.#_componentLocale.fixedTypes.all\n }`}\n >\n [*]\n </button>\n {this.categories.map(category => {\n const buttonClass =\n category.name === this.selectedCategory\n ? \"button-secondary\"\n : \"button-tertiary\";\n\n return (\n <button\n class={`button-icon-only ${buttonClass}`}\n aria-label={category.name}\n title={category.name}\n onClick={this.selectedCategoryHandler}\n data-name={category.name}\n >\n <ch-image class=\"icon-md\" src={category.icon}></ch-image>\n </button>\n );\n })}\n </div>\n <p class=\"text-body-regular-s selected-category\">\n {selectedCategoryDescription}\n </p>\n </footer>\n );\n };\n\n render(): void {\n return (\n <Host class=\"widget\">\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n {this.loading ? (\n <gx-ide-loader\n loaderTitle={this.#_componentLocale.loader.title}\n description={this.#_componentLocale.loader.description}\n show\n ></gx-ide-loader>\n ) : (\n <section class=\"main\">\n <ch-action-list-render\n class=\"list-box\"\n model={this.categoriesListBoxModel}\n selection=\"single\"\n onSelectedItemsChange={this.#handleSelectionChange}\n ></ch-action-list-render>\n {this.#renderFooter()}\n </section>\n )}\n </Host>\n );\n }\n}\n\ntype StatusInfo = {\n [key: string]: {\n display: boolean;\n };\n};\n\nexport type DataTypeCategoryData = {\n name: string;\n icon: string;\n types: DataTypeData[];\n};\nexport type DataTypeData = {\n name: string;\n icon: string;\n};\n\nexport type DataTypeSelectedCallback = (data: {\n name: string;\n icon: string;\n}) => Promise<void>;\n"],"mappings":";;;;;;AAMO,MAAMA,6BACXC;EAEA,MAAMC,IAAqC;IACzCC,SAASF,EAASG;IAClBC,IAAIJ,EAASG;IACbE,MAAM;IACNC,UAAU;IACVC,YAAY;IACZC,OAAOR,EAASS,MAAMC,KAAIL,MACjB;MACLH,SAASG,EAAKF;MACdC,IAAIC,EAAKF;MACTQ,uBAAuB;QACrB,iBAAiB;UACfC,QAAQ,EAAC;YAAEC,QAAQR,EAAKS;;;;MAG5BT,MAAM;;;EAIZ,OAAOJ;AAAa;;AAGf,MAAMc,qBACXC,KAEOA,EAAUN,KAAI,CAACO,GAAUC,OACvB;EACLhB,SAASe,EAASd;EAClBC,IAAIa,EAASd;EACbQ,uBAAuB;IACrB,iBAAiB;MACfC,QAAQ,EAA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|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { r as e, h as t, H as i, g as n } from "./p-49712340.js";
|
|
2
|
+
|
|
3
|
+
import { g as o } from "./p-b81d21d5.js";
|
|
4
|
+
|
|
5
|
+
import { L as r } from "./p-311eedf3.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns initials from the first two words of a name. Returns "X" for invalid input.
|
|
9
|
+
*
|
|
10
|
+
* @param name - The full name string.
|
|
11
|
+
* @returns Initials of the first two words, or "X" if invalid.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* getInitialsFromName("John Doe") -> "JD"
|
|
15
|
+
* getInitialsFromName("Jane") -> "J"
|
|
16
|
+
* getInitialsFromName("") -> "X"
|
|
17
|
+
*/ const getInitialsFromName = e => {
|
|
18
|
+
if (typeof e !== "string" || e.trim() === "") {
|
|
19
|
+
return "X";
|
|
20
|
+
}
|
|
21
|
+
const t = e.split(" ").filter(Boolean);
|
|
22
|
+
// Remove any empty strings from splitting
|
|
23
|
+
if (t.length === 1) {
|
|
10
24
|
return t[0][0].toUpperCase();
|
|
11
25
|
} else {
|
|
12
26
|
return `${t[0][0].toUpperCase()}${t[1][0].toUpperCase()}`;
|
|
13
27
|
}
|
|
14
28
|
};
|
|
15
29
|
|
|
16
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Limits the full name to the first two words. Returns null for invalid input.
|
|
32
|
+
*
|
|
33
|
+
* @param fullName - The full name string to be limited.
|
|
34
|
+
* @returns The first two words of the full name, or null if invalid.
|
|
35
|
+
*
|
|
36
|
+
* Example:
|
|
37
|
+
* limitFullName("John Doe Smith") -> "John Doe"
|
|
38
|
+
* limitFullName("Jane") -> "Jane"
|
|
39
|
+
* limitFullName("") -> null
|
|
40
|
+
*/ const limitFullName = e => {
|
|
41
|
+
if (typeof e !== "string" || e.trim() === "") {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const t = e.split(" ").filter(Boolean);
|
|
45
|
+
// Remove any empty strings from splitting
|
|
46
|
+
if (t.length === 1) {
|
|
47
|
+
return t[0];
|
|
48
|
+
} else {
|
|
49
|
+
return `${t[0]} ${t[1]}`;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const s = "@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}:host{display:inline-grid;justify-items:end;block-size:100%}.user-login__button{all:unset;display:grid;grid-template-columns:max-content max-content max-content;align-items:center;gap:var(--mer-spacing--sm);block-size:auto;cursor:pointer}.user-login__details{display:grid;grid-template-rows:max-content max-content;gap:var(--mer-spacing--3xs);justify-items:end}.user-login__name{font-weight:var(--mer-font__weight--medium);font-size:var(--mer-font__size--3xs);color:var(--mer-text__on-elevation)}.user-login__organization{font-weight:var(--mer-font__weight--light);font-size:var(--mer-font__size--4xs);color:var(--mer-text__neutral)}.user-login__name,.user-login__organization{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-inline-size:120px;display:inline-block}.user-login__avatar{font-size:9px;flex:0 0 auto;display:flex;align-items:center;justify-content:center;block-size:var(--mer-spacing--lg);inline-size:var(--mer-spacing--lg);color:var(--mer-text__on-elevation);border-radius:50%;background-color:var(--mer-color__tinted-primary--10);border:var(--mer-border__width--sm) solid var(--mer-color__primary--200)}.privacy-policy{text-decoration:underline;cursor:pointer}";
|
|
17
54
|
|
|
18
|
-
var a = undefined && undefined.__classPrivateFieldSet || function(e, t, i,
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
if (typeof t === "function" ? e !== t || !
|
|
22
|
-
return
|
|
55
|
+
var a = undefined && undefined.__classPrivateFieldSet || function(e, t, i, n, o) {
|
|
56
|
+
if (n === "m") throw new TypeError("Private method is not writable");
|
|
57
|
+
if (n === "a" && !o) throw new TypeError("Private accessor was defined without a setter");
|
|
58
|
+
if (typeof t === "function" ? e !== t || !o : !t.has(e)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
59
|
+
return n === "a" ? o.call(e, i) : o ? o.value = i : t.set(e, i), i;
|
|
23
60
|
};
|
|
24
61
|
|
|
25
|
-
var
|
|
26
|
-
if (i === "a" && !
|
|
27
|
-
if (typeof t === "function" ? e !== t || !
|
|
28
|
-
return i === "m" ?
|
|
62
|
+
var l = undefined && undefined.__classPrivateFieldGet || function(e, t, i, n) {
|
|
63
|
+
if (i === "a" && !n) throw new TypeError("Private accessor was defined without a getter");
|
|
64
|
+
if (typeof t === "function" ? e !== t || !n : !t.has(e)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
65
|
+
return i === "m" ? n : i === "a" ? n.call(e) : n ? n.value : t.get(e);
|
|
29
66
|
};
|
|
30
67
|
|
|
31
|
-
var
|
|
68
|
+
var c, d, f, u, p;
|
|
32
69
|
|
|
33
|
-
const
|
|
70
|
+
const m = [
|
|
34
71
|
// TODO: review if "utils/form--full" is required.
|
|
35
72
|
"resets/box-sizing", "components/tooltip", "components/toggle", "components/icon", "components/dropdown", "utils/layout", "utils/typography", "utils/spacing", "chameleon/scrollbar" ];
|
|
36
73
|
|
|
37
|
-
const h =
|
|
74
|
+
const h = o({
|
|
38
75
|
category: "navigation",
|
|
39
76
|
name: "chevron-down",
|
|
40
77
|
colorType: "neutral"
|
|
@@ -44,14 +81,14 @@ const g = "my-account";
|
|
|
44
81
|
|
|
45
82
|
const _ = "change-team";
|
|
46
83
|
|
|
47
|
-
const
|
|
84
|
+
const v = "sign-out";
|
|
48
85
|
|
|
49
|
-
const
|
|
86
|
+
const w = "language";
|
|
50
87
|
|
|
51
88
|
const y = class {
|
|
52
89
|
constructor(t) {
|
|
53
90
|
e(this, t);
|
|
54
|
-
|
|
91
|
+
c.set(this, void 0);
|
|
55
92
|
d.set(this, "");
|
|
56
93
|
// #mode: Mode;
|
|
57
94
|
f.set(this, void 0);
|
|
@@ -62,14 +99,14 @@ const y = class {
|
|
|
62
99
|
// this.changeModeCallback(this.#mode);
|
|
63
100
|
// }
|
|
64
101
|
// };
|
|
65
|
-
|
|
102
|
+
p.set(this, ((e, t, i) => {
|
|
66
103
|
if (i === g) {
|
|
67
104
|
this.myAccountCallback();
|
|
68
105
|
} else if (i === _) {
|
|
69
106
|
this.changeTeamCallback();
|
|
70
|
-
} else if (i === w) {
|
|
71
|
-
this.signOutCallback();
|
|
72
107
|
} else if (i === v) {
|
|
108
|
+
this.signOutCallback();
|
|
109
|
+
} else if (i === w) {
|
|
73
110
|
this.changeLanguageCallback();
|
|
74
111
|
}
|
|
75
112
|
}));
|
|
@@ -83,67 +120,69 @@ const y = class {
|
|
|
83
120
|
this.showTermsCallback = undefined;
|
|
84
121
|
}
|
|
85
122
|
async componentWillLoad() {
|
|
86
|
-
a(this,
|
|
123
|
+
a(this, c, await r.getComponentStrings(this.el), "f");
|
|
87
124
|
a(this, d, getInitialsFromName(this.userInfo.name), "f");
|
|
88
125
|
a(this, f, [ {
|
|
89
126
|
id: g,
|
|
90
|
-
caption:
|
|
127
|
+
caption: l(this, c, "f").myAccountLabel,
|
|
91
128
|
showSeparator: false
|
|
92
129
|
}, {
|
|
93
130
|
id: _,
|
|
94
|
-
caption:
|
|
131
|
+
caption: l(this, c, "f").changeTeamLabel,
|
|
95
132
|
showSeparator: false
|
|
96
133
|
}, {
|
|
97
|
-
id:
|
|
98
|
-
caption:
|
|
134
|
+
id: v,
|
|
135
|
+
caption: l(this, c, "f").signOutLabel,
|
|
99
136
|
showSeparator: true
|
|
100
137
|
} ], "f");
|
|
101
138
|
}
|
|
102
139
|
render() {
|
|
140
|
+
var e, n;
|
|
141
|
+
const o = limitFullName((e = this.userInfo) === null || e === void 0 ? void 0 : e.name);
|
|
103
142
|
return t(i, {
|
|
104
143
|
class: "widget"
|
|
105
144
|
}, t("ch-theme", {
|
|
106
|
-
model:
|
|
145
|
+
model: m
|
|
107
146
|
}), t("ch-dropdown-render", {
|
|
108
147
|
class: "dropdown",
|
|
109
|
-
model:
|
|
148
|
+
model: l(this, f, "f"),
|
|
110
149
|
position: "InsideEnd_OutsideEnd",
|
|
111
|
-
itemClickCallback:
|
|
150
|
+
itemClickCallback: l(this, p, "f")
|
|
112
151
|
}, t("button", {
|
|
113
152
|
class: "user-login__button",
|
|
114
153
|
ref: e => a(this, u, e, "f"),
|
|
115
154
|
slot: "action"
|
|
116
155
|
}, t("div", {
|
|
117
156
|
class: "user-login__details"
|
|
118
|
-
}, t("span", {
|
|
157
|
+
}, o ? t("span", {
|
|
119
158
|
class: "user-login__name"
|
|
120
|
-
}, this.userInfo.
|
|
159
|
+
}, o) : null, ((n = this.userInfo) === null || n === void 0 ? void 0 : n.team) ? t("span", {
|
|
121
160
|
class: "user-login__organization"
|
|
122
|
-
}, this.userInfo.team)), t("div", {
|
|
161
|
+
}, this.userInfo.team) : null), t("div", {
|
|
123
162
|
class: "user-login__avatar"
|
|
124
|
-
},
|
|
163
|
+
}, l(this, d, "f")), t("ch-image", {
|
|
125
164
|
src: h,
|
|
126
165
|
class: "icon-md",
|
|
127
|
-
containerRef:
|
|
166
|
+
containerRef: l(this, u, "f")
|
|
128
167
|
})), t("div", {
|
|
129
168
|
class: "user-login__footer footer-slot",
|
|
130
169
|
slot: "footer"
|
|
131
170
|
}, t("p", {
|
|
132
171
|
class: "text-body-regular-s privacy-policy",
|
|
133
172
|
onClick: this.showTermsCallback
|
|
134
|
-
},
|
|
173
|
+
}, l(this, c, "f").privacyAndTerms))));
|
|
135
174
|
}
|
|
136
175
|
static get assetsDirs() {
|
|
137
176
|
return [ "gx-ide-assets/current-user-info" ];
|
|
138
177
|
}
|
|
139
178
|
get el() {
|
|
140
|
-
return
|
|
179
|
+
return n(this);
|
|
141
180
|
}
|
|
142
181
|
};
|
|
143
182
|
|
|
144
|
-
|
|
183
|
+
c = new WeakMap, d = new WeakMap, f = new WeakMap, u = new WeakMap, p = new WeakMap;
|
|
145
184
|
|
|
146
|
-
y.style =
|
|
185
|
+
y.style = s;
|
|
147
186
|
|
|
148
187
|
export { y as gx_ide_current_user_info };
|
|
149
|
-
//# sourceMappingURL=p-
|
|
188
|
+
//# sourceMappingURL=p-c2ec8185.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getInitialsFromName","name","trim","nameData","split","filter","Boolean","length","toUpperCase","limitFullName","fullName","fullNameData","currentUserInfoCss","CSS_BUNDLES","CHEVRON_DOWN_ICON","getIconPath","category","colorType","MY_ACCOUNT_ID","CHANGE_TEAM_ID","SIGN_OUT_ID","LANGUAGE_ID","GxIdeNewEnvironment","_GxIdeNewEnvironment_componentLocale","set","this","_GxIdeNewEnvironment_initials","_GxIdeNewEnvironment_menuDropdownModel","_GxIdeNewEnvironment_userLoginButton","_GxIdeNewEnvironment_dropDownitemClickHandler","_event","_target","itemId","myAccountCallback","changeTeamCallback","signOutCallback","changeLanguageCallback","componentWillLoad","__classPrivateFieldSet","Locale","getComponentStrings","el","userInfo","id","caption","__classPrivateFieldGet","myAccountLabel","showSeparator","changeTeamLabel","signOutLabel","render","userName","_a","h","Host","class","model","position","itemClickCallback","ref","slot","_b","team","src","containerRef","onClick","showTermsCallback","privacyAndTerms"],"sources":["src/components/current-user-info/helpers.tsx","src/components/current-user-info/current-user-info.scss?tag=gx-ide-current-user-info&encapsulation=shadow","src/components/current-user-info/current-user-info.tsx"],"sourcesContent":["/**\n * Returns initials from the first two words of a name. Returns \"X\" for invalid input.\n *\n * @param name - The full name string.\n * @returns Initials of the first two words, or \"X\" if invalid.\n *\n * Example:\n * getInitialsFromName(\"John Doe\") -> \"JD\"\n * getInitialsFromName(\"Jane\") -> \"J\"\n * getInitialsFromName(\"\") -> \"X\"\n */\nexport const getInitialsFromName = (name: string): string | null => {\n if (typeof name !== \"string\" || name.trim() === \"\") {\n return \"X\";\n }\n\n const nameData = name.split(\" \").filter(Boolean); // Remove any empty strings from splitting\n if (nameData.length === 1) {\n return nameData[0][0].toUpperCase();\n } else {\n return `${nameData[0][0].toUpperCase()}${nameData[1][0].toUpperCase()}`;\n }\n};\n\n/**\n * Limits the full name to the first two words. Returns null for invalid input.\n *\n * @param fullName - The full name string to be limited.\n * @returns The first two words of the full name, or null if invalid.\n *\n * Example:\n * limitFullName(\"John Doe Smith\") -> \"John Doe\"\n * limitFullName(\"Jane\") -> \"Jane\"\n * limitFullName(\"\") -> null\n */\nexport const limitFullName = (fullName: string): string | null => {\n if (typeof fullName !== \"string\" || fullName.trim() === \"\") {\n return null;\n }\n\n const fullNameData = fullName.split(\" \").filter(Boolean); // Remove any empty strings from splitting\n if (fullNameData.length === 1) {\n return fullNameData[0];\n } else {\n return `${fullNameData[0]} ${fullNameData[1]}`;\n }\n};\n","@import \"../../../node_modules/@genexus/mercury/dist/mercury.scss\";\n\n:host {\n display: inline-grid;\n justify-items: end;\n block-size: 100%;\n}\n\n.user-login {\n &__button {\n all: unset;\n display: grid;\n grid-template-columns: max-content max-content max-content;\n align-items: center;\n gap: var(--mer-spacing--sm);\n block-size: auto;\n cursor: pointer;\n }\n &__details {\n display: grid;\n grid-template-rows: max-content max-content;\n gap: var(--mer-spacing--3xs);\n justify-items: end;\n }\n &__name {\n font-weight: var(--mer-font__weight--medium);\n font-size: var(--mer-font__size--3xs);\n color: var(--mer-text__on-elevation);\n }\n &__organization {\n font-weight: var(--mer-font__weight--light);\n font-size: var(--mer-font__size--4xs);\n color: var(--mer-text__neutral);\n }\n &__name,\n &__organization {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-inline-size: 120px;\n display: inline-block;\n }\n &__avatar {\n font-size: 9px;\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n justify-content: center;\n block-size: var(--mer-spacing--lg);\n inline-size: var(--mer-spacing--lg);\n color: var(--mer-text__on-elevation);\n border-radius: 50%;\n background-color: var(--mer-color__tinted-primary--10);\n border: var(--mer-border__width--sm) solid var(--mer-color__primary--200);\n }\n}\n\n.privacy-policy {\n text-decoration: underline;\n cursor: pointer;\n}\n","/* STENCIL IMPORTS */\nimport { Component, Element, Host, Prop, State, h } from \"@stencil/core\";\n\nimport { getIconPath, MercuryBundles } from \"@genexus/mercury\";\n\nimport { Locale } from \"../../common/locale\";\nimport { getInitialsFromName, limitFullName } from \"./helpers\";\nimport { DropdownModel } from \"@genexus/chameleon-controls-library\";\n\nconst CSS_BUNDLES: MercuryBundles = [\n // TODO: review if \"utils/form--full\" is required.\n \"resets/box-sizing\",\n \"components/tooltip\",\n \"components/toggle\",\n \"components/icon\",\n \"components/dropdown\",\n \"utils/layout\",\n \"utils/typography\",\n \"utils/spacing\",\n \"chameleon/scrollbar\"\n];\n\nconst CHEVRON_DOWN_ICON = getIconPath({\n category: \"navigation\",\n name: \"chevron-down\",\n colorType: \"neutral\"\n});\n\nconst MY_ACCOUNT_ID = \"my-account\";\nconst CHANGE_TEAM_ID = \"change-team\";\nconst SIGN_OUT_ID = \"sign-out\";\nconst LANGUAGE_ID = \"language\";\n\n@Component({\n tag: \"gx-ide-current-user-info\",\n styleUrl: \"current-user-info.scss\",\n shadow: true,\n assetsDirs: [\"gx-ide-assets/current-user-info\"]\n})\nexport class GxIdeNewEnvironment {\n #componentLocale: any;\n #initials: string = \"\";\n // #mode: Mode;\n #menuDropdownModel: DropdownModel;\n\n @Element() el: HTMLGxIdeCurrentUserInfoElement;\n #userLoginButton: HTMLButtonElement;\n\n @State() showMenu: boolean = false;\n\n /**\n * User data\n */\n @Prop() readonly userInfo: UserInfo;\n\n /**\n * Callback executed when the user click \"My Account\" link\n */\n @Prop() readonly myAccountCallback!: () => Promise<void>;\n\n /**\n * Callback executed when the user click \"change team\" link\n */\n @Prop() readonly changeTeamCallback!: () => Promise<void>;\n\n /**\n * Callback executed when the user click \"Language\" link\n */\n @Prop() readonly changeLanguageCallback!: () => Promise<void>;\n\n /**\n * Callback executed when the user switch the \"Mode\" status\n */\n @Prop() readonly changeModeCallback!: (mode: Mode) => Promise<void>;\n\n /**\n * Callback executed when the user click \"Sign Out\" link\n */\n @Prop() readonly signOutCallback!: () => Promise<void>;\n\n /**\n * Callback executed when the user click \"Privacy Policy & Terms of use\" link\n */\n @Prop() readonly showTermsCallback!: () => Promise<void>;\n\n async componentWillLoad() {\n this.#componentLocale = await Locale.getComponentStrings(this.el);\n this.#initials = getInitialsFromName(this.userInfo.name);\n this.#menuDropdownModel = [\n {\n id: MY_ACCOUNT_ID,\n caption: this.#componentLocale.myAccountLabel,\n showSeparator: false\n },\n {\n id: CHANGE_TEAM_ID,\n caption: this.#componentLocale.changeTeamLabel,\n showSeparator: false\n },\n {\n id: SIGN_OUT_ID,\n caption: this.#componentLocale.signOutLabel,\n showSeparator: true\n }\n // {\n // id: LANGUAGE_ID,\n // caption: this.#componentLocale.languageLabel,\n // showSeparator: true\n // }\n ];\n }\n\n // #handleModeSwitch = () => {\n // this.#mode = this.#mode === \"dark\" ? \"light\" : \"dark\";\n // if (this.changeModeCallback) {\n // this.changeModeCallback(this.#mode);\n // }\n // };\n\n #dropDownitemClickHandler = (\n _event: UIEvent,\n _target: string,\n itemId: string\n ): void => {\n if (itemId === MY_ACCOUNT_ID) {\n this.myAccountCallback();\n } else if (itemId === CHANGE_TEAM_ID) {\n this.changeTeamCallback();\n } else if (itemId === SIGN_OUT_ID) {\n this.signOutCallback();\n } else if (itemId === LANGUAGE_ID) {\n this.changeLanguageCallback();\n }\n };\n\n render() {\n const userName = limitFullName(this.userInfo?.name);\n return (\n <Host class=\"widget\">\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n <ch-dropdown-render\n class=\"dropdown\"\n model={this.#menuDropdownModel}\n position=\"InsideEnd_OutsideEnd\"\n itemClickCallback={this.#dropDownitemClickHandler}\n >\n <button\n class=\"user-login__button\"\n ref={el => (this.#userLoginButton = el as HTMLButtonElement)}\n slot=\"action\"\n >\n <div class=\"user-login__details\">\n {userName ? (\n <span class=\"user-login__name\">{userName}</span>\n ) : null}\n {this.userInfo?.team ? (\n <span class=\"user-login__organization\">\n {this.userInfo.team}\n </span>\n ) : null}\n </div>\n\n <div class=\"user-login__avatar\">{this.#initials}</div>\n <ch-image\n src={CHEVRON_DOWN_ICON}\n class=\"icon-md\"\n containerRef={this.#userLoginButton}\n ></ch-image>\n </button>\n <div class=\"user-login__footer footer-slot\" slot=\"footer\">\n <p\n class=\"text-body-regular-s privacy-policy\"\n onClick={this.showTermsCallback}\n >\n {this.#componentLocale.privacyAndTerms}\n </p>\n </div>\n </ch-dropdown-render>\n </Host>\n );\n }\n}\n\nexport type UserInfo = {\n name: string;\n team: string;\n};\n\nexport type Mode = \"dark\" | \"light\";\n"],"mappings":";;;;;;;;;;;;;;;;GAWO,OAAMA,sBAAuBC;EAClC,WAAWA,MAAS,YAAYA,EAAKC,WAAW,IAAI;IAClD,OAAO;;EAGT,MAAMC,IAAWF,EAAKG,MAAM,KAAKC,OAAOC;;IACxC,IAAIH,EAASI,WAAW,GAAG;IACzB,OAAOJ,EAAS,GAAG,GAAGK;SACjB;IACL,OAAO,GAAGL,EAAS,GAAG,GAAGK,gBAAgBL,EAAS,GAAG,GAAGK;;;;;;;;;;;;;;GAerD,OAAMC,gBAAiBC;EAC5B,WAAWA,MAAa,YAAYA,EAASR,WAAW,IAAI;IAC1D,OAAO;;EAGT,MAAMS,IAAeD,EAASN,MAAM,KAAKC,OAAOC;;IAChD,IAAIK,EAAaJ,WAAW,GAAG;IAC7B,OAAOI,EAAa;SACf;IACL,OAAO,GAAGA,EAAa,MAAMA,EAAa;;;;AC5C9C,MAAMC,IAAqB;;;;;;;;;;;;;;;;;ACS3B,MAAMC,IAA8B;;AAElC,qBACA,sBACA,qBACA,mBACA,uBACA,gBACA,oBACA,iBACA;;AAGF,MAAMC,IAAoBC,EAAY;EACpCC,UAAU;EACVf,MAAM;EACNgB,WAAW;;;AAGb,MAAMC,IAAgB;;AACtB,MAAMC,IAAiB;;AACvB,MAAMC,IAAc;;AACpB,MAAMC,IAAc;;MAQPC,IAAmB;;;IAC9BC,EAAAC,IAAAC,WAAA;IACAC,EAAAF,IAAAC,MAAoB;;QAEpBE,EAAAH,IAAAC,WAAA;IAGAG,EAAAJ,IAAAC,WAAA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E,OAAM;OAAsBV,EAAApB,MAAIC,GAAA,OACrC2B,EAAA;MACEU,KAAKjD;MACLyC,OAAM;MACNS,cAAcnB,EAAApB,MAAIG,GAAA;SAGtByB,EAAA;MAAKE,OAAM;MAAiCK,MAAK;OAC/CP,EAAA;MACEE,OAAM;MACNU,SAASxC,KAAKyC;OAEbrB,EAAApB,MAAIF,GAAA,KAAkB4C"}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Returns initials from the first two words of a name. Returns "X" for invalid input.
|
|
3
|
+
*
|
|
4
|
+
* @param name - The full name string.
|
|
5
|
+
* @returns Initials of the first two words, or "X" if invalid.
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
* getInitialsFromName("John Doe") -> "JD"
|
|
9
|
+
* getInitialsFromName("Jane") -> "J"
|
|
10
|
+
* getInitialsFromName("") -> "X"
|
|
11
|
+
*/
|
|
12
|
+
export declare const getInitialsFromName: (name: string) => string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Limits the full name to the first two words. Returns null for invalid input.
|
|
15
|
+
*
|
|
16
|
+
* @param fullName - The full name string to be limited.
|
|
17
|
+
* @returns The first two words of the full name, or null if invalid.
|
|
18
|
+
*
|
|
19
|
+
* Example:
|
|
20
|
+
* limitFullName("John Doe Smith") -> "John Doe"
|
|
21
|
+
* limitFullName("Jane") -> "Jane"
|
|
22
|
+
* limitFullName("") -> null
|
|
23
|
+
*/
|
|
24
|
+
export declare const limitFullName: (fullName: string) => string | null;
|