Code Monkey home page Code Monkey logo

asta4js's People

Contributors

xzer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asta4js's Issues

make Aj can be load by require

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.

watch on array does not work correctly

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
    });

binding option data with customized _value/_text function cause exception

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"

watch _render does not work for asSingleCheck bound field

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");
        }
      }
    });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.