Skip to content

Commit

Permalink
support a.b.c
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoqing.dongxq committed Jan 15, 2015
1 parent cff33bd commit ea29239
Show file tree
Hide file tree
Showing 14 changed files with 403 additions and 157 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Thumbs.db
*.pyo
.build
node_modules
spm_modules
_site
sea-modules
.cache
1 change: 0 additions & 1 deletion dist/bui-data/1.1.2/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
define("bui-data/1.1.2/index-debug", ["bui-common/1.1.2/common-debug","jquery"], function(require, exports, module){
define("bui-data/1.1.3/index-debug", ["bui-common/1.1.3/common-debug","jquery"], function(require, exports, module){
/**
* @fileOverview Data 命名空间的入口文件
* @ignore
*/

var BUI = require("bui-common/1.1.2/common-debug"),
var BUI = require("bui-common/1.1.3/common-debug"),
Data = BUI.namespace('Data');

BUI.mix(Data, {
Sortable: require("bui-data/1.1.2/src/sortable-debug"),
Proxy: require("bui-data/1.1.2/src/proxy-debug"),
AbstractStore: require("bui-data/1.1.2/src/abstractstore-debug"),
Store: require("bui-data/1.1.2/src/store-debug"),
Node: require("bui-data/1.1.2/src/node-debug"),
TreeStore: require("bui-data/1.1.2/src/treestore-debug")
Sortable: require("bui-data/1.1.3/src/sortable-debug"),
Proxy: require("bui-data/1.1.3/src/proxy-debug"),
AbstractStore: require("bui-data/1.1.3/src/abstractstore-debug"),
Store: require("bui-data/1.1.3/src/store-debug"),
Node: require("bui-data/1.1.3/src/node-debug"),
TreeStore: require("bui-data/1.1.3/src/treestore-debug")
});

module.exports = Data;

});
define("bui-data/1.1.2/src/sortable-debug", [], function(require, exports, module){
define("bui-data/1.1.3/src/sortable-debug", [], function(require, exports, module){
/**
* @fileOverview 可排序扩展类
* @ignore
Expand Down Expand Up @@ -185,11 +185,11 @@ define("bui-data/1.1.2/src/sortable-debug", [], function(require, exports, modul
module.exports = sortable;

});
define("bui-data/1.1.2/src/proxy-debug", ["jquery"], function(require, exports, module){
define("bui-data/1.1.3/src/proxy-debug", ["jquery"], function(require, exports, module){


var $ = require('jquery'),
Sortable = require("bui-data/1.1.2/src/sortable-debug");
Sortable = require("bui-data/1.1.3/src/sortable-debug");

/**
* 数据代理对象,加载数据,
Expand Down Expand Up @@ -635,14 +635,14 @@ define("bui-data/1.1.2/src/proxy-debug", ["jquery"], function(require, exports,
module.exports = proxy;

});
define("bui-data/1.1.2/src/abstractstore-debug", ["bui-common/1.1.2/common-debug","jquery"], function(require, exports, module){
define("bui-data/1.1.3/src/abstractstore-debug", ["bui-common/1.1.3/common-debug","jquery"], function(require, exports, module){
/**
* @fileOverview 抽象数据缓冲类
* @ignore
*/

var BUI = require("bui-common/1.1.2/common-debug"),
Proxy = require("bui-data/1.1.2/src/proxy-debug");
var BUI = require("bui-common/1.1.3/common-debug"),
Proxy = require("bui-data/1.1.3/src/proxy-debug");

/**
* @class BUI.Data.AbstractStore
Expand Down Expand Up @@ -701,6 +701,51 @@ define("bui-data/1.1.2/src/abstractstore-debug", ["bui-common/1.1.2/common-debug
*/
params : {

},
/**
* 错误字段,包含在返回信息中表示错误信息的字段
* <pre><code>
* //可以修改接收的后台参数的含义
* var store = new Store({
* url : 'data.json',
* errorProperty : 'errorMsg', //存放错误信息的字段(error)
* hasErrorProperty : 'isError', //是否错误的字段(hasError)
* root : 'data', //存放数据的字段名(rows)
* totalProperty : 'total' //存放记录总数的字段名(results)
* });
* </code></pre>
* @cfg {String} [errorProperty='error']
*/
/**
* 错误字段
* @type {String}
* @ignore
*/
errorProperty : {
value : 'error'
},
/**
* 是否存在错误,加载数据时如果返回错误,此字段表示有错误发生
* <pre><code>
* //可以修改接收的后台参数的含义
* var store = new Store({
* url : 'data.json',
* errorProperty : 'errorMsg', //存放错误信息的字段(error)
* hasErrorProperty : 'isError', //是否错误的字段(hasError)
* root : 'data', //存放数据的字段名(rows)
* totalProperty : 'total' //存放记录总数的字段名(results)
* });
* </code></pre>
* @cfg {String} [hasErrorProperty='hasError']
*/
/**
* 是否存在错误
* @type {String}
* @default 'hasError'
* @ignore
*/
hasErrorProperty : {
value : 'hasError'
},
/**
* 数据代理对象,用于加载数据的ajax配置,{@link BUI.Data.Proxy}
Expand Down Expand Up @@ -1087,7 +1132,7 @@ define("bui-data/1.1.2/src/abstractstore-debug", ["bui-common/1.1.2/common-debug
//获取的原始数据
_self.fire('beforeProcessLoad',data);

if(data[hasErrorField] || data.exception){
if(BUI.getValue(data,hasErrorField) || data.exception){
_self.onException(data);
return false;
}
Expand All @@ -1113,10 +1158,10 @@ define("bui-data/1.1.2/src/abstractstore-debug", ["bui-common/1.1.2/common-debug
//网络异常、转码错误之类,发生在json获取或转变时
if(data.exception){
obj.type = 'exception';
obj[errorProperty] = data.exception;
obj.error = data.exception;
}else{//用户定义的错误
obj.type = 'error';
obj[errorProperty] = data[errorProperty];
obj.error = BUI.getValue(data,errorProperty);
}
_self.fire('exception',obj);

Expand All @@ -1142,7 +1187,7 @@ define("bui-data/1.1.2/src/abstractstore-debug", ["bui-common/1.1.2/common-debug
module.exports = AbstractStore;

});
define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debug"], function(require, exports, module){
define("bui-data/1.1.3/src/store-debug", ["jquery","bui-common/1.1.3/common-debug"], function(require, exports, module){
/**
* @fileOverview 数据缓冲对象
* @author [email protected]
Expand All @@ -1151,9 +1196,9 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu


var $ = require('jquery'),
Proxy = require("bui-data/1.1.2/src/proxy-debug"),
AbstractStore = require("bui-data/1.1.2/src/abstractstore-debug"),
Sortable = require("bui-data/1.1.2/src/sortable-debug");
Proxy = require("bui-data/1.1.3/src/proxy-debug"),
AbstractStore = require("bui-data/1.1.3/src/abstractstore-debug"),
Sortable = require("bui-data/1.1.3/src/sortable-debug");

//移除数据
function removeAt(index,array){
Expand Down Expand Up @@ -1243,51 +1288,7 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu
shared : false,
value:[]
},
/**
* 错误字段,包含在返回信息中表示错误信息的字段
* <pre><code>
* //可以修改接收的后台参数的含义
* var store = new Store({
* url : 'data.json',
* errorProperty : 'errorMsg', //存放错误信息的字段(error)
* hasErrorProperty : 'isError', //是否错误的字段(hasError)
* root : 'data', //存放数据的字段名(rows)
* totalProperty : 'total' //存放记录总数的字段名(results)
* });
* </code></pre>
* @cfg {String} [errorProperty='error']
*/
/**
* 错误字段
* @type {String}
* @ignore
*/
errorProperty : {
value : 'error'
},
/**
* 是否存在错误,加载数据时如果返回错误,此字段表示有错误发生
* <pre><code>
* //可以修改接收的后台参数的含义
* var store = new Store({
* url : 'data.json',
* errorProperty : 'errorMsg', //存放错误信息的字段(error)
* hasErrorProperty : 'isError', //是否错误的字段(hasError)
* root : 'data', //存放数据的字段名(rows)
* totalProperty : 'total' //存放记录总数的字段名(results)
* });
* </code></pre>
* @cfg {String} [hasErrorProperty='hasError']
*/
/**
* 是否存在错误
* @type {String}
* @default 'hasError'
* @ignore
*/
hasErrorProperty : {
value : 'hasError'
},


/**
* 对比2个对象是否相当,在去重、更新、删除,查找数据时使用此函数
Expand Down Expand Up @@ -1631,8 +1632,9 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu
getTotalCount : function(){
var _self = this,
resultMap = _self.get('resultMap'),
total = _self.get('totalProperty');
return parseInt(resultMap[total],10) || 0;
total = _self.get('totalProperty'),
totalVal = BUI.getValue(resultMap,total);
return parseInt(totalVal,10) || 0;
},
/**
* 获取当前缓存的纪录
Expand All @@ -1645,7 +1647,7 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu
var _self = this,
resultMap = _self.get('resultMap'),
root = _self.get('root');
return resultMap[root];
return BUI.getValue(resultMap,root);
},
/**
* 是否包含数据
Expand Down Expand Up @@ -1801,7 +1803,7 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu
var _self = this,
hasErrorField = _self.get('hasErrorProperty');

if(data[hasErrorField] || data.exception){ //如果失败
if (BUI.getValue(data,hasErrorField) || data.exception){ //如果失败
_self.onException(data);
return;
}
Expand Down Expand Up @@ -2030,7 +2032,7 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu
if(BUI.isArray(data)){
_self._setResult(data);
}else{
_self._setResult(data[root],data[totalProperty]);
_self._setResult(BUI.getValue(data,root), BUI.getValue(data,totalProperty));
}

_self.set('start',start);
Expand All @@ -2057,8 +2059,9 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu
resultMap = _self.get('resultMap');

totalCount = totalCount || rows.length;
resultMap[_self.get('root')] = rows;
resultMap[_self.get('totalProperty')] = totalCount;

BUI.setValue(resultMap,_self.get('root'),rows);
BUI.setValue(resultMap,_self.get('totalProperty'),totalCount);

//清理之前发生的改变
_self._clearChanges();
Expand All @@ -2068,14 +2071,14 @@ define("bui-data/1.1.2/src/store-debug", ["jquery","bui-common/1.1.2/common-debu
module.exports = store;

});
define("bui-data/1.1.2/src/node-debug", ["bui-common/1.1.2/common-debug","jquery"], function(require, exports, module){
define("bui-data/1.1.3/src/node-debug", ["bui-common/1.1.3/common-debug","jquery"], function(require, exports, module){
/**
* @fileOverview 树形数据结构的节点类,无法直接使用数据作为节点,所以进行一层封装
* 可以直接作为TreeNode控件的配置项
* @ignore
*/

var BUI = require("bui-common/1.1.2/common-debug");
var BUI = require("bui-common/1.1.3/common-debug");

function mapNode(cfg,map){
var rst = {};
Expand Down Expand Up @@ -2162,17 +2165,17 @@ define("bui-data/1.1.2/src/node-debug", ["bui-common/1.1.2/common-debug","jquery
module.exports = Node;

});
define("bui-data/1.1.2/src/treestore-debug", ["bui-common/1.1.2/common-debug","jquery"], function(require, exports, module){
define("bui-data/1.1.3/src/treestore-debug", ["bui-common/1.1.3/common-debug","jquery"], function(require, exports, module){
/**
* @fileOverview 树形对象缓冲类
* @ignore
*/


var BUI = require("bui-common/1.1.2/common-debug"),
Node = require("bui-data/1.1.2/src/node-debug"),
Proxy = require("bui-data/1.1.2/src/proxy-debug"),
AbstractStore = require("bui-data/1.1.2/src/abstractstore-debug");
var BUI = require("bui-common/1.1.3/common-debug"),
Node = require("bui-data/1.1.3/src/node-debug"),
Proxy = require("bui-data/1.1.3/src/proxy-debug"),
AbstractStore = require("bui-data/1.1.3/src/abstractstore-debug");

/**
* @class BUI.Data.TreeStore
Expand Down Expand Up @@ -2693,7 +2696,7 @@ define("bui-data/1.1.2/src/treestore-debug", ["bui-common/1.1.2/common-debug","j
if(BUI.isArray(data)){
_self.setChildren(node,data);
}else{
_self.setChildren(node,data[dataProperty]);
_self.setChildren(node, BUI.getValue(data, dataProperty));
}
node.loaded = true; //标识已经加载过
_self.fire('load',{node : node,params : params});
Expand Down
1 change: 1 addition & 0 deletions dist/bui-data/1.1.3/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bui-data",
"version": "1.1.2",
"version": "1.1.3",
"description": "",
"keywords": [],
"homepage": "",
Expand Down
Loading

0 comments on commit ea29239

Please sign in to comment.