delegate.js revision 800680c877c79e2f011188f8036b438463d824b5
/**
* Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate.
* @module dd
* @submodule dd-delegate
*/
/**
* Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate.
* @class Delegate
* @extends Base
* @constructor
* @namespace DD
*/
var Delegate = function(o) {
},
CONT = 'container',
NODES = 'nodes',
/**
* @private
* @property _bubbleTargets
* @description The default bubbleTarget for this object. Default: Y.DD.DDM
*/
/**
* @property dd
* @description A reference to the temporary dd instance used under the hood.
*/
dd: null,
/**
* @property _shimState
* @private
* @description The state of the Y.DD.DDM._noShim property to it can be reset.
*/
_shimState: null,
/**
* @private
* @property _handles
* @description Array of event handles to be destroyed
*/
_handles: null,
/**
* @private
* @method _onNodeChange
* @description Listens to the nodeChange event and sets the dragNode on the temp dd instance.
* @param {Event} e The Event.
*/
_onNodeChange: function(e) {
},
/**
* @private
* @method _afterDragEnd
* @description Listens for the drag:end event and updates the temp dd instance.
* @param {Event} e The Event.
*/
_afterDragEnd: function(e) {
},
/**
* @private
* @method _delMouseDown
* @description The callback for the Y.DD.Delegate instance used
* @param {Event} e The MouseDown Event.
*/
_delMouseDown: function(e) {
var tar = e.currentTarget,
} else {
}
}
},
/**
* @private
* @method _onMouseEnter
* @description Sets the target shim state
* @param {Event} e The MouseEnter Event
*/
_onMouseEnter: function(e) {
},
/**
* @private
* @method _onMouseLeave
* @description Resets the target shim state
* @param {Event} e The MouseLeave Event
*/
_onMouseLeave: function(e) {
},
initializer: function(cfg) {
this._handles = [];
//Create a tmp DD instance under the hood.
conf.bubbleTargets = this;
if (this.get('handles')) {
}
//On end drag, detach the listeners
//Attach the delegate to the container
this._handles.push(Y.delegate(Y.DD.Drag.START_EVENT, Y.bind(this._delMouseDown, this), cont, this.get(NODES)));
},
/**
* @method syncTargets
* @description Applies the Y.Plugin.Drop to all nodes matching the cont + nodes selector query.
* @return {Self}
* @chainable
*/
syncTargets: function() {
return;
}
if (this.get('target')) {
}
this.createDrop(i, groups);
}, this);
}
return this;
},
/**
* @method createDrop
* @description Apply the Drop plugin to this node
* @param {Node} node The Node to apply the plugin to
* @param {Array} groups The default groups to assign this target to.
* @return Node
*/
var config = {
useShim: false,
bubbleTargets: this
};
}
return node;
},
destructor: function() {
if (this.dd) {
}
}
v.detach();
});
}
}, {
NAME: 'delegate',
ATTRS: {
/**
* @attribute container
* @description A selector query to get the container to listen for mousedown events on. All "nodes" should be a child of this container.
* @type String
*/
container: {
value: 'body'
},
/**
* @attribute nodes
* @description A selector query to get the children of the "container" to make draggable elements from.
* @type String
*/
nodes: {
value: '.dd-draggable'
},
/**
* @attribute invalid
* @description A selector query to test a node to see if it's an invalid item.
* @type String
*/
invalid: {
value: 'input, select, button, a, textarea'
},
/**
* @attribute lastNode
* @description Y.Node instance of the last item dragged.
* @type Node
*/
lastNode: {
},
/**
* @attribute currentNode
* @description Y.Node instance of the dd node.
* @type Node
*/
currentNode: {
},
/**
* @attribute dragNode
* @description Y.Node instance of the dd dragNode.
* @type Node
*/
dragNode: {
},
/**
* @attribute over
* @description Is the mouse currently over the container
* @type Boolean
*/
over: {
value: false
},
/**
* @attribute target
* @description Should the items also be a drop target.
* @type Boolean
*/
target: {
value: false
},
/**
* @attribute dragConfig
* @description The default config to be used when creating the DD instance.
* @type Object
*/
dragConfig: {
value: null
},
/**
* @attribute handles
* @description The handles config option added to the temp DD instance.
* @type Array
*/
handles: {
value: null
}
}
});
/**
* @private
* @for DDM
* @property _delegates
* @description Holder for all Y.DD.Delegate instances
* @type Array
*/
_delegates: [],
/**
* @for DDM
* @method regDelegate
* @description Register a Delegate with the DDM
*/
regDelegate: function(del) {
},
/**
* @for DDM
* @method getDelegate
* @description Get a delegate instance from a container node
* @returns Y.DD.Delegate
*/
getDelegate: function(node) {
var del = null;
Y.each(this._delegates, function(v) {
del = v;
}
}, this);
return del;
}
});
Y.namespace('DD');