@genexus/genexus-ide-ui 1.0.39 → 1.0.41
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-ai-message.cjs.entry.js +1 -5
- package/dist/cjs/gx-ide-ai-message.cjs.entry.js.map +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/ai-assistant/ai-message.js +1 -5
- package/dist/collection/components/ai-assistant/ai-message.js.map +1 -1
- 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/ai-message.js +1 -5
- package/dist/components/ai-message.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-ai-message.entry.js +1 -5
- package/dist/esm/gx-ide-ai-message.entry.js.map +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/genexus-ide-ui/{p-6e993843.entry.js → p-d15caa11.entry.js} +2 -6
- package/dist/genexus-ide-ui/p-d15caa11.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-6e993843.entry.js.map +0 -1
- package/dist/genexus-ide-ui/p-dd890eed.entry.js.map +0 -1
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f)
|
|
3
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
5
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
6
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
9
|
+
if (kind === "m")
|
|
10
|
+
throw new TypeError("Private method is not writable");
|
|
11
|
+
if (kind === "a" && !f)
|
|
12
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
14
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
15
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
16
|
+
};
|
|
17
|
+
var _GxIdeKbManagerImport__componentLocale, _GxIdeKbManagerImport_showAll, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, _GxIdeKbManagerImport_handleSelectionChange, _GxIdeKbManagerImport_updateListBoxModelState, _GxIdeKbManagerImport_showAllObjects, _GxIdeKbManagerImport_showRecentlyObjects, _GxIdeKbManagerImport_renderFooter;
|
|
18
|
+
// Stencil
|
|
19
|
+
import { Host, h } from "@stencil/core";
|
|
20
|
+
// Other Libraries
|
|
21
|
+
import { getIconPath } from "@genexus/mercury";
|
|
22
|
+
// Gx Ide Ui
|
|
23
|
+
import { Locale } from "../../common/locale";
|
|
24
|
+
import { mapCategoryToListItemGroup, mapDataTypesToList } from "./helpers";
|
|
25
|
+
const CSS_BUNDLES = [
|
|
26
|
+
"resets/box-sizing",
|
|
27
|
+
"components/tab",
|
|
28
|
+
"components/tooltip",
|
|
29
|
+
"components/list-box",
|
|
30
|
+
"components/tree-view",
|
|
31
|
+
"utils/form--full",
|
|
32
|
+
"utils/layout",
|
|
33
|
+
"utils/typography",
|
|
34
|
+
"utils/spacing",
|
|
35
|
+
"chameleon/scrollbar"
|
|
36
|
+
];
|
|
37
|
+
const ALL_CATEGORY_ID = "all";
|
|
38
|
+
const RECENTLY_USED_CATEGORY_ID = "recenttly-used";
|
|
39
|
+
const CLOCK_ICON = getIconPath({
|
|
40
|
+
category: "system",
|
|
41
|
+
name: "time",
|
|
42
|
+
colorType: "primary"
|
|
43
|
+
});
|
|
44
|
+
export class GxIdeKbManagerImport {
|
|
45
|
+
constructor() {
|
|
46
|
+
_GxIdeKbManagerImport__componentLocale.set(this, void 0);
|
|
47
|
+
_GxIdeKbManagerImport_showAll.set(this, false);
|
|
48
|
+
_GxIdeKbManagerImport_categoriesActionListItemGroupMap.set(this, new Map());
|
|
49
|
+
_GxIdeKbManagerImport_handleSelectionChange.set(this, (event) => {
|
|
50
|
+
var _a;
|
|
51
|
+
const eventType = (_a = event.detail[0]) === null || _a === void 0 ? void 0 : _a.item.type;
|
|
52
|
+
if (eventType === "actionable") {
|
|
53
|
+
const name = event.detail[0].item.caption;
|
|
54
|
+
const itemAdditionalBase = event.detail[0].item.additionalInformation["stretch-start"].center[0];
|
|
55
|
+
const icon = itemAdditionalBase.imgSrc;
|
|
56
|
+
this.dataTypeSelectedCallback({
|
|
57
|
+
name: name,
|
|
58
|
+
icon: icon
|
|
59
|
+
});
|
|
60
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_updateListBoxModelState, "f").call(this, event.detail[0].item.caption, "actionable");
|
|
61
|
+
}
|
|
62
|
+
else if (eventType === "group") {
|
|
63
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_updateListBoxModelState, "f").call(this, event.detail[0].item.caption, "group");
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
_GxIdeKbManagerImport_updateListBoxModelState.set(this, (name, type) => {
|
|
67
|
+
if (this.selectedCategory === RECENTLY_USED_CATEGORY_ID) {
|
|
68
|
+
this.recentlyUsedActionListModel.forEach(item => {
|
|
69
|
+
// clear selected
|
|
70
|
+
item.selected = false;
|
|
71
|
+
});
|
|
72
|
+
const selectedItemIndex = this.recentlyUsed.findIndex(item => item.name === name);
|
|
73
|
+
if (selectedItemIndex !== -1) {
|
|
74
|
+
this.recentlyUsedActionListModel[selectedItemIndex].selected = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else if (type === "group" &&
|
|
78
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").has(name)) {
|
|
79
|
+
const group = __classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").get(name);
|
|
80
|
+
const groupUpdated = Object.assign(Object.assign({}, group), { expanded: group.expanded });
|
|
81
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").set(name, groupUpdated);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
_GxIdeKbManagerImport_showAllObjects.set(this, () => {
|
|
85
|
+
if (!__classPrivateFieldGet(this, _GxIdeKbManagerImport_showAll, "f")) {
|
|
86
|
+
const allCategoriesActionListModel = [];
|
|
87
|
+
let counter = 1;
|
|
88
|
+
const mapLength = __classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").size;
|
|
89
|
+
for (const key of __classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").keys()) {
|
|
90
|
+
allCategoriesActionListModel.push(__classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").get(key));
|
|
91
|
+
if (counter !== mapLength) {
|
|
92
|
+
allCategoriesActionListModel.push({ type: "separator" });
|
|
93
|
+
}
|
|
94
|
+
counter++;
|
|
95
|
+
}
|
|
96
|
+
this.categoriesListBoxModel = allCategoriesActionListModel;
|
|
97
|
+
__classPrivateFieldSet(this, _GxIdeKbManagerImport_showAll, true, "f");
|
|
98
|
+
this.selectedCategory = ALL_CATEGORY_ID;
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
_GxIdeKbManagerImport_showRecentlyObjects.set(this, () => {
|
|
102
|
+
__classPrivateFieldSet(this, _GxIdeKbManagerImport_showAll, false, "f");
|
|
103
|
+
this.categoriesListBoxModel = this.recentlyUsedActionListModel;
|
|
104
|
+
this.selectedCategory = RECENTLY_USED_CATEGORY_ID;
|
|
105
|
+
});
|
|
106
|
+
this.selectedCategoryHandler = (e) => {
|
|
107
|
+
this.selectedCategory = e.currentTarget.dataset.name;
|
|
108
|
+
const newSelectedCategory = [
|
|
109
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").get(this.selectedCategory)
|
|
110
|
+
];
|
|
111
|
+
this.categoriesListBoxModel = newSelectedCategory;
|
|
112
|
+
__classPrivateFieldSet(this, _GxIdeKbManagerImport_showAll, false, "f");
|
|
113
|
+
};
|
|
114
|
+
_GxIdeKbManagerImport_renderFooter.set(this, () => {
|
|
115
|
+
const recentlyUsedBtnClass = this.selectedCategory === RECENTLY_USED_CATEGORY_ID
|
|
116
|
+
? "button-secondary"
|
|
117
|
+
: "button-tertiary";
|
|
118
|
+
const allBtnClass = this.selectedCategory === ALL_CATEGORY_ID
|
|
119
|
+
? "button-secondary"
|
|
120
|
+
: "button-tertiary";
|
|
121
|
+
let selectedCategoryDescription = this.selectedCategory;
|
|
122
|
+
if (this.selectedCategory === RECENTLY_USED_CATEGORY_ID) {
|
|
123
|
+
selectedCategoryDescription =
|
|
124
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").fixedTypes.recentlyUsed;
|
|
125
|
+
}
|
|
126
|
+
else if (this.selectedCategory === ALL_CATEGORY_ID) {
|
|
127
|
+
selectedCategoryDescription = __classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").fixedTypes.all;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
selectedCategoryDescription = this.selectedCategory;
|
|
131
|
+
}
|
|
132
|
+
return (h("footer", { class: "footer control-footer control-footer-start spacing-body-inline spacing-body-block scrollable\n " }, h("div", { class: "buttons-spacer" }, this.recentlyUsed && this.recentlyUsed.length > 0 && (h("button", { class: `button-icon-only ${recentlyUsedBtnClass}`, "aria-label": `${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").select} ${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").fixedTypes.recentlyUsed}`, title: `${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").select} ${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").fixedTypes.recentlyUsed}`, onClick: __classPrivateFieldGet(this, _GxIdeKbManagerImport_showRecentlyObjects, "f") }, h("ch-image", { class: "icon-md", src: CLOCK_ICON }))), h("button", { class: `button-icon-only ${allBtnClass}`, onClick: __classPrivateFieldGet(this, _GxIdeKbManagerImport_showAllObjects, "f"), "aria-label": `${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").select} ${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").fixedTypes.all}`, title: `${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").select} ${__classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").fixedTypes.all}` }, "[*]"), this.categories.map(category => {
|
|
133
|
+
const buttonClass = category.name === this.selectedCategory
|
|
134
|
+
? "button-secondary"
|
|
135
|
+
: "button-tertiary";
|
|
136
|
+
return (h("button", { class: `button-icon-only ${buttonClass}`, "aria-label": category.name, title: category.name, onClick: this.selectedCategoryHandler, "data-name": category.name }, h("ch-image", { class: "icon-md", src: category.icon })));
|
|
137
|
+
})), h("p", { class: "text-body-regular-s selected-category" }, selectedCategoryDescription)));
|
|
138
|
+
});
|
|
139
|
+
this.categoriesListBoxModel = [];
|
|
140
|
+
this.selectedCategory = undefined;
|
|
141
|
+
this.statusInfo = [];
|
|
142
|
+
this.recentlyUsedActionListModel = [];
|
|
143
|
+
this.loading = true;
|
|
144
|
+
this.categories = undefined;
|
|
145
|
+
this.dataTypeSelectedCallback = undefined;
|
|
146
|
+
this.recentlyUsed = [];
|
|
147
|
+
}
|
|
148
|
+
categoriesChanged(newCategories) {
|
|
149
|
+
if (!(newCategories === null || newCategories === void 0 ? void 0 : newCategories.length)) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").clear();
|
|
153
|
+
newCategories.forEach(category => {
|
|
154
|
+
const categoryListBoxModel = mapCategoryToListItemGroup(category);
|
|
155
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_categoriesActionListItemGroupMap, "f").set(category.name, categoryListBoxModel);
|
|
156
|
+
});
|
|
157
|
+
this.loading = false;
|
|
158
|
+
__classPrivateFieldGet(this, _GxIdeKbManagerImport_showAllObjects, "f").call(this);
|
|
159
|
+
}
|
|
160
|
+
recentlyUsedChanged(newRecentlyUsed) {
|
|
161
|
+
this.recentlyUsedActionListModel = null;
|
|
162
|
+
this.recentlyUsedActionListModel = mapDataTypesToList(newRecentlyUsed);
|
|
163
|
+
}
|
|
164
|
+
async componentWillLoad() {
|
|
165
|
+
__classPrivateFieldSet(this, _GxIdeKbManagerImport__componentLocale, await Locale.getComponentStrings(this.el), "f");
|
|
166
|
+
// initialize models
|
|
167
|
+
this.recentlyUsed.length && this.recentlyUsedChanged(this.recentlyUsed);
|
|
168
|
+
}
|
|
169
|
+
render() {
|
|
170
|
+
return (h(Host, { class: "widget" }, h("ch-theme", { model: CSS_BUNDLES }), this.loading ? (h("gx-ide-loader", { loaderTitle: __classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").loader.title, description: __classPrivateFieldGet(this, _GxIdeKbManagerImport__componentLocale, "f").loader.description, show: true })) : (h("section", { class: "main" }, h("ch-action-list-render", { class: "list-box", model: this.categoriesListBoxModel, selection: "single", onSelectedItemsChange: __classPrivateFieldGet(this, _GxIdeKbManagerImport_handleSelectionChange, "f") }), __classPrivateFieldGet(this, _GxIdeKbManagerImport_renderFooter, "f").call(this)))));
|
|
171
|
+
}
|
|
172
|
+
static get is() { return "gx-ide-data-type-selector"; }
|
|
173
|
+
static get encapsulation() { return "shadow"; }
|
|
174
|
+
static get originalStyleUrls() {
|
|
175
|
+
return {
|
|
176
|
+
"$": ["data-type-selector.scss"]
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
static get styleUrls() {
|
|
180
|
+
return {
|
|
181
|
+
"$": ["data-type-selector.css"]
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
static get assetsDirs() { return ["gx-ide-assets/data-type-selector"]; }
|
|
185
|
+
static get properties() {
|
|
186
|
+
return {
|
|
187
|
+
"categories": {
|
|
188
|
+
"type": "unknown",
|
|
189
|
+
"mutable": false,
|
|
190
|
+
"complexType": {
|
|
191
|
+
"original": "DataTypeCategoryData[]",
|
|
192
|
+
"resolved": "DataTypeCategoryData[]",
|
|
193
|
+
"references": {
|
|
194
|
+
"DataTypeCategoryData": {
|
|
195
|
+
"location": "local",
|
|
196
|
+
"path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/data-type-selector/data-type-selector.tsx",
|
|
197
|
+
"id": "src/components/data-type-selector/data-type-selector.tsx::DataTypeCategoryData"
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"required": false,
|
|
202
|
+
"optional": false,
|
|
203
|
+
"docs": {
|
|
204
|
+
"tags": [],
|
|
205
|
+
"text": "All possible types and its category"
|
|
206
|
+
},
|
|
207
|
+
"defaultValue": "undefined"
|
|
208
|
+
},
|
|
209
|
+
"dataTypeSelectedCallback": {
|
|
210
|
+
"type": "unknown",
|
|
211
|
+
"mutable": false,
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "DataTypeSelectedCallback",
|
|
214
|
+
"resolved": "(data: { name: string; icon: string; }) => Promise<void>",
|
|
215
|
+
"references": {
|
|
216
|
+
"DataTypeSelectedCallback": {
|
|
217
|
+
"location": "local",
|
|
218
|
+
"path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/data-type-selector/data-type-selector.tsx",
|
|
219
|
+
"id": "src/components/data-type-selector/data-type-selector.tsx::DataTypeSelectedCallback"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"required": false,
|
|
224
|
+
"optional": false,
|
|
225
|
+
"docs": {
|
|
226
|
+
"tags": [],
|
|
227
|
+
"text": "Callback invoked when user select an item type"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"recentlyUsed": {
|
|
231
|
+
"type": "unknown",
|
|
232
|
+
"mutable": false,
|
|
233
|
+
"complexType": {
|
|
234
|
+
"original": "DataTypeData[]",
|
|
235
|
+
"resolved": "DataTypeData[]",
|
|
236
|
+
"references": {
|
|
237
|
+
"DataTypeData": {
|
|
238
|
+
"location": "local",
|
|
239
|
+
"path": "/home/runner/work/genexus-ide-ui/genexus-ide-ui/src/components/data-type-selector/data-type-selector.tsx",
|
|
240
|
+
"id": "src/components/data-type-selector/data-type-selector.tsx::DataTypeData"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"required": false,
|
|
245
|
+
"optional": false,
|
|
246
|
+
"docs": {
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": "All recently used types list"
|
|
249
|
+
},
|
|
250
|
+
"defaultValue": "[]"
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
static get states() {
|
|
255
|
+
return {
|
|
256
|
+
"categoriesListBoxModel": {},
|
|
257
|
+
"selectedCategory": {},
|
|
258
|
+
"statusInfo": {},
|
|
259
|
+
"recentlyUsedActionListModel": {},
|
|
260
|
+
"loading": {}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
static get elementRef() { return "el"; }
|
|
264
|
+
static get watchers() {
|
|
265
|
+
return [{
|
|
266
|
+
"propName": "categories",
|
|
267
|
+
"methodName": "categoriesChanged"
|
|
268
|
+
}, {
|
|
269
|
+
"propName": "recentlyUsed",
|
|
270
|
+
"methodName": "recentlyUsedChanged"
|
|
271
|
+
}];
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
_GxIdeKbManagerImport__componentLocale = new WeakMap(), _GxIdeKbManagerImport_showAll = new WeakMap(), _GxIdeKbManagerImport_categoriesActionListItemGroupMap = new WeakMap(), _GxIdeKbManagerImport_handleSelectionChange = new WeakMap(), _GxIdeKbManagerImport_updateListBoxModelState = new WeakMap(), _GxIdeKbManagerImport_showAllObjects = new WeakMap(), _GxIdeKbManagerImport_showRecentlyObjects = new WeakMap(), _GxIdeKbManagerImport_renderFooter = new WeakMap();
|
|
275
|
+
//# sourceMappingURL=data-type-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-type-selector.js","sourceRoot":"","sources":["../../../src/components/data-type-selector/data-type-selector.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,UAAU;AACV,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAChF,kBAAkB;AAClB,OAAO,EAAkB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAY/D,YAAY;AACZ,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE3E,MAAM,WAAW,GAAmB;IAClC,mBAAmB;IACnB,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CAAC;IAYD,mBAAmB,CAAC,eAA+B;QACjD,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,2BAA2B,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,uBAAA,IAAI,0CAAqB,MAAM,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,MAAA,CAAC;QACnE,oBAAoB;QACpB,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC1E,CAAC;IAqKD,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAC,QAAQ;YAClB,gBAAU,KAAK,EAAE,WAAW,GAAa;YACxC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACd,qBACE,WAAW,EAAE,uBAAA,IAAI,8CAAkB,CAAC,MAAM,CAAC,KAAK,EAChD,WAAW,EAAE,uBAAA,IAAI,8CAAkB,CAAC,MAAM,CAAC,WAAW,EACtD,IAAI,SACW,CAClB,CAAC,CAAC,CAAC,CACF,eAAS,KAAK,EAAC,MAAM;gBACnB,6BACE,KAAK,EAAC,UAAU,EAChB,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAClC,SAAS,EAAC,QAAQ,EAClB,qBAAqB,EAAE,uBAAA,IAAI,mDAAuB,GAC3B;gBACxB,uBAAA,IAAI,0CAAc,MAAlB,IAAI,CAAgB,CACb,CACX,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["// 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"]}
|
|
@@ -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,38 @@
|
|
|
1
|
+
export const mapCategoryToListItemGroup = (category) => {
|
|
2
|
+
const categoryGroup = {
|
|
3
|
+
caption: category.name,
|
|
4
|
+
id: category.name,
|
|
5
|
+
type: "group",
|
|
6
|
+
expanded: true,
|
|
7
|
+
expandable: true,
|
|
8
|
+
items: category.types.map(type => {
|
|
9
|
+
return {
|
|
10
|
+
caption: type.name,
|
|
11
|
+
id: type.name,
|
|
12
|
+
additionalInformation: {
|
|
13
|
+
"stretch-start": {
|
|
14
|
+
center: [{ imgSrc: type.icon }]
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
type: "actionable"
|
|
18
|
+
};
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
return categoryGroup;
|
|
22
|
+
};
|
|
23
|
+
export const mapDataTypesToList = (dataTypes) => {
|
|
24
|
+
return dataTypes.map((dataType, index) => {
|
|
25
|
+
return {
|
|
26
|
+
caption: dataType.name,
|
|
27
|
+
id: dataType.name,
|
|
28
|
+
additionalInformation: {
|
|
29
|
+
"stretch-start": {
|
|
30
|
+
center: [{ imgSrc: dataType.icon || undefined }]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
type: "actionable",
|
|
34
|
+
order: index
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/components/data-type-selector/helpers.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,QAA8B,EACT,EAAE;IACvB,MAAM,aAAa,GAAwB;QACzC,OAAO,EAAE,QAAQ,CAAC,IAAI;QACtB,EAAE,EAAE,QAAQ,CAAC,IAAI;QACjB,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC/B,OAAO;gBACL,OAAO,EAAE,IAAI,CAAC,IAAI;gBAClB,EAAE,EAAE,IAAI,CAAC,IAAI;gBACb,qBAAqB,EAAE;oBACrB,eAAe,EAAE;wBACf,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;qBAChC;iBACF;gBACD,IAAI,EAAE,YAAY;aACnB,CAAC;QACJ,CAAC,CAAC;KACH,CAAC;IACF,OAAO,aAAa,CAAC;AACvB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,SAAyB,EACR,EAAE;IACnB,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE;QACvC,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,IAAI;YACtB,EAAE,EAAE,QAAQ,CAAC,IAAI;YACjB,qBAAqB,EAAE;gBACrB,eAAe,EAAE;oBACf,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;iBACjD;aACF;YACD,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","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"]}
|
|
@@ -584,7 +584,7 @@ export class GxIdeKbManagerImport {
|
|
|
584
584
|
"signature": "(item: ImportItemResultData) => Promise<void>",
|
|
585
585
|
"parameters": [{
|
|
586
586
|
"name": "item",
|
|
587
|
-
"type": "{ id: string; name: string; status: \"
|
|
587
|
+
"type": "{ id: string; name: string; status: \"error\" | \"success\" | \"warning\"; messages?: string[]; }",
|
|
588
588
|
"docs": ""
|
|
589
589
|
}],
|
|
590
590
|
"references": {
|
|
@@ -342,7 +342,7 @@ export class GxIdeTeamDevUpdate {
|
|
|
342
342
|
"mutable": false,
|
|
343
343
|
"complexType": {
|
|
344
344
|
"original": "GridContextMenuCallback",
|
|
345
|
-
"resolved": "(selection: string[], grid: \"
|
|
345
|
+
"resolved": "(selection: string[], grid: \"results\" | \"update\" | \"ignored\") => Promise<void>",
|
|
346
346
|
"references": {
|
|
347
347
|
"GridContextMenuCallback": {
|
|
348
348
|
"location": "local",
|
|
@@ -98,6 +98,7 @@ const allGeneXusIdeUIComponents = {
|
|
|
98
98
|
"gx-ide-current-user-info": 0,
|
|
99
99
|
"gx-ide-dashboard-home": 0,
|
|
100
100
|
"gx-ide-data-selector": 0,
|
|
101
|
+
"gx-ide-data-type-selector": 0,
|
|
101
102
|
"gx-ide-design-import": 0,
|
|
102
103
|
"gx-ide-directory-selector": 0,
|
|
103
104
|
"gx-ide-edit-module-server": 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.e2e.js","sourceRoot":"","sources":["../../src/testing/locale.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,SAAS,GAAqC;IAClD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;IAC/B,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;IAC/B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE;CACjC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,uBAAoD,EAAE,EAAE;IAC1E,QAAQ,CAAC,YAAY,uBAAuB,GAAG,EAAE,GAAG,EAAE;QACpD,IAAI,IAAa,CAAC;QAClB,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAE5E,8EAA8E;QAC9E,2EAA2E;QAC3E,cAAc;QACd,MAAM,eAAe,GAAG,GAAG,EAAE,CAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;;YACxB,MAAM,aAAa,GAAG,gBAAgB,CAAC;YACvC,MAAM,gBAAgB,GAAG,IAAI,CAAC;YAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC;YAC9B,MAAM,WAAW,GAAG,QAAQ,CAAC;YAC7B,MAAM,cAAc,GAAG,OAAO,CAAC;YAC/B,MAAM,IAAI,GACR,MAAA,MAAA,QAAQ;iBACL,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;iBAC/B,YAAY,CAAC,MAAM,CAAC,0CACnB,OAAO,EAAE,mCAAI,gBAA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,CAAC,SAAwC,CAAC,CAC/E,CAAC;AAEF,0BAA0B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import { E2EPage, newE2EPage } from \"@stencil/core/testing\";\nimport { GeneXusIdeUIControlsTagName } from \"../common/types\";\nimport { haveSameStructure } from \"./same-structure.e2e\";\n\nconst COMPONENT_PREFIX = \"gx-ide-\";\nconst languages: { name: string; attr: string }[] = [\n { name: \"chinese\", attr: \"zh\" },\n { name: \"english\", attr: \"en\" },\n { name: \"japanese\", attr: \"ja\" }\n];\n\nconst testLocale = (componentNameWithPrefix: GeneXusIdeUIControlsTagName) => {\n describe(`[locale][${componentNameWithPrefix}]`, () => {\n let page: E2EPage;\n const componentName = componentNameWithPrefix.replace(COMPONENT_PREFIX, \"\");\n\n // This implementation is a WA since we can't evaluate JS classes in the page.\n // TODO: Implement the locale utility as a function, which can be evaluated\n // in the page\n const getTranslations = () =>\n page.evaluate(component => {\n const ASSETS_FOLDER = \"gx-ide-assets/\";\n const DEFAULT_LANGUAGE = \"en\";\n const LANGS_FOLDER = \"langs/\";\n const LANG_PREFIX = \".lang.\";\n const LANG_EXTENSION = \".json\";\n const lang =\n document\n .getElementsByTagName(\"html\")[0]\n .getAttribute(\"lang\")\n ?.valueOf() ?? DEFAULT_LANGUAGE;\n const folder = `${component}/`;\n\n const path =\n `/build/${ASSETS_FOLDER}${folder}${LANGS_FOLDER}${component}${LANG_PREFIX}${lang}${LANG_EXTENSION}` as const;\n\n return new Promise(resolve => {\n fetch(path)\n .then(async langFile => {\n if (langFile.ok) {\n const fileObject = await langFile.json();\n resolve(fileObject);\n } else {\n resolve(undefined);\n }\n })\n .catch(() => resolve(undefined));\n });\n }, componentName);\n\n beforeEach(async () => {\n page = await newE2EPage({\n failOnConsoleError: true,\n html: \"\" // Necessary\n });\n });\n\n it(\"should work without specifying the language (lang attr) in the browser\", async () => {\n const languageFile: any | undefined = await getTranslations();\n expect(languageFile).toBeTruthy();\n });\n\n it(\"should default to english language when there is no language (lang attr) in the browser\", async () => {\n const languageFile: any | undefined = await getTranslations();\n expect(languageFile).toBeTruthy();\n\n await page.evaluate(() =>\n document.documentElement.setAttribute(\"lang\", \"en\")\n );\n\n const languageEnglishFile: any | undefined = await getTranslations();\n expect(languageEnglishFile).toBeTruthy();\n expect(languageFile).toEqual(languageEnglishFile);\n });\n\n languages.forEach(language => {\n it(`should work with ${language.name} language`, async () => {\n await page.evaluate(\n (attr: string) => document.documentElement.setAttribute(\"lang\", attr),\n language.attr\n );\n const languageFile: any | undefined = await getTranslations();\n expect(languageFile).toBeTruthy();\n });\n });\n\n for (let index = 0; index < languages.length - 1; index++) {\n const language1 = languages[index];\n const language2 = languages[index + 1];\n\n // TODO: Complete all translations. At this moment, Japanese and Chinese\n // translations have missing literals\n it(`should translate the same literals (${language1.name} and ${language2.name})`, async () => {\n await page.evaluate(\n (attr: string) => document.documentElement.setAttribute(\"lang\", attr),\n language1.attr\n );\n const language1File: any | undefined = await getTranslations();\n\n await page.evaluate(\n (attr: string) => document.documentElement.setAttribute(\"lang\", attr),\n language2.attr\n );\n const language2File: any | undefined = await getTranslations();\n\n expect(language1File).toBeTruthy();\n expect(language2File).toBeTruthy();\n expect(haveSameStructure(language1File, language2File)).toBe(true);\n });\n }\n });\n};\n\n// TypeScript does not have a built-in type to exhaust a list with union types\nconst allGeneXusIdeUIComponents: { [key in GeneXusIdeUIControlsTagName]: 0 } = {\n \"gx-ide-ai-assistant\": 0,\n \"gx-ide-ai-message\": 0,\n \"gx-ide-bpm-app-declaration\": 0,\n \"gx-ide-bpm-assign-roles\": 0,\n \"gx-ide-bpm-import-files\": 0,\n \"gx-ide-bpm-import-gxpm\": 0,\n \"gx-ide-bpm-objects-selector\": 0,\n \"gx-ide-bpm-timer-duration\": 0,\n \"gx-ide-card\": 0,\n \"gx-ide-connect-gx-server\": 0,\n \"gx-ide-container\": 0,\n \"gx-ide-create-kb-from-server\": 0,\n \"gx-ide-current-user-info\": 0,\n \"gx-ide-dashboard-home\": 0,\n \"gx-ide-data-selector\": 0,\n \"gx-ide-design-import\": 0,\n \"gx-ide-directory-selector\": 0,\n \"gx-ide-edit-module-server\": 0,\n \"gx-ide-empty-state\": 0,\n \"gx-ide-entity-selector\": 0,\n \"gx-ide-gam-installation-settings\": 0,\n \"gx-ide-kb-manager-export\": 0,\n \"gx-ide-kb-manager-import\": 0,\n \"gx-ide-list-selector\": 0,\n \"gx-ide-list-selector-item\": 0,\n \"gx-ide-loader\": 0,\n \"gx-ide-manage-module-references\": 0,\n \"gx-ide-manage-module-references-v2\": 0,\n \"gx-ide-new-environment\": 0,\n \"gx-ide-new-kb\": 0,\n \"gx-ide-new-object\": 0,\n \"gx-ide-object-selector\": 0,\n \"gx-ide-references\": 0,\n \"gx-ide-select-user-team\": 0,\n \"gx-ide-sign-in\": 0,\n \"gx-ide-sign-in-team\": 0,\n \"gx-ide-share-kb\": 0,\n \"gx-ide-start-page\": 0,\n \"gx-ide-status-buttons\": 0,\n \"gx-ide-switch-panel\": 0,\n \"gx-ide-switcher\": 0,\n \"gx-ide-team-dev-commit\": 0,\n \"gx-ide-team-dev-select-recent-comment\": 0,\n \"gx-ide-team-dev-update\": 0,\n \"gx-ide-team-dev-update-partial-selection\": 0,\n \"gx-ide-team-dev-update-to-revision\": 0,\n \"gx-ide-template\": 0,\n \"gx-ide-test\": 0,\n \"gx-ide-title\": 0,\n \"gx-ide-top-bar\": 0,\n \"gx-ide-wf-settings\": 0,\n \"gx-ide-ww-images\": 0,\n \"gx-ide-navigation-report\": 0,\n \"gx-ide-splash\": 0,\n \"gx-ide-welcome-page\": 0,\n \"gx-ide-bpm-export-xpdl\": 0\n};\n\nconst componentsWithoutTranslations = new Set<GeneXusIdeUIControlsTagName>([\n \"gx-ide-ai-message\",\n \"gx-ide-container\",\n \"gx-ide-directory-selector\",\n \"gx-ide-empty-state\",\n \"gx-ide-list-selector\",\n \"gx-ide-list-selector-item\",\n \"gx-ide-loader\",\n \"gx-ide-switch-panel\",\n \"gx-ide-switcher\",\n \"gx-ide-test\",\n \"gx-ide-title\",\n \"gx-ide-top-bar\"\n]);\n\nconst componentsWithTranslations = Object.keys(\n allGeneXusIdeUIComponents\n).filter(\n component =>\n !componentsWithoutTranslations.has(component as GeneXusIdeUIControlsTagName)\n);\n\ncomponentsWithTranslations.forEach(testLocale);\n"]}
|
|
1
|
+
{"version":3,"file":"locale.e2e.js","sourceRoot":"","sources":["../../src/testing/locale.e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,gBAAgB,GAAG,SAAS,CAAC;AACnC,MAAM,SAAS,GAAqC;IAClD,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;IAC/B,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;IAC/B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE;CACjC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,uBAAoD,EAAE,EAAE;IAC1E,QAAQ,CAAC,YAAY,uBAAuB,GAAG,EAAE,GAAG,EAAE;QACpD,IAAI,IAAa,CAAC;QAClB,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAE5E,8EAA8E;QAC9E,2EAA2E;QAC3E,cAAc;QACd,MAAM,eAAe,GAAG,GAAG,EAAE,CAC3B,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;;YACxB,MAAM,aAAa,GAAG,gBAAgB,CAAC;YACvC,MAAM,gBAAgB,GAAG,IAAI,CAAC;YAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC;YAC9B,MAAM,WAAW,GAAG,QAAQ,CAAC;YAC7B,MAAM,cAAc,GAAG,OAAO,CAAC;YAC/B,MAAM,IAAI,GACR,MAAA,MAA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;CACjB,CAAC,CAAC;AAEH,MAAM,0BAA0B,GAAG,MAAM,CAAC,IAAI,CAC5C,yBAAyB,CAC1B,CAAC,MAAM,CACN,SAAS,CAAC,EAAE,CACV,CAAC,6BAA6B,CAAC,GAAG,CAAC,SAAwC,CAAC,CAC/E,CAAC;AAEF,0BAA0B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC","sourcesContent":["import { E2EPage, newE2EPage } from \"@stencil/core/testing\";\nimport { GeneXusIdeUIControlsTagName } from \"../common/types\";\nimport { haveSameStructure } from \"./same-structure.e2e\";\n\nconst COMPONENT_PREFIX = \"gx-ide-\";\nconst languages: { name: string; attr: string }[] = [\n { name: \"chinese\", attr: \"zh\" },\n { name: \"english\", attr: \"en\" },\n { name: \"japanese\", attr: \"ja\" }\n];\n\nconst testLocale = (componentNameWithPrefix: GeneXusIdeUIControlsTagName) => {\n describe(`[locale][${componentNameWithPrefix}]`, () => {\n let page: E2EPage;\n const componentName = componentNameWithPrefix.replace(COMPONENT_PREFIX, \"\");\n\n // This implementation is a WA since we can't evaluate JS classes in the page.\n // TODO: Implement the locale utility as a function, which can be evaluated\n // in the page\n const getTranslations = () =>\n page.evaluate(component => {\n const ASSETS_FOLDER = \"gx-ide-assets/\";\n const DEFAULT_LANGUAGE = \"en\";\n const LANGS_FOLDER = \"langs/\";\n const LANG_PREFIX = \".lang.\";\n const LANG_EXTENSION = \".json\";\n const lang =\n document\n .getElementsByTagName(\"html\")[0]\n .getAttribute(\"lang\")\n ?.valueOf() ?? DEFAULT_LANGUAGE;\n const folder = `${component}/`;\n\n const path =\n `/build/${ASSETS_FOLDER}${folder}${LANGS_FOLDER}${component}${LANG_PREFIX}${lang}${LANG_EXTENSION}` as const;\n\n return new Promise(resolve => {\n fetch(path)\n .then(async langFile => {\n if (langFile.ok) {\n const fileObject = await langFile.json();\n resolve(fileObject);\n } else {\n resolve(undefined);\n }\n })\n .catch(() => resolve(undefined));\n });\n }, componentName);\n\n beforeEach(async () => {\n page = await newE2EPage({\n failOnConsoleError: true,\n html: \"\" // Necessary\n });\n });\n\n it(\"should work without specifying the language (lang attr) in the browser\", async () => {\n const languageFile: any | undefined = await getTranslations();\n expect(languageFile).toBeTruthy();\n });\n\n it(\"should default to english language when there is no language (lang attr) in the browser\", async () => {\n const languageFile: any | undefined = await getTranslations();\n expect(languageFile).toBeTruthy();\n\n await page.evaluate(() =>\n document.documentElement.setAttribute(\"lang\", \"en\")\n );\n\n const languageEnglishFile: any | undefined = await getTranslations();\n expect(languageEnglishFile).toBeTruthy();\n expect(languageFile).toEqual(languageEnglishFile);\n });\n\n languages.forEach(language => {\n it(`should work with ${language.name} language`, async () => {\n await page.evaluate(\n (attr: string) => document.documentElement.setAttribute(\"lang\", attr),\n language.attr\n );\n const languageFile: any | undefined = await getTranslations();\n expect(languageFile).toBeTruthy();\n });\n });\n\n for (let index = 0; index < languages.length - 1; index++) {\n const language1 = languages[index];\n const language2 = languages[index + 1];\n\n // TODO: Complete all translations. At this moment, Japanese and Chinese\n // translations have missing literals\n it(`should translate the same literals (${language1.name} and ${language2.name})`, async () => {\n await page.evaluate(\n (attr: string) => document.documentElement.setAttribute(\"lang\", attr),\n language1.attr\n );\n const language1File: any | undefined = await getTranslations();\n\n await page.evaluate(\n (attr: string) => document.documentElement.setAttribute(\"lang\", attr),\n language2.attr\n );\n const language2File: any | undefined = await getTranslations();\n\n expect(language1File).toBeTruthy();\n expect(language2File).toBeTruthy();\n expect(haveSameStructure(language1File, language2File)).toBe(true);\n });\n }\n });\n};\n\n// TypeScript does not have a built-in type to exhaust a list with union types\nconst allGeneXusIdeUIComponents: { [key in GeneXusIdeUIControlsTagName]: 0 } = {\n \"gx-ide-ai-assistant\": 0,\n \"gx-ide-ai-message\": 0,\n \"gx-ide-bpm-app-declaration\": 0,\n \"gx-ide-bpm-assign-roles\": 0,\n \"gx-ide-bpm-import-files\": 0,\n \"gx-ide-bpm-import-gxpm\": 0,\n \"gx-ide-bpm-objects-selector\": 0,\n \"gx-ide-bpm-timer-duration\": 0,\n \"gx-ide-card\": 0,\n \"gx-ide-connect-gx-server\": 0,\n \"gx-ide-container\": 0,\n \"gx-ide-create-kb-from-server\": 0,\n \"gx-ide-current-user-info\": 0,\n \"gx-ide-dashboard-home\": 0,\n \"gx-ide-data-selector\": 0,\n \"gx-ide-data-type-selector\": 0,\n \"gx-ide-design-import\": 0,\n \"gx-ide-directory-selector\": 0,\n \"gx-ide-edit-module-server\": 0,\n \"gx-ide-empty-state\": 0,\n \"gx-ide-entity-selector\": 0,\n \"gx-ide-gam-installation-settings\": 0,\n \"gx-ide-kb-manager-export\": 0,\n \"gx-ide-kb-manager-import\": 0,\n \"gx-ide-list-selector\": 0,\n \"gx-ide-list-selector-item\": 0,\n \"gx-ide-loader\": 0,\n \"gx-ide-manage-module-references\": 0,\n \"gx-ide-manage-module-references-v2\": 0,\n \"gx-ide-new-environment\": 0,\n \"gx-ide-new-kb\": 0,\n \"gx-ide-new-object\": 0,\n \"gx-ide-object-selector\": 0,\n \"gx-ide-references\": 0,\n \"gx-ide-select-user-team\": 0,\n \"gx-ide-sign-in\": 0,\n \"gx-ide-sign-in-team\": 0,\n \"gx-ide-share-kb\": 0,\n \"gx-ide-start-page\": 0,\n \"gx-ide-status-buttons\": 0,\n \"gx-ide-switch-panel\": 0,\n \"gx-ide-switcher\": 0,\n \"gx-ide-team-dev-commit\": 0,\n \"gx-ide-team-dev-select-recent-comment\": 0,\n \"gx-ide-team-dev-update\": 0,\n \"gx-ide-team-dev-update-partial-selection\": 0,\n \"gx-ide-team-dev-update-to-revision\": 0,\n \"gx-ide-template\": 0,\n \"gx-ide-test\": 0,\n \"gx-ide-title\": 0,\n \"gx-ide-top-bar\": 0,\n \"gx-ide-wf-settings\": 0,\n \"gx-ide-ww-images\": 0,\n \"gx-ide-navigation-report\": 0,\n \"gx-ide-splash\": 0,\n \"gx-ide-welcome-page\": 0,\n \"gx-ide-bpm-export-xpdl\": 0\n};\n\nconst componentsWithoutTranslations = new Set<GeneXusIdeUIControlsTagName>([\n \"gx-ide-ai-message\",\n \"gx-ide-container\",\n \"gx-ide-directory-selector\",\n \"gx-ide-empty-state\",\n \"gx-ide-list-selector\",\n \"gx-ide-list-selector-item\",\n \"gx-ide-loader\",\n \"gx-ide-switch-panel\",\n \"gx-ide-switcher\",\n \"gx-ide-test\",\n \"gx-ide-title\",\n \"gx-ide-top-bar\"\n]);\n\nconst componentsWithTranslations = Object.keys(\n allGeneXusIdeUIComponents\n).filter(\n component =>\n !componentsWithoutTranslations.has(component as GeneXusIdeUIControlsTagName)\n);\n\ncomponentsWithTranslations.forEach(testLocale);\n"]}
|
|
@@ -24,11 +24,7 @@ const GxIdeAiMessage = /*@__PURE__*/ proxyCustomElement(class GxIdeAiMessage ext
|
|
|
24
24
|
this.__registerHost();
|
|
25
25
|
this.copyable = false;
|
|
26
26
|
this.copyMessage = () => {
|
|
27
|
-
|
|
28
|
-
messageType: this.messageType,
|
|
29
|
-
message: this.message
|
|
30
|
-
}, null, 2);
|
|
31
|
-
navigator.clipboard.writeText(messageInfo);
|
|
27
|
+
navigator.clipboard.writeText(this.message);
|
|
32
28
|
this.showCopiedMessage = true;
|
|
33
29
|
setTimeout(() => {
|
|
34
30
|
this.showCopiedMessage = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"ai-message.js","mappings":";;;;;AAAA,MAAM,YAAY,GAAG,grIAAgrI;;;;;;;;;;ACQrsI,MAAM,SAAS,GAAG,WAAW,CAAC;IAC5B,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;MAQU,cAAc;;;;QAGjB,aAAQ,GAAG,KAAK,CAAC;QA0DjB,gBAAW,GAAG;YACpB,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAChC;gBACE,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,EACD,IAAI,EACJ,CAAC,CACF,CAA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IAAI,EACP,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,CACnC,EACL,IAAI,CAAC,WAAW,KAAK,uBAAuB,IAC3C,WAAK,KAAK,EAAC,mBAAmB,IAC5B,WAAK,KAAK,EAAC,WAAW,GAAO,CACzB,IACJ,IAAI,CACJ,CACF,CACH,EACL;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/ai-assistant/ai-message.scss?tag=gx-ide-ai-message","src/components/ai-assistant/ai-message.tsx"],"sourcesContent":["@import \"../../global/gx-ide-mixins.scss\";\n\n:host {\n font-family: var(--mer-font-family--primary);\n}\n/*--- Messages ---*/\n.message {\n color: var(--mer-color__neutral-gray--100);\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 100ms;\n transition: grid-template-rows 100ms, -ms-grid-rows 100ms;\n &__outer-wrapper {\n overflow: hidden;\n }\n &__inner-wrapper {\n padding: var(--mer-spacing--sm) var(--mer-spacing--sm);\n border-radius: var(--mer-border__radius--sm);\n border-inline-start: var(--mer-border__width--md) solid transparent;\n background-color: var(--mer-color__neutral-gray--1200);\n margin-block-start: var(--mer-spacing--xs);\n position: relative;\n }\n &__header {\n display: flex;\n gap: var(--mer-spacing--xs);\n justify-content: space-between;\n\n .icon-md {\n opacity: 0;\n }\n\n &--in-progress {\n display: contents;\n }\n }\n &__role {\n &:before {\n content: \"\";\n display: grid;\n place-self: center flex-end;\n inline-size: 4px;\n block-size: 4px;\n border-radius: 50%;\n background-color: currentcolor;\n }\n\n font-weight: var(--mer-font__weight--semi-bold);\n margin-block-end: var(--mer-spacing--xs);\n display: inline-grid;\n grid-template-columns: max-content 1fr;\n gap: 8px;\n\n &-description {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n padding-block-start: 2px;\n }\n &--user {\n color: var(--mer-color__primary--300);\n }\n &--assistant {\n }\n &--hidden {\n display: none;\n }\n }\n &__caption {\n font-size: var(--mer-font__size--xs);\n line-height: var(--mer-line-height--regular);\n }\n &--visible {\n grid-template-rows: 1fr;\n }\n &--copying {\n pointer-events: none;\n span:not(.copied),\n .message__caption {\n color: transparent;\n -webkit-user-select: none; /* Safari */\n -ms-user-select: none; /* IE 10 and IE 11 */\n user-select: none; /* Standard syntax */\n }\n }\n /*--- Types of messages ---*/\n &--user {\n .message__inner-wrapper {\n background-color: rgba(91, 167, 255, 0.08);\n border-color: var(--mer-border-color__primary);\n }\n }\n &--assistant-action {\n .message__inner-wrapper {\n background-color: rgba(63, 168, 155, 0.05);\n border-color: var(--mer-border-color__success);\n }\n }\n &--assistant-chat {\n .message__inner-wrapper {\n background-color: var(--mer-surface__elevation--01);\n }\n }\n &--assistant-in-progress {\n color: var(--mer-color__neutral-gray--500);\n .message__inner-wrapper {\n font-style: italic;\n display: grid;\n grid-template-columns: 1fr auto;\n gap: var(--mer-spacing--xs);\n\n .message__caption {\n flex: 1;\n }\n .animation-wrapper {\n flex: none;\n }\n }\n }\n &--assistant-error {\n .message__inner-wrapper {\n background-color: rgba(251, 124, 132, 0.05);\n border-color: var(--mer-border-color__error);\n }\n }\n &--copyable {\n &:hover {\n filter: brightness(1.2);\n .icon-md {\n opacity: 1;\n }\n }\n }\n &:last-child {\n margin-block-end: 0;\n }\n}\n:host(:first-child) {\n .message {\n &__inner-wrapper {\n margin-block-end: 0;\n }\n }\n}\n\n/*--- Dot Pulse Sweet Animation ---*/\n.animation-wrapper {\n width: 45px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n$color: var(--mer-color__neutral-gray--400);\n.dot-pulse {\n position: relative;\n left: -9999px;\n width: 5px;\n height: 5px;\n border-radius: 2.5px;\n background-color: $color;\n color: $color;\n box-shadow: 9999px 0 0 -5px;\n animation: dot-pulse 1.5s infinite linear;\n animation-delay: 0.25s;\n &::before,\n &::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n top: 0;\n width: 5px;\n height: 5px;\n border-radius: 2.5px;\n background-color: $color;\n color: $color;\n }\n &::before {\n box-shadow: 9984px 0 0 -5px;\n animation: dot-pulse-before 1.5s infinite linear;\n animation-delay: 0s;\n }\n &::after {\n box-shadow: 10014px 0 0 -5px;\n animation: dot-pulse-after 1.5s infinite linear;\n animation-delay: 0.5s;\n }\n}\n@keyframes dot-pulse-before {\n 0% {\n box-shadow: 9984px 0 0 -5px;\n }\n 30% {\n box-shadow: 9984px 0 0 2px;\n }\n 60%,\n 100% {\n box-shadow: 9984px 0 0 -5px;\n }\n}\n@keyframes dot-pulse {\n 0% {\n box-shadow: 9999px 0 0 -5px;\n }\n 30% {\n box-shadow: 9999px 0 0 2px;\n }\n 60%,\n 100% {\n box-shadow: 9999px 0 0 -5px;\n }\n}\n@keyframes dot-pulse-after {\n 0% {\n box-shadow: 10014px 0 0 -5px;\n }\n 30% {\n box-shadow: 10014px 0 0 2px;\n }\n 60%,\n 100% {\n box-shadow: 10014px 0 0 -5px;\n }\n}\n\n/*--- Copy Message ---*/\n.copied {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mer-color__neutral-gray--300);\n display: flex;\n gap: var(--mer-spacing--xs);\n opacity: 0;\n animation: fadeIn var(--mer-timing--regular) ease-out forwards;\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@include hiChar;\n","import { Component, h, Prop, Element, State } from \"@stencil/core\";\n\nimport { getIconPath } from \"@genexus/mercury\";\n\nimport { Locale } from \"../../common/locale\";\nimport { MessageType } from \"./ai-assistant\";\nimport { hiChar } from \"../../common/helpers\";\n\nconst COPY_ICON = getIconPath({\n category: \"bpm\",\n name: \"tasks\",\n colorType: \"neutral\"\n});\n\n@Component({\n tag: \"gx-ide-ai-message\",\n styleUrl: \"ai-message.scss\",\n shadow: false,\n assetsDirs: [\"gx-ide-assets/ai-message\"]\n})\nexport class GxIdeAiMessage {\n /* The message allows to be copied*/\n private _componentLocale: any;\n private copyable = false;\n\n @Element() el: HTMLGxIdeAiMessageElement;\n\n /**\n * This wil display the message if true\n */\n @State() visible = false;\n\n /**\n * This wil show the user a text, indicating that the message has been copied\n */\n @State() showCopiedMessage = false;\n\n /**\n * A reference to the gx-ide-ai-assistant host element\n */\n @Prop() readonly aiAssistantHostRef: HTMLGxIdeAiAssistantElement;\n\n /**\n * The actual message\n */\n @Prop() readonly message: string;\n\n /**\n * The message type\n */\n @Prop() readonly messageType: MessageType;\n\n /**\n * The filter value\n */\n @Prop() readonly filterValue: string;\n\n /**\n * It hides the message (used for the filter)\n */\n @Prop() readonly hidden: boolean;\n\n /**\n * An object with the needed string translations.\n */\n @Prop() readonly translations: Translations;\n\n async componentWillLoad() {\n this._componentLocale = await Locale.getComponentStrings(this.el);\n this.evaluateMessageIsCopyable();\n }\n\n componentDidRender() {\n setTimeout(() => {\n /* Without the timeout it appears instantly (no apparent transition)*/\n this.visible = true;\n const messagesList = this.el.parentElement;\n messagesList.scrollTo(0, 0);\n }, 0);\n }\n\n private copyMessage = () => {\n const messageInfo = JSON.stringify(\n {\n messageType: this.messageType,\n message: this.message\n },\n null,\n 2\n );\n\n navigator.clipboard.writeText(messageInfo);\n this.showCopiedMessage = true;\n setTimeout(() => {\n this.showCopiedMessage = false;\n }, 1500);\n };\n\n #buttonMouseDownHandler = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n };\n\n private evaluateMessageIsCopyable = () => {\n this.copyable = this.messageType !== \"assistant-in-progress\";\n };\n\n private evaluateCopyIcon = () => {\n return this.copyable ? (\n <button\n class=\"button-tertiary button-icon-only\"\n aria-label=\"copy\"\n onClick={this.copyMessage}\n onMouseDown={this.#buttonMouseDownHandler}\n >\n <ch-image class=\"icon-md\" src={COPY_ICON}></ch-image>\n </button>\n ) : null;\n };\n\n render() {\n return (\n <li\n class={{\n \"message\": true,\n \"message--visible\": this.visible && !this.hidden,\n [`message--${[this.messageType]}`]: true,\n \"message--assistant\": this.messageType !== \"user\",\n \"message--copyable\": this.copyable,\n \"message--copying\": this.showCopiedMessage\n }}\n >\n <div class=\"message__outer-wrapper\">\n <div\n class={{\n \"message__inner-wrapper\": true\n }}\n >\n {this.messageType === \"user\" ? (\n <div class=\"message__header\">\n <span class=\"message__role message__role--user\">\n <span class=\"message__role-description\">\n {this._componentLocale.you}\n </span>\n </span>\n {this.evaluateCopyIcon()}\n </div>\n ) : (\n <div\n class={{\n \"message__header\": true,\n \"message__header--in-progress\":\n this.messageType === \"assistant-in-progress\"\n }}\n >\n <span\n class={{\n \"message__role\":\n this.messageType !== \"assistant-in-progress\",\n \"message__role--hidden\":\n this.messageType === \"assistant-in-progress\",\n \"message__role--assistant\": true\n }}\n >\n <span class=\"message__role-description\">\n {this._componentLocale.assistant}\n </span>\n </span>\n {this.evaluateCopyIcon()}\n </div>\n )}\n <div\n class={{\n \"message__caption\": true,\n \"message__caption--in-progress\":\n this.messageType === \"assistant-in-progress\"\n }}\n >\n {this.showCopiedMessage ? (\n <span class=\"copied\">\n <ch-image class=\"icon-md\" src={COPY_ICON}></ch-image>\n {this.translations[\"copied\"]}\n </span>\n ) : null}\n {hiChar(this.message, this.filterValue)}\n </div>\n {this.messageType === \"assistant-in-progress\" ? (\n <div class=\"animation-wrapper\">\n <div class=\"dot-pulse\"></div>\n </div>\n ) : null}\n </div>\n </div>\n </li>\n );\n }\n}\n\nexport type Translations = {\n [key: string]: string;\n};\n"],"version":3}
|
|
1
|
+
{"file":"ai-message.js","mappings":";;;;;AAAA,MAAM,YAAY,GAAG,grIAAgrI;;;;;;;;;;ACQrsI,MAAM,SAAS,GAAG,WAAW,CAAC;IAC5B,QAAQ,EAAE,KAAK;IACf,IAAI,EAAE,OAAO;IACb,SAAS,EAAE,SAAS;CACrB,CAAC,CAAC;MAQU,cAAc;;;;QAGjB,aAAQ,GAAG,KAAK,CAAC;QA0DjB,gBAAW,GAAG;YACpB,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,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I,CAAC,WAAW,CAAC,CACnC,EACL,IAAI,CAAC,WAAW,KAAK,uBAAuB,IAC3C,WAAK,KAAK,EAAC,mBAAmB,IAC5B,WAAK,KAAK,EAAC,WAAW,GAAO,CACzB,IACJ,IAAI,CACJ,CACF,CACH,EACL;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/ai-assistant/ai-message.scss?tag=gx-ide-ai-message","src/components/ai-assistant/ai-message.tsx"],"sourcesContent":["@import \"../../global/gx-ide-mixins.scss\";\n\n:host {\n font-family: var(--mer-font-family--primary);\n}\n/*--- Messages ---*/\n.message {\n color: var(--mer-color__neutral-gray--100);\n display: grid;\n grid-template-rows: 0fr;\n transition: grid-template-rows 100ms;\n transition: grid-template-rows 100ms, -ms-grid-rows 100ms;\n &__outer-wrapper {\n overflow: hidden;\n }\n &__inner-wrapper {\n padding: var(--mer-spacing--sm) var(--mer-spacing--sm);\n border-radius: var(--mer-border__radius--sm);\n border-inline-start: var(--mer-border__width--md) solid transparent;\n background-color: var(--mer-color__neutral-gray--1200);\n margin-block-start: var(--mer-spacing--xs);\n position: relative;\n }\n &__header {\n display: flex;\n gap: var(--mer-spacing--xs);\n justify-content: space-between;\n\n .icon-md {\n opacity: 0;\n }\n\n &--in-progress {\n display: contents;\n }\n }\n &__role {\n &:before {\n content: \"\";\n display: grid;\n place-self: center flex-end;\n inline-size: 4px;\n block-size: 4px;\n border-radius: 50%;\n background-color: currentcolor;\n }\n\n font-weight: var(--mer-font__weight--semi-bold);\n margin-block-end: var(--mer-spacing--xs);\n display: inline-grid;\n grid-template-columns: max-content 1fr;\n gap: 8px;\n\n &-description {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: inline-block;\n padding-block-start: 2px;\n }\n &--user {\n color: var(--mer-color__primary--300);\n }\n &--assistant {\n }\n &--hidden {\n display: none;\n }\n }\n &__caption {\n font-size: var(--mer-font__size--xs);\n line-height: var(--mer-line-height--regular);\n }\n &--visible {\n grid-template-rows: 1fr;\n }\n &--copying {\n pointer-events: none;\n span:not(.copied),\n .message__caption {\n color: transparent;\n -webkit-user-select: none; /* Safari */\n -ms-user-select: none; /* IE 10 and IE 11 */\n user-select: none; /* Standard syntax */\n }\n }\n /*--- Types of messages ---*/\n &--user {\n .message__inner-wrapper {\n background-color: rgba(91, 167, 255, 0.08);\n border-color: var(--mer-border-color__primary);\n }\n }\n &--assistant-action {\n .message__inner-wrapper {\n background-color: rgba(63, 168, 155, 0.05);\n border-color: var(--mer-border-color__success);\n }\n }\n &--assistant-chat {\n .message__inner-wrapper {\n background-color: var(--mer-surface__elevation--01);\n }\n }\n &--assistant-in-progress {\n color: var(--mer-color__neutral-gray--500);\n .message__inner-wrapper {\n font-style: italic;\n display: grid;\n grid-template-columns: 1fr auto;\n gap: var(--mer-spacing--xs);\n\n .message__caption {\n flex: 1;\n }\n .animation-wrapper {\n flex: none;\n }\n }\n }\n &--assistant-error {\n .message__inner-wrapper {\n background-color: rgba(251, 124, 132, 0.05);\n border-color: var(--mer-border-color__error);\n }\n }\n &--copyable {\n &:hover {\n filter: brightness(1.2);\n .icon-md {\n opacity: 1;\n }\n }\n }\n &:last-child {\n margin-block-end: 0;\n }\n}\n:host(:first-child) {\n .message {\n &__inner-wrapper {\n margin-block-end: 0;\n }\n }\n}\n\n/*--- Dot Pulse Sweet Animation ---*/\n.animation-wrapper {\n width: 45px;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n$color: var(--mer-color__neutral-gray--400);\n.dot-pulse {\n position: relative;\n left: -9999px;\n width: 5px;\n height: 5px;\n border-radius: 2.5px;\n background-color: $color;\n color: $color;\n box-shadow: 9999px 0 0 -5px;\n animation: dot-pulse 1.5s infinite linear;\n animation-delay: 0.25s;\n &::before,\n &::after {\n content: \"\";\n display: inline-block;\n position: absolute;\n top: 0;\n width: 5px;\n height: 5px;\n border-radius: 2.5px;\n background-color: $color;\n color: $color;\n }\n &::before {\n box-shadow: 9984px 0 0 -5px;\n animation: dot-pulse-before 1.5s infinite linear;\n animation-delay: 0s;\n }\n &::after {\n box-shadow: 10014px 0 0 -5px;\n animation: dot-pulse-after 1.5s infinite linear;\n animation-delay: 0.5s;\n }\n}\n@keyframes dot-pulse-before {\n 0% {\n box-shadow: 9984px 0 0 -5px;\n }\n 30% {\n box-shadow: 9984px 0 0 2px;\n }\n 60%,\n 100% {\n box-shadow: 9984px 0 0 -5px;\n }\n}\n@keyframes dot-pulse {\n 0% {\n box-shadow: 9999px 0 0 -5px;\n }\n 30% {\n box-shadow: 9999px 0 0 2px;\n }\n 60%,\n 100% {\n box-shadow: 9999px 0 0 -5px;\n }\n}\n@keyframes dot-pulse-after {\n 0% {\n box-shadow: 10014px 0 0 -5px;\n }\n 30% {\n box-shadow: 10014px 0 0 2px;\n }\n 60%,\n 100% {\n box-shadow: 10014px 0 0 -5px;\n }\n}\n\n/*--- Copy Message ---*/\n.copied {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--mer-color__neutral-gray--300);\n display: flex;\n gap: var(--mer-spacing--xs);\n opacity: 0;\n animation: fadeIn var(--mer-timing--regular) ease-out forwards;\n}\n\n@keyframes fadeIn {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n@include hiChar;\n","import { Component, h, Prop, Element, State } from \"@stencil/core\";\n\nimport { getIconPath } from \"@genexus/mercury\";\n\nimport { Locale } from \"../../common/locale\";\nimport { MessageType } from \"./ai-assistant\";\nimport { hiChar } from \"../../common/helpers\";\n\nconst COPY_ICON = getIconPath({\n category: \"bpm\",\n name: \"tasks\",\n colorType: \"neutral\"\n});\n\n@Component({\n tag: \"gx-ide-ai-message\",\n styleUrl: \"ai-message.scss\",\n shadow: false,\n assetsDirs: [\"gx-ide-assets/ai-message\"]\n})\nexport class GxIdeAiMessage {\n /* The message allows to be copied*/\n private _componentLocale: any;\n private copyable = false;\n\n @Element() el: HTMLGxIdeAiMessageElement;\n\n /**\n * This wil display the message if true\n */\n @State() visible = false;\n\n /**\n * This wil show the user a text, indicating that the message has been copied\n */\n @State() showCopiedMessage = false;\n\n /**\n * A reference to the gx-ide-ai-assistant host element\n */\n @Prop() readonly aiAssistantHostRef: HTMLGxIdeAiAssistantElement;\n\n /**\n * The actual message\n */\n @Prop() readonly message: string;\n\n /**\n * The message type\n */\n @Prop() readonly messageType: MessageType;\n\n /**\n * The filter value\n */\n @Prop() readonly filterValue: string;\n\n /**\n * It hides the message (used for the filter)\n */\n @Prop() readonly hidden: boolean;\n\n /**\n * An object with the needed string translations.\n */\n @Prop() readonly translations: Translations;\n\n async componentWillLoad() {\n this._componentLocale = await Locale.getComponentStrings(this.el);\n this.evaluateMessageIsCopyable();\n }\n\n componentDidRender() {\n setTimeout(() => {\n /* Without the timeout it appears instantly (no apparent transition)*/\n this.visible = true;\n const messagesList = this.el.parentElement;\n messagesList.scrollTo(0, 0);\n }, 0);\n }\n\n private copyMessage = () => {\n navigator.clipboard.writeText(this.message);\n this.showCopiedMessage = true;\n setTimeout(() => {\n this.showCopiedMessage = false;\n }, 1500);\n };\n\n #buttonMouseDownHandler = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n };\n\n private evaluateMessageIsCopyable = () => {\n this.copyable = this.messageType !== \"assistant-in-progress\";\n };\n\n private evaluateCopyIcon = () => {\n return this.copyable ? (\n <button\n class=\"button-tertiary button-icon-only\"\n aria-label=\"copy\"\n onClick={this.copyMessage}\n onMouseDown={this.#buttonMouseDownHandler}\n >\n <ch-image class=\"icon-md\" src={COPY_ICON}></ch-image>\n </button>\n ) : null;\n };\n\n render() {\n return (\n <li\n class={{\n \"message\": true,\n \"message--visible\": this.visible && !this.hidden,\n [`message--${[this.messageType]}`]: true,\n \"message--assistant\": this.messageType !== \"user\",\n \"message--copyable\": this.copyable,\n \"message--copying\": this.showCopiedMessage\n }}\n >\n <div class=\"message__outer-wrapper\">\n <div\n class={{\n \"message__inner-wrapper\": true\n }}\n >\n {this.messageType === \"user\" ? (\n <div class=\"message__header\">\n <span class=\"message__role message__role--user\">\n <span class=\"message__role-description\">\n {this._componentLocale.you}\n </span>\n </span>\n {this.evaluateCopyIcon()}\n </div>\n ) : (\n <div\n class={{\n \"message__header\": true,\n \"message__header--in-progress\":\n this.messageType === \"assistant-in-progress\"\n }}\n >\n <span\n class={{\n \"message__role\":\n this.messageType !== \"assistant-in-progress\",\n \"message__role--hidden\":\n this.messageType === \"assistant-in-progress\",\n \"message__role--assistant\": true\n }}\n >\n <span class=\"message__role-description\">\n {this._componentLocale.assistant}\n </span>\n </span>\n {this.evaluateCopyIcon()}\n </div>\n )}\n <div\n class={{\n \"message__caption\": true,\n \"message__caption--in-progress\":\n this.messageType === \"assistant-in-progress\"\n }}\n >\n {this.showCopiedMessage ? (\n <span class=\"copied\">\n <ch-image class=\"icon-md\" src={COPY_ICON}></ch-image>\n {this.translations[\"copied\"]}\n </span>\n ) : null}\n {hiChar(this.message, this.filterValue)}\n </div>\n {this.messageType === \"assistant-in-progress\" ? (\n <div class=\"animation-wrapper\">\n <div class=\"dot-pulse\"></div>\n </div>\n ) : null}\n </div>\n </div>\n </li>\n );\n }\n}\n\nexport type Translations = {\n [key: string]: string;\n};\n"],"version":3}
|