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
ea3510f6
Commit
ea3510f6
authored
Sep 26, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make possible use complex schema_arr fields as array items
parent
b4d52192
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+18
-7
No files found.
jsonform/gadget_json_generated_form_child.js
View file @
ea3510f6
...
...
@@ -178,13 +178,16 @@
return
input
;
}
function
render_enum_with_title
(
g
,
schema_arr
,
json_document
)
{
function
render_enum_with_title
(
g
,
schema_arr
,
json_document
,
selected_schema
)
{
var
input
=
document
.
createElement
(
"
select
"
),
option
,
i
,
ser_value
,
selected
=
false
;
input
.
size
=
1
;
if
(
json_document
===
undefined
&&
selected_schema
!==
undefined
)
{
json_document
=
selected_schema
.
schema
.
const
;
}
if
(
schema_arr
[
0
].
schema
.
default
)
{
if
(
json_document
===
undefined
)
{
json_document
=
schema_arr
[
0
].
schema
.
default
;
...
...
@@ -333,6 +336,7 @@
type
:
options
.
type
,
required
:
options
.
required
,
delete_button
:
options
.
delete_button
,
selected_schema
:
options
.
selected_schema
,
schema_arr
:
options
.
schema_arr
,
document
:
options
.
json_document
,
display_label
:
options
.
parent_type
!==
"
array
"
,
...
...
@@ -797,7 +801,8 @@
gadget
:
gadget
,
parent_type
:
'
array
'
,
type
:
value
.
type
,
schema_arr
:
[
value
]
selected_schema
:
value
,
schema_arr
:
schema_arr
})
.
push
(
element_append
);
}));
...
...
@@ -824,7 +829,8 @@
gadget
:
gadget
,
parent_type
:
'
array
'
,
type
:
value
.
type
,
schema_arr
:
[
value
]
selected_schema
:
value
,
schema_arr
:
schema_arr
})
.
push
(
element_append
);
}));
...
...
@@ -858,8 +864,12 @@
type_changed
,
queue
=
RSVP
.
Queue
();
// XXX if (ret_arr.length > 1) notify user
schema_ob
=
schemaArrFilteredByDocument
(
schema_arr
,
json_document
)[
0
];
if
(
options
.
selected_schema
)
{
schema_ob
=
options
.
selected_schema
;
}
else
{
// XXX if (ret_arr.length > 1) notify user
schema_ob
=
schemaArrFilteredByDocument
(
schema_arr
,
json_document
)[
0
];
}
schema
=
schema_ob
.
schema
;
schema_path
=
schema_ob
.
schema_path
;
...
...
@@ -941,7 +951,7 @@
.
join
(
"
"
)
// use non-breaking hyphen
.
replace
(
/-/g
,
"
‑
"
);
if
(
label_text
)
{
if
(
property_name
||
options
.
top
)
{
if
(
options
.
top
)
{
label
=
document
.
createElement
(
"
span
"
);
label
.
textContent
=
label_text
;
...
...
@@ -961,7 +971,7 @@
// render input begin
if
(
!
input
&&
schema_arr
[
0
].
is_arr_of_const
)
{
input
=
render_enum_with_title
(
gadget
,
schema_arr
,
json_document
);
input
=
render_enum_with_title
(
gadget
,
schema_arr
,
json_document
,
options
.
selected_schema
);
}
if
(
!
input
&&
schema
.
const
!==
undefined
)
{
input
=
render_const
(
gadget
,
schema
,
json_document
);
...
...
@@ -1850,6 +1860,7 @@
options
.
document
,
root
,
{
type
:
options
.
type
,
selected_schema
:
options
.
selected_schema
,
required
:
options
.
required
,
delete_button
:
options
.
delete_button
,
top
:
options
.
top
...
...
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