UNPKG

armisa-models

Version:
72 lines (71 loc) 3.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validationTabbing = void 0; const DateBoxFactory_1 = require("../../../ComponentFactory/DateBox/DateBoxFactory"); const StructrulCodeFactory_1 = require("../../../ComponentFactory/StructructrulCode/StructrulCodeFactory"); const enums_1 = require("../../../enums"); class validationTabbing { static gotoNextElement(tabbing, currentElementFactory) { const othersTabbing = new validationTabbing(tabbing, currentElementFactory); othersTabbing.gotoNextElement(); } constructor(tabbing, currentElementFactory) { this.tabbing = tabbing; this.currentElementFactory = currentElementFactory; this.gotoNextElement = () => { if (this.currentElementFactory instanceof DateBoxFactory_1.DateBoxFactory) { this.goToNextElementDataBox(this.currentElementFactory); } else if (this.currentElementFactory instanceof StructrulCodeFactory_1.StructrulCodeFactory) { this.goToNextElementStructrulCode(this.currentElementFactory); } else { this.tabbing.elementTabbing.focusNextElement(); } }; this.goToNextElementDataBox = (currentDateBoxFactory) => { currentDateBoxFactory.validate(); if (typeof currentDateBoxFactory.validation !== 'boolean') { if (currentDateBoxFactory.validation[1] === enums_1.EnumValidateState.empty) { currentDateBoxFactory.showDatePicker && currentDateBoxFactory.showDatePicker(); } else { if (currentDateBoxFactory.showDatePicker) { const showDatePicker = () => { currentDateBoxFactory.any.showDatePicker(); delete this.elementsOfForm.onCloseModalOpenNexWindow; }; this.elementsOfForm.onCloseModalOpenNexWindow = showDatePicker; } this.elementsOfForm.showInvalidArgumentMessageBox(currentDateBoxFactory.validation[0]); } } else { this.tabbing.elementTabbing.focusNextElement(); } }; this.goToNextElementStructrulCode = (currentStructrulCodeFactory) => { currentStructrulCodeFactory.validate(); if (typeof currentStructrulCodeFactory.validation !== 'boolean') { if (currentStructrulCodeFactory.validation[1] === enums_1.EnumValidateState.empty) { currentStructrulCodeFactory.showTreeView && currentStructrulCodeFactory.showTreeView(); } else { if (currentStructrulCodeFactory.showTreeView) { const showTreeView = () => { currentStructrulCodeFactory.any.showTreeView(); delete this.elementsOfForm.onCloseModalOpenNexWindow; }; this.elementsOfForm.onCloseModalOpenNexWindow = showTreeView; } this.elementsOfForm.showInvalidArgumentMessageBox(currentStructrulCodeFactory.validation[0]); } } else { this.tabbing.elementTabbing.focusNextElement(); } }; this.elementsOfForm = tabbing.elementsOfFormFactory; } } exports.validationTabbing = validationTabbing;