diff --git a/package-lock.json b/package-lock.json index 5410cfb..a4d6156 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "schema-maker", - "version": "1.0.3", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "schema-maker", - "version": "1.0.3", + "version": "1.1.1", "license": "ISC", "dependencies": { "basiscore": "^2.34.0" diff --git a/src/SchemaUtil.ts b/src/SchemaUtil.ts index cd7de8c..e40b8a1 100644 --- a/src/SchemaUtil.ts +++ b/src/SchemaUtil.ts @@ -620,7 +620,7 @@ export default class SchemaUtil { edited.id = parseInt(editedPart.values[0].value); } else if (editedPart.part == 2) { let value = editedPart.values[0].value; - if(value && typeof value != "string"){ + if(value && typeof value != "string" &&typeof value != "number"){ edited.valueData = value edited.value = value.value }else{ @@ -657,7 +657,7 @@ export default class SchemaUtil { let value = addedItem.parts.find((x) => x.part == 2)?.values[0] .value; let valueData : NodeJS.Dict - if(value && typeof value != "string"){ + if(value && typeof value != "string" &&typeof value != "number"){ valueData = value value = value.value } diff --git a/src/components/modules/PartBaseModule.ts b/src/components/modules/PartBaseModule.ts index 89f9925..12cb6d3 100644 --- a/src/components/modules/PartBaseModule.ts +++ b/src/components/modules/PartBaseModule.ts @@ -32,14 +32,14 @@ export default abstract class PartBaseModule< if (questionPart) { this.data.viewType = schemaId; this.data.caption = - typeof questionPart.caption == "string" + typeof questionPart.caption == "string" || typeof questionPart.caption != "number" ? questionPart.caption : questionPart.caption ? "value" in questionPart.caption && questionPart.caption["value"] : undefined; this.data["captionData"] = - typeof this.data.caption == "string" + typeof this.data.caption == "string" ||typeof this.data.caption == "number" ? null : this.data.caption ? this.data.caption @@ -79,7 +79,7 @@ export default abstract class PartBaseModule< const caption = SchemaUtil.getCaptionProperty(result); if (caption != null) { this.data.caption = caption; - if (typeof caption != "string") { + if (typeof caption != "string"||typeof caption != "number") { this.data.caption = caption.value; this.data["captionData"]= caption; } diff --git a/src/components/modules/question/QuestionModule.ts b/src/components/modules/question/QuestionModule.ts index de466b8..60b72d8 100644 --- a/src/components/modules/question/QuestionModule.ts +++ b/src/components/modules/question/QuestionModule.ts @@ -32,7 +32,7 @@ export default class QuestionModule extends ContainerModule { } setTitleData() { this._data.titleData = - typeof this._data.title == "string" ? null : this._data.title; + typeof this._data.title == "string" || "number" ? null : this._data.title; } getTitleData() { return this._data.titleData; @@ -63,7 +63,7 @@ export default class QuestionModule extends ContainerModule { this._data.title = value; } this.container.querySelector("[data-bc-title]").innerHTML = - typeof this._data.title == "string" + typeof this._data.title == "string" ||typeof this._data.title == "number" ? this._data.title : this._data.title?.value; this.setTitleData(); @@ -254,7 +254,7 @@ export default class QuestionModule extends ContainerModule { ...(this._schema && { vocab: this._schema.vocab }), ...(this._data.title && { title: - typeof this._data.title == "string" + typeof this._data.title == "string" ||typeof this._data.title == "number" ? this._data.title : this._data.title.value, }), diff --git a/src/components/modules/section/SectionModule.ts b/src/components/modules/section/SectionModule.ts index e61e3a9..55765bd 100644 --- a/src/components/modules/section/SectionModule.ts +++ b/src/components/modules/section/SectionModule.ts @@ -22,7 +22,7 @@ export default class SectionModule extends ContainerModule { } setTitleData() { this._data.titleData = - typeof this._data.title == "string" ? undefined : this._data.title; + typeof this._data.title == "string" || typeof this._data.title == "number" ? undefined : this._data.title; } getTitleData() { return this._data.titleData; @@ -38,7 +38,7 @@ export default class SectionModule extends ContainerModule { this._data.title = value; } this.container.querySelector("[data-bc-title]").innerHTML = - typeof this._data.title == "string" + typeof this._data.title == "string" || typeof this._data.title == "number" ? this._data.title : this._data.title?.value; this.setTitleData();