delegate.js revision 6de55f3713f55fbc379ea009f320a0803b7c8505
/**
* This class 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
*/
/**
* This class 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 D = function(o) {
},
CONT = 'cont',
NODES = 'nodes',
D.NAME = 'delegate';
D.ATTRS = {
/**
* @attribute cont
* @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
*/
cont: {
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: ''
},
/**
* @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
}
};
/**
* @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
* @method _handleNodeChange
* @description Listens to the nodeChange event and sets the dragNode on the temp dd instance.
* @param {Event} e The Event.
*/
_handleNodeChange: function(e) {
},
/**
* @private
* @method _handleDragEnd
* @description Listens for the drag:end event and updates the temp dd instance.
* @param {Event} e The Event.
*/
_handleDragEnd: function(e) {
var self = this;
},
/**
* @private
* @method _handleDelegate
* @description The callback for the Y.DD.Delegate instance used
* @param {Event} e The MouseDown Event.
*/
_handleDelegate: function(e) {
var tar = e.currentTarget,
} else {
}
}
},
/**
* @private
* @method _handleMouseEnter
* @description Sets the target shim state
* @param {Event} e The MouseEnter Event
*/
_handleMouseEnter: function(e) {
},
/**
* @private
* @method _handleMouseLeave
* @description Resets the target shim state
* @param {Event} e The MouseLeave Event
*/
_handleMouseLeave: function(e) {
},
initializer: function() {
//Create a tmp DD instance under the hood.
}
//Set this as the target
//On end drag, detach the listeners
//Attach the delegate to the container
self.syncTargets();
},
/**
* @method syncTargets
* @description Applies the Y.Plugin.Drop to all nodes matching the cont + nodes selector query.
* @param {String} group The default group to assign this target to. Optional.
* @return {Self}
* @chainable
*/
syncTargets: function(group) {
Y.error('DD.Delegate: Drop Plugin Not Found');
return;
}
if (group) {
}
});
}
return self;
},
/**
* @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,
bubbles: this
};
}
return node;
},
//TODO
return this;
},
destructor: function() {
if (this.dd) {
}
});
}
}
});
/**
* @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');