enonic-wizardry
Advanced tools
Comparing version 0.1.9 to 0.1.10
@@ -170,2 +170,3 @@ "use strict"; | ||
var minimumOccurrencesAttr = xpath.select1("./occurrences/@minimum", input); | ||
var maximumOccurrencesAttr = xpath.select1("./occurrences/@maximum", input); | ||
var name = nameAttr.value; | ||
@@ -176,9 +177,15 @@ var comment = xpath.select1("string(./label)", input); | ||
: true; | ||
var type = getType(typeAttr ? typeAttr.value : ""); | ||
var type = getType(typeAttr ? typeAttr.value : "", { | ||
maxOccurrences: maximumOccurrencesAttr | ||
? Number.parseInt(maximumOccurrencesAttr.value) | ||
: undefined | ||
}); | ||
return { name: name, type: type, comment: comment, optional: optional }; | ||
} | ||
function getType(inputType) { | ||
function getType(inputType, options) { | ||
switch (inputType) { | ||
case "ContentSelector": | ||
return GeneratedFieldType.StringArray; | ||
return options.maxOccurrences === 1 | ||
? GeneratedFieldType.String | ||
: GeneratedFieldType.StringArray; | ||
case "CheckBox": | ||
@@ -185,0 +192,0 @@ return GeneratedFieldType.Boolean; |
{ | ||
"name": "enonic-wizardry", | ||
"version": "0.1.9", | ||
"version": "0.1.10", | ||
"description": "Functional utility library for Enonic XP", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
29238
653