* @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
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;
var items = this.getItems();
var ret = {};
items.each(function(f){
+
if (!f.getName()) {
return;
}
+
var v = f.getValue();
+
if (f.inputType =='radio') {
if (typeof(ret[f.getName()]) == 'undefined') {
ret[f.getName()] = ''; // empty..
v = f.el.dom.value;
}
+
+ if(f.xtype == 'MoneyField'){
+ ret[f.currencyName] = f.getCurrency();
+ }
// not sure if this supported any more..
if ((typeof(v) == 'object') && f.getRawValue) {
return this;
},
+
getItems : function()
{
var r=new Roo.util.MixedCollection(false, function(o){
iter(this);
return r;
-
-
-
-
+
}
});
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);
}
});
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) {
// 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],
* @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
* @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
});
};
checked: false,
weight : false,
inline: false,
+ tooltip : '',
getAutoCreate : function()
{
tag: 'input',
type : 'hidden',
cls : 'roo-hidden-value',
- value : this.checked ? this.valueOff : this.inputValue
+ value : this.checked ? this.inputValue : this.valueOff
};
}
if(this.checked){
input.checked = this.checked;
-
}
-
if (this.name) {
input.name = this.name;
'for' : id,
cls : 'control-label',
html : this.fieldLabel
-
},
{
cls : "",
cls: 'control-label box-input-label',
//cls : 'input-group-addon',
html : this.fieldLabel
-
},
inputblock
}
},
- onClick : function()
+ onClick : function(e)
{
- this.setChecked(!this.checked);
+ if(this.fireEvent('click', this, e) !== false){
+ this.setChecked(!this.checked);
+ }
+
},
setChecked : function(state,suppressEvent)
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;
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);
}
* @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
});
};
{
this.selectorEl.dom.value = '';
- if(!this.files.length){
+ if(!this.files || !this.files.length){
return;
}
image.on('click', this.onClick, this, file);
+ this.fireEvent('previewrendered', this, file);
+
return file;
},
* @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
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(){
cn : [
{
tag : 'i',
- cls : '',
+ cls : 'roo-required-indicator left-indicator text-danger fa fa-lg fa-star',
tooltip : this.iconTooltip
},
{
]
};
+ 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;
},
{
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);
},
*/
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);
}
setValue : function(v, suppressEvent)
{
+ if(this.value === v){
+ return;
+ }
+
this.value = v;
+
if(this.rendered){
this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
}
{
tag : 'input',
cls : 'form-control roo-money-currency-input',
- autocomplete: 'new-password'
+ autocomplete: 'new-password',
+ readOnly : 1,
+ name : this.currencyName
},
{
tag :'span',
initEvents : function()
{
+ this.indicator = this.indicatorEl();
+
this.initCurrencyEvent();
this.initNumberEvent();
this.createList();
- this.indicator = this.indicatorEl();
-
this.triggerEl = this.el.select('.input-group-addon', true).first();
this.triggerEl.on("click", this.onTriggerClick, this, { preventDefault : true });
- this.currencyEl = this.el.select('.roo-money-currency-input', true).first();
-
- this.amountEl = this.el.select('.roo-money-amount-input', true).first();
-
var _this = this;
(function(){
this.store.on('load', this.onLoad, this);
this.store.on('loadexception', this.onLoadException, this);
- this.keyNav = new Roo.KeyNav(this.currencyEl, {
+ this.keyNav = new Roo.KeyNav(this.currencyEl(), {
"up" : function(e){
this.inKeyMode = true;
this.selectPrev();
forceKeyDown: true
});
+ this.currencyEl().on("click", this.onTriggerClick, this, { preventDefault : true });
+
},
initNumberEvent : function(e)
{
+ this.inputEl().on("keydown" , this.fireKey, this);
+ this.inputEl().on("focus", this.onFocus, this);
+ this.inputEl().on("blur", this.onBlur, this);
+
+ this.inputEl().relayEvent('keyup', this);
+
+ if(this.indicator){
+ this.indicator.addClass('invisible');
+ }
+
+ this.originalValue = this.getValue();
+
+ if(this.validationEvent == 'keyup'){
+ this.validationTask = new Roo.util.DelayedTask(this.validate, this);
+ this.inputEl().on('keyup', this.filterValidation, this);
+ }
+ else if(this.validationEvent !== false){
+ this.inputEl().on(this.validationEvent, this.validate, this, {buffer: this.validationDelay});
+ }
+
+ if(this.selectOnFocus){
+ this.on("focus", this.preFocus, this);
+
+ }
+ if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Roo.form.VTypes[this.vtype+'Mask']))){
+ this.inputEl().on("keypress", this.filterKeys, this);
+ } else {
+ this.inputEl().relayEvent('keypress', this);
+ }
+
var allowed = "0123456789";
if(this.allowDecimals){
}
};
- this.amountEl.on("keypress", keyPress, this);
+ this.inputEl().on("keypress", keyPress, this);
},
getCurrency : function()
{
- var v = this.currencyEl.getValue();
+ var v = this.currencyEl().getValue();
return v;
},
restrictHeight : function()
{
- this.list.alignTo(this.currencyEl, this.listAlign);
- this.list.alignTo(this.currencyEl, this.listAlign);
+ this.list.alignTo(this.currencyEl(), this.listAlign);
+ this.list.alignTo(this.currencyEl(), this.listAlign);
},
onViewClick : function(view, doFocus, el, e)
this.lastCurrency = o;
- if (this.currencyName) {
- currency = !o || typeof(o[this.currencyName]) == 'undefined' ? '' : o[this.currencyName];
+ if (this.currencyField) {
+ currency = !o || typeof(o[this.currencyField]) == 'undefined' ? '' : o[this.currencyField];
} else {
- Roo.log('no currencyName value set for '+ (this.name ? this.name : this.id));
+ Roo.log('no currencyField value set for '+ (this.name ? this.name : this.id));
}
this.lastSelectionText = currency;
setFromData : function(o)
{
- this.setFromCurrencyData(o);
+ var c = {};
+
+ c[this.currencyField] = !o || typeof(o[this.currencyName]) == 'undefined' ? '' : o[this.currencyName];
+
+ this.setFromCurrencyData(c);
var value = '';
this.currencyValue = v;
if(this.rendered){
- this.currencyEl.dom.value = (v === null || v === undefined ? '' : v);
+ this.currencyEl().dom.value = (v === null || v === undefined ? '' : v);
this.validate();
}
},
this.value = v;
if(this.rendered){
- this.amountEl.dom.value = (v === null || v === undefined ? '' : v);
+ this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
this.validate();
}
},
getRawValue : function()
{
- var v = this.amountEl.getValue();
+ var v = this.inputEl().getValue();
return v;
},
validate : function()
{
- if(this.disabled){
+ if(this.disabled || this.allowBlank){
this.markValid();
return true;
}
this.markInvalid();
return false;
+ },
+
+ getName: function()
+ {
+ return this.name;
+ },
+
+ beforeBlur : function()
+ {
+ if(!this.castInt){
+ return;
+ }
+
+ var v = this.parseValue(this.getRawValue());
+
+ if(v){
+ this.setValue(v);
+ }
+ },
+
+ onBlur : function()
+ {
+ this.beforeBlur();
+
+ if(!Roo.isOpera && this.focusClass){ // don't touch in Opera
+ //this.el.removeClass(this.focusClass);
+ }
+
+ this.hasFocus = false;
+
+ if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){
+ this.validate();
+ }
+
+ var v = this.getValue();
+
+ if(String(v) !== String(this.startValue)){
+ this.fireEvent('change', this, v, this.startValue);
+ }
+
+ this.fireEvent("blur", this);
+ },
+
+ inputEl : function()
+ {
+ return this.el.select('.roo-money-amount-input', true).first();
+ },
+
+ currencyEl : function()
+ {
+ return this.el.select('.roo-money-currency-input', true).first();
}
});
\ No newline at end of file