123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- // *********************************************************************************
- // Scheme for the variables list
- // *********************************************************************************
- export const variableScheme = {
- hash: 'UUID for the variable',
- name: 'Variable name',
- type: 'Varaible type',
- value: 'Variable value'
- };
- // *********************************************************************************
- // Variable types
- // *********************************************************************************
- export const variableTypes = [
- {
- name: 'inteiro',
- value: 'INTEGER',
- defaultValue: 0,
- htmlType: 'number',
- barrier: ''
- },
- {
- name: 'real',
- value: 'DOUBLE',
- defaultValue: 0.0,
- htmlType: 'number',
- barrier: ''
- },
- {
- name: 'cadeia',
- value: 'STRING',
- defaultValue: '',
- htmlType: 'text',
- barrier: '"'
- },
- {
- name: 'lógico',
- value: 'BOOLEAN',
- vales: [
- {
- name: 'verdadeiro',
- value: true
- },
- {
- name: 'falso',
- value: false
- }
- ],
- defaultValue: true,
- htmlType: 'select',
- barrier: ''
- }
- ];
- export function getVariableTypeByValue (value) {
- for (let i = 0; i < variableTypes.length; i++) {
- if (variableTypes[i].value === value)
- return variableTypes[i];
- }
- return null;
- }
- // *********************************************************************************
- // 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`;
- }
- return `<li id="variable<variableId>Li">
- <form id="variable<variableId>Form">
- <div class="row">
- <div class="col-2">
- <select name="tipo" class="form-control" title="tipo da variável" id="variable<variableId>Type" variable-id="<variableId>">
- ${variableTypesHtml}
- </select>
- </div>
- <div class="col-2">
- <input type="text" class="form-control" title="nome da variável" id="variable<variableId>Name" value="<variableName>" variable-id="<variableId>">
- </div>
- <div class="col-1 text-center my-auto" style="margin-bottom: 0px !important">
- <label for="variable<variableId>Value" tabindex="0" tile="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>">
- </div>
- <div class="col-1">
- <button id="variable<variableId>Delete" type="button" class="btn btn-danger">Excluir</button>
- </div>
- </div>
- </form>
- </li>`;
- }
- // *********************************************************************************
|