@cybertale/form 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -45,7 +45,10 @@ export default class DataListComponent extends Vue {
|
|
|
45
45
|
options: Option[] = []
|
|
46
46
|
|
|
47
47
|
returnIfExists (tag: number): string {
|
|
48
|
-
|
|
48
|
+
if (this.object.Stats[tag]) {
|
|
49
|
+
return this.object.Stats[tag].Data
|
|
50
|
+
}
|
|
51
|
+
return ''
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
async created() {
|
|
@@ -70,7 +73,7 @@ export default class DataListComponent extends Vue {
|
|
|
70
73
|
|
|
71
74
|
getValue (statEnum: number, indexStatTypeEnum = StatTypeEnum.Option) : string {
|
|
72
75
|
if (this.object.Stats[statEnum]) {
|
|
73
|
-
if (this.object.Stats[indexStatTypeEnum] && this.object.Stats[statEnum] &&
|
|
76
|
+
if (this.object.Stats[indexStatTypeEnum] && this.object.Stats[statEnum] && this.isJSON(this.object.Stats[statEnum].Data)) {
|
|
74
77
|
const data = JSON.parse(this.object.Stats[statEnum].Data)
|
|
75
78
|
return data[Number(this.object.Stats[indexStatTypeEnum].Data)]
|
|
76
79
|
} else {
|
|
@@ -82,11 +85,14 @@ export default class DataListComponent extends Vue {
|
|
|
82
85
|
|
|
83
86
|
get valueName (): string {
|
|
84
87
|
const temp = this.options.find((option: any) => option.id === this.getValue(StatTypeEnum.Value, StatTypeEnum.ValueIndices))
|
|
85
|
-
|
|
88
|
+
if (!temp) { return this.getValue(StatTypeEnum.Value, StatTypeEnum.ValueIndices) }
|
|
89
|
+
return temp?.name
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
attributeCheck (statType : number) : boolean | string {
|
|
89
|
-
|
|
93
|
+
if (this.object.Stats[statType] === undefined) { return false }
|
|
94
|
+
if (this.object.Stats[statType].Data === '') { return false }
|
|
95
|
+
return this.object.Stats[statType].Data
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
validate () : string {
|
|
@@ -103,21 +109,23 @@ export default class DataListComponent extends Vue {
|
|
|
103
109
|
this.regionType.RegionTypes[object.Region].ObjectTypes[object.ObjectEnum].ChooseSubType(object, value)
|
|
104
110
|
}
|
|
105
111
|
|
|
106
|
-
|
|
107
|
-
|
|
112
|
+
check (id : string) : boolean {
|
|
113
|
+
if (this.object.Stats[this.statTypeEnum.Value] === undefined || id === undefined) { return false }
|
|
114
|
+
return this.object.Stats[this.statTypeEnum.Value].Data === id.toString()
|
|
108
115
|
}
|
|
109
116
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return false;
|
|
117
|
+
isJSON (str: string): boolean {
|
|
118
|
+
let temp = null
|
|
119
|
+
try {
|
|
120
|
+
temp = JSON.parse(str)
|
|
121
|
+
} catch (e) {
|
|
122
|
+
return false
|
|
123
|
+
}
|
|
124
|
+
return Array.isArray(temp)
|
|
119
125
|
}
|
|
126
|
+
|
|
120
127
|
}
|
|
128
|
+
|
|
121
129
|
</script>
|
|
122
130
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
123
131
|
<style scoped>
|