shx-3d-render

main
Jan Umbach 2024-06-15 12:32:28 +02:00
parent 0f0d02d43b
commit 155260f7b3
1 changed files with 12 additions and 13 deletions

View File

@ -50,11 +50,11 @@
}
};
function SHX_IFC_genTextInput(inputID, labelText, inputName, inputVal) {
function SHX_IFC_genTextInput(inputID, labelText, inputName, inputVal, section_id) {
return `
<label class="form__label custom shx-ifc-form_label" for="${inputID}-label">${labelText}</label>
<div class="field custom">
<input class="field__input" form="{{ 'product-form-' | append: section_id }}" type="text" id="${inputID}" name="properties[${inputName}]" value="${inputVal}">
<input class="field__input" form="product-form-${section_id}" type="text" id="${inputID}" name="properties[${inputName}]" value="${inputVal}">
</div>
`;
}
@ -66,7 +66,7 @@
}
function SHX_IFC_genDropdownSelect(inputID, labelText, inputName, inputVal, options) {
function SHX_IFC_genDropdownSelect(inputID, labelText, inputName, inputVal, options, section_id) {
let html = `
<label class="form__label custom shx-ifc-form_label" for="${inputID}-label">${labelText}</label>
<div class="field custom">
@ -88,21 +88,21 @@
let globalInputFormsObj = {
"test1": {
"renderHTML": () => {
"renderHTML": (section_id) => {
let html = defaultStyle;
html += SHX_IFC_genTextInput('shx-text1', 'Custom Text 1', 'Custom Text 1', globalInputFormsObjValues['test1']['shx-text1']);
html += SHX_IFC_genDropdownSelect('shx-font', 'Schriftart', 'dropdown', globalInputFormsObjValues['test1']['shx-font'], ['LT Beverage', 'test2', 'test3']);
html += SHX_IFC_genTextInput('shx-text1', 'Custom Text 1', 'Custom Text 1', globalInputFormsObjValues['test1']['shx-text1'], section_id);
html += SHX_IFC_genDropdownSelect('shx-font', 'Schriftart', 'dropdown', globalInputFormsObjValues['test1']['shx-font'], ['LT Beverage', 'test2', 'test3'], section_id);
html += SHX_IFC_genRenderButton();
return html;
}
},"test2": {
"renderHTML": () => {
"renderHTML": (section_id) => {
let html = defaultStyle;
html += SHX_IFC_genTextInput('custom-text-1', 'Custom Text 1', 'Custom Text 1', globalInputFormsObjValues['test2']['text1']);
html += SHX_IFC_genTextInput('custom-text-2', 'Custom Text 2', 'Custom Text 2', globalInputFormsObjValues['test2']['text2']);
html += SHX_IFC_genTextInput('custom-text-1', 'Custom Text 1', 'Custom Text 1', globalInputFormsObjValues['test2']['text1'], section_id);
html += SHX_IFC_genTextInput('custom-text-2', 'Custom Text 2', 'Custom Text 2', globalInputFormsObjValues['test2']['text2'], section_id);
html += SHX_IFC_genRenderButton();
return html;
@ -124,9 +124,8 @@
}
connectedCallback() {
this.section_id = this.getAttribute('section_id');
console.log('section_id', this.section_id);
this.section_id = this.getAttribute('section_id');
this.innerHTML = '<div class="shx-input-forms-container"><div class="shx-input-forms-content"></div></div>';
this.container = this.querySelector('.shx-input-forms-container');
this.container.style.height = '0px';
@ -219,7 +218,7 @@
for(let key in globalInputFormsObj) {
if(key === this.currentVariant) {
content.innerHTML = globalInputFormsObj[key].renderHTML();
content.innerHTML = globalInputFormsObj[key].renderHTML(this.section_id);
}
}