1/** 2 * 2023 DMConcept 3 * 4 * NOTICE OF LICENSE 5 * 6 * This file is licenced under the Software License Agreement. 7 * With the purchase or the installation of the software in your application 8 * you accept the licence agreement 9 * 10 * @author DMConcept <[email protected]> 11 * @copyright 2023 DMConcept 12 * @license Commercial license (You can not resell or redistribute this software.) 13 * 14 */ 15 16var CONFIGURATOR = CONFIGURATOR || {}; 17CONFIGURATOR.ELEMENTS = CONFIGURATOR.ELEMENTS || {}; 18CONFIGURATOR.ELEMENTS.CHOICES = CONFIGURATOR.ELEMENTS.CHOICES || {}; 19 20CONFIGURATOR.ELEMENTS.CHOICES.ChoicesSimples = function(step, parent){ 21 22 var Super = Object.getPrototypeOf(this); 23 24 /** 25 * Contains current active child's ID 26 * Set to undefined when none is active 27 */ 28 this.current; 29 30 this.updateInternalState = function() { 31 var updated = false; 32 var i = 0; 33 this.current = undefined; 34 // look for an active child, when found, stop research 35 while (!updated && i < this.substeps.length) { 36 var substep = this.substeps[i];
37 if (this.isVisibleAndActive(substep)) { 38 this.current = substep.getID(); 39 updated = true; 40 } 41 i++; 42 } 43 44 if (this.current > 0) { 45 this.state = this.STATE.ACTIVE; 46 } else { 47 this.state = this.STATE.INACTIVE; 48 } 49 50 }; 51 52 this.notify = function(id, state) { 53 var allowed = Super.notify.call(this, id, state); 54 55 // if allowed, means the checked element has changed 56 // ask children to update their state 57 if (allowed) { 58 this.substeps.forEach(function(substep) { 59 substep.updateStateFromHtml(); 60 }); 61 } 62 63 return allowed; 64 }; 65 66 this.validateChildAction = function(id, state) { 67 var valid = false; 68 69 switch (state) { 70 case this.STATE.INACTIVE: 71 if (this.step.params.required !== "1") { 72 this.current = undefined; 73 valid = true; 74 } 75 break; 76 case this.STATE.ACTIVE: 77 this.current = id; 78 valid = true; 79 break; 80 81 default: 82 console.log("validateChildAction choices-simples invalid state"); 83 break; 84 } 85 86 return valid; 87 }; 88 89 if (step) { 90 this.init(step, parent); 91 } 92}; 93 94CONFIGURATOR.ELEMENTS.dispatch.registerObject('choices_simples', CONFIGURATOR.ELEMENTS.CHOICES.ChoicesSimples); 95CONFIGURATOR.ELEMENTS.CHOICES.ChoicesSimples.prototype = new CONFIGURATOR.ELEMENTS.CHOICES.BaseChoices;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.