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
a00855c7
Commit
a00855c7
authored
Jan 03, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split renderForm() and rerender()
parent
b7a18928
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
23 deletions
+31
-23
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+31
-23
No files found.
jsonform/gadget_json_generated_form_child.js
View file @
a00855c7
...
@@ -1952,23 +1952,13 @@
...
@@ -1952,23 +1952,13 @@
.
declareMethod
(
'
renderForm
'
,
function
(
options
)
{
.
declareMethod
(
'
renderForm
'
,
function
(
options
)
{
var
g
=
this
,
var
g
=
this
,
property_name
=
g
.
element
.
getAttribute
(
'
data-json-property-name
'
),
property_name
=
g
.
element
.
getAttribute
(
'
data-json-property-name
'
),
schema
=
options
.
schema_arr
!==
undefined
&&
options
.
schema_arr
[
0
].
schema
,
schema
=
options
.
schema_arr
!==
undefined
&&
options
.
schema_arr
[
0
].
schema
;
root
;
g
.
props
.
changed
=
false
;
g
.
props
.
changed
=
false
;
g
.
props
.
saveOrigValue
=
options
.
saveOrigValue
;
g
.
props
.
saveOrigValue
=
options
.
saveOrigValue
;
g
.
props
.
inputs
=
[];
g
.
props
.
add_buttons
=
[];
g
.
props
.
add_custom_data
=
{};
g
.
props
.
arrays
=
{};
g
.
props
.
objects
=
{};
g
.
props
.
path
=
options
.
path
;
// self gadget scope
g
.
props
.
path
=
options
.
path
;
// self gadget scope
if
(
!
property_name
||
!
options
.
display_label
)
{
if
(
!
property_name
||
!
options
.
display_label
)
{
property_name
=
""
;
property_name
=
""
;
}
}
root
=
g
.
element
.
querySelector
(
'
[data-json-path="/"]
'
);
if
(
!
root
)
{
root
=
g
.
element
;
}
if
(
options
.
delete_button
===
undefined
)
{
if
(
options
.
delete_button
===
undefined
)
{
if
(
options
.
top
)
{
if
(
options
.
top
)
{
options
.
delete_button
=
false
;
options
.
delete_button
=
false
;
...
@@ -1982,23 +1972,41 @@
...
@@ -1982,23 +1972,41 @@
// used for empty document generation
// used for empty document generation
g
.
props
.
type
=
(
schema
&&
typeof
schema
.
type
===
"
string
"
&&
schema
.
type
)
||
g
.
props
.
type
=
(
schema
&&
typeof
schema
.
type
===
"
string
"
&&
schema
.
type
)
||
options
.
type
||
getDocumentType
(
options
.
document
);
options
.
type
||
getDocumentType
(
options
.
document
);
while
(
root
.
firstChild
)
{
root
.
removeChild
(
root
.
firstChild
);
}
if
(
checkSchemaIsMetaSchema
(
schema
))
{
if
(
checkSchemaIsMetaSchema
(
schema
))
{
g
.
props
.
updatePropertySelectors
=
true
;
g
.
props
.
updatePropertySelectors
=
true
;
g
.
props
.
current_document
=
options
.
document
;
g
.
props
.
current_document
=
options
.
document
;
}
}
return
render_field
(
g
,
property_name
,
""
,
options
.
schema_arr
,
g
.
props
.
property_name
=
property_name
;
options
.
document
,
root
,
g
.
props
.
schema_arr
=
options
.
schema_arr
;
{
g
.
props
.
render_opt
=
{
type
:
options
.
type
,
type
:
options
.
type
,
selected_schema
:
options
.
selected_schema
,
selected_schema
:
options
.
selected_schema
,
required
:
options
.
required
,
required
:
options
.
required
,
delete_button
:
options
.
delete_button
,
delete_button
:
options
.
delete_button
,
top
:
options
.
top
top
:
options
.
top
})
};
return
g
.
rerender
(
options
.
document
);
})
.
declareMethod
(
'
rerender
'
,
function
(
document
)
{
var
g
=
this
,
for_delete
,
root
=
g
.
element
.
querySelector
(
'
[data-json-path="/"]
'
);
g
.
props
.
inputs
=
[];
g
.
props
.
add_buttons
=
[];
g
.
props
.
add_custom_data
=
{};
g
.
props
.
arrays
=
{};
g
.
props
.
objects
=
{};
if
(
!
root
)
{
root
=
g
.
element
;
}
for_delete
=
Array
.
from
(
root
.
childNodes
);
return
render_field
(
g
,
g
.
props
.
property_name
,
""
,
g
.
props
.
schema_arr
,
document
,
root
,
g
.
props
.
render_opt
)
.
push
(
function
()
{
.
push
(
function
()
{
for
(
var
i
=
0
;
i
<
for_delete
.
length
;
i
+=
1
)
{
root
.
removeChild
(
for_delete
[
i
]);
}
return
g
.
element
;
return
g
.
element
;
});
});
})
})
...
...
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