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
b7a18928
Commit
b7a18928
authored
Jan 03, 2019
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add getGadgetByPath() and refactor getElementByPath() so use it
parent
5819ba7b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
jsonform.gadget.js
jsonform.gadget.js
+3
-0
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+16
-9
No files found.
jsonform.gadget.js
View file @
b7a18928
...
@@ -682,6 +682,9 @@
...
@@ -682,6 +682,9 @@
.
allowPublicAcquisition
(
"
checkValidity
"
,
function
(
arr
)
{
.
allowPublicAcquisition
(
"
checkValidity
"
,
function
(
arr
)
{
return
this
.
checkValidity
(
arr
[
0
]);
return
this
.
checkValidity
(
arr
[
0
]);
})
})
.
declareMethod
(
'
getGadgetByPath
'
,
function
(
path
)
{
return
this
.
props
.
form_gadget
.
getGadgetByPath
(
path
||
"
/
"
);
})
.
declareMethod
(
'
checkValidity
'
,
function
(
json_document
)
{
.
declareMethod
(
'
checkValidity
'
,
function
(
json_document
)
{
// XXX need use local schema and local json document
// XXX need use local schema and local json document
// in every subgadget to take into account user anyOf choice
// in every subgadget to take into account user anyOf choice
...
...
jsonform/gadget_json_generated_form_child.js
View file @
b7a18928
...
@@ -1848,7 +1848,7 @@
...
@@ -1848,7 +1848,7 @@
});
});
})
})
.
declareMethod
(
'
get
Elemen
tByPath
'
,
function
(
data_path
)
{
.
declareMethod
(
'
get
Gadge
tByPath
'
,
function
(
data_path
)
{
var
g
=
this
,
var
g
=
this
,
array
,
array
,
path
,
path
,
...
@@ -1878,7 +1878,7 @@
...
@@ -1878,7 +1878,7 @@
next_data_path
=
"
/
"
+
next_data_path
.
slice
(
1
).
join
(
"
/
"
);
next_data_path
=
"
/
"
+
next_data_path
.
slice
(
1
).
join
(
"
/
"
);
return
g
.
getDeclaredGadget
(
array
[
idx
].
getAttribute
(
'
data-gadget-scope
'
))
return
g
.
getDeclaredGadget
(
array
[
idx
].
getAttribute
(
'
data-gadget-scope
'
))
.
push
(
function
(
gadget
)
{
.
push
(
function
(
gadget
)
{
return
gadget
.
get
Elemen
tByPath
(
next_data_path
);
return
gadget
.
get
Gadge
tByPath
(
next_data_path
);
});
});
}
}
...
@@ -1906,22 +1906,29 @@
...
@@ -1906,22 +1906,29 @@
if
(
scope
===
false
)
{
if
(
scope
===
false
)
{
// gadget for this element absent
// gadget for this element absent
// so find element in current gadget
// so find element in current gadget
return
document
.
getElementById
(
return
{
g
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
bingo
+
key
+
'
/
'
gadget
:
g
,
);
path
:
bingo
+
key
+
'
/
'
};
}
}
if
(
scope
)
{
if
(
scope
)
{
// get gadget by scope and use relative path for find element in gadget
// get gadget by scope and use relative path for find element in gadget
return
g
.
getDeclaredGadget
(
scope
)
return
g
.
getDeclaredGadget
(
scope
)
.
push
(
function
(
gadget
)
{
.
push
(
function
(
gadget
)
{
return
gadget
.
get
Elemen
tByPath
(
next_data_path
);
return
gadget
.
get
Gadge
tByPath
(
next_data_path
);
});
});
}
}
}
}
return
RSVP
.
Queue
()
return
{
.
push
(
function
()
{
gadget
:
g
,
path
:
data_path
};
})
.
declareMethod
(
'
getElementByPath
'
,
function
(
data_path
)
{
return
this
.
getGadgetByPath
(
data_path
)
.
push
(
function
(
ret
)
{
return
document
.
getElementById
(
return
document
.
getElementById
(
g
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
data_
path
ret
.
gadget
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
ret
.
path
);
);
});
});
})
})
...
...
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