astamuse / asta4js Goto Github PK
View Code? Open in Web Editor NEWnon-intrusive MVVM which allows designer-friendly independent html template
License: Other
non-intrusive MVVM which allows designer-friendly independent html template
License: Other
If we watch to a existing array and then add items to the existing array, the watch function will not work correctly:
Aj.init(function ($scope) {
$scope.data = {
list: []
};
$scope.snippet("ul").bind($scope.data, {
list:{
_duplicator: "li",
_item: {
"nnn": {
_selector: ".x-watch",
_watch: {
_fields: ["name"],
_cal: function(v){
console.log("cal", v);
return v+"-watched";
}
},
_render: function(target, nv, ov, ctx){
console.log("args", arguments);
console.log("idx:", ctx.getArrayAssistant().getIndex());
target.text(nv);
}
}
}
}
});
$scope.data.list.push({
name: "name-" + i
});
}
Workaround is to reassign a new array reference to replace the existing array:
$scope.data.list = Aj.util.clone($scope.data.list);
$scope.data.list.push({
name: "name-" + i
});
At form-option.js,
var retrieveTargetPropMetaRoot=function(meta){
var checkKeys = Object.keys(meta);
if (checkKeys.length == 0) {
return meta;
}else if(checkKeys.length == 1){
if(checkKeys[0] === "_duplicator"){
return meta;
}else if(checkKeys[0] === "_item"){
return meta;
}else{
return retrieveTargetPropMetaRoot(meta[checkKeys[0]]);
}
}else if(checkKeys.length == 2){
if(checkKeys.indexOf("_duplicator") && checkKeys.indexOf("_item")){
return meta;
}else{
throwMalformedOptionMeta(meta);
}
}else{
throwMalformedOptionMeta(meta);
}
}
The following if statement is always false since the indexOf will return 0 for any of them.
if(checkKeys.indexOf("_duplicator") && checkKeys.indexOf("_item")){
we need fix the judgment as ">= 0"
The framework insert a hidden tag to the original place of binding target as a place holder, which tag is as the same name of the original tag, which cause some pseudo selectors failed, such as :first-child, :last-child, :n-th
currently we can retrieve the current item by getItem, but there is no way to replace current item.
Now Aj use require to organize its own modules, but Aj does not follow the AMD to
exports itself.
We need to ask Aj to be requirejs loadable.
at least, for the following two operation, we need support "not" operation:
possible solution is as following:
If we watch a field which is bound as asSingleCheck, the _render of watch field does not work:
$scope.snippet("body").bind($scope.data, {
tdata: [
Aj.form().asSingleCheck(),
//"#tdataprev"
],
"@tdata":{
_selector: "#tdatawatch",
_watch:{
_fields: ["tdata"],
},
_render: function(target, value){
target.text(value + ":www");
}
}
});
getItem should return the current bound item of array but it now always returns the last item of array.
Currently, if the declared transform object is with wrong property name(_get_value and _set_value), there is nothing to warn developer to notice that.
The current error message is difficult to understand what is wrong for developers.
_transform is implemented as a part of value monitor but _index was treated as a special field out of monitoring, which causes the _transform mechanism is not applied to _index.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.