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
ac03cab9
Commit
ac03cab9
authored
Aug 24, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add saveOrigValue option for render()
now it's useful only for tests
parent
35492a16
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
1 deletion
+19
-1
jsonform.gadget.js
jsonform.gadget.js
+2
-0
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+15
-0
test/jsonform_test.js
test/jsonform_test.js
+2
-1
No files found.
jsonform.gadget.js
View file @
ac03cab9
...
@@ -599,6 +599,7 @@
...
@@ -599,6 +599,7 @@
key
:
options
.
key
,
key
:
options
.
key
,
value
:
JSON
.
stringify
(
options
.
value
)
||
'
""
'
,
value
:
JSON
.
stringify
(
options
.
value
)
||
'
""
'
,
schema
:
JSON
.
stringify
(
options
.
schema
),
schema
:
JSON
.
stringify
(
options
.
schema
),
saveOrigValue
:
options
.
saveOrigValue
,
schema_url
:
options
.
schema_url
,
schema_url
:
options
.
schema_url
,
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
editable
:
options
.
editable
===
undefined
?
true
:
options
.
editable
});
});
...
@@ -677,6 +678,7 @@
...
@@ -677,6 +678,7 @@
schema
:
schema
,
schema
:
schema
,
schema_path
:
""
,
schema_path
:
""
,
document
:
json_document
,
document
:
json_document
,
saveOrigValue
:
g
.
state
.
saveOrigValue
,
required
:
true
,
required
:
true
,
top
:
true
top
:
true
});
});
...
...
jsonform/gadget_json_generated_form_child.js
View file @
ac03cab9
...
@@ -274,6 +274,7 @@
...
@@ -274,6 +274,7 @@
schema_path
:
options
.
schema_path
,
schema_path
:
options
.
schema_path
,
document
:
options
.
default_dict
,
document
:
options
.
default_dict
,
display_label
:
options
.
parent_type
!==
"
array
"
,
display_label
:
options
.
parent_type
!==
"
array
"
,
saveOrigValue
:
g
.
props
.
saveOrigValue
,
scope
:
scope
scope
:
scope
})
})
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -720,6 +721,19 @@
...
@@ -720,6 +721,19 @@
if
(
getDocumentType
(
json_field
.
type
)
===
"
string
"
)
{
if
(
getDocumentType
(
json_field
.
type
)
===
"
string
"
)
{
type
=
json_field
.
type
;
type
=
json_field
.
type
;
}
// else json_field.type is array so we use type
}
// else json_field.type is array so we use type
if
([
"
object
"
,
"
array
"
].
indexOf
(
type
)
>=
0
&&
default_value
!==
undefined
&&
getDocumentType
(
default_value
)
!==
type
)
{
if
(
gadget
.
props
.
saveOrigValue
)
{
// XXX is not useful for user
// only for tests
json_field
=
{
const
:
default_value
};
}
else
{
gadget
.
props
.
changed
=
true
;
}
}
if
(
type
===
undefined
&&
default_value
!==
undefined
)
{
if
(
type
===
undefined
&&
default_value
!==
undefined
)
{
type
=
getDocumentType
(
default_value
);
type
=
getDocumentType
(
default_value
);
}
}
...
@@ -1617,6 +1631,7 @@
...
@@ -1617,6 +1631,7 @@
schema
=
options
.
schema
,
schema
=
options
.
schema
,
root
;
root
;
g
.
props
.
change
=
false
;
g
.
props
.
change
=
false
;
g
.
props
.
saveOrigValue
=
options
.
saveOrigValue
;
g
.
props
.
inputs
=
[];
g
.
props
.
inputs
=
[];
g
.
props
.
add_buttons
=
[];
g
.
props
.
add_buttons
=
[];
g
.
props
.
add_custom_data
=
{};
g
.
props
.
add_custom_data
=
{};
...
...
test/jsonform_test.js
View file @
ac03cab9
...
@@ -178,7 +178,8 @@
...
@@ -178,7 +178,8 @@
.
push
(
function
(
g
)
{
.
push
(
function
(
g
)
{
var
opt
=
{
var
opt
=
{
key
:
key
,
key
:
key
,
value
:
value
value
:
value
,
saveOrigValue
:
true
};
};
gadget
=
g
;
gadget
=
g
;
if
(
schema
!==
undefined
)
{
if
(
schema
!==
undefined
)
{
...
...
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