diff --git a/src/js/espd.js b/src/js/espd.js index 10671d2..9cac47c 100644 --- a/src/js/espd.js +++ b/src/js/espd.js @@ -555,7 +555,7 @@ function componentsFactory() { } /** - * Auxiliary function to transform espd_json to Vue components that can be used in ESPD Response + * Auxiliary function to transform espd_json to Vue components that can be used in ESPD Examples * JSON to BootstrapVue for ESPD v4.0.0 tranformation * @param {*} fragment - JSON object to be processed * @param {*} result - JSON object to conserver the result @@ -590,9 +590,8 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { ` } if (Object.hasOwn(fragment[el], 'components')) result = json2ESPD_v4(fragment[el].components, result) - if (fragment[el].tag.endsWith('- SC')) result.template += `` - result.template += ` - ` + if (fragment[el].tag.endsWith('- SC')) result.template += '' + result.template += '' //Produce Vue component // exp: {} - is data that is exchanged at top level // @@ -609,18 +608,17 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { } }) - //DONE - return result break; case 'SUBCRITERION': - result.template += `
` + result.template += '
' if (Object.hasOwn(fragment[el], 'components')) result = json2ESPD_v4(fragment[el].components, result) - result.template += `
` + result.template += '
' break; case 'REQUIREMENT_GROUP': - result.template += `
` + result.template += '
' if (fragment[el].cardinality.toString().trim().endsWith('..n')) { result.data_part[`html_${stringToProperty(fragment[el].requestpath)}`] = '' result.template += `
` @@ -630,16 +628,16 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { if (fragment[el].cardinality.toString().trim().endsWith('..n')) { result.template += ` ` } - result.template += `
` + result.template += '
' break; case 'REQUIREMENT_SUBGROUP': - result.template += `
` + result.template += '
' if (fragment[el].cardinality.toString().trim().endsWith('..n')) { result.data_part[`html_${stringToProperty(fragment[el].requestpath)}`]='' @@ -668,15 +666,8 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { result[option_variable] = opt_var result.exp[`${select_variable}`] = result[option_variable][0].value result.template += ` - - - ` + + ` } else { //render normally this element result = json2ESPD_v4({ e: tmp_cmp }, result) @@ -686,7 +677,7 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { //The section is shown depending on the value in elementcode field result.template += `` + result.template += '' } else { //render normally this element result = json2ESPD_v4({ e: tmp_cmp }, result) @@ -701,7 +692,7 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { if (fragment[el].cardinality.toString().trim().endsWith('..n')) { result.template += ` ` } @@ -743,17 +734,14 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { if (['QUESTION_GROUP', 'QUESTION_SUBGROUP'].indexOf(tmp_cmp.type) != -1) { if (['ONTRUE', 'ONFALSE'].indexOf(tmp_cmp.elementcode) != -1) { result.template += ` -
- ` +
` result = json2ESPD_v4({ e: tmp_cmp }, result) - result.template += ` -
` } if (tmp_cmp.elementcode == 'ON*') { result.template += `
` result = json2ESPD_v4({ e: tmp_cmp }, result) - result.template += '
' } + result.template += '
' } if (tmp_cmp.type == 'CAPTION') { @@ -761,7 +749,7 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { } if (tmp_cmp.type == 'LEGISLATION') { - result.template += `LEGISLATION` + result.template += 'LEGISLATION' } } } @@ -769,7 +757,7 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { if (fragment[el].cardinality.toString().trim().endsWith('..n')) { result.template += ` ` } @@ -822,7 +810,7 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { } if (tmp_cmp.type == 'LEGISLATION') { - result.template += `LEGISLATION` + result.template += 'LEGISLATION' } } } @@ -830,7 +818,7 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { if (fragment[el].cardinality.toString().trim().endsWith('..n')) { result.template += ` ` } @@ -866,7 +854,7 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { break; case 'LEGISLATION': - result.template += `LEGISLATION` + result.template += 'LEGISLATION' break; case 'ADDITIONAL_DESCRIPTION_LINE': case 'CAPTION': @@ -925,6 +913,14 @@ function json2ESPD_v4(fragment, result = { sel_count: 0, template: ''}) { return result } +/** + * Auxiliary function to transform the espd_json to Vue component for HTML visualisation + * JSON to BootstrapVue for ESPD v4.0.0 + */ +function json2HTML_v4(fragment, result){ + +} + /** * Class to store the data for ESPD and the structure *