Esempio n. 1
0
		_getBackItem: function(start,end,cfg){
			var _self = this, 
				path = BUI.substitute('M {x1} {y1} L{x2} {y2}',start);
			path = path + BUI.substitute('L{x2} {y2} L{x1} {y1}Z',end);

			cfg = BUI.merge(cfg,{
				path : path
			});
			return cfg;
		},
Esempio n. 2
0
    _createInput: function() {
      var _self = this,
        buttonCls = _self.get('buttonCls'),
        buttonEl = _self.get('el').find('.' + buttonCls),
        inputTpl = _self.get('inputTpl'),
        name = _self.get('name'),
        fileInput;

      inputTpl = BUI.substitute(inputTpl, {
        name: name
      });

      buttonEl.append(inputTpl);

      fileInput = buttonEl.find('input');

      //TODO:IE6下只有通过脚本和内联样式才能控制按钮大小
      if(UA.ie == 6){
        fileInput.css('fontSize','400px');
      }
      _self._bindChangeHandler(fileInput);

      _self.set('fileInput', fileInput);

      _self.setMultiple(_self.get('multiple'));
      _self.setFilter(_self.get('filter'));
      //_self._setDisabled(_self.get('disabled'));
    },
Esempio n. 3
0
File: grid.js Progetto: 2zyun/bui
 _getCellText:function (column, record,index) {
     var _self = this,
       dataIndex = column.get('dataIndex'),
       textTpl = column.get('cellTpl') || _self.get('cellTextTpl'),
       text = _self._getCellInnerText(column,dataIndex, record,index);
     return BUI.substitute(textTpl,{text:text, tips:_self._getTips(column, dataIndex, record)});
 },
Esempio n. 4
0
 _setResultTpl: function(item, status){
   var _self = this,
     resultTpl = _self.get('resultTpl'),
     itemTpl = resultTpl[status] || resultTpl['default'],
     tplData = BUI.mix({}, item.attr, item.result);
   item.resultTpl = BUI.substitute(itemTpl, tplData);
 },
Esempio n. 5
0
 parseElCfg : function(attrs){
   attrs.type = 'text';
   if(attrs.rotate){
     attrs.transform = BUI.substitute('r{rotate} {x} {y}',attrs);
   }
   
   return attrs;
 }
Esempio n. 6
0
File: list.js Progetto: 858888/bui
 getItemTpl: function(item, index) {
   var _self = this,
     render = _self.get('itemTplRender'),
     itemTpl = _self.get('itemTpl');
   if (render) {
     return render(item, index);
   }
   return BUI.substitute(itemTpl, item);
 },
Esempio n. 7
0
File: grid.js Progetto: 2zyun/bui
 _getHeaderCellTpl:function (column) {
   var _self = this,
     headerCellTpl = _self.get('headerCellTpl');
   return BUI.substitute(headerCellTpl,{
     id:column.get('id'),
     width:column.get('width'),
     hideCls:!column.get('visible') ? CLS_HIDE : ''
   });
 },
Esempio n. 8
0
File: base.js Progetto: dericgit/bui
	function parseValue(attrs,value){
		if(!BUI.isString(value)){ //只转换字符串
			return value;
		}
		if(value.indexOf('{') != -1){ //如果有可替换的值,进行计算
			value = BUI.substitute(value,attrs);
			value = BUI.JSON.looseParse(value); //转成对应的值
		}
		return value;
	}
Esempio n. 9
0
 _getPath : function(attrs){
   if(!attrs.symbol && attrs.path){
     return  BUI.substitute(attrs.path,attrs);
   }
   var method = Marker.Symbols[attrs.symbol];
   if(method){
     return method(attrs.x,attrs.y,attrs.radius)
   }else{
     throw 'not support this type ' + attrs.symbol;
   }
 }
Esempio n. 10
0
File: base.js Progetto: mysoko/bui
 showError : function(msg,errorTpl){
   var _self = this,
     control = _self.get('control'),
     errorMsg = BUI.substitute(errorTpl,{error : msg}),
     el = $(errorMsg);
   //_self.clearErrorMsg();
   
   el.appendTo(control.parent());
   _self.set('msgEl',el);
   _self.get('el').addClass(CLS_FIELD_ERROR);
 },
Esempio n. 11
0
    _setContent : function(){
      var _self = this,
        body = _self.get('body'),
        contentTpl = BUI.substitute(_self.get('contentTpl'),{
          msg : _self.get('msg'),
          iconTpl : _self.get('iconTpl')
        });
      body.empty();

      $(contentTpl).appendTo(body);
    },
Esempio n. 12
0
File: grid.js Progetto: 2zyun/bui
 _getCellTpl:function (column, dataIndex, record,index) {
   var _self = this,
     cellText = _self._getCellText(column, record,index),
     cellTpl = _self.get('cellTpl');
   return BUI.substitute(cellTpl,{
     elCls : column.get('elCls'),
     id:column.get('id'),
     dataIndex:dataIndex,
     cellText:cellText,
     hideCls:!column.get('visible') ? CLS_HIDE : ''
   });
 },
Esempio n. 13
0
    _getWeekTpl : function(startDate){
      var _self = this,
        weekTpl = _self.get('weekTpl'),
        daysTemps = [];
      for (var i = 0; i < weekDays.length; i++) {
        var date = DateUtil.addDay(i,startDate);
        daysTemps.push(_self._getDayTpl(date));  
      }

      return BUI.substitute(weekTpl,{
        daysTpl:daysTemps.join('')
      });
    },
Esempio n. 14
0
 _getIconsTpl : function(node){
   var _self = this,
     level = node.level,
     start = _self.get('startLevel'),
     iconWraperTpl = _self.get('iconWraperTpl'),
     icons = [],
     i;
   for(i = start ; i < level ; i = i + 1){
     icons.push(_self._getLevelIcon(node,i));
   }
   icons.push(_self._getExpandIcon(node));
   icons.push(_self._getCheckedIcon(node));
   icons.push(_self._getNodeTypeIcon(node));
   return BUI.substitute(iconWraperTpl,{icons : icons.join('')});
 },
Esempio n. 15
0
File: line.js Progetto: 2zyun/bui
 BUI.each(points,function(item,index){
   if(item.value == null){
     if(connectNulls){
       return;
     }
     str = '';
   }else{
     str = (preItem == null || preItem.value == null) ? (smooth ? 'M{x} {y} R' : 'M{x} {y}') : (smooth ? ' {x} {y}' : 'L{x} {y}');
     
   }
   
   path += BUI.substitute(str,item);
   
   preItem = item;
   
 });
Esempio n. 16
0
File: tip.js Progetto: haodw/bui
 _uiSetTitle : function(title){
   var _self = this,
     titleTpl = _self.get('titleTpl'),
     container = _self._getTitleContainer(),
     titleEl = _self.get('titleEl'),
     tem;
   if(titleEl){
     titleEl.remove();
   }
   title = title || '';
   if(BUI.isString(title)){
     title = {title : title};
   }
   tem = BUI.substitute(titleTpl,title);
   titleEl = $(tem).appendTo(container);
   _self.set('titleEl',titleEl);
 },
Esempio n. 17
0
    _getDayTpl : function(date){
      var _self = this,
        dayTpl = _self.get('dayTpl'),
        day = date.getDay(),
        todayCls = _self._isToday(date) ? CLS_TODAY:'',
        dayOfWeek = weekDays[day],
        dateNumber = date.getDate(),
        //不是本月则处于不活动状态
        dateType = _self._isCurrentMonth(date) ? dateTypes.active : dateTypes.deactive;

      return BUI.substitute(dayTpl,{
        dayOfWeek : dayOfWeek,
        dateType : dateType,
        dateNumber : dateNumber,
        todayCls : todayCls,
        date : DateUtil.format(date,DATE_MASK)
      });
    },
Esempio n. 18
0
File: base.js Progetto: dericgit/bui
		_wrapControl : function(){
	
			var _self = this,
				control = _self.get('control'),
				controlEl = control.get('el'),
				elCls = _self.get('elCls'),
				container = _self._getContainer(controlEl),
				tpl = BUI.substitute(_self.get('tpl'),_self.getLayoutAttrs()) ,
				node = $(tpl).appendTo(container),
				bodyEl;
			if(elCls){
				node.addClass(elCls);
			}
			bodyEl = _self.getControlContainer(node);
			controlEl.appendTo(bodyEl);
			_self.set('bodyEl',bodyEl);

			return node;
		},
Esempio n. 19
0
File: base.js Progetto: dericgit/bui
		synTpl : function(el,item,attrs){
			var _self = this,
				name = item.name,
				elName = '_'+name + 'El', //title 使用_titleEl作为临时变量存储对应的DOM 
				tpl,
				m, //使用的附加方法
				tplEl = _self.get(elName);
			if(attrs[name]){
				if(!tplEl){
					tpl = _self.get(item.value);
					tpl = BUI.substitute(tpl,attrs);
					m = item.prev ? 'prependTo' : 'appendTo';
					tplEl = $(tpl)[m](el);
					_self.set(elName,tplEl);
				}
			}else if(tplEl){
				tplEl.remove();
			}
		},
Esempio n. 20
0
File: border.js Progetto: 2zyun/bui
		getCollapsedRange : function(){
			var _self = this,
				property = _self.getCollapseProperty(),
				el = _self.get('el'),
				val = _self.get(property);
			if(BUI.isString(val)){
				var dynacAttrs = _self._getDynacAttrs();
				if(val.indexOf('{') != -1){
					val = BUI.substitute(val,dynacAttrs);
					val = BUI.JSON.looseParse(val);
				}
				else if(val.indexOf('%') != -1){
					val = parseInt(val,10) * 0.01 * dynacAttrs[property];
				}else{
					val = parseInt(val,10);
				}
			}
			return val - _self._getLeftRange(property);
		},
Esempio n. 21
0
File: grid.js Progetto: 2zyun/bui
    _createHeaderRow:function () {
      var _self = this,
          columns = _self._getColumns(),
          tbodyEl = _self.get('tbodyEl'),
          rowTpl = _self.get('headerRowTpl'),
          rowEl,
          cellsTpl = [];

      $.each(columns, function (index,column) {
        cellsTpl.push(_self._getHeaderCellTpl(column));
      });

      //if this component set width,add a empty column to fit row width
      if(_self.get('useEmptyCell')/* && !_self.get('forceFit')*/){
        cellsTpl.push(_self._getEmptyCellTpl());
      }
      rowTpl = BUI.substitute(rowTpl,{cellsTpl:cellsTpl.join('')});
      rowEl = $(rowTpl).appendTo(tbodyEl);
      return rowEl;
    },
Esempio n. 22
0
File: grid.js Progetto: 2zyun/bui
    getItemTpl : function  (record,index) {
      var _self = this,
        columns =  _self._getColumns(),
        tbodyEl = _self.get('tbodyEl'),
        rowTpl = _self.get('rowTpl'),
        oddCls = index % 2 === 0 ? CLS_ROW_ODD : CLS_ROW_EVEN,
        cellsTpl = [],
        rowEl;

      BUI.each(columns, function (column) {
        var dataIndex = column.get('dataIndex');
        cellsTpl.push(_self._getCellTpl(column, dataIndex, record,index));
      });

      if(_self.get('useEmptyCell') /*&& !_self.get('forceFit')*/){
        cellsTpl.push(_self._getEmptyCellTpl());
      }

      rowTpl = BUI.substitute(rowTpl,{cellsTpl:cellsTpl.join(''), oddCls:oddCls});
      return rowTpl;
    },
Esempio n. 23
0
 _getTextItemTpl:function (id) {
     var _self = this,
         obj = _self.getAttrVals();
     return BUI.substitute(this.get(id + 'Tpl'), obj);
 },
Esempio n. 24
0
File: line.js Progetto: 2zyun/bui
 BUI.each(points,function(item,index){
   if (item.value != null) {
     var str = 'L{x} {y}';
     path += BUI.substitute(str,item);
   }
 });
Esempio n. 25
0
File: tab.js Progetto: 858888/bui
 _getPanel: function(item) {
   var _self = this,
     panelContainer = _self.get('panelContainer'),
     panelTpl = BUI.substitute(_self.get('panelTpl'), item);
   return $(panelTpl).appendTo(panelContainer);
 }
Esempio n. 26
0
 function formatError(self,values,msg){
   var ars = parseParams(values); 
   msg = msg || self.get('msg');
   return BUI.substitute(msg,ars);
 }
Esempio n. 27
0
  	parseElCfg : function(attrs){
  		attrs.type = 'path'; //将线转换成path
			attrs.path = BUI.substitute('M {x1},{y1}L{x2},{y2}',attrs);
  		return attrs;
  	},
Esempio n. 28
0
 Search.createLink = function(cfg){
   var temp = '<span class="page-action grid-command" data-id="{id}" data-href="{href}" title="{title}">{text}</span>';
   return BUI.substitute(temp,cfg);
 }
Esempio n. 29
0
File: base.js Progetto: cnJun/bui
 BUI.each(tickItems,function(item){
     var subPath = BUI.substitute('M{x1} {y1}L{x2} {y2}',item);
     path += subPath;
 });
Esempio n. 30
0
 _getIcon : function(cls){
    var _self = this,
     iconTpl = _self.get('iconTpl');
   return BUI.substitute(iconTpl,{cls : cls});
 },