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 @@
...
@@ -500,14 +500,19 @@
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
({
return
this
.
changeState
({
key
:
options
.
key
,
key
:
options
.
key
,
value
:
options
.
value
||
""
,
value
:
JSON
.
stringify
(
options
.
value
)
||
'
""
'
,
schema
:
options
.
schema
,
schema
:
JSON
.
stringify
(
options
.
schema
)
,
schema_url
:
options
.
schema_url
,
schema_url
:
options
.
schema_url
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
});
});
})
})
.
onStateChange
(
function
(
options
)
{
.
onStateChange
(
function
()
{
var
g
=
this
;
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
;
g
.
props
.
toplevel
=
true
;
// contain map of current normalized schema
// contain map of current normalized schema
// json pointer and corresponding url
// json pointer and corresponding url
...
@@ -537,11 +542,11 @@
...
@@ -537,11 +542,11 @@
}
}
})
})
.
push
(
function
()
{
.
push
(
function
()
{
if
(
options
.
schema
)
{
if
(
schema
)
{
return
options
.
schema
;
return
schema
;
}
}
var
schema_url
=
options
.
schema_url
||
var
schema_url
=
g
.
state
.
schema_url
||
(
options
.
value
&&
options
.
value
.
$schema
);
(
json_document
&&
json_document
.
$schema
);
if
(
schema_url
)
{
if
(
schema_url
)
{
return
loadJSONSchema
(
g
,
schema_url
)
return
loadJSONSchema
(
g
,
schema_url
)
.
push
(
function
(
schema_arr
)
{
.
push
(
function
(
schema_arr
)
{
...
@@ -551,11 +556,10 @@
...
@@ -551,11 +556,10 @@
return
{};
return
{};
})
})
.
push
(
function
(
schema
)
{
.
push
(
function
(
schema
)
{
g
.
options
.
schema
=
schema
;
return
g
.
props
.
form_gadget
.
renderForm
({
return
g
.
props
.
form_gadget
.
renderForm
({
schema
:
schema
,
schema
:
schema
,
schema_path
:
""
,
schema_path
:
""
,
document
:
options
.
value
,
document
:
json_document
,
required
:
true
,
required
:
true
,
top
:
true
top
:
true
});
});
...
@@ -603,7 +607,7 @@
...
@@ -603,7 +607,7 @@
// This will prevent the gadget to be changed if
// This will prevent the gadget to be changed if
// its parent call render with the same value
// its parent call render with the same value
// (as ERP5 does in case of formulator error)
// (as ERP5 does in case of formulator error)
g
.
state
.
value
=
value
;
g
.
state
.
value
=
JSON
.
stringify
(
value
)
;
if
(
g
.
state
.
key
)
{
if
(
g
.
state
.
key
)
{
var
form_data
=
{};
var
form_data
=
{};
value
=
JSON
.
stringify
(
value
);
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