Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
0ff97d42
Commit
0ff97d42
authored
Sep 06, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_json_form: update version from
https://lab.nexedi.com/bk/rjs_json_form
parent
c67dad31
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
323 additions
and
87 deletions
+323
-87
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
...ateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
+196
-57
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.js.js
...json_form/jsonform/gadget_json_generated_form_child.js.js
+46
-16
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/tv4.js.js
...mplateItem/portal_skins/erp5_json_form/jsonform/tv4.js.js
+81
-14
No files found.
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform.gadget.js.js
View file @
0ff97d42
This diff is collapsed.
Click to expand it.
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/gadget_json_generated_form_child.js.js
View file @
0ff97d42
...
...
@@ -199,12 +199,15 @@
return
input
;
}
function
render_const
(
schema
,
json_document
)
{
function
render_const
(
g
,
schema
,
json_document
)
{
var
input
=
document
.
createElement
(
"
input
"
),
ser_doc
=
JSON
.
stringify
(
json_document
),
ser_const
=
JSON
.
stringify
(
schema
.
const
);
input
.
setAttribute
(
'
readonly
'
,
true
);
if
(
json_document
===
undefined
||
deepEqual
(
json_document
,
schema
.
const
))
{
if
(
json_document
===
undefined
)
{
g
.
props
.
changed
=
true
;
}
input
.
setAttribute
(
'
data-origin-value
'
,
ser_const
);
input
.
value
=
ser_const
;
}
else
{
...
...
@@ -636,6 +639,13 @@
}
}
if
(
json_document
===
undefined
)
{
if
(
schema
.
hasOwnProperty
(
'
default
'
))
{
json_document
=
schema
.
default
;
gadget
.
props
.
changed
=
true
;
}
}
// XXX add failback rendering if json_document not array
// input = render_textarea(schema, default_value, "array");
return
RSVP
.
Queue
()
...
...
@@ -880,7 +890,7 @@
div_input
.
setAttribute
(
"
class
"
,
"
input
"
);
if
(
json_field
.
const
!==
undefined
)
{
input
=
render_const
(
json_field
,
default_value
);
input
=
render_const
(
gadget
,
json_field
,
default_value
);
}
else
if
(
json_field
.
enum
!==
undefined
)
{
input
=
render_enum
(
gadget
,
json_field
,
default_value
);
// XXX take in account existing type with enum
...
...
@@ -888,7 +898,7 @@
}
if
(
!
input
&&
type
===
"
null
"
)
{
input
=
render_const
({
const
:
null
},
default_value
);
input
=
render_const
(
gadget
,
{
const
:
null
},
default_value
);
}
if
(
!
input
&&
type
===
"
boolean
"
)
{
...
...
@@ -1208,7 +1218,12 @@
}
if
(
default_dict
===
undefined
)
{
default_dict
=
{};
if
(
json_field
.
hasOwnProperty
(
'
default
'
))
{
default_dict
=
json_field
.
default
;
g
.
props
.
changed
=
true
;
}
else
{
default_dict
=
{};
}
}
return
expandProperties
(
g
,
json_field
.
properties
,
schema_path
+
'
/properties/
'
,
required
)
...
...
@@ -1222,6 +1237,7 @@
if
(
properties
.
hasOwnProperty
(
key
))
{
schema_arr
=
properties
[
key
];
s_o
=
schemaArrFilteredByDocument
(
schema_arr
,
default_dict
[
key
]);
// XXX need schema merge with patternProperties passed key
if
(
checkSchemaArrOneChoise
(
schema_arr
))
{
if
(
required
.
indexOf
(
key
)
>=
0
)
{
used_properties
[
key
]
=
false
;
...
...
@@ -1312,30 +1328,44 @@
})
.
push
(
function
()
{
var
queue
=
RSVP
.
Queue
(),
key
,
additionalProperties
;
// XXX for pattern properties needs schemas merge for
// all passed patterns
if
(
json_field
.
patternProperties
!==
undefined
)
{
// XXX need loop on any pattern properties
if
(
json_field
.
patternProperties
[
'
.*
'
]
!==
undefined
)
{
queue
.
push
(
render_object_additionalProperty
.
bind
(
g
,
for
(
key
in
json_field
.
patternProperties
)
{
if
(
json_field
.
patternProperties
.
hasOwnProperty
(
key
))
{
if
(
key
===
"
.*
"
||
key
===
"
^.*$
"
||
key
===
"
.*$
"
||
key
===
"
^.*
"
)
{
// additionalProperties nether used in this case
additionalProperties
=
false
;
}
queue
.
push
(
render_object_additionalProperty
.
bind
(
g
,
g
,
"
.*
property
"
,
key
+
"
property
"
,
default_dict
,
path
,
json_field
.
patternProperties
[
'
.*
'
],
schema_path
+
'
/patternProperties/
.*
'
,
json_field
.
patternProperties
[
key
],
schema_path
+
'
/patternProperties/
'
+
key
,
used_properties
,
element_append
))
.
push
(
root_append
);
.
push
(
root_append
);
}
}
}
if
(
json_field
.
additionalProperties
===
undefined
)
{
additionalProperties
=
true
;
}
else
{
additionalProperties
=
json_field
.
additionalProperties
;
if
(
additionalProperties
===
undefined
)
{
if
(
json_field
.
additionalProperties
===
undefined
)
{
additionalProperties
=
true
;
}
else
{
additionalProperties
=
json_field
.
additionalProperties
;
}
}
if
(
additionalProperties
!==
false
)
{
queue
...
...
bt5/erp5_json_form/SkinTemplateItem/portal_skins/erp5_json_form/jsonform/tv4.js.js
View file @
0ff97d42
This diff is collapsed.
Click to expand it.
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