Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vue-unistra
formbuilder
Commits
424da58a
Commit
424da58a
authored
Dec 17, 2020
by
Yoran Hillion
Browse files
✨
(formrenderer) : Quick and dirty form prefill
parent
1d4748fe
Changes
4
Hide whitespace changes
Inline
Side-by-side
package.json
View file @
424da58a
{
"name"
:
"@vue-unistra/unistra-formbuilder"
,
"version"
:
"2.0.
6
-test"
,
"version"
:
"2.0.
7
-test"
,
"main"
:
"dist/index.js"
,
"files"
:
[
"dist/*"
,
...
...
src/components/formrenderer/UsfRenderer/UsfRenderer.vue
View file @
424da58a
<
template
>
<v-form
ref=
"form"
lazy-validation
@
submit.prevent=
"submitForm"
>
<usf-field
v-for=
"(field, index) in root"
:key=
"field.id"
:field-id=
"field"
:field-index=
"index"
<v-form
ref=
"form"
lazy-validation
@
submit.prevent=
"submitForm"
>
<usf-field
v-for=
"(field, index) in root"
:key=
"field.id"
:field-id=
"field"
:field-index=
"index"
/>
<v-btn
block
:color=
"submitButtonColor"
:disabled=
"isSubmitButtonDisabled"
:type=
"submitButtonType"
>
<v-btn
block
:color=
"submitButtonColor"
:disabled=
"isSubmitButtonDisabled"
:type=
"submitButtonType"
>
{{
submitButtonText
}}
</v-btn>
</v-form>
...
...
@@ -57,6 +62,11 @@ export default {
default
:
()
=>
({}),
required
:
false
,
},
submittedData
:
{
type
:
Object
,
default
:
()
=>
({}),
required
:
false
,
},
},
computed
:
{
...
mapState
(
'
form
'
,
[
'
root
'
]),
...
...
@@ -93,6 +103,13 @@ export default {
this
.
$store
.
dispatch
(
'
user/update
'
,
value
);
},
},
submittedData
:
{
deep
:
true
,
immediate
:
true
,
handler
(
value
)
{
this
.
$store
.
dispatch
(
'
submission/update
'
,
value
);
},
},
},
};
</
script
>
src/store/modules/submission/actions.js
View file @
424da58a
...
...
@@ -2,11 +2,16 @@ const resetState = ({ commit }) => {
commit
(
'
RESET_STATE
'
);
};
const
update
=
({
commit
},
payload
)
=>
{
commit
(
'
UPDATE
'
,
payload
);
};
const
updateValue
=
({
commit
},
payload
)
=>
{
commit
(
'
UPDATE_VALUE
'
,
payload
);
};
export
default
{
resetState
,
update
,
updateValue
,
};
src/store/modules/submission/mutations.js
View file @
424da58a
...
...
@@ -4,11 +4,16 @@ const RESET_STATE = (state) => {
Object
.
keys
(
state
).
forEach
(
key
=>
delete
state
[
key
]);
};
const
UPDATE
=
(
state
,
payload
)
=>
{
Object
.
entries
(
payload
).
map
(([
key
,
value
])
=>
Vue
.
set
(
state
,
key
,
value
));
};
const
UPDATE_VALUE
=
(
state
,
payload
)
=>
{
Vue
.
set
(
state
,
payload
.
key
,
payload
.
value
);
};
export
default
{
RESET_STATE
,
UPDATE
,
UPDATE_VALUE
,
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment