6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass /**
ad598bab533c3f4f0bdb0f536bcf5e0ac0769d15Dav Glass * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate.
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @module dd
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @submodule dd-delegate
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass */
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass /**
ad598bab533c3f4f0bdb0f536bcf5e0ac0769d15Dav Glass * Provides the ability to drag multiple nodes under a container element using only one Y.DD.Drag instance as a delegate.
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @class Delegate
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @extends Base
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @constructor
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @namespace DD
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass */
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass
482da2d388e0f999f372383039af944e21bc717bDav Glass var Delegate = function(o) {
482da2d388e0f999f372383039af944e21bc717bDav Glass Delegate.superclass.constructor.apply(this, arguments);
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass CONT = 'container',
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass NODES = 'nodes',
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass _tmpNode = Y.Node.create('<div>Temp Node</div>');
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
482da2d388e0f999f372383039af944e21bc717bDav Glass Y.extend(Delegate, Y.Base, {
f05c0eb9de3e3021b733c24fb7d17ba9ae093272Dav Glass /**
f05c0eb9de3e3021b733c24fb7d17ba9ae093272Dav Glass * @private
f05c0eb9de3e3021b733c24fb7d17ba9ae093272Dav Glass * @property _bubbleTargets
f05c0eb9de3e3021b733c24fb7d17ba9ae093272Dav Glass * @description The default bubbleTarget for this object. Default: Y.DD.DDM
f05c0eb9de3e3021b733c24fb7d17ba9ae093272Dav Glass */
f05c0eb9de3e3021b733c24fb7d17ba9ae093272Dav Glass _bubbleTargets: Y.DD.DDM,
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @property dd
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @description A reference to the temporary dd instance used under the hood.
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass */
3b3bd34996b581ab171be1465201869cb009dbadDav Glass dd: null,
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass /**
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @property _shimState
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @private
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @description The state of the Y.DD.DDM._noShim property to it can be reset.
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass */
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass _shimState: null,
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @private
5b99a6835685fac17a0dad8b3b3a8e3d76e59c94Dav Glass * @property _handles
5b99a6835685fac17a0dad8b3b3a8e3d76e59c94Dav Glass * @description Array of event handles to be destroyed
5b99a6835685fac17a0dad8b3b3a8e3d76e59c94Dav Glass */
5b99a6835685fac17a0dad8b3b3a8e3d76e59c94Dav Glass _handles: null,
5b99a6835685fac17a0dad8b3b3a8e3d76e59c94Dav Glass /**
5b99a6835685fac17a0dad8b3b3a8e3d76e59c94Dav Glass * @private
482da2d388e0f999f372383039af944e21bc717bDav Glass * @method _onNodeChange
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Listens to the nodeChange event and sets the dragNode on the temp dd instance.
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @param {Event} e The Event.
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass _onNodeChange: function(e) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass this.set('dragNode', e.newVal);
3b3bd34996b581ab171be1465201869cb009dbadDav Glass },
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @private
482da2d388e0f999f372383039af944e21bc717bDav Glass * @method _afterDragEnd
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Listens for the drag:end event and updates the temp dd instance.
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @param {Event} e The Event.
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass _afterDragEnd: function(e) {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass Y.DD.DDM._noShim = this._shimState;
afd5f1529ad29e1f0661263383c202acf3cc6a32Dav Glass
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this.set('lastNode', this.dd.get('node'));
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this.get('lastNode').removeClass(Y.DD.DDM.CSS_PREFIX + '-dragging');
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this.dd._unprep();
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this.dd.set('node', _tmpNode);
3b3bd34996b581ab171be1465201869cb009dbadDav Glass },
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @private
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass * @method _delMouseDown
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description The callback for the Y.DD.Delegate instance used
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @param {Event} e The MouseDown Event.
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass _delMouseDown: function(e) {
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass var tar = e.currentTarget,
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass dd = this.dd;
d6ca53ce458cb3beccaeb0242202a44d0e6de0acDav Glass
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass if (tar.test(this.get(NODES)) && !tar.test(this.get('invalid'))) {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this._shimState = Y.DD.DDM._noShim;
a201dfca71f32a095917fac03611f2f999cb3b97Dav Glass Y.DD.DDM._noShim = true;
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this.set('currentNode', tar);
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass dd.set('node', tar);
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass if (dd.proxy) {
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass dd.set('dragNode', Y.DD.DDM._proxy);
a201dfca71f32a095917fac03611f2f999cb3b97Dav Glass } else {
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass dd.set('dragNode', tar);
a201dfca71f32a095917fac03611f2f999cb3b97Dav Glass }
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass dd._prep();
d6ca53ce458cb3beccaeb0242202a44d0e6de0acDav Glass
482da2d388e0f999f372383039af944e21bc717bDav Glass dd.fire('drag:mouseDown', { ev: e });
3b3bd34996b581ab171be1465201869cb009dbadDav Glass }
3b3bd34996b581ab171be1465201869cb009dbadDav Glass },
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @private
482da2d388e0f999f372383039af944e21bc717bDav Glass * @method _onMouseEnter
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Sets the target shim state
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @param {Event} e The MouseEnter Event
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass _onMouseEnter: function(e) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass this._shimState = Y.DD.DDM._noShim;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass Y.DD.DDM._noShim = true;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass },
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @private
482da2d388e0f999f372383039af944e21bc717bDav Glass * @method _onMouseLeave
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Resets the target shim state
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @param {Event} e The MouseLeave Event
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass _onMouseLeave: function(e) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass Y.DD.DDM._noShim = this._shimState;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass initializer: function(cfg) {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this._handles = [];
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass //Create a tmp DD instance under the hood.
1db7a264d82ab84bbc6a175fbb4d2aeeed45d052Dav Glass //var conf = Y.clone(this.get('dragConfig') || {}),
1db7a264d82ab84bbc6a175fbb4d2aeeed45d052Dav Glass var conf = this.get('dragConfig') || {},
482da2d388e0f999f372383039af944e21bc717bDav Glass cont = this.get(CONT);
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass
3b3bd34996b581ab171be1465201869cb009dbadDav Glass conf.node = _tmpNode.cloneNode(true);
482da2d388e0f999f372383039af944e21bc717bDav Glass conf.bubbleTargets = this;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass
482da2d388e0f999f372383039af944e21bc717bDav Glass if (this.get('handles')) {
482da2d388e0f999f372383039af944e21bc717bDav Glass conf.handles = this.get('handles');
482da2d388e0f999f372383039af944e21bc717bDav Glass }
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass
482da2d388e0f999f372383039af944e21bc717bDav Glass this.dd = new Y.DD.Drag(conf);
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass //On end drag, detach the listeners
482da2d388e0f999f372383039af944e21bc717bDav Glass this.dd.after('drag:end', Y.bind(this._afterDragEnd, this));
482da2d388e0f999f372383039af944e21bc717bDav Glass this.dd.on('dragNodeChange', Y.bind(this._onNodeChange, this));
380fd5294aabfa2070df49d96ec2f4bdb41c6c79Dav Glass this.dd.after('drag:mouseup', function() {
380fd5294aabfa2070df49d96ec2f4bdb41c6c79Dav Glass this._unprep();
380fd5294aabfa2070df49d96ec2f4bdb41c6c79Dav Glass });
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass //Attach the delegate to the container
0e2ca74abf5da92afe63a29d96776674f0412affDav Glass this._handles.push(Y.delegate(Y.DD.Drag.START_EVENT, Y.bind(this._delMouseDown, this), cont, this.get(NODES)));
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this._handles.push(Y.on('mouseenter', Y.bind(this._onMouseEnter, this), cont));
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this._handles.push(Y.on('mouseleave', Y.bind(this._onMouseLeave, this), cont));
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass Y.later(50, this, this.syncTargets);
482da2d388e0f999f372383039af944e21bc717bDav Glass Y.DD.DDM.regDelegate(this);
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass },
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass /**
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @method syncTargets
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @description Applies the Y.Plugin.Drop to all nodes matching the cont + nodes selector query.
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @return {Self}
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass * @chainable
4d589fe0c1bf5d088a90cdf29f3bc777942006cbDav Glass */
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass syncTargets: function() {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass if (!Y.Plugin.Drop || this.get('destroyed')) {
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass return;
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass }
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass var items, groups, config;
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass if (this.get('target')) {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass items = Y.one(this.get(CONT)).all(this.get(NODES));
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass groups = this.dd.get('groups');
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass config = this.get('dragConfig');
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass
f05c0eb9de3e3021b733c24fb7d17ba9ae093272Dav Glass if (config && 'groups' in config) {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass groups = config.groups;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass }
3b3bd34996b581ab171be1465201869cb009dbadDav Glass
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass items.each(function(i) {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass this.createDrop(i, groups);
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass }, this);
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass }
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass return this;
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass },
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @method createDrop
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Apply the Drop plugin to this node
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @param {Node} node The Node to apply the plugin to
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @param {Array} groups The default groups to assign this target to.
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @return Node
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
3b3bd34996b581ab171be1465201869cb009dbadDav Glass createDrop: function(node, groups) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass var config = {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass useShim: false,
482da2d388e0f999f372383039af944e21bc717bDav Glass bubbleTargets: this
3b3bd34996b581ab171be1465201869cb009dbadDav Glass };
3b3bd34996b581ab171be1465201869cb009dbadDav Glass
3b3bd34996b581ab171be1465201869cb009dbadDav Glass if (!node.drop) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass node.plug(Y.Plugin.Drop, config);
3b3bd34996b581ab171be1465201869cb009dbadDav Glass }
3b3bd34996b581ab171be1465201869cb009dbadDav Glass node.drop.set('groups', groups);
3b3bd34996b581ab171be1465201869cb009dbadDav Glass return node;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass },
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass destructor: function() {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass if (this.dd) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass this.dd.destroy();
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass }
a201dfca71f32a095917fac03611f2f999cb3b97Dav Glass if (Y.Plugin.Drop) {
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass var targets = Y.one(this.get(CONT)).all(this.get(NODES));
482da2d388e0f999f372383039af944e21bc717bDav Glass targets.unplug(Y.Plugin.Drop);
482da2d388e0f999f372383039af944e21bc717bDav Glass }
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass Y.each(this._handles, function(v) {
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass v.detach();
eba99cf5219728ad7993f0b1ed3b75f7fdb78193Dav Glass });
482da2d388e0f999f372383039af944e21bc717bDav Glass }
482da2d388e0f999f372383039af944e21bc717bDav Glass }, {
482da2d388e0f999f372383039af944e21bc717bDav Glass NAME: 'delegate',
482da2d388e0f999f372383039af944e21bc717bDav Glass ATTRS: {
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute container
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description A selector query to get the container to listen for mousedown events on. All "nodes" should be a child of this container.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type String
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass container: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: 'body'
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute nodes
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description A selector query to get the children of the "container" to make draggable elements from.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type String
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass nodes: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: '.dd-draggable'
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute invalid
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description A selector query to test a node to see if it's an invalid item.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type String
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass invalid: {
afd5f1529ad29e1f0661263383c202acf3cc6a32Dav Glass value: 'input, select, button, a, textarea'
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute lastNode
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description Y.Node instance of the last item dragged.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type Node
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass lastNode: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: _tmpNode
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute currentNode
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description Y.Node instance of the dd node.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type Node
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass currentNode: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: _tmpNode
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute dragNode
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description Y.Node instance of the dd dragNode.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type Node
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass dragNode: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: _tmpNode
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute over
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description Is the mouse currently over the container
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type Boolean
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass over: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: false
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute target
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description Should the items also be a drop target.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type Boolean
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass target: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: false
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute dragConfig
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description The default config to be used when creating the DD instance.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type Object
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass dragConfig: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: null
482da2d388e0f999f372383039af944e21bc717bDav Glass },
482da2d388e0f999f372383039af944e21bc717bDav Glass /**
482da2d388e0f999f372383039af944e21bc717bDav Glass * @attribute handles
482da2d388e0f999f372383039af944e21bc717bDav Glass * @description The handles config option added to the temp DD instance.
482da2d388e0f999f372383039af944e21bc717bDav Glass * @type Array
482da2d388e0f999f372383039af944e21bc717bDav Glass */
482da2d388e0f999f372383039af944e21bc717bDav Glass handles: {
482da2d388e0f999f372383039af944e21bc717bDav Glass value: null
a201dfca71f32a095917fac03611f2f999cb3b97Dav Glass }
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass }
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass });
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
3b3bd34996b581ab171be1465201869cb009dbadDav Glass Y.mix(Y.DD.DDM, {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @private
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @for DDM
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @property _delegates
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Holder for all Y.DD.Delegate instances
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @type Array
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
3b3bd34996b581ab171be1465201869cb009dbadDav Glass _delegates: [],
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @for DDM
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @method regDelegate
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Register a Delegate with the DDM
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
3b3bd34996b581ab171be1465201869cb009dbadDav Glass regDelegate: function(del) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass this._delegates.push(del);
3b3bd34996b581ab171be1465201869cb009dbadDav Glass },
3b3bd34996b581ab171be1465201869cb009dbadDav Glass /**
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @for DDM
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @method getDelegate
3b3bd34996b581ab171be1465201869cb009dbadDav Glass * @description Get a delegate instance from a container node
18e82681a4dfa7e04bd54297593e1da270fb7fd0Dav Glass * @return Y.DD.Delegate
3b3bd34996b581ab171be1465201869cb009dbadDav Glass */
3b3bd34996b581ab171be1465201869cb009dbadDav Glass getDelegate: function(node) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass var del = null;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass node = Y.one(node);
3b3bd34996b581ab171be1465201869cb009dbadDav Glass Y.each(this._delegates, function(v) {
713a27b6ab5ab057e9b4ab551617b54730e8906eDav Glass if (node.test(v.get(CONT))) {
3b3bd34996b581ab171be1465201869cb009dbadDav Glass del = v;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass }
3b3bd34996b581ab171be1465201869cb009dbadDav Glass }, this);
3b3bd34996b581ab171be1465201869cb009dbadDav Glass return del;
3b3bd34996b581ab171be1465201869cb009dbadDav Glass }
3b3bd34996b581ab171be1465201869cb009dbadDav Glass });
3b3bd34996b581ab171be1465201869cb009dbadDav Glass
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass Y.namespace('DD');
482da2d388e0f999f372383039af944e21bc717bDav Glass Y.DD.Delegate = Delegate;
6cd85fc002ad88c48179730400dc0bc36a7a9f5bDav Glass
18e82681a4dfa7e04bd54297593e1da270fb7fd0Dav Glass