Roo/data/JsonReader.js
[roojs1] / roojs-bootstrap-debug.js
index 0f1d506..5df0164 100644 (file)
@@ -1006,7 +1006,7 @@ Roo.extend(Roo.bootstrap.Column, Roo.bootstrap.Component,  {
  * @cfg {Boolean} jumbotron is it a jumbotron element
  * @cfg {String} html content of element
  * @cfg {String} well (lg|sm|md) a well, large, small or medium.
- * @cfg {String} panel (primary|success|info|warning|danger) render as panel  - type - primary/success.....
+ * @cfg {String} panel (default|primary|success|info|warning|danger) render as panel  - type - primary/success.....
  * @cfg {String} header content of header (for panel)
  * @cfg {String} footer content of footer (for panel)
  * @cfg {String} sticky (footer|wrap|push) block to use as footer or body- needs css-bootstrap/sticky-footer.css
@@ -6832,7 +6832,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
         if (tbd) {
             
             tbd.setSize(ctr.getWidth(),
-                        ctr.getHeight() - (thd.getHeight() + (tfd ? tfd.getHeight() : 0))
+                        ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0))
             );
             var barsize = (tbd.dom.offsetWidth - tbd.dom.clientWidth);
             cw -= barsize;
@@ -8038,6 +8038,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
 
         return this;
     },
+    
     getItems : function()
     {
         var r=new Roo.util.MixedCollection(false, function(o){
@@ -8059,10 +8060,7 @@ clientValidation  Boolean          Applies to submit only.  Pass true to call fo
 
         iter(this);
         return r;
-
-
-
-
+        
     }
 
 });
@@ -9358,11 +9356,24 @@ Roo.extend(Roo.bootstrap.Input, Roo.bootstrap.Component,  {
     
     setFieldLabel : function(v)
     {
+        if(!this.rendered){
+            return;
+        }
+        
         this.fieldLabel = v;
         
-        if(this.rendered){
-            this.el.select('label',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+        if(this.indicator){
+            var ar = this.el.select('label > span',true);
+            if (!ar.length) {
+                Roo.log("could not find label > span on element");
+                Roo.log(this);
+                return;
+            }
+            this.el.select('label > span',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
+            return;
         }
+        
+        this.el.select('label',true).first().dom.innerHTML = (v === null || v === undefined ? '' : v);
     }
 });
 
@@ -12260,6 +12271,12 @@ Roo.extend(Roo.data.JsonReader, Roo.data.DataReader, {
         var s = this.meta, Record = this.recordType,
             f = Record ? Record.prototype.fields : null, fi = f ? f.items : [], fl = f ? f.length : 0;
 
+        Roo.log('----------------------');
+        Roo.log(s);
+        Roo.log(Record);
+        Roo.log(f);
+
+
 //      Generate extraction functions for the totalProperty, the root, the id, and for each field
         if (!this.ef) {
             if(s.totalProperty) {
@@ -14081,6 +14098,7 @@ Roo.extend(Roo.bootstrap.ComboBox, Roo.bootstrap.TriggerField, {
                     
                     this.onLoad();
                     
+                    
                 }else{
                     
                     this.store.baseParams[this.queryParam] = q;
@@ -17323,6 +17341,8 @@ Roo.extend(Roo.bootstrap.Popover, Roo.bootstrap.Component,  {
             // fixme..
         }
         var align = Roo.bootstrap.Popover.alignment[placement];
+        
+//        Roo.log(align);
         this.el.alignTo(on_el, align[0],align[1]);
         //var arrow = this.el.select('.arrow',true).first();
         //arrow.set(align[2], 
@@ -20123,6 +20143,7 @@ Roo.apply(Roo.bootstrap.MonthField,  {
  * @cfg {Boolean} checked initnal the element
  * @cfg {Boolean} inline inline the element (default false)
  * @cfg {String} groupId the checkbox group id // normal just use for checkbox
+ * @cfg {String} tooltip label tooltip
  * 
  * @constructor
  * Create a new CheckBox
@@ -20139,7 +20160,13 @@ Roo.bootstrap.CheckBox = function(config){
         * @param {Roo.bootstrap.CheckBox} this This input
         * @param {Boolean} checked The new checked value
         */
-       check : true
+       check : true,
+       /**
+        * @event click
+        * Fires when the element is click.
+        * @param {Roo.bootstrap.CheckBox} this This input
+        */
+       click : true
     });
     
 };
@@ -20153,6 +20180,7 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
     checked: false,
     weight : false,
     inline: false,
+    tooltip : '',
     
     getAutoCreate : function()
     {
@@ -20183,7 +20211,7 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
                 tag: 'input',
                 type : 'hidden',
                 cls : 'roo-hidden-value',
-                value : this.checked ? this.valueOff : this.inputValue
+                value : this.checked ? this.inputValue : this.valueOff
             };
         }
         
@@ -20198,10 +20226,8 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
         
         if(this.checked){
             input.checked = this.checked;
-            
         }
         
-        
         if (this.name) {
             
             input.name = this.name;
@@ -20265,7 +20291,6 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
                     'for' :  id,
                     cls : 'control-label',
                     html : this.fieldLabel
-
                 },
                 {
                     cls : "", 
@@ -20313,7 +20338,6 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
                         cls: 'control-label box-input-label',
                         //cls : 'input-group-addon',
                         html : this.fieldLabel
-                        
                     },
                     
                     inputblock
@@ -20396,9 +20420,12 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
         }
     },
     
-    onClick : function()
+    onClick : function(e)
     {   
-        this.setChecked(!this.checked);
+        if(this.fireEvent('click', this, e) !== false){
+            this.setChecked(!this.checked);
+        }
+        
     },
     
     setChecked : function(state,suppressEvent)
@@ -20541,6 +20568,15 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
         
         var r = false;
         
+        for(var i in group){
+            if(group[i].el.isVisible(true)){
+                r = false;
+                break;
+            }
+            
+            r = true;
+        }
+        
         for(var i in group){
             if(r){
                 break;
@@ -20658,7 +20694,7 @@ Roo.extend(Roo.bootstrap.CheckBox, Roo.bootstrap.Input,  {
         
         var label = Roo.bootstrap.FieldLabel.get(this.name + '-group');
         
-        if (label) {
+        if (label && label.iconEl) {
             label.iconEl.removeClass(label.validClass);
             label.iconEl.removeClass(label.invalidClass);
         }
@@ -28401,7 +28437,14 @@ Roo.bootstrap.DocumentManager = function(config){
          * @param {Roo.bootstrap.DocumentManager} this
          * @param {Object} file
          */
-        "process" : true
+        "process" : true,
+        /**
+         * @event previewrendered
+         * Fire when preview rendered
+         * @param {Roo.bootstrap.DocumentManager} this
+         * @param {Object} file
+         */
+        "previewrendered" : true
         
     });
 };
@@ -28637,7 +28680,7 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
     {
         this.selectorEl.dom.value = '';
         
-        if(!this.files.length){
+        if(!this.files || !this.files.length){
             return;
         }
         
@@ -28989,6 +29032,8 @@ Roo.extend(Roo.bootstrap.DocumentManager, Roo.bootstrap.Component,  {
         
         image.on('click', this.onClick, this, file);
         
+        this.fireEvent('previewrendered', this, file);
+        
         return file;
         
     },
@@ -29677,9 +29722,10 @@ Roo.extend(Roo.bootstrap.NavProgressItem, Roo.bootstrap.Component,  {
  * @cfg {String} cls class of the element
  * @cfg {String} target label target 
  * @cfg {Boolean} allowBlank (true|false) target allowBlank default true
- * @cfg {String} invalidClass default "text-danger fa fa-lg fa-exclamation-triangle"
- * @cfg {String} validClass default "text-success fa fa-lg fa-check"
+ * @cfg {String} invalidClass default "text-warning"
+ * @cfg {String} validClass default "text-success"
  * @cfg {String} iconTooltip default "This field is required"
+ * @cfg {String} indicatorpos (left|right) default left
  * 
  * @constructor
  * Create a new FieldLabel
@@ -29713,9 +29759,10 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
     html: '',
     target: '',
     allowBlank : true,
-    invalidClass : 'text-danger fa fa-lg fa-exclamation-triangle',
-    validClass : 'text-success fa fa-lg fa-check',
+    invalidClass : 'has-warning',
+    validClass : 'has-success',
     iconTooltip : 'This field is required',
+    indicatorpos : 'left',
     
     getAutoCreate : function(){
         
@@ -29726,7 +29773,7 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
             cn : [
                 {
                     tag : 'i',
-                    cls : '',
+                    cls : 'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',
                     tooltip : this.iconTooltip
                 },
                 {
@@ -29736,6 +29783,25 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
             ] 
         };
         
+        if(this.indicatorpos == 'right'){
+            var cfg = {
+                tag : this.tag,
+                cls : 'roo-bootstrap-field-label ' + this.cls,
+                for : this.target,
+                cn : [
+                    {
+                        tag : 'span',
+                        html : this.html
+                    },
+                    {
+                        tag : 'i',
+                        cls : 'roo-required-indicator right-indicator text-danger fa fa-lg fa-star',
+                        tooltip : this.iconTooltip
+                    }
+                ] 
+            };
+        }
+        
         return cfg;
     },
     
@@ -29743,23 +29809,41 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
     {
         Roo.bootstrap.Element.superclass.initEvents.call(this);
         
-        this.iconEl = this.el.select('i', true).first();
+        this.indicator = this.indicatorEl();
         
-        this.iconEl.setVisibilityMode(Roo.Element.DISPLAY).hide();
+        if(this.indicator){
+            this.indicator.removeClass('visible');
+            this.indicator.addClass('invisible');
+        }
         
         Roo.bootstrap.FieldLabel.register(this);
     },
     
+    indicatorEl : function()
+    {
+        var indicator = this.el.select('i.roo-required-indicator',true).first();
+        
+        if(!indicator){
+            return false;
+        }
+        
+        return indicator;
+        
+    },
+    
     /**
      * Mark this field as valid
      */
     markValid : function()
     {
-        this.iconEl.show();
+        if(this.indicator){
+            this.indicator.removeClass('visible');
+            this.indicator.addClass('invisible');
+        }
         
-        this.iconEl.removeClass(this.invalidClass);
+        this.el.removeClass(this.invalidClass);
         
-        this.iconEl.addClass(this.validClass);
+        this.el.addClass(this.validClass);
         
         this.fireEvent('valid', this);
     },
@@ -29770,11 +29854,14 @@ Roo.extend(Roo.bootstrap.FieldLabel, Roo.bootstrap.Component,  {
      */
     markInvalid : function(msg)
     {
-        this.iconEl.show();
+        if(this.indicator){
+            this.indicator.removeClass('invisible');
+            this.indicator.addClass('visible');
+        }
         
-        this.iconEl.removeClass(this.validClass);
+        this.el.removeClass(this.validClass);
         
-        this.iconEl.addClass(this.invalidClass);
+        this.el.addClass(this.invalidClass);
         
         this.fireEvent('invalid', this, msg);
     }
@@ -33453,7 +33540,12 @@ Roo.extend(Roo.bootstrap.RadioSet, Roo.bootstrap.Input,  {
     
     setValue : function(v, suppressEvent)
     {   
+        if(this.value === v){
+            return;
+        }
+        
         this.value = v;
+        
         if(this.rendered){
             this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
         }
@@ -39887,7 +39979,9 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
                                 {
                                     tag : 'input',
                                     cls : 'form-control roo-money-currency-input',
-                                    autocomplete: 'new-password'
+                                    autocomplete: 'new-password',
+                                    readOnly : 1,
+                                    name : this.currencyName
                                 },
                                 {
                                     tag :'span',
@@ -40103,17 +40197,7 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
             forceKeyDown: true
         });
         
-        this.queryDelay = Math.max(this.queryDelay || 10,
-                this.mode == 'local' ? 10 : 250);
-        
-        
-        this.dqTask = new Roo.util.DelayedTask(this.initQuery, this);
-        
-        if(this.typeAhead){
-            this.taTask = new Roo.util.DelayedTask(this.onTypeAhead, this);
-        }
-        
-        this.currencyEl().on("keyup", this.onCurrencyKeyUp, this);
+        this.currencyEl().on("click", this.onTriggerClick, this, { preventDefault : true });
         
     },
     
@@ -40371,7 +40455,7 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
     
     validate : function()
     {
-        if(this.disabled){
+        if(this.disabled || this.allowBlank){
             this.markValid();
             return true;
         }
@@ -40428,14 +40512,6 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
         this.fireEvent("blur", this);
     },
     
-    onCurrencyKeyUp : function(e)
-    {
-        if(!e.isSpecialKey()){
-            this.lastKey = e.getKey();
-            this.dqTask.delay(this.queryDelay);
-        }
-    },
-    
     inputEl : function()
     {
         return this.el.select('.roo-money-amount-input', true).first();
@@ -40444,47 +40520,6 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, {
     currencyEl : function()
     {
         return this.el.select('.roo-money-currency-input', true).first();
-    },
-    
-    initQuery : function()
-    {
-        var v = this.getCurrency();
-        
-        this.doQuery(v);
-    },
-    
-    onTypeAhead : function()
-    {
-        if(this.store.getCount() > 0){
-            var r = this.store.getAt(0);
-            var newValue = r.data[this.currencyField];
-            var len = newValue.length;
-            var selStart = this.getCurrency().length;
-            
-            if(selStart != len){
-                this.setCurrency(newValue);
-                this.selectText(selStart, newValue.length);
-            }
-        }
-    },
-    
-    selectText : function(start, end)
-    {
-        var v = this.getCurrency();
-        
-        if(v.length > 0){
-            start = start === undefined ? 0 : start;
-            end = end === undefined ? v.length : end;
-            var d = this.el.dom;
-            if(d.setSelectionRange){
-                d.setSelectionRange(start, end);
-            }else if(d.createTextRange){
-                var range = d.createTextRange();
-                range.moveStart("character", start);
-                range.moveEnd("character", v.length-end);
-                range.select();
-            }
-        }
     }
     
 });
\ No newline at end of file