Merge branch 'master' of http://git.roojs.com/roojs1
[roojs1] / roojs-bootstrap-debug.js
index c049259..45b4da2 100644 (file)
@@ -629,7 +629,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
     name: false,
     target: false,
      
-    pressed : false,
+    pressed : null,
      
     
     getAutoCreate : function(){
@@ -844,16 +844,13 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
             return;
         }
         
-        
         Roo.log('button on click ');
         if(this.preventDefault){
             e.preventDefault();
         }
         
         if (this.pressed === true || this.pressed === false) {
-            this.pressed = !this.pressed;
-            this.el[this.pressed ? 'addClass' : 'removeClass']('active');
-            this.fireEvent('toggle', this, e, this.pressed);
+            this.toggleActive(e);
         }
         
         
@@ -889,12 +886,10 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component,  {
      /**
      * toggles the current active state 
      */
-    toggleActive : function()
+    toggleActive : function(e)
     {
-       var active = this.el.hasClass('active');
-       this.setActive(!active);
-       
-        
+        this.setActive(!this.pressed);
+        this.fireEvent('toggle', this, e, !this.pressed);
     },
      /**
      * get the current active state
@@ -2251,10 +2246,18 @@ Roo.extend(Roo.bootstrap.Menu, Roo.bootstrap.Component,  {
         this.hidden = false;
         this.triggerEl.addClass('open');
         
-        if(this.el.getWidth() + xy[0] > Roo.lib.Dom.getViewWidth()){
+        // reassign x when hitting right
+        if(this.el.getWidth() + xy[0] >= Roo.lib.Dom.getViewWidth()){
             xy[0] = xy[0] - this.el.getWidth() + this.triggerEl.getWidth();
         }
         
+        // reassign y when hitting bottom
+        if(this.el.getHeight() + xy[1] >= Roo.lib.Dom.getViewHeight()){
+            xy[1] = xy[1] - this.el.getHeight() - this.triggerEl.getHeight();
+        }
+        
+        // but the list may align on trigger left or trigger top... should it be a properity?
+        
         if(this.el.getStyle('top') != 'auto' && this.el.getStyle('top').slice(-1) != "%"){
             this.el.setXY(xy);
         }
@@ -6189,7 +6192,9 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
             }
         } 
         
-        this.maskEl = new Roo.LoadMask(this.el, { store : this.ds, msgCls: 'roo-el-mask-msg' });
+        if(this.loadMask) {
+            this.maskEl = new Roo.LoadMask(this.el, { store : this.ds, msgCls: 'roo-el-mask-msg' });
+        }
         
         this.store.on('load', this.onLoad, this);
         this.store.on('beforeload', this.onBeforeLoad, this);
@@ -6555,7 +6560,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     
     
     
-    onLoad : function(event)
+    onLoad : function()
     {
 //        Roo.log('ds onload');
         this.clear();
@@ -6604,10 +6609,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         Roo.each(this.el.select('tbody td', true).elements, function(e){
             e.on('mouseout', _this.onMouseout, _this);
         });
-        this.fireEvent('rowsrendered', this, event);
-        //if(this.loadMask){
-        //    this.maskEl.hide();
-        //}
+        this.fireEvent('rowsrendered', this);
         
         this.autoSize();
     },
@@ -6820,13 +6822,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     
     onBeforeLoad : function()
     {
-        //Roo.log('ds onBeforeLoad');
-        
-        //this.clear();
         
-        //if(this.loadMask){
-        //    this.maskEl.show();
-        //}
     },
      /**
      * Remove all rows
@@ -8549,6 +8545,7 @@ Roo.form.VTypes = function(){
  * @cfg {String} autocomplete - default is new-password see: https://developers.google.com/web/fundamentals/input/form/label-and-name-inputs?hl=en
  * @cfg {String} indicatorpos (left|right) default left
  * @cfg {String} capture (user|camera) use for file input only. (default empty)
+ * @cfg {String} accept (image|video|audio) use for file input only. (default empty)
 
  * @cfg {String} align (left|center|right) Default left
  * @cfg {Boolean} forceFeedback (true|false) Default false
@@ -8763,6 +8760,7 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
     labelxs : 0,
     
     capture : '',
+    accept : '',
     
     parentLabelAlign : function()
     {
@@ -8803,6 +8801,10 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
             input.capture = this.capture;
         }
         
+        if(this.accept.length){
+            input.accept = this.accept + "/*";
+        }
+        
         if(this.align){
             input.style = (typeof(input.style) == 'undefined') ? ('text-align:' + this.align) : (input.style + 'text-align:' + this.align);
         }
@@ -9101,7 +9103,7 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
         this.indicator = this.indicatorEl();
         
         if(this.indicator){
-            this.indicator.addClass('invisible');
+            this.indicator.addClass(this.indicatorpos == 'right' ? 'hidden' : 'invisible'); // changed from invisible??? - 
         }
  
         // reference to original value for reset
@@ -9415,7 +9417,7 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
         
         if(this.indicator){
             this.indicator.removeClass('visible');
-            this.indicator.addClass('invisible');
+            this.indicator.addClass(this.indicatorpos == 'right' ? 'hidden' : 'invisible');
         }
         
         if(this.disabled){
@@ -9469,7 +9471,7 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
         }
         
         if(this.indicator){
-            this.indicator.removeClass('invisible');
+            this.indicator.removeClass(this.indicatorpos == 'right' ? 'hidden' : 'invisible');
             this.indicator.addClass('visible');
         }
         
@@ -18639,7 +18641,7 @@ Roo.extend(Roo.bootstrap.DateField, Roo.bootstrap.Input,  {
         
         this.picker().select('>.datepicker-days tbody',true).first().dom.innerHTML = '';
         
-        while(prevMonth.valueOf() < nextMonth) {
+        while(prevMonth.valueOf() <= nextMonth) {
             var clsName = '';
             
             if (prevMonth.getUTCDay() === this.weekStart) {
@@ -20400,6 +20402,7 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
     weight : false,
     inline: false,
     tooltip : '',
+    useFontAwesomeCheckBox : false,
     
     getAutoCreate : function()
     {
@@ -20579,6 +20582,10 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
                 html: this.boxLabel
             };
             
+            if(this.useFontAwesomeCheckBox) {
+                boxLabelCfg.cls = 'box-label fa-checkbox'
+            }
+            
             if(this.tooltip){
                 boxLabelCfg.tooltip = this.tooltip;
             }
@@ -22506,7 +22513,7 @@ Roo.extend(Roo.HtmlEditorCore, Roo.Component,  {
             if (v.match(/^\./) || v.match(/^\//)) {
                 return;
             }
-            if (v.match(/^(http|https):\/\//) || v.match(/^mailto:/)) {
+            if (v.match(/^(http|https):\/\//) || v.match(/^mailto:/) || v.match(/^ftp:/)) {
                 return;
             }
             if (v.match(/^#/)) {
@@ -30005,6 +30012,11 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
     
     getAutoCreate : function(){
         
+       var cls = "";
+       if (!this.allowBlank) {
+           cls  = "visible";
+       }
+       
         var cfg = {
             tag : this.tag,
             cls : 'roo-bootstrap-field-label ' + this.cls,
@@ -30012,7 +30024,7 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
             cn : [
                 {
                     tag : 'i',
-                    cls : 'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',
+                    cls : 'roo-required-indicator left-indicator text-danger fa fa-lg fa-star ' + cls,
                     tooltip : this.iconTooltip
                 },
                 {
@@ -30034,7 +30046,7 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
                     },
                     {
                         tag : 'i',
-                        cls : 'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',
+                        cls : 'roo-required-indicator right-indicator text-danger fa fa-lg fa-star '+ cls,
                         tooltip : this.iconTooltip
                     }
                 ] 
@@ -33219,10 +33231,6 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
      * if a valid character like '.' or '-' is left in the field with no number (defaults to "{value} is not a valid number")
      */
     nanText : "{0} is not a valid number",
-    /**
-     * @cfg {Boolean} castInt (true|false) cast int if true (defalut true)
-     */
-    castInt : true,
     /**
      * @cfg {String} thousandsDelimiter Symbol of thousandsDelimiter
      */
@@ -33396,13 +33404,9 @@ Roo.extend(Roo.bootstrap.NumberField, Roo.bootstrap.Input, {
 
     beforeBlur : function()
     {
-        if(!this.castInt){
-            return;
-        }
-        
         var v = this.parseValue(this.getRawValue());
         
-        if(v || v === 0){
+        if(v || v === 0 || v === ''){
             this.setValue(v);
         }
     },