@genexus/genexus-ide-ui 1.1.73 → 1.1.74
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-name-picker.cjs.entry.js +6 -5
- package/dist/cjs/gx-ide-name-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/name-picker/gx-ide-assets/name-picker/shortcuts.json +15 -0
- package/dist/collection/components/name-picker/name-picker.js +9 -8
- package/dist/collection/components/name-picker/name-picker.js.map +1 -1
- package/dist/components/gx-ide-name-picker.js +8 -7
- package/dist/components/gx-ide-name-picker.js.map +1 -1
- package/dist/esm/genexus-ide-ui.js +1 -1
- package/dist/esm/gx-ide-name-picker.entry.js +7 -6
- package/dist/esm/gx-ide-name-picker.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js +1 -1
- package/dist/genexus-ide-ui/genexus-ide-ui.esm.js.map +1 -1
- package/dist/genexus-ide-ui/gx-ide-assets/name-picker/shortcuts.json +15 -0
- package/dist/genexus-ide-ui/{p-2d989eb1.entry.js → p-345f7738.entry.js} +57 -52
- package/dist/genexus-ide-ui/p-345f7738.entry.js.map +1 -0
- package/dist/types/components/name-picker/name-picker.d.ts +2 -2
- package/dist/types/components.d.ts +4 -4
- package/package.json +1 -1
- package/dist/genexus-ide-ui/p-2d989eb1.entry.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { r as t,
|
|
1
|
+
import { r as t, g as e, h as i, H as s, a as n } from "./p-9b9ccd0c.js";
|
|
2
2
|
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as o } from "./p-c5196b3b.js";
|
|
4
4
|
|
|
5
|
-
import { c as
|
|
5
|
+
import { c as a, v as r } from "./p-b32b6b1f.js";
|
|
6
6
|
|
|
7
|
-
import { L as
|
|
7
|
+
import { L as c } from "./p-311eedf3.js";
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const d = ":host{display:grid;block-size:100%;grid-template-rows:1fr max-content}.field-group{grid-auto-rows:max-content}.main{overflow:auto}.section{display:contents}.tooltip{position:absolute}";
|
|
10
10
|
|
|
11
11
|
var l = undefined && undefined.__classPrivateFieldGet || function(t, e, i, s) {
|
|
12
12
|
if (i === "a" && !s) throw new TypeError("Private accessor was defined without a getter");
|
|
@@ -14,38 +14,39 @@ var l = undefined && undefined.__classPrivateFieldGet || function(t, e, i, s) {
|
|
|
14
14
|
return i === "m" ? s : i === "a" ? s.call(t) : s ? s.value : e.get(t);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var h = undefined && undefined.__classPrivateFieldSet || function(t, e, i, s, n) {
|
|
18
18
|
if (s === "m") throw new TypeError("Private method is not writable");
|
|
19
19
|
if (s === "a" && !n) throw new TypeError("Private accessor was defined without a setter");
|
|
20
20
|
if (typeof e === "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
21
21
|
return s === "a" ? n.call(t, i) : n ? n.value = i : e.set(t, i), i;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var u, f, p, m, w, b, v, g;
|
|
25
25
|
|
|
26
|
-
const
|
|
26
|
+
const y = [ "resets/box-sizing", "utils/form", "utils/spacing", "utils/layout", "chameleon/scrollbar", "components/button", "components/edit", "components/tooltip" ];
|
|
27
27
|
|
|
28
|
-
const
|
|
29
|
-
constructor(
|
|
30
|
-
t(this,
|
|
28
|
+
const k = class {
|
|
29
|
+
constructor(s) {
|
|
30
|
+
t(this, s);
|
|
31
31
|
/**
|
|
32
32
|
* The component hard-coded strings translations.
|
|
33
33
|
*/
|
|
34
34
|
// eslint-disable-next-line @stencil-community/own-props-must-be-private
|
|
35
|
-
|
|
35
|
+
u.set(this, void 0);
|
|
36
36
|
f.set(this, void 0);
|
|
37
|
-
p.set(this, (
|
|
37
|
+
p.set(this, e(`./gx-ide-assets/name-picker/shortcuts.json`));
|
|
38
|
+
m.set(this, (t => {
|
|
38
39
|
this.inputValue = t.detail;
|
|
39
|
-
|
|
40
|
+
a(this.validatableControls, "input-name");
|
|
40
41
|
}));
|
|
41
|
-
|
|
42
|
+
w.set(this, (async () => {
|
|
42
43
|
this.cancelCallback();
|
|
43
44
|
}));
|
|
44
|
-
|
|
45
|
-
const t = await this.
|
|
46
|
-
this.validatableControls =
|
|
45
|
+
b.set(this, (async () => {
|
|
46
|
+
const t = await this.confirmCallback(this.inputValue);
|
|
47
|
+
this.validatableControls = r(t, this.validatableControls);
|
|
47
48
|
}));
|
|
48
|
-
|
|
49
|
+
v.set(this, (() => {
|
|
49
50
|
// populate validatableControls with the controls that could have errors.
|
|
50
51
|
const t = [ l(this, f, "f") ];
|
|
51
52
|
t.forEach((t => {
|
|
@@ -60,73 +61,77 @@ const g = class {
|
|
|
60
61
|
}));
|
|
61
62
|
// TODO: evaluate if this should be a global helper function.
|
|
62
63
|
// It is used on other dialogs as well.
|
|
63
|
-
|
|
64
|
-
var
|
|
65
|
-
return ((s = (
|
|
64
|
+
g.set(this, (t => {
|
|
65
|
+
var e, s, n;
|
|
66
|
+
return ((s = (e = this.validatableControls) === null || e === void 0 ? void 0 : e.get(t === null || t === void 0 ? void 0 : t.id)) === null || s === void 0 ? void 0 : s.hasError) && ((n = this.validatableControls.get(t.id)) === null || n === void 0 ? void 0 : n.message) && i("ch-tooltip", {
|
|
66
67
|
class: "tooltip",
|
|
67
68
|
actionElement: t,
|
|
68
|
-
blockAlign:
|
|
69
|
-
inlineAlign:
|
|
70
|
-
delay:
|
|
69
|
+
blockAlign: o.tooltipSettings.blockAlign,
|
|
70
|
+
inlineAlign: o.tooltipSettings.inlineAlign,
|
|
71
|
+
delay: o.tooltipSettings.delay
|
|
71
72
|
}, this.validatableControls.get(t.id).message);
|
|
72
73
|
}));
|
|
73
74
|
this.inputValue = undefined;
|
|
74
75
|
this.validatableControls = new Map;
|
|
75
76
|
this.cancelCallback = undefined;
|
|
76
|
-
this.
|
|
77
|
+
this.confirmCallback = undefined;
|
|
77
78
|
this.defaultInputValue = undefined;
|
|
78
79
|
}
|
|
79
80
|
defaultInputValueChanged(t) {
|
|
80
81
|
this.inputValue = t;
|
|
81
82
|
}
|
|
82
83
|
async componentWillLoad() {
|
|
83
|
-
|
|
84
|
+
h(this, u, await c.getComponentStrings(this.el), "f");
|
|
84
85
|
this.defaultInputValueChanged(this.defaultInputValue);
|
|
85
86
|
}
|
|
86
87
|
componentDidLoad() {
|
|
87
|
-
l(this,
|
|
88
|
+
l(this, v, "f").call(this);
|
|
88
89
|
}
|
|
89
90
|
render() {
|
|
90
91
|
const t = !this.inputValue || this.inputValue.length === 0;
|
|
91
|
-
return
|
|
92
|
+
return i(s, {
|
|
92
93
|
class: "widget"
|
|
93
|
-
},
|
|
94
|
-
model:
|
|
95
|
-
}),
|
|
94
|
+
}, i("ch-theme", {
|
|
95
|
+
model: y
|
|
96
|
+
}), i("ch-shortcuts", {
|
|
97
|
+
src: l(this, p, "f")
|
|
98
|
+
}), i("section", {
|
|
96
99
|
class: "section"
|
|
97
|
-
},
|
|
100
|
+
}, i("div", {
|
|
98
101
|
class: "main scrollable field-group spacing-body"
|
|
99
|
-
},
|
|
102
|
+
}, i("div", {
|
|
100
103
|
class: "field field-block"
|
|
101
|
-
},
|
|
104
|
+
}, i("label", {
|
|
102
105
|
class: "label",
|
|
103
106
|
htmlFor: "input-name"
|
|
104
|
-
}, l(this,
|
|
107
|
+
}, l(this, u, "f").labels.name), i("ch-edit", {
|
|
105
108
|
type: "text",
|
|
106
109
|
id: "input-name",
|
|
107
110
|
class: "input",
|
|
108
|
-
placeholder: l(this,
|
|
111
|
+
placeholder: l(this, u, "f").placeHolders.name,
|
|
109
112
|
value: this.inputValue,
|
|
110
|
-
onInput: l(this,
|
|
111
|
-
ref: t =>
|
|
112
|
-
}), l(this,
|
|
113
|
+
onInput: l(this, m, "f"),
|
|
114
|
+
ref: t => h(this, f, t, "f")
|
|
115
|
+
}), l(this, g, "f").call(this, l(this, f, "f")))), i("footer", {
|
|
113
116
|
class: "control-footer-with-border spacing-body"
|
|
114
|
-
},
|
|
117
|
+
}, i("div", {
|
|
115
118
|
class: "buttons-spacer"
|
|
116
|
-
},
|
|
119
|
+
}, i("button", {
|
|
120
|
+
id: "cancel-button",
|
|
117
121
|
class: "button-secondary",
|
|
118
|
-
onClick: l(this,
|
|
119
|
-
}, l(this,
|
|
122
|
+
onClick: l(this, w, "f")
|
|
123
|
+
}, l(this, u, "f").buttons.cancel), i("button", {
|
|
124
|
+
id: "confirm-button",
|
|
120
125
|
class: "button-primary",
|
|
121
|
-
onClick: l(this,
|
|
126
|
+
onClick: l(this, b, "f"),
|
|
122
127
|
disabled: t
|
|
123
|
-
}, l(this,
|
|
128
|
+
}, l(this, u, "f").buttons.confirm)))));
|
|
124
129
|
}
|
|
125
130
|
static get assetsDirs() {
|
|
126
131
|
return [ "gx-ide-assets/name-picker" ];
|
|
127
132
|
}
|
|
128
133
|
get el() {
|
|
129
|
-
return
|
|
134
|
+
return n(this);
|
|
130
135
|
}
|
|
131
136
|
static get watchers() {
|
|
132
137
|
return {
|
|
@@ -135,10 +140,10 @@ const g = class {
|
|
|
135
140
|
}
|
|
136
141
|
};
|
|
137
142
|
|
|
138
|
-
|
|
139
|
-
|
|
143
|
+
u = new WeakMap, f = new WeakMap, p = new WeakMap, m = new WeakMap, w = new WeakMap,
|
|
144
|
+
b = new WeakMap, v = new WeakMap, g = new WeakMap;
|
|
140
145
|
|
|
141
|
-
|
|
146
|
+
k.style = d;
|
|
142
147
|
|
|
143
|
-
export {
|
|
144
|
-
//# sourceMappingURL=p-
|
|
148
|
+
export { k as gx_ide_name_picker };
|
|
149
|
+
//# sourceMappingURL=p-345f7738.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["namePickerCss","CSS_BUNDLES","GxIdeNamePicker","_GxIdeNamePicker_componentLocale","set","this","_GxIdeNamePicker_inputValueEl","_GxIdeNamePicker_shortcutsSrc","getAssetPath","_GxIdeNamePicker_handleInputValueChange","event","inputValue","detail","clearControlError","validatableControls","_GxIdeNamePicker_cancelClickHandler","async","cancelCallback","_GxIdeNamePicker_confirmClickHandler","formSubmitResult","confirmCallback","validateControls","_GxIdeNamePicker_initializeValidatableControls","__classPrivateFieldGet","forEach","validatableControl","id","reference","hasError","message","undefined","_GxIdeNamePicker_evaluateTooltipRender","controlReference","_b","_a","get","_c","h","class","actionElement","blockAlign","config","tooltipSettings","inlineAlign","delay","Map","defaultInputValueChanged","newDefaultInputValue","componentWillLoad","__classPrivateFieldSet","Locale","getComponentStrings","el","defaultInputValue","componentDidLoad","call","render","confirmButtonDisabled","length","Host","model","src","htmlFor","labels","name","type","placeholder","placeHolders","value","onInput","ref","onClick","buttons","cancel","disabled","confirm"],"sources":["src/components/name-picker/name-picker.scss?tag=gx-ide-name-picker&encapsulation=shadow","src/components/name-picker/name-picker.tsx"],"sourcesContent":[":host {\n display: grid;\n block-size: 100%;\n grid-template-rows: 1fr max-content;\n}\n\n.field-group {\n grid-auto-rows: max-content;\n}\n\n.main {\n overflow: auto;\n}\n\n.section {\n display: contents;\n}\n\n.tooltip {\n position: absolute;\n}\n","import {\n Component,\n Element,\n getAssetPath,\n h,\n Host,\n Prop,\n State,\n Watch\n} from \"@stencil/core\";\n\nimport { MercuryBundles } from \"@genexus/mercury\";\nimport { config } from \"../../common/config\";\nimport {\n clearControlError,\n ControlValidation,\n validateControls\n} from \"../../common/form-validation\";\nimport { Locale } from \"../../common/locale\";\nimport { FormSubmitResult } from \"../../components\";\n\nconst CSS_BUNDLES: MercuryBundles = [\n \"resets/box-sizing\",\n \"utils/form\",\n \"utils/spacing\",\n \"utils/layout\",\n \"chameleon/scrollbar\",\n \"components/button\",\n \"components/edit\",\n \"components/tooltip\"\n];\n\n@Component({\n tag: \"gx-ide-name-picker\",\n styleUrl: \"name-picker.scss\",\n shadow: true,\n assetsDirs: [\"gx-ide-assets/name-picker\"]\n})\nexport class GxIdeNamePicker {\n /**\n * The component hard-coded strings translations.\n */\n // eslint-disable-next-line @stencil-community/own-props-must-be-private\n #componentLocale: any;\n\n #inputValueEl!: HTMLChEditElement;\n #shortcutsSrc = getAssetPath(`./gx-ide-assets/name-picker/shortcuts.json`);\n\n @Element() el: HTMLGxIdeNamePickerElement;\n\n /**\n * The input name\n */\n @State() inputValue: string;\n\n @State() validatableControls = new Map<string, ControlValidation>();\n\n /**\n * Callback that must be invoked when the 'Cancel' button is pressed.\n */\n @Prop() readonly cancelCallback: () => Promise<void>;\n\n /**\n * Callback that must be invoked when the 'Confirm' button is pressed.\n */\n @Prop() readonly confirmCallback: (\n inputValue: string\n ) => Promise<FormSubmitResult>;\n\n /**\n * This property is used to set the initial values of the input field when the component is loaded.\n */\n @Prop() readonly defaultInputValue: string;\n @Watch(\"defaultInputValue\")\n defaultInputValueChanged(newDefaultInputValue: string) {\n this.inputValue = newDefaultInputValue;\n }\n\n async componentWillLoad() {\n this.#componentLocale = await Locale.getComponentStrings(this.el);\n this.defaultInputValueChanged(this.defaultInputValue);\n }\n\n componentDidLoad() {\n this.#initializeValidatableControls();\n }\n\n #handleInputValueChange = (event: CustomEvent<string> | InputEvent) => {\n this.inputValue = event.detail as string;\n clearControlError(this.validatableControls, \"input-name\");\n };\n\n #cancelClickHandler = async () => {\n this.cancelCallback();\n };\n\n #confirmClickHandler = async () => {\n const formSubmitResult = await this.confirmCallback(this.inputValue);\n this.validatableControls = validateControls(\n formSubmitResult,\n this.validatableControls\n );\n };\n\n #initializeValidatableControls = () => {\n // populate validatableControls with the controls that could have errors.\n const validatableControls: HTMLElement[] = [this.#inputValueEl];\n validatableControls.forEach(validatableControl => {\n if (validatableControl.id) {\n this.validatableControls.set(validatableControl.id, {\n reference: validatableControl,\n hasError: false,\n message: undefined\n });\n }\n });\n };\n\n // TODO: evaluate if this should be a global helper function.\n // It is used on other dialogs as well.\n #evaluateTooltipRender = (\n controlReference: HTMLElement\n ): HTMLChTooltipElement =>\n this.validatableControls?.get(controlReference?.id)?.hasError &&\n this.validatableControls.get(controlReference.id)?.message && (\n <ch-tooltip\n class=\"tooltip\"\n actionElement={controlReference as unknown as HTMLButtonElement}\n blockAlign={config.tooltipSettings.blockAlign}\n inlineAlign={config.tooltipSettings.inlineAlign}\n delay={config.tooltipSettings.delay}\n >\n {this.validatableControls.get(controlReference.id).message}\n </ch-tooltip>\n );\n\n render() {\n const confirmButtonDisabled =\n !this.inputValue || this.inputValue.length === 0;\n\n return (\n <Host class=\"widget\">\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n <ch-shortcuts src={this.#shortcutsSrc}></ch-shortcuts>\n <section class=\"section\">\n <div class=\"main scrollable field-group spacing-body\">\n <div class=\"field field-block\">\n <label class=\"label\" htmlFor=\"input-name\">\n {this.#componentLocale.labels.name}\n </label>\n <ch-edit\n type=\"text\"\n id=\"input-name\"\n class=\"input\"\n placeholder={this.#componentLocale.placeHolders.name}\n value={this.inputValue}\n onInput={this.#handleInputValueChange}\n ref={(el: HTMLChEditElement) =>\n (this.#inputValueEl = el as HTMLChEditElement)\n }\n ></ch-edit>\n {this.#evaluateTooltipRender(this.#inputValueEl)}\n </div>\n </div>\n\n <footer class=\"control-footer-with-border spacing-body\">\n <div class=\"buttons-spacer\">\n <button\n id=\"cancel-button\"\n class=\"button-secondary\"\n onClick={this.#cancelClickHandler}\n >\n {this.#componentLocale.buttons.cancel}\n </button>\n\n <button\n id=\"confirm-button\"\n class=\"button-primary\"\n onClick={this.#confirmClickHandler}\n disabled={confirmButtonDisabled}\n >\n {this.#componentLocale.buttons.confirm}\n </button>\n </div>\n </footer>\n </section>\n </Host>\n );\n }\n}\n"],"mappings":";;;;;;;;AAAA,MAAMA,IAAgB;;;;;;;;;;;;;;;;;ACqBtB,MAAMC,IAA8B,EAClC,qBACA,cACA,iBACA,gBACA,uBACA,qBACA,mBACA;;MASWC,IA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/C,KAAKyC,yBAAyBzC,KAAKgD;;EAGrC,gBAAAC;IACE/B,EAAAlB,MAAIiB,GAAA,KAA+BiC,KAAnClD;;EAoDF,MAAAmD;IACE,MAAMC,KACHpD,KAAKM,cAAcN,KAAKM,WAAW+C,WAAW;IAEjD,OACErB,EAACsB,GAAI;MAACrB,OAAM;OACVD,EAAA;MAAUuB,OAAO3D;QACjBoC,EAAA;MAAcwB,KAAKtC,EAAAlB,MAAIE,GAAA;QACvB8B,EAAA;MAASC,OAAM;OACbD,EAAA;MAAKC,OAAM;OACTD,EAAA;MAAKC,OAAM;OACTD,EAAA;MAAOC,OAAM;MAAQwB,SAAQ;OAC1BvC,EAAAlB,MAAIF,GAAA,KAAkB4D,OAAOC,OAEhC3B,EAAA;MACE4B,MAAK;MACLvC,IAAG;MACHY,OAAM;MACN4B,aAAa3C,EAAAlB,MAAIF,GAAA,KAAkBgE,aAAaH;MAChDI,OAAO/D,KAAKM;MACZ0D,SAAS9C,EAAAlB,MAAII,GAAA;MACb6D,KAAMlB,KACHH,EAAA5C,MAAIC,GAAiB8C,GAAuB;QAGhD7B,EAAAlB,MAAI0B,GAAA,KAAuBwB,KAA3BlD,MAA4BkB,EAAAlB,MAAIC,GAAA,SAIrC+B,EAAA;MAAQC,OAAM;OACZD,EAAA;MAAKC,OAAM;OACTD,EAAA;MACEX,IAAG;MACHY,OAAM;MACNiC,SAAShD,EAAAlB,MAAIU,GAAA;OAEZQ,EAAAlB,MAAIF,GAAA,KAAkBqE,QAAQC,SAGjCpC,EAAA;MACEX,IAAG;MACHY,OAAM;MACNiC,SAAShD,EAAAlB,MAAIa,GAAA;MACbwD,UAAUjB;OAETlC,EAAAlB,MAAIF,GAAA,KAAkBqE,QAAQG"}
|
|
@@ -13,9 +13,9 @@ export declare class GxIdeNamePicker {
|
|
|
13
13
|
*/
|
|
14
14
|
readonly cancelCallback: () => Promise<void>;
|
|
15
15
|
/**
|
|
16
|
-
* Callback that must be invoked when the '
|
|
16
|
+
* Callback that must be invoked when the 'Confirm' button is pressed.
|
|
17
17
|
*/
|
|
18
|
-
readonly
|
|
18
|
+
readonly confirmCallback: (inputValue: string) => Promise<FormSubmitResult>;
|
|
19
19
|
/**
|
|
20
20
|
* This property is used to set the initial values of the input field when the component is loaded.
|
|
21
21
|
*/
|
|
@@ -1477,9 +1477,9 @@ export namespace Components {
|
|
|
1477
1477
|
*/
|
|
1478
1478
|
"cancelCallback": () => Promise<void>;
|
|
1479
1479
|
/**
|
|
1480
|
-
* Callback that must be invoked when the '
|
|
1480
|
+
* Callback that must be invoked when the 'Confirm' button is pressed.
|
|
1481
1481
|
*/
|
|
1482
|
-
"
|
|
1482
|
+
"confirmCallback": (
|
|
1483
1483
|
inputValue: string
|
|
1484
1484
|
) => Promise<FormSubmitResult1>;
|
|
1485
1485
|
/**
|
|
@@ -5403,9 +5403,9 @@ declare namespace LocalJSX {
|
|
|
5403
5403
|
*/
|
|
5404
5404
|
"cancelCallback"?: () => Promise<void>;
|
|
5405
5405
|
/**
|
|
5406
|
-
* Callback that must be invoked when the '
|
|
5406
|
+
* Callback that must be invoked when the 'Confirm' button is pressed.
|
|
5407
5407
|
*/
|
|
5408
|
-
"
|
|
5408
|
+
"confirmCallback"?: (
|
|
5409
5409
|
inputValue: string
|
|
5410
5410
|
) => Promise<FormSubmitResult1>;
|
|
5411
5411
|
/**
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["namePickerCss","CSS_BUNDLES","GxIdeNamePicker","_GxIdeNamePicker_componentLocale","set","this","_GxIdeNamePicker_inputValueEl","_GxIdeNamePicker_handleInputValueChange","event","inputValue","detail","clearControlError","validatableControls","_GxIdeNamePicker_cancelClickHandler","async","cancelCallback","_GxIdeNamePicker_confirmClickHandler","formSubmitResult","createCallback","validateControls","_GxIdeNamePicker_initializeValidatableControls","__classPrivateFieldGet","forEach","validatableControl","id","reference","hasError","message","undefined","_GxIdeNamePicker_evaluateTooltipRender","controlReference","_b","_a","get","_c","h","class","actionElement","blockAlign","config","tooltipSettings","inlineAlign","delay","Map","defaultInputValueChanged","newDefaultInputValue","componentWillLoad","__classPrivateFieldSet","Locale","getComponentStrings","el","defaultInputValue","componentDidLoad","call","render","confirmButtonDisabled","length","Host","model","htmlFor","labels","name","type","placeholder","placeHolders","value","onInput","ref","onClick","buttons","cancel","disabled","confirm"],"sources":["src/components/name-picker/name-picker.scss?tag=gx-ide-name-picker&encapsulation=shadow","src/components/name-picker/name-picker.tsx"],"sourcesContent":[":host {\n display: grid;\n block-size: 100%;\n grid-template-rows: 1fr max-content;\n}\n\n.field-group {\n grid-auto-rows: max-content;\n}\n\n.main {\n overflow: auto;\n}\n\n.section {\n display: contents;\n}\n\n.tooltip {\n position: absolute;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from \"@stencil/core\";\n\nimport { MercuryBundles } from \"@genexus/mercury\";\nimport { config } from \"../../common/config\";\nimport {\n clearControlError,\n ControlValidation,\n validateControls\n} from \"../../common/form-validation\";\nimport { Locale } from \"../../common/locale\";\nimport { FormSubmitResult } from \"../../components\";\n\nconst CSS_BUNDLES: MercuryBundles = [\n \"resets/box-sizing\",\n \"utils/form\",\n \"utils/spacing\",\n \"utils/layout\",\n \"chameleon/scrollbar\",\n \"components/button\",\n \"components/edit\",\n \"components/tooltip\"\n];\n\n@Component({\n tag: \"gx-ide-name-picker\",\n styleUrl: \"name-picker.scss\",\n shadow: true,\n assetsDirs: [\"gx-ide-assets/name-picker\"]\n})\nexport class GxIdeNamePicker {\n /**\n * The component hard-coded strings translations.\n */\n // eslint-disable-next-line @stencil-community/own-props-must-be-private\n #componentLocale: any;\n\n #inputValueEl!: HTMLChEditElement;\n\n @Element() el: HTMLGxIdeNamePickerElement;\n\n /**\n * The input name\n */\n @State() inputValue: string;\n\n @State() validatableControls = new Map<string, ControlValidation>();\n\n /**\n * Callback that must be invoked when the 'Cancel' button is pressed.\n */\n @Prop() readonly cancelCallback: () => Promise<void>;\n\n /**\n * Callback that must be invoked when the 'Create' button is pressed.\n */\n @Prop() readonly createCallback: (\n inputValue: string\n ) => Promise<FormSubmitResult>;\n\n /**\n * This property is used to set the initial values of the input field when the component is loaded.\n */\n @Prop() readonly defaultInputValue: string;\n @Watch(\"defaultInputValue\")\n defaultInputValueChanged(newDefaultInputValue: string) {\n this.inputValue = newDefaultInputValue;\n }\n\n async componentWillLoad() {\n this.#componentLocale = await Locale.getComponentStrings(this.el);\n this.defaultInputValueChanged(this.defaultInputValue);\n }\n\n componentDidLoad() {\n this.#initializeValidatableControls();\n }\n\n #handleInputValueChange = (event: CustomEvent<string> | InputEvent) => {\n this.inputValue = event.detail as string;\n clearControlError(this.validatableControls, \"input-name\");\n };\n\n #cancelClickHandler = async () => {\n this.cancelCallback();\n };\n\n #confirmClickHandler = async () => {\n const formSubmitResult = await this.createCallback(this.inputValue);\n this.validatableControls = validateControls(\n formSubmitResult,\n this.validatableControls\n );\n };\n\n #initializeValidatableControls = () => {\n // populate validatableControls with the controls that could have errors.\n const validatableControls: HTMLElement[] = [this.#inputValueEl];\n validatableControls.forEach(validatableControl => {\n if (validatableControl.id) {\n this.validatableControls.set(validatableControl.id, {\n reference: validatableControl,\n hasError: false,\n message: undefined\n });\n }\n });\n };\n\n // TODO: evaluate if this should be a global helper function.\n // It is used on other dialogs as well.\n #evaluateTooltipRender = (\n controlReference: HTMLElement\n ): HTMLChTooltipElement =>\n this.validatableControls?.get(controlReference?.id)?.hasError &&\n this.validatableControls.get(controlReference.id)?.message && (\n <ch-tooltip\n class=\"tooltip\"\n actionElement={controlReference as unknown as HTMLButtonElement}\n blockAlign={config.tooltipSettings.blockAlign}\n inlineAlign={config.tooltipSettings.inlineAlign}\n delay={config.tooltipSettings.delay}\n >\n {this.validatableControls.get(controlReference.id).message}\n </ch-tooltip>\n );\n\n render() {\n const confirmButtonDisabled =\n !this.inputValue || this.inputValue.length === 0;\n\n return (\n <Host class=\"widget\">\n <ch-theme model={CSS_BUNDLES}></ch-theme>\n <section class=\"section\">\n <div class=\"main scrollable field-group spacing-body\">\n <div class=\"field field-block\">\n <label class=\"label\" htmlFor=\"input-name\">\n {this.#componentLocale.labels.name}\n </label>\n <ch-edit\n type=\"text\"\n id=\"input-name\"\n class=\"input\"\n placeholder={this.#componentLocale.placeHolders.name}\n value={this.inputValue}\n onInput={this.#handleInputValueChange}\n ref={(el: HTMLChEditElement) =>\n (this.#inputValueEl = el as HTMLChEditElement)\n }\n ></ch-edit>\n {this.#evaluateTooltipRender(this.#inputValueEl)}\n </div>\n </div>\n\n <footer class=\"control-footer-with-border spacing-body\">\n <div class=\"buttons-spacer\">\n <button\n class=\"button-secondary\"\n onClick={this.#cancelClickHandler}\n >\n {this.#componentLocale.buttons.cancel}\n </button>\n\n <button\n class=\"button-primary\"\n onClick={this.#confirmClickHandler}\n disabled={confirmButtonDisabled}\n >\n {this.#componentLocale.buttons.confirm}\n </button>\n </div>\n </footer>\n </section>\n </Host>\n );\n }\n}\n"],"mappings":";;;;;;;;AAAA,MAAMA,IAAgB;;;;;;;;;;;;;;;;;ACYtB,MAAMC,IAA8B,EAClC,qBACA,cACA,iBACA,gBACA,uBACA,qBACA,mBACA;;MASWC,IAAe;;;;;;;QAK1BC,EAAAC,IAAAC,WAAA;IAEAC,EAAAF,IAAAC,WAAA;IAyCAE,EAAAH,IAAAC,OAA2BG;MACzBH,KAAKI,aAAaD,EAAME;MACxBC,EAAkBN,KAAKO,qBAAqB;AAAa;IAG3DC,EAAAT,IAAAC,OAAsBS;MACpBT,KAAKU;AAAgB;IAGvBC,EAAAZ,IAAAC,OAAuBS;MACrB,MAAMG,UAAyBZ,KAAKa,eAAeb,KAAKI;MACxDJ,KAAKO,sBAAsBO,EACzBF,GACAZ,KAAKO;AACN;IAGHQ,EAAAhB,IAAAC,OAAiC;;MAE/B,MAAMO,IAAqC,EAACS,EAAAhB,MAAIC,GAAA;MAChDM,EAAoBU,SAAQC;QAC1B,IAAIA,EAAmBC,IAAI;UACzBnB,KAAKO,oBAAoBR,IA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