@live-change/vue3-components 0.1.9 → 0.1.13
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/.idea/misc.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/form/CommandForm.vue +8 -20
- package/form/DefinedForm.vue +8 -2
- package/logic/LoadingZone.vue +10 -0
- package/logic/WorkingZone.vue +12 -2
- package/package.json +2 -3
- package/vue3-components.iml +9 -0
package/.idea/misc.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/vue3-components.iml" filepath="$PROJECT_DIR$/vue3-components.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
package/form/CommandForm.vue
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
:class="class"
|
|
12
12
|
:style="style"
|
|
13
13
|
v-slot="{ data }">
|
|
14
|
-
<slot v-bind="{ data }"></slot>
|
|
15
|
-
</defined-form>
|
|
14
|
+
<slot v-bind="{ data, submit }"></slot>
|
|
15
|
+
</defined-form>
|
|
16
16
|
<slot v-if="state == 'error'" name="error">
|
|
17
17
|
<div class="alert alert-danger" role="alert">error</div>
|
|
18
18
|
</slot>
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
type: String
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
|
+
emits: ['submit', 'done', 'error'],
|
|
79
80
|
inject: ['loadingZone', 'workingZone'],
|
|
80
81
|
data() {
|
|
81
82
|
return {
|
|
@@ -98,31 +99,17 @@
|
|
|
98
99
|
return this.serviceDefinitionSource
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
|
-
if(!this.$api.metadata.
|
|
102
|
-
const definition = this.$api.metadata.
|
|
103
|
-
return definition
|
|
104
|
-
},
|
|
105
|
-
serviceDefinitionMatch() {
|
|
106
|
-
//console.log("METADATA SERVICE DEFS", this.$api.metadata.serviceDefinitions)
|
|
107
|
-
if(!this.$api.metadata.serviceDefinitions) return
|
|
108
|
-
const definition = this.serviceDefinition
|
|
109
|
-
if(definition.credentials) {
|
|
110
|
-
const credentials = {
|
|
111
|
-
roles: (this.$session && this.$session.session.roles) || [],
|
|
112
|
-
user: this.$session && this.$session.session.user
|
|
113
|
-
}
|
|
114
|
-
//console.log("DEFN CRED", JSON.stringify(definition.credentials), "==", JSON.stringify(credentials))
|
|
115
|
-
if(JSON.stringify(definition.credentials) != JSON.stringify(credentials)) return
|
|
116
|
-
}
|
|
102
|
+
if(!this.$api.metadata.api?.services) return
|
|
103
|
+
const definition = this.$api.metadata.api?.services.find(service => service.name == this.service)
|
|
117
104
|
return definition
|
|
118
105
|
},
|
|
119
106
|
actionDefinition() {
|
|
120
|
-
return this.
|
|
107
|
+
return this.serviceDefinition
|
|
121
108
|
&& this.serviceDefinition.actions[this.action]
|
|
122
109
|
},
|
|
123
110
|
definitionNotFound() {
|
|
124
111
|
return (this.$api.metadata.serviceDefinitions && !this.serviceDefinition)
|
|
125
|
-
|| (this.
|
|
112
|
+
|| (this.serviceDefinition && !this.actionDefinition)
|
|
126
113
|
},
|
|
127
114
|
loadingError() {
|
|
128
115
|
return this.definitionNotFound ? "notFound" : this.serviceDefinitionsError
|
|
@@ -303,6 +290,7 @@
|
|
|
303
290
|
})
|
|
304
291
|
},
|
|
305
292
|
handleSubmitEvent(ev) {
|
|
293
|
+
console.log("HANDLE SUBMIT EVENT!", ev)
|
|
306
294
|
ev.preventDefault()
|
|
307
295
|
this.submit()
|
|
308
296
|
},
|
package/form/DefinedForm.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component v-if="tag" :is="tag" v-on:submit="ev =>
|
|
2
|
+
<component v-if="tag" :is="tag" v-on:submit="ev => handleSubmitEvent(ev)" :class="class" :style="style">
|
|
3
3
|
<slot v-bind="{ data }"></slot>
|
|
4
4
|
</component>
|
|
5
5
|
<slot v-else v-bind="{ data }"></slot>
|
|
@@ -388,6 +388,7 @@
|
|
|
388
388
|
type: String
|
|
389
389
|
}
|
|
390
390
|
},
|
|
391
|
+
//emits: ['submit', 'update'],
|
|
391
392
|
provide() {
|
|
392
393
|
return {
|
|
393
394
|
form: {
|
|
@@ -407,7 +408,7 @@
|
|
|
407
408
|
validate: () => this.validate(),
|
|
408
409
|
clearFieldValidation: (propName) => this.clearFieldValidation(propName),
|
|
409
410
|
clearValidation: () => this.clearValidation(),
|
|
410
|
-
|
|
411
|
+
|
|
411
412
|
addElementToArray: (propName, initialValue) => this.addElementToArray(propName, initialValue),
|
|
412
413
|
removeElementFromArray: (propName, index) => this.removeElementFromArray(propName, index)
|
|
413
414
|
}
|
|
@@ -519,6 +520,11 @@
|
|
|
519
520
|
let position = getElementPositionInDocument(errorFieldElement)
|
|
520
521
|
window.scrollTo(0, position.y - 100) /// TODO: remove fixed nav-bar and do it properly.
|
|
521
522
|
},
|
|
523
|
+
handleSubmitEvent(ev) {
|
|
524
|
+
console.log("HANDLE SUBMIT!", ev)
|
|
525
|
+
ev.preventDefault()
|
|
526
|
+
this.$emit('submit', ev)
|
|
527
|
+
}
|
|
522
528
|
},
|
|
523
529
|
created() {
|
|
524
530
|
this.initForm()
|
package/logic/LoadingZone.vue
CHANGED
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
export default {
|
|
39
39
|
name: "LoadingZone",
|
|
40
|
+
emits: ['isLoading', 'error'],
|
|
40
41
|
props: {
|
|
41
42
|
suspense: {
|
|
42
43
|
type: Boolean,
|
|
@@ -60,7 +61,15 @@
|
|
|
60
61
|
errors
|
|
61
62
|
}
|
|
62
63
|
},
|
|
64
|
+
watch: {
|
|
65
|
+
isLoading(l) {
|
|
66
|
+
this.$emit('isLoading', l)
|
|
67
|
+
}
|
|
68
|
+
},
|
|
63
69
|
computed: {
|
|
70
|
+
isLoading() {
|
|
71
|
+
return this.loading.length > 0
|
|
72
|
+
}
|
|
64
73
|
},
|
|
65
74
|
methods: {
|
|
66
75
|
loadingStarted(task) {
|
|
@@ -122,6 +131,7 @@
|
|
|
122
131
|
this.$allLoadingTasks.splice(this.$allLoadingTasks.indexOf(task), 1)
|
|
123
132
|
if(this.$allLoadingErrors)
|
|
124
133
|
this.$allLoadingErrors.push({ task, reason })
|
|
134
|
+
this.$emit('error', this.errors)
|
|
125
135
|
},
|
|
126
136
|
addLoadingPromise(name, promise) {
|
|
127
137
|
let task = this.loadingStarted({ name, promise })
|
package/logic/WorkingZone.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot v-bind="{ isWorking: !!working.length, working, errors }"></slot>
|
|
1
|
+
<template>
|
|
2
|
+
<slot v-bind="{ isWorking: !!working.length, working, errors }"></slot>
|
|
3
3
|
<slot name="working" v-if="working.length && !errors.length">
|
|
4
4
|
Processing...
|
|
5
5
|
</slot>
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
export default {
|
|
23
23
|
name: "WorkingZone",
|
|
24
|
+
emits: ['isWorking', 'error'],
|
|
24
25
|
data() {
|
|
25
26
|
return {
|
|
26
27
|
working: [],
|
|
@@ -29,7 +30,15 @@
|
|
|
29
30
|
connectionProblem: false
|
|
30
31
|
}
|
|
31
32
|
},
|
|
33
|
+
watch: {
|
|
34
|
+
isWorking(w) {
|
|
35
|
+
this.$emit('isWorking', w)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
32
38
|
computed: {
|
|
39
|
+
isWorking() {
|
|
40
|
+
return this.working.length > 0
|
|
41
|
+
}
|
|
33
42
|
},
|
|
34
43
|
methods: {
|
|
35
44
|
workingStarted(task) {
|
|
@@ -91,6 +100,7 @@
|
|
|
91
100
|
this.$allWorkingTasks.splice(this.$allWorkingTasks.indexOf(task), 1)
|
|
92
101
|
if(this.$allWorkingErrors)
|
|
93
102
|
this.$allWorkingErrors.push({ task, reason })
|
|
103
|
+
this.$emit('error', this.errors)
|
|
94
104
|
},
|
|
95
105
|
addWorkingPromise(name, promise) {
|
|
96
106
|
let task = this.workingStarted({ name, promise })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,8 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/live-change/vue3-components",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@vue/server-renderer": "^3.2.4",
|
|
25
24
|
"debug": "^4.3.2",
|
|
26
|
-
"vue": "^3.2.
|
|
25
|
+
"vue": "^3.2.21"
|
|
27
26
|
}
|
|
28
27
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
4
|
+
<exclude-output />
|
|
5
|
+
<content url="file://$MODULE_DIR$" />
|
|
6
|
+
<orderEntry type="inheritedJdk" />
|
|
7
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
8
|
+
</component>
|
|
9
|
+
</module>
|