Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
rjs_json_form
Commits
59e8ced8
Commit
59e8ced8
authored
Jun 15, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
state modification catcher fixed
parent
62279dd6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
jsonform.gadget.js
jsonform.gadget.js
+15
-11
No files found.
jsonform.gadget.js
View file @
59e8ced8
...
...
@@ -500,14 +500,19 @@
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
({
key
:
options
.
key
,
value
:
options
.
value
||
""
,
schema
:
options
.
schema
,
value
:
JSON
.
stringify
(
options
.
value
)
||
'
""
'
,
schema
:
JSON
.
stringify
(
options
.
schema
)
,
schema_url
:
options
.
schema_url
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
});
})
.
onStateChange
(
function
(
options
)
{
var
g
=
this
;
.
onStateChange
(
function
()
{
var
g
=
this
,
json_document
=
JSON
.
parse
(
g
.
state
.
value
),
schema
;
if
(
g
.
state
.
schema
!==
undefined
)
{
schema
=
JSON
.
parse
(
g
.
state
.
schema
);
}
g
.
props
.
toplevel
=
true
;
// contain map of current normalized schema
// json pointer and corresponding url
...
...
@@ -537,11 +542,11 @@
}
})
.
push
(
function
()
{
if
(
options
.
schema
)
{
return
options
.
schema
;
if
(
schema
)
{
return
schema
;
}
var
schema_url
=
options
.
schema_url
||
(
options
.
value
&&
options
.
value
.
$schema
);
var
schema_url
=
g
.
state
.
schema_url
||
(
json_document
&&
json_document
.
$schema
);
if
(
schema_url
)
{
return
loadJSONSchema
(
g
,
schema_url
)
.
push
(
function
(
schema_arr
)
{
...
...
@@ -551,11 +556,10 @@
return
{};
})
.
push
(
function
(
schema
)
{
g
.
options
.
schema
=
schema
;
return
g
.
props
.
form_gadget
.
renderForm
({
schema
:
schema
,
schema_path
:
""
,
document
:
options
.
value
,
document
:
json_document
,
required
:
true
,
top
:
true
});
...
...
@@ -603,7 +607,7 @@
// This will prevent the gadget to be changed if
// its parent call render with the same value
// (as ERP5 does in case of formulator error)
g
.
state
.
value
=
value
;
g
.
state
.
value
=
JSON
.
stringify
(
value
)
;
if
(
g
.
state
.
key
)
{
var
form_data
=
{};
value
=
JSON
.
stringify
(
value
);
...
...
Write
Preview
Markdown
is supported
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