/** Datei: plugins/rest/assets.OLD/js/arunox/_OLD/data/form/input.js **/ /** * rest/arunox/generators/data/form/input.js * * Some Javascript codes without further description * * @author Sparky * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ ARUNOX.Registry.generator.register( 'data/form/input', class extends ARUNOX.Theme.Component { static htmlTag = 'input'; create( config, data ) { this.element.type = config.type; this.element.name = config.key; this.element.value = data?.[ config.key ] || config.value || ''; this.element.readOnly = config.readonly || false; if( config.type != 'hidden' ) { this.element.id = 'control_' + config.key; if( this.element.hasAttribute( 'readonly' ) ) this.element.readonly = true; if( this.element.hasAttribute( 'type' ) ) this.element.type = config.type; if( this.element.hasAttribute( 'name' ) ) this.element.name = config.key; this.element.classList.add( 'form__control' ); if( config.required ) { this.element.required = true; this.validators.register( 'required' ); } if( this.validators.exists( config.type ) ) { this.validators.register( config.type ); } if( config.validate?.request ) { this.validators.register( 'request' ); } if( config.readonly ) { this.parent.element.classList.add( 'is-readonly' ); } if( config.required ) { this.parent.element.classList.add( 'is-required' ); const required = document.createElement( 'span' ); required.classList.add( 'form__info', 'form__info--required' ); required.innerHTML = typeof config.required === 'string' ? config.required : 'required'; this.parent.append( required ); } this.element.addEventListener( 'focus', () => { this.parent.element.classList.add( 'has-focus' ); }); this.element.addEventListener( 'blur', () => { this.parent.element.classList.remove( 'has-focus' ); }); this.apply( 'validation', config, data ); } this.apply( `customize/input/${config.type}`, config, data ); } }); /** Datei: plugins/rest/assets.OLD/js/arunox/_OLD/data/form/feedback.js **/ /** * rest/arunox/generators/data/form/control.js * * Some Javascript codes without further description * * @author Sparky * @copyright 2025 ARUNOX * @version 1.0.0 * @since 1.0.0 File is created */ ARUNOX.Registry.generator.register( 'data/form/feedback', class extends ARUNOX.Theme.Component { static htmlTag = 'span'; create( config, type ) { const wrapper = this.parent.parent; const textField = type === null ? 'waiting' : 'message'; wrapper.element.classList.removeRexEx( /^(is)-(valid|invalid)/ ); wrapper.element.classList.removeRexEx( /^(on|validate)-/ ); if( type === null ) wrapper.element.classList.add( 'on-validate' ); else if( type === true ) wrapper.element.classList.add( 'is-valid' ); else if( type === false ) wrapper.element.classList.add( 'is-invalid' ); else wrapper.element.classList.add( `validate-${type}` ); wrapper.element.querySelector('.form__info--feedback')?.remove(); wrapper.append( this ); this.element.classList.add( 'form__info', 'form__info--feedback' ); this.element.innerHTML = ''; if( !config.validate ) return; if( typeof config.validate[ type ] === 'undefined' ) return; if( typeof config.validate[ type ] === 'string' ) { this.element.innerHTML = config.validate[ type ]; return; } if( typeof config.validate[ type ][ textField ] === 'string' ) { this.element.innerHTML = config.validate[ type ][ textField ]; return; } } });