Browse Source

feat: updated the types for better reading

Marcelo Vilas Boas Correa Filho 2 years ago
parent
commit
50caa3457a

+ 15 - 15
js/accessibleUI/modules/operations/operations-schemes.js

@@ -36,7 +36,7 @@ export const Operators = {
     OPERATOR: 'OPERATOR'
 }
 
-export const operatorTypes = [
+export const OperatorType = [
     {
         name: 'Variável',
         value: Operators.VARIABLE
@@ -55,7 +55,7 @@ export const operatorTypes = [
 // Operation types
 // *********************************************************************************
 
-export const operationTypes = [
+export const OperationType = [
     {
         name: ';',
         friendlyName: 'Fim',
@@ -97,7 +97,7 @@ export const operationTypes = [
 // Operator kinds
 // *********************************************************************************
 
-export const operatorKinds = [
+export const OperatorKind = [
     {
         name: 'Variável',
         value: 'VARIABLE'
@@ -115,8 +115,8 @@ export const operatorKinds = [
 export function htmlOperationTypeScheme () {
     let operationTypesSelect = ``;
 
-    for (let i = 0; i < operationTypes.length; i++) {
-        operationTypesSelect += `<option value="${operationTypes[i].value}">${operationTypes[i].name}</option>`;
+    for (let i = 0; i < OperationType.length; i++) {
+        operationTypesSelect += `<option value="${OperationType[i].value}">${OperationType[i].name}</option>`;
     }
 
     return `<div class="col-2">
@@ -134,8 +134,8 @@ export function htmlOperationTypeScheme () {
 export function htmlOperationKindScheme (operation) {
     let operatorKindsSelect = ``;
 
-    for (let i = 0; i < operatorKinds.length; i++) {
-        operatorKindsSelect += `<option value="${operatorKinds[i].value}">${operatorKinds[i].name}</option>`;
+    for (let i = 0; i < OperatorKind.length; i++) {
+        operatorKindsSelect += `<option value="${OperatorKind[i].value}">${OperatorKind[i].name}</option>`;
     }
 
     return `<div class="col-3">
@@ -236,8 +236,8 @@ export function htmlOperatorValueInputScheme (operation, operator) {
 export function htmlOperationTypeSelect (operation, operator) {
     let operationTypesSelect = ``;
 
-    for (let i = 0; i < operationTypes.length; i++) {
-        operationTypesSelect += `<option value="${operationTypes[i].value}" title="${operationTypes[i].friendlyName}">${operationTypes[i].name}</option>`;
+    for (let i = 0; i < OperationType.length; i++) {
+        operationTypesSelect += `<option value="${OperationType[i].value}" title="${OperationType[i].friendlyName}">${OperationType[i].name}</option>`;
     }
 
     return `<div class="col-2">
@@ -252,9 +252,9 @@ export function htmlOperationTypeSelect (operation, operator) {
 // *********************************************************************************
 
 export function getOperatorTypeByValue (value) {
-    for (let i = 0; i < operatorTypes.length; i++) {
-        if (operatorTypes[i].value === value)
-            return operatorTypes[i];
+    for (let i = 0; i < OperatorType.length; i++) {
+        if (OperatorType[i].value === value)
+            return OperatorType[i];
     }
 
     return null;
@@ -263,9 +263,9 @@ export function getOperatorTypeByValue (value) {
 // *********************************************************************************
 
 export function getOperationTypeByValue (value) {
-    for (let i = 0; i < operationTypes.length; i++) {
-        if (operationTypes[i].value === value)
-            return operationTypes[i];
+    for (let i = 0; i < OperationType.length; i++) {
+        if (OperationType[i].value === value)
+            return OperationType[i];
     }
 
     return null;

+ 1 - 1
js/accessibleUI/modules/operations/operations.js

@@ -6,7 +6,7 @@ import {
     htmlAssignVariableScheme,
     htmlOperationKindScheme, htmlOperationTypeSelect, htmlOperatorValueInputScheme,
     htmlOperatorVariablesSelectScheme,
-    operationScheme, Operators, operatorScheme, operatorTypes
+    operationScheme, Operators, operatorScheme
 } from "./operations-schemes";
 import {getVariableByHash, variables} from "../variables/variables";
 // Imports

+ 7 - 13
js/accessibleUI/modules/variables/variables-schemes.js

@@ -15,7 +15,7 @@ export const variableScheme = {
 // Variable types
 // *********************************************************************************
 
-export const variableTypes = [
+export const VariableType = [
     {
         name: 'inteiro',
         value: 'INTEGER',
@@ -57,9 +57,9 @@ export const variableTypes = [
 ];
 
 export function getVariableTypeByValue (value) {
-    for (let i = 0; i < variableTypes.length; i++) {
-        if (variableTypes[i].value === value)
-            return variableTypes[i];
+    for (let i = 0; i < VariableType.length; i++) {
+        if (VariableType[i].value === value)
+            return VariableType[i];
     }
 
     return null;
@@ -69,17 +69,11 @@ export function getVariableTypeByValue (value) {
 // Html Schemes
 // *********************************************************************************
 
-let htmlVariableSchemeBuilt = '';
-
 export function htmlVariableScheme () {
-
-    if (htmlVariableSchemeBuilt !== '')
-        return htmlVariableSchemeBuilt;
-
     let variableTypesHtml = '';
 
-    for (let i = 0; i < variableTypes.length; i++) {
-        variableTypesHtml += `<option value="${variableTypes[i].value}">${variableTypes[i].name}</option>\n`;
+    for (let i = 0; i < VariableType.length; i++) {
+        variableTypesHtml += `<option value="${VariableType[i].value}">${VariableType[i].name}</option>\n`;
     }
 
     return `<li id="variable<variableId>Li">
@@ -100,7 +94,7 @@ export function htmlVariableScheme () {
                             <label for="variable<variableId>Value" tabindex="0" title="Recebe">recebe</label>
                         </div>
                         <div class="col-2">
-                            <input type="${variableTypes[0].htmlType}" class="form-control" id ="variable<variableId>Value" title="Valor da variável" value="0" variable-id="<variableId>">
+                            <input type="${VariableType[0].htmlType}" class="form-control" id ="variable<variableId>Value" title="Valor da variável" value="0" variable-id="<variableId>">
                         </div>
                         <div class="col my-auto" style="text-align: end;">
                             <div class="row justify-content-end">

+ 7 - 2
js/accessibleUI/modules/variables/variables.js

@@ -1,6 +1,11 @@
 // Imports
 import {htmlOlCommandsVariables, generateUUID} from './../../main';
-import {getVariableTypeByValue, htmlVariableScheme, variableScheme, variableTypes} from "./variables-schemes";
+import {
+    getVariableTypeByValue,
+    htmlVariableScheme,
+    variableScheme,
+    VariableType
+} from "./variables-schemes";
 import {deleteOperationByVariable} from "../operations/operations";
 // Imports
 
@@ -13,7 +18,7 @@ export function createVariable () {
 
     variable.hash = generateUUID().replaceAll('-', '');
     variable.name = 'var' + variablesIndex;
-    variable.type = variableTypes[0];
+    variable.type = VariableType[0];
     variable.value = variable.type.defaultValue;
 
     variables.push(variable);