@live-change/vue3-components 0.2.18 → 0.2.19
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/form/CommandForm.vue +4 -4
- package/form/DefinedForm.vue +23 -3
- package/package.json +3 -3
package/form/CommandForm.vue
CHANGED
|
@@ -92,16 +92,16 @@
|
|
|
92
92
|
},
|
|
93
93
|
serviceDefinition() {
|
|
94
94
|
if(this.serviceDefinitionSource) {
|
|
95
|
-
if(typeof this.
|
|
96
|
-
const definition = this.$api.
|
|
95
|
+
if(typeof this.servicesDefinitionSource == 'string') {
|
|
96
|
+
const definition = this.$api.serviceDefinitions.value
|
|
97
97
|
.find(service => service.name == this.serviceDefinitionSource)
|
|
98
98
|
return definition
|
|
99
99
|
} else {
|
|
100
100
|
return this.serviceDefinitionSource
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
if(!this.$api.
|
|
104
|
-
const definition = this.$api.
|
|
103
|
+
if(!this.$api.servicesDefinitions.value) return
|
|
104
|
+
const definition = this.$api.servicesDefinitions.value.find(service => service.name == this.service)
|
|
105
105
|
return definition
|
|
106
106
|
},
|
|
107
107
|
actionDefinition() {
|
package/form/DefinedForm.vue
CHANGED
|
@@ -71,16 +71,17 @@
|
|
|
71
71
|
|
|
72
72
|
reset(initialValue) {
|
|
73
73
|
if(this.definition.type) {
|
|
74
|
-
let defaultValue = this.definition.
|
|
75
|
-
if(
|
|
74
|
+
let defaultValue = this.definition.defaultValue
|
|
75
|
+
if(defaultValue === undefined) {
|
|
76
76
|
switch(this.definition.type) {
|
|
77
77
|
case "String" : defaultValue = ""; break;
|
|
78
78
|
case "Object" : defaultValue = {}; break;
|
|
79
79
|
case "Number" : defaultValue = 0; break;
|
|
80
80
|
case "Array" : defaultValue = []; break;
|
|
81
|
+
default: defaultValue = null
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
|
-
this.setValue(initialValue
|
|
84
|
+
this.setValue(initialValue ?? defaultValue)
|
|
84
85
|
} else {
|
|
85
86
|
this.setValue(initialValue)
|
|
86
87
|
}
|
|
@@ -273,11 +274,30 @@
|
|
|
273
274
|
this.elements = []
|
|
274
275
|
if(!this.data[this.property]) this.data[this.property] = []
|
|
275
276
|
this.object = this.data[this.property]
|
|
277
|
+
this.unwatch = watch(() => this.data[this.property], () => {
|
|
278
|
+
this.object = this.data[this.property]
|
|
279
|
+
while(this.elements.length > this.object.length) {
|
|
280
|
+
this.elements.pop()
|
|
281
|
+
}
|
|
282
|
+
while(this.elements.length < this.object.length) {
|
|
283
|
+
this.elements.push(this.newElement(this.elements.length))
|
|
284
|
+
}
|
|
285
|
+
}, { deep: true })
|
|
276
286
|
}
|
|
277
287
|
|
|
278
288
|
setProperty(name) {
|
|
289
|
+
if(this.unwatch) this.unwatch()
|
|
279
290
|
this.property = name
|
|
280
291
|
this.object = this.data[this.property]
|
|
292
|
+
this.unwatch = watch(() => this.data[this.property], () => {
|
|
293
|
+
this.object = this.data[this.property]
|
|
294
|
+
while(this.elements.length > this.object.length) {
|
|
295
|
+
this.elements.pop()
|
|
296
|
+
}
|
|
297
|
+
while(this.elements.length < this.object.length) {
|
|
298
|
+
this.elements.push(this.newElement(this.elements.length))
|
|
299
|
+
}
|
|
300
|
+
}, { deep: true })
|
|
281
301
|
}
|
|
282
302
|
|
|
283
303
|
newElement(index) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.19",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/live-change/live-change-framework-vue3",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/vue3-ssr": "^0.2.
|
|
24
|
+
"@live-change/vue3-ssr": "^0.2.19",
|
|
25
25
|
"debug": "^4.3.4",
|
|
26
26
|
"mitt": "3.0.0",
|
|
27
27
|
"vue": "^3.2.47"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "90a9050401e8ac3f2b45505526153b07ccde3839"
|
|
30
30
|
}
|