shx-3d-render

main
Jan Umbach 2024-06-23 11:06:38 +02:00
parent 732d9786e1
commit b8b9d0eab5
1 changed files with 15 additions and 8 deletions

View File

@ -301,7 +301,7 @@
}
};
function SHX_IFC_genTextInput(inputID, labelText, inputName, inputVal, section_id) {
function SHX_IFC_genTextInput(inputID, labelText, inputName, inputVal, section_id, maxLength = 24) {
setTimeout(() => {
document.querySelector(`#${inputID}`).addEventListener('input',(e)=>{
if(!document.querySelector(`label[for="${inputID}-label"] span`)){
@ -310,8 +310,8 @@
document.querySelector(`label[for="${inputID}-label"]`).appendChild(span)
}
document.querySelector(`label[for="${inputID}-label"] span`).style.display = `inline`
document.querySelector(`label[for="${inputID}-label"] span`).style.color = undefined;
document.querySelector(`label[for="${inputID}-label"] span`).textContent = e.target.value.length + ' von ' + 24 + ' Zeichen verwendet';
document.querySelector(`label[for="${inputID}-label"] span`).style.color = null;
document.querySelector(`label[for="${inputID}-label"] span`).textContent = e.target.value.length + ' von ' + maxLength + ' Zeichen verwendet';
if(e.target.value.length==0){
document.querySelector(`label[for="${inputID}-label"] span`).textContent = 'Bitte gib deinen Text ein';
document.querySelector(`label[for="${inputID}-label"] span`).style.color = 'red';
@ -321,7 +321,7 @@
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-${section_id}" type="text" id="${inputID}" name="properties[${inputName}]" value="${inputVal}" oninput="document.querySelector('shx-input-forms').renderView()" required maxlength="24">
<input class="field__input" form="product-form-${section_id}" type="text" id="${inputID}" name="properties[${inputName}]" value="${inputVal}" oninput="document.querySelector('shx-input-forms').renderView()" required maxlength="${maxLength}" normalMaxLength="${maxLength}">
</div>
`;
@ -530,11 +530,18 @@
this.Viewer3D.style.width = this.container.offsetWidth + 'px';
this.Viewer3D.style.height = this.container.offsetWidth + 'px';
this.Viewer3DContainer.appendChild(this.Viewer3D);
this.requiredPlaceholder = document.createElement('input');
this.requiredPlaceholder.type = 'text';
this.requiredPlaceholder.style.display = 'none';
this.requiredPlaceholder.required = true;
this.requiredPlaceholder.form = 'product-form-' + this.section_id;
this.requiredPlaceholder.name = 'properties[Text]';
this.requiredPlaceholder.value = '';
this.Viewer3DContainer.appendChild(this.requiredPlaceholder);
}
setTimeout(createIFrame.bind(this), 1000);