<commit_before>/**
 * @file xsdwebform.parser.html.js
 * XSD Schema to HTML5 Web Form
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (C) 2017 EEA, Eworx, <NAME>. All rights reserved.
 */
'use strict';

import XSDWebFormParserError from './xsdwebform.parser.error.js';

/**
 * Class XSDWebFormParserHTMLTags
 * Parser for XSD Schema Tags 
 */
class XSDWebFormParserHTMLTags {
	/**
	 * Class constructor
	 */
	constructor() {
		this.HTMLObjects = [];
		this.LabelContentObjects = [];
		this.TextContentObjects = [];
		this.showLog = false;
		this.verbose = false;

		this.HTML_TYPES = {
			"page": this.parsePage,
			"form": this.parseForm,
			"group": this.parseGroup,
			"subgroup": this.parseSubGroup,
			"item": this.parseItem,
			"input": this.parseInput,
			"text": this.parseText,
			"number": this.parseNumber,
			//TODO: "decimal": this.parseDecimal,
			"positivenumber": this.parseNumberP,
			"date": this.parseDate,
			"select": this.parseSelect,
			"lookup": this.parseLookup,
			"radio": this.parseRadio,
			"checkbox": this.parseCheckbox,
			"radioorselect" : this.decideRadioCheck
		};

		this.XSD_HTML_TYPES = {
			"xs:integer": "number", //TODO: pattern
			"xs:decimal": "number", //TODO: pattern="[0-9]+([\.,][0-9]+)?" step="0.01"(?) https://stackoverflow.com/questions/15303940/how-to-handle-floats-and-decimal-separators-with-html5-input-type-number
			"NonNegativeIntegerType": "positivenumber",
			"xs:date": "date",
			"DateType": "date",
			"xs:string": "input",
			"xs:boolean": "radioorselect"
		};//TODO: Array of Types

		this.XSD_PROPERTIES = {
			"minInclusive": (inp) => { return `min="${inp}"`; },
			"maxInclusive": (inp) => { return `max="${inp}"`; },
			"minLength": (inp) => { return `minlength="${inp}"`; },
			"maxLength": (inp) => { return `maxlength="${inp}"`; },
			"multiValueDelim":  (inp) => { return `placeholder="use ${inp} separator (e.g. text${inp}text)"`; },
			"minOccurs": () => {},
			"maxOccurs": () => {},
			"totalDigits": (inp) => { return `pattern="[0-9]{1,${inp}}"`; },
		};
		
		//DD Custom Properties<commit_msg>Updated TODO in Xsdwebform html Parser<commit_after>/**
 * @file xsdwebform.parser.html.js
 * XSD Schema to HTML5 Web Form
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (C) 2017 EEA, Eworx, George Bouris. All rights reserved.
 */
'use strict';

import XSDWebFormParserError from './xsdwebform.parser.error.js';

/**
 * Class XSDWebFormParserHTMLTags
 * Parser for XSD Schema Tags 
 */
class XSDWebFormParserHTMLTags {
	/**
	 * Class constructor
	 */
	constructor() {
		this.HTMLObjects = [];
		this.LabelContentObjects = [];
		this.TextContentObjects = [];
		this.showLog = false;
		this.verbose = false;

		this.HTML_TYPES = {
			"page": this.parsePage,
			"form": this.parseForm,
			"group": this.parseGroup,
			"subgroup": this.parseSubGroup,
			"item": this.parseItem,
			"input": this.parseInput,
			"text": this.parseText,
			"number": this.parseNumber,
			//TODO: "decimal": this.parseDecimal,
			"positivenumber": this.parseNumberP,
			"date": this.parseDate,
			"select": this.parseSelect,
			"lookup": this.parseLookup,
			"radio": this.parseRadio,
			"checkbox": this.parseCheckbox,
			"radioorselect" : this.decideRadioCheck
		};

		this.XSD_HTML_TYPES = {
			"xs:integer": "number", //TODO: pattern ? totalDigits
			"xs:decimal": "number", //TODO: pattern="[0-9]+([\.,][0-9]+)?" step="0.01"(?) https://stackoverflow.com/questions/15303940/how-to-handle-floats-and-decimal-separators-with-html5-input-type-number
			"NonNegativeIntegerType": "positivenumber",
			"xs:date": "date",
			"DateType": "date",
			"xs:string": "input",
			"xs:boolean": "radioorselect"
		};//TODO: Array of Types

		this.XSD_PROPERTIES = {
			"minInclusive": (inp) => { return `min="${inp}"`; },
			"maxInclusive": (inp) => { return `max="${inp}"`; },
			"minLength": (inp) => { return `minlength="${inp}"`; },
			"maxLength": (inp) => { return `maxlength="${inp}"`; },
			"multiValueDelim":  (inp) => { return `placeholder="use ${inp} separator (e.g. text${inp}text)"`; },
			"minOccurs": () => {},
			"maxOccurs": () => {},
			"totalDigits": (inp) => { return `pattern="[0-9]{1,${inp}}"`; },
		};
		
		//DD Custom Properties
{'fraction_non_alphanumeric': 0.20281220209723547, 'fraction_numerical': 0.011439466158245948, 'mean_word_length': 4.0627261761158024, 'pattern_counts': {'":': 60, '<': 10, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1536849', 'n_tokens_mistral': 1717, 'n_tokens_neox': 1524, 'n_words': 286}