|
@ -1832,28 +1832,122 @@
|
|
|
}
|
|
|
this.inputText.val(value)
|
|
|
},
|
|
|
_init: function ()
|
|
|
_render: function ()
|
|
|
{
|
|
|
$.ligerui.controls.Spinner.base._init.call(this);
|
|
|
var p = this.options;
|
|
|
if (p.type == 'float')
|
|
|
{
|
|
|
p.step = 0.1;
|
|
|
p.interval = 300;
|
|
|
} else if (p.type == 'int')
|
|
|
var g = this, p = this.options;
|
|
|
g.interval = null;
|
|
|
g.inputText = null;
|
|
|
g.value = null;
|
|
|
g.textFieldID = "";
|
|
|
if (this.element.tagName.toLowerCase() == "input" && this.element.type && this.element.type == "text")
|
|
|
{
|
|
|
g.inputText = $(this.element);
|
|
|
if (this.element.id)
|
|
|
g.textFieldID = this.element.id;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
p.step = 1;
|
|
|
p.interval = 300;
|
|
|
} else if (p.type == 'time')
|
|
|
g.inputText = $('<input type="text"/>');
|
|
|
g.inputText.appendTo($(this.element));
|
|
|
}
|
|
|
if (g.textFieldID == "" && p.textFieldID)
|
|
|
g.textFieldID = p.textFieldID;
|
|
|
|
|
|
g.link = $('<div class="l-trigger"><div class="l-spinner-up"><div class="l-spinner-icon"></div></div><div class="l-spinner-split"></div><div class="l-spinner-down"><div class="l-spinner-icon"></div></div></div>');
|
|
|
g.wrapper = g.inputText.wrap('<div class="l-text"></div>').parent();
|
|
|
g.wrapper.append('<div class="l-text-l"></div><div class="l-text-r"></div>');
|
|
|
g.wrapper.append(g.link).after(g.selectBox).after(g.valueField);
|
|
|
g.link.up = $(".l-spinner-up", g.link);
|
|
|
g.link.down = $(".l-spinner-down", g.link);
|
|
|
g.inputText.addClass("l-text-field");
|
|
|
|
|
|
if (p.disabled)
|
|
|
{
|
|
|
p.step = 1;
|
|
|
p.interval = 300;
|
|
|
} else
|
|
|
g.wrapper.addClass("l-text-disabled");
|
|
|
}
|
|
|
//初始化
|
|
|
if (!g._isVerify(g.inputText.val()))
|
|
|
{
|
|
|
p.type = "int";
|
|
|
p.step = 1;
|
|
|
p.interval = 300;
|
|
|
g.value = g._getDefaultValue();
|
|
|
g._showValue(g.value);
|
|
|
}
|
|
|
//事件
|
|
|
g.link.up.hover(function ()
|
|
|
{
|
|
|
if (!p.disabled)
|
|
|
$(this).addClass("l-spinner-up-over");
|
|
|
}, function ()
|
|
|
{
|
|
|
clearInterval(g.interval);
|
|
|
$(document).unbind("selectstart.spinner");
|
|
|
$(this).removeClass("l-spinner-up-over");
|
|
|
}).mousedown(function ()
|
|
|
{
|
|
|
if (!p.disabled)
|
|
|
{
|
|
|
g._uping.call(g);
|
|
|
/********* 向上延时500 *************/
|
|
|
g.interval = setInterval(function ()
|
|
|
{
|
|
|
g._uping.call(g);
|
|
|
}, p.interval+500);
|
|
|
/**********************************/
|
|
|
$(document).bind("selectstart.spinner", function () { return false; });
|
|
|
}
|
|
|
}).mouseup(function ()
|
|
|
{
|
|
|
clearInterval(g.interval);
|
|
|
g.inputText.trigger("change").focus();
|
|
|
$(document).unbind("selectstart.spinner");
|
|
|
});
|
|
|
g.link.down.hover(function ()
|
|
|
{
|
|
|
if (!p.disabled)
|
|
|
$(this).addClass("l-spinner-down-over");
|
|
|
}, function ()
|
|
|
{
|
|
|
clearInterval(g.interval);
|
|
|
$(document).unbind("selectstart.spinner");
|
|
|
$(this).removeClass("l-spinner-down-over");
|
|
|
}).mousedown(function ()
|
|
|
{
|
|
|
if (!p.disabled)
|
|
|
{
|
|
|
g.interval = setInterval(function ()
|
|
|
{
|
|
|
g._downing.call(g);
|
|
|
}, p.interval);
|
|
|
$(document).bind("selectstart.spinner", function () { return false; });
|
|
|
}
|
|
|
}).mouseup(function ()
|
|
|
{
|
|
|
clearInterval(g.interval);
|
|
|
g.inputText.trigger("change").focus();
|
|
|
$(document).unbind("selectstart.spinner");
|
|
|
});
|
|
|
|
|
|
g.inputText.change(function ()
|
|
|
{
|
|
|
var value = g.inputText.val();
|
|
|
g.value = g._getVerifyValue(value);
|
|
|
g.trigger('changeValue', [g.value]);
|
|
|
g._showValue(g.value);
|
|
|
}).blur(function ()
|
|
|
{
|
|
|
g.wrapper.removeClass("l-text-focus");
|
|
|
}).focus(function ()
|
|
|
{
|
|
|
g.wrapper.addClass("l-text-focus");
|
|
|
});
|
|
|
g.wrapper.hover(function ()
|
|
|
{
|
|
|
if (!p.disabled)
|
|
|
g.wrapper.addClass("l-text-over");
|
|
|
}, function ()
|
|
|
{
|
|
|
g.wrapper.removeClass("l-text-over");
|
|
|
});
|
|
|
g.set(p);
|
|
|
}
|
|
|
});
|
|
|
|