提交 6185d048 编写于 作者: C Catouse

* fixed errors in droppable.js.

 * rebuit.
上级 a4701c93
/*!
* ZUI - v1.1.0-dev - 2014-07-28
* ZUI - v1.1.0-dev - 2014-08-01
* http://easysoft.github.io/zui/
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
......@@ -44,7 +44,8 @@ This file is generated by `grunt build`, do not edit it by hand.
group: true,
label: this.escapeExpression(group.label),
children: 0,
disabled: group.disabled
disabled: group.disabled,
search_keys: ($.trim(group.getAttribute('data-keys') || '')).replace(/,/, ' ')
});
_ref = group.childNodes;
_results = [];
......@@ -71,7 +72,8 @@ This file is generated by `grunt build`, do not edit it by hand.
disabled: group_disabled === true ? group_disabled : option.disabled,
group_array_index: group_position,
classes: option.className,
style: option.style.cssText
style: option.style.cssText,
search_keys: ($.trim(option.getAttribute('data-keys') || '')).replace(/,/, ' ')
});
} else {
this.parsed.push({
......@@ -343,16 +345,23 @@ This file is generated by `grunt build`, do not edit it by hand.
}
if (!(option.group && !this.group_search)) {
option.search_text = option.group ? option.label : option.html;
option.search_match = this.search_string_match(option.search_text, regex);
option.search_keys_match = this.search_string_match(option.search_keys, regex);
option.search_text_match = this.search_string_match(option.search_text, regex);
option.search_match = option.search_text_match || option.search_keys_match;
if (option.search_match && !option.group) {
results += 1;
}
if (option.search_match) {
if (searchText.length) {
if (option.search_text_match && option.search_text.length) {
startpos = option.search_text.search(zregex);
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
}
else if(option.search_keys_match && option.search_keys.length){
startpos = option.search_keys.search(zregex);
text = option.search_keys.substr(0, startpos + searchText.length) + '</em>' + option.search_keys.substr(startpos + searchText.length);
option.search_text += '&nbsp; <small style="opacity: 0.7">' + text.substr(0, startpos) + '<em>' + text.substr(startpos) + '</small>';
}
if (results_group != null) {
results_group.group_match = true;
}
......@@ -1218,7 +1227,7 @@ This file is generated by `grunt build`, do not edit it by hand.
}).call(this);
/*!
* ZUI - v1.1.0-dev - 2014-07-28
* ZUI - v1.1.0-dev - 2014-08-01
* http://easysoft.github.io/zui/
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
......
/*!
* ZUI - v1.1.0-dev - 2014-07-28
* ZUI - v1.1.0-dev - 2014-08-01
* http://easysoft.github.io/zui/
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
......@@ -3360,7 +3360,7 @@ a .icon-flip-vertical:before {
.icon-coffee:before {
content: "\e6d2";
}
.icon-file-alt:before {
.icon-file-text-alt:before {
content: "\e6d4";
}
.icon-building:before {
......@@ -3402,6 +3402,9 @@ a .icon-flip-vertical:before {
.icon-mobile:before {
content: "\e6e7";
}
.icon-mobile-phone:before {
content: "\e6e7";
}
.icon-circle-blank:before {
content: "\e6e8";
}
......
此差异已折叠。
/*!
* ZUI - v1.1.0-dev - 2014-07-28
* ZUI - v1.1.0-dev - 2014-08-01
* http://easysoft.github.io/zui/
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
......@@ -3068,7 +3068,7 @@ a .icon-flip-vertical:before {
.icon-coffee:before {
content: "\e6d2";
}
.icon-file-alt:before {
.icon-file-text-alt:before {
content: "\e6d4";
}
.icon-building:before {
......@@ -3110,6 +3110,9 @@ a .icon-flip-vertical:before {
.icon-mobile:before {
content: "\e6e7";
}
.icon-mobile-phone:before {
content: "\e6e7";
}
.icon-circle-blank:before {
content: "\e6e8";
}
......
此差异已折叠。
此差异已折叠。
因为 它太大了无法显示 source diff 。你可以改为 查看blob
/*!
* ZUI - v1.1.0-dev - 2014-07-29
* ZUI - v1.1.0-dev - 2014-08-01
* http://easysoft.github.io/zui/
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
......@@ -3211,7 +3211,7 @@ var imgReady = (function () {
this.init();
};
Droppable.DEFAULTS = {container: 'body', flex: false, deviation: 5};
Droppable.DEFAULTS = {container: 'body', flex: false, deviation: 5, sensorOffsetX: 0, sensorOffsetY: 0, nested: false};
Droppable.prototype.getOptions = function (options)
{
......@@ -3235,7 +3235,7 @@ var imgReady = (function () {
self = this,
setting = this.options;
this.$triggerTarget = (setting.trigger ? $e.find(setting.trigger) : $e);
this.$triggerTarget = (setting.trigger ? ($.isFunction(setting.trigger) ? setting.trigger($e) : $e.find(setting.trigger)).first() : $e);
this.$triggerTarget.on('mousedown', function(event)
{
......@@ -3248,7 +3248,7 @@ var imgReady = (function () {
var $targets = $(setting.target),
target = null,
shadow = null,
$container = $(setting.container),
$container = $(setting.container).first(),
isIn = false,
isSelf = true,
oldCssPosition,
......@@ -3304,30 +3304,38 @@ var imgReady = (function () {
$targets.removeClass('drop-to');
}
var newTarget = null;
$targets.each(function(index)
{
var t = $(this);
var tPos = t.offset();
var tW = t.width(),
tH = t.height(),
tX = tPos.left,
tY = tPos.top;
tX = tPos.left + setting.sensorOffsetX,
tY = tPos.top + setting.sensorOffsetY;
if(mouseOffset.left > tX && mouseOffset.top > tY && mouseOffset.left < (tX + tW) && mouseOffset.top < (tY + tH))
{
isIn = true;
if($e.data('id') != t.data('id')) isSelf = false;
if(target == null || (target.data('id') != t.data('id') && (!isSelf))) isNew = true;
target = t;
if(setting.flex)
{
$targets.removeClass('drop-to');
}
t.addClass('drop-to');
return false;
if(newTarget) newTarget.removeClass('drop-to');
newTarget = t;
if(!setting.nested) return false;
}
});
if(newTarget)
{
isIn = true;
var id = newTarget.data('id');
if($e.data('id') != id) isSelf = false;
if(target == null || (target.data('id') != id && (!isSelf))) isNew = true;
target = newTarget;
if(setting.flex)
{
$targets.removeClass('drop-to');
}
target.addClass('drop-to');
}
if(!setting.flex)
{
$e.toggleClass('drop-in', isIn);
......@@ -3460,7 +3468,7 @@ var imgReady = (function () {
Sortable.prototype.reset = function()
{
var that = this;
var that = this, order = 0;
var list = this.$.children(this.options.selector);
list.each(function()
{
......@@ -3474,6 +3482,7 @@ var imgReady = (function () {
{
that.bindEventToList($this);
}
$(this).attr('data-order', ++order);
});
};
......@@ -3539,6 +3548,7 @@ var imgReady = (function () {
var options = typeof option == 'object' && option;
if (!data) $this.data('zui.sortable', (data = new Sortable(this, options)));
else if(typeof option == 'object') data.reset();
if (typeof option == 'string') data[option]();
})
......
/*!
* ZUI - v1.1.0-dev - 2014-07-28
* ZUI - v1.1.0-dev - 2014-08-01
* http://easysoft.github.io/zui/
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
......
/*!
* ZUI - v1.1.0-dev - 2014-07-28
* ZUI - v1.1.0-dev - 2014-08-01
* http://easysoft.github.io/zui/
* GitHub: https://github.com/easysoft/zui.git
* Copyright (c) 2014 cnezsoft.com; Licensed MIT
......
此差异已折叠。
此差异已折叠。
......@@ -11,7 +11,7 @@
this.init();
};
Droppable.DEFAULTS = {container: 'body', flex: false, deviation: 5};
Droppable.DEFAULTS = {container: 'body', flex: false, deviation: 5, sensorOffsetX: 0, sensorOffsetY: 0, nested: false};
Droppable.prototype.getOptions = function (options)
{
......@@ -35,7 +35,7 @@
self = this,
setting = this.options;
this.$triggerTarget = (setting.trigger ? $e.find(setting.trigger) : $e);
this.$triggerTarget = (setting.trigger ? ($.isFunction(setting.trigger) ? setting.trigger($e) : $e.find(setting.trigger)).first() : $e);
this.$triggerTarget.on('mousedown', function(event)
{
......@@ -48,7 +48,7 @@
var $targets = $(setting.target),
target = null,
shadow = null,
$container = $(setting.container),
$container = $(setting.container).first(),
isIn = false,
isSelf = true,
oldCssPosition,
......@@ -104,30 +104,38 @@
$targets.removeClass('drop-to');
}
var newTarget = null;
$targets.each(function(index)
{
var t = $(this);
var tPos = t.offset();
var tW = t.width(),
tH = t.height(),
tX = tPos.left,
tY = tPos.top;
tX = tPos.left + setting.sensorOffsetX,
tY = tPos.top + setting.sensorOffsetY;
if(mouseOffset.left > tX && mouseOffset.top > tY && mouseOffset.left < (tX + tW) && mouseOffset.top < (tY + tH))
{
isIn = true;
if($e.data('id') != t.data('id')) isSelf = false;
if(target == null || (target.data('id') != t.data('id') && (!isSelf))) isNew = true;
target = t;
if(setting.flex)
{
$targets.removeClass('drop-to');
}
t.addClass('drop-to');
return false;
if(newTarget) newTarget.removeClass('drop-to');
newTarget = t;
if(!setting.nested) return false;
}
});
if(newTarget)
{
isIn = true;
var id = newTarget.data('id');
if($e.data('id') != id) isSelf = false;
if(target == null || (target.data('id') != id && (!isSelf))) isNew = true;
target = newTarget;
if(setting.flex)
{
$targets.removeClass('drop-to');
}
target.addClass('drop-to');
}
if(!setting.flex)
{
$e.toggleClass('drop-in', isIn);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册