*/
toggleActive : function(e)
{
- this.setActive(!this.pressed);
- this.fireEvent('toggle', this, e, !this.pressed);
+ this.setActive(!this.pressed); // this modifies pressed...
+ this.fireEvent('toggle', this, e, this.pressed);
},
/**
* get the current active state
/**
* @event drop
* When a element a card is dropped
- * @param {Roo.bootstrap.Element} this
- * @param {Roo.Element} n the node being dropped?
- * @param {Object} dd Drag and drop data
- * @param {Roo.EventObject} e
- * @param {Roo.EventObject} data the data passed via getDragData
+ * @param {Roo.bootstrap.Card} this
+ *
+ *
+ * @param {Roo.bootstrap.Card} move_card the card being dropped?
+ * @param {String} position 'above' or 'below'
+ * @param {Roo.bootstrap.Card} next_to_card What card position is relative to of 'false' for empty list.
+
*/
'drop' : true,
/**
if (info === false) {
return false;
}
-
- if (this.fireEvent("drop", this, n, dd, e, data) === false) {
+ this.dropPlaceHolder('hide');
+
+
+
+
+
+ this.acceptCard(data.source, info.position, info.card, info.items_n);
+ return true;
+
+ },
+ firstChildCard : function()
+ {
+ for (var i = 0;i< this.items.length;i++) {
+
+ if (!this.items[i].el.hasClass('card')) {
+ continue;
+ }
+ return this.items[i];
+ }
+ return this.items.length ? this.items[this.items.length-1] : false; // don't try and put stuff after the cards...
+ },
+ /**
+ * accept card
+ *
+ * - card.acceptCard(move_card, info.position, info.card, info.items_n);
+
+ */
+ acceptCard : function(move_card, position, next_to_card )
+ {
+ if (this.fireEvent("drop", this, move_card, position, next_to_card) === false) {
return false;
}
-
- this.dropPlaceHolder('hide');
- // do the dom manipulation first..
- var dom = data.source.el.dom;
+ var to_items_n = next_to_card ? this.items.indexOf(next_to_card) : 0;
+
+
+ var dom = move_card.el.dom;
dom.parentNode.removeChild(dom);
- if (info.card !== true) {
- var cardel = info.card.el.dom;
+ if (next_to_card !== false) {
+ var cardel = next_to_card.el.dom;
- if (info.position == 'above') {
+ if (position == 'above') {
cardel.parentNode.insertBefore(dom, cardel);
} else if (cardel.nextSibling) {
cardel.parentNode.insertBefore(dom,cardel.nextSibling);
// remove Card from items.
- var old_parent = data.source.parent();
+ var old_parent = move_card.parent();
- old_parent.items = old_parent.items.filter(function(e) { return e != data.source });
+ old_parent.items = old_parent.items.filter(function(e) { return e != move_card });
if (this.items.length) {
var nitems = [];
//Roo.log([info.items_n, info.position, this.items.length]);
for (var i =0; i < this.items.length; i++) {
- if (i == info.items_n && info.position == 'above') {
- nitems.push(data.source);
+ if (i == to_items_n && position == 'above') {
+ nitems.push(move_card);
}
nitems.push(this.items[i]);
- if (i == info.items_n && info.position == 'below') {
- nitems.push(data.source);
+ if (i == to_items_n && position == 'below') {
+ nitems.push(move_card);
}
}
this.items = nitems;
Roo.log(this.items);
} else {
- this.items.push(data.source);
+ this.items.push(move_card);
}
- data.source.parentId = this.id;
+ move_card.parentId = this.id;
return true;
+
+
},
+
/** Decide whether to drop above or below a View node. */
getDropPoint : function(e, n, dd)
{
},
"Roo.bootstrap.CheckBox" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"desc" : "inline the element (default false)",
"memberOf" : ""
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "inputValue",
"type" : "String",
},
"Roo.bootstrap.ComboBox" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.DateField" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.HtmlEditor" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
},
"Roo.bootstrap.Input" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : ""
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : ""
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.MoneyField" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.MonthField" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.NumberField" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.PhoneInput" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.RadioSet" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"false"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.SecurePass" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "Label",
"type" : "String/Object",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.TextArea" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.TimeField" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
},
"Roo.bootstrap.TriggerField" : {
"props" : [
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input"
+ },
{
"name" : "accept",
"type" : "String",
"right"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input"
- },
{
"name" : "invalidClass",
"type" : "String",
* @extends Roo.bootstrap.Component
* Bootstrap Input class
* @cfg {Boolean} disabled is it disabled
- * @cfg {String} inputType button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text
+ * @cfg {String} (button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text) inputType
* @cfg {String} name name of the input
* @cfg {string} fieldLabel - the label associated
* @cfg {string} placeholder - placeholder to put in text.
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"optvals" : []
},
{
- "name" : "validateOnBlur",
- "type" : "Boolean",
- "desc" : "Whether the field should validate when it loses focus (defaults to true).",
+ "name" : "labelxs",
+ "type" : "Number",
+ "desc" : "set the width of label (1-12)",
"memberOf" : "Roo.bootstrap.Input",
"optvals" : []
},
{
- "name" : "labelxs",
- "type" : "Number",
- "desc" : "set the width of label (1-12)",
+ "name" : "validateOnBlur",
+ "type" : "Boolean",
+ "desc" : "Whether the field should validate when it loses focus (defaults to true).",
"memberOf" : "Roo.bootstrap.Input",
"optvals" : []
},
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"false"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "actionMode",
"type" : "String",
"memberOf" : "Roo.bootstrap.ComboBox",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "tooltip",
"type" : "string",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"memberOf" : "Roo.bootstrap.DateField",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"false"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "actionMode",
"type" : "String",
"memberOf" : "Roo.bootstrap.ComboBox",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "tooltip",
"type" : "string",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "validationEvent",
"type" : "String/Boolean",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
]
},
{
- "name" : "focusClass",
- "type" : "String",
- "desc" : "The CSS class to use when the field receives focus (defaults to \"x-form-focus\")",
+ "name" : "size",
+ "type" : "string",
+ "desc" : "- (lg|sm) or leave empty..",
"memberOf" : "Roo.bootstrap.Input",
"optvals" : []
},
{
- "name" : "size",
- "type" : "string",
- "desc" : "- (lg|sm) or leave empty..",
+ "name" : "focusClass",
+ "type" : "String",
+ "desc" : "The CSS class to use when the field receives focus (defaults to \"x-form-focus\")",
"memberOf" : "Roo.bootstrap.Input",
"optvals" : []
},
"calendar"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
]
},
{
- "name" : "size",
- "type" : "string",
- "desc" : "- (lg|sm) or leave empty..",
+ "name" : "focusClass",
+ "type" : "String",
+ "desc" : "The CSS class to use when the field receives focus (defaults to \"x-form-focus\")",
"memberOf" : "Roo.bootstrap.Input",
"optvals" : []
},
{
- "name" : "focusClass",
- "type" : "String",
- "desc" : "The CSS class to use when the field receives focus (defaults to \"x-form-focus\")",
+ "name" : "size",
+ "type" : "string",
+ "desc" : "- (lg|sm) or leave empty..",
"memberOf" : "Roo.bootstrap.Input",
"optvals" : []
},
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"memberOf" : "Roo.bootstrap.Component",
"optvals" : []
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "validationEvent",
"type" : "String/Boolean",
"audio"
]
},
+ {
+ "name" : "(button|checkbox|email|file|hidden|image|number|password|radio|range|reset|search|submit|text)",
+ "type" : "String",
+ "desc" : "inputType",
+ "memberOf" : "Roo.bootstrap.Input",
+ "optvals" : []
+ },
{
"name" : "xs",
"type" : "Number",
"calendar"
]
},
- {
- "name" : "inputType",
- "type" : "String",
- "desc" : "button | checkbox | email | file | hidden | image | number | password | radio | range | reset | search | submit | text",
- "memberOf" : "Roo.bootstrap.Input",
- "optvals" : []
- },
{
"name" : "invalidClass",
"type" : "String",
*/
toggleActive : function(e)
{
- this.setActive(!this.pressed);
- this.fireEvent('toggle', this, e, !this.pressed);
+ this.setActive(!this.pressed); // this modifies pressed...
+ this.fireEvent('toggle', this, e, this.pressed);
},
/**
* get the current active state
/**
* @event drop
* When a element a card is dropped
- * @param {Roo.bootstrap.Element} this
- * @param {Roo.Element} n the node being dropped?
- * @param {Object} dd Drag and drop data
- * @param {Roo.EventObject} e
- * @param {Roo.EventObject} data the data passed via getDragData
+ * @param {Roo.bootstrap.Card} this
+ *
+ *
+ * @param {Roo.bootstrap.Card} move_card the card being dropped?
+ * @param {String} position 'above' or 'below'
+ * @param {Roo.bootstrap.Card} next_to_card What card position is relative to of 'false' for empty list.
+
*/
'drop' : true,
/**
if (info === false) {
return false;
}
-
+ this.dropPlaceHolder('hide');
+
if (this.fireEvent("drop", this, n, dd, e, data) === false) {
return false;
}
- this.dropPlaceHolder('hide');
-
+
+
+
+ this.acceptCard(data.source, info.position, info.card, info.items_n);
+ return true;
+ /*
// do the dom manipulation first..
var dom = data.source.el.dom;
dom.parentNode.removeChild(dom);
data.source.parentId = this.id;
return true;
+ */
+ },
+ firstChildCard : function()
+ {
+ for (var i = 0;i< this.items.length;i++) {
+
+ if (!this.items[i].el.hasClass('card')) {
+ continue;
+ }
+ return this.items[i];
+ }
+ return this.items.length ? this.items[this.items.length-1] : false; // don't try and put stuff after the cards...
},
+ /**
+ * accept card
+ *
+ * - card.acceptCard(move_card, info.position, info.card, info.items_n);
+
+ */
+ acceptCard : function(move_card, position, next_to_card )
+ {
+ if (this.fireEvent("drop", this, move_card, position, next_to_card) === false) {
+ return false;
+ }
+
+ var to_items_n = next_to_card ? this.items.indexOf(next_to_card) : true;
+
+
+ var dom = move_card.el.dom;
+ dom.parentNode.removeChild(dom);
+
+
+ if (next_to_card !== true) {
+ var cardel = next_to_card.el.dom;
+
+ if (position == 'above') {
+ cardel.parentNode.insertBefore(dom, cardel);
+ } else if (cardel.nextSibling) {
+ cardel.parentNode.insertBefore(dom,cardel.nextSibling);
+ } else {
+ cardel.parentNode.append(dom);
+ }
+ } else {
+ // card container???
+ this.bodyEl.dom.append(dom);
+ }
+
+ //FIXME HANDLE card = true
+
+ // add this to the correct place in items.
+
+
+
+ // remove Card from items.
+
+ var old_parent = move_card.parent();
+
+ old_parent.items = old_parent.items.filter(function(e) { return e != move_card });
+
+ if (this.items.length) {
+ var nitems = [];
+ //Roo.log([info.items_n, info.position, this.items.length]);
+ for (var i =0; i < this.items.length; i++) {
+ if (i == to_items_n && position == 'above') {
+ nitems.push(move_card);
+ }
+ nitems.push(this.items[i]);
+ if (i == to_items_n && position == 'below') {
+ nitems.push(move_card);
+ }
+ }
+ this.items = nitems;
+ Roo.log(this.items);
+ } else {
+ this.items.push(move_card);
+ }
+
+ move_card.parentId = this.id;
+
+ return true;
+
+
+ },
+
/** Decide whether to drop above or below a View node. */
getDropPoint : function(e, n, dd)
}if(A.tag!=='a'&&this.href!==''){throw "Tag must be a to set href.";}else if(this.href.length>0){A.href=this.href;}if(this.removeClass){A.cls='';}if(this.target){A.target=this.target;}return A;},initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype;
this.menu.triggerEl=this.el;this.addxtype(Roo.apply({},this.menu));}if(this.el.hasClass('roo-button')){this.el.on('click',this.onClick,this);}else{this.el.select('.roo-button').on('click',this.onClick,this);}if(this.removeClass){this.el.on('click',this.onClick,this);
}this.el.enableDisplayMode();},onClick:function(e){if(this.disabled){return;}Roo.log('button on click ');if(this.preventDefault){e.preventDefault();}if(this.pressed===true||this.pressed===false){this.toggleActive(e);}this.fireEvent('click',this,e);},enable:function(){this.disabled=false;
-this.el.removeClass('disabled');},disable:function(){this.disabled=true;this.el.addClass('disabled');},setActive:function(v){this.el[v?'addClass':'removeClass']('active');this.pressed=v;},toggleActive:function(e){this.setActive(!this.pressed);this.fireEvent('toggle',this,e,!this.pressed);
+this.el.removeClass('disabled');},disable:function(){this.disabled=true;this.el.addClass('disabled');},setActive:function(v){this.el[v?'addClass':'removeClass']('active');this.pressed=v;},toggleActive:function(e){this.setActive(!this.pressed);this.fireEvent('toggle',this,e,this.pressed);
},isActive:function(){return this.el.hasClass('active');},setText:function(A){this.el.select('.roo-button-text',true).first().dom.innerHTML=A;},getText:function(){return this.el.select('.roo-button-text',true).first().dom.innerHTML;},setWeight:function(A){this.el.removeClass(Roo.bootstrap.Button.weights.map(function(w){return 'btn-'+w;
}));this.el.removeClass(Roo.bootstrap.Button.weights.map(function(w){return 'btn-outline-'+w;}));this.weight=A;var B=this.outline?'outline-':'';if(A=='default'){this.el.addClass('btn-default btn-outline-secondary');return;}this.el.addClass('btn-'+B+A);}});
Roo.bootstrap.Button.weights=['default','secondary','primary','success','info','warning','danger','link','light','dark'];
C.items_n=i>0?i-1:0;C.card_n=F>0?F-1:0;C.card=C.cards[C.card_n];}}if(!C.cards.length){C.card=true;C.position='below';C.items_n;return C;}if(C.card_n<0){C.card_n=E;C.card=C.cards[E];C.items_n=this.items.indexOf(C.cards[E]);C.position='below';}if(this.items[C.items_n].el==A){return false;
}if(C.position=='below'){var G=C.card_n+1==C.cards.length?false:C.cards[C.card_n+1];if(G&&G.el==A){return false;}return C;}var H=C.card_n>0?C.cards[C.card_n-1]:false;if(H&&H.el==A){return false;}return C;},onNodeEnter:function(n,dd,e,A){return false;},onNodeOver:function(n,dd,e,A){var B=this.getTargetFromEvent(e,A.source.el);
if(B===false){this.dropPlaceHolder('hide');return false;}Roo.log(['getTargetFromEvent',B]);this.dropPlaceHolder('show',B,A);return false;},onNodeOut:function(n,dd,e,A){this.dropPlaceHolder('hide');},onNodeDrop:function(n,dd,e,A){var B=this.getTargetFromEvent(e,A.source.el);
-if(B===false){return false;}if(this.fireEvent("drop",this,n,dd,e,A)===false){return false;}this.dropPlaceHolder('hide');var C=A.source.el.dom;C.parentNode.removeChild(C);if(B.card!==true){var D=B.card.el.dom;if(B.position=='above'){D.parentNode.insertBefore(C,D);
-}else if(D.nextSibling){D.parentNode.insertBefore(C,D.nextSibling);}else{D.parentNode.append(C);}}else{this.bodyEl.dom.append(C);}var E=A.source.parent();E.items=E.items.filter(function(e){return e!=A.source});if(this.items.length){var F=[];for(var i=0;i<this.items.length;
-i++){if(i==B.items_n&&B.position=='above'){F.push(A.source);}F.push(this.items[i]);if(i==B.items_n&&B.position=='below'){F.push(A.source);}}this.items=F;Roo.log(this.items);}else{this.items.push(A.source);}A.source.parentId=this.id;return true;},getDropPoint:function(e,n,dd){if(dd){return false;
+if(B===false){return false;}this.dropPlaceHolder('hide');if(this.fireEvent("drop",this,n,dd,e,A)===false){return false;}this.acceptCard(A.source,B.position,B.card,B.items_n);return true;},firstChildCard:function(){for(var i=0;i<this.items.length;i++){if(!this.items[i].el.hasClass('card')){continue;
+}return this.items[i];}return this.items.length?this.items[this.items.length-1]:false;},acceptCard:function(A,B,C){if(this.fireEvent("drop",this,A,B,C)===false){return false;}var D=C?this.items.indexOf(C):true;var E=A.el.dom;E.parentNode.removeChild(E);if(C!==true){var F=C.el.dom;
+if(B=='above'){F.parentNode.insertBefore(E,F);}else if(F.nextSibling){F.parentNode.insertBefore(E,F.nextSibling);}else{F.parentNode.append(E);}}else{this.bodyEl.dom.append(E);}var G=A.parent();G.items=G.items.filter(function(e){return e!=A});if(this.items.length){var H=[];
+for(var i=0;i<this.items.length;i++){if(i==D&&B=='above'){H.push(A);}H.push(this.items[i]);if(i==D&&B=='below'){H.push(A);}}this.items=H;Roo.log(this.items);}else{this.items.push(A);}A.parentId=this.id;return true;},getDropPoint:function(e,n,dd){if(dd){return false;
}if(n==this.bodyEl.dom){return "above";}var t=Roo.lib.Dom.getY(n),b=t+n.offsetHeight;var c=t+(b-t)/2;var y=Roo.lib.Event.getPageY(e);if(y<=c){return "above";}else{return "below";}},onToggleCollapse:function(e){if(this.collapsed){this.el.select('.roo-collapse-toggle').removeClass('collapsed');
this.collapsableEl.addClass('show');this.collapsed=false;return;}this.el.select('.roo-collapse-toggle').addClass('collapsed');this.collapsableEl.removeClass('show');this.collapsed=true;},onToggleRotate:function(e){this.collapsableEl.removeClass('show');this.footerEl.removeClass('d-none');
this.el.removeClass('roo-card-rotated');this.el.removeClass('d-none');if(this.rotated){this.collapsableEl.addClass('show');this.rotated=false;this.fireEvent('rotate',this,this.rotated);return;}this.el.addClass('roo-card-rotated');this.footerEl.addClass('d-none');