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
Jérome Perrin
rjs_json_form
Commits
87f5354c
Commit
87f5354c
authored
Jul 26, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
notifyChange emited on every input event, and then limit check validity on every 0.5 sec
parent
08481383
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
17 deletions
+25
-17
jsonform.gadget.js
jsonform.gadget.js
+11
-1
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+14
-16
No files found.
jsonform.gadget.js
View file @
87f5354c
...
@@ -420,7 +420,8 @@
...
@@ -420,7 +420,8 @@
})
})
.
declareAcquiredMethod
(
"
downloadJSON
"
,
"
downloadJSON
"
)
.
declareAcquiredMethod
(
"
downloadJSON
"
,
"
downloadJSON
"
)
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
allowPublicAcquisition
(
"
notifyChange
"
,
function
()
{
.
allowPublicAcquisition
(
"
rootNotifyChange
"
,
function
()
{
this
.
props
.
changed
=
true
;
return
this
.
notifyChange
();
return
this
.
notifyChange
();
})
})
.
declareAcquiredMethod
(
"
notifyValid
"
,
"
notifyValid
"
)
.
declareAcquiredMethod
(
"
notifyValid
"
,
"
notifyValid
"
)
...
@@ -643,6 +644,15 @@
...
@@ -643,6 +644,15 @@
// XXX Disable
// XXX Disable
return
;
return
;
})
})
.
onLoop
(
function
()
{
var
gadget
=
this
;
if
(
this
.
props
.
changed
)
{
return
this
.
checkValidity
()
.
push
(
function
()
{
gadget
.
props
.
changed
=
false
;
});
}
},
500
)
.
declareMethod
(
'
getContent
'
,
function
()
{
.
declareMethod
(
'
getContent
'
,
function
()
{
var
g
=
this
;
var
g
=
this
;
...
...
jsonform/gadget_json_generated_form_child.js
View file @
87f5354c
...
@@ -273,13 +273,6 @@
...
@@ -273,13 +273,6 @@
return
ret_arr
[
0
];
return
ret_arr
[
0
];
}
}
function
checkValidityAndNotifyChange
(
g
)
{
return
RSVP
.
all
([
g
.
checkValidity
(),
g
.
notifyChange
()
]);
}
function
render_schema_selector
(
gadget
,
title
,
schema_arr
,
event
,
rerender
)
{
function
render_schema_selector
(
gadget
,
title
,
schema_arr
,
event
,
rerender
)
{
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -385,7 +378,7 @@
...
@@ -385,7 +378,7 @@
return
event
(
schema_alternatives
[
value
[
scope
]].
value
);
return
event
(
schema_alternatives
[
value
[
scope
]].
value
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
checkValidityAndNotifyChange
(
gadget
);
return
gadget
.
rootNotifyChange
(
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
if
(
rerender
)
{
if
(
rerender
)
{
...
@@ -450,7 +443,7 @@
...
@@ -450,7 +443,7 @@
}
else
{
}
else
{
input
.
removeAttribute
(
"
style
"
);
input
.
removeAttribute
(
"
style
"
);
}
}
return
checkValidityAndNotifyChange
(
gadget
);
return
gadget
.
rootNotifyChange
(
);
});
});
},
},
rerender
:
function
()
{
rerender
:
function
()
{
...
@@ -1298,7 +1291,7 @@
...
@@ -1298,7 +1291,7 @@
g
.
props
=
{};
g
.
props
=
{};
g
.
options
=
{};
g
.
options
=
{};
})
})
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
n
otifyChange
"
)
.
declareAcquiredMethod
(
"
rootNotifyChange
"
,
"
rootN
otifyChange
"
)
.
declareAcquiredMethod
(
"
renameChildrenParent
"
,
"
renameChildren
"
)
.
declareAcquiredMethod
(
"
renameChildrenParent
"
,
"
renameChildren
"
)
.
allowPublicAcquisition
(
"
renameChildren
"
,
function
(
opt_arr
,
scope
)
{
.
allowPublicAcquisition
(
"
renameChildren
"
,
function
(
opt_arr
,
scope
)
{
var
property_name
,
var
property_name
,
...
@@ -1362,7 +1355,7 @@
...
@@ -1362,7 +1355,7 @@
for
(
i
=
0
;
i
<
button_list
.
length
;
i
=
i
+
1
)
{
for
(
i
=
0
;
i
<
button_list
.
length
;
i
=
i
+
1
)
{
tasks
.
push
(
button_list
[
i
].
rerender
());
tasks
.
push
(
button_list
[
i
].
rerender
());
}
}
tasks
.
push
(
checkValidityAndNotifyChange
(
g
));
tasks
.
push
(
g
.
rootNotifyChange
(
));
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
(
tasks
);
return
RSVP
.
all
(
tasks
);
...
@@ -1461,7 +1454,7 @@
...
@@ -1461,7 +1454,7 @@
if
(
event_object
&&
opt
.
type
===
"
change
"
)
{
if
(
event_object
&&
opt
.
type
===
"
change
"
)
{
return
event_object
.
event
();
return
event_object
.
event
();
}
}
return
g
.
n
otifyChange
();
return
g
.
rootN
otifyChange
();
})
})
.
declareMethod
(
'
renderForm
'
,
function
(
options
)
{
.
declareMethod
(
'
renderForm
'
,
function
(
options
)
{
var
g
=
this
,
var
g
=
this
,
...
@@ -1529,18 +1522,23 @@
...
@@ -1529,18 +1522,23 @@
}
}
})
})
.
onEvent
(
'
change
'
,
function
(
evt
)
{
.
onEvent
(
'
input
'
,
function
(
evt
)
{
if
(
evt
.
target
===
this
.
props
.
property_name_edit
)
{
if
(
evt
.
target
===
this
.
props
.
property_name_edit
)
{
return
this
.
rename
(
this
.
props
.
property_name_edit
.
value
,
evt
);
return
this
.
rename
(
this
.
props
.
property_name_edit
.
value
,
evt
);
}
}
var
field_list
=
this
.
props
.
inputs
,
var
gadget
=
this
,
i
;
field_list
=
this
.
props
.
inputs
,
i
,
changed
=
false
;
// on form data field
// on form data field
for
(
i
=
0
;
i
<
field_list
.
length
;
i
=
i
+
1
)
{
for
(
i
=
0
;
i
<
field_list
.
length
;
i
=
i
+
1
)
{
if
(
evt
.
target
===
field_list
[
i
])
{
if
(
evt
.
target
===
field_list
[
i
])
{
return
checkValidityAndNotifyChange
(
this
);
changed
=
true
;
}
}
}
if
(
changed
)
{
return
gadget
.
rootNotifyChange
();
}
}
})
})
...
...
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