You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21142 lines
785 KiB
21142 lines
785 KiB
/** |
|
* EasyUI for jQuery 1.9.14 |
|
* |
|
* Copyright (c) 2009-2021 www.jeasyui.com. All rights reserved. |
|
* |
|
* Licensed under the freeware license: http://www.jeasyui.com/license_freeware.php |
|
* To use it on other terms please contact us: info@jeasyui.com |
|
* |
|
*/ |
|
(function ($) { |
|
$.easyui = { |
|
indexOfArray: function (a, o, id) { |
|
for (var i = 0, _1 = a.length; i < _1; i++) { |
|
if (id == undefined) { |
|
if (a[i] == o) { |
|
return i; |
|
} |
|
} else { |
|
if (a[i][o] == id) { |
|
return i; |
|
} |
|
} |
|
} |
|
return -1; |
|
}, |
|
removeArrayItem: function (a, o, id) { |
|
if (typeof o == "string") { |
|
for (var i = 0, _2 = a.length; i < _2; i++) { |
|
if (a[i][o] == id) { |
|
a.splice(i, 1); |
|
return; |
|
} |
|
} |
|
} else { |
|
var _3 = this.indexOfArray(a, o); |
|
if (_3 != -1) { |
|
a.splice(_3, 1); |
|
} |
|
} |
|
}, |
|
addArrayItem: function (a, o, r) { |
|
var _4 = this.indexOfArray(a, o, r ? r[o] : undefined); |
|
if (_4 == -1) { |
|
a.push(r ? r : o); |
|
} else { |
|
a[_4] = r ? r : o; |
|
} |
|
}, |
|
getArrayItem: function (a, o, id) { |
|
var _5 = this.indexOfArray(a, o, id); |
|
return _5 == -1 ? null : a[_5]; |
|
}, |
|
forEach: function (_6, _7, _8) { |
|
var _9 = []; |
|
for (var i = 0; i < _6.length; i++) { |
|
_9.push(_6[i]); |
|
} |
|
while (_9.length) { |
|
var _a = _9.shift(); |
|
if (_8(_a) == false) { |
|
return; |
|
} |
|
if (_7 && _a.children) { |
|
for (var i = _a.children.length - 1; i >= 0; i--) { |
|
_9.unshift(_a.children[i]); |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
$.parser = { |
|
auto: true, |
|
emptyFn: function () {}, |
|
onComplete: function (_b) {}, |
|
plugins: ["draggable", "droppable", "resizable", "pagination", "tooltip", "linkbutton", "menu", "sidemenu", "menubutton", "splitbutton", "switchbutton", "progressbar", "radiobutton", "checkbox", "tree", "textbox", "passwordbox", "maskedbox", "filebox", "combo", "combobox", "combotree", "combogrid", "combotreegrid", "tagbox", "numberbox", "validatebox", "searchbox", "spinner", "numberspinner", "timespinner", "datetimespinner", "calendar", "datebox", "datetimebox", "timepicker", "slider", "layout", "panel", "datagrid", "propertygrid", "treegrid", "datalist", "tabs", "accordion", "window", "dialog", "form"], |
|
parse: function (_c) { |
|
var aa = []; |
|
for (var i = 0; i < $.parser.plugins.length; i++) { |
|
var _d = $.parser.plugins[i]; |
|
var r = $(".easyui-" + _d, _c); |
|
if (r.length) { |
|
if (r[_d]) { |
|
r.each(function () { |
|
$(this)[_d]($.data(this, "options") || {}); |
|
}); |
|
} else { |
|
aa.push({ |
|
name: _d, |
|
jq: r |
|
}); |
|
} |
|
} |
|
} |
|
if (aa.length && window.easyloader) { |
|
var _e = []; |
|
for (var i = 0; i < aa.length; i++) { |
|
_e.push(aa[i].name); |
|
} |
|
easyloader.load(_e, function () { |
|
for (var i = 0; i < aa.length; i++) { |
|
var _f = aa[i].name; |
|
var jq = aa[i].jq; |
|
jq.each(function () { |
|
$(this)[_f]($.data(this, "options") || {}); |
|
}); |
|
} |
|
$.parser.onComplete.call($.parser, _c); |
|
}); |
|
} else { |
|
$.parser.onComplete.call($.parser, _c); |
|
} |
|
}, |
|
parseValue: function (_10, _11, _12, _13) { |
|
_13 = _13 || 0; |
|
var v = $.trim(String(_11 || "")); |
|
var _14 = v.substr(v.length - 1, 1); |
|
if (_14 == "%") { |
|
v = parseFloat(v.substr(0, v.length - 1)); |
|
if (_10.toLowerCase().indexOf("width") >= 0) { |
|
_13 += _12[0].offsetWidth - _12[0].clientWidth; |
|
v = Math.floor((_12.width() - _13) * v / 100); |
|
} else { |
|
_13 += _12[0].offsetHeight - _12[0].clientHeight; |
|
v = Math.floor((_12.height() - _13) * v / 100); |
|
} |
|
} else { |
|
v = parseInt(v) || undefined; |
|
} |
|
return v; |
|
}, |
|
parseOptions: function (_15, _16) { |
|
var t = $(_15); |
|
var _17 = {}; |
|
var s = $.trim(t.attr("data-options")); |
|
if (s) { |
|
if (s.substring(0, 1) != "{") { |
|
s = "{" + s + "}"; |
|
} |
|
_17 = (new Function("return " + s))(); |
|
} |
|
$.map(["width", "height", "left", "top", "minWidth", "maxWidth", "minHeight", "maxHeight"], function (p) { |
|
var pv = $.trim(_15.style[p] || ""); |
|
if (pv) { |
|
if (pv.indexOf("%") == -1) { |
|
pv = parseInt(pv); |
|
if (isNaN(pv)) { |
|
pv = undefined; |
|
} |
|
} |
|
_17[p] = pv; |
|
} |
|
}); |
|
if (_16) { |
|
var _18 = {}; |
|
for (var i = 0; i < _16.length; i++) { |
|
var pp = _16[i]; |
|
if (typeof pp == "string") { |
|
_18[pp] = t.attr(pp); |
|
} else { |
|
for (var _19 in pp) { |
|
var _1a = pp[_19]; |
|
if (_1a == "boolean") { |
|
_18[_19] = t.attr(_19) ? (t.attr(_19) == "true") : undefined; |
|
} else { |
|
if (_1a == "number") { |
|
_18[_19] = t.attr(_19) == "0" ? 0 : parseFloat(t.attr(_19)) || undefined; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
$.extend(_17, _18); |
|
} |
|
return _17; |
|
}, |
|
parseVars: function () { |
|
var d = $("<div style=\"position:absolute;top:-1000px;width:100px;height:100px;padding:5px\"></div>").appendTo("body"); |
|
$._boxModel = d.outerWidth() != 100; |
|
d.remove(); |
|
d = $("<div style=\"position:fixed\"></div>").appendTo("body"); |
|
$._positionFixed = (d.css("position") == "fixed"); |
|
d.remove(); |
|
} |
|
}; |
|
$(function () { |
|
$.parser.parseVars(); |
|
if (!window.easyloader && $.parser.auto) { |
|
$.parser.parse(); |
|
} |
|
}); |
|
$.fn._outerWidth = function (_1b) { |
|
if (_1b == undefined) { |
|
if (this[0] == window) { |
|
return this.width() || document.body.clientWidth; |
|
} |
|
return this.outerWidth() || 0; |
|
} |
|
return this._size("width", _1b); |
|
}; |
|
$.fn._outerHeight = function (_1c) { |
|
if (_1c == undefined) { |
|
if (this[0] == window) { |
|
return this.height() || document.body.clientHeight; |
|
} |
|
return this.outerHeight() || 0; |
|
} |
|
return this._size("height", _1c); |
|
}; |
|
$.fn._scrollLeft = function (_1d) { |
|
if (_1d == undefined) { |
|
return this.scrollLeft(); |
|
} else { |
|
return this.each(function () { |
|
$(this).scrollLeft(_1d); |
|
}); |
|
} |
|
}; |
|
$.fn._propAttr = $.fn.prop || $.fn.attr; |
|
$.fn._bind = $.fn.on; |
|
$.fn._unbind = $.fn.off; |
|
$.fn._size = function (_1e, _1f) { |
|
if (typeof _1e == "string") { |
|
if (_1e == "clear") { |
|
return this.each(function () { |
|
$(this).css({ |
|
width: "", |
|
minWidth: "", |
|
maxWidth: "", |
|
height: "", |
|
minHeight: "", |
|
maxHeight: "" |
|
}); |
|
}); |
|
} else { |
|
if (_1e == "fit") { |
|
return this.each(function () { |
|
_20(this, this.tagName == "BODY" ? $("body") : $(this).parent(), true); |
|
}); |
|
} else { |
|
if (_1e == "unfit") { |
|
return this.each(function () { |
|
_20(this, $(this).parent(), false); |
|
}); |
|
} else { |
|
if (_1f == undefined) { |
|
return _21(this[0], _1e); |
|
} else { |
|
return this.each(function () { |
|
_21(this, _1e, _1f); |
|
}); |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
return this.each(function () { |
|
_1f = _1f || $(this).parent(); |
|
$.extend(_1e, _20(this, _1f, _1e.fit) || {}); |
|
var r1 = _22(this, "width", _1f, _1e); |
|
var r2 = _22(this, "height", _1f, _1e); |
|
if (r1 || r2) { |
|
$(this).addClass("easyui-fluid"); |
|
} else { |
|
$(this).removeClass("easyui-fluid"); |
|
} |
|
}); |
|
} |
|
function _20(_23, _24, fit) { |
|
if (!_24.length) { |
|
return false; |
|
} |
|
var t = $(_23)[0]; |
|
var p = _24[0]; |
|
var _25 = p.fcount || 0; |
|
if (fit) { |
|
if (!t.fitted) { |
|
t.fitted = true; |
|
p.fcount = _25 + 1; |
|
$(p).addClass("panel-noscroll"); |
|
if (p.tagName == "BODY") { |
|
$("html").addClass("panel-fit"); |
|
} |
|
} |
|
return { |
|
width: ($(p).width() || 1), |
|
height: ($(p).height() || 1) |
|
}; |
|
} else { |
|
if (t.fitted) { |
|
t.fitted = false; |
|
p.fcount = _25 - 1; |
|
if (p.fcount == 0) { |
|
$(p).removeClass("panel-noscroll"); |
|
if (p.tagName == "BODY") { |
|
$("html").removeClass("panel-fit"); |
|
} |
|
} |
|
} |
|
return false; |
|
} |
|
}; |
|
function _22(_26, _27, _28, _29) { |
|
var t = $(_26); |
|
var p = _27; |
|
var p1 = p.substr(0, 1).toUpperCase() + p.substr(1); |
|
var min = $.parser.parseValue("min" + p1, _29["min" + p1], _28); |
|
var max = $.parser.parseValue("max" + p1, _29["max" + p1], _28); |
|
var val = $.parser.parseValue(p, _29[p], _28); |
|
var _2a = (String(_29[p] || "").indexOf("%") >= 0 ? true : false); |
|
if (!isNaN(val)) { |
|
var v = Math.min(Math.max(val, min || 0), max || 99999); |
|
if (!_2a) { |
|
_29[p] = v; |
|
} |
|
t._size("min" + p1, ""); |
|
t._size("max" + p1, ""); |
|
t._size(p, v); |
|
} else { |
|
t._size(p, ""); |
|
t._size("min" + p1, min); |
|
t._size("max" + p1, max); |
|
} |
|
return _2a || _29.fit; |
|
}; |
|
function _21(_2b, _2c, _2d) { |
|
var t = $(_2b); |
|
if (_2d == undefined) { |
|
_2d = parseInt(_2b.style[_2c]); |
|
if (isNaN(_2d)) { |
|
return undefined; |
|
} |
|
if ($._boxModel) { |
|
_2d += _2e(); |
|
} |
|
return _2d; |
|
} else { |
|
if (_2d === "") { |
|
t.css(_2c, ""); |
|
} else { |
|
if ($._boxModel) { |
|
_2d -= _2e(); |
|
if (_2d < 0) { |
|
_2d = 0; |
|
} |
|
} |
|
t.css(_2c, _2d + "px"); |
|
} |
|
} |
|
function _2e() { |
|
if (_2c.toLowerCase().indexOf("width") >= 0) { |
|
return t.outerWidth() - t.width(); |
|
} else { |
|
return t.outerHeight() - t.height(); |
|
} |
|
}; |
|
}; |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
var _2f = null; |
|
var _30 = null; |
|
var _31 = false; |
|
function _32(e) { |
|
if (e.touches.length != 1) { |
|
return; |
|
} |
|
if (!_31) { |
|
_31 = true; |
|
dblClickTimer = setTimeout(function () { |
|
_31 = false; |
|
}, 500); |
|
} else { |
|
clearTimeout(dblClickTimer); |
|
_31 = false; |
|
_33(e, "dblclick"); |
|
} |
|
_2f = setTimeout(function () { |
|
_33(e, "contextmenu", 3); |
|
}, 1000); |
|
_33(e, "mousedown"); |
|
if ($.fn.draggable.isDragging || $.fn.resizable.isResizing) { |
|
e.preventDefault(); |
|
} |
|
}; |
|
function _34(e) { |
|
if (e.touches.length != 1) { |
|
return; |
|
} |
|
if (_2f) { |
|
clearTimeout(_2f); |
|
} |
|
_33(e, "mousemove"); |
|
if ($.fn.draggable.isDragging || $.fn.resizable.isResizing) { |
|
e.preventDefault(); |
|
} |
|
}; |
|
function _35(e) { |
|
if (_2f) { |
|
clearTimeout(_2f); |
|
} |
|
_33(e, "mouseup"); |
|
if ($.fn.draggable.isDragging || $.fn.resizable.isResizing) { |
|
e.preventDefault(); |
|
} |
|
}; |
|
function _33(e, _36, _37) { |
|
var _38 = new $.Event(_36); |
|
_38.pageX = e.changedTouches[0].pageX; |
|
_38.pageY = e.changedTouches[0].pageY; |
|
_38.which = _37 || 1; |
|
$(e.target).trigger(_38); |
|
}; |
|
if (document.addEventListener) { |
|
document.addEventListener("touchstart", _32, true); |
|
document.addEventListener("touchmove", _34, true); |
|
document.addEventListener("touchend", _35, true); |
|
} |
|
})(jQuery); |
|
(function ($) { |
|
function _39(e) { |
|
var _3a = $.data(e.data.target, "draggable"); |
|
var _3b = _3a.options; |
|
var _3c = _3a.proxy; |
|
var _3d = e.data; |
|
var _3e = _3d.startLeft + e.pageX - _3d.startX; |
|
var top = _3d.startTop + e.pageY - _3d.startY; |
|
if (_3c) { |
|
if (_3c.parent()[0] == document.body) { |
|
if (_3b.deltaX != null && _3b.deltaX != undefined) { |
|
_3e = e.pageX + _3b.deltaX; |
|
} else { |
|
_3e = e.pageX - e.data.offsetWidth; |
|
} |
|
if (_3b.deltaY != null && _3b.deltaY != undefined) { |
|
top = e.pageY + _3b.deltaY; |
|
} else { |
|
top = e.pageY - e.data.offsetHeight; |
|
} |
|
} else { |
|
if (_3b.deltaX != null && _3b.deltaX != undefined) { |
|
_3e += e.data.offsetWidth + _3b.deltaX; |
|
} |
|
if (_3b.deltaY != null && _3b.deltaY != undefined) { |
|
top += e.data.offsetHeight + _3b.deltaY; |
|
} |
|
} |
|
} |
|
if (e.data.parent != document.body) { |
|
_3e += $(e.data.parent).scrollLeft(); |
|
top += $(e.data.parent).scrollTop(); |
|
} |
|
if (_3b.axis == "h") { |
|
_3d.left = _3e; |
|
} else { |
|
if (_3b.axis == "v") { |
|
_3d.top = top; |
|
} else { |
|
_3d.left = _3e; |
|
_3d.top = top; |
|
} |
|
} |
|
}; |
|
function _3f(e) { |
|
var _40 = $.data(e.data.target, "draggable"); |
|
var _41 = _40.options; |
|
var _42 = _40.proxy; |
|
if (!_42) { |
|
_42 = $(e.data.target); |
|
} |
|
_42.css({ |
|
left: e.data.left, |
|
top: e.data.top |
|
}); |
|
$("body").css("cursor", _41.cursor); |
|
}; |
|
function _43(e) { |
|
if (!$.fn.draggable.isDragging) { |
|
return false; |
|
} |
|
var _44 = $.data(e.data.target, "draggable"); |
|
var _45 = _44.options; |
|
var _46 = $(".droppable:visible").filter(function () { |
|
return e.data.target != this; |
|
}).filter(function () { |
|
var _47 = $.data(this, "droppable").options.accept; |
|
if (_47) { |
|
return $(_47).filter(function () { |
|
return this == e.data.target; |
|
}).length > 0; |
|
} else { |
|
return true; |
|
} |
|
}); |
|
_44.droppables = _46; |
|
var _48 = _44.proxy; |
|
if (!_48) { |
|
if (_45.proxy) { |
|
if (_45.proxy == "clone") { |
|
_48 = $(e.data.target).clone().insertAfter(e.data.target); |
|
} else { |
|
_48 = _45.proxy.call(e.data.target, e.data.target); |
|
} |
|
_44.proxy = _48; |
|
} else { |
|
_48 = $(e.data.target); |
|
} |
|
} |
|
_48.css("position", "absolute"); |
|
_39(e); |
|
_3f(e); |
|
_45.onStartDrag.call(e.data.target, e); |
|
return false; |
|
}; |
|
function _49(e) { |
|
if (!$.fn.draggable.isDragging) { |
|
return false; |
|
} |
|
var _4a = $.data(e.data.target, "draggable"); |
|
_39(e); |
|
if (_4a.options.onDrag.call(e.data.target, e) != false) { |
|
_3f(e); |
|
} |
|
var _4b = e.data.target; |
|
_4a.droppables.each(function () { |
|
var _4c = $(this); |
|
if (_4c.droppable("options").disabled) { |
|
return; |
|
} |
|
var p2 = _4c.offset(); |
|
if (e.pageX > p2.left && e.pageX < p2.left + _4c.outerWidth() && e.pageY > p2.top && e.pageY < p2.top + _4c.outerHeight()) { |
|
if (!this.entered) { |
|
$(this).trigger("_dragenter", [_4b]); |
|
this.entered = true; |
|
} |
|
$(this).trigger("_dragover", [_4b]); |
|
} else { |
|
if (this.entered) { |
|
$(this).trigger("_dragleave", [_4b]); |
|
this.entered = false; |
|
} |
|
} |
|
}); |
|
return false; |
|
}; |
|
function _4d(e) { |
|
if (!$.fn.draggable.isDragging) { |
|
_4e(); |
|
return false; |
|
} |
|
_49(e); |
|
var _4f = $.data(e.data.target, "draggable"); |
|
var _50 = _4f.proxy; |
|
var _51 = _4f.options; |
|
_51.onEndDrag.call(e.data.target, e); |
|
if (_51.revert) { |
|
if (_52() == true) { |
|
$(e.data.target).css({ |
|
position: e.data.startPosition, |
|
left: e.data.startLeft, |
|
top: e.data.startTop |
|
}); |
|
} else { |
|
if (_50) { |
|
var _53, |
|
top; |
|
if (_50.parent()[0] == document.body) { |
|
_53 = e.data.startX - e.data.offsetWidth; |
|
top = e.data.startY - e.data.offsetHeight; |
|
} else { |
|
_53 = e.data.startLeft; |
|
top = e.data.startTop; |
|
} |
|
_50.animate({ |
|
left: _53, |
|
top: top |
|
}, function () { |
|
_54(); |
|
}); |
|
} else { |
|
$(e.data.target).animate({ |
|
left: e.data.startLeft, |
|
top: e.data.startTop |
|
}, function () { |
|
$(e.data.target).css("position", e.data.startPosition); |
|
}); |
|
} |
|
} |
|
} else { |
|
$(e.data.target).css({ |
|
position: "absolute", |
|
left: e.data.left, |
|
top: e.data.top |
|
}); |
|
_52(); |
|
} |
|
_51.onStopDrag.call(e.data.target, e); |
|
_4e(); |
|
function _54() { |
|
if (_50) { |
|
_50.remove(); |
|
} |
|
_4f.proxy = null; |
|
}; |
|
function _52() { |
|
var _55 = false; |
|
_4f.droppables.each(function () { |
|
var _56 = $(this); |
|
if (_56.droppable("options").disabled) { |
|
return; |
|
} |
|
var p2 = _56.offset(); |
|
if (e.pageX > p2.left && e.pageX < p2.left + _56.outerWidth() && e.pageY > p2.top && e.pageY < p2.top + _56.outerHeight()) { |
|
if (_51.revert) { |
|
$(e.data.target).css({ |
|
position: e.data.startPosition, |
|
left: e.data.startLeft, |
|
top: e.data.startTop |
|
}); |
|
} |
|
$(this).triggerHandler("_drop", [e.data.target]); |
|
_54(); |
|
_55 = true; |
|
this.entered = false; |
|
return false; |
|
} |
|
}); |
|
if (!_55 && !_51.revert) { |
|
_54(); |
|
} |
|
return _55; |
|
}; |
|
return false; |
|
}; |
|
function _4e() { |
|
if ($.fn.draggable.timer) { |
|
clearTimeout($.fn.draggable.timer); |
|
$.fn.draggable.timer = undefined; |
|
} |
|
$(document)._unbind(".draggable"); |
|
$.fn.draggable.isDragging = false; |
|
setTimeout(function () { |
|
$("body").css("cursor", ""); |
|
}, 100); |
|
}; |
|
$.fn.draggable = function (_57, _58) { |
|
if (typeof _57 == "string") { |
|
return $.fn.draggable.methods[_57](this, _58); |
|
} |
|
return this.each(function () { |
|
var _59; |
|
var _5a = $.data(this, "draggable"); |
|
if (_5a) { |
|
_5a.handle._unbind(".draggable"); |
|
_59 = $.extend(_5a.options, _57); |
|
} else { |
|
_59 = $.extend({}, $.fn.draggable.defaults, $.fn.draggable.parseOptions(this), _57 || {}); |
|
} |
|
var _5b = _59.handle ? (typeof _59.handle == "string" ? $(_59.handle, this) : _59.handle) : $(this); |
|
$.data(this, "draggable", { |
|
options: _59, |
|
handle: _5b |
|
}); |
|
if (_59.disabled) { |
|
$(this).css("cursor", ""); |
|
return; |
|
} |
|
_5b._unbind(".draggable")._bind("mousemove.draggable", { |
|
target: this |
|
}, function (e) { |
|
if ($.fn.draggable.isDragging) { |
|
return; |
|
} |
|
var _5c = $.data(e.data.target, "draggable").options; |
|
if (_5d(e)) { |
|
$(this).css("cursor", _5c.cursor); |
|
} else { |
|
$(this).css("cursor", ""); |
|
} |
|
})._bind("mouseleave.draggable", { |
|
target: this |
|
}, function (e) { |
|
$(this).css("cursor", ""); |
|
})._bind("mousedown.draggable", { |
|
target: this |
|
}, function (e) { |
|
if (_5d(e) == false) { |
|
return; |
|
} |
|
$(this).css("cursor", ""); |
|
var _5e = $(e.data.target).position(); |
|
var _5f = $(e.data.target).offset(); |
|
var _60 = { |
|
startPosition: $(e.data.target).css("position"), |
|
startLeft: _5e.left, |
|
startTop: _5e.top, |
|
left: _5e.left, |
|
top: _5e.top, |
|
startX: e.pageX, |
|
startY: e.pageY, |
|
width: $(e.data.target).outerWidth(), |
|
height: $(e.data.target).outerHeight(), |
|
offsetWidth: (e.pageX - _5f.left), |
|
offsetHeight: (e.pageY - _5f.top), |
|
target: e.data.target, |
|
parent: $(e.data.target).parent()[0] |
|
}; |
|
$.extend(e.data, _60); |
|
var _61 = $.data(e.data.target, "draggable").options; |
|
if (_61.onBeforeDrag.call(e.data.target, e) == false) { |
|
return; |
|
} |
|
$(document)._bind("mousedown.draggable", e.data, _43); |
|
$(document)._bind("mousemove.draggable", e.data, _49); |
|
$(document)._bind("mouseup.draggable", e.data, _4d); |
|
$.fn.draggable.timer = setTimeout(function () { |
|
$.fn.draggable.isDragging = true; |
|
_43(e); |
|
}, _61.delay); |
|
return false; |
|
}); |
|
function _5d(e) { |
|
var _62 = $.data(e.data.target, "draggable"); |
|
var _63 = _62.handle; |
|
var _64 = $(_63).offset(); |
|
var _65 = $(_63).outerWidth(); |
|
var _66 = $(_63).outerHeight(); |
|
var t = e.pageY - _64.top; |
|
var r = _64.left + _65 - e.pageX; |
|
var b = _64.top + _66 - e.pageY; |
|
var l = e.pageX - _64.left; |
|
return Math.min(t, r, b, l) > _62.options.edge; |
|
}; |
|
}); |
|
}; |
|
$.fn.draggable.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "draggable").options; |
|
}, |
|
proxy: function (jq) { |
|
return $.data(jq[0], "draggable").proxy; |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
$(this).draggable({ |
|
disabled: false |
|
}); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
$(this).draggable({ |
|
disabled: true |
|
}); |
|
}); |
|
} |
|
}; |
|
$.fn.draggable.parseOptions = function (_67) { |
|
var t = $(_67); |
|
return $.extend({}, $.parser.parseOptions(_67, ["cursor", "handle", "axis", { |
|
"revert": "boolean", |
|
"deltaX": "number", |
|
"deltaY": "number", |
|
"edge": "number", |
|
"delay": "number" |
|
} |
|
]), { |
|
disabled: (t.attr("disabled") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.draggable.defaults = { |
|
proxy: null, |
|
revert: false, |
|
cursor: "move", |
|
deltaX: null, |
|
deltaY: null, |
|
handle: null, |
|
disabled: false, |
|
edge: 0, |
|
axis: null, |
|
delay: 100, |
|
onBeforeDrag: function (e) {}, |
|
onStartDrag: function (e) {}, |
|
onDrag: function (e) {}, |
|
onEndDrag: function (e) {}, |
|
onStopDrag: function (e) {} |
|
}; |
|
$.fn.draggable.isDragging = false; |
|
})(jQuery); |
|
(function ($) { |
|
function _68(_69) { |
|
$(_69).addClass("droppable"); |
|
$(_69)._bind("_dragenter", function (e, _6a) { |
|
$.data(_69, "droppable").options.onDragEnter.apply(_69, [e, _6a]); |
|
}); |
|
$(_69)._bind("_dragleave", function (e, _6b) { |
|
$.data(_69, "droppable").options.onDragLeave.apply(_69, [e, _6b]); |
|
}); |
|
$(_69)._bind("_dragover", function (e, _6c) { |
|
$.data(_69, "droppable").options.onDragOver.apply(_69, [e, _6c]); |
|
}); |
|
$(_69)._bind("_drop", function (e, _6d) { |
|
$.data(_69, "droppable").options.onDrop.apply(_69, [e, _6d]); |
|
}); |
|
}; |
|
$.fn.droppable = function (_6e, _6f) { |
|
if (typeof _6e == "string") { |
|
return $.fn.droppable.methods[_6e](this, _6f); |
|
} |
|
_6e = _6e || {}; |
|
return this.each(function () { |
|
var _70 = $.data(this, "droppable"); |
|
if (_70) { |
|
$.extend(_70.options, _6e); |
|
} else { |
|
_68(this); |
|
$.data(this, "droppable", { |
|
options: $.extend({}, $.fn.droppable.defaults, $.fn.droppable.parseOptions(this), _6e) |
|
}); |
|
} |
|
}); |
|
}; |
|
$.fn.droppable.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "droppable").options; |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
$(this).droppable({ |
|
disabled: false |
|
}); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
$(this).droppable({ |
|
disabled: true |
|
}); |
|
}); |
|
} |
|
}; |
|
$.fn.droppable.parseOptions = function (_71) { |
|
var t = $(_71); |
|
return $.extend({}, $.parser.parseOptions(_71, ["accept"]), { |
|
disabled: (t.attr("disabled") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.droppable.defaults = { |
|
accept: null, |
|
disabled: false, |
|
onDragEnter: function (e, _72) {}, |
|
onDragOver: function (e, _73) {}, |
|
onDragLeave: function (e, _74) {}, |
|
onDrop: function (e, _75) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function _76(e) { |
|
var _77 = e.data; |
|
var _78 = $.data(_77.target, "resizable").options; |
|
if (_77.dir.indexOf("e") != -1) { |
|
var _79 = _77.startWidth + e.pageX - _77.startX; |
|
_79 = Math.min(Math.max(_79, _78.minWidth), _78.maxWidth); |
|
_77.width = _79; |
|
} |
|
if (_77.dir.indexOf("s") != -1) { |
|
var _7a = _77.startHeight + e.pageY - _77.startY; |
|
_7a = Math.min(Math.max(_7a, _78.minHeight), _78.maxHeight); |
|
_77.height = _7a; |
|
} |
|
if (_77.dir.indexOf("w") != -1) { |
|
var _79 = _77.startWidth - e.pageX + _77.startX; |
|
_79 = Math.min(Math.max(_79, _78.minWidth), _78.maxWidth); |
|
_77.width = _79; |
|
_77.left = _77.startLeft + _77.startWidth - _77.width; |
|
} |
|
if (_77.dir.indexOf("n") != -1) { |
|
var _7a = _77.startHeight - e.pageY + _77.startY; |
|
_7a = Math.min(Math.max(_7a, _78.minHeight), _78.maxHeight); |
|
_77.height = _7a; |
|
_77.top = _77.startTop + _77.startHeight - _77.height; |
|
} |
|
}; |
|
function _7b(e) { |
|
var _7c = e.data; |
|
var t = $(_7c.target); |
|
t.css({ |
|
left: _7c.left, |
|
top: _7c.top |
|
}); |
|
if (t.outerWidth() != _7c.width) { |
|
t._outerWidth(_7c.width); |
|
} |
|
if (t.outerHeight() != _7c.height) { |
|
t._outerHeight(_7c.height); |
|
} |
|
}; |
|
function _7d(e) { |
|
$.fn.resizable.isResizing = true; |
|
$.data(e.data.target, "resizable").options.onStartResize.call(e.data.target, e); |
|
return false; |
|
}; |
|
function _7e(e) { |
|
_76(e); |
|
if ($.data(e.data.target, "resizable").options.onResize.call(e.data.target, e) != false) { |
|
_7b(e); |
|
} |
|
return false; |
|
}; |
|
function _7f(e) { |
|
$.fn.resizable.isResizing = false; |
|
_76(e, true); |
|
_7b(e); |
|
$.data(e.data.target, "resizable").options.onStopResize.call(e.data.target, e); |
|
$(document)._unbind(".resizable"); |
|
$("body").css("cursor", ""); |
|
return false; |
|
}; |
|
function _80(e) { |
|
var _81 = $(e.data.target).resizable("options"); |
|
var tt = $(e.data.target); |
|
var dir = ""; |
|
var _82 = tt.offset(); |
|
var _83 = tt.outerWidth(); |
|
var _84 = tt.outerHeight(); |
|
var _85 = _81.edge; |
|
if (e.pageY > _82.top && e.pageY < _82.top + _85) { |
|
dir += "n"; |
|
} else { |
|
if (e.pageY < _82.top + _84 && e.pageY > _82.top + _84 - _85) { |
|
dir += "s"; |
|
} |
|
} |
|
if (e.pageX > _82.left && e.pageX < _82.left + _85) { |
|
dir += "w"; |
|
} else { |
|
if (e.pageX < _82.left + _83 && e.pageX > _82.left + _83 - _85) { |
|
dir += "e"; |
|
} |
|
} |
|
var _86 = _81.handles.split(","); |
|
_86 = $.map(_86, function (h) { |
|
return $.trim(h).toLowerCase(); |
|
}); |
|
if ($.inArray("all", _86) >= 0 || $.inArray(dir, _86) >= 0) { |
|
return dir; |
|
} |
|
for (var i = 0; i < dir.length; i++) { |
|
var _87 = $.inArray(dir.substr(i, 1), _86); |
|
if (_87 >= 0) { |
|
return _86[_87]; |
|
} |
|
} |
|
return ""; |
|
}; |
|
$.fn.resizable = function (_88, _89) { |
|
if (typeof _88 == "string") { |
|
return $.fn.resizable.methods[_88](this, _89); |
|
} |
|
return this.each(function () { |
|
var _8a = null; |
|
var _8b = $.data(this, "resizable"); |
|
if (_8b) { |
|
$(this)._unbind(".resizable"); |
|
_8a = $.extend(_8b.options, _88 || {}); |
|
} else { |
|
_8a = $.extend({}, $.fn.resizable.defaults, $.fn.resizable.parseOptions(this), _88 || {}); |
|
$.data(this, "resizable", { |
|
options: _8a |
|
}); |
|
} |
|
if (_8a.disabled == true) { |
|
return; |
|
} |
|
$(this)._bind("mousemove.resizable", { |
|
target: this |
|
}, function (e) { |
|
if ($.fn.resizable.isResizing) { |
|
return; |
|
} |
|
var dir = _80(e); |
|
$(e.data.target).css("cursor", dir ? dir + "-resize" : ""); |
|
})._bind("mouseleave.resizable", { |
|
target: this |
|
}, function (e) { |
|
$(e.data.target).css("cursor", ""); |
|
})._bind("mousedown.resizable", { |
|
target: this |
|
}, function (e) { |
|
var dir = _80(e); |
|
if (dir == "") { |
|
return; |
|
} |
|
function _8c(css) { |
|
var val = parseInt($(e.data.target).css(css)); |
|
if (isNaN(val)) { |
|
return 0; |
|
} else { |
|
return val; |
|
} |
|
}; |
|
var _8d = { |
|
target: e.data.target, |
|
dir: dir, |
|
startLeft: _8c("left"), |
|
startTop: _8c("top"), |
|
left: _8c("left"), |
|
top: _8c("top"), |
|
startX: e.pageX, |
|
startY: e.pageY, |
|
startWidth: $(e.data.target).outerWidth(), |
|
startHeight: $(e.data.target).outerHeight(), |
|
width: $(e.data.target).outerWidth(), |
|
height: $(e.data.target).outerHeight(), |
|
deltaWidth: $(e.data.target).outerWidth() - $(e.data.target).width(), |
|
deltaHeight: $(e.data.target).outerHeight() - $(e.data.target).height() |
|
}; |
|
$(document)._bind("mousedown.resizable", _8d, _7d); |
|
$(document)._bind("mousemove.resizable", _8d, _7e); |
|
$(document)._bind("mouseup.resizable", _8d, _7f); |
|
$("body").css("cursor", dir + "-resize"); |
|
}); |
|
}); |
|
}; |
|
$.fn.resizable.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "resizable").options; |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
$(this).resizable({ |
|
disabled: false |
|
}); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
$(this).resizable({ |
|
disabled: true |
|
}); |
|
}); |
|
} |
|
}; |
|
$.fn.resizable.parseOptions = function (_8e) { |
|
var t = $(_8e); |
|
return $.extend({}, $.parser.parseOptions(_8e, ["handles", { |
|
minWidth: "number", |
|
minHeight: "number", |
|
maxWidth: "number", |
|
maxHeight: "number", |
|
edge: "number" |
|
} |
|
]), { |
|
disabled: (t.attr("disabled") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.resizable.defaults = { |
|
disabled: false, |
|
handles: "n, e, s, w, ne, se, sw, nw, all", |
|
minWidth: 10, |
|
minHeight: 10, |
|
maxWidth: 10000, |
|
maxHeight: 10000, |
|
edge: 5, |
|
onStartResize: function (e) {}, |
|
onResize: function (e) {}, |
|
onStopResize: function (e) {} |
|
}; |
|
$.fn.resizable.isResizing = false; |
|
})(jQuery); |
|
(function ($) { |
|
function _8f(_90, _91) { |
|
var _92 = $.data(_90, "linkbutton").options; |
|
if (_91) { |
|
$.extend(_92, _91); |
|
} |
|
if (_92.width || _92.height || _92.fit) { |
|
var btn = $(_90); |
|
var _93 = btn.parent(); |
|
var _94 = btn.is(":visible"); |
|
if (!_94) { |
|
var _95 = $("<div style=\"display:none\"></div>").insertBefore(_90); |
|
var _96 = { |
|
position: btn.css("position"), |
|
display: btn.css("display"), |
|
left: btn.css("left") |
|
}; |
|
btn.appendTo("body"); |
|
btn.css({ |
|
position: "absolute", |
|
display: "inline-block", |
|
left: -20000 |
|
}); |
|
} |
|
btn._size(_92, _93); |
|
var _97 = btn.find(".l-btn-left"); |
|
_97.css("margin-top", 0); |
|
_97.css("margin-top", parseInt((btn.height() - _97.height()) / 2) + "px"); |
|
if (!_94) { |
|
btn.insertAfter(_95); |
|
btn.css(_96); |
|
_95.remove(); |
|
} |
|
} |
|
}; |
|
function _98(_99) { |
|
var _9a = $.data(_99, "linkbutton").options; |
|
var t = $(_99).empty(); |
|
t.addClass("l-btn").removeClass("l-btn-plain l-btn-selected l-btn-plain-selected l-btn-outline"); |
|
t.removeClass("l-btn-small l-btn-medium l-btn-large").addClass("l-btn-" + _9a.size); |
|
if (_9a.plain) { |
|
t.addClass("l-btn-plain"); |
|
} |
|
if (_9a.outline) { |
|
t.addClass("l-btn-outline"); |
|
} |
|
if (_9a.selected) { |
|
t.addClass(_9a.plain ? "l-btn-selected l-btn-plain-selected" : "l-btn-selected"); |
|
} |
|
t.attr("group", _9a.group || ""); |
|
t.attr("id", _9a.id || ""); |
|
var _9b = $("<span class=\"l-btn-left\"></span>").appendTo(t); |
|
if (_9a.text) { |
|
$("<span class=\"l-btn-text\"></span>").html(_9a.text).appendTo(_9b); |
|
} else { |
|
$("<span class=\"l-btn-text l-btn-empty\"> </span>").appendTo(_9b); |
|
} |
|
if (_9a.iconCls) { |
|
$("<span class=\"l-btn-icon\"> </span>").addClass(_9a.iconCls).appendTo(_9b); |
|
_9b.addClass("l-btn-icon-" + _9a.iconAlign); |
|
} |
|
t._unbind(".linkbutton")._bind("focus.linkbutton", function () { |
|
if (!_9a.disabled) { |
|
$(this).addClass("l-btn-focus"); |
|
} |
|
})._bind("blur.linkbutton", function () { |
|
$(this).removeClass("l-btn-focus"); |
|
})._bind("click.linkbutton", function () { |
|
if (!_9a.disabled) { |
|
if (_9a.toggle) { |
|
if (_9a.selected) { |
|
$(this).linkbutton("unselect"); |
|
} else { |
|
$(this).linkbutton("select"); |
|
} |
|
} |
|
_9a.onClick.call(this); |
|
} |
|
}); |
|
_9c(_99, _9a.selected); |
|
_9d(_99, _9a.disabled); |
|
}; |
|
function _9c(_9e, _9f) { |
|
var _a0 = $.data(_9e, "linkbutton").options; |
|
if (_9f) { |
|
if (_a0.group) { |
|
$("a.l-btn[group=\"" + _a0.group + "\"]").each(function () { |
|
var o = $(this).linkbutton("options"); |
|
if (o.toggle) { |
|
$(this).removeClass("l-btn-selected l-btn-plain-selected"); |
|
o.selected = false; |
|
} |
|
}); |
|
} |
|
$(_9e).addClass(_a0.plain ? "l-btn-selected l-btn-plain-selected" : "l-btn-selected"); |
|
_a0.selected = true; |
|
} else { |
|
if (!_a0.group) { |
|
$(_9e).removeClass("l-btn-selected l-btn-plain-selected"); |
|
_a0.selected = false; |
|
} |
|
} |
|
}; |
|
function _9d(_a1, _a2) { |
|
var _a3 = $.data(_a1, "linkbutton"); |
|
var _a4 = _a3.options; |
|
$(_a1).removeClass("l-btn-disabled l-btn-plain-disabled"); |
|
if (_a2) { |
|
_a4.disabled = true; |
|
var _a5 = $(_a1).attr("href"); |
|
if (_a5) { |
|
_a3.href = _a5; |
|
$(_a1).attr("href", "javascript:;"); |
|
} |
|
if (_a1.onclick) { |
|
_a3.onclick = _a1.onclick; |
|
_a1.onclick = null; |
|
} |
|
_a4.plain ? $(_a1).addClass("l-btn-disabled l-btn-plain-disabled") : $(_a1).addClass("l-btn-disabled"); |
|
} else { |
|
_a4.disabled = false; |
|
if (_a3.href) { |
|
$(_a1).attr("href", _a3.href); |
|
} |
|
if (_a3.onclick) { |
|
_a1.onclick = _a3.onclick; |
|
} |
|
} |
|
$(_a1)._propAttr("disabled", _a2); |
|
}; |
|
$.fn.linkbutton = function (_a6, _a7) { |
|
if (typeof _a6 == "string") { |
|
return $.fn.linkbutton.methods[_a6](this, _a7); |
|
} |
|
_a6 = _a6 || {}; |
|
return this.each(function () { |
|
var _a8 = $.data(this, "linkbutton"); |
|
if (_a8) { |
|
$.extend(_a8.options, _a6); |
|
} else { |
|
$.data(this, "linkbutton", { |
|
options: $.extend({}, $.fn.linkbutton.defaults, $.fn.linkbutton.parseOptions(this), _a6) |
|
}); |
|
$(this)._propAttr("disabled", false); |
|
$(this)._bind("_resize", function (e, _a9) { |
|
if ($(this).hasClass("easyui-fluid") || _a9) { |
|
_8f(this); |
|
} |
|
return false; |
|
}); |
|
} |
|
_98(this); |
|
_8f(this); |
|
}); |
|
}; |
|
$.fn.linkbutton.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "linkbutton").options; |
|
}, |
|
resize: function (jq, _aa) { |
|
return jq.each(function () { |
|
_8f(this, _aa); |
|
}); |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
_9d(this, false); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
_9d(this, true); |
|
}); |
|
}, |
|
select: function (jq) { |
|
return jq.each(function () { |
|
_9c(this, true); |
|
}); |
|
}, |
|
unselect: function (jq) { |
|
return jq.each(function () { |
|
_9c(this, false); |
|
}); |
|
} |
|
}; |
|
$.fn.linkbutton.parseOptions = function (_ab) { |
|
var t = $(_ab); |
|
return $.extend({}, $.parser.parseOptions(_ab, ["id", "iconCls", "iconAlign", "group", "size", "text", { |
|
plain: "boolean", |
|
toggle: "boolean", |
|
selected: "boolean", |
|
outline: "boolean" |
|
} |
|
]), { |
|
disabled: (t.attr("disabled") ? true : undefined), |
|
text: ($.trim(t.html()) || undefined), |
|
iconCls: (t.attr("icon") || t.attr("iconCls")) |
|
}); |
|
}; |
|
$.fn.linkbutton.defaults = { |
|
id: null, |
|
disabled: false, |
|
toggle: false, |
|
selected: false, |
|
outline: false, |
|
group: null, |
|
plain: false, |
|
text: "", |
|
iconCls: null, |
|
iconAlign: "left", |
|
size: "small", |
|
onClick: function () {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function _ac(_ad) { |
|
var _ae = $.data(_ad, "pagination"); |
|
var _af = _ae.options; |
|
var bb = _ae.bb = {}; |
|
if (_af.buttons && !$.isArray(_af.buttons)) { |
|
$(_af.buttons).insertAfter(_ad); |
|
} |
|
var _b0 = $(_ad).addClass("pagination").html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr></tr></table>"); |
|
var tr = _b0.find("tr"); |
|
var aa = $.extend([], _af.layout); |
|
if (!_af.showPageList) { |
|
_b1(aa, "list"); |
|
} |
|
if (!_af.showPageInfo) { |
|
_b1(aa, "info"); |
|
} |
|
if (!_af.showRefresh) { |
|
_b1(aa, "refresh"); |
|
} |
|
if (aa[0] == "sep") { |
|
aa.shift(); |
|
} |
|
if (aa[aa.length - 1] == "sep") { |
|
aa.pop(); |
|
} |
|
for (var _b2 = 0; _b2 < aa.length; _b2++) { |
|
var _b3 = aa[_b2]; |
|
if (_b3 == "list") { |
|
var ps = $("<select class=\"pagination-page-list\"></select>"); |
|
ps._bind("change", function () { |
|
_af.pageSize = parseInt($(this).val()); |
|
_af.onChangePageSize.call(_ad, _af.pageSize); |
|
_b9(_ad, _af.pageNumber); |
|
}); |
|
for (var i = 0; i < _af.pageList.length; i++) { |
|
$("<option></option>").text(_af.pageList[i]).appendTo(ps); |
|
} |
|
$("<td></td>").append(ps).appendTo(tr); |
|
} else { |
|
if (_b3 == "sep") { |
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr); |
|
} else { |
|
if (_b3 == "first") { |
|
bb.first = _b4("first"); |
|
} else { |
|
if (_b3 == "prev") { |
|
bb.prev = _b4("prev"); |
|
} else { |
|
if (_b3 == "next") { |
|
bb.next = _b4("next"); |
|
} else { |
|
if (_b3 == "last") { |
|
bb.last = _b4("last"); |
|
} else { |
|
if (_b3 == "manual") { |
|
$("<span style=\"padding-left:6px;\"></span>").html(_af.beforePageText).appendTo(tr).wrap("<td></td>"); |
|
bb.num = $("<input class=\"pagination-num\" type=\"text\" value=\"1\" size=\"2\">").appendTo(tr).wrap("<td></td>"); |
|
bb.num._unbind(".pagination")._bind("keydown.pagination", function (e) { |
|
if (e.keyCode == 13) { |
|
var _b5 = parseInt($(this).val()) || 1; |
|
_b9(_ad, _b5); |
|
return false; |
|
} |
|
}); |
|
bb.after = $("<span style=\"padding-right:6px;\"></span>").appendTo(tr).wrap("<td></td>"); |
|
} else { |
|
if (_b3 == "refresh") { |
|
bb.refresh = _b4("refresh"); |
|
} else { |
|
if (_b3 == "links") { |
|
$("<td class=\"pagination-links\"></td>").appendTo(tr); |
|
} else { |
|
if (_b3 == "info") { |
|
if (_b2 == aa.length - 1) { |
|
$("<div class=\"pagination-info\"></div>").appendTo(_b0); |
|
} else { |
|
$("<td><div class=\"pagination-info\"></div></td>").appendTo(tr); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (_af.buttons) { |
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr); |
|
if ($.isArray(_af.buttons)) { |
|
for (var i = 0; i < _af.buttons.length; i++) { |
|
var btn = _af.buttons[i]; |
|
if (btn == "-") { |
|
$("<td><div class=\"pagination-btn-separator\"></div></td>").appendTo(tr); |
|
} else { |
|
var td = $("<td></td>").appendTo(tr); |
|
var a = $("<a href=\"javascript:;\"></a>").appendTo(td); |
|
a[0].onclick = eval(btn.handler || function () {}); |
|
a.linkbutton($.extend({}, btn, { |
|
plain: true |
|
})); |
|
} |
|
} |
|
} else { |
|
var td = $("<td></td>").appendTo(tr); |
|
$(_af.buttons).appendTo(td).show(); |
|
} |
|
} |
|
$("<div style=\"clear:both;\"></div>").appendTo(_b0); |
|
function _b4(_b6) { |
|
var btn = _af.nav[_b6]; |
|
var a = $("<a href=\"javascript:;\"></a>").appendTo(tr); |
|
a.wrap("<td></td>"); |
|
a.linkbutton({ |
|
iconCls: btn.iconCls, |
|
plain: true |
|
})._unbind(".pagination")._bind("click.pagination", function () { |
|
btn.handler.call(_ad); |
|
}); |
|
return a; |
|
}; |
|
function _b1(aa, _b7) { |
|
var _b8 = $.inArray(_b7, aa); |
|
if (_b8 >= 0) { |
|
aa.splice(_b8, 1); |
|
} |
|
return aa; |
|
}; |
|
}; |
|
function _b9(_ba, _bb) { |
|
var _bc = $.data(_ba, "pagination").options; |
|
if (_bc.onBeforeSelectPage.call(_ba, _bb, _bc.pageSize) == false) { |
|
_bd(_ba); |
|
return; |
|
} |
|
_bd(_ba, { |
|
pageNumber: _bb |
|
}); |
|
_bc.onSelectPage.call(_ba, _bc.pageNumber, _bc.pageSize); |
|
}; |
|
function _bd(_be, _bf) { |
|
var _c0 = $.data(_be, "pagination"); |
|
var _c1 = _c0.options; |
|
var bb = _c0.bb; |
|
$.extend(_c1, _bf || {}); |
|
var ps = $(_be).find("select.pagination-page-list"); |
|
if (ps.length) { |
|
ps.val(_c1.pageSize + ""); |
|
_c1.pageSize = parseInt(ps.val()); |
|
} |
|
var _c2 = Math.ceil(_c1.total / _c1.pageSize) || 1; |
|
if (_c1.pageNumber < 1) { |
|
_c1.pageNumber = 1; |
|
} |
|
if (_c1.pageNumber > _c2) { |
|
_c1.pageNumber = _c2; |
|
} |
|
if (_c1.total == 0) { |
|
_c1.pageNumber = 0; |
|
_c2 = 0; |
|
} |
|
if (bb.num) { |
|
bb.num.val(_c1.pageNumber); |
|
} |
|
if (bb.after) { |
|
bb.after.html(_c1.afterPageText.replace(/{pages}/, _c2)); |
|
} |
|
var td = $(_be).find("td.pagination-links"); |
|
if (td.length) { |
|
td.empty(); |
|
var _c3 = _c1.pageNumber - Math.floor(_c1.links / 2); |
|
if (_c3 < 1) { |
|
_c3 = 1; |
|
} |
|
var _c4 = _c3 + _c1.links - 1; |
|
if (_c4 > _c2) { |
|
_c4 = _c2; |
|
} |
|
_c3 = _c4 - _c1.links + 1; |
|
if (_c3 < 1) { |
|
_c3 = 1; |
|
} |
|
for (var i = _c3; i <= _c4; i++) { |
|
var a = $("<a class=\"pagination-link\" href=\"javascript:;\"></a>").appendTo(td); |
|
a.linkbutton({ |
|
plain: true, |
|
text: i |
|
}); |
|
if (i == _c1.pageNumber) { |
|
a.linkbutton("select"); |
|
} else { |
|
a._unbind(".pagination")._bind("click.pagination", { |
|
pageNumber: i |
|
}, function (e) { |
|
_b9(_be, e.data.pageNumber); |
|
}); |
|
} |
|
} |
|
} |
|
var _c5 = _c1.displayMsg; |
|
_c5 = _c5.replace(/{from}/, _c1.total == 0 ? 0 : _c1.pageSize * (_c1.pageNumber - 1) + 1); |
|
_c5 = _c5.replace(/{to}/, Math.min(_c1.pageSize * (_c1.pageNumber), _c1.total)); |
|
_c5 = _c5.replace(/{total}/, _c1.total); |
|
$(_be).find("div.pagination-info").html(_c5); |
|
if (bb.first) { |
|
bb.first.linkbutton({ |
|
disabled: ((!_c1.total) || _c1.pageNumber == 1) |
|
}); |
|
} |
|
if (bb.prev) { |
|
bb.prev.linkbutton({ |
|
disabled: ((!_c1.total) || _c1.pageNumber == 1) |
|
}); |
|
} |
|
if (bb.next) { |
|
bb.next.linkbutton({ |
|
disabled: (_c1.pageNumber == _c2) |
|
}); |
|
} |
|
if (bb.last) { |
|
bb.last.linkbutton({ |
|
disabled: (_c1.pageNumber == _c2) |
|
}); |
|
} |
|
_c6(_be, _c1.loading); |
|
}; |
|
function _c6(_c7, _c8) { |
|
var _c9 = $.data(_c7, "pagination"); |
|
var _ca = _c9.options; |
|
_ca.loading = _c8; |
|
if (_ca.showRefresh && _c9.bb.refresh) { |
|
_c9.bb.refresh.linkbutton({ |
|
iconCls: (_ca.loading ? "pagination-loading" : "pagination-load") |
|
}); |
|
} |
|
}; |
|
$.fn.pagination = function (_cb, _cc) { |
|
if (typeof _cb == "string") { |
|
return $.fn.pagination.methods[_cb](this, _cc); |
|
} |
|
_cb = _cb || {}; |
|
return this.each(function () { |
|
var _cd; |
|
var _ce = $.data(this, "pagination"); |
|
if (_ce) { |
|
_cd = $.extend(_ce.options, _cb); |
|
} else { |
|
_cd = $.extend({}, $.fn.pagination.defaults, $.fn.pagination.parseOptions(this), _cb); |
|
$.data(this, "pagination", { |
|
options: _cd |
|
}); |
|
} |
|
_ac(this); |
|
_bd(this); |
|
}); |
|
}; |
|
$.fn.pagination.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "pagination").options; |
|
}, |
|
loading: function (jq) { |
|
return jq.each(function () { |
|
_c6(this, true); |
|
}); |
|
}, |
|
loaded: function (jq) { |
|
return jq.each(function () { |
|
_c6(this, false); |
|
}); |
|
}, |
|
refresh: function (jq, _cf) { |
|
return jq.each(function () { |
|
_bd(this, _cf); |
|
}); |
|
}, |
|
select: function (jq, _d0) { |
|
return jq.each(function () { |
|
_b9(this, _d0); |
|
}); |
|
} |
|
}; |
|
$.fn.pagination.parseOptions = function (_d1) { |
|
var t = $(_d1); |
|
return $.extend({}, $.parser.parseOptions(_d1, [{ |
|
total: "number", |
|
pageSize: "number", |
|
pageNumber: "number", |
|
links: "number" |
|
}, { |
|
loading: "boolean", |
|
showPageList: "boolean", |
|
showPageInfo: "boolean", |
|
showRefresh: "boolean" |
|
} |
|
]), { |
|
pageList: (t.attr("pageList") ? eval(t.attr("pageList")) : undefined) |
|
}); |
|
}; |
|
$.fn.pagination.defaults = { |
|
total: 1, |
|
pageSize: 10, |
|
pageNumber: 1, |
|
pageList: [10, 20, 30, 50], |
|
loading: false, |
|
buttons: null, |
|
showPageList: true, |
|
showPageInfo: true, |
|
showRefresh: true, |
|
links: 10, |
|
layout: ["list", "sep", "first", "prev", "sep", "manual", "sep", "next", "last", "sep", "refresh", "info"], |
|
onBeforeSelectPage: function (_d2, _d3) {}, |
|
onSelectPage: function (_d4, _d5) {}, |
|
onBeforeRefresh: function (_d6, _d7) {}, |
|
onRefresh: function (_d8, _d9) {}, |
|
onChangePageSize: function (_da) {}, |
|
beforePageText: "Page", |
|
afterPageText: "of {pages}", |
|
displayMsg: "Displaying {from} to {to} of {total} items", |
|
nav: { |
|
first: { |
|
iconCls: "pagination-first", |
|
handler: function () { |
|
var _db = $(this).pagination("options"); |
|
if (_db.pageNumber > 1) { |
|
$(this).pagination("select", 1); |
|
} |
|
} |
|
}, |
|
prev: { |
|
iconCls: "pagination-prev", |
|
handler: function () { |
|
var _dc = $(this).pagination("options"); |
|
if (_dc.pageNumber > 1) { |
|
$(this).pagination("select", _dc.pageNumber - 1); |
|
} |
|
} |
|
}, |
|
next: { |
|
iconCls: "pagination-next", |
|
handler: function () { |
|
var _dd = $(this).pagination("options"); |
|
var _de = Math.ceil(_dd.total / _dd.pageSize); |
|
if (_dd.pageNumber < _de) { |
|
$(this).pagination("select", _dd.pageNumber + 1); |
|
} |
|
} |
|
}, |
|
last: { |
|
iconCls: "pagination-last", |
|
handler: function () { |
|
var _df = $(this).pagination("options"); |
|
var _e0 = Math.ceil(_df.total / _df.pageSize); |
|
if (_df.pageNumber < _e0) { |
|
$(this).pagination("select", _e0); |
|
} |
|
} |
|
}, |
|
refresh: { |
|
iconCls: "pagination-refresh", |
|
handler: function () { |
|
var _e1 = $(this).pagination("options"); |
|
if (_e1.onBeforeRefresh.call(this, _e1.pageNumber, _e1.pageSize) != false) { |
|
$(this).pagination("select", _e1.pageNumber); |
|
_e1.onRefresh.call(this, _e1.pageNumber, _e1.pageSize); |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function _e2(_e3) { |
|
var _e4 = $(_e3); |
|
_e4.addClass("tree"); |
|
return _e4; |
|
}; |
|
function _e5(_e6) { |
|
var _e7 = $.data(_e6, "tree").options; |
|
$(_e6)._unbind()._bind("mouseover", function (e) { |
|
var tt = $(e.target); |
|
var _e8 = tt.closest("div.tree-node"); |
|
if (!_e8.length) { |
|
return; |
|
} |
|
_e8.addClass("tree-node-hover"); |
|
if (tt.hasClass("tree-hit")) { |
|
if (tt.hasClass("tree-expanded")) { |
|
tt.addClass("tree-expanded-hover"); |
|
} else { |
|
tt.addClass("tree-collapsed-hover"); |
|
} |
|
} |
|
e.stopPropagation(); |
|
})._bind("mouseout", function (e) { |
|
var tt = $(e.target); |
|
var _e9 = tt.closest("div.tree-node"); |
|
if (!_e9.length) { |
|
return; |
|
} |
|
_e9.removeClass("tree-node-hover"); |
|
if (tt.hasClass("tree-hit")) { |
|
if (tt.hasClass("tree-expanded")) { |
|
tt.removeClass("tree-expanded-hover"); |
|
} else { |
|
tt.removeClass("tree-collapsed-hover"); |
|
} |
|
} |
|
e.stopPropagation(); |
|
})._bind("click", function (e) { |
|
var tt = $(e.target); |
|
var _ea = tt.closest("div.tree-node"); |
|
if (!_ea.length) { |
|
return; |
|
} |
|
if (tt.hasClass("tree-hit")) { |
|
_148(_e6, _ea[0]); |
|
return false; |
|
} else { |
|
if (tt.hasClass("tree-checkbox")) { |
|
_10f(_e6, _ea[0]); |
|
return false; |
|
} else { |
|
_18d(_e6, _ea[0]); |
|
_e7.onClick.call(_e6, _ed(_e6, _ea[0])); |
|
} |
|
} |
|
e.stopPropagation(); |
|
})._bind("dblclick", function (e) { |
|
var _eb = $(e.target).closest("div.tree-node"); |
|
if (!_eb.length) { |
|
return; |
|
} |
|
_18d(_e6, _eb[0]); |
|
_e7.onDblClick.call(_e6, _ed(_e6, _eb[0])); |
|
e.stopPropagation(); |
|
})._bind("contextmenu", function (e) { |
|
var _ec = $(e.target).closest("div.tree-node"); |
|
if (!_ec.length) { |
|
return; |
|
} |
|
_e7.onContextMenu.call(_e6, e, _ed(_e6, _ec[0])); |
|
e.stopPropagation(); |
|
}); |
|
}; |
|
function _ee(_ef) { |
|
var _f0 = $.data(_ef, "tree").options; |
|
_f0.dnd = false; |
|
var _f1 = $(_ef).find("div.tree-node"); |
|
_f1.draggable("disable"); |
|
_f1.css("cursor", "pointer"); |
|
}; |
|
function _f2(_f3) { |
|
var _f4 = $.data(_f3, "tree"); |
|
var _f5 = _f4.options; |
|
var _f6 = _f4.tree; |
|
_f4.disabledNodes = []; |
|
_f5.dnd = true; |
|
_f6.find("div.tree-node").draggable({ |
|
disabled: false, |
|
revert: true, |
|
cursor: "pointer", |
|
proxy: function (_f7) { |
|
var p = $("<div class=\"tree-node-proxy\"></div>").appendTo("body"); |
|
p.html("<span class=\"tree-dnd-icon tree-dnd-no\"> </span>" + $(_f7).find(".tree-title").html()); |
|
p.hide(); |
|
return p; |
|
}, |
|
deltaX: 15, |
|
deltaY: 15, |
|
onBeforeDrag: function (e) { |
|
if (_f5.onBeforeDrag.call(_f3, _ed(_f3, this)) == false) { |
|
return false; |
|
} |
|
if ($(e.target).hasClass("tree-hit") || $(e.target).hasClass("tree-checkbox")) { |
|
return false; |
|
} |
|
if (e.which != 1) { |
|
return false; |
|
} |
|
var _f8 = $(this).find("span.tree-indent"); |
|
if (_f8.length) { |
|
e.data.offsetWidth -= _f8.length * _f8.width(); |
|
} |
|
}, |
|
onStartDrag: function (e) { |
|
$(this).next("ul").find("div.tree-node").each(function () { |
|
$(this).droppable("disable"); |
|
_f4.disabledNodes.push(this); |
|
}); |
|
$(this).draggable("proxy").css({ |
|
left: -10000, |
|
top: -10000 |
|
}); |
|
_f5.onStartDrag.call(_f3, _ed(_f3, this)); |
|
var _f9 = _ed(_f3, this); |
|
if (_f9.id == undefined) { |
|
_f9.id = "easyui_tree_node_id_temp"; |
|
_12f(_f3, _f9); |
|
} |
|
_f4.draggingNodeId = _f9.id; |
|
}, |
|
onDrag: function (e) { |
|
var x1 = e.pageX, |
|
y1 = e.pageY, |
|
x2 = e.data.startX, |
|
y2 = e.data.startY; |
|
var d = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); |
|
if (d > 3) { |
|
$(this).draggable("proxy").show(); |
|
} |
|
this.pageY = e.pageY; |
|
}, |
|
onStopDrag: function () { |
|
for (var i = 0; i < _f4.disabledNodes.length; i++) { |
|
$(_f4.disabledNodes[i]).droppable("enable"); |
|
} |
|
_f4.disabledNodes = []; |
|
var _fa = _185(_f3, _f4.draggingNodeId); |
|
if (_fa && _fa.id == "easyui_tree_node_id_temp") { |
|
_fa.id = ""; |
|
_12f(_f3, _fa); |
|
} |
|
_f5.onStopDrag.call(_f3, _fa); |
|
} |
|
}).droppable({ |
|
accept: "div.tree-node", |
|
onDragEnter: function (e, _fb) { |
|
if (_f5.onDragEnter.call(_f3, this, _fc(_fb)) == false) { |
|
_fd(_fb, false); |
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); |
|
$(this).droppable("disable"); |
|
_f4.disabledNodes.push(this); |
|
} |
|
}, |
|
onDragOver: function (e, _fe) { |
|
if ($(this).droppable("options").disabled) { |
|
return; |
|
} |
|
var _ff = _fe.pageY; |
|
var top = $(this).offset().top; |
|
var _100 = top + $(this).outerHeight(); |
|
_fd(_fe, true); |
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); |
|
if (_ff > top + (_100 - top) / 2) { |
|
if (_100 - _ff < 5) { |
|
$(this).addClass("tree-node-bottom"); |
|
} else { |
|
$(this).addClass("tree-node-append"); |
|
} |
|
} else { |
|
if (_ff - top < 5) { |
|
$(this).addClass("tree-node-top"); |
|
} else { |
|
$(this).addClass("tree-node-append"); |
|
} |
|
} |
|
if (_f5.onDragOver.call(_f3, this, _fc(_fe)) == false) { |
|
_fd(_fe, false); |
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); |
|
$(this).droppable("disable"); |
|
_f4.disabledNodes.push(this); |
|
} |
|
}, |
|
onDragLeave: function (e, _101) { |
|
_fd(_101, false); |
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); |
|
_f5.onDragLeave.call(_f3, this, _fc(_101)); |
|
}, |
|
onDrop: function (e, _102) { |
|
var dest = this; |
|
var _103, |
|
_104; |
|
if ($(this).hasClass("tree-node-append")) { |
|
_103 = _105; |
|
_104 = "append"; |
|
} else { |
|
_103 = _106; |
|
_104 = $(this).hasClass("tree-node-top") ? "top" : "bottom"; |
|
} |
|
if (_f5.onBeforeDrop.call(_f3, dest, _fc(_102), _104) == false) { |
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); |
|
return; |
|
} |
|
_103(_102, dest, _104); |
|
$(this).removeClass("tree-node-append tree-node-top tree-node-bottom"); |
|
} |
|
}); |
|
function _fc(_107, pop) { |
|
return $(_107).closest("ul.tree").tree(pop ? "pop" : "getData", _107); |
|
}; |
|
function _fd(_108, _109) { |
|
var icon = $(_108).draggable("proxy").find("span.tree-dnd-icon"); |
|
icon.removeClass("tree-dnd-yes tree-dnd-no").addClass(_109 ? "tree-dnd-yes" : "tree-dnd-no"); |
|
}; |
|
function _105(_10a, dest) { |
|
if (_ed(_f3, dest).state == "closed") { |
|
_140(_f3, dest, function () { |
|
_10b(); |
|
}); |
|
} else { |
|
_10b(); |
|
} |
|
function _10b() { |
|
var node = _fc(_10a, true); |
|
$(_f3).tree("append", { |
|
parent: dest, |
|
data: [node] |
|
}); |
|
_f5.onDrop.call(_f3, dest, node, "append"); |
|
}; |
|
}; |
|
function _106(_10c, dest, _10d) { |
|
var _10e = {}; |
|
if (_10d == "top") { |
|
_10e.before = dest; |
|
} else { |
|
_10e.after = dest; |
|
} |
|
var node = _fc(_10c, true); |
|
_10e.data = node; |
|
$(_f3).tree("insert", _10e); |
|
_f5.onDrop.call(_f3, dest, node, _10d); |
|
}; |
|
}; |
|
function _10f(_110, _111, _112, _113) { |
|
var _114 = $.data(_110, "tree"); |
|
var opts = _114.options; |
|
if (!opts.checkbox) { |
|
return; |
|
} |
|
var _115 = _ed(_110, _111); |
|
if (!_115.checkState) { |
|
return; |
|
} |
|
var ck = $(_111).find(".tree-checkbox"); |
|
if (_112 == undefined) { |
|
if (ck.hasClass("tree-checkbox1")) { |
|
_112 = false; |
|
} else { |
|
if (ck.hasClass("tree-checkbox0")) { |
|
_112 = true; |
|
} else { |
|
if (_115._checked == undefined) { |
|
_115._checked = $(_111).find(".tree-checkbox").hasClass("tree-checkbox1"); |
|
} |
|
_112 = !_115._checked; |
|
} |
|
} |
|
} |
|
_115._checked = _112; |
|
if (_112) { |
|
if (ck.hasClass("tree-checkbox1")) { |
|
return; |
|
} |
|
} else { |
|
if (ck.hasClass("tree-checkbox0")) { |
|
return; |
|
} |
|
} |
|
if (!_113) { |
|
if (opts.onBeforeCheck.call(_110, _115, _112) == false) { |
|
return; |
|
} |
|
} |
|
if (opts.cascadeCheck) { |
|
_116(_110, _115, _112); |
|
_117(_110, _115); |
|
} else { |
|
_118(_110, _115, _112 ? "1" : "0"); |
|
} |
|
if (!_113) { |
|
opts.onCheck.call(_110, _115, _112); |
|
} |
|
}; |
|
function _116(_119, _11a, _11b) { |
|
var opts = $.data(_119, "tree").options; |
|
var flag = _11b ? 1 : 0; |
|
_118(_119, _11a, flag); |
|
if (opts.deepCheck) { |
|
$.easyui.forEach(_11a.children || [], true, function (n) { |
|
_118(_119, n, flag); |
|
}); |
|
} else { |
|
var _11c = []; |
|
if (_11a.children && _11a.children.length) { |
|
_11c.push(_11a); |
|
} |
|
$.easyui.forEach(_11a.children || [], true, function (n) { |
|
if (!n.hidden) { |
|
_118(_119, n, flag); |
|
if (n.children && n.children.length) { |
|
_11c.push(n); |
|
} |
|
} |
|
}); |
|
for (var i = _11c.length - 1; i >= 0; i--) { |
|
var node = _11c[i]; |
|
_118(_119, node, _11d(node)); |
|
} |
|
} |
|
}; |
|
function _118(_11e, _11f, flag) { |
|
var opts = $.data(_11e, "tree").options; |
|
if (!_11f.checkState || flag == undefined) { |
|
return; |
|
} |
|
if (_11f.hidden && !opts.deepCheck) { |
|
return; |
|
} |
|
var ck = $("#" + _11f.domId).find(".tree-checkbox"); |
|
_11f.checkState = ["unchecked", "checked", "indeterminate"][flag]; |
|
_11f.checked = (_11f.checkState == "checked"); |
|
ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2"); |
|
ck.addClass("tree-checkbox" + flag); |
|
}; |
|
function _117(_120, _121) { |
|
var pd = _122(_120, $("#" + _121.domId)[0]); |
|
if (pd) { |
|
_118(_120, pd, _11d(pd)); |
|
_117(_120, pd); |
|
} |
|
}; |
|
function _11d(row) { |
|
var c0 = 0; |
|
var c1 = 0; |
|
var len = 0; |
|
$.easyui.forEach(row.children || [], false, function (r) { |
|
if (r.checkState) { |
|
len++; |
|
if (r.checkState == "checked") { |
|
c1++; |
|
} else { |
|
if (r.checkState == "unchecked") { |
|
c0++; |
|
} |
|
} |
|
} |
|
}); |
|
if (len == 0) { |
|
return undefined; |
|
} |
|
var flag = 0; |
|
if (c0 == len) { |
|
flag = 0; |
|
} else { |
|
if (c1 == len) { |
|
flag = 1; |
|
} else { |
|
flag = 2; |
|
} |
|
} |
|
return flag; |
|
}; |
|
function _123(_124, _125) { |
|
var opts = $.data(_124, "tree").options; |
|
if (!opts.checkbox) { |
|
return; |
|
} |
|
var node = $(_125); |
|
var ck = node.find(".tree-checkbox"); |
|
var _126 = _ed(_124, _125); |
|
if (opts.view.hasCheckbox(_124, _126)) { |
|
if (!ck.length) { |
|
_126.checkState = _126.checkState || "unchecked"; |
|
$("<span class=\"tree-checkbox\"></span>").insertBefore(node.find(".tree-title")); |
|
} |
|
if (_126.checkState == "checked") { |
|
_10f(_124, _125, true, true); |
|
} else { |
|
if (_126.checkState == "unchecked") { |
|
_10f(_124, _125, false, true); |
|
} else { |
|
var flag = _11d(_126); |
|
if (flag === 0) { |
|
_10f(_124, _125, false, true); |
|
} else { |
|
if (flag === 1) { |
|
_10f(_124, _125, true, true); |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
ck.remove(); |
|
_126.checkState = undefined; |
|
_126.checked = undefined; |
|
_117(_124, _126); |
|
} |
|
}; |
|
function _127(_128, ul, data, _129, _12a) { |
|
var _12b = $.data(_128, "tree"); |
|
var opts = _12b.options; |
|
var _12c = $(ul).prevAll("div.tree-node:first"); |
|
data = opts.loadFilter.call(_128, data, _12c[0]); |
|
var _12d = _12e(_128, "domId", _12c.attr("id")); |
|
if (!_129) { |
|
_12d ? _12d.children = data : _12b.data = data; |
|
$(ul).empty(); |
|
} else { |
|
if (_12d) { |
|
_12d.children ? _12d.children = _12d.children.concat(data) : _12d.children = data; |
|
} else { |
|
_12b.data = _12b.data.concat(data); |
|
} |
|
} |
|
opts.view.render.call(opts.view, _128, ul, data); |
|
if (opts.dnd) { |
|
_f2(_128); |
|
} |
|
if (_12d) { |
|
_12f(_128, _12d); |
|
} |
|
for (var i = 0; i < _12b.tmpIds.length; i++) { |
|
_10f(_128, $("#" + _12b.tmpIds[i])[0], true, true); |
|
} |
|
_12b.tmpIds = []; |
|
setTimeout(function () { |
|
_130(_128, _128); |
|
}, 0); |
|
if (!_12a) { |
|
opts.onLoadSuccess.call(_128, _12d, data); |
|
} |
|
}; |
|
function _130(_131, ul, _132) { |
|
var opts = $.data(_131, "tree").options; |
|
if (opts.lines) { |
|
$(_131).addClass("tree-lines"); |
|
} else { |
|
$(_131).removeClass("tree-lines"); |
|
return; |
|
} |
|
if (!_132) { |
|
_132 = true; |
|
$(_131).find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"); |
|
$(_131).find("div.tree-node").removeClass("tree-node-last tree-root-first tree-root-one"); |
|
var _133 = $(_131).tree("getRoots"); |
|
if (_133.length > 1) { |
|
$(_133[0].target).addClass("tree-root-first"); |
|
} else { |
|
if (_133.length == 1) { |
|
$(_133[0].target).addClass("tree-root-one"); |
|
} |
|
} |
|
} |
|
$(ul).children("li").each(function () { |
|
var node = $(this).children("div.tree-node"); |
|
var ul = node.next("ul"); |
|
if (ul.length) { |
|
if ($(this).next().length) { |
|
_134(node); |
|
} |
|
_130(_131, ul, _132); |
|
} else { |
|
_135(node); |
|
} |
|
}); |
|
var _136 = $(ul).children("li:last").children("div.tree-node").addClass("tree-node-last"); |
|
_136.children("span.tree-join").removeClass("tree-join").addClass("tree-joinbottom"); |
|
function _135(node, _137) { |
|
var icon = node.find("span.tree-icon"); |
|
icon.prev("span.tree-indent").addClass("tree-join"); |
|
}; |
|
function _134(node) { |
|
var _138 = node.find("span.tree-indent, span.tree-hit").length; |
|
node.next().find("div.tree-node").each(function () { |
|
$(this).children("span:eq(" + (_138 - 1) + ")").addClass("tree-line"); |
|
}); |
|
}; |
|
}; |
|
function _139(_13a, ul, _13b, _13c) { |
|
var opts = $.data(_13a, "tree").options; |
|
_13b = $.extend({}, opts.queryParams, _13b || {}); |
|
var _13d = null; |
|
if (_13a != ul) { |
|
var node = $(ul).prev(); |
|
_13d = _ed(_13a, node[0]); |
|
} |
|
if (opts.onBeforeLoad.call(_13a, _13d, _13b) == false) { |
|
return; |
|
} |
|
var _13e = $(ul).prev().children("span.tree-folder"); |
|
_13e.addClass("tree-loading"); |
|
var _13f = opts.loader.call(_13a, _13b, function (data) { |
|
_13e.removeClass("tree-loading"); |
|
_127(_13a, ul, data); |
|
if (_13c) { |
|
_13c(); |
|
} |
|
}, function () { |
|
_13e.removeClass("tree-loading"); |
|
opts.onLoadError.apply(_13a, arguments); |
|
if (_13c) { |
|
_13c(); |
|
} |
|
}); |
|
if (_13f == false) { |
|
_13e.removeClass("tree-loading"); |
|
} |
|
}; |
|
function _140(_141, _142, _143) { |
|
var opts = $.data(_141, "tree").options; |
|
var hit = $(_142).children("span.tree-hit"); |
|
if (hit.length == 0) { |
|
return; |
|
} |
|
if (hit.hasClass("tree-expanded")) { |
|
return; |
|
} |
|
var node = _ed(_141, _142); |
|
if (opts.onBeforeExpand.call(_141, node) == false) { |
|
return; |
|
} |
|
hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"); |
|
hit.next().addClass("tree-folder-open"); |
|
var ul = $(_142).next(); |
|
if (ul.length) { |
|
if (opts.animate) { |
|
ul.slideDown("normal", function () { |
|
node.state = "open"; |
|
opts.onExpand.call(_141, node); |
|
if (_143) { |
|
_143(); |
|
} |
|
}); |
|
} else { |
|
ul.css("display", "block"); |
|
node.state = "open"; |
|
opts.onExpand.call(_141, node); |
|
if (_143) { |
|
_143(); |
|
} |
|
} |
|
} else { |
|
var _144 = $("<ul style=\"display:none\"></ul>").insertAfter(_142); |
|
_139(_141, _144[0], { |
|
id: node.id |
|
}, function () { |
|
if (_144.is(":empty")) { |
|
_144.remove(); |
|
} |
|
if (opts.animate) { |
|
_144.slideDown("normal", function () { |
|
node.state = "open"; |
|
opts.onExpand.call(_141, node); |
|
if (_143) { |
|
_143(); |
|
} |
|
}); |
|
} else { |
|
_144.css("display", "block"); |
|
node.state = "open"; |
|
opts.onExpand.call(_141, node); |
|
if (_143) { |
|
_143(); |
|
} |
|
} |
|
}); |
|
} |
|
}; |
|
function _145(_146, _147) { |
|
var opts = $.data(_146, "tree").options; |
|
var hit = $(_147).children("span.tree-hit"); |
|
if (hit.length == 0) { |
|
return; |
|
} |
|
if (hit.hasClass("tree-collapsed")) { |
|
return; |
|
} |
|
var node = _ed(_146, _147); |
|
if (opts.onBeforeCollapse.call(_146, node) == false) { |
|
return; |
|
} |
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); |
|
hit.next().removeClass("tree-folder-open"); |
|
var ul = $(_147).next(); |
|
if (opts.animate) { |
|
ul.slideUp("normal", function () { |
|
node.state = "closed"; |
|
opts.onCollapse.call(_146, node); |
|
}); |
|
} else { |
|
ul.css("display", "none"); |
|
node.state = "closed"; |
|
opts.onCollapse.call(_146, node); |
|
} |
|
}; |
|
function _148(_149, _14a) { |
|
var hit = $(_14a).children("span.tree-hit"); |
|
if (hit.length == 0) { |
|
return; |
|
} |
|
if (hit.hasClass("tree-expanded")) { |
|
_145(_149, _14a); |
|
} else { |
|
_140(_149, _14a); |
|
} |
|
}; |
|
function _14b(_14c, _14d) { |
|
var _14e = _14f(_14c, _14d); |
|
if (_14d) { |
|
_14e.unshift(_ed(_14c, _14d)); |
|
} |
|
for (var i = 0; i < _14e.length; i++) { |
|
_140(_14c, _14e[i].target); |
|
} |
|
}; |
|
function _150(_151, _152) { |
|
var _153 = []; |
|
var p = _122(_151, _152); |
|
while (p) { |
|
_153.unshift(p); |
|
p = _122(_151, p.target); |
|
} |
|
for (var i = 0; i < _153.length; i++) { |
|
_140(_151, _153[i].target); |
|
} |
|
}; |
|
function _154(_155, _156) { |
|
var c = $(_155).parent(); |
|
while (c[0].tagName != "BODY" && c.css("overflow-y") != "auto") { |
|
c = c.parent(); |
|
} |
|
var n = $(_156); |
|
var ntop = n.offset().top; |
|
if (c[0].tagName != "BODY") { |
|
var ctop = c.offset().top; |
|
if (ntop < ctop) { |
|
c.scrollTop(c.scrollTop() + ntop - ctop); |
|
} else { |
|
if (ntop + n.outerHeight() > ctop + c.outerHeight() - 18) { |
|
c.scrollTop(c.scrollTop() + ntop + n.outerHeight() - ctop - c.outerHeight() + 18); |
|
} |
|
} |
|
} else { |
|
c.scrollTop(ntop); |
|
} |
|
}; |
|
function _157(_158, _159) { |
|
var _15a = _14f(_158, _159); |
|
if (_159) { |
|
_15a.unshift(_ed(_158, _159)); |
|
} |
|
for (var i = 0; i < _15a.length; i++) { |
|
_145(_158, _15a[i].target); |
|
} |
|
}; |
|
function _15b(_15c, _15d) { |
|
var node = $(_15d.parent); |
|
var data = _15d.data; |
|
if (!data) { |
|
return; |
|
} |
|
data = $.isArray(data) ? data : [data]; |
|
if (!data.length) { |
|
return; |
|
} |
|
var ul; |
|
if (node.length == 0) { |
|
ul = $(_15c); |
|
} else { |
|
if (_15e(_15c, node[0])) { |
|
var _15f = node.find("span.tree-icon"); |
|
_15f.removeClass("tree-file").addClass("tree-folder tree-folder-open"); |
|
var hit = $("<span class=\"tree-hit tree-expanded\"></span>").insertBefore(_15f); |
|
if (hit.prev().length) { |
|
hit.prev().remove(); |
|
} |
|
} |
|
ul = node.next(); |
|
if (!ul.length) { |
|
ul = $("<ul></ul>").insertAfter(node); |
|
} |
|
} |
|
_127(_15c, ul[0], data, true, true); |
|
}; |
|
function _160(_161, _162) { |
|
var ref = _162.before || _162.after; |
|
var _163 = _122(_161, ref); |
|
var data = _162.data; |
|
if (!data) { |
|
return; |
|
} |
|
data = $.isArray(data) ? data : [data]; |
|
if (!data.length) { |
|
return; |
|
} |
|
_15b(_161, { |
|
parent: (_163 ? _163.target : null), |
|
data: data |
|
}); |
|
var _164 = _163 ? _163.children : $(_161).tree("getRoots"); |
|
for (var i = 0; i < _164.length; i++) { |
|
if (_164[i].domId == $(ref).attr("id")) { |
|
for (var j = data.length - 1; j >= 0; j--) { |
|
_164.splice((_162.before ? i : (i + 1)), 0, data[j]); |
|
} |
|
_164.splice(_164.length - data.length, data.length); |
|
break; |
|
} |
|
} |
|
var li = $(); |
|
for (var i = 0; i < data.length; i++) { |
|
li = li.add($("#" + data[i].domId).parent()); |
|
} |
|
if (_162.before) { |
|
li.insertBefore($(ref).parent()); |
|
} else { |
|
li.insertAfter($(ref).parent()); |
|
} |
|
}; |
|
function _165(_166, _167) { |
|
var _168 = del(_167); |
|
$(_167).parent().remove(); |
|
if (_168) { |
|
if (!_168.children || !_168.children.length) { |
|
var node = $(_168.target); |
|
node.find(".tree-icon").removeClass("tree-folder").addClass("tree-file"); |
|
node.find(".tree-hit").remove(); |
|
$("<span class=\"tree-indent\"></span>").prependTo(node); |
|
node.next().remove(); |
|
} |
|
_12f(_166, _168); |
|
} |
|
_130(_166, _166); |
|
function del(_169) { |
|
var id = $(_169).attr("id"); |
|
var _16a = _122(_166, _169); |
|
var cc = _16a ? _16a.children : $.data(_166, "tree").data; |
|
for (var i = 0; i < cc.length; i++) { |
|
if (cc[i].domId == id) { |
|
cc.splice(i, 1); |
|
break; |
|
} |
|
} |
|
return _16a; |
|
}; |
|
}; |
|
function _12f(_16b, _16c) { |
|
var opts = $.data(_16b, "tree").options; |
|
var node = $(_16c.target); |
|
var data = _ed(_16b, _16c.target); |
|
if (data.iconCls) { |
|
node.find(".tree-icon").removeClass(data.iconCls); |
|
} |
|
$.extend(data, _16c); |
|
node.find(".tree-title").html(opts.formatter.call(_16b, data)); |
|
if (data.iconCls) { |
|
node.find(".tree-icon").addClass(data.iconCls); |
|
} |
|
_123(_16b, _16c.target); |
|
}; |
|
function _16d(_16e, _16f) { |
|
if (_16f) { |
|
var p = _122(_16e, _16f); |
|
while (p) { |
|
_16f = p.target; |
|
p = _122(_16e, _16f); |
|
} |
|
return _ed(_16e, _16f); |
|
} else { |
|
var _170 = _171(_16e); |
|
return _170.length ? _170[0] : null; |
|
} |
|
}; |
|
function _171(_172) { |
|
var _173 = $.data(_172, "tree").data; |
|
for (var i = 0; i < _173.length; i++) { |
|
_174(_173[i]); |
|
} |
|
return _173; |
|
}; |
|
function _14f(_175, _176) { |
|
var _177 = []; |
|
var n = _ed(_175, _176); |
|
var data = n ? (n.children || []) : $.data(_175, "tree").data; |
|
$.easyui.forEach(data, true, function (node) { |
|
_177.push(_174(node)); |
|
}); |
|
return _177; |
|
}; |
|
function _122(_178, _179) { |
|
var p = $(_179).closest("ul").prevAll("div.tree-node:first"); |
|
return _ed(_178, p[0]); |
|
}; |
|
function _17a(_17b, _17c) { |
|
_17c = _17c || "checked"; |
|
if (!$.isArray(_17c)) { |
|
_17c = [_17c]; |
|
} |
|
var _17d = []; |
|
$.easyui.forEach($.data(_17b, "tree").data, true, function (n) { |
|
if (n.checkState && $.easyui.indexOfArray(_17c, n.checkState) != -1) { |
|
_17d.push(_174(n)); |
|
} |
|
}); |
|
return _17d; |
|
}; |
|
function _17e(_17f) { |
|
var node = $(_17f).find("div.tree-node-selected"); |
|
return node.length ? _ed(_17f, node[0]) : null; |
|
}; |
|
function _180(_181, _182) { |
|
var data = _ed(_181, _182); |
|
if (data && data.children) { |
|
$.easyui.forEach(data.children, true, function (node) { |
|
_174(node); |
|
}); |
|
} |
|
return data; |
|
}; |
|
function _ed(_183, _184) { |
|
return _12e(_183, "domId", $(_184).attr("id")); |
|
}; |
|
function _185(_186, _187) { |
|
if ($.isFunction(_187)) { |
|
var fn = _187; |
|
} else { |
|
var _187 = typeof _187 == "object" ? _187 : { |
|
id: _187 |
|
}; |
|
var fn = function (node) { |
|
for (var p in _187) { |
|
if (node[p] != _187[p]) { |
|
return false; |
|
} |
|
} |
|
return true; |
|
}; |
|
} |
|
var _188 = null; |
|
var data = $.data(_186, "tree").data; |
|
$.easyui.forEach(data, true, function (node) { |
|
if (fn.call(_186, node) == true) { |
|
_188 = _174(node); |
|
return false; |
|
} |
|
}); |
|
return _188; |
|
}; |
|
function _12e(_189, _18a, _18b) { |
|
var _18c = {}; |
|
_18c[_18a] = _18b; |
|
return _185(_189, _18c); |
|
}; |
|
function _174(node) { |
|
node.target = $("#" + node.domId)[0]; |
|
return node; |
|
}; |
|
function _18d(_18e, _18f) { |
|
var opts = $.data(_18e, "tree").options; |
|
var node = _ed(_18e, _18f); |
|
if (opts.onBeforeSelect.call(_18e, node) == false) { |
|
return; |
|
} |
|
$(_18e).find("div.tree-node-selected").removeClass("tree-node-selected"); |
|
$(_18f).addClass("tree-node-selected"); |
|
opts.onSelect.call(_18e, node); |
|
}; |
|
function _15e(_190, _191) { |
|
return $(_191).children("span.tree-hit").length == 0; |
|
}; |
|
function _192(_193, _194) { |
|
var opts = $.data(_193, "tree").options; |
|
var node = _ed(_193, _194); |
|
if (opts.onBeforeEdit.call(_193, node) == false) { |
|
return; |
|
} |
|
$(_194).css("position", "relative"); |
|
var nt = $(_194).find(".tree-title"); |
|
var _195 = nt.outerWidth(); |
|
nt.empty(); |
|
var _196 = $("<input class=\"tree-editor\">").appendTo(nt); |
|
_196.val(node.text).focus(); |
|
_196.width(_195 + 20); |
|
_196._outerHeight(opts.editorHeight); |
|
_196._bind("click", function (e) { |
|
return false; |
|
})._bind("mousedown", function (e) { |
|
e.stopPropagation(); |
|
})._bind("mousemove", function (e) { |
|
e.stopPropagation(); |
|
})._bind("keydown", function (e) { |
|
if (e.keyCode == 13) { |
|
_197(_193, _194); |
|
return false; |
|
} else { |
|
if (e.keyCode == 27) { |
|
_19b(_193, _194); |
|
return false; |
|
} |
|
} |
|
})._bind("blur", function (e) { |
|
e.stopPropagation(); |
|
_197(_193, _194); |
|
}); |
|
}; |
|
function _197(_198, _199) { |
|
var opts = $.data(_198, "tree").options; |
|
$(_199).css("position", ""); |
|
var _19a = $(_199).find("input.tree-editor"); |
|
var val = _19a.val(); |
|
_19a.remove(); |
|
var node = _ed(_198, _199); |
|
node.text = val; |
|
_12f(_198, node); |
|
opts.onAfterEdit.call(_198, node); |
|
}; |
|
function _19b(_19c, _19d) { |
|
var opts = $.data(_19c, "tree").options; |
|
$(_19d).css("position", ""); |
|
$(_19d).find("input.tree-editor").remove(); |
|
var node = _ed(_19c, _19d); |
|
_12f(_19c, node); |
|
opts.onCancelEdit.call(_19c, node); |
|
}; |
|
function _19e(_19f, q) { |
|
var _1a0 = $.data(_19f, "tree"); |
|
var opts = _1a0.options; |
|
var ids = {}; |
|
$.easyui.forEach(_1a0.data, true, function (node) { |
|
if (opts.filter.call(_19f, q, node)) { |
|
$("#" + node.domId).removeClass("tree-node-hidden"); |
|
ids[node.domId] = 1; |
|
node.hidden = false; |
|
} else { |
|
$("#" + node.domId).addClass("tree-node-hidden"); |
|
node.hidden = true; |
|
} |
|
}); |
|
for (var id in ids) { |
|
_1a1(id); |
|
} |
|
function _1a1(_1a2) { |
|
var p = $(_19f).tree("getParent", $("#" + _1a2)[0]); |
|
while (p) { |
|
$(p.target).removeClass("tree-node-hidden"); |
|
p.hidden = false; |
|
p = $(_19f).tree("getParent", p.target); |
|
} |
|
}; |
|
}; |
|
$.fn.tree = function (_1a3, _1a4) { |
|
if (typeof _1a3 == "string") { |
|
return $.fn.tree.methods[_1a3](this, _1a4); |
|
} |
|
var _1a3 = _1a3 || {}; |
|
return this.each(function () { |
|
var _1a5 = $.data(this, "tree"); |
|
var opts; |
|
if (_1a5) { |
|
opts = $.extend(_1a5.options, _1a3); |
|
_1a5.options = opts; |
|
} else { |
|
opts = $.extend({}, $.fn.tree.defaults, $.fn.tree.parseOptions(this), _1a3); |
|
$.data(this, "tree", { |
|
options: opts, |
|
tree: _e2(this), |
|
data: [], |
|
tmpIds: [] |
|
}); |
|
var data = $.fn.tree.parseData(this); |
|
if (data.length) { |
|
_127(this, this, data); |
|
} |
|
} |
|
_e5(this); |
|
if (opts.data) { |
|
_127(this, this, $.extend(true, [], opts.data)); |
|
} |
|
_139(this, this); |
|
}); |
|
}; |
|
$.fn.tree.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "tree").options; |
|
}, |
|
loadData: function (jq, data) { |
|
return jq.each(function () { |
|
_127(this, this, data); |
|
}); |
|
}, |
|
getNode: function (jq, _1a6) { |
|
return _ed(jq[0], _1a6); |
|
}, |
|
getData: function (jq, _1a7) { |
|
return _180(jq[0], _1a7); |
|
}, |
|
reload: function (jq, _1a8) { |
|
return jq.each(function () { |
|
if (_1a8) { |
|
var node = $(_1a8); |
|
var hit = node.children("span.tree-hit"); |
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); |
|
node.next().remove(); |
|
_140(this, _1a8); |
|
} else { |
|
$(this).empty(); |
|
_139(this, this); |
|
} |
|
}); |
|
}, |
|
getRoot: function (jq, _1a9) { |
|
return _16d(jq[0], _1a9); |
|
}, |
|
getRoots: function (jq) { |
|
return _171(jq[0]); |
|
}, |
|
getParent: function (jq, _1aa) { |
|
return _122(jq[0], _1aa); |
|
}, |
|
getChildren: function (jq, _1ab) { |
|
return _14f(jq[0], _1ab); |
|
}, |
|
getChecked: function (jq, _1ac) { |
|
return _17a(jq[0], _1ac); |
|
}, |
|
getSelected: function (jq) { |
|
return _17e(jq[0]); |
|
}, |
|
isLeaf: function (jq, _1ad) { |
|
return _15e(jq[0], _1ad); |
|
}, |
|
find: function (jq, id) { |
|
return _185(jq[0], id); |
|
}, |
|
findBy: function (jq, _1ae) { |
|
return _12e(jq[0], _1ae.field, _1ae.value); |
|
}, |
|
select: function (jq, _1af) { |
|
return jq.each(function () { |
|
_18d(this, _1af); |
|
}); |
|
}, |
|
check: function (jq, _1b0) { |
|
return jq.each(function () { |
|
_10f(this, _1b0, true); |
|
}); |
|
}, |
|
uncheck: function (jq, _1b1) { |
|
return jq.each(function () { |
|
_10f(this, _1b1, false); |
|
}); |
|
}, |
|
collapse: function (jq, _1b2) { |
|
return jq.each(function () { |
|
_145(this, _1b2); |
|
}); |
|
}, |
|
expand: function (jq, _1b3) { |
|
return jq.each(function () { |
|
_140(this, _1b3); |
|
}); |
|
}, |
|
collapseAll: function (jq, _1b4) { |
|
return jq.each(function () { |
|
_157(this, _1b4); |
|
}); |
|
}, |
|
expandAll: function (jq, _1b5) { |
|
return jq.each(function () { |
|
_14b(this, _1b5); |
|
}); |
|
}, |
|
expandTo: function (jq, _1b6) { |
|
return jq.each(function () { |
|
_150(this, _1b6); |
|
}); |
|
}, |
|
scrollTo: function (jq, _1b7) { |
|
return jq.each(function () { |
|
_154(this, _1b7); |
|
}); |
|
}, |
|
toggle: function (jq, _1b8) { |
|
return jq.each(function () { |
|
_148(this, _1b8); |
|
}); |
|
}, |
|
append: function (jq, _1b9) { |
|
return jq.each(function () { |
|
_15b(this, _1b9); |
|
}); |
|
}, |
|
insert: function (jq, _1ba) { |
|
return jq.each(function () { |
|
_160(this, _1ba); |
|
}); |
|
}, |
|
remove: function (jq, _1bb) { |
|
return jq.each(function () { |
|
_165(this, _1bb); |
|
}); |
|
}, |
|
pop: function (jq, _1bc) { |
|
var node = jq.tree("getData", _1bc); |
|
jq.tree("remove", _1bc); |
|
return node; |
|
}, |
|
update: function (jq, _1bd) { |
|
return jq.each(function () { |
|
_12f(this, $.extend({}, _1bd, { |
|
checkState: _1bd.checked ? "checked" : (_1bd.checked === false ? "unchecked" : undefined) |
|
})); |
|
}); |
|
}, |
|
enableDnd: function (jq) { |
|
return jq.each(function () { |
|
_f2(this); |
|
}); |
|
}, |
|
disableDnd: function (jq) { |
|
return jq.each(function () { |
|
_ee(this); |
|
}); |
|
}, |
|
beginEdit: function (jq, _1be) { |
|
return jq.each(function () { |
|
_192(this, _1be); |
|
}); |
|
}, |
|
endEdit: function (jq, _1bf) { |
|
return jq.each(function () { |
|
_197(this, _1bf); |
|
}); |
|
}, |
|
cancelEdit: function (jq, _1c0) { |
|
return jq.each(function () { |
|
_19b(this, _1c0); |
|
}); |
|
}, |
|
doFilter: function (jq, q) { |
|
return jq.each(function () { |
|
_19e(this, q); |
|
}); |
|
} |
|
}; |
|
$.fn.tree.parseOptions = function (_1c1) { |
|
var t = $(_1c1); |
|
return $.extend({}, $.parser.parseOptions(_1c1, ["url", "method", { |
|
checkbox: "boolean", |
|
cascadeCheck: "boolean", |
|
onlyLeafCheck: "boolean" |
|
}, { |
|
animate: "boolean", |
|
lines: "boolean", |
|
dnd: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.tree.parseData = function (_1c2) { |
|
var data = []; |
|
_1c3(data, $(_1c2)); |
|
return data; |
|
function _1c3(aa, tree) { |
|
tree.children("li").each(function () { |
|
var node = $(this); |
|
var item = $.extend({}, $.parser.parseOptions(this, ["id", "iconCls", "state"]), { |
|
checked: (node.attr("checked") ? true : undefined) |
|
}); |
|
item.text = node.children("span").html(); |
|
if (!item.text) { |
|
item.text = node.html(); |
|
} |
|
var _1c4 = node.children("ul"); |
|
if (_1c4.length) { |
|
item.children = []; |
|
_1c3(item.children, _1c4); |
|
} |
|
aa.push(item); |
|
}); |
|
}; |
|
}; |
|
var _1c5 = 1; |
|
var _1c6 = { |
|
render: function (_1c7, ul, data) { |
|
var _1c8 = $.data(_1c7, "tree"); |
|
var opts = _1c8.options; |
|
var _1c9 = $(ul).prev(".tree-node"); |
|
var _1ca = _1c9.length ? $(_1c7).tree("getNode", _1c9[0]) : null; |
|
var _1cb = _1c9.find("span.tree-indent, span.tree-hit").length; |
|
var _1cc = $(_1c7).attr("id") || ""; |
|
var cc = _1cd.call(this, _1cb, data); |
|
$(ul).append(cc.join("")); |
|
function _1cd(_1ce, _1cf) { |
|
var cc = []; |
|
for (var i = 0; i < _1cf.length; i++) { |
|
var item = _1cf[i]; |
|
if (item.state != "open" && item.state != "closed") { |
|
item.state = "open"; |
|
} |
|
item.domId = _1cc + "_easyui_tree_" + _1c5++; |
|
cc.push("<li>"); |
|
cc.push("<div id=\"" + item.domId + "\" class=\"tree-node" + (item.nodeCls ? " " + item.nodeCls : "") + "\">"); |
|
for (var j = 0; j < _1ce; j++) { |
|
cc.push("<span class=\"tree-indent\"></span>"); |
|
} |
|
if (item.state == "closed") { |
|
cc.push("<span class=\"tree-hit tree-collapsed\"></span>"); |
|
cc.push("<span class=\"tree-icon tree-folder " + (item.iconCls ? item.iconCls : "") + "\"></span>"); |
|
} else { |
|
if (item.children && item.children.length) { |
|
cc.push("<span class=\"tree-hit tree-expanded\"></span>"); |
|
cc.push("<span class=\"tree-icon tree-folder tree-folder-open " + (item.iconCls ? item.iconCls : "") + "\"></span>"); |
|
} else { |
|
cc.push("<span class=\"tree-indent\"></span>"); |
|
cc.push("<span class=\"tree-icon tree-file " + (item.iconCls ? item.iconCls : "") + "\"></span>"); |
|
} |
|
} |
|
if (this.hasCheckbox(_1c7, item)) { |
|
var flag = 0; |
|
if (_1ca && _1ca.checkState == "checked" && opts.cascadeCheck) { |
|
flag = 1; |
|
item.checked = true; |
|
} else { |
|
if (item.checked) { |
|
$.easyui.addArrayItem(_1c8.tmpIds, item.domId); |
|
} |
|
} |
|
item.checkState = flag ? "checked" : "unchecked"; |
|
cc.push("<span class=\"tree-checkbox tree-checkbox" + flag + "\"></span>"); |
|
} else { |
|
item.checkState = undefined; |
|
item.checked = undefined; |
|
} |
|
cc.push("<span class=\"tree-title\">" + opts.formatter.call(_1c7, item) + "</span>"); |
|
cc.push("</div>"); |
|
if (item.children && item.children.length) { |
|
var tmp = _1cd.call(this, _1ce + 1, item.children); |
|
cc.push("<ul style=\"display:" + (item.state == "closed" ? "none" : "block") + "\">"); |
|
cc = cc.concat(tmp); |
|
cc.push("</ul>"); |
|
} |
|
cc.push("</li>"); |
|
} |
|
return cc; |
|
}; |
|
}, |
|
hasCheckbox: function (_1d0, item) { |
|
var _1d1 = $.data(_1d0, "tree"); |
|
var opts = _1d1.options; |
|
if (opts.checkbox) { |
|
if ($.isFunction(opts.checkbox)) { |
|
if (opts.checkbox.call(_1d0, item)) { |
|
return true; |
|
} else { |
|
return false; |
|
} |
|
} else { |
|
if (opts.onlyLeafCheck) { |
|
if (item.state == "open" && !(item.children && item.children.length)) { |
|
return true; |
|
} |
|
} else { |
|
return true; |
|
} |
|
} |
|
} |
|
return false; |
|
} |
|
}; |
|
$.fn.tree.defaults = { |
|
url: null, |
|
method: "post", |
|
animate: false, |
|
checkbox: false, |
|
cascadeCheck: true, |
|
onlyLeafCheck: false, |
|
lines: false, |
|
dnd: false, |
|
editorHeight: 26, |
|
data: null, |
|
queryParams: {}, |
|
formatter: function (node) { |
|
return node.text; |
|
}, |
|
filter: function (q, node) { |
|
var qq = []; |
|
$.map($.isArray(q) ? q : [q], function (q) { |
|
q = $.trim(q); |
|
if (q) { |
|
qq.push(q); |
|
} |
|
}); |
|
for (var i = 0; i < qq.length; i++) { |
|
var _1d2 = node.text.toLowerCase().indexOf(qq[i].toLowerCase()); |
|
if (_1d2 >= 0) { |
|
return true; |
|
} |
|
} |
|
return !qq.length; |
|
}, |
|
loader: function (_1d3, _1d4, _1d5) { |
|
var opts = $(this).tree("options"); |
|
if (!opts.url) { |
|
return false; |
|
} |
|
$.ajax({ |
|
type: opts.method, |
|
url: opts.url, |
|
data: _1d3, |
|
dataType: "json", |
|
success: function (data) { |
|
_1d4(data); |
|
}, |
|
error: function () { |
|
_1d5.apply(this, arguments); |
|
} |
|
}); |
|
}, |
|
loadFilter: function (data, _1d6) { |
|
return data; |
|
}, |
|
view: _1c6, |
|
onBeforeLoad: function (node, _1d7) {}, |
|
onLoadSuccess: function (node, data) {}, |
|
onLoadError: function () {}, |
|
onClick: function (node) {}, |
|
onDblClick: function (node) {}, |
|
onBeforeExpand: function (node) {}, |
|
onExpand: function (node) {}, |
|
onBeforeCollapse: function (node) {}, |
|
onCollapse: function (node) {}, |
|
onBeforeCheck: function (node, _1d8) {}, |
|
onCheck: function (node, _1d9) {}, |
|
onBeforeSelect: function (node) {}, |
|
onSelect: function (node) {}, |
|
onContextMenu: function (e, node) {}, |
|
onBeforeDrag: function (node) {}, |
|
onStartDrag: function (node) {}, |
|
onStopDrag: function (node) {}, |
|
onDragEnter: function (_1da, _1db) {}, |
|
onDragOver: function (_1dc, _1dd) {}, |
|
onDragLeave: function (_1de, _1df) {}, |
|
onBeforeDrop: function (_1e0, _1e1, _1e2) {}, |
|
onDrop: function (_1e3, _1e4, _1e5) {}, |
|
onBeforeEdit: function (node) {}, |
|
onAfterEdit: function (node) {}, |
|
onCancelEdit: function (node) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function init(_1e6) { |
|
$(_1e6).addClass("progressbar"); |
|
$(_1e6).html("<div class=\"progressbar-text\"></div><div class=\"progressbar-value\"><div class=\"progressbar-text\"></div></div>"); |
|
$(_1e6)._bind("_resize", function (e, _1e7) { |
|
if ($(this).hasClass("easyui-fluid") || _1e7) { |
|
_1e8(_1e6); |
|
} |
|
return false; |
|
}); |
|
return $(_1e6); |
|
}; |
|
function _1e8(_1e9, _1ea) { |
|
var opts = $.data(_1e9, "progressbar").options; |
|
var bar = $.data(_1e9, "progressbar").bar; |
|
if (_1ea) { |
|
opts.width = _1ea; |
|
} |
|
bar._size(opts); |
|
bar.find("div.progressbar-text").css("width", bar.width()); |
|
bar.find("div.progressbar-text,div.progressbar-value").css({ |
|
height: bar.height() + "px", |
|
lineHeight: bar.height() + "px" |
|
}); |
|
}; |
|
$.fn.progressbar = function (_1eb, _1ec) { |
|
if (typeof _1eb == "string") { |
|
var _1ed = $.fn.progressbar.methods[_1eb]; |
|
if (_1ed) { |
|
return _1ed(this, _1ec); |
|
} |
|
} |
|
_1eb = _1eb || {}; |
|
return this.each(function () { |
|
var _1ee = $.data(this, "progressbar"); |
|
if (_1ee) { |
|
$.extend(_1ee.options, _1eb); |
|
} else { |
|
_1ee = $.data(this, "progressbar", { |
|
options: $.extend({}, $.fn.progressbar.defaults, $.fn.progressbar.parseOptions(this), _1eb), |
|
bar: init(this) |
|
}); |
|
} |
|
$(this).progressbar("setValue", _1ee.options.value); |
|
_1e8(this); |
|
}); |
|
}; |
|
$.fn.progressbar.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "progressbar").options; |
|
}, |
|
resize: function (jq, _1ef) { |
|
return jq.each(function () { |
|
_1e8(this, _1ef); |
|
}); |
|
}, |
|
getValue: function (jq) { |
|
return $.data(jq[0], "progressbar").options.value; |
|
}, |
|
setValue: function (jq, _1f0) { |
|
if (_1f0 < 0) { |
|
_1f0 = 0; |
|
} |
|
if (_1f0 > 100) { |
|
_1f0 = 100; |
|
} |
|
return jq.each(function () { |
|
var opts = $.data(this, "progressbar").options; |
|
var text = opts.text.replace(/{value}/, _1f0); |
|
var _1f1 = opts.value; |
|
opts.value = _1f0; |
|
$(this).find("div.progressbar-value").width(_1f0 + "%"); |
|
$(this).find("div.progressbar-text").html(text); |
|
if (_1f1 != _1f0) { |
|
opts.onChange.call(this, _1f0, _1f1); |
|
} |
|
}); |
|
} |
|
}; |
|
$.fn.progressbar.parseOptions = function (_1f2) { |
|
return $.extend({}, $.parser.parseOptions(_1f2, ["width", "height", "text", { |
|
value: "number" |
|
} |
|
])); |
|
}; |
|
$.fn.progressbar.defaults = { |
|
width: "auto", |
|
height: 22, |
|
value: 0, |
|
text: "{value}%", |
|
onChange: function (_1f3, _1f4) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function init(_1f5) { |
|
$(_1f5).addClass("tooltip-f"); |
|
}; |
|
function _1f6(_1f7) { |
|
var opts = $.data(_1f7, "tooltip").options; |
|
$(_1f7)._unbind(".tooltip")._bind(opts.showEvent + ".tooltip", function (e) { |
|
$(_1f7).tooltip("show", e); |
|
})._bind(opts.hideEvent + ".tooltip", function (e) { |
|
$(_1f7).tooltip("hide", e); |
|
})._bind("mousemove.tooltip", function (e) { |
|
if (opts.trackMouse) { |
|
opts.trackMouseX = e.pageX; |
|
opts.trackMouseY = e.pageY; |
|
$(_1f7).tooltip("reposition"); |
|
} |
|
}); |
|
}; |
|
function _1f8(_1f9) { |
|
var _1fa = $.data(_1f9, "tooltip"); |
|
if (_1fa.showTimer) { |
|
clearTimeout(_1fa.showTimer); |
|
_1fa.showTimer = null; |
|
} |
|
if (_1fa.hideTimer) { |
|
clearTimeout(_1fa.hideTimer); |
|
_1fa.hideTimer = null; |
|
} |
|
}; |
|
function _1fb(_1fc) { |
|
var _1fd = $.data(_1fc, "tooltip"); |
|
if (!_1fd || !_1fd.tip) { |
|
return; |
|
} |
|
var opts = _1fd.options; |
|
var tip = _1fd.tip; |
|
var pos = { |
|
left: -100000, |
|
top: -100000 |
|
}; |
|
if ($(_1fc).is(":visible")) { |
|
pos = _1fe(opts.position); |
|
if (opts.position == "top" && pos.top < 0) { |
|
pos = _1fe("bottom"); |
|
} else { |
|
if ((opts.position == "bottom") && (pos.top + tip._outerHeight() > $(window)._outerHeight() + $(document).scrollTop())) { |
|
pos = _1fe("top"); |
|
} |
|
} |
|
if (pos.left < 0) { |
|
if (opts.position == "left") { |
|
pos = _1fe("right"); |
|
} else { |
|
$(_1fc).tooltip("arrow").css("left", tip._outerWidth() / 2 + pos.left); |
|
pos.left = 0; |
|
} |
|
} else { |
|
if (pos.left + tip._outerWidth() > $(window)._outerWidth() + $(document)._scrollLeft()) { |
|
if (opts.position == "right") { |
|
pos = _1fe("left"); |
|
} else { |
|
var left = pos.left; |
|
pos.left = $(window)._outerWidth() + $(document)._scrollLeft() - tip._outerWidth(); |
|
$(_1fc).tooltip("arrow").css("left", tip._outerWidth() / 2 - (pos.left - left)); |
|
} |
|
} |
|
} |
|
} |
|
tip.css({ |
|
left: pos.left, |
|
top: pos.top, |
|
zIndex: (opts.zIndex != undefined ? opts.zIndex : ($.fn.window ? $.fn.window.defaults.zIndex++ : "")) |
|
}); |
|
opts.onPosition.call(_1fc, pos.left, pos.top); |
|
function _1fe(_1ff) { |
|
opts.position = _1ff || "bottom"; |
|
tip.removeClass("tooltip-top tooltip-bottom tooltip-left tooltip-right").addClass("tooltip-" + opts.position); |
|
var left, |
|
top; |
|
var _200 = $.isFunction(opts.deltaX) ? opts.deltaX.call(_1fc, opts.position) : opts.deltaX; |
|
var _201 = $.isFunction(opts.deltaY) ? opts.deltaY.call(_1fc, opts.position) : opts.deltaY; |
|
if (opts.trackMouse) { |
|
t = $(); |
|
left = opts.trackMouseX + _200; |
|
top = opts.trackMouseY + _201; |
|
} else { |
|
var t = $(_1fc); |
|
left = t.offset().left + _200; |
|
top = t.offset().top + _201; |
|
} |
|
switch (opts.position) { |
|
case "right": |
|
left += t._outerWidth() + 12 + (opts.trackMouse ? 12 : 0); |
|
if (opts.valign == "middle") { |
|
top -= (tip._outerHeight() - t._outerHeight()) / 2; |
|
} |
|
break; |
|
case "left": |
|
left -= tip._outerWidth() + 12 + (opts.trackMouse ? 12 : 0); |
|
if (opts.valign == "middle") { |
|
top -= (tip._outerHeight() - t._outerHeight()) / 2; |
|
} |
|
break; |
|
case "top": |
|
left -= (tip._outerWidth() - t._outerWidth()) / 2; |
|
top -= tip._outerHeight() + 12 + (opts.trackMouse ? 12 : 0); |
|
break; |
|
case "bottom": |
|
left -= (tip._outerWidth() - t._outerWidth()) / 2; |
|
top += t._outerHeight() + 12 + (opts.trackMouse ? 12 : 0); |
|
break; |
|
} |
|
return { |
|
left: left, |
|
top: top |
|
}; |
|
}; |
|
}; |
|
function _202(_203, e) { |
|
var _204 = $.data(_203, "tooltip"); |
|
var opts = _204.options; |
|
var tip = _204.tip; |
|
if (!tip) { |
|
tip = $("<div tabindex=\"-1\" class=\"tooltip\">" + "<div class=\"tooltip-content\"></div>" + "<div class=\"tooltip-arrow-outer\"></div>" + "<div class=\"tooltip-arrow\"></div>" + "</div>").appendTo("body"); |
|
_204.tip = tip; |
|
_205(_203); |
|
} |
|
_1f8(_203); |
|
_204.showTimer = setTimeout(function () { |
|
$(_203).tooltip("reposition"); |
|
tip.show(); |
|
opts.onShow.call(_203, e); |
|
var _206 = tip.children(".tooltip-arrow-outer"); |
|
var _207 = tip.children(".tooltip-arrow"); |
|
var bc = "border-" + opts.position + "-color"; |
|
_206.add(_207).css({ |
|
borderTopColor: "", |
|
borderBottomColor: "", |
|
borderLeftColor: "", |
|
borderRightColor: "" |
|
}); |
|
_206.css(bc, tip.css(bc)); |
|
_207.css(bc, tip.css("backgroundColor")); |
|
}, opts.showDelay); |
|
}; |
|
function _208(_209, e) { |
|
var _20a = $.data(_209, "tooltip"); |
|
if (_20a && _20a.tip) { |
|
_1f8(_209); |
|
_20a.hideTimer = setTimeout(function () { |
|
_20a.tip.hide(); |
|
_20a.options.onHide.call(_209, e); |
|
}, _20a.options.hideDelay); |
|
} |
|
}; |
|
function _205(_20b, _20c) { |
|
var _20d = $.data(_20b, "tooltip"); |
|
var opts = _20d.options; |
|
if (_20c) { |
|
opts.content = _20c; |
|
} |
|
if (!_20d.tip) { |
|
return; |
|
} |
|
var cc = typeof opts.content == "function" ? opts.content.call(_20b) : opts.content; |
|
_20d.tip.children(".tooltip-content").html(cc); |
|
opts.onUpdate.call(_20b, cc); |
|
}; |
|
function _20e(_20f) { |
|
var _210 = $.data(_20f, "tooltip"); |
|
if (_210) { |
|
_1f8(_20f); |
|
var opts = _210.options; |
|
if (_210.tip) { |
|
_210.tip.remove(); |
|
} |
|
if (opts._title) { |
|
$(_20f).attr("title", opts._title); |
|
} |
|
$.removeData(_20f, "tooltip"); |
|
$(_20f)._unbind(".tooltip").removeClass("tooltip-f"); |
|
opts.onDestroy.call(_20f); |
|
} |
|
}; |
|
$.fn.tooltip = function (_211, _212) { |
|
if (typeof _211 == "string") { |
|
return $.fn.tooltip.methods[_211](this, _212); |
|
} |
|
_211 = _211 || {}; |
|
return this.each(function () { |
|
var _213 = $.data(this, "tooltip"); |
|
if (_213) { |
|
$.extend(_213.options, _211); |
|
} else { |
|
$.data(this, "tooltip", { |
|
options: $.extend({}, $.fn.tooltip.defaults, $.fn.tooltip.parseOptions(this), _211) |
|
}); |
|
init(this); |
|
} |
|
_1f6(this); |
|
_205(this); |
|
}); |
|
}; |
|
$.fn.tooltip.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "tooltip").options; |
|
}, |
|
tip: function (jq) { |
|
return $.data(jq[0], "tooltip").tip; |
|
}, |
|
arrow: function (jq) { |
|
return jq.tooltip("tip").children(".tooltip-arrow-outer,.tooltip-arrow"); |
|
}, |
|
show: function (jq, e) { |
|
return jq.each(function () { |
|
_202(this, e); |
|
}); |
|
}, |
|
hide: function (jq, e) { |
|
return jq.each(function () { |
|
_208(this, e); |
|
}); |
|
}, |
|
update: function (jq, _214) { |
|
return jq.each(function () { |
|
_205(this, _214); |
|
}); |
|
}, |
|
reposition: function (jq) { |
|
return jq.each(function () { |
|
_1fb(this); |
|
}); |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
_20e(this); |
|
}); |
|
} |
|
}; |
|
$.fn.tooltip.parseOptions = function (_215) { |
|
var t = $(_215); |
|
var opts = $.extend({}, $.parser.parseOptions(_215, ["position", "showEvent", "hideEvent", "content", { |
|
trackMouse: "boolean", |
|
deltaX: "number", |
|
deltaY: "number", |
|
showDelay: "number", |
|
hideDelay: "number" |
|
} |
|
]), { |
|
_title: t.attr("title") |
|
}); |
|
t.attr("title", ""); |
|
if (!opts.content) { |
|
opts.content = opts._title; |
|
} |
|
return opts; |
|
}; |
|
$.fn.tooltip.defaults = { |
|
position: "bottom", |
|
valign: "middle", |
|
content: null, |
|
trackMouse: false, |
|
deltaX: 0, |
|
deltaY: 0, |
|
showEvent: "mouseenter", |
|
hideEvent: "mouseleave", |
|
showDelay: 200, |
|
hideDelay: 100, |
|
onShow: function (e) {}, |
|
onHide: function (e) {}, |
|
onUpdate: function (_216) {}, |
|
onPosition: function (left, top) {}, |
|
onDestroy: function () {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
$.fn._remove = function () { |
|
return this.each(function () { |
|
$(this).remove(); |
|
try { |
|
this.outerHTML = ""; |
|
} catch (err) {} |
|
}); |
|
}; |
|
function _217(node) { |
|
node._remove(); |
|
}; |
|
function _218(_219, _21a) { |
|
var _21b = $.data(_219, "panel"); |
|
var opts = _21b.options; |
|
var _21c = _21b.panel; |
|
var _21d = _21c.children(".panel-header"); |
|
var _21e = _21c.children(".panel-body"); |
|
var _21f = _21c.children(".panel-footer"); |
|
var _220 = (opts.halign == "left" || opts.halign == "right"); |
|
if (_21a) { |
|
$.extend(opts, { |
|
width: _21a.width, |
|
height: _21a.height, |
|
minWidth: _21a.minWidth, |
|
maxWidth: _21a.maxWidth, |
|
minHeight: _21a.minHeight, |
|
maxHeight: _21a.maxHeight, |
|
left: _21a.left, |
|
top: _21a.top |
|
}); |
|
opts.hasResized = false; |
|
} |
|
var _221 = _21c.outerWidth(); |
|
var _222 = _21c.outerHeight(); |
|
_21c._size(opts); |
|
var _223 = _21c.outerWidth(); |
|
var _224 = _21c.outerHeight(); |
|
if (opts.hasResized && (_221 == _223 && _222 == _224)) { |
|
return; |
|
} |
|
opts.hasResized = true; |
|
if (!_220) { |
|
_21d._outerWidth(_21c.width()); |
|
} |
|
_21e._outerWidth(_21c.width()); |
|
if (!isNaN(parseInt(opts.height))) { |
|
if (_220) { |
|
if (opts.header) { |
|
var _225 = $(opts.header)._outerWidth(); |
|
} else { |
|
_21d.css("width", ""); |
|
var _225 = _21d._outerWidth(); |
|
} |
|
var _226 = _21d.find(".panel-title"); |
|
_225 += Math.min(_226._outerWidth(), _226._outerHeight()); |
|
var _227 = _21c.height(); |
|
_21d._outerWidth(_225)._outerHeight(_227); |
|
_226._outerWidth(_21d.height()); |
|
_21e._outerWidth(_21c.width() - _225 - _21f._outerWidth())._outerHeight(_227); |
|
_21f._outerHeight(_227); |
|
_21e.css({ |
|
left: "", |
|
right: "" |
|
}); |
|
if (_21d.length) { |
|
_21e.css(opts.halign, (_21d.position()[opts.halign] + _225) + "px"); |
|
} |
|
opts.panelCssWidth = _21c.css("width"); |
|
if (opts.collapsed) { |
|
_21c._outerWidth(_225 + _21f._outerWidth()); |
|
} |
|
} else { |
|
_21e._outerHeight(_21c.height() - _21d._outerHeight() - _21f._outerHeight()); |
|
} |
|
} else { |
|
_21e.css("height", ""); |
|
var min = $.parser.parseValue("minHeight", opts.minHeight, _21c.parent()); |
|
var max = $.parser.parseValue("maxHeight", opts.maxHeight, _21c.parent()); |
|
var _228 = _21d._outerHeight() + _21f._outerHeight() + _21c._outerHeight() - _21c.height(); |
|
_21e._size("minHeight", min ? (min - _228) : ""); |
|
_21e._size("maxHeight", max ? (max - _228) : ""); |
|
} |
|
_21c.css({ |
|
height: (_220 ? undefined : ""), |
|
minHeight: "", |
|
maxHeight: "", |
|
left: opts.left, |
|
top: opts.top |
|
}); |
|
opts.onResize.apply(_219, [opts.width, opts.height]); |
|
$(_219).panel("doLayout"); |
|
}; |
|
function _229(_22a, _22b) { |
|
var _22c = $.data(_22a, "panel"); |
|
var opts = _22c.options; |
|
var _22d = _22c.panel; |
|
if (_22b) { |
|
if (_22b.left != null) { |
|
opts.left = _22b.left; |
|
} |
|
if (_22b.top != null) { |
|
opts.top = _22b.top; |
|
} |
|
} |
|
_22d.css({ |
|
left: opts.left, |
|
top: opts.top |
|
}); |
|
_22d.find(".tooltip-f").each(function () { |
|
$(this).tooltip("reposition"); |
|
}); |
|
opts.onMove.apply(_22a, [opts.left, opts.top]); |
|
}; |
|
function _22e(_22f) { |
|
$(_22f).addClass("panel-body")._size("clear"); |
|
var _230 = $("<div class=\"panel\"></div>").insertBefore(_22f); |
|
_230[0].appendChild(_22f); |
|
_230._bind("_resize", function (e, _231) { |
|
if ($(this).hasClass("easyui-fluid") || _231) { |
|
_218(_22f, {}); |
|
} |
|
return false; |
|
}); |
|
return _230; |
|
}; |
|
function _232(_233) { |
|
var _234 = $.data(_233, "panel"); |
|
var opts = _234.options; |
|
var _235 = _234.panel; |
|
_235.css(opts.style); |
|
_235.addClass(opts.cls); |
|
_235.removeClass("panel-hleft panel-hright").addClass("panel-h" + opts.halign); |
|
_236(); |
|
_237(); |
|
var _238 = $(_233).panel("header"); |
|
var body = $(_233).panel("body"); |
|
var _239 = $(_233).siblings(".panel-footer"); |
|
if (opts.border) { |
|
_238.removeClass("panel-header-noborder"); |
|
body.removeClass("panel-body-noborder"); |
|
_239.removeClass("panel-footer-noborder"); |
|
} else { |
|
_238.addClass("panel-header-noborder"); |
|
body.addClass("panel-body-noborder"); |
|
_239.addClass("panel-footer-noborder"); |
|
} |
|
_238.addClass(opts.headerCls); |
|
body.addClass(opts.bodyCls); |
|
$(_233).attr("id", opts.id || ""); |
|
if (opts.content) { |
|
$(_233).panel("clear"); |
|
$(_233).html(opts.content); |
|
$.parser.parse($(_233)); |
|
} |
|
function _236() { |
|
if (opts.noheader || (!opts.title && !opts.header)) { |
|
_217(_235.children(".panel-header")); |
|
_235.children(".panel-body").addClass("panel-body-noheader"); |
|
} else { |
|
if (opts.header) { |
|
$(opts.header).addClass("panel-header").prependTo(_235); |
|
} else { |
|
var _23a = _235.children(".panel-header"); |
|
if (!_23a.length) { |
|
_23a = $("<div class=\"panel-header\"></div>").prependTo(_235); |
|
} |
|
if (!$.isArray(opts.tools)) { |
|
_23a.find("div.panel-tool .panel-tool-a").appendTo(opts.tools); |
|
} |
|
_23a.empty(); |
|
var _23b = $("<div class=\"panel-title\"></div>").html(opts.title).appendTo(_23a); |
|
if (opts.iconCls) { |
|
_23b.addClass("panel-with-icon"); |
|
$("<div class=\"panel-icon\"></div>").addClass(opts.iconCls).appendTo(_23a); |
|
} |
|
if (opts.halign == "left" || opts.halign == "right") { |
|
_23b.addClass("panel-title-" + opts.titleDirection); |
|
} |
|
var tool = $("<div class=\"panel-tool\"></div>").appendTo(_23a); |
|
tool._bind("click", function (e) { |
|
e.stopPropagation(); |
|
}); |
|
if (opts.tools) { |
|
if ($.isArray(opts.tools)) { |
|
$.map(opts.tools, function (t) { |
|
_23c(tool, t.iconCls, eval(t.handler)); |
|
}); |
|
} else { |
|
$(opts.tools).children().each(function () { |
|
$(this).addClass($(this).attr("iconCls")).addClass("panel-tool-a").appendTo(tool); |
|
}); |
|
} |
|
} |
|
if (opts.collapsible) { |
|
_23c(tool, "panel-tool-collapse", function () { |
|
if (opts.collapsed == true) { |
|
_25d(_233, true); |
|
} else { |
|
_24e(_233, true); |
|
} |
|
}); |
|
} |
|
if (opts.minimizable) { |
|
_23c(tool, "panel-tool-min", function () { |
|
_263(_233); |
|
}); |
|
} |
|
if (opts.maximizable) { |
|
_23c(tool, "panel-tool-max", function () { |
|
if (opts.maximized == true) { |
|
_266(_233); |
|
} else { |
|
_24d(_233); |
|
} |
|
}); |
|
} |
|
if (opts.closable) { |
|
_23c(tool, "panel-tool-close", function () { |
|
_24f(_233); |
|
}); |
|
} |
|
} |
|
_235.children("div.panel-body").removeClass("panel-body-noheader"); |
|
} |
|
}; |
|
function _23c(c, icon, _23d) { |
|
var a = $("<a href=\"javascript:;\"></a>").addClass(icon).appendTo(c); |
|
a._bind("click", _23d); |
|
}; |
|
function _237() { |
|
if (opts.footer) { |
|
$(opts.footer).addClass("panel-footer").appendTo(_235); |
|
$(_233).addClass("panel-body-nobottom"); |
|
} else { |
|
_235.children(".panel-footer").remove(); |
|
$(_233).removeClass("panel-body-nobottom"); |
|
} |
|
}; |
|
}; |
|
function _23e(_23f, _240) { |
|
var _241 = $.data(_23f, "panel"); |
|
var opts = _241.options; |
|
if (_242) { |
|
opts.queryParams = _240; |
|
} |
|
if (!opts.href) { |
|
return; |
|
} |
|
if (!_241.isLoaded || !opts.cache) { |
|
var _242 = $.extend({}, opts.queryParams); |
|
if (opts.onBeforeLoad.call(_23f, _242) == false) { |
|
return; |
|
} |
|
_241.isLoaded = false; |
|
if (opts.loadingMessage) { |
|
$(_23f).panel("clear"); |
|
$(_23f).html($("<div class=\"panel-loading\"></div>").html(opts.loadingMessage)); |
|
} |
|
opts.loader.call(_23f, _242, function (data) { |
|
var _243 = opts.extractor.call(_23f, data); |
|
$(_23f).panel("clear"); |
|
$(_23f).html(_243); |
|
$.parser.parse($(_23f)); |
|
opts.onLoad.apply(_23f, arguments); |
|
_241.isLoaded = true; |
|
}, function () { |
|
opts.onLoadError.apply(_23f, arguments); |
|
}); |
|
} |
|
}; |
|
function _244(_245) { |
|
var t = $(_245); |
|
t.find(".combo-f").each(function () { |
|
$(this).combo("destroy"); |
|
}); |
|
t.find(".m-btn").each(function () { |
|
$(this).menubutton("destroy"); |
|
}); |
|
t.find(".s-btn").each(function () { |
|
$(this).splitbutton("destroy"); |
|
}); |
|
t.find(".tooltip-f").each(function () { |
|
$(this).tooltip("destroy"); |
|
}); |
|
t.children("div").each(function () { |
|
$(this)._size("unfit"); |
|
}); |
|
t.empty(); |
|
}; |
|
function _246(_247) { |
|
$(_247).panel("doLayout", true); |
|
}; |
|
function _248(_249, _24a) { |
|
var _24b = $.data(_249, "panel"); |
|
var opts = _24b.options; |
|
var _24c = _24b.panel; |
|
if (_24a != true) { |
|
if (opts.onBeforeOpen.call(_249) == false) { |
|
return; |
|
} |
|
} |
|
_24c.stop(true, true); |
|
if ($.isFunction(opts.openAnimation)) { |
|
opts.openAnimation.call(_249, cb); |
|
} else { |
|
switch (opts.openAnimation) { |
|
case "slide": |
|
_24c.slideDown(opts.openDuration, cb); |
|
break; |
|
case "fade": |
|
_24c.fadeIn(opts.openDuration, cb); |
|
break; |
|
case "show": |
|
_24c.show(opts.openDuration, cb); |
|
break; |
|
default: |
|
_24c.show(); |
|
cb(); |
|
} |
|
} |
|
function cb() { |
|
opts.closed = false; |
|
opts.minimized = false; |
|
var tool = _24c.children(".panel-header").find("a.panel-tool-restore"); |
|
if (tool.length) { |
|
opts.maximized = true; |
|
} |
|
opts.onOpen.call(_249); |
|
if (opts.maximized == true) { |
|
opts.maximized = false; |
|
_24d(_249); |
|
} |
|
if (opts.collapsed == true) { |
|
opts.collapsed = false; |
|
_24e(_249); |
|
} |
|
if (!opts.collapsed) { |
|
if (opts.href && (!_24b.isLoaded || !opts.cache)) { |
|
_23e(_249); |
|
_246(_249); |
|
opts.doneLayout = true; |
|
} |
|
} |
|
if (!opts.doneLayout) { |
|
opts.doneLayout = true; |
|
_246(_249); |
|
} |
|
}; |
|
}; |
|
function _24f(_250, _251) { |
|
var _252 = $.data(_250, "panel"); |
|
var opts = _252.options; |
|
var _253 = _252.panel; |
|
if (_251 != true) { |
|
if (opts.onBeforeClose.call(_250) == false) { |
|
return; |
|
} |
|
} |
|
_253.find(".tooltip-f").each(function () { |
|
$(this).tooltip("hide"); |
|
}); |
|
_253.stop(true, true); |
|
_253._size("unfit"); |
|
if ($.isFunction(opts.closeAnimation)) { |
|
opts.closeAnimation.call(_250, cb); |
|
} else { |
|
switch (opts.closeAnimation) { |
|
case "slide": |
|
_253.slideUp(opts.closeDuration, cb); |
|
break; |
|
case "fade": |
|
_253.fadeOut(opts.closeDuration, cb); |
|
break; |
|
case "hide": |
|
_253.hide(opts.closeDuration, cb); |
|
break; |
|
default: |
|
_253.hide(); |
|
cb(); |
|
} |
|
} |
|
function cb() { |
|
opts.closed = true; |
|
opts.onClose.call(_250); |
|
}; |
|
}; |
|
function _254(_255, _256) { |
|
var _257 = $.data(_255, "panel"); |
|
var opts = _257.options; |
|
var _258 = _257.panel; |
|
if (_256 != true) { |
|
if (opts.onBeforeDestroy.call(_255) == false) { |
|
return; |
|
} |
|
} |
|
$(_255).panel("clear").panel("clear", "footer"); |
|
_217(_258); |
|
opts.onDestroy.call(_255); |
|
}; |
|
function _24e(_259, _25a) { |
|
var opts = $.data(_259, "panel").options; |
|
var _25b = $.data(_259, "panel").panel; |
|
var body = _25b.children(".panel-body"); |
|
var _25c = _25b.children(".panel-header"); |
|
var tool = _25c.find("a.panel-tool-collapse"); |
|
if (opts.collapsed == true) { |
|
return; |
|
} |
|
body.stop(true, true); |
|
if (opts.onBeforeCollapse.call(_259) == false) { |
|
return; |
|
} |
|
tool.addClass("panel-tool-expand"); |
|
if (_25a == true) { |
|
if (opts.halign == "left" || opts.halign == "right") { |
|
_25b.animate({ |
|
width: _25c._outerWidth() + _25b.children(".panel-footer")._outerWidth() |
|
}, function () { |
|
cb(); |
|
}); |
|
} else { |
|
body.slideUp("normal", function () { |
|
cb(); |
|
}); |
|
} |
|
} else { |
|
if (opts.halign == "left" || opts.halign == "right") { |
|
_25b._outerWidth(_25c._outerWidth() + _25b.children(".panel-footer")._outerWidth()); |
|
} |
|
cb(); |
|
} |
|
function cb() { |
|
body.hide(); |
|
opts.collapsed = true; |
|
opts.onCollapse.call(_259); |
|
}; |
|
}; |
|
function _25d(_25e, _25f) { |
|
var opts = $.data(_25e, "panel").options; |
|
var _260 = $.data(_25e, "panel").panel; |
|
var body = _260.children(".panel-body"); |
|
var tool = _260.children(".panel-header").find("a.panel-tool-collapse"); |
|
if (opts.collapsed == false) { |
|
return; |
|
} |
|
body.stop(true, true); |
|
if (opts.onBeforeExpand.call(_25e) == false) { |
|
return; |
|
} |
|
tool.removeClass("panel-tool-expand"); |
|
if (_25f == true) { |
|
if (opts.halign == "left" || opts.halign == "right") { |
|
body.show(); |
|
_260.animate({ |
|
width: opts.panelCssWidth |
|
}, function () { |
|
cb(); |
|
}); |
|
} else { |
|
body.slideDown("normal", function () { |
|
cb(); |
|
}); |
|
} |
|
} else { |
|
if (opts.halign == "left" || opts.halign == "right") { |
|
_260.css("width", opts.panelCssWidth); |
|
} |
|
cb(); |
|
} |
|
function cb() { |
|
body.show(); |
|
opts.collapsed = false; |
|
opts.onExpand.call(_25e); |
|
_23e(_25e); |
|
_246(_25e); |
|
}; |
|
}; |
|
function _24d(_261) { |
|
var opts = $.data(_261, "panel").options; |
|
var _262 = $.data(_261, "panel").panel; |
|
var tool = _262.children(".panel-header").find("a.panel-tool-max"); |
|
if (opts.maximized == true) { |
|
return; |
|
} |
|
tool.addClass("panel-tool-restore"); |
|
if (!$.data(_261, "panel").original) { |
|
$.data(_261, "panel").original = { |
|
width: opts.width, |
|
height: opts.height, |
|
left: opts.left, |
|
top: opts.top, |
|
fit: opts.fit |
|
}; |
|
} |
|
opts.left = 0; |
|
opts.top = 0; |
|
opts.fit = true; |
|
_218(_261); |
|
opts.minimized = false; |
|
opts.maximized = true; |
|
opts.onMaximize.call(_261); |
|
}; |
|
function _263(_264) { |
|
var opts = $.data(_264, "panel").options; |
|
var _265 = $.data(_264, "panel").panel; |
|
_265._size("unfit"); |
|
_265.hide(); |
|
opts.minimized = true; |
|
opts.maximized = false; |
|
opts.onMinimize.call(_264); |
|
}; |
|
function _266(_267) { |
|
var opts = $.data(_267, "panel").options; |
|
var _268 = $.data(_267, "panel").panel; |
|
var tool = _268.children(".panel-header").find("a.panel-tool-max"); |
|
if (opts.maximized == false) { |
|
return; |
|
} |
|
_268.show(); |
|
tool.removeClass("panel-tool-restore"); |
|
$.extend(opts, $.data(_267, "panel").original); |
|
_218(_267); |
|
opts.minimized = false; |
|
opts.maximized = false; |
|
$.data(_267, "panel").original = null; |
|
opts.onRestore.call(_267); |
|
}; |
|
function _269(_26a, _26b) { |
|
$.data(_26a, "panel").options.title = _26b; |
|
$(_26a).panel("header").find("div.panel-title").html(_26b); |
|
}; |
|
var _26c = null; |
|
$(window)._unbind(".panel")._bind("resize.panel", function () { |
|
if (_26c) { |
|
clearTimeout(_26c); |
|
} |
|
_26c = setTimeout(function () { |
|
var _26d = $("body.layout"); |
|
if (_26d.length) { |
|
_26d.layout("resize"); |
|
$("body").children(".easyui-fluid:visible").each(function () { |
|
$(this).triggerHandler("_resize"); |
|
}); |
|
} else { |
|
$("body").panel("doLayout"); |
|
} |
|
_26c = null; |
|
}, 100); |
|
}); |
|
$.fn.panel = function (_26e, _26f) { |
|
if (typeof _26e == "string") { |
|
return $.fn.panel.methods[_26e](this, _26f); |
|
} |
|
_26e = _26e || {}; |
|
return this.each(function () { |
|
var _270 = $.data(this, "panel"); |
|
var opts; |
|
if (_270) { |
|
opts = $.extend(_270.options, _26e); |
|
_270.isLoaded = false; |
|
} else { |
|
opts = $.extend({}, $.fn.panel.defaults, $.fn.panel.parseOptions(this), _26e); |
|
$(this).attr("title", ""); |
|
_270 = $.data(this, "panel", { |
|
options: opts, |
|
panel: _22e(this), |
|
isLoaded: false |
|
}); |
|
} |
|
_232(this); |
|
$(this).show(); |
|
if (opts.doSize == true) { |
|
_270.panel.css("display", "block"); |
|
_218(this); |
|
} |
|
if (opts.closed == true || opts.minimized == true) { |
|
_270.panel.hide(); |
|
} else { |
|
_248(this); |
|
} |
|
}); |
|
}; |
|
$.fn.panel.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "panel").options; |
|
}, |
|
panel: function (jq) { |
|
return $.data(jq[0], "panel").panel; |
|
}, |
|
header: function (jq) { |
|
return $.data(jq[0], "panel").panel.children(".panel-header"); |
|
}, |
|
footer: function (jq) { |
|
return jq.panel("panel").children(".panel-footer"); |
|
}, |
|
body: function (jq) { |
|
return $.data(jq[0], "panel").panel.children(".panel-body"); |
|
}, |
|
setTitle: function (jq, _271) { |
|
return jq.each(function () { |
|
_269(this, _271); |
|
}); |
|
}, |
|
open: function (jq, _272) { |
|
return jq.each(function () { |
|
_248(this, _272); |
|
}); |
|
}, |
|
close: function (jq, _273) { |
|
return jq.each(function () { |
|
_24f(this, _273); |
|
}); |
|
}, |
|
destroy: function (jq, _274) { |
|
return jq.each(function () { |
|
_254(this, _274); |
|
}); |
|
}, |
|
clear: function (jq, type) { |
|
return jq.each(function () { |
|
_244(type == "footer" ? $(this).panel("footer") : this); |
|
}); |
|
}, |
|
refresh: function (jq, href) { |
|
return jq.each(function () { |
|
var _275 = $.data(this, "panel"); |
|
_275.isLoaded = false; |
|
if (href) { |
|
if (typeof href == "string") { |
|
_275.options.href = href; |
|
} else { |
|
_275.options.queryParams = href; |
|
} |
|
} |
|
_23e(this); |
|
}); |
|
}, |
|
resize: function (jq, _276) { |
|
return jq.each(function () { |
|
_218(this, _276 || {}); |
|
}); |
|
}, |
|
doLayout: function (jq, all) { |
|
return jq.each(function () { |
|
_277(this, "body"); |
|
_277($(this).siblings(".panel-footer")[0], "footer"); |
|
function _277(_278, type) { |
|
if (!_278) { |
|
return; |
|
} |
|
var _279 = _278 == $("body")[0]; |
|
var s = $(_278).find("div.panel:visible,div.accordion:visible,div.tabs-container:visible,div.layout:visible,.easyui-fluid:visible").filter(function (_27a, el) { |
|
var p = $(el).parents(".panel-" + type + ":first"); |
|
return _279 ? p.length == 0 : p[0] == _278; |
|
}); |
|
s.each(function () { |
|
$(this).triggerHandler("_resize", [all || false]); |
|
}); |
|
}; |
|
}); |
|
}, |
|
move: function (jq, _27b) { |
|
return jq.each(function () { |
|
_229(this, _27b); |
|
}); |
|
}, |
|
maximize: function (jq) { |
|
return jq.each(function () { |
|
_24d(this); |
|
}); |
|
}, |
|
minimize: function (jq) { |
|
return jq.each(function () { |
|
_263(this); |
|
}); |
|
}, |
|
restore: function (jq) { |
|
return jq.each(function () { |
|
_266(this); |
|
}); |
|
}, |
|
collapse: function (jq, _27c) { |
|
return jq.each(function () { |
|
_24e(this, _27c); |
|
}); |
|
}, |
|
expand: function (jq, _27d) { |
|
return jq.each(function () { |
|
_25d(this, _27d); |
|
}); |
|
} |
|
}; |
|
$.fn.panel.parseOptions = function (_27e) { |
|
var t = $(_27e); |
|
var hh = t.children(".panel-header,header"); |
|
var ff = t.children(".panel-footer,footer"); |
|
return $.extend({}, $.parser.parseOptions(_27e, ["id", "width", "height", "left", "top", "title", "iconCls", "cls", "headerCls", "bodyCls", "tools", "href", "method", "header", "footer", "halign", "titleDirection", { |
|
cache: "boolean", |
|
fit: "boolean", |
|
border: "boolean", |
|
noheader: "boolean" |
|
}, { |
|
collapsible: "boolean", |
|
minimizable: "boolean", |
|
maximizable: "boolean" |
|
}, { |
|
closable: "boolean", |
|
collapsed: "boolean", |
|
minimized: "boolean", |
|
maximized: "boolean", |
|
closed: "boolean" |
|
}, "openAnimation", "closeAnimation", { |
|
openDuration: "number", |
|
closeDuration: "number" |
|
}, ]), { |
|
loadingMessage: (t.attr("loadingMessage") != undefined ? t.attr("loadingMessage") : undefined), |
|
header: (hh.length ? hh.removeClass("panel-header") : undefined), |
|
footer: (ff.length ? ff.removeClass("panel-footer") : undefined) |
|
}); |
|
}; |
|
$.fn.panel.defaults = { |
|
id: null, |
|
title: null, |
|
iconCls: null, |
|
width: "auto", |
|
height: "auto", |
|
left: null, |
|
top: null, |
|
cls: null, |
|
headerCls: null, |
|
bodyCls: null, |
|
style: {}, |
|
href: null, |
|
cache: true, |
|
fit: false, |
|
border: true, |
|
doSize: true, |
|
noheader: false, |
|
content: null, |
|
halign: "top", |
|
titleDirection: "down", |
|
collapsible: false, |
|
minimizable: false, |
|
maximizable: false, |
|
closable: false, |
|
collapsed: false, |
|
minimized: false, |
|
maximized: false, |
|
closed: false, |
|
openAnimation: false, |
|
openDuration: 400, |
|
closeAnimation: false, |
|
closeDuration: 400, |
|
tools: null, |
|
footer: null, |
|
header: null, |
|
queryParams: {}, |
|
method: "get", |
|
href: null, |
|
loadingMessage: "Loading...", |
|
loader: function (_27f, _280, _281) { |
|
var opts = $(this).panel("options"); |
|
if (!opts.href) { |
|
return false; |
|
} |
|
$.ajax({ |
|
type: opts.method, |
|
url: opts.href, |
|
cache: false, |
|
data: _27f, |
|
dataType: "html", |
|
success: function (data) { |
|
_280(data); |
|
}, |
|
error: function () { |
|
_281.apply(this, arguments); |
|
} |
|
}); |
|
}, |
|
extractor: function (data) { |
|
var _282 = /<body[^>]*>((.|[\n\r])*)<\/body>/im; |
|
var _283 = _282.exec(data); |
|
if (_283) { |
|
return _283[1]; |
|
} else { |
|
return data; |
|
} |
|
}, |
|
onBeforeLoad: function (_284) {}, |
|
onLoad: function () {}, |
|
onLoadError: function () {}, |
|
onBeforeOpen: function () {}, |
|
onOpen: function () {}, |
|
onBeforeClose: function () {}, |
|
onClose: function () {}, |
|
onBeforeDestroy: function () {}, |
|
onDestroy: function () {}, |
|
onResize: function (_285, _286) {}, |
|
onMove: function (left, top) {}, |
|
onMaximize: function () {}, |
|
onRestore: function () {}, |
|
onMinimize: function () {}, |
|
onBeforeCollapse: function () {}, |
|
onBeforeExpand: function () {}, |
|
onCollapse: function () {}, |
|
onExpand: function () {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function _287(_288, _289) { |
|
var _28a = $.data(_288, "window"); |
|
if (_289) { |
|
if (_289.left != null) { |
|
_28a.options.left = _289.left; |
|
} |
|
if (_289.top != null) { |
|
_28a.options.top = _289.top; |
|
} |
|
} |
|
$(_288).panel("move", _28a.options); |
|
if (_28a.shadow) { |
|
_28a.shadow.css({ |
|
left: _28a.options.left, |
|
top: _28a.options.top |
|
}); |
|
} |
|
}; |
|
function _28b(_28c, _28d) { |
|
var opts = $.data(_28c, "window").options; |
|
var pp = $(_28c).window("panel"); |
|
var _28e = pp._outerWidth(); |
|
if (opts.inline) { |
|
var _28f = pp.parent(); |
|
opts.left = Math.ceil((_28f.width() - _28e) / 2 + _28f.scrollLeft()); |
|
} else { |
|
var _290 = opts.fixed ? 0 : $(document).scrollLeft(); |
|
opts.left = Math.ceil(($(window)._outerWidth() - _28e) / 2 + _290); |
|
} |
|
if (_28d) { |
|
_287(_28c); |
|
} |
|
}; |
|
function _291(_292, _293) { |
|
var opts = $.data(_292, "window").options; |
|
var pp = $(_292).window("panel"); |
|
var _294 = pp._outerHeight(); |
|
if (opts.inline) { |
|
var _295 = pp.parent(); |
|
opts.top = Math.ceil((_295.height() - _294) / 2 + _295.scrollTop()); |
|
} else { |
|
var _296 = opts.fixed ? 0 : $(document).scrollTop(); |
|
opts.top = Math.ceil(($(window)._outerHeight() - _294) / 2 + _296); |
|
} |
|
if (_293) { |
|
_287(_292); |
|
} |
|
}; |
|
function _297(_298) { |
|
var _299 = $.data(_298, "window"); |
|
var opts = _299.options; |
|
var win = $(_298).panel($.extend({}, _299.options, { |
|
border: false, |
|
doSize: true, |
|
closed: true, |
|
cls: "window " + (!opts.border ? "window-thinborder window-noborder " : (opts.border == "thin" ? "window-thinborder " : "")) + (opts.cls || ""), |
|
headerCls: "window-header " + (opts.headerCls || ""), |
|
bodyCls: "window-body " + (opts.noheader ? "window-body-noheader " : " ") + (opts.bodyCls || ""), |
|
onBeforeDestroy: function () { |
|
if (opts.onBeforeDestroy.call(_298) == false) { |
|
return false; |
|
} |
|
if (_299.shadow) { |
|
_299.shadow.remove(); |
|
} |
|
if (_299.mask) { |
|
_299.mask.remove(); |
|
} |
|
}, |
|
onClose: function () { |
|
if (_299.shadow) { |
|
_299.shadow.hide(); |
|
} |
|
if (_299.mask) { |
|
_299.mask.hide(); |
|
} |
|
opts.onClose.call(_298); |
|
}, |
|
onOpen: function () { |
|
if (_299.mask) { |
|
_299.mask.css($.extend({ |
|
display: "block", |
|
zIndex: $.fn.window.defaults.zIndex++ |
|
}, $.fn.window.getMaskSize(_298))); |
|
} |
|
if (_299.shadow) { |
|
_299.shadow.css({ |
|
display: "block", |
|
position: (opts.fixed ? "fixed" : "absolute"), |
|
zIndex: $.fn.window.defaults.zIndex++, |
|
left: opts.left, |
|
top: opts.top, |
|
width: _299.window._outerWidth(), |
|
height: _299.window._outerHeight() |
|
}); |
|
} |
|
_299.window.css({ |
|
position: (opts.fixed ? "fixed" : "absolute"), |
|
zIndex: $.fn.window.defaults.zIndex++ |
|
}); |
|
opts.onOpen.call(_298); |
|
}, |
|
onResize: function (_29a, _29b) { |
|
var _29c = $(this).panel("options"); |
|
$.extend(opts, { |
|
width: _29c.width, |
|
height: _29c.height, |
|
left: _29c.left, |
|
top: _29c.top |
|
}); |
|
if (_299.shadow) { |
|
_299.shadow.css({ |
|
left: opts.left, |
|
top: opts.top, |
|
width: _299.window._outerWidth(), |
|
height: _299.window._outerHeight() |
|
}); |
|
} |
|
opts.onResize.call(_298, _29a, _29b); |
|
}, |
|
onMinimize: function () { |
|
if (_299.shadow) { |
|
_299.shadow.hide(); |
|
} |
|
if (_299.mask) { |
|
_299.mask.hide(); |
|
} |
|
_299.options.onMinimize.call(_298); |
|
}, |
|
onBeforeCollapse: function () { |
|
if (opts.onBeforeCollapse.call(_298) == false) { |
|
return false; |
|
} |
|
if (_299.shadow) { |
|
_299.shadow.hide(); |
|
} |
|
}, |
|
onExpand: function () { |
|
if (_299.shadow) { |
|
_299.shadow.show(); |
|
} |
|
opts.onExpand.call(_298); |
|
} |
|
})); |
|
_299.window = win.panel("panel"); |
|
if (_299.mask) { |
|
_299.mask.remove(); |
|
} |
|
if (opts.modal) { |
|
_299.mask = $("<div class=\"window-mask\" style=\"display:none\"></div>").insertAfter(_299.window); |
|
} |
|
if (_299.shadow) { |
|
_299.shadow.remove(); |
|
} |
|
if (opts.shadow) { |
|
_299.shadow = $("<div class=\"window-shadow\" style=\"display:none\"></div>").insertAfter(_299.window); |
|
} |
|
var _29d = opts.closed; |
|
if (opts.left == null) { |
|
_28b(_298); |
|
} |
|
if (opts.top == null) { |
|
_291(_298); |
|
} |
|
_287(_298); |
|
if (!_29d) { |
|
win.window("open"); |
|
} |
|
}; |
|
function _29e(left, top, _29f, _2a0) { |
|
var _2a1 = this; |
|
var _2a2 = $.data(_2a1, "window"); |
|
var opts = _2a2.options; |
|
if (!opts.constrain) { |
|
return {}; |
|
} |
|
if ($.isFunction(opts.constrain)) { |
|
return opts.constrain.call(_2a1, left, top, _29f, _2a0); |
|
} |
|
var win = $(_2a1).window("window"); |
|
var _2a3 = opts.inline ? win.parent() : $(window); |
|
var _2a4 = opts.fixed ? 0 : _2a3.scrollTop(); |
|
if (left < 0) { |
|
left = 0; |
|
} |
|
if (top < _2a4) { |
|
top = _2a4; |
|
} |
|
if (left + _29f > _2a3.width()) { |
|
if (_29f == win.outerWidth()) { |
|
left = _2a3.width() - _29f; |
|
} else { |
|
_29f = _2a3.width() - left; |
|
} |
|
} |
|
if (top - _2a4 + _2a0 > _2a3.height()) { |
|
if (_2a0 == win.outerHeight()) { |
|
top = _2a3.height() - _2a0 + _2a4; |
|
} else { |
|
_2a0 = _2a3.height() - top + _2a4; |
|
} |
|
} |
|
return { |
|
left: left, |
|
top: top, |
|
width: _29f, |
|
height: _2a0 |
|
}; |
|
}; |
|
function _2a5(_2a6) { |
|
var _2a7 = $.data(_2a6, "window"); |
|
var opts = _2a7.options; |
|
_2a7.window.draggable({ |
|
handle: ">div.panel-header>div.panel-title", |
|
disabled: _2a7.options.draggable == false, |
|
onBeforeDrag: function (e) { |
|
if (_2a7.mask) { |
|
_2a7.mask.css("z-index", $.fn.window.defaults.zIndex++); |
|
} |
|
if (_2a7.shadow) { |
|
_2a7.shadow.css("z-index", $.fn.window.defaults.zIndex++); |
|
} |
|
_2a7.window.css("z-index", $.fn.window.defaults.zIndex++); |
|
}, |
|
onStartDrag: function (e) { |
|
_2a8(e); |
|
}, |
|
onDrag: function (e) { |
|
_2a9(e); |
|
return false; |
|
}, |
|
onStopDrag: function (e) { |
|
_2aa(e, "move"); |
|
} |
|
}); |
|
_2a7.window.resizable({ |
|
disabled: _2a7.options.resizable == false, |
|
onStartResize: function (e) { |
|
_2a8(e); |
|
}, |
|
onResize: function (e) { |
|
_2a9(e); |
|
return false; |
|
}, |
|
onStopResize: function (e) { |
|
_2aa(e, "resize"); |
|
} |
|
}); |
|
function _2a8(e) { |
|
_2a7.window.css("position", opts.fixed ? "fixed" : "absolute"); |
|
if (_2a7.shadow) { |
|
_2a7.shadow.css("position", opts.fixed ? "fixed" : "absolute"); |
|
} |
|
if (_2a7.pmask) { |
|
_2a7.pmask.remove(); |
|
} |
|
_2a7.pmask = $("<div class=\"window-proxy-mask\"></div>").insertAfter(_2a7.window); |
|
_2a7.pmask.css({ |
|
display: "none", |
|
position: (opts.fixed ? "fixed" : "absolute"), |
|
zIndex: $.fn.window.defaults.zIndex++, |
|
left: e.data.left, |
|
top: e.data.top, |
|
width: _2a7.window._outerWidth(), |
|
height: _2a7.window._outerHeight() |
|
}); |
|
if (_2a7.proxy) { |
|
_2a7.proxy.remove(); |
|
} |
|
_2a7.proxy = $("<div class=\"window-proxy\"></div>").insertAfter(_2a7.window); |
|
_2a7.proxy.css({ |
|
display: "none", |
|
position: (opts.fixed ? "fixed" : "absolute"), |
|
zIndex: $.fn.window.defaults.zIndex++, |
|
left: e.data.left, |
|
top: e.data.top |
|
}); |
|
_2a7.proxy._outerWidth(e.data.width)._outerHeight(e.data.height); |
|
_2a7.proxy.hide(); |
|
setTimeout(function () { |
|
if (_2a7.pmask) { |
|
_2a7.pmask.show(); |
|
} |
|
if (_2a7.proxy) { |
|
_2a7.proxy.show(); |
|
} |
|
}, 500); |
|
}; |
|
function _2a9(e) { |
|
$.extend(e.data, _29e.call(_2a6, e.data.left, e.data.top, e.data.width, e.data.height)); |
|
_2a7.pmask.show(); |
|
_2a7.proxy.css({ |
|
display: "block", |
|
left: e.data.left, |
|
top: e.data.top |
|
}); |
|
_2a7.proxy._outerWidth(e.data.width); |
|
_2a7.proxy._outerHeight(e.data.height); |
|
}; |
|
function _2aa(e, _2ab) { |
|
_2a7.window.css("position", opts.fixed ? "fixed" : "absolute"); |
|
if (_2a7.shadow) { |
|
_2a7.shadow.css("position", opts.fixed ? "fixed" : "absolute"); |
|
} |
|
$.extend(e.data, _29e.call(_2a6, e.data.left, e.data.top, e.data.width + 0.1, e.data.height + 0.1)); |
|
$(_2a6).window(_2ab, e.data); |
|
_2a7.pmask.remove(); |
|
_2a7.pmask = null; |
|
_2a7.proxy.remove(); |
|
_2a7.proxy = null; |
|
}; |
|
}; |
|
$(function () { |
|
if (!$._positionFixed) { |
|
$(window).resize(function () { |
|
$("body>div.window-mask:visible").css({ |
|
width: "", |
|
height: "" |
|
}); |
|
setTimeout(function () { |
|
$("body>div.window-mask:visible").css($.fn.window.getMaskSize()); |
|
}, 50); |
|
}); |
|
} |
|
}); |
|
$.fn.window = function (_2ac, _2ad) { |
|
if (typeof _2ac == "string") { |
|
var _2ae = $.fn.window.methods[_2ac]; |
|
if (_2ae) { |
|
return _2ae(this, _2ad); |
|
} else { |
|
return this.panel(_2ac, _2ad); |
|
} |
|
} |
|
_2ac = _2ac || {}; |
|
return this.each(function () { |
|
var _2af = $.data(this, "window"); |
|
if (_2af) { |
|
$.extend(_2af.options, _2ac); |
|
} else { |
|
_2af = $.data(this, "window", { |
|
options: $.extend({}, $.fn.window.defaults, $.fn.window.parseOptions(this), _2ac) |
|
}); |
|
if (!_2af.options.inline) { |
|
document.body.appendChild(this); |
|
} |
|
} |
|
_297(this); |
|
_2a5(this); |
|
}); |
|
}; |
|
$.fn.window.methods = { |
|
options: function (jq) { |
|
var _2b0 = jq.panel("options"); |
|
var _2b1 = $.data(jq[0], "window").options; |
|
return $.extend(_2b1, { |
|
closed: _2b0.closed, |
|
collapsed: _2b0.collapsed, |
|
minimized: _2b0.minimized, |
|
maximized: _2b0.maximized |
|
}); |
|
}, |
|
window: function (jq) { |
|
return $.data(jq[0], "window").window; |
|
}, |
|
move: function (jq, _2b2) { |
|
return jq.each(function () { |
|
_287(this, _2b2); |
|
}); |
|
}, |
|
hcenter: function (jq) { |
|
return jq.each(function () { |
|
_28b(this, true); |
|
}); |
|
}, |
|
vcenter: function (jq) { |
|
return jq.each(function () { |
|
_291(this, true); |
|
}); |
|
}, |
|
center: function (jq) { |
|
return jq.each(function () { |
|
_28b(this); |
|
_291(this); |
|
_287(this); |
|
}); |
|
} |
|
}; |
|
$.fn.window.getMaskSize = function (_2b3) { |
|
var _2b4 = $(_2b3).data("window"); |
|
if (_2b4 && _2b4.options.inline) { |
|
return {}; |
|
} else { |
|
if ($._positionFixed) { |
|
return { |
|
position: "fixed" |
|
}; |
|
} else { |
|
return { |
|
width: $(document).width(), |
|
height: $(document).height() |
|
}; |
|
} |
|
} |
|
}; |
|
$.fn.window.parseOptions = function (_2b5) { |
|
return $.extend({}, $.fn.panel.parseOptions(_2b5), $.parser.parseOptions(_2b5, [{ |
|
draggable: "boolean", |
|
resizable: "boolean", |
|
shadow: "boolean", |
|
modal: "boolean", |
|
inline: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.window.defaults = $.extend({}, $.fn.panel.defaults, { |
|
zIndex: 9000, |
|
draggable: true, |
|
resizable: true, |
|
shadow: true, |
|
modal: false, |
|
border: true, |
|
inline: false, |
|
title: "New Window", |
|
collapsible: true, |
|
minimizable: true, |
|
maximizable: true, |
|
closable: true, |
|
closed: false, |
|
fixed: false, |
|
constrain: false |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _2b6(_2b7) { |
|
var opts = $.data(_2b7, "dialog").options; |
|
opts.inited = false; |
|
$(_2b7).window($.extend({}, opts, { |
|
onResize: function (w, h) { |
|
if (opts.inited) { |
|
_2bc(this); |
|
opts.onResize.call(this, w, h); |
|
} |
|
} |
|
})); |
|
var win = $(_2b7).window("window"); |
|
if (opts.toolbar) { |
|
if ($.isArray(opts.toolbar)) { |
|
$(_2b7).siblings("div.dialog-toolbar").remove(); |
|
var _2b8 = $("<div class=\"dialog-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").appendTo(win); |
|
var tr = _2b8.find("tr"); |
|
for (var i = 0; i < opts.toolbar.length; i++) { |
|
var btn = opts.toolbar[i]; |
|
if (btn == "-") { |
|
$("<td><div class=\"dialog-tool-separator\"></div></td>").appendTo(tr); |
|
} else { |
|
var td = $("<td></td>").appendTo(tr); |
|
var tool = $("<a href=\"javascript:;\"></a>").appendTo(td); |
|
tool[0].onclick = eval(btn.handler || function () {}); |
|
tool.linkbutton($.extend({}, btn, { |
|
plain: true |
|
})); |
|
} |
|
} |
|
} else { |
|
$(opts.toolbar).addClass("dialog-toolbar").appendTo(win); |
|
$(opts.toolbar).show(); |
|
} |
|
} else { |
|
$(_2b7).siblings("div.dialog-toolbar").remove(); |
|
} |
|
if (opts.buttons) { |
|
if ($.isArray(opts.buttons)) { |
|
$(_2b7).siblings("div.dialog-button").remove(); |
|
var _2b9 = $("<div class=\"dialog-button\"></div>").appendTo(win); |
|
for (var i = 0; i < opts.buttons.length; i++) { |
|
var p = opts.buttons[i]; |
|
var _2ba = $("<a href=\"javascript:;\"></a>").appendTo(_2b9); |
|
if (p.handler) { |
|
_2ba[0].onclick = p.handler; |
|
} |
|
_2ba.linkbutton(p); |
|
} |
|
} else { |
|
$(opts.buttons).addClass("dialog-button").appendTo(win); |
|
$(opts.buttons).show(); |
|
} |
|
} else { |
|
$(_2b7).siblings("div.dialog-button").remove(); |
|
} |
|
opts.inited = true; |
|
var _2bb = opts.closed; |
|
win.show(); |
|
$(_2b7).window("resize", {}); |
|
if (_2bb) { |
|
win.hide(); |
|
} |
|
}; |
|
function _2bc(_2bd, _2be) { |
|
var t = $(_2bd); |
|
var opts = t.dialog("options"); |
|
var _2bf = opts.noheader; |
|
var tb = t.siblings(".dialog-toolbar"); |
|
var bb = t.siblings(".dialog-button"); |
|
tb.insertBefore(_2bd).css({ |
|
borderTopWidth: (_2bf ? 1 : 0), |
|
top: (_2bf ? tb.length : 0) |
|
}); |
|
bb.insertAfter(_2bd); |
|
tb.add(bb)._outerWidth(t._outerWidth()).find(".easyui-fluid:visible").each(function () { |
|
$(this).triggerHandler("_resize"); |
|
}); |
|
var _2c0 = tb._outerHeight() + bb._outerHeight(); |
|
if (!isNaN(parseInt(opts.height))) { |
|
t._outerHeight(t._outerHeight() - _2c0); |
|
} else { |
|
var _2c1 = t._size("min-height"); |
|
if (_2c1) { |
|
t._size("min-height", _2c1 - _2c0); |
|
} |
|
var _2c2 = t._size("max-height"); |
|
if (_2c2) { |
|
t._size("max-height", _2c2 - _2c0); |
|
} |
|
} |
|
var _2c3 = $.data(_2bd, "window").shadow; |
|
if (_2c3) { |
|
var cc = t.panel("panel"); |
|
_2c3.css({ |
|
width: cc._outerWidth(), |
|
height: cc._outerHeight() |
|
}); |
|
} |
|
}; |
|
$.fn.dialog = function (_2c4, _2c5) { |
|
if (typeof _2c4 == "string") { |
|
var _2c6 = $.fn.dialog.methods[_2c4]; |
|
if (_2c6) { |
|
return _2c6(this, _2c5); |
|
} else { |
|
return this.window(_2c4, _2c5); |
|
} |
|
} |
|
_2c4 = _2c4 || {}; |
|
return this.each(function () { |
|
var _2c7 = $.data(this, "dialog"); |
|
if (_2c7) { |
|
$.extend(_2c7.options, _2c4); |
|
} else { |
|
$.data(this, "dialog", { |
|
options: $.extend({}, $.fn.dialog.defaults, $.fn.dialog.parseOptions(this), _2c4) |
|
}); |
|
} |
|
_2b6(this); |
|
}); |
|
}; |
|
$.fn.dialog.methods = { |
|
options: function (jq) { |
|
var _2c8 = $.data(jq[0], "dialog").options; |
|
var _2c9 = jq.panel("options"); |
|
$.extend(_2c8, { |
|
width: _2c9.width, |
|
height: _2c9.height, |
|
left: _2c9.left, |
|
top: _2c9.top, |
|
closed: _2c9.closed, |
|
collapsed: _2c9.collapsed, |
|
minimized: _2c9.minimized, |
|
maximized: _2c9.maximized |
|
}); |
|
return _2c8; |
|
}, |
|
dialog: function (jq) { |
|
return jq.window("window"); |
|
} |
|
}; |
|
$.fn.dialog.parseOptions = function (_2ca) { |
|
var t = $(_2ca); |
|
return $.extend({}, $.fn.window.parseOptions(_2ca), $.parser.parseOptions(_2ca, ["toolbar", "buttons"]), { |
|
toolbar: (t.children(".dialog-toolbar").length ? t.children(".dialog-toolbar").removeClass("dialog-toolbar") : undefined), |
|
buttons: (t.children(".dialog-button").length ? t.children(".dialog-button").removeClass("dialog-button") : undefined) |
|
}); |
|
}; |
|
$.fn.dialog.defaults = $.extend({}, $.fn.window.defaults, { |
|
title: "New Dialog", |
|
collapsible: false, |
|
minimizable: false, |
|
maximizable: false, |
|
resizable: false, |
|
toolbar: null, |
|
buttons: null |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _2cb() { |
|
$(document)._unbind(".messager")._bind("keydown.messager", function (e) { |
|
if (e.keyCode == 27) { |
|
$("body").children("div.messager-window").children("div.messager-body").each(function () { |
|
$(this).dialog("close"); |
|
}); |
|
} else { |
|
if (e.keyCode == 9) { |
|
var win = $("body").children("div.messager-window"); |
|
if (!win.length) { |
|
return; |
|
} |
|
var _2cc = win.find(".messager-input,.messager-button .l-btn"); |
|
for (var i = 0; i < _2cc.length; i++) { |
|
if ($(_2cc[i]).is(":focus")) { |
|
$(_2cc[i >= _2cc.length - 1 ? 0 : i + 1]).focus(); |
|
return false; |
|
} |
|
} |
|
} else { |
|
if (e.keyCode == 13) { |
|
var _2cd = $(e.target).closest("input.messager-input"); |
|
if (_2cd.length) { |
|
var dlg = _2cd.closest(".messager-body"); |
|
_2ce(dlg, _2cd.val()); |
|
} |
|
} |
|
} |
|
} |
|
}); |
|
}; |
|
function _2cf() { |
|
$(document)._unbind(".messager"); |
|
}; |
|
function _2d0(_2d1) { |
|
var opts = $.extend({}, $.messager.defaults, { |
|
modal: false, |
|
shadow: false, |
|
draggable: false, |
|
resizable: false, |
|
closed: true, |
|
style: { |
|
left: "", |
|
top: "", |
|
right: 0, |
|
zIndex: $.fn.window.defaults.zIndex++, |
|
bottom: -document.body.scrollTop - document.documentElement.scrollTop |
|
}, |
|
title: "", |
|
width: 300, |
|
height: 150, |
|
minHeight: 0, |
|
showType: "slide", |
|
showSpeed: 600, |
|
content: _2d1.msg, |
|
timeout: 4000 |
|
}, _2d1); |
|
var dlg = $("<div class=\"messager-body\"></div>").appendTo("body"); |
|
dlg.dialog($.extend({}, opts, { |
|
noheader: (opts.title ? false : true), |
|
openAnimation: (opts.showType), |
|
closeAnimation: (opts.showType == "show" ? "hide" : opts.showType), |
|
openDuration: opts.showSpeed, |
|
closeDuration: opts.showSpeed, |
|
onOpen: function () { |
|
dlg.dialog("dialog").hover(function () { |
|
if (opts.timer) { |
|
clearTimeout(opts.timer); |
|
} |
|
}, function () { |
|
_2d2(); |
|
}); |
|
_2d2(); |
|
function _2d2() { |
|
if (opts.timeout > 0) { |
|
opts.timer = setTimeout(function () { |
|
if (dlg.length && dlg.data("dialog")) { |
|
dlg.dialog("close"); |
|
} |
|
}, opts.timeout); |
|
} |
|
}; |
|
if (_2d1.onOpen) { |
|
_2d1.onOpen.call(this); |
|
} else { |
|
opts.onOpen.call(this); |
|
} |
|
}, |
|
onClose: function () { |
|
if (opts.timer) { |
|
clearTimeout(opts.timer); |
|
} |
|
if (_2d1.onClose) { |
|
_2d1.onClose.call(this); |
|
} else { |
|
opts.onClose.call(this); |
|
} |
|
dlg.dialog("destroy"); |
|
} |
|
})); |
|
dlg.dialog("dialog").css(opts.style); |
|
dlg.dialog("open"); |
|
return dlg; |
|
}; |
|
function _2d3(_2d4) { |
|
_2cb(); |
|
var dlg = $("<div class=\"messager-body\"></div>").appendTo("body"); |
|
dlg.dialog($.extend({}, _2d4, { |
|
noheader: (_2d4.title ? false : true), |
|
onClose: function () { |
|
_2cf(); |
|
if (_2d4.onClose) { |
|
_2d4.onClose.call(this); |
|
} |
|
dlg.dialog("destroy"); |
|
} |
|
})); |
|
var win = dlg.dialog("dialog").addClass("messager-window"); |
|
win.find(".dialog-button").addClass("messager-button").find("a:first").focus(); |
|
return dlg; |
|
}; |
|
function _2ce(dlg, _2d5) { |
|
var opts = dlg.dialog("options"); |
|
dlg.dialog("close"); |
|
opts.fn(_2d5); |
|
}; |
|
$.messager = { |
|
show: function (_2d6) { |
|
return _2d0(_2d6); |
|
}, |
|
alert: function (_2d7, msg, icon, fn) { |
|
var opts = typeof _2d7 == "object" ? _2d7 : { |
|
title: _2d7, |
|
msg: msg, |
|
icon: icon, |
|
fn: fn |
|
}; |
|
var cls = opts.icon ? "messager-icon messager-" + opts.icon : ""; |
|
opts = $.extend({}, $.messager.defaults, { |
|
content: "<div class=\"" + cls + "\"></div>" + "<div>" + opts.msg + "</div>" + "<div style=\"clear:both;\"></div>" |
|
}, opts); |
|
if (!opts.buttons) { |
|
opts.buttons = [{ |
|
text: opts.ok, |
|
onClick: function () { |
|
_2ce(dlg); |
|
} |
|
} |
|
]; |
|
} |
|
var dlg = _2d3(opts); |
|
return dlg; |
|
}, |
|
confirm: function (_2d8, msg, fn) { |
|
var opts = typeof _2d8 == "object" ? _2d8 : { |
|
title: _2d8, |
|
msg: msg, |
|
fn: fn |
|
}; |
|
opts = $.extend({}, $.messager.defaults, { |
|
content: "<div class=\"messager-icon messager-question\"></div>" + "<div>" + opts.msg + "</div>" + "<div style=\"clear:both;\"></div>" |
|
}, opts); |
|
if (!opts.buttons) { |
|
opts.buttons = [{ |
|
text: opts.ok, |
|
onClick: function () { |
|
_2ce(dlg, true); |
|
} |
|
}, { |
|
text: opts.cancel, |
|
onClick: function () { |
|
_2ce(dlg, false); |
|
} |
|
} |
|
]; |
|
} |
|
var dlg = _2d3(opts); |
|
return dlg; |
|
}, |
|
prompt: function (_2d9, msg, fn) { |
|
var opts = typeof _2d9 == "object" ? _2d9 : { |
|
title: _2d9, |
|
msg: msg, |
|
fn: fn |
|
}; |
|
opts = $.extend({}, $.messager.defaults, { |
|
content: "<div class=\"messager-icon messager-question\"></div>" + "<div>" + opts.msg + "</div>" + "<br>" + "<div style=\"clear:both;\"></div>" + "<div><input class=\"messager-input\" type=\"text\"></div>" |
|
}, opts); |
|
if (!opts.buttons) { |
|
opts.buttons = [{ |
|
text: opts.ok, |
|
onClick: function () { |
|
_2ce(dlg, dlg.find(".messager-input").val()); |
|
} |
|
}, { |
|
text: opts.cancel, |
|
onClick: function () { |
|
_2ce(dlg); |
|
} |
|
} |
|
]; |
|
} |
|
var dlg = _2d3(opts); |
|
dlg.find(".messager-input").focus(); |
|
return dlg; |
|
}, |
|
progress: function (_2da) { |
|
var _2db = { |
|
bar: function () { |
|
return $("body>div.messager-window").find("div.messager-p-bar"); |
|
}, |
|
close: function () { |
|
var dlg = $("body>div.messager-window>div.messager-body:has(div.messager-progress)"); |
|
if (dlg.length) { |
|
dlg.dialog("close"); |
|
} |
|
} |
|
}; |
|
if (typeof _2da == "string") { |
|
var _2dc = _2db[_2da]; |
|
return _2dc(); |
|
} |
|
_2da = _2da || {}; |
|
var opts = $.extend({}, { |
|
title: "", |
|
minHeight: 0, |
|
content: undefined, |
|
msg: "", |
|
text: undefined, |
|
interval: 300 |
|
}, _2da); |
|
var dlg = _2d3($.extend({}, $.messager.defaults, { |
|
content: "<div class=\"messager-progress\"><div class=\"messager-p-msg\">" + opts.msg + "</div><div class=\"messager-p-bar\"></div></div>", |
|
closable: false, |
|
doSize: false |
|
}, opts, { |
|
onClose: function () { |
|
if (this.timer) { |
|
clearInterval(this.timer); |
|
} |
|
if (_2da.onClose) { |
|
_2da.onClose.call(this); |
|
} else { |
|
$.messager.defaults.onClose.call(this); |
|
} |
|
} |
|
})); |
|
var bar = dlg.find("div.messager-p-bar"); |
|
bar.progressbar({ |
|
text: opts.text |
|
}); |
|
dlg.dialog("resize"); |
|
if (opts.interval) { |
|
dlg[0].timer = setInterval(function () { |
|
var v = bar.progressbar("getValue"); |
|
v += 10; |
|
if (v > 100) { |
|
v = 0; |
|
} |
|
bar.progressbar("setValue", v); |
|
}, opts.interval); |
|
} |
|
return dlg; |
|
} |
|
}; |
|
$.messager.defaults = $.extend({}, $.fn.dialog.defaults, { |
|
ok: "Ok", |
|
cancel: "Cancel", |
|
width: 300, |
|
height: "auto", |
|
minHeight: 150, |
|
modal: true, |
|
collapsible: false, |
|
minimizable: false, |
|
maximizable: false, |
|
resizable: false, |
|
fn: function () {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _2dd(_2de, _2df) { |
|
var _2e0 = $.data(_2de, "accordion"); |
|
var opts = _2e0.options; |
|
var _2e1 = _2e0.panels; |
|
var cc = $(_2de); |
|
var _2e2 = (opts.halign == "left" || opts.halign == "right"); |
|
cc.children(".panel-last").removeClass("panel-last"); |
|
cc.children(".panel:last").addClass("panel-last"); |
|
if (_2df) { |
|
$.extend(opts, { |
|
width: _2df.width, |
|
height: _2df.height |
|
}); |
|
} |
|
cc._size(opts); |
|
var _2e3 = 0; |
|
var _2e4 = "auto"; |
|
var _2e5 = cc.find(">.panel>.accordion-header"); |
|
if (_2e5.length) { |
|
if (_2e2) { |
|
$(_2e5[0]).next().panel("resize", { |
|
width: cc.width(), |
|
height: cc.height() |
|
}); |
|
_2e3 = $(_2e5[0])._outerWidth(); |
|
} else { |
|
_2e3 = $(_2e5[0]).css("height", "")._outerHeight(); |
|
} |
|
} |
|
if (!isNaN(parseInt(opts.height))) { |
|
if (_2e2) { |
|
_2e4 = cc.width() - _2e3 * _2e5.length; |
|
} else { |
|
_2e4 = cc.height() - _2e3 * _2e5.length; |
|
} |
|
} |
|
_2e6(true, _2e4 - _2e6(false)); |
|
function _2e6(_2e7, _2e8) { |
|
var _2e9 = 0; |
|
for (var i = 0; i < _2e1.length; i++) { |
|
var p = _2e1[i]; |
|
if (_2e2) { |
|
var h = p.panel("header")._outerWidth(_2e3); |
|
} else { |
|
var h = p.panel("header")._outerHeight(_2e3); |
|
} |
|
if (p.panel("options").collapsible == _2e7) { |
|
var _2ea = isNaN(_2e8) ? undefined : (_2e8 + _2e3 * h.length); |
|
if (_2e2) { |
|
p.panel("resize", { |
|
height: cc.height(), |
|
width: (_2e7 ? _2ea : undefined) |
|
}); |
|
_2e9 += p.panel("panel")._outerWidth() - _2e3 * h.length; |
|
} else { |
|
p.panel("resize", { |
|
width: cc.width(), |
|
height: (_2e7 ? _2ea : undefined) |
|
}); |
|
_2e9 += p.panel("panel").outerHeight() - _2e3 * h.length; |
|
} |
|
} |
|
} |
|
return _2e9; |
|
}; |
|
}; |
|
function _2eb(_2ec, _2ed, _2ee, all) { |
|
var _2ef = $.data(_2ec, "accordion").panels; |
|
var pp = []; |
|
for (var i = 0; i < _2ef.length; i++) { |
|
var p = _2ef[i]; |
|
if (_2ed) { |
|
if (p.panel("options")[_2ed] == _2ee) { |
|
pp.push(p); |
|
} |
|
} else { |
|
if (p[0] == $(_2ee)[0]) { |
|
return i; |
|
} |
|
} |
|
} |
|
if (_2ed) { |
|
return all ? pp : (pp.length ? pp[0] : null); |
|
} else { |
|
return -1; |
|
} |
|
}; |
|
function _2f0(_2f1) { |
|
return _2eb(_2f1, "collapsed", false, true); |
|
}; |
|
function _2f2(_2f3) { |
|
var pp = _2f0(_2f3); |
|
return pp.length ? pp[0] : null; |
|
}; |
|
function _2f4(_2f5, _2f6) { |
|
return _2eb(_2f5, null, _2f6); |
|
}; |
|
function _2f7(_2f8, _2f9) { |
|
var _2fa = $.data(_2f8, "accordion").panels; |
|
if (typeof _2f9 == "number") { |
|
if (_2f9 < 0 || _2f9 >= _2fa.length) { |
|
return null; |
|
} else { |
|
return _2fa[_2f9]; |
|
} |
|
} |
|
return _2eb(_2f8, "title", _2f9); |
|
}; |
|
function _2fb(_2fc) { |
|
var opts = $.data(_2fc, "accordion").options; |
|
var cc = $(_2fc); |
|
if (opts.border) { |
|
cc.removeClass("accordion-noborder"); |
|
} else { |
|
cc.addClass("accordion-noborder"); |
|
} |
|
}; |
|
function init(_2fd) { |
|
var _2fe = $.data(_2fd, "accordion"); |
|
var cc = $(_2fd); |
|
cc.addClass("accordion"); |
|
_2fe.panels = []; |
|
cc.children("div").each(function () { |
|
var opts = $.extend({}, $.parser.parseOptions(this), { |
|
selected: ($(this).attr("selected") ? true : undefined) |
|
}); |
|
var pp = $(this); |
|
_2fe.panels.push(pp); |
|
_300(_2fd, pp, opts); |
|
}); |
|
cc._bind("_resize", function (e, _2ff) { |
|
if ($(this).hasClass("easyui-fluid") || _2ff) { |
|
_2dd(_2fd); |
|
} |
|
return false; |
|
}); |
|
}; |
|
function _300(_301, pp, _302) { |
|
var opts = $.data(_301, "accordion").options; |
|
pp.panel($.extend({}, { |
|
collapsible: true, |
|
minimizable: false, |
|
maximizable: false, |
|
closable: false, |
|
doSize: false, |
|
collapsed: true, |
|
headerCls: "accordion-header", |
|
bodyCls: "accordion-body", |
|
halign: opts.halign |
|
}, _302, { |
|
onBeforeExpand: function () { |
|
if (_302.onBeforeExpand) { |
|
if (_302.onBeforeExpand.call(this) == false) { |
|
return false; |
|
} |
|
} |
|
if (!opts.multiple) { |
|
var all = $.grep(_2f0(_301), function (p) { |
|
return p.panel("options").collapsible; |
|
}); |
|
for (var i = 0; i < all.length; i++) { |
|
_30a(_301, _2f4(_301, all[i])); |
|
} |
|
} |
|
var _303 = $(this).panel("header"); |
|
_303.addClass("accordion-header-selected"); |
|
_303.find(".accordion-collapse").removeClass("accordion-expand"); |
|
}, |
|
onExpand: function () { |
|
$(_301).find(">.panel-last>.accordion-header").removeClass("accordion-header-border"); |
|
if (_302.onExpand) { |
|
_302.onExpand.call(this); |
|
} |
|
opts.onSelect.call(_301, $(this).panel("options").title, _2f4(_301, this)); |
|
}, |
|
onBeforeCollapse: function () { |
|
if (_302.onBeforeCollapse) { |
|
if (_302.onBeforeCollapse.call(this) == false) { |
|
return false; |
|
} |
|
} |
|
$(_301).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); |
|
var _304 = $(this).panel("header"); |
|
_304.removeClass("accordion-header-selected"); |
|
_304.find(".accordion-collapse").addClass("accordion-expand"); |
|
}, |
|
onCollapse: function () { |
|
if (isNaN(parseInt(opts.height))) { |
|
$(_301).find(">.panel-last>.accordion-header").removeClass("accordion-header-border"); |
|
} |
|
if (_302.onCollapse) { |
|
_302.onCollapse.call(this); |
|
} |
|
opts.onUnselect.call(_301, $(this).panel("options").title, _2f4(_301, this)); |
|
} |
|
})); |
|
var _305 = pp.panel("header"); |
|
var tool = _305.children("div.panel-tool"); |
|
tool.children("a.panel-tool-collapse").hide(); |
|
var t = $("<a href=\"javascript:;\"></a>").addClass("accordion-collapse accordion-expand").appendTo(tool); |
|
t._bind("click", function () { |
|
_306(pp); |
|
return false; |
|
}); |
|
pp.panel("options").collapsible ? t.show() : t.hide(); |
|
if (opts.halign == "left" || opts.halign == "right") { |
|
t.hide(); |
|
} |
|
_305._bind("click", function () { |
|
_306(pp); |
|
return false; |
|
}); |
|
function _306(p) { |
|
var _307 = p.panel("options"); |
|
if (_307.collapsible) { |
|
var _308 = _2f4(_301, p); |
|
if (_307.collapsed) { |
|
_309(_301, _308); |
|
} else { |
|
_30a(_301, _308); |
|
} |
|
} |
|
}; |
|
}; |
|
function _309(_30b, _30c) { |
|
var p = _2f7(_30b, _30c); |
|
if (!p) { |
|
return; |
|
} |
|
_30d(_30b); |
|
var opts = $.data(_30b, "accordion").options; |
|
p.panel("expand", opts.animate); |
|
}; |
|
function _30a(_30e, _30f) { |
|
var p = _2f7(_30e, _30f); |
|
if (!p) { |
|
return; |
|
} |
|
_30d(_30e); |
|
var opts = $.data(_30e, "accordion").options; |
|
p.panel("collapse", opts.animate); |
|
}; |
|
function _310(_311) { |
|
var opts = $.data(_311, "accordion").options; |
|
$(_311).find(">.panel-last>.accordion-header").addClass("accordion-header-border"); |
|
var p = _2eb(_311, "selected", true); |
|
if (p) { |
|
_312(_2f4(_311, p)); |
|
} else { |
|
_312(opts.selected); |
|
} |
|
function _312(_313) { |
|
var _314 = opts.animate; |
|
opts.animate = false; |
|
_309(_311, _313); |
|
opts.animate = _314; |
|
}; |
|
}; |
|
function _30d(_315) { |
|
var _316 = $.data(_315, "accordion").panels; |
|
for (var i = 0; i < _316.length; i++) { |
|
_316[i].stop(true, true); |
|
} |
|
}; |
|
function add(_317, _318) { |
|
var _319 = $.data(_317, "accordion"); |
|
var opts = _319.options; |
|
var _31a = _319.panels; |
|
if (_318.selected == undefined) { |
|
_318.selected = true; |
|
} |
|
_30d(_317); |
|
var pp = $("<div></div>").appendTo(_317); |
|
_31a.push(pp); |
|
_300(_317, pp, _318); |
|
_2dd(_317); |
|
opts.onAdd.call(_317, _318.title, _31a.length - 1); |
|
if (_318.selected) { |
|
_309(_317, _31a.length - 1); |
|
} |
|
}; |
|
function _31b(_31c, _31d) { |
|
var _31e = $.data(_31c, "accordion"); |
|
var opts = _31e.options; |
|
var _31f = _31e.panels; |
|
_30d(_31c); |
|
var _320 = _2f7(_31c, _31d); |
|
var _321 = _320.panel("options").title; |
|
var _322 = _2f4(_31c, _320); |
|
if (!_320) { |
|
return; |
|
} |
|
if (opts.onBeforeRemove.call(_31c, _321, _322) == false) { |
|
return; |
|
} |
|
_31f.splice(_322, 1); |
|
_320.panel("destroy"); |
|
if (_31f.length) { |
|
_2dd(_31c); |
|
var curr = _2f2(_31c); |
|
if (!curr) { |
|
_309(_31c, 0); |
|
} |
|
} |
|
opts.onRemove.call(_31c, _321, _322); |
|
}; |
|
$.fn.accordion = function (_323, _324) { |
|
if (typeof _323 == "string") { |
|
return $.fn.accordion.methods[_323](this, _324); |
|
} |
|
_323 = _323 || {}; |
|
return this.each(function () { |
|
var _325 = $.data(this, "accordion"); |
|
if (_325) { |
|
$.extend(_325.options, _323); |
|
} else { |
|
$.data(this, "accordion", { |
|
options: $.extend({}, $.fn.accordion.defaults, $.fn.accordion.parseOptions(this), _323), |
|
accordion: $(this).addClass("accordion"), |
|
panels: [] |
|
}); |
|
init(this); |
|
} |
|
_2fb(this); |
|
_2dd(this); |
|
_310(this); |
|
}); |
|
}; |
|
$.fn.accordion.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "accordion").options; |
|
}, |
|
panels: function (jq) { |
|
return $.data(jq[0], "accordion").panels; |
|
}, |
|
resize: function (jq, _326) { |
|
return jq.each(function () { |
|
_2dd(this, _326); |
|
}); |
|
}, |
|
getSelections: function (jq) { |
|
return _2f0(jq[0]); |
|
}, |
|
getSelected: function (jq) { |
|
return _2f2(jq[0]); |
|
}, |
|
getPanel: function (jq, _327) { |
|
return _2f7(jq[0], _327); |
|
}, |
|
getPanelIndex: function (jq, _328) { |
|
return _2f4(jq[0], _328); |
|
}, |
|
select: function (jq, _329) { |
|
return jq.each(function () { |
|
_309(this, _329); |
|
}); |
|
}, |
|
unselect: function (jq, _32a) { |
|
return jq.each(function () { |
|
_30a(this, _32a); |
|
}); |
|
}, |
|
add: function (jq, _32b) { |
|
return jq.each(function () { |
|
add(this, _32b); |
|
}); |
|
}, |
|
remove: function (jq, _32c) { |
|
return jq.each(function () { |
|
_31b(this, _32c); |
|
}); |
|
} |
|
}; |
|
$.fn.accordion.parseOptions = function (_32d) { |
|
var t = $(_32d); |
|
return $.extend({}, $.parser.parseOptions(_32d, ["width", "height", "halign", { |
|
fit: "boolean", |
|
border: "boolean", |
|
animate: "boolean", |
|
multiple: "boolean", |
|
selected: "number" |
|
} |
|
])); |
|
}; |
|
$.fn.accordion.defaults = { |
|
width: "auto", |
|
height: "auto", |
|
fit: false, |
|
border: true, |
|
animate: true, |
|
multiple: false, |
|
selected: 0, |
|
halign: "top", |
|
onSelect: function (_32e, _32f) {}, |
|
onUnselect: function (_330, _331) {}, |
|
onAdd: function (_332, _333) {}, |
|
onBeforeRemove: function (_334, _335) {}, |
|
onRemove: function (_336, _337) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function _338(c) { |
|
var w = 0; |
|
$(c).children().each(function () { |
|
w += $(this).outerWidth(true); |
|
}); |
|
return w; |
|
}; |
|
function _339(_33a) { |
|
var opts = $.data(_33a, "tabs").options; |
|
if (!opts.showHeader) { |
|
return; |
|
} |
|
var _33b = $(_33a).children("div.tabs-header"); |
|
var tool = _33b.children("div.tabs-tool:not(.tabs-tool-hidden)"); |
|
var _33c = _33b.children("div.tabs-scroller-left"); |
|
var _33d = _33b.children("div.tabs-scroller-right"); |
|
var wrap = _33b.children("div.tabs-wrap"); |
|
if (opts.tabPosition == "left" || opts.tabPosition == "right") { |
|
if (!tool.length) { |
|
return; |
|
} |
|
tool._outerWidth(_33b.width()); |
|
var _33e = { |
|
left: opts.tabPosition == "left" ? "auto" : 0, |
|
right: opts.tabPosition == "left" ? 0 : "auto", |
|
top: opts.toolPosition == "top" ? 0 : "auto", |
|
bottom: opts.toolPosition == "top" ? "auto" : 0 |
|
}; |
|
var _33f = { |
|
marginTop: opts.toolPosition == "top" ? tool.outerHeight() : 0 |
|
}; |
|
tool.css(_33e); |
|
wrap.css(_33f); |
|
return; |
|
} |
|
var _340 = _33b.outerHeight(); |
|
if (opts.plain) { |
|
_340 -= _340 - _33b.height(); |
|
} |
|
tool._outerHeight(_340); |
|
var _341 = _338(_33b.find("ul.tabs")); |
|
var _342 = _33b.width() - tool._outerWidth(); |
|
if (_341 > _342) { |
|
_33c.add(_33d).show()._outerHeight(_340); |
|
if (opts.toolPosition == "left") { |
|
tool.css({ |
|
left: _33c.outerWidth(), |
|
right: "" |
|
}); |
|
wrap.css({ |
|
marginLeft: _33c.outerWidth() + tool._outerWidth(), |
|
marginRight: _33d._outerWidth(), |
|
width: _342 - _33c.outerWidth() - _33d.outerWidth() |
|
}); |
|
} else { |
|
tool.css({ |
|
left: "", |
|
right: _33d.outerWidth() |
|
}); |
|
wrap.css({ |
|
marginLeft: _33c.outerWidth(), |
|
marginRight: _33d.outerWidth() + tool._outerWidth(), |
|
width: _342 - _33c.outerWidth() - _33d.outerWidth() |
|
}); |
|
} |
|
} else { |
|
_33c.add(_33d).hide(); |
|
if (opts.toolPosition == "left") { |
|
tool.css({ |
|
left: 0, |
|
right: "" |
|
}); |
|
wrap.css({ |
|
marginLeft: tool._outerWidth(), |
|
marginRight: 0, |
|
width: _342 |
|
}); |
|
} else { |
|
tool.css({ |
|
left: "", |
|
right: 0 |
|
}); |
|
wrap.css({ |
|
marginLeft: 0, |
|
marginRight: tool._outerWidth(), |
|
width: _342 |
|
}); |
|
} |
|
} |
|
}; |
|
function _343(_344) { |
|
var opts = $.data(_344, "tabs").options; |
|
var _345 = $(_344).children("div.tabs-header"); |
|
if (opts.tools) { |
|
if (typeof opts.tools == "string") { |
|
$(opts.tools).addClass("tabs-tool").appendTo(_345); |
|
$(opts.tools).show(); |
|
} else { |
|
_345.children("div.tabs-tool").remove(); |
|
var _346 = $("<div class=\"tabs-tool\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"height:100%\"><tr></tr></table></div>").appendTo(_345); |
|
var tr = _346.find("tr"); |
|
for (var i = 0; i < opts.tools.length; i++) { |
|
var td = $("<td></td>").appendTo(tr); |
|
var tool = $("<a href=\"javascript:;\"></a>").appendTo(td); |
|
tool[0].onclick = eval(opts.tools[i].handler || function () {}); |
|
tool.linkbutton($.extend({}, opts.tools[i], { |
|
plain: true |
|
})); |
|
} |
|
} |
|
} else { |
|
_345.children("div.tabs-tool").remove(); |
|
} |
|
}; |
|
function _347(_348, _349) { |
|
var _34a = $.data(_348, "tabs"); |
|
var opts = _34a.options; |
|
var cc = $(_348); |
|
if (!opts.doSize) { |
|
return; |
|
} |
|
if (_349) { |
|
$.extend(opts, { |
|
width: _349.width, |
|
height: _349.height |
|
}); |
|
} |
|
cc._size(opts); |
|
var _34b = cc.children("div.tabs-header"); |
|
var _34c = cc.children("div.tabs-panels"); |
|
var wrap = _34b.find("div.tabs-wrap"); |
|
var ul = wrap.find(".tabs"); |
|
ul.children("li").removeClass("tabs-first tabs-last"); |
|
ul.children("li:first").addClass("tabs-first"); |
|
ul.children("li:last").addClass("tabs-last"); |
|
if (opts.tabPosition == "left" || opts.tabPosition == "right") { |
|
_34b._outerWidth(opts.showHeader ? opts.headerWidth : 0); |
|
_34c._outerWidth(cc.width() - _34b.outerWidth()); |
|
_34b.add(_34c)._size("height", isNaN(parseInt(opts.height)) ? "" : cc.height()); |
|
wrap._outerWidth(_34b.width()); |
|
ul._outerWidth(wrap.width()).css("height", ""); |
|
} else { |
|
_34b.children("div.tabs-scroller-left,div.tabs-scroller-right,div.tabs-tool:not(.tabs-tool-hidden)").css("display", opts.showHeader ? "block" : "none"); |
|
_34b._outerWidth(cc.width()).css("height", ""); |
|
if (opts.showHeader) { |
|
_34b.css("background-color", ""); |
|
wrap.css("height", ""); |
|
} else { |
|
_34b.css("background-color", "transparent"); |
|
_34b._outerHeight(0); |
|
wrap._outerHeight(0); |
|
} |
|
ul._outerHeight(opts.tabHeight).css("width", ""); |
|
ul._outerHeight(ul.outerHeight() - ul.height() - 1 + opts.tabHeight).css("width", ""); |
|
_34c._size("height", isNaN(parseInt(opts.height)) ? "" : (cc.height() - _34b.outerHeight())); |
|
_34c._size("width", cc.width()); |
|
} |
|
if (_34a.tabs.length) { |
|
var d1 = ul.outerWidth(true) - ul.width(); |
|
var li = ul.children("li:first"); |
|
var d2 = li.outerWidth(true) - li.width(); |
|
var _34d = _34b.width() - _34b.children(".tabs-tool:not(.tabs-tool-hidden)")._outerWidth(); |
|
var _34e = Math.floor((_34d - d1 - d2 * _34a.tabs.length) / _34a.tabs.length); |
|
$.map(_34a.tabs, function (p) { |
|
_34f(p, (opts.justified && $.inArray(opts.tabPosition, ["top", "bottom"]) >= 0) ? _34e : undefined); |
|
}); |
|
if (opts.justified && $.inArray(opts.tabPosition, ["top", "bottom"]) >= 0) { |
|
var _350 = _34d - d1 - _338(ul); |
|
_34f(_34a.tabs[_34a.tabs.length - 1], _34e + _350); |
|
} |
|
} |
|
_339(_348); |
|
function _34f(p, _351) { |
|
var _352 = p.panel("options"); |
|
var p_t = _352.tab.find(".tabs-inner"); |
|
var _351 = _351 ? _351 : (parseInt(_352.tabWidth || opts.tabWidth || undefined)); |
|
if (_351) { |
|
p_t._outerWidth(_351); |
|
} else { |
|
p_t.css("width", ""); |
|
} |
|
p_t._outerHeight(opts.tabHeight); |
|
p_t.css("lineHeight", p_t.height() + "px"); |
|
p_t.find(".easyui-fluid:visible").triggerHandler("_resize"); |
|
}; |
|
}; |
|
function _353(_354) { |
|
var opts = $.data(_354, "tabs").options; |
|
var tab = _355(_354); |
|
if (tab) { |
|
var _356 = $(_354).children("div.tabs-panels"); |
|
var _357 = opts.width == "auto" ? "auto" : _356.width(); |
|
var _358 = opts.height == "auto" ? "auto" : _356.height(); |
|
tab.panel("resize", { |
|
width: _357, |
|
height: _358 |
|
}); |
|
} |
|
}; |
|
function _359(_35a) { |
|
var tabs = $.data(_35a, "tabs").tabs; |
|
var cc = $(_35a).addClass("tabs-container"); |
|
var _35b = $("<div class=\"tabs-panels\"></div>").insertBefore(cc); |
|
cc.children("div").each(function () { |
|
_35b[0].appendChild(this); |
|
}); |
|
cc[0].appendChild(_35b[0]); |
|
$("<div class=\"tabs-header\">" + "<div class=\"tabs-scroller-left\"></div>" + "<div class=\"tabs-scroller-right\"></div>" + "<div class=\"tabs-wrap\">" + "<ul class=\"tabs\"></ul>" + "</div>" + "</div>").prependTo(_35a); |
|
cc.children("div.tabs-panels").children("div").each(function (i) { |
|
var opts = $.extend({}, $.parser.parseOptions(this), { |
|
disabled: ($(this).attr("disabled") ? true : undefined), |
|
selected: ($(this).attr("selected") ? true : undefined) |
|
}); |
|
_368(_35a, opts, $(this)); |
|
}); |
|
cc.children("div.tabs-header").find(".tabs-scroller-left, .tabs-scroller-right")._bind("mouseenter", function () { |
|
$(this).addClass("tabs-scroller-over"); |
|
})._bind("mouseleave", function () { |
|
$(this).removeClass("tabs-scroller-over"); |
|
}); |
|
cc._bind("_resize", function (e, _35c) { |
|
if ($(this).hasClass("easyui-fluid") || _35c) { |
|
_347(_35a); |
|
_353(_35a); |
|
} |
|
return false; |
|
}); |
|
}; |
|
function _35d(_35e) { |
|
var _35f = $.data(_35e, "tabs"); |
|
var opts = _35f.options; |
|
$(_35e).children("div.tabs-header")._unbind()._bind("click", function (e) { |
|
if ($(e.target).hasClass("tabs-scroller-left")) { |
|
$(_35e).tabs("scrollBy", -opts.scrollIncrement); |
|
} else { |
|
if ($(e.target).hasClass("tabs-scroller-right")) { |
|
$(_35e).tabs("scrollBy", opts.scrollIncrement); |
|
} else { |
|
var li = $(e.target).closest("li"); |
|
if (li.hasClass("tabs-disabled")) { |
|
return false; |
|
} |
|
var a = $(e.target).closest(".tabs-close"); |
|
if (a.length) { |
|
_382(_35e, _360(li)); |
|
} else { |
|
if (li.length) { |
|
var _361 = _360(li); |
|
var _362 = _35f.tabs[_361].panel("options"); |
|
if (_362.collapsible) { |
|
_362.closed ? _379(_35e, _361) : _399(_35e, _361); |
|
} else { |
|
_379(_35e, _361); |
|
} |
|
} |
|
} |
|
return false; |
|
} |
|
} |
|
})._bind("contextmenu", function (e) { |
|
var li = $(e.target).closest("li"); |
|
if (li.hasClass("tabs-disabled")) { |
|
return; |
|
} |
|
if (li.length) { |
|
opts.onContextMenu.call(_35e, e, li.find("span.tabs-title").html(), _360(li)); |
|
} |
|
}); |
|
function _360(li) { |
|
var _363 = 0; |
|
li.parent().children("li").each(function (i) { |
|
if (li[0] == this) { |
|
_363 = i; |
|
return false; |
|
} |
|
}); |
|
return _363; |
|
}; |
|
}; |
|
function _364(_365) { |
|
var opts = $.data(_365, "tabs").options; |
|
var _366 = $(_365).children("div.tabs-header"); |
|
var _367 = $(_365).children("div.tabs-panels"); |
|
_366.removeClass("tabs-header-top tabs-header-bottom tabs-header-left tabs-header-right"); |
|
_367.removeClass("tabs-panels-top tabs-panels-bottom tabs-panels-left tabs-panels-right"); |
|
if (opts.tabPosition == "top") { |
|
_366.insertBefore(_367); |
|
} else { |
|
if (opts.tabPosition == "bottom") { |
|
_366.insertAfter(_367); |
|
_366.addClass("tabs-header-bottom"); |
|
_367.addClass("tabs-panels-top"); |
|
} else { |
|
if (opts.tabPosition == "left") { |
|
_366.addClass("tabs-header-left"); |
|
_367.addClass("tabs-panels-right"); |
|
} else { |
|
if (opts.tabPosition == "right") { |
|
_366.addClass("tabs-header-right"); |
|
_367.addClass("tabs-panels-left"); |
|
} |
|
} |
|
} |
|
} |
|
if (opts.plain == true) { |
|
_366.addClass("tabs-header-plain"); |
|
} else { |
|
_366.removeClass("tabs-header-plain"); |
|
} |
|
_366.removeClass("tabs-header-narrow").addClass(opts.narrow ? "tabs-header-narrow" : ""); |
|
var tabs = _366.find(".tabs"); |
|
tabs.removeClass("tabs-pill").addClass(opts.pill ? "tabs-pill" : ""); |
|
tabs.removeClass("tabs-narrow").addClass(opts.narrow ? "tabs-narrow" : ""); |
|
tabs.removeClass("tabs-justified").addClass(opts.justified ? "tabs-justified" : ""); |
|
if (opts.border == true) { |
|
_366.removeClass("tabs-header-noborder"); |
|
_367.removeClass("tabs-panels-noborder"); |
|
} else { |
|
_366.addClass("tabs-header-noborder"); |
|
_367.addClass("tabs-panels-noborder"); |
|
} |
|
opts.doSize = true; |
|
}; |
|
function _368(_369, _36a, pp) { |
|
_36a = _36a || {}; |
|
var _36b = $.data(_369, "tabs"); |
|
var tabs = _36b.tabs; |
|
if (_36a.index == undefined || _36a.index > tabs.length) { |
|
_36a.index = tabs.length; |
|
} |
|
if (_36a.index < 0) { |
|
_36a.index = 0; |
|
} |
|
var ul = $(_369).children("div.tabs-header").find("ul.tabs"); |
|
var _36c = $(_369).children("div.tabs-panels"); |
|
var tab = $("<li>" + "<span class=\"tabs-inner\">" + "<span class=\"tabs-title\"></span>" + "<span class=\"tabs-icon\"></span>" + "</span>" + "</li>"); |
|
if (!pp) { |
|
pp = $("<div></div>"); |
|
} |
|
if (_36a.index >= tabs.length) { |
|
tab.appendTo(ul); |
|
pp.appendTo(_36c); |
|
tabs.push(pp); |
|
} else { |
|
tab.insertBefore(ul.children("li:eq(" + _36a.index + ")")); |
|
pp.insertBefore(_36c.children("div.panel:eq(" + _36a.index + ")")); |
|
tabs.splice(_36a.index, 0, pp); |
|
} |
|
pp.panel($.extend({}, _36a, { |
|
tab: tab, |
|
border: false, |
|
noheader: true, |
|
closed: true, |
|
doSize: false, |
|
iconCls: (_36a.icon ? _36a.icon : undefined), |
|
onLoad: function () { |
|
if (_36a.onLoad) { |
|
_36a.onLoad.apply(this, arguments); |
|
} |
|
_36b.options.onLoad.call(_369, $(this)); |
|
}, |
|
onBeforeOpen: function () { |
|
if (_36a.onBeforeOpen) { |
|
if (_36a.onBeforeOpen.call(this) == false) { |
|
return false; |
|
} |
|
} |
|
var p = $(_369).tabs("getSelected"); |
|
if (p) { |
|
if (p[0] != this) { |
|
$(_369).tabs("unselect", _374(_369, p)); |
|
p = $(_369).tabs("getSelected"); |
|
if (p) { |
|
return false; |
|
} |
|
} else { |
|
_353(_369); |
|
return false; |
|
} |
|
} |
|
var _36d = $(this).panel("options"); |
|
_36d.tab.addClass("tabs-selected"); |
|
var wrap = $(_369).find(">div.tabs-header>div.tabs-wrap"); |
|
var left = _36d.tab.position().left; |
|
var _36e = left + _36d.tab.outerWidth(); |
|
if (left < 0 || _36e > wrap.width()) { |
|
var _36f = left - (wrap.width() - _36d.tab.width()) / 2; |
|
$(_369).tabs("scrollBy", _36f); |
|
} else { |
|
$(_369).tabs("scrollBy", 0); |
|
} |
|
var _370 = $(this).panel("panel"); |
|
_370.css("display", "block"); |
|
_353(_369); |
|
_370.css("display", "none"); |
|
}, |
|
onOpen: function () { |
|
if (_36a.onOpen) { |
|
_36a.onOpen.call(this); |
|
} |
|
var _371 = $(this).panel("options"); |
|
var _372 = _374(_369, this); |
|
_36b.selectHis.push(_372); |
|
_36b.options.onSelect.call(_369, _371.title, _372); |
|
}, |
|
onBeforeClose: function () { |
|
if (_36a.onBeforeClose) { |
|
if (_36a.onBeforeClose.call(this) == false) { |
|
return false; |
|
} |
|
} |
|
$(this).panel("options").tab.removeClass("tabs-selected"); |
|
}, |
|
onClose: function () { |
|
if (_36a.onClose) { |
|
_36a.onClose.call(this); |
|
} |
|
var _373 = $(this).panel("options"); |
|
_36b.options.onUnselect.call(_369, _373.title, _374(_369, this)); |
|
} |
|
})); |
|
$(_369).tabs("update", { |
|
tab: pp, |
|
options: pp.panel("options"), |
|
type: "header" |
|
}); |
|
}; |
|
function _375(_376, _377) { |
|
var _378 = $.data(_376, "tabs"); |
|
var opts = _378.options; |
|
if (_377.selected == undefined) { |
|
_377.selected = true; |
|
} |
|
_368(_376, _377); |
|
opts.onAdd.call(_376, _377.title, _377.index); |
|
if (_377.selected) { |
|
_379(_376, _377.index); |
|
} |
|
}; |
|
function _37a(_37b, _37c) { |
|
_37c.type = _37c.type || "all"; |
|
var _37d = $.data(_37b, "tabs").selectHis; |
|
var pp = _37c.tab; |
|
var opts = pp.panel("options"); |
|
var _37e = opts.title; |
|
$.extend(opts, _37c.options, { |
|
iconCls: (_37c.options.icon ? _37c.options.icon : undefined) |
|
}); |
|
if (_37c.type == "all" || _37c.type == "body") { |
|
pp.panel(); |
|
} |
|
if (_37c.type == "all" || _37c.type == "header") { |
|
var tab = opts.tab; |
|
if (opts.header) { |
|
tab.find(".tabs-inner").html($(opts.header)); |
|
} else { |
|
var _37f = tab.find("span.tabs-title"); |
|
var _380 = tab.find("span.tabs-icon"); |
|
_37f.html(opts.title); |
|
_380.attr("class", "tabs-icon"); |
|
tab.find(".tabs-close").remove(); |
|
if (opts.closable) { |
|
_37f.addClass("tabs-closable"); |
|
$("<span class=\"tabs-close\"></span>").appendTo(tab); |
|
} else { |
|
_37f.removeClass("tabs-closable"); |
|
} |
|
if (opts.iconCls) { |
|
_37f.addClass("tabs-with-icon"); |
|
_380.addClass(opts.iconCls); |
|
} else { |
|
_37f.removeClass("tabs-with-icon"); |
|
} |
|
if (opts.tools) { |
|
var _381 = tab.find("span.tabs-p-tool"); |
|
if (!_381.length) { |
|
var _381 = $("<span class=\"tabs-p-tool\"></span>").insertAfter(tab.find(".tabs-inner")); |
|
} |
|
if ($.isArray(opts.tools)) { |
|
_381.empty(); |
|
for (var i = 0; i < opts.tools.length; i++) { |
|
var t = $("<a href=\"javascript:;\"></a>").appendTo(_381); |
|
t.addClass(opts.tools[i].iconCls); |
|
if (opts.tools[i].handler) { |
|
t._bind("click", { |
|
handler: opts.tools[i].handler |
|
}, function (e) { |
|
if ($(this).parents("li").hasClass("tabs-disabled")) { |
|
return; |
|
} |
|
e.data.handler.call(this); |
|
}); |
|
} |
|
} |
|
} else { |
|
$(opts.tools).children().appendTo(_381); |
|
} |
|
var pr = _381.children().length * 12; |
|
if (opts.closable) { |
|
pr += 8; |
|
_381.css("right", ""); |
|
} else { |
|
pr -= 3; |
|
_381.css("right", "5px"); |
|
} |
|
_37f.css("padding-right", pr + "px"); |
|
} else { |
|
tab.find("span.tabs-p-tool").remove(); |
|
_37f.css("padding-right", ""); |
|
} |
|
} |
|
} |
|
if (opts.disabled) { |
|
opts.tab.addClass("tabs-disabled"); |
|
} else { |
|
opts.tab.removeClass("tabs-disabled"); |
|
} |
|
_347(_37b); |
|
$.data(_37b, "tabs").options.onUpdate.call(_37b, opts.title, _374(_37b, pp)); |
|
}; |
|
function _382(_383, _384) { |
|
var _385 = $.data(_383, "tabs"); |
|
var opts = _385.options; |
|
var tabs = _385.tabs; |
|
var _386 = _385.selectHis; |
|
if (!_387(_383, _384)) { |
|
return; |
|
} |
|
var tab = _388(_383, _384); |
|
var _389 = tab.panel("options").title; |
|
var _38a = _374(_383, tab); |
|
if (opts.onBeforeClose.call(_383, _389, _38a) == false) { |
|
return; |
|
} |
|
var tab = _388(_383, _384, true); |
|
tab.panel("options").tab.remove(); |
|
tab.panel("destroy"); |
|
opts.onClose.call(_383, _389, _38a); |
|
_347(_383); |
|
var his = []; |
|
for (var i = 0; i < _386.length; i++) { |
|
var _38b = _386[i]; |
|
if (_38b != _38a) { |
|
his.push(_38b > _38a ? _38b - 1 : _38b); |
|
} |
|
} |
|
_385.selectHis = his; |
|
var _38c = $(_383).tabs("getSelected"); |
|
if (!_38c && his.length) { |
|
_38a = _385.selectHis.pop(); |
|
$(_383).tabs("select", _38a); |
|
} |
|
}; |
|
function _388(_38d, _38e, _38f) { |
|
var tabs = $.data(_38d, "tabs").tabs; |
|
var tab = null; |
|
if (typeof _38e == "number") { |
|
if (_38e >= 0 && _38e < tabs.length) { |
|
tab = tabs[_38e]; |
|
if (_38f) { |
|
tabs.splice(_38e, 1); |
|
} |
|
} |
|
} else { |
|
var tmp = $("<span></span>"); |
|
for (var i = 0; i < tabs.length; i++) { |
|
var p = tabs[i]; |
|
tmp.html(p.panel("options").title); |
|
var _390 = tmp.text(); |
|
tmp.html(_38e); |
|
_38e = tmp.text(); |
|
if (_390 == _38e) { |
|
tab = p; |
|
if (_38f) { |
|
tabs.splice(i, 1); |
|
} |
|
break; |
|
} |
|
} |
|
tmp.remove(); |
|
} |
|
return tab; |
|
}; |
|
function _374(_391, tab) { |
|
var tabs = $.data(_391, "tabs").tabs; |
|
for (var i = 0; i < tabs.length; i++) { |
|
if (tabs[i][0] == $(tab)[0]) { |
|
return i; |
|
} |
|
} |
|
return -1; |
|
}; |
|
function _355(_392) { |
|
var tabs = $.data(_392, "tabs").tabs; |
|
for (var i = 0; i < tabs.length; i++) { |
|
var tab = tabs[i]; |
|
if (tab.panel("options").tab.hasClass("tabs-selected")) { |
|
return tab; |
|
} |
|
} |
|
return null; |
|
}; |
|
function _393(_394) { |
|
var _395 = $.data(_394, "tabs"); |
|
var tabs = _395.tabs; |
|
for (var i = 0; i < tabs.length; i++) { |
|
var opts = tabs[i].panel("options"); |
|
if (opts.selected && !opts.disabled) { |
|
_379(_394, i); |
|
return; |
|
} |
|
} |
|
_379(_394, _395.options.selected); |
|
}; |
|
function _379(_396, _397) { |
|
var p = _388(_396, _397); |
|
if (p && !p.is(":visible")) { |
|
_398(_396); |
|
if (!p.panel("options").disabled) { |
|
p.panel("open"); |
|
} |
|
} |
|
}; |
|
function _399(_39a, _39b) { |
|
var p = _388(_39a, _39b); |
|
if (p && p.is(":visible")) { |
|
_398(_39a); |
|
p.panel("close"); |
|
} |
|
}; |
|
function _398(_39c) { |
|
$(_39c).children("div.tabs-panels").each(function () { |
|
$(this).stop(true, true); |
|
}); |
|
}; |
|
function _387(_39d, _39e) { |
|
return _388(_39d, _39e) != null; |
|
}; |
|
function _39f(_3a0, _3a1) { |
|
var opts = $.data(_3a0, "tabs").options; |
|
opts.showHeader = _3a1; |
|
$(_3a0).tabs("resize"); |
|
}; |
|
function _3a2(_3a3, _3a4) { |
|
var tool = $(_3a3).find(">.tabs-header>.tabs-tool"); |
|
if (_3a4) { |
|
tool.removeClass("tabs-tool-hidden").show(); |
|
} else { |
|
tool.addClass("tabs-tool-hidden").hide(); |
|
} |
|
$(_3a3).tabs("resize").tabs("scrollBy", 0); |
|
}; |
|
$.fn.tabs = function (_3a5, _3a6) { |
|
if (typeof _3a5 == "string") { |
|
return $.fn.tabs.methods[_3a5](this, _3a6); |
|
} |
|
_3a5 = _3a5 || {}; |
|
return this.each(function () { |
|
var _3a7 = $.data(this, "tabs"); |
|
if (_3a7) { |
|
$.extend(_3a7.options, _3a5); |
|
} else { |
|
$.data(this, "tabs", { |
|
options: $.extend({}, $.fn.tabs.defaults, $.fn.tabs.parseOptions(this), _3a5), |
|
tabs: [], |
|
selectHis: [] |
|
}); |
|
_359(this); |
|
} |
|
_343(this); |
|
_364(this); |
|
_347(this); |
|
_35d(this); |
|
_393(this); |
|
}); |
|
}; |
|
$.fn.tabs.methods = { |
|
options: function (jq) { |
|
var cc = jq[0]; |
|
var opts = $.data(cc, "tabs").options; |
|
var s = _355(cc); |
|
opts.selected = s ? _374(cc, s) : -1; |
|
return opts; |
|
}, |
|
tabs: function (jq) { |
|
return $.data(jq[0], "tabs").tabs; |
|
}, |
|
resize: function (jq, _3a8) { |
|
return jq.each(function () { |
|
_347(this, _3a8); |
|
_353(this); |
|
}); |
|
}, |
|
add: function (jq, _3a9) { |
|
return jq.each(function () { |
|
_375(this, _3a9); |
|
}); |
|
}, |
|
close: function (jq, _3aa) { |
|
return jq.each(function () { |
|
_382(this, _3aa); |
|
}); |
|
}, |
|
getTab: function (jq, _3ab) { |
|
return _388(jq[0], _3ab); |
|
}, |
|
getTabIndex: function (jq, tab) { |
|
return _374(jq[0], tab); |
|
}, |
|
getSelected: function (jq) { |
|
return _355(jq[0]); |
|
}, |
|
select: function (jq, _3ac) { |
|
return jq.each(function () { |
|
_379(this, _3ac); |
|
}); |
|
}, |
|
unselect: function (jq, _3ad) { |
|
return jq.each(function () { |
|
_399(this, _3ad); |
|
}); |
|
}, |
|
exists: function (jq, _3ae) { |
|
return _387(jq[0], _3ae); |
|
}, |
|
update: function (jq, _3af) { |
|
return jq.each(function () { |
|
_37a(this, _3af); |
|
}); |
|
}, |
|
enableTab: function (jq, _3b0) { |
|
return jq.each(function () { |
|
var opts = $(this).tabs("getTab", _3b0).panel("options"); |
|
opts.tab.removeClass("tabs-disabled"); |
|
opts.disabled = false; |
|
}); |
|
}, |
|
disableTab: function (jq, _3b1) { |
|
return jq.each(function () { |
|
var opts = $(this).tabs("getTab", _3b1).panel("options"); |
|
opts.tab.addClass("tabs-disabled"); |
|
opts.disabled = true; |
|
}); |
|
}, |
|
showHeader: function (jq) { |
|
return jq.each(function () { |
|
_39f(this, true); |
|
}); |
|
}, |
|
hideHeader: function (jq) { |
|
return jq.each(function () { |
|
_39f(this, false); |
|
}); |
|
}, |
|
showTool: function (jq) { |
|
return jq.each(function () { |
|
_3a2(this, true); |
|
}); |
|
}, |
|
hideTool: function (jq) { |
|
return jq.each(function () { |
|
_3a2(this, false); |
|
}); |
|
}, |
|
scrollBy: function (jq, _3b2) { |
|
return jq.each(function () { |
|
var opts = $(this).tabs("options"); |
|
var wrap = $(this).find(">div.tabs-header>div.tabs-wrap"); |
|
var pos = Math.min(wrap._scrollLeft() + _3b2, _3b3()); |
|
wrap.animate({ |
|
scrollLeft: pos |
|
}, opts.scrollDuration); |
|
function _3b3() { |
|
var w = 0; |
|
var ul = wrap.children("ul"); |
|
ul.children("li").each(function () { |
|
w += $(this).outerWidth(true); |
|
}); |
|
return w - wrap.width() + (ul.outerWidth() - ul.width()); |
|
}; |
|
}); |
|
} |
|
}; |
|
$.fn.tabs.parseOptions = function (_3b4) { |
|
return $.extend({}, $.parser.parseOptions(_3b4, ["tools", "toolPosition", "tabPosition", { |
|
fit: "boolean", |
|
border: "boolean", |
|
plain: "boolean" |
|
}, { |
|
headerWidth: "number", |
|
tabWidth: "number", |
|
tabHeight: "number", |
|
selected: "number" |
|
}, { |
|
showHeader: "boolean", |
|
justified: "boolean", |
|
narrow: "boolean", |
|
pill: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.tabs.defaults = { |
|
width: "auto", |
|
height: "auto", |
|
headerWidth: 150, |
|
tabWidth: "auto", |
|
tabHeight: 32, |
|
selected: 0, |
|
showHeader: true, |
|
plain: false, |
|
fit: false, |
|
border: true, |
|
justified: false, |
|
narrow: false, |
|
pill: false, |
|
tools: null, |
|
toolPosition: "right", |
|
tabPosition: "top", |
|
scrollIncrement: 100, |
|
scrollDuration: 400, |
|
onLoad: function (_3b5) {}, |
|
onSelect: function (_3b6, _3b7) {}, |
|
onUnselect: function (_3b8, _3b9) {}, |
|
onBeforeClose: function (_3ba, _3bb) {}, |
|
onClose: function (_3bc, _3bd) {}, |
|
onAdd: function (_3be, _3bf) {}, |
|
onUpdate: function (_3c0, _3c1) {}, |
|
onContextMenu: function (e, _3c2, _3c3) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
var _3c4 = false; |
|
function _3c5(_3c6, _3c7) { |
|
var _3c8 = $.data(_3c6, "layout"); |
|
var opts = _3c8.options; |
|
var _3c9 = _3c8.panels; |
|
var cc = $(_3c6); |
|
if (_3c7) { |
|
$.extend(opts, { |
|
width: _3c7.width, |
|
height: _3c7.height |
|
}); |
|
} |
|
if (_3c6.tagName.toLowerCase() == "body") { |
|
cc._size("fit"); |
|
} else { |
|
cc._size(opts); |
|
} |
|
var cpos = { |
|
top: 0, |
|
left: 0, |
|
width: cc.width(), |
|
height: cc.height() |
|
}; |
|
_3ca(_3cb(_3c9.expandNorth) ? _3c9.expandNorth : _3c9.north, "n"); |
|
_3ca(_3cb(_3c9.expandSouth) ? _3c9.expandSouth : _3c9.south, "s"); |
|
_3cc(_3cb(_3c9.expandEast) ? _3c9.expandEast : _3c9.east, "e"); |
|
_3cc(_3cb(_3c9.expandWest) ? _3c9.expandWest : _3c9.west, "w"); |
|
_3c9.center.panel("resize", cpos); |
|
function _3ca(pp, type) { |
|
if (!pp.length || !_3cb(pp)) { |
|
return; |
|
} |
|
var opts = pp.panel("options"); |
|
pp.panel("resize", { |
|
width: cc.width(), |
|
height: opts.height |
|
}); |
|
var _3cd = pp.panel("panel").outerHeight(); |
|
pp.panel("move", { |
|
left: 0, |
|
top: (type == "n" ? 0 : cc.height() - _3cd) |
|
}); |
|
cpos.height -= _3cd; |
|
if (type == "n") { |
|
cpos.top += _3cd; |
|
if (!opts.split && opts.border) { |
|
cpos.top--; |
|
} |
|
} |
|
if (!opts.split && opts.border) { |
|
cpos.height++; |
|
} |
|
}; |
|
function _3cc(pp, type) { |
|
if (!pp.length || !_3cb(pp)) { |
|
return; |
|
} |
|
var opts = pp.panel("options"); |
|
pp.panel("resize", { |
|
width: opts.width, |
|
height: cpos.height |
|
}); |
|
var _3ce = pp.panel("panel").outerWidth(); |
|
pp.panel("move", { |
|
left: (type == "e" ? cc.width() - _3ce : 0), |
|
top: cpos.top |
|
}); |
|
cpos.width -= _3ce; |
|
if (type == "w") { |
|
cpos.left += _3ce; |
|
if (!opts.split && opts.border) { |
|
cpos.left--; |
|
} |
|
} |
|
if (!opts.split && opts.border) { |
|
cpos.width++; |
|
} |
|
}; |
|
}; |
|
function init(_3cf) { |
|
var cc = $(_3cf); |
|
cc.addClass("layout"); |
|
function _3d0(el) { |
|
var _3d1 = $.fn.layout.parsePanelOptions(el); |
|
if ("north,south,east,west,center".indexOf(_3d1.region) >= 0) { |
|
_3d4(_3cf, _3d1, el); |
|
} |
|
}; |
|
var opts = cc.layout("options"); |
|
var _3d2 = opts.onAdd; |
|
opts.onAdd = function () {}; |
|
cc.find(">div,>form>div").each(function () { |
|
_3d0(this); |
|
}); |
|
opts.onAdd = _3d2; |
|
cc.append("<div class=\"layout-split-proxy-h\"></div><div class=\"layout-split-proxy-v\"></div>"); |
|
cc._bind("_resize", function (e, _3d3) { |
|
if ($(this).hasClass("easyui-fluid") || _3d3) { |
|
_3c5(_3cf); |
|
} |
|
return false; |
|
}); |
|
}; |
|
function _3d4(_3d5, _3d6, el) { |
|
_3d6.region = _3d6.region || "center"; |
|
var _3d7 = $.data(_3d5, "layout").panels; |
|
var cc = $(_3d5); |
|
var dir = _3d6.region; |
|
if (_3d7[dir].length) { |
|
return; |
|
} |
|
var pp = $(el); |
|
if (!pp.length) { |
|
pp = $("<div></div>").appendTo(cc); |
|
} |
|
var _3d8 = $.extend({}, $.fn.layout.paneldefaults, { |
|
width: (pp.length ? parseInt(pp[0].style.width) || pp.outerWidth() : "auto"), |
|
height: (pp.length ? parseInt(pp[0].style.height) || pp.outerHeight() : "auto"), |
|
doSize: false, |
|
collapsible: true, |
|
onOpen: function () { |
|
var tool = $(this).panel("header").children("div.panel-tool"); |
|
tool.children("a.panel-tool-collapse").hide(); |
|
var _3d9 = { |
|
north: "up", |
|
south: "down", |
|
east: "right", |
|
west: "left" |
|
}; |
|
if (!_3d9[dir]) { |
|
return; |
|
} |
|
var _3da = "layout-button-" + _3d9[dir]; |
|
var t = tool.children("a." + _3da); |
|
if (!t.length) { |
|
t = $("<a href=\"javascript:;\"></a>").addClass(_3da).appendTo(tool); |
|
t._bind("click", { |
|
dir: dir |
|
}, function (e) { |
|
_3f1(_3d5, e.data.dir); |
|
return false; |
|
}); |
|
} |
|
$(this).panel("options").collapsible ? t.show() : t.hide(); |
|
} |
|
}, _3d6, { |
|
cls: ((_3d6.cls || "") + " layout-panel layout-panel-" + dir), |
|
bodyCls: ((_3d6.bodyCls || "") + " layout-body") |
|
}); |
|
pp.panel(_3d8); |
|
_3d7[dir] = pp; |
|
var _3db = { |
|
north: "s", |
|
south: "n", |
|
east: "w", |
|
west: "e" |
|
}; |
|
var _3dc = pp.panel("panel"); |
|
if (pp.panel("options").split) { |
|
_3dc.addClass("layout-split-" + dir); |
|
} |
|
_3dc.resizable($.extend({}, { |
|
handles: (_3db[dir] || ""), |
|
disabled: (!pp.panel("options").split), |
|
onStartResize: function (e) { |
|
_3c4 = true; |
|
if (dir == "north" || dir == "south") { |
|
var _3dd = $(">div.layout-split-proxy-v", _3d5); |
|
} else { |
|
var _3dd = $(">div.layout-split-proxy-h", _3d5); |
|
} |
|
var top = 0, |
|
left = 0, |
|
_3de = 0, |
|
_3df = 0; |
|
var pos = { |
|
display: "block" |
|
}; |
|
if (dir == "north") { |
|
pos.top = parseInt(_3dc.css("top")) + _3dc.outerHeight() - _3dd.height(); |
|
pos.left = parseInt(_3dc.css("left")); |
|
pos.width = _3dc.outerWidth(); |
|
pos.height = _3dd.height(); |
|
} else { |
|
if (dir == "south") { |
|
pos.top = parseInt(_3dc.css("top")); |
|
pos.left = parseInt(_3dc.css("left")); |
|
pos.width = _3dc.outerWidth(); |
|
pos.height = _3dd.height(); |
|
} else { |
|
if (dir == "east") { |
|
pos.top = parseInt(_3dc.css("top")) || 0; |
|
pos.left = parseInt(_3dc.css("left")) || 0; |
|
pos.width = _3dd.width(); |
|
pos.height = _3dc.outerHeight(); |
|
} else { |
|
if (dir == "west") { |
|
pos.top = parseInt(_3dc.css("top")) || 0; |
|
pos.left = _3dc.outerWidth() - _3dd.width(); |
|
pos.width = _3dd.width(); |
|
pos.height = _3dc.outerHeight(); |
|
} |
|
} |
|
} |
|
} |
|
_3dd.css(pos); |
|
$("<div class=\"layout-mask\"></div>").css({ |
|
left: 0, |
|
top: 0, |
|
width: cc.width(), |
|
height: cc.height() |
|
}).appendTo(cc); |
|
}, |
|
onResize: function (e) { |
|
if (dir == "north" || dir == "south") { |
|
var _3e0 = _3e1(this); |
|
$(this).resizable("options").maxHeight = _3e0; |
|
var _3e2 = $(">div.layout-split-proxy-v", _3d5); |
|
var top = dir == "north" ? e.data.height - _3e2.height() : $(_3d5).height() - e.data.height; |
|
_3e2.css("top", top); |
|
} else { |
|
var _3e3 = _3e1(this); |
|
$(this).resizable("options").maxWidth = _3e3; |
|
var _3e2 = $(">div.layout-split-proxy-h", _3d5); |
|
var left = dir == "west" ? e.data.width - _3e2.width() : $(_3d5).width() - e.data.width; |
|
_3e2.css("left", left); |
|
} |
|
return false; |
|
}, |
|
onStopResize: function (e) { |
|
cc.children("div.layout-split-proxy-v,div.layout-split-proxy-h").hide(); |
|
pp.panel("resize", e.data); |
|
_3c5(_3d5); |
|
_3c4 = false; |
|
cc.find(">div.layout-mask").remove(); |
|
} |
|
}, _3d6)); |
|
cc.layout("options").onAdd.call(_3d5, dir); |
|
function _3e1(p) { |
|
var _3e4 = "expand" + dir.substring(0, 1).toUpperCase() + dir.substring(1); |
|
var _3e5 = _3d7["center"]; |
|
var _3e6 = (dir == "north" || dir == "south") ? "minHeight" : "minWidth"; |
|
var _3e7 = (dir == "north" || dir == "south") ? "maxHeight" : "maxWidth"; |
|
var _3e8 = (dir == "north" || dir == "south") ? "_outerHeight" : "_outerWidth"; |
|
var _3e9 = $.parser.parseValue(_3e7, _3d7[dir].panel("options")[_3e7], $(_3d5)); |
|
var _3ea = $.parser.parseValue(_3e6, _3e5.panel("options")[_3e6], $(_3d5)); |
|
var _3eb = _3e5.panel("panel")[_3e8]() - _3ea; |
|
if (_3cb(_3d7[_3e4])) { |
|
_3eb += _3d7[_3e4][_3e8]() - 1; |
|
} else { |
|
_3eb += $(p)[_3e8](); |
|
} |
|
if (_3eb > _3e9) { |
|
_3eb = _3e9; |
|
} |
|
return _3eb; |
|
}; |
|
}; |
|
function _3ec(_3ed, _3ee) { |
|
var _3ef = $.data(_3ed, "layout").panels; |
|
if (_3ef[_3ee].length) { |
|
_3ef[_3ee].panel("destroy"); |
|
_3ef[_3ee] = $(); |
|
var _3f0 = "expand" + _3ee.substring(0, 1).toUpperCase() + _3ee.substring(1); |
|
if (_3ef[_3f0]) { |
|
_3ef[_3f0].panel("destroy"); |
|
_3ef[_3f0] = undefined; |
|
} |
|
$(_3ed).layout("options").onRemove.call(_3ed, _3ee); |
|
} |
|
}; |
|
function _3f1(_3f2, _3f3, _3f4) { |
|
if (_3f4 == undefined) { |
|
_3f4 = "normal"; |
|
} |
|
var _3f5 = $.data(_3f2, "layout"); |
|
var _3f6 = _3f5.panels; |
|
var p = _3f6[_3f3]; |
|
var _3f7 = p.panel("options"); |
|
if (_3f7.onBeforeCollapse.call(p) == false) { |
|
return; |
|
} |
|
var _3f8 = "expand" + _3f3.substring(0, 1).toUpperCase() + _3f3.substring(1); |
|
if (!_3f6[_3f8]) { |
|
_3f6[_3f8] = _3f9(_3f3); |
|
var ep = _3f6[_3f8].panel("panel"); |
|
if (!_3f7.expandMode) { |
|
ep.css("cursor", "default"); |
|
} else { |
|
ep._bind("click", function () { |
|
if (_3f7.expandMode == "dock") { |
|
_406(_3f2, _3f3); |
|
} else { |
|
p.panel("expand", false).panel("open"); |
|
var _3fa = _3fb(); |
|
p.panel("resize", _3fa.collapse); |
|
p.panel("panel")._unbind(".layout")._bind("mouseleave.layout", { |
|
region: _3f3 |
|
}, function (e) { |
|
var that = this; |
|
_3f5.collapseTimer = setTimeout(function () { |
|
$(that).stop(true, true); |
|
if (_3c4 == true) { |
|
return; |
|
} |
|
if ($("body>div.combo-p>div.combo-panel:visible").length) { |
|
return; |
|
} |
|
_3f1(_3f2, e.data.region); |
|
}, _3f5.options.collapseDelay); |
|
}); |
|
p.panel("panel").animate(_3fa.expand, function () { |
|
$(_3f2).layout("options").onExpand.call(_3f2, _3f3); |
|
}); |
|
} |
|
return false; |
|
}); |
|
} |
|
} |
|
var _3fc = _3fb(); |
|
if (!_3cb(_3f6[_3f8])) { |
|
_3f6.center.panel("resize", _3fc.resizeC); |
|
} |
|
p.panel("panel").animate(_3fc.collapse, _3f4, function () { |
|
p.panel("collapse", false).panel("close"); |
|
_3f6[_3f8].panel("open").panel("resize", _3fc.expandP); |
|
$(this)._unbind(".layout"); |
|
$(_3f2).layout("options").onCollapse.call(_3f2, _3f3); |
|
}); |
|
function _3f9(dir) { |
|
var _3fd = { |
|
"east": "left", |
|
"west": "right", |
|
"north": "down", |
|
"south": "up" |
|
}; |
|
var isns = (_3f7.region == "north" || _3f7.region == "south"); |
|
var icon = "layout-button-" + _3fd[dir]; |
|
var p = $("<div></div>").appendTo(_3f2); |
|
p.panel($.extend({}, $.fn.layout.paneldefaults, { |
|
cls: ("layout-expand layout-expand-" + dir), |
|
title: " ", |
|
titleDirection: _3f7.titleDirection, |
|
iconCls: (_3f7.hideCollapsedContent ? null : _3f7.iconCls), |
|
closed: true, |
|
minWidth: 0, |
|
minHeight: 0, |
|
doSize: false, |
|
region: _3f7.region, |
|
collapsedSize: _3f7.collapsedSize, |
|
noheader: (!isns && _3f7.hideExpandTool), |
|
tools: ((isns && _3f7.hideExpandTool) ? null : [{ |
|
iconCls: icon, |
|
handler: function () { |
|
_406(_3f2, _3f3); |
|
return false; |
|
} |
|
} |
|
]), |
|
onResize: function () { |
|
var _3fe = $(this).children(".layout-expand-title"); |
|
if (_3fe.length) { |
|
var icon = $(this).children(".panel-icon"); |
|
var _3ff = icon.length > 0 ? (icon._outerHeight() + 2) : 0; |
|
_3fe._outerWidth($(this).height() - _3ff); |
|
var left = ($(this).width() - Math.min(_3fe._outerWidth(), _3fe._outerHeight())) / 2; |
|
var top = Math.max(_3fe._outerWidth(), _3fe._outerHeight()); |
|
if (_3fe.hasClass("layout-expand-title-down")) { |
|
left += Math.min(_3fe._outerWidth(), _3fe._outerHeight()); |
|
top = 0; |
|
} |
|
top += _3ff; |
|
_3fe.css({ |
|
left: (left + "px"), |
|
top: (top + "px") |
|
}); |
|
} |
|
} |
|
})); |
|
if (!_3f7.hideCollapsedContent) { |
|
var _400 = typeof _3f7.collapsedContent == "function" ? _3f7.collapsedContent.call(p[0], _3f7.title) : _3f7.collapsedContent; |
|
isns ? p.panel("setTitle", _400) : p.html(_400); |
|
} |
|
p.panel("panel").hover(function () { |
|
$(this).addClass("layout-expand-over"); |
|
}, function () { |
|
$(this).removeClass("layout-expand-over"); |
|
}); |
|
return p; |
|
}; |
|
function _3fb() { |
|
var cc = $(_3f2); |
|
var _401 = _3f6.center.panel("options"); |
|
var _402 = _3f7.collapsedSize; |
|
if (_3f3 == "east") { |
|
var _403 = p.panel("panel")._outerWidth(); |
|
var _404 = _401.width + _403 - _402; |
|
if (_3f7.split || !_3f7.border) { |
|
_404++; |
|
} |
|
return { |
|
resizeC: { |
|
width: _404 |
|
}, |
|
expand: { |
|
left: cc.width() - _403 |
|
}, |
|
expandP: { |
|
top: _401.top, |
|
left: cc.width() - _402, |
|
width: _402, |
|
height: _401.height |
|
}, |
|
collapse: { |
|
left: cc.width(), |
|
top: _401.top, |
|
height: _401.height |
|
} |
|
}; |
|
} else { |
|
if (_3f3 == "west") { |
|
var _403 = p.panel("panel")._outerWidth(); |
|
var _404 = _401.width + _403 - _402; |
|
if (_3f7.split || !_3f7.border) { |
|
_404++; |
|
} |
|
return { |
|
resizeC: { |
|
width: _404, |
|
left: _402 - 1 |
|
}, |
|
expand: { |
|
left: 0 |
|
}, |
|
expandP: { |
|
left: 0, |
|
top: _401.top, |
|
width: _402, |
|
height: _401.height |
|
}, |
|
collapse: { |
|
left: -_403, |
|
top: _401.top, |
|
height: _401.height |
|
} |
|
}; |
|
} else { |
|
if (_3f3 == "north") { |
|
var _405 = p.panel("panel")._outerHeight(); |
|
var hh = _401.height; |
|
if (!_3cb(_3f6.expandNorth)) { |
|
hh += _405 - _402 + ((_3f7.split || !_3f7.border) ? 1 : 0); |
|
} |
|
_3f6.east.add(_3f6.west).add(_3f6.expandEast).add(_3f6.expandWest).panel("resize", { |
|
top: _402 - 1, |
|
height: hh |
|
}); |
|
return { |
|
resizeC: { |
|
top: _402 - 1, |
|
height: hh |
|
}, |
|
expand: { |
|
top: 0 |
|
}, |
|
expandP: { |
|
top: 0, |
|
left: 0, |
|
width: cc.width(), |
|
height: _402 |
|
}, |
|
collapse: { |
|
top: -_405, |
|
width: cc.width() |
|
} |
|
}; |
|
} else { |
|
if (_3f3 == "south") { |
|
var _405 = p.panel("panel")._outerHeight(); |
|
var hh = _401.height; |
|
if (!_3cb(_3f6.expandSouth)) { |
|
hh += _405 - _402 + ((_3f7.split || !_3f7.border) ? 1 : 0); |
|
} |
|
_3f6.east.add(_3f6.west).add(_3f6.expandEast).add(_3f6.expandWest).panel("resize", { |
|
height: hh |
|
}); |
|
return { |
|
resizeC: { |
|
height: hh |
|
}, |
|
expand: { |
|
top: cc.height() - _405 |
|
}, |
|
expandP: { |
|
top: cc.height() - _402, |
|
left: 0, |
|
width: cc.width(), |
|
height: _402 |
|
}, |
|
collapse: { |
|
top: cc.height(), |
|
width: cc.width() |
|
} |
|
}; |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
}; |
|
function _406(_407, _408) { |
|
var _409 = $.data(_407, "layout").panels; |
|
var p = _409[_408]; |
|
var _40a = p.panel("options"); |
|
if (_40a.onBeforeExpand.call(p) == false) { |
|
return; |
|
} |
|
var _40b = "expand" + _408.substring(0, 1).toUpperCase() + _408.substring(1); |
|
if (_409[_40b]) { |
|
_409[_40b].panel("close"); |
|
p.panel("panel").stop(true, true); |
|
p.panel("expand", false).panel("open"); |
|
var _40c = _40d(); |
|
p.panel("resize", _40c.collapse); |
|
p.panel("panel").animate(_40c.expand, function () { |
|
_3c5(_407); |
|
$(_407).layout("options").onExpand.call(_407, _408); |
|
}); |
|
} |
|
function _40d() { |
|
var cc = $(_407); |
|
var _40e = _409.center.panel("options"); |
|
if (_408 == "east" && _409.expandEast) { |
|
return { |
|
collapse: { |
|
left: cc.width(), |
|
top: _40e.top, |
|
height: _40e.height |
|
}, |
|
expand: { |
|
left: cc.width() - p.panel("panel")._outerWidth() |
|
} |
|
}; |
|
} else { |
|
if (_408 == "west" && _409.expandWest) { |
|
return { |
|
collapse: { |
|
left: -p.panel("panel")._outerWidth(), |
|
top: _40e.top, |
|
height: _40e.height |
|
}, |
|
expand: { |
|
left: 0 |
|
} |
|
}; |
|
} else { |
|
if (_408 == "north" && _409.expandNorth) { |
|
return { |
|
collapse: { |
|
top: -p.panel("panel")._outerHeight(), |
|
width: cc.width() |
|
}, |
|
expand: { |
|
top: 0 |
|
} |
|
}; |
|
} else { |
|
if (_408 == "south" && _409.expandSouth) { |
|
return { |
|
collapse: { |
|
top: cc.height(), |
|
width: cc.width() |
|
}, |
|
expand: { |
|
top: cc.height() - p.panel("panel")._outerHeight() |
|
} |
|
}; |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
}; |
|
function _3cb(pp) { |
|
if (!pp) { |
|
return false; |
|
} |
|
if (pp.length) { |
|
return pp.panel("panel").is(":visible"); |
|
} else { |
|
return false; |
|
} |
|
}; |
|
function _40f(_410) { |
|
var _411 = $.data(_410, "layout"); |
|
var opts = _411.options; |
|
var _412 = _411.panels; |
|
var _413 = opts.onCollapse; |
|
opts.onCollapse = function () {}; |
|
_414("east"); |
|
_414("west"); |
|
_414("north"); |
|
_414("south"); |
|
opts.onCollapse = _413; |
|
function _414(_415) { |
|
var p = _412[_415]; |
|
if (p.length && p.panel("options").collapsed) { |
|
_3f1(_410, _415, 0); |
|
} |
|
}; |
|
}; |
|
function _416(_417, _418, _419) { |
|
var p = $(_417).layout("panel", _418); |
|
p.panel("options").split = _419; |
|
var cls = "layout-split-" + _418; |
|
var _41a = p.panel("panel").removeClass(cls); |
|
if (_419) { |
|
_41a.addClass(cls); |
|
} |
|
_41a.resizable({ |
|
disabled: (!_419) |
|
}); |
|
_3c5(_417); |
|
}; |
|
$.fn.layout = function (_41b, _41c) { |
|
if (typeof _41b == "string") { |
|
return $.fn.layout.methods[_41b](this, _41c); |
|
} |
|
_41b = _41b || {}; |
|
return this.each(function () { |
|
var _41d = $.data(this, "layout"); |
|
if (_41d) { |
|
$.extend(_41d.options, _41b); |
|
} else { |
|
var opts = $.extend({}, $.fn.layout.defaults, $.fn.layout.parseOptions(this), _41b); |
|
$.data(this, "layout", { |
|
options: opts, |
|
panels: { |
|
center: $(), |
|
north: $(), |
|
south: $(), |
|
east: $(), |
|
west: $() |
|
} |
|
}); |
|
init(this); |
|
} |
|
_3c5(this); |
|
_40f(this); |
|
}); |
|
}; |
|
$.fn.layout.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "layout").options; |
|
}, |
|
resize: function (jq, _41e) { |
|
return jq.each(function () { |
|
_3c5(this, _41e); |
|
}); |
|
}, |
|
panel: function (jq, _41f) { |
|
return $.data(jq[0], "layout").panels[_41f]; |
|
}, |
|
collapse: function (jq, _420) { |
|
return jq.each(function () { |
|
_3f1(this, _420); |
|
}); |
|
}, |
|
expand: function (jq, _421) { |
|
return jq.each(function () { |
|
_406(this, _421); |
|
}); |
|
}, |
|
add: function (jq, _422) { |
|
return jq.each(function () { |
|
_3d4(this, _422); |
|
_3c5(this); |
|
if ($(this).layout("panel", _422.region).panel("options").collapsed) { |
|
_3f1(this, _422.region, 0); |
|
} |
|
}); |
|
}, |
|
remove: function (jq, _423) { |
|
return jq.each(function () { |
|
_3ec(this, _423); |
|
_3c5(this); |
|
}); |
|
}, |
|
split: function (jq, _424) { |
|
return jq.each(function () { |
|
_416(this, _424, true); |
|
}); |
|
}, |
|
unsplit: function (jq, _425) { |
|
return jq.each(function () { |
|
_416(this, _425, false); |
|
}); |
|
}, |
|
stopCollapsing: function (jq) { |
|
return jq.each(function () { |
|
clearTimeout($(this).data("layout").collapseTimer); |
|
}); |
|
} |
|
}; |
|
$.fn.layout.parseOptions = function (_426) { |
|
return $.extend({}, $.parser.parseOptions(_426, [{ |
|
fit: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.layout.defaults = { |
|
fit: false, |
|
onExpand: function (_427) {}, |
|
onCollapse: function (_428) {}, |
|
onAdd: function (_429) {}, |
|
onRemove: function (_42a) {} |
|
}; |
|
$.fn.layout.parsePanelOptions = function (_42b) { |
|
var t = $(_42b); |
|
return $.extend({}, $.fn.panel.parseOptions(_42b), $.parser.parseOptions(_42b, ["region", { |
|
split: "boolean", |
|
collpasedSize: "number", |
|
minWidth: "number", |
|
minHeight: "number", |
|
maxWidth: "number", |
|
maxHeight: "number" |
|
} |
|
])); |
|
}; |
|
$.fn.layout.paneldefaults = $.extend({}, $.fn.panel.defaults, { |
|
region: null, |
|
split: false, |
|
collapseDelay: 100, |
|
collapsedSize: 32, |
|
expandMode: "float", |
|
hideExpandTool: false, |
|
hideCollapsedContent: true, |
|
collapsedContent: function (_42c) { |
|
var p = $(this); |
|
var opts = p.panel("options"); |
|
if (opts.region == "north" || opts.region == "south") { |
|
return _42c; |
|
} |
|
var cc = []; |
|
if (opts.iconCls) { |
|
cc.push("<div class=\"panel-icon " + opts.iconCls + "\"></div>"); |
|
} |
|
cc.push("<div class=\"panel-title layout-expand-title"); |
|
cc.push(" layout-expand-title-" + opts.titleDirection); |
|
cc.push(opts.iconCls ? " layout-expand-with-icon" : ""); |
|
cc.push("\">"); |
|
cc.push(_42c); |
|
cc.push("</div>"); |
|
return cc.join(""); |
|
}, |
|
minWidth: 10, |
|
minHeight: 10, |
|
maxWidth: 10000, |
|
maxHeight: 10000 |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
$(function () { |
|
$(document)._unbind(".menu")._bind("mousedown.menu", function (e) { |
|
var m = $(e.target).closest("div.menu,div.combo-p"); |
|
if (m.length) { |
|
return; |
|
} |
|
$("body>div.menu-top:visible").not(".menu-inline").menu("hide"); |
|
_42d($("body>div.menu:visible").not(".menu-inline")); |
|
}); |
|
}); |
|
function init(_42e) { |
|
var opts = $.data(_42e, "menu").options; |
|
$(_42e).addClass("menu-top"); |
|
opts.inline ? $(_42e).addClass("menu-inline") : $(_42e).appendTo("body"); |
|
$(_42e)._bind("_resize", function (e, _42f) { |
|
if ($(this).hasClass("easyui-fluid") || _42f) { |
|
$(_42e).menu("resize", _42e); |
|
} |
|
return false; |
|
}); |
|
var _430 = _431($(_42e)); |
|
for (var i = 0; i < _430.length; i++) { |
|
_434(_42e, _430[i]); |
|
} |
|
function _431(menu) { |
|
var _432 = []; |
|
menu.addClass("menu"); |
|
_432.push(menu); |
|
if (!menu.hasClass("menu-content")) { |
|
menu.children("div").each(function () { |
|
var _433 = $(this).children("div"); |
|
if (_433.length) { |
|
_433.appendTo("body"); |
|
this.submenu = _433; |
|
var mm = _431(_433); |
|
_432 = _432.concat(mm); |
|
} |
|
}); |
|
} |
|
return _432; |
|
}; |
|
}; |
|
function _434(_435, div) { |
|
var menu = $(div).addClass("menu"); |
|
if (!menu.data("menu")) { |
|
menu.data("menu", { |
|
options: $.parser.parseOptions(menu[0], ["width", "height"]) |
|
}); |
|
} |
|
if (!menu.hasClass("menu-content")) { |
|
menu.children("div").each(function () { |
|
_436(_435, this); |
|
}); |
|
$("<div class=\"menu-line\"></div>").prependTo(menu); |
|
} |
|
_437(_435, menu); |
|
if (!menu.hasClass("menu-inline")) { |
|
menu.hide(); |
|
} |
|
_438(_435, menu); |
|
}; |
|
function _436(_439, div, _43a) { |
|
var item = $(div); |
|
var _43b = $.extend({}, $.parser.parseOptions(item[0], ["id", "name", "iconCls", "href", { |
|
separator: "boolean" |
|
} |
|
]), { |
|
disabled: (item.attr("disabled") ? true : undefined), |
|
text: $.trim(item.html()), |
|
onclick: item[0].onclick |
|
}, _43a || {}); |
|
_43b.onclick = _43b.onclick || _43b.handler || null; |
|
item.data("menuitem", { |
|
options: _43b |
|
}); |
|
if (_43b.separator) { |
|
item.addClass("menu-sep"); |
|
} |
|
if (!item.hasClass("menu-sep")) { |
|
item.addClass("menu-item"); |
|
item.empty().append($("<div class=\"menu-text\"></div>").html(_43b.text)); |
|
if (_43b.iconCls) { |
|
$("<div class=\"menu-icon\"></div>").addClass(_43b.iconCls).appendTo(item); |
|
} |
|
if (_43b.id) { |
|
item.attr("id", _43b.id); |
|
} |
|
if (_43b.onclick) { |
|
if (typeof _43b.onclick == "string") { |
|
item.attr("onclick", _43b.onclick); |
|
} else { |
|
item[0].onclick = eval(_43b.onclick); |
|
} |
|
} |
|
if (_43b.disabled) { |
|
_43c(_439, item[0], true); |
|
} |
|
if (item[0].submenu) { |
|
$("<div class=\"menu-rightarrow\"></div>").appendTo(item); |
|
} |
|
} |
|
}; |
|
function _437(_43d, menu) { |
|
var opts = $.data(_43d, "menu").options; |
|
var _43e = menu.attr("style") || ""; |
|
var _43f = menu.is(":visible"); |
|
menu.css({ |
|
display: "block", |
|
left: -10000, |
|
height: "auto", |
|
overflow: "hidden" |
|
}); |
|
menu.find(".menu-item").each(function () { |
|
$(this)._outerHeight(opts.itemHeight); |
|
$(this).find(".menu-text").css({ |
|
height: (opts.itemHeight - 2) + "px", |
|
lineHeight: (opts.itemHeight - 2) + "px" |
|
}); |
|
}); |
|
menu.removeClass("menu-noline").addClass(opts.noline ? "menu-noline" : ""); |
|
var _440 = menu.data("menu").options; |
|
var _441 = _440.width; |
|
var _442 = _440.height; |
|
if (isNaN(parseInt(_441))) { |
|
_441 = 0; |
|
menu.find("div.menu-text").each(function () { |
|
if (_441 < $(this).outerWidth()) { |
|
_441 = $(this).outerWidth(); |
|
} |
|
}); |
|
_441 = _441 ? _441 + 40 : ""; |
|
} |
|
var _443 = menu.outerHeight(); |
|
if (isNaN(parseInt(_442))) { |
|
_442 = _443; |
|
if (menu.hasClass("menu-top") && opts.alignTo) { |
|
var at = $(opts.alignTo); |
|
var h1 = at.offset().top - $(document).scrollTop(); |
|
var h2 = $(window)._outerHeight() + $(document).scrollTop() - at.offset().top - at._outerHeight(); |
|
_442 = Math.min(_442, Math.max(h1, h2)); |
|
} else { |
|
if (_442 > $(window)._outerHeight()) { |
|
_442 = $(window).height(); |
|
} |
|
} |
|
} |
|
menu.attr("style", _43e); |
|
menu.show(); |
|
menu._size($.extend({}, _440, { |
|
width: _441, |
|
height: _442, |
|
minWidth: _440.minWidth || opts.minWidth, |
|
maxWidth: _440.maxWidth || opts.maxWidth |
|
})); |
|
menu.find(".easyui-fluid").triggerHandler("_resize", [true]); |
|
menu.css("overflow", menu.outerHeight() < _443 ? "auto" : "hidden"); |
|
menu.children("div.menu-line")._outerHeight(_443 - 2); |
|
if (!_43f) { |
|
menu.hide(); |
|
} |
|
}; |
|
function _438(_444, menu) { |
|
var _445 = $.data(_444, "menu"); |
|
var opts = _445.options; |
|
menu._unbind(".menu"); |
|
for (var _446 in opts.events) { |
|
menu._bind(_446 + ".menu", { |
|
target: _444 |
|
}, opts.events[_446]); |
|
} |
|
}; |
|
function _447(e) { |
|
var _448 = e.data.target; |
|
var _449 = $.data(_448, "menu"); |
|
if (_449.timer) { |
|
clearTimeout(_449.timer); |
|
_449.timer = null; |
|
} |
|
}; |
|
function _44a(e) { |
|
var _44b = e.data.target; |
|
var _44c = $.data(_44b, "menu"); |
|
if (_44c.options.hideOnUnhover) { |
|
_44c.timer = setTimeout(function () { |
|
_44d(_44b, $(_44b).hasClass("menu-inline")); |
|
}, _44c.options.duration); |
|
} |
|
}; |
|
function _44e(e) { |
|
var _44f = e.data.target; |
|
var item = $(e.target).closest(".menu-item"); |
|
if (item.length) { |
|
item.siblings().each(function () { |
|
if (this.submenu) { |
|
_42d(this.submenu); |
|
} |
|
$(this).removeClass("menu-active"); |
|
}); |
|
item.addClass("menu-active"); |
|
if (item.hasClass("menu-item-disabled")) { |
|
item.addClass("menu-active-disabled"); |
|
return; |
|
} |
|
var _450 = item[0].submenu; |
|
if (_450) { |
|
$(_44f).menu("show", { |
|
menu: _450, |
|
parent: item |
|
}); |
|
} |
|
} |
|
}; |
|
function _451(e) { |
|
var item = $(e.target).closest(".menu-item"); |
|
if (item.length) { |
|
item.removeClass("menu-active menu-active-disabled"); |
|
var _452 = item[0].submenu; |
|
if (_452) { |
|
if (e.pageX >= parseInt(_452.css("left"))) { |
|
item.addClass("menu-active"); |
|
} else { |
|
_42d(_452); |
|
} |
|
} else { |
|
item.removeClass("menu-active"); |
|
} |
|
} |
|
}; |
|
function _453(e) { |
|
var _454 = e.data.target; |
|
var item = $(e.target).closest(".menu-item"); |
|
if (item.length) { |
|
var opts = $(_454).data("menu").options; |
|
var _455 = item.data("menuitem").options; |
|
if (_455.disabled) { |
|
return; |
|
} |
|
if (!item[0].submenu) { |
|
_44d(_454, opts.inline); |
|
if (_455.href) { |
|
location.href = _455.href; |
|
} |
|
} |
|
item.trigger("mouseenter"); |
|
opts.onClick.call(_454, $(_454).menu("getItem", item[0])); |
|
} |
|
}; |
|
function _44d(_456, _457) { |
|
var _458 = $.data(_456, "menu"); |
|
if (_458) { |
|
if ($(_456).is(":visible")) { |
|
_42d($(_456)); |
|
if (_457) { |
|
$(_456).show(); |
|
} else { |
|
_458.options.onHide.call(_456); |
|
} |
|
} |
|
} |
|
return false; |
|
}; |
|
function _459(_45a, _45b) { |
|
_45b = _45b || {}; |
|
var left, |
|
top; |
|
var opts = $.data(_45a, "menu").options; |
|
var menu = $(_45b.menu || _45a); |
|
$(_45a).menu("resize", menu[0]); |
|
if (menu.hasClass("menu-top")) { |
|
$.extend(opts, _45b); |
|
left = opts.left; |
|
top = opts.top; |
|
if (opts.alignTo) { |
|
var at = $(opts.alignTo); |
|
left = at.offset().left; |
|
top = at.offset().top + at._outerHeight(); |
|
if (opts.align == "right") { |
|
left += at.outerWidth() - menu.outerWidth(); |
|
} |
|
} |
|
if (left + menu.outerWidth() > $(window)._outerWidth() + $(document)._scrollLeft()) { |
|
left = $(window)._outerWidth() + $(document).scrollLeft() - menu.outerWidth() - 5; |
|
} |
|
if (left < 0) { |
|
left = 0; |
|
} |
|
top = _45c(top, opts.alignTo); |
|
} else { |
|
var _45d = _45b.parent; |
|
left = _45d.offset().left + _45d.outerWidth() - 2; |
|
if (left + menu.outerWidth() + 5 > $(window)._outerWidth() + $(document).scrollLeft()) { |
|
left = _45d.offset().left - menu.outerWidth() + 2; |
|
} |
|
top = _45c(_45d.offset().top - 3); |
|
} |
|
function _45c(top, _45e) { |
|
if (top + menu.outerHeight() > $(window)._outerHeight() + $(document).scrollTop()) { |
|
if (_45e) { |
|
top = $(_45e).offset().top - menu._outerHeight(); |
|
} else { |
|
top = $(window)._outerHeight() + $(document).scrollTop() - menu.outerHeight(); |
|
} |
|
} |
|
if (top < 0) { |
|
top = 0; |
|
} |
|
return top; |
|
}; |
|
menu.css(opts.position.call(_45a, menu[0], left, top)); |
|
menu.show(0, function () { |
|
if (!menu[0].shadow) { |
|
menu[0].shadow = $("<div class=\"menu-shadow\"></div>").insertAfter(menu); |
|
} |
|
menu[0].shadow.css({ |
|
display: (menu.hasClass("menu-inline") ? "none" : "block"), |
|
zIndex: $.fn.menu.defaults.zIndex++, |
|
left: menu.css("left"), |
|
top: menu.css("top"), |
|
width: menu.outerWidth(), |
|
height: menu.outerHeight() |
|
}); |
|
menu.css("z-index", $.fn.menu.defaults.zIndex++); |
|
if (menu.hasClass("menu-top")) { |
|
opts.onShow.call(_45a); |
|
} |
|
}); |
|
}; |
|
function _42d(menu) { |
|
if (menu && menu.length) { |
|
_45f(menu); |
|
menu.find("div.menu-item").each(function () { |
|
if (this.submenu) { |
|
_42d(this.submenu); |
|
} |
|
$(this).removeClass("menu-active"); |
|
}); |
|
} |
|
function _45f(m) { |
|
m.stop(true, true); |
|
if (m[0].shadow) { |
|
m[0].shadow.hide(); |
|
} |
|
m.hide(); |
|
}; |
|
}; |
|
function _460(_461, _462) { |
|
var _463 = null; |
|
var fn = $.isFunction(_462) ? _462 : function (item) { |
|
for (var p in _462) { |
|
if (item[p] != _462[p]) { |
|
return false; |
|
} |
|
} |
|
return true; |
|
}; |
|
function find(menu) { |
|
menu.children("div.menu-item").each(function () { |
|
var opts = $(this).data("menuitem").options; |
|
if (fn.call(_461, opts) == true) { |
|
_463 = $(_461).menu("getItem", this); |
|
} else { |
|
if (this.submenu && !_463) { |
|
find(this.submenu); |
|
} |
|
} |
|
}); |
|
}; |
|
find($(_461)); |
|
return _463; |
|
}; |
|
function _43c(_464, _465, _466) { |
|
var t = $(_465); |
|
if (t.hasClass("menu-item")) { |
|
var opts = t.data("menuitem").options; |
|
opts.disabled = _466; |
|
if (_466) { |
|
t.addClass("menu-item-disabled"); |
|
t[0].onclick = null; |
|
} else { |
|
t.removeClass("menu-item-disabled"); |
|
t[0].onclick = opts.onclick; |
|
} |
|
} |
|
}; |
|
function _467(_468, _469) { |
|
var opts = $.data(_468, "menu").options; |
|
var menu = $(_468); |
|
if (_469.parent) { |
|
if (!_469.parent.submenu) { |
|
var _46a = $("<div></div>").appendTo("body"); |
|
_469.parent.submenu = _46a; |
|
$("<div class=\"menu-rightarrow\"></div>").appendTo(_469.parent); |
|
_434(_468, _46a); |
|
} |
|
menu = _469.parent.submenu; |
|
} |
|
var div = $("<div></div>").appendTo(menu); |
|
_436(_468, div, _469); |
|
}; |
|
function _46b(_46c, _46d) { |
|
function _46e(el) { |
|
if (el.submenu) { |
|
el.submenu.children("div.menu-item").each(function () { |
|
_46e(this); |
|
}); |
|
var _46f = el.submenu[0].shadow; |
|
if (_46f) { |
|
_46f.remove(); |
|
} |
|
el.submenu.remove(); |
|
} |
|
$(el).remove(); |
|
}; |
|
_46e(_46d); |
|
}; |
|
function _470(_471, _472, _473) { |
|
var menu = $(_472).parent(); |
|
if (_473) { |
|
$(_472).show(); |
|
} else { |
|
$(_472).hide(); |
|
} |
|
_437(_471, menu); |
|
}; |
|
function _474(_475) { |
|
$(_475).children("div.menu-item").each(function () { |
|
_46b(_475, this); |
|
}); |
|
if (_475.shadow) { |
|
_475.shadow.remove(); |
|
} |
|
$(_475).remove(); |
|
}; |
|
$.fn.menu = function (_476, _477) { |
|
if (typeof _476 == "string") { |
|
return $.fn.menu.methods[_476](this, _477); |
|
} |
|
_476 = _476 || {}; |
|
return this.each(function () { |
|
var _478 = $.data(this, "menu"); |
|
if (_478) { |
|
$.extend(_478.options, _476); |
|
} else { |
|
_478 = $.data(this, "menu", { |
|
options: $.extend({}, $.fn.menu.defaults, $.fn.menu.parseOptions(this), _476) |
|
}); |
|
init(this); |
|
} |
|
$(this).css({ |
|
left: _478.options.left, |
|
top: _478.options.top |
|
}); |
|
}); |
|
}; |
|
$.fn.menu.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "menu").options; |
|
}, |
|
show: function (jq, pos) { |
|
return jq.each(function () { |
|
_459(this, pos); |
|
}); |
|
}, |
|
hide: function (jq) { |
|
return jq.each(function () { |
|
_44d(this); |
|
}); |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
_474(this); |
|
}); |
|
}, |
|
setText: function (jq, _479) { |
|
return jq.each(function () { |
|
var item = $(_479.target).data("menuitem").options; |
|
item.text = _479.text; |
|
$(_479.target).children("div.menu-text").html(_479.text); |
|
}); |
|
}, |
|
setIcon: function (jq, _47a) { |
|
return jq.each(function () { |
|
var item = $(_47a.target).data("menuitem").options; |
|
item.iconCls = _47a.iconCls; |
|
$(_47a.target).children("div.menu-icon").remove(); |
|
if (_47a.iconCls) { |
|
$("<div class=\"menu-icon\"></div>").addClass(_47a.iconCls).appendTo(_47a.target); |
|
} |
|
}); |
|
}, |
|
getItem: function (jq, _47b) { |
|
var item = $(_47b).data("menuitem").options; |
|
return $.extend({}, item, { |
|
target: $(_47b)[0] |
|
}); |
|
}, |
|
findItem: function (jq, text) { |
|
if (typeof text == "string") { |
|
return _460(jq[0], function (item) { |
|
return $("<div>" + item.text + "</div>").text() == text; |
|
}); |
|
} else { |
|
return _460(jq[0], text); |
|
} |
|
}, |
|
appendItem: function (jq, _47c) { |
|
return jq.each(function () { |
|
_467(this, _47c); |
|
}); |
|
}, |
|
removeItem: function (jq, _47d) { |
|
return jq.each(function () { |
|
_46b(this, _47d); |
|
}); |
|
}, |
|
enableItem: function (jq, _47e) { |
|
return jq.each(function () { |
|
_43c(this, _47e, false); |
|
}); |
|
}, |
|
disableItem: function (jq, _47f) { |
|
return jq.each(function () { |
|
_43c(this, _47f, true); |
|
}); |
|
}, |
|
showItem: function (jq, _480) { |
|
return jq.each(function () { |
|
_470(this, _480, true); |
|
}); |
|
}, |
|
hideItem: function (jq, _481) { |
|
return jq.each(function () { |
|
_470(this, _481, false); |
|
}); |
|
}, |
|
resize: function (jq, _482) { |
|
return jq.each(function () { |
|
_437(this, _482 ? $(_482) : $(this)); |
|
}); |
|
} |
|
}; |
|
$.fn.menu.parseOptions = function (_483) { |
|
return $.extend({}, $.parser.parseOptions(_483, [{ |
|
minWidth: "number", |
|
itemHeight: "number", |
|
duration: "number", |
|
hideOnUnhover: "boolean" |
|
}, { |
|
fit: "boolean", |
|
inline: "boolean", |
|
noline: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.menu.defaults = { |
|
zIndex: 110000, |
|
left: 0, |
|
top: 0, |
|
alignTo: null, |
|
align: "left", |
|
minWidth: 150, |
|
itemHeight: 32, |
|
duration: 100, |
|
hideOnUnhover: true, |
|
inline: false, |
|
fit: false, |
|
noline: false, |
|
events: { |
|
mouseenter: _447, |
|
mouseleave: _44a, |
|
mouseover: _44e, |
|
mouseout: _451, |
|
click: _453 |
|
}, |
|
position: function (_484, left, top) { |
|
return { |
|
left: left, |
|
top: top |
|
}; |
|
}, |
|
onShow: function () {}, |
|
onHide: function () {}, |
|
onClick: function (item) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
var _485 = 1; |
|
function init(_486) { |
|
$(_486).addClass("sidemenu"); |
|
}; |
|
function _487(_488, _489) { |
|
var opts = $(_488).sidemenu("options"); |
|
if (_489) { |
|
$.extend(opts, { |
|
width: _489.width, |
|
height: _489.height |
|
}); |
|
} |
|
$(_488)._size(opts); |
|
$(_488).find(".accordion").accordion("resize"); |
|
}; |
|
function _48a(_48b, _48c, data) { |
|
var opts = $(_48b).sidemenu("options"); |
|
var tt = $("<ul class=\"sidemenu-tree\"></ul>").appendTo(_48c); |
|
tt.tree({ |
|
data: data, |
|
animate: opts.animate, |
|
onBeforeSelect: function (node) { |
|
if (node.children) { |
|
return false; |
|
} |
|
}, |
|
onSelect: function (node) { |
|
_48d(_48b, node.id, true); |
|
}, |
|
onExpand: function (node) { |
|
_49a(_48b, node); |
|
}, |
|
onCollapse: function (node) { |
|
_49a(_48b, node); |
|
}, |
|
onClick: function (node) { |
|
if (node.children) { |
|
if (node.state == "open") { |
|
$(node.target).addClass("tree-node-nonleaf-collapsed"); |
|
} else { |
|
$(node.target).removeClass("tree-node-nonleaf-collapsed"); |
|
} |
|
$(this).tree("toggle", node.target); |
|
} |
|
} |
|
}); |
|
tt._unbind(".sidemenu")._bind("mouseleave.sidemenu", function () { |
|
$(_48c).trigger("mouseleave"); |
|
}); |
|
_48d(_48b, opts.selectedItemId); |
|
}; |
|
function _48e(_48f, _490, data) { |
|
var opts = $(_48f).sidemenu("options"); |
|
$(_490).tooltip({ |
|
content: $("<div></div>"), |
|
position: opts.floatMenuPosition, |
|
valign: "top", |
|
data: data, |
|
onUpdate: function (_491) { |
|
var _492 = $(this).tooltip("options"); |
|
var data = _492.data; |
|
_491.accordion({ |
|
width: opts.floatMenuWidth, |
|
multiple: false |
|
}).accordion("add", { |
|
title: data.text, |
|
collapsed: false, |
|
collapsible: false |
|
}); |
|
_48a(_48f, _491.accordion("panels")[0], data.children); |
|
}, |
|
onShow: function () { |
|
var t = $(this); |
|
var tip = t.tooltip("tip").addClass("sidemenu-tooltip"); |
|
tip.children(".tooltip-content").addClass("sidemenu"); |
|
tip.find(".accordion").accordion("resize"); |
|
tip.add(tip.find("ul.tree"))._unbind(".sidemenu")._bind("mouseover.sidemenu", function () { |
|
t.tooltip("show"); |
|
})._bind("mouseleave.sidemenu", function () { |
|
t.tooltip("hide"); |
|
}); |
|
t.tooltip("reposition"); |
|
}, |
|
onPosition: function (left, top) { |
|
var tip = $(this).tooltip("tip"); |
|
if (!opts.collapsed) { |
|
tip.css({ |
|
left: -999999 |
|
}); |
|
} else { |
|
if (top + tip.outerHeight() > $(window)._outerHeight() + $(document).scrollTop()) { |
|
top = $(window)._outerHeight() + $(document).scrollTop() - tip.outerHeight(); |
|
tip.css("top", top); |
|
} |
|
} |
|
} |
|
}); |
|
}; |
|
function _493(_494, _495) { |
|
$(_494).find(".sidemenu-tree").each(function () { |
|
_495($(this)); |
|
}); |
|
$(_494).find(".tooltip-f").each(function () { |
|
var tip = $(this).tooltip("tip"); |
|
if (tip) { |
|
tip.find(".sidemenu-tree").each(function () { |
|
_495($(this)); |
|
}); |
|
$(this).tooltip("reposition"); |
|
} |
|
}); |
|
}; |
|
function _48d(_496, _497, _498) { |
|
var _499 = null; |
|
var opts = $(_496).sidemenu("options"); |
|
_493(_496, function (t) { |
|
t.find("div.tree-node-selected").removeClass("tree-node-selected"); |
|
var node = t.tree("find", _497); |
|
if (node) { |
|
$(node.target).addClass("tree-node-selected"); |
|
opts.selectedItemId = node.id; |
|
t.trigger("mouseleave.sidemenu"); |
|
_499 = node; |
|
} |
|
}); |
|
if (_498 && _499) { |
|
opts.onSelect.call(_496, _499); |
|
} |
|
}; |
|
function _49a(_49b, item) { |
|
_493(_49b, function (t) { |
|
var node = t.tree("find", item.id); |
|
if (node) { |
|
var _49c = t.tree("options"); |
|
var _49d = _49c.animate; |
|
_49c.animate = false; |
|
t.tree(item.state == "open" ? "expand" : "collapse", node.target); |
|
_49c.animate = _49d; |
|
} |
|
}); |
|
}; |
|
function _49e(_49f) { |
|
var opts = $(_49f).sidemenu("options"); |
|
$(_49f).empty(); |
|
if (opts.data) { |
|
$.easyui.forEach(opts.data, true, function (node) { |
|
if (!node.id) { |
|
node.id = "_easyui_sidemenu_" + (_485++); |
|
} |
|
if (!node.iconCls) { |
|
node.iconCls = "sidemenu-default-icon"; |
|
} |
|
if (node.children) { |
|
node.nodeCls = "tree-node-nonleaf"; |
|
if (!node.state) { |
|
node.state = "closed"; |
|
} |
|
if (node.state == "open") { |
|
node.nodeCls = "tree-node-nonleaf"; |
|
} else { |
|
node.nodeCls = "tree-node-nonleaf tree-node-nonleaf-collapsed"; |
|
} |
|
} |
|
}); |
|
var acc = $("<div></div>").appendTo(_49f); |
|
acc.accordion({ |
|
fit: opts.height == "auto" ? false : true, |
|
border: opts.border, |
|
multiple: opts.multiple |
|
}); |
|
var data = opts.data; |
|
for (var i = 0; i < data.length; i++) { |
|
acc.accordion("add", { |
|
title: data[i].text, |
|
selected: data[i].state == "open", |
|
iconCls: data[i].iconCls, |
|
onBeforeExpand: function () { |
|
return !opts.collapsed; |
|
} |
|
}); |
|
var ap = acc.accordion("panels")[i]; |
|
_48a(_49f, ap, data[i].children); |
|
_48e(_49f, ap.panel("header"), data[i]); |
|
} |
|
} |
|
}; |
|
function _4a0(_4a1, _4a2) { |
|
var opts = $(_4a1).sidemenu("options"); |
|
opts.collapsed = _4a2; |
|
var acc = $(_4a1).find(".accordion"); |
|
var _4a3 = acc.accordion("panels"); |
|
acc.accordion("options").animate = false; |
|
if (opts.collapsed) { |
|
$(_4a1).addClass("sidemenu-collapsed"); |
|
for (var i = 0; i < _4a3.length; i++) { |
|
var _4a4 = _4a3[i]; |
|
if (_4a4.panel("options").collapsed) { |
|
opts.data[i].state = "closed"; |
|
} else { |
|
opts.data[i].state = "open"; |
|
acc.accordion("unselect", i); |
|
} |
|
var _4a5 = _4a4.panel("header"); |
|
_4a5.find(".panel-title").html(""); |
|
_4a5.find(".panel-tool").hide(); |
|
} |
|
} else { |
|
$(_4a1).removeClass("sidemenu-collapsed"); |
|
for (var i = 0; i < _4a3.length; i++) { |
|
var _4a4 = _4a3[i]; |
|
if (opts.data[i].state == "open") { |
|
acc.accordion("select", i); |
|
} |
|
var _4a5 = _4a4.panel("header"); |
|
_4a5.find(".panel-title").html(_4a4.panel("options").title); |
|
_4a5.find(".panel-tool").show(); |
|
} |
|
} |
|
acc.accordion("options").animate = opts.animate; |
|
}; |
|
function _4a6(_4a7) { |
|
$(_4a7).find(".tooltip-f").each(function () { |
|
$(this).tooltip("destroy"); |
|
}); |
|
$(_4a7).remove(); |
|
}; |
|
$.fn.sidemenu = function (_4a8, _4a9) { |
|
if (typeof _4a8 == "string") { |
|
var _4aa = $.fn.sidemenu.methods[_4a8]; |
|
return _4aa(this, _4a9); |
|
} |
|
_4a8 = _4a8 || {}; |
|
return this.each(function () { |
|
var _4ab = $.data(this, "sidemenu"); |
|
if (_4ab) { |
|
$.extend(_4ab.options, _4a8); |
|
} else { |
|
_4ab = $.data(this, "sidemenu", { |
|
options: $.extend({}, $.fn.sidemenu.defaults, $.fn.sidemenu.parseOptions(this), _4a8) |
|
}); |
|
init(this); |
|
} |
|
_487(this); |
|
_49e(this); |
|
_4a0(this, _4ab.options.collapsed); |
|
}); |
|
}; |
|
$.fn.sidemenu.methods = { |
|
options: function (jq) { |
|
return jq.data("sidemenu").options; |
|
}, |
|
resize: function (jq, _4ac) { |
|
return jq.each(function () { |
|
_487(this, _4ac); |
|
}); |
|
}, |
|
collapse: function (jq) { |
|
return jq.each(function () { |
|
_4a0(this, true); |
|
}); |
|
}, |
|
expand: function (jq) { |
|
return jq.each(function () { |
|
_4a0(this, false); |
|
}); |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
_4a6(this); |
|
}); |
|
} |
|
}; |
|
$.fn.sidemenu.parseOptions = function (_4ad) { |
|
var t = $(_4ad); |
|
return $.extend({}, $.parser.parseOptions(_4ad, ["width", "height"])); |
|
}; |
|
$.fn.sidemenu.defaults = { |
|
width: 200, |
|
height: "auto", |
|
border: true, |
|
animate: true, |
|
multiple: true, |
|
collapsed: false, |
|
data: null, |
|
floatMenuWidth: 200, |
|
floatMenuPosition: "right", |
|
onSelect: function (item) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function init(_4ae) { |
|
var opts = $.data(_4ae, "menubutton").options; |
|
var btn = $(_4ae); |
|
btn.linkbutton(opts); |
|
if (opts.hasDownArrow) { |
|
btn.removeClass(opts.cls.btn1 + " " + opts.cls.btn2).addClass("m-btn"); |
|
btn.removeClass("m-btn-small m-btn-medium m-btn-large").addClass("m-btn-" + opts.size); |
|
var _4af = btn.find(".l-btn-left"); |
|
$("<span></span>").addClass(opts.cls.arrow).appendTo(_4af); |
|
$("<span></span>").addClass("m-btn-line").appendTo(_4af); |
|
} |
|
$(_4ae).menubutton("resize"); |
|
if (opts.menu) { |
|
$(opts.menu).menu({ |
|
duration: opts.duration |
|
}); |
|
var _4b0 = $(opts.menu).menu("options"); |
|
var _4b1 = _4b0.onShow; |
|
var _4b2 = _4b0.onHide; |
|
$.extend(_4b0, { |
|
onShow: function () { |
|
var _4b3 = $(this).menu("options"); |
|
var btn = $(_4b3.alignTo); |
|
var opts = btn.menubutton("options"); |
|
btn.addClass((opts.plain == true) ? opts.cls.btn2 : opts.cls.btn1); |
|
_4b1.call(this); |
|
}, |
|
onHide: function () { |
|
var _4b4 = $(this).menu("options"); |
|
var btn = $(_4b4.alignTo); |
|
var opts = btn.menubutton("options"); |
|
btn.removeClass((opts.plain == true) ? opts.cls.btn2 : opts.cls.btn1); |
|
_4b2.call(this); |
|
} |
|
}); |
|
} |
|
}; |
|
function _4b5(_4b6) { |
|
var opts = $.data(_4b6, "menubutton").options; |
|
var btn = $(_4b6); |
|
var t = btn.find("." + opts.cls.trigger); |
|
if (!t.length) { |
|
t = btn; |
|
} |
|
t._unbind(".menubutton"); |
|
var _4b7 = null; |
|
t._bind(opts.showEvent + ".menubutton", function () { |
|
if (!_4b8()) { |
|
_4b7 = setTimeout(function () { |
|
_4b9(_4b6); |
|
}, opts.duration); |
|
return false; |
|
} |
|
})._bind(opts.hideEvent + ".menubutton", function () { |
|
if (_4b7) { |
|
clearTimeout(_4b7); |
|
} |
|
$(opts.menu).triggerHandler("mouseleave"); |
|
}); |
|
function _4b8() { |
|
return $(_4b6).linkbutton("options").disabled; |
|
}; |
|
}; |
|
function _4b9(_4ba) { |
|
var opts = $(_4ba).menubutton("options"); |
|
if (opts.disabled || !opts.menu) { |
|
return; |
|
} |
|
$("body>div.menu-top").menu("hide"); |
|
var btn = $(_4ba); |
|
var mm = $(opts.menu); |
|
if (mm.length) { |
|
mm.menu("options").alignTo = btn; |
|
mm.menu("show", { |
|
alignTo: btn, |
|
align: opts.menuAlign |
|
}); |
|
} |
|
btn.blur(); |
|
}; |
|
$.fn.menubutton = function (_4bb, _4bc) { |
|
if (typeof _4bb == "string") { |
|
var _4bd = $.fn.menubutton.methods[_4bb]; |
|
if (_4bd) { |
|
return _4bd(this, _4bc); |
|
} else { |
|
return this.linkbutton(_4bb, _4bc); |
|
} |
|
} |
|
_4bb = _4bb || {}; |
|
return this.each(function () { |
|
var _4be = $.data(this, "menubutton"); |
|
if (_4be) { |
|
$.extend(_4be.options, _4bb); |
|
} else { |
|
$.data(this, "menubutton", { |
|
options: $.extend({}, $.fn.menubutton.defaults, $.fn.menubutton.parseOptions(this), _4bb) |
|
}); |
|
$(this)._propAttr("disabled", false); |
|
} |
|
init(this); |
|
_4b5(this); |
|
}); |
|
}; |
|
$.fn.menubutton.methods = { |
|
options: function (jq) { |
|
var _4bf = jq.linkbutton("options"); |
|
return $.extend($.data(jq[0], "menubutton").options, { |
|
toggle: _4bf.toggle, |
|
selected: _4bf.selected, |
|
disabled: _4bf.disabled |
|
}); |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).menubutton("options"); |
|
if (opts.menu) { |
|
$(opts.menu).menu("destroy"); |
|
} |
|
$(this).remove(); |
|
}); |
|
} |
|
}; |
|
$.fn.menubutton.parseOptions = function (_4c0) { |
|
var t = $(_4c0); |
|
return $.extend({}, $.fn.linkbutton.parseOptions(_4c0), $.parser.parseOptions(_4c0, ["menu", { |
|
plain: "boolean", |
|
hasDownArrow: "boolean", |
|
duration: "number" |
|
} |
|
])); |
|
}; |
|
$.fn.menubutton.defaults = $.extend({}, $.fn.linkbutton.defaults, { |
|
plain: true, |
|
hasDownArrow: true, |
|
menu: null, |
|
menuAlign: "left", |
|
duration: 100, |
|
showEvent: "mouseenter", |
|
hideEvent: "mouseleave", |
|
cls: { |
|
btn1: "m-btn-active", |
|
btn2: "m-btn-plain-active", |
|
arrow: "m-btn-downarrow", |
|
trigger: "m-btn" |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function init(_4c1) { |
|
var opts = $.data(_4c1, "splitbutton").options; |
|
$(_4c1).menubutton(opts); |
|
$(_4c1).addClass("s-btn"); |
|
}; |
|
$.fn.splitbutton = function (_4c2, _4c3) { |
|
if (typeof _4c2 == "string") { |
|
var _4c4 = $.fn.splitbutton.methods[_4c2]; |
|
if (_4c4) { |
|
return _4c4(this, _4c3); |
|
} else { |
|
return this.menubutton(_4c2, _4c3); |
|
} |
|
} |
|
_4c2 = _4c2 || {}; |
|
return this.each(function () { |
|
var _4c5 = $.data(this, "splitbutton"); |
|
if (_4c5) { |
|
$.extend(_4c5.options, _4c2); |
|
} else { |
|
$.data(this, "splitbutton", { |
|
options: $.extend({}, $.fn.splitbutton.defaults, $.fn.splitbutton.parseOptions(this), _4c2) |
|
}); |
|
$(this)._propAttr("disabled", false); |
|
} |
|
init(this); |
|
}); |
|
}; |
|
$.fn.splitbutton.methods = { |
|
options: function (jq) { |
|
var _4c6 = jq.menubutton("options"); |
|
var _4c7 = $.data(jq[0], "splitbutton").options; |
|
$.extend(_4c7, { |
|
disabled: _4c6.disabled, |
|
toggle: _4c6.toggle, |
|
selected: _4c6.selected |
|
}); |
|
return _4c7; |
|
} |
|
}; |
|
$.fn.splitbutton.parseOptions = function (_4c8) { |
|
var t = $(_4c8); |
|
return $.extend({}, $.fn.linkbutton.parseOptions(_4c8), $.parser.parseOptions(_4c8, ["menu", { |
|
plain: "boolean", |
|
duration: "number" |
|
} |
|
])); |
|
}; |
|
$.fn.splitbutton.defaults = $.extend({}, $.fn.linkbutton.defaults, { |
|
plain: true, |
|
menu: null, |
|
duration: 100, |
|
cls: { |
|
btn1: "m-btn-active s-btn-active", |
|
btn2: "m-btn-plain-active s-btn-plain-active", |
|
arrow: "m-btn-downarrow", |
|
trigger: "m-btn-line" |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
var _4c9 = 1; |
|
function init(_4ca) { |
|
var _4cb = $("<span class=\"switchbutton\">" + "<span class=\"switchbutton-inner\">" + "<span class=\"switchbutton-on\"></span>" + "<span class=\"switchbutton-handle\"></span>" + "<span class=\"switchbutton-off\"></span>" + "<input class=\"switchbutton-value\" type=\"checkbox\" tabindex=\"-1\">" + "</span>" + "</span>").insertAfter(_4ca); |
|
var t = $(_4ca); |
|
t.addClass("switchbutton-f").hide(); |
|
var name = t.attr("name"); |
|
if (name) { |
|
t.removeAttr("name").attr("switchbuttonName", name); |
|
_4cb.find(".switchbutton-value").attr("name", name); |
|
} |
|
_4cb._bind("_resize", function (e, _4cc) { |
|
if ($(this).hasClass("easyui-fluid") || _4cc) { |
|
_4cd(_4ca); |
|
} |
|
return false; |
|
}); |
|
return _4cb; |
|
}; |
|
function _4cd(_4ce, _4cf) { |
|
var _4d0 = $.data(_4ce, "switchbutton"); |
|
var opts = _4d0.options; |
|
var _4d1 = _4d0.switchbutton; |
|
if (_4cf) { |
|
$.extend(opts, _4cf); |
|
} |
|
var _4d2 = _4d1.is(":visible"); |
|
if (!_4d2) { |
|
_4d1.appendTo("body"); |
|
} |
|
_4d1._size(opts); |
|
if (opts.label && opts.labelPosition) { |
|
if (opts.labelPosition == "top") { |
|
_4d0.label._size({ |
|
width: opts.labelWidth |
|
}, _4d1); |
|
} else { |
|
_4d0.label._size({ |
|
width: opts.labelWidth, |
|
height: _4d1.outerHeight() |
|
}, _4d1); |
|
_4d0.label.css("lineHeight", _4d1.outerHeight() + "px"); |
|
} |
|
} |
|
var w = _4d1.width(); |
|
var h = _4d1.height(); |
|
var w = _4d1.outerWidth(); |
|
var h = _4d1.outerHeight(); |
|
var _4d3 = parseInt(opts.handleWidth) || _4d1.height(); |
|
var _4d4 = w * 2 - _4d3; |
|
_4d1.find(".switchbutton-inner").css({ |
|
width: _4d4 + "px", |
|
height: h + "px", |
|
lineHeight: h + "px" |
|
}); |
|
_4d1.find(".switchbutton-handle")._outerWidth(_4d3)._outerHeight(h).css({ |
|
marginLeft: -_4d3 / 2 + "px" |
|
}); |
|
_4d1.find(".switchbutton-on").css({ |
|
width: (w - _4d3 / 2) + "px", |
|
textIndent: (opts.reversed ? "" : "-") + _4d3 / 2 + "px" |
|
}); |
|
_4d1.find(".switchbutton-off").css({ |
|
width: (w - _4d3 / 2) + "px", |
|
textIndent: (opts.reversed ? "-" : "") + _4d3 / 2 + "px" |
|
}); |
|
opts.marginWidth = w - _4d3; |
|
_4d5(_4ce, opts.checked, false); |
|
if (!_4d2) { |
|
_4d1.insertAfter(_4ce); |
|
} |
|
}; |
|
function _4d6(_4d7) { |
|
var _4d8 = $.data(_4d7, "switchbutton"); |
|
var opts = _4d8.options; |
|
var _4d9 = _4d8.switchbutton; |
|
var _4da = _4d9.find(".switchbutton-inner"); |
|
var on = _4da.find(".switchbutton-on").html(opts.onText); |
|
var off = _4da.find(".switchbutton-off").html(opts.offText); |
|
var _4db = _4da.find(".switchbutton-handle").html(opts.handleText); |
|
if (opts.reversed) { |
|
off.prependTo(_4da); |
|
on.insertAfter(_4db); |
|
} else { |
|
on.prependTo(_4da); |
|
off.insertAfter(_4db); |
|
} |
|
var _4dc = "_easyui_switchbutton_" + (++_4c9); |
|
var _4dd = _4d9.find(".switchbutton-value")._propAttr("checked", opts.checked).attr("id", _4dc); |
|
_4dd._unbind(".switchbutton")._bind("change.switchbutton", function (e) { |
|
return false; |
|
}); |
|
_4d9.removeClass("switchbutton-reversed").addClass(opts.reversed ? "switchbutton-reversed" : ""); |
|
if (opts.label) { |
|
if (typeof opts.label == "object") { |
|
_4d8.label = $(opts.label); |
|
_4d8.label.attr("for", _4dc); |
|
} else { |
|
$(_4d8.label).remove(); |
|
_4d8.label = $("<label class=\"textbox-label\"></label>").html(opts.label); |
|
_4d8.label.css("textAlign", opts.labelAlign).attr("for", _4dc); |
|
if (opts.labelPosition == "after") { |
|
_4d8.label.insertAfter(_4d9); |
|
} else { |
|
_4d8.label.insertBefore(_4d7); |
|
} |
|
_4d8.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"); |
|
_4d8.label.addClass("textbox-label-" + opts.labelPosition); |
|
} |
|
} else { |
|
$(_4d8.label).remove(); |
|
} |
|
_4d5(_4d7, opts.checked); |
|
_4de(_4d7, opts.readonly); |
|
_4df(_4d7, opts.disabled); |
|
$(_4d7).switchbutton("setValue", opts.value); |
|
}; |
|
function _4d5(_4e0, _4e1, _4e2) { |
|
var _4e3 = $.data(_4e0, "switchbutton"); |
|
var opts = _4e3.options; |
|
var _4e4 = _4e3.switchbutton.find(".switchbutton-inner"); |
|
var _4e5 = _4e4.find(".switchbutton-on"); |
|
var _4e6 = opts.reversed ? (_4e1 ? opts.marginWidth : 0) : (_4e1 ? 0 : opts.marginWidth); |
|
var dir = _4e5.css("float").toLowerCase(); |
|
var css = {}; |
|
css["margin-" + dir] = -_4e6 + "px"; |
|
_4e2 ? _4e4.animate(css, 200) : _4e4.css(css); |
|
var _4e7 = _4e4.find(".switchbutton-value"); |
|
$(_4e0).add(_4e7)._propAttr("checked", _4e1); |
|
if (opts.checked != _4e1) { |
|
opts.checked = _4e1; |
|
opts.onChange.call(_4e0, opts.checked); |
|
$(_4e0).closest("form").trigger("_change", [_4e0]); |
|
} |
|
}; |
|
function _4df(_4e8, _4e9) { |
|
var _4ea = $.data(_4e8, "switchbutton"); |
|
var opts = _4ea.options; |
|
var _4eb = _4ea.switchbutton; |
|
var _4ec = _4eb.find(".switchbutton-value"); |
|
if (_4e9) { |
|
opts.disabled = true; |
|
$(_4e8).add(_4ec)._propAttr("disabled", true); |
|
_4eb.addClass("switchbutton-disabled"); |
|
_4eb.removeAttr("tabindex"); |
|
} else { |
|
opts.disabled = false; |
|
$(_4e8).add(_4ec)._propAttr("disabled", false); |
|
_4eb.removeClass("switchbutton-disabled"); |
|
_4eb.attr("tabindex", $(_4e8).attr("tabindex") || ""); |
|
} |
|
}; |
|
function _4de(_4ed, mode) { |
|
var _4ee = $.data(_4ed, "switchbutton"); |
|
var opts = _4ee.options; |
|
opts.readonly = mode == undefined ? true : mode; |
|
_4ee.switchbutton.removeClass("switchbutton-readonly").addClass(opts.readonly ? "switchbutton-readonly" : ""); |
|
}; |
|
function _4ef(_4f0) { |
|
var _4f1 = $.data(_4f0, "switchbutton"); |
|
var opts = _4f1.options; |
|
_4f1.switchbutton._unbind(".switchbutton")._bind("click.switchbutton", function () { |
|
if (!opts.disabled && !opts.readonly) { |
|
_4d5(_4f0, opts.checked ? false : true, true); |
|
} |
|
})._bind("keydown.switchbutton", function (e) { |
|
if (e.which == 13 || e.which == 32) { |
|
if (!opts.disabled && !opts.readonly) { |
|
_4d5(_4f0, opts.checked ? false : true, true); |
|
return false; |
|
} |
|
} |
|
}); |
|
}; |
|
$.fn.switchbutton = function (_4f2, _4f3) { |
|
if (typeof _4f2 == "string") { |
|
return $.fn.switchbutton.methods[_4f2](this, _4f3); |
|
} |
|
_4f2 = _4f2 || {}; |
|
return this.each(function () { |
|
var _4f4 = $.data(this, "switchbutton"); |
|
if (_4f4) { |
|
$.extend(_4f4.options, _4f2); |
|
} else { |
|
_4f4 = $.data(this, "switchbutton", { |
|
options: $.extend({}, $.fn.switchbutton.defaults, $.fn.switchbutton.parseOptions(this), _4f2), |
|
switchbutton: init(this) |
|
}); |
|
} |
|
_4f4.options.originalChecked = _4f4.options.checked; |
|
_4d6(this); |
|
_4cd(this); |
|
_4ef(this); |
|
}); |
|
}; |
|
$.fn.switchbutton.methods = { |
|
options: function (jq) { |
|
var _4f5 = jq.data("switchbutton"); |
|
return $.extend(_4f5.options, { |
|
value: _4f5.switchbutton.find(".switchbutton-value").val() |
|
}); |
|
}, |
|
resize: function (jq, _4f6) { |
|
return jq.each(function () { |
|
_4cd(this, _4f6); |
|
}); |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
_4df(this, false); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
_4df(this, true); |
|
}); |
|
}, |
|
readonly: function (jq, mode) { |
|
return jq.each(function () { |
|
_4de(this, mode); |
|
}); |
|
}, |
|
check: function (jq) { |
|
return jq.each(function () { |
|
_4d5(this, true); |
|
}); |
|
}, |
|
uncheck: function (jq) { |
|
return jq.each(function () { |
|
_4d5(this, false); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
_4d5(this, false); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).switchbutton("options"); |
|
_4d5(this, opts.originalChecked); |
|
}); |
|
}, |
|
setValue: function (jq, _4f7) { |
|
return jq.each(function () { |
|
$(this).val(_4f7); |
|
$.data(this, "switchbutton").switchbutton.find(".switchbutton-value").val(_4f7); |
|
}); |
|
} |
|
}; |
|
$.fn.switchbutton.parseOptions = function (_4f8) { |
|
var t = $(_4f8); |
|
return $.extend({}, $.parser.parseOptions(_4f8, ["onText", "offText", "handleText", { |
|
handleWidth: "number", |
|
reversed: "boolean" |
|
}, "label", "labelPosition", "labelAlign", { |
|
labelWidth: "number" |
|
} |
|
]), { |
|
value: (t.val() || undefined), |
|
checked: (t.attr("checked") ? true : undefined), |
|
disabled: (t.attr("disabled") ? true : undefined), |
|
readonly: (t.attr("readonly") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.switchbutton.defaults = { |
|
handleWidth: "auto", |
|
width: 60, |
|
height: 30, |
|
checked: false, |
|
disabled: false, |
|
readonly: false, |
|
reversed: false, |
|
onText: "ON", |
|
offText: "OFF", |
|
handleText: "", |
|
value: "on", |
|
label: null, |
|
labelWidth: "auto", |
|
labelPosition: "before", |
|
labelAlign: "left", |
|
onChange: function (_4f9) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
var _4fa = 1; |
|
function init(_4fb) { |
|
var _4fc = $("<span class=\"radiobutton inputbox\">" + "<span class=\"radiobutton-inner\" style=\"display:none\"></span>" + "<input type=\"radio\" class=\"radiobutton-value\">" + "</span>").insertAfter(_4fb); |
|
var t = $(_4fb); |
|
t.addClass("radiobutton-f").hide(); |
|
var name = t.attr("name"); |
|
if (name) { |
|
t.removeAttr("name").attr("radiobuttonName", name); |
|
_4fc.find(".radiobutton-value").attr("name", name); |
|
} |
|
return _4fc; |
|
}; |
|
function _4fd(_4fe) { |
|
var _4ff = $.data(_4fe, "radiobutton"); |
|
var opts = _4ff.options; |
|
var _500 = _4ff.radiobutton; |
|
var _501 = "_easyui_radiobutton_" + (++_4fa); |
|
var _502 = _500.find(".radiobutton-value").attr("id", _501); |
|
_502._unbind(".radiobutton")._bind("change.radiobutton", function (e) { |
|
return false; |
|
}); |
|
if (opts.label) { |
|
if (typeof opts.label == "object") { |
|
_4ff.label = $(opts.label); |
|
_4ff.label.attr("for", _501); |
|
} else { |
|
$(_4ff.label).remove(); |
|
_4ff.label = $("<label class=\"textbox-label\"></label>").html(opts.label); |
|
_4ff.label.css("textAlign", opts.labelAlign).attr("for", _501); |
|
if (opts.labelPosition == "after") { |
|
_4ff.label.insertAfter(_500); |
|
} else { |
|
_4ff.label.insertBefore(_4fe); |
|
} |
|
_4ff.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"); |
|
_4ff.label.addClass("textbox-label-" + opts.labelPosition); |
|
} |
|
} else { |
|
$(_4ff.label).remove(); |
|
} |
|
$(_4fe).radiobutton("setValue", opts.value); |
|
_503(_4fe, opts.checked); |
|
_504(_4fe, opts.readonly); |
|
_505(_4fe, opts.disabled); |
|
}; |
|
function _506(_507) { |
|
var _508 = $.data(_507, "radiobutton"); |
|
var opts = _508.options; |
|
var _509 = _508.radiobutton; |
|
_509._unbind(".radiobutton")._bind("click.radiobutton", function () { |
|
if (!opts.disabled && !opts.readonly) { |
|
_503(_507, true); |
|
} |
|
}); |
|
}; |
|
function _50a(_50b) { |
|
var _50c = $.data(_50b, "radiobutton"); |
|
var opts = _50c.options; |
|
var _50d = _50c.radiobutton; |
|
_50d._size(opts, _50d.parent()); |
|
if (opts.label && opts.labelPosition) { |
|
if (opts.labelPosition == "top") { |
|
_50c.label._size({ |
|
width: opts.labelWidth |
|
}, _50d); |
|
} else { |
|
_50c.label._size({ |
|
width: opts.labelWidth, |
|
height: _50d.outerHeight() |
|
}, _50d); |
|
_50c.label.css("lineHeight", _50d.outerHeight() + "px"); |
|
} |
|
} |
|
}; |
|
function _503(_50e, _50f) { |
|
if (_50f) { |
|
var f = $(_50e).closest("form"); |
|
var name = $(_50e).attr("radiobuttonName"); |
|
f.find(".radiobutton-f[radiobuttonName=\"" + name + "\"]").each(function () { |
|
if (this != _50e) { |
|
_510(this, false); |
|
} |
|
}); |
|
_510(_50e, true); |
|
} else { |
|
_510(_50e, false); |
|
} |
|
function _510(b, c) { |
|
var _511 = $(b).data("radiobutton"); |
|
var opts = _511.options; |
|
var _512 = _511.radiobutton; |
|
_512.find(".radiobutton-inner").css("display", c ? "" : "none"); |
|
_512.find(".radiobutton-value")._propAttr("checked", c); |
|
if (c) { |
|
_512.addClass("radiobutton-checked"); |
|
$(_511.label).addClass("textbox-label-checked"); |
|
} else { |
|
_512.removeClass("radiobutton-checked"); |
|
$(_511.label).removeClass("textbox-label-checked"); |
|
} |
|
if (opts.checked != c) { |
|
opts.checked = c; |
|
opts.onChange.call($(b)[0], c); |
|
$(b).closest("form").trigger("_change", [$(b)[0]]); |
|
} |
|
}; |
|
}; |
|
function _505(_513, _514) { |
|
var _515 = $.data(_513, "radiobutton"); |
|
var opts = _515.options; |
|
var _516 = _515.radiobutton; |
|
var rv = _516.find(".radiobutton-value"); |
|
opts.disabled = _514; |
|
if (_514) { |
|
$(_513).add(rv)._propAttr("disabled", true); |
|
_516.addClass("radiobutton-disabled"); |
|
$(_515.label).addClass("textbox-label-disabled"); |
|
} else { |
|
$(_513).add(rv)._propAttr("disabled", false); |
|
_516.removeClass("radiobutton-disabled"); |
|
$(_515.label).removeClass("textbox-label-disabled"); |
|
} |
|
}; |
|
function _504(_517, mode) { |
|
var _518 = $.data(_517, "radiobutton"); |
|
var opts = _518.options; |
|
opts.readonly = mode == undefined ? true : mode; |
|
if (opts.readonly) { |
|
_518.radiobutton.addClass("radiobutton-readonly"); |
|
$(_518.label).addClass("textbox-label-readonly"); |
|
} else { |
|
_518.radiobutton.removeClass("radiobutton-readonly"); |
|
$(_518.label).removeClass("textbox-label-readonly"); |
|
} |
|
}; |
|
$.fn.radiobutton = function (_519, _51a) { |
|
if (typeof _519 == "string") { |
|
return $.fn.radiobutton.methods[_519](this, _51a); |
|
} |
|
_519 = _519 || {}; |
|
return this.each(function () { |
|
var _51b = $.data(this, "radiobutton"); |
|
if (_51b) { |
|
$.extend(_51b.options, _519); |
|
} else { |
|
_51b = $.data(this, "radiobutton", { |
|
options: $.extend({}, $.fn.radiobutton.defaults, $.fn.radiobutton.parseOptions(this), _519), |
|
radiobutton: init(this) |
|
}); |
|
} |
|
_51b.options.originalChecked = _51b.options.checked; |
|
_4fd(this); |
|
_506(this); |
|
_50a(this); |
|
}); |
|
}; |
|
$.fn.radiobutton.methods = { |
|
options: function (jq) { |
|
var _51c = jq.data("radiobutton"); |
|
return $.extend(_51c.options, { |
|
value: _51c.radiobutton.find(".radiobutton-value").val() |
|
}); |
|
}, |
|
setValue: function (jq, _51d) { |
|
return jq.each(function () { |
|
$(this).val(_51d); |
|
$.data(this, "radiobutton").radiobutton.find(".radiobutton-value").val(_51d); |
|
}); |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
_505(this, false); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
_505(this, true); |
|
}); |
|
}, |
|
readonly: function (jq, mode) { |
|
return jq.each(function () { |
|
_504(this, mode); |
|
}); |
|
}, |
|
check: function (jq) { |
|
return jq.each(function () { |
|
_503(this, true); |
|
}); |
|
}, |
|
uncheck: function (jq) { |
|
return jq.each(function () { |
|
_503(this, false); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
_503(this, false); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).radiobutton("options"); |
|
_503(this, opts.originalChecked); |
|
}); |
|
} |
|
}; |
|
$.fn.radiobutton.parseOptions = function (_51e) { |
|
var t = $(_51e); |
|
return $.extend({}, $.parser.parseOptions(_51e, ["label", "labelPosition", "labelAlign", { |
|
labelWidth: "number" |
|
} |
|
]), { |
|
value: (t.val() || undefined), |
|
checked: (t.attr("checked") ? true : undefined), |
|
disabled: (t.attr("disabled") ? true : undefined), |
|
readonly: (t.attr("readonly") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.radiobutton.defaults = { |
|
width: 20, |
|
height: 20, |
|
value: null, |
|
disabled: false, |
|
readonly: false, |
|
checked: false, |
|
label: null, |
|
labelWidth: "auto", |
|
labelPosition: "before", |
|
labelAlign: "left", |
|
onChange: function (_51f) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
var _520 = 1; |
|
function init(_521) { |
|
var _522 = $("<span class=\"checkbox inputbox\">" + "<span class=\"checkbox-inner\">" + "<svg xml:space=\"preserve\" focusable=\"false\" version=\"1.1\" viewBox=\"0 0 24 24\"><path d=\"M4.1,12.7 9,17.6 20.3,6.3\" fill=\"none\" stroke=\"white\"></path></svg>" + "</span>" + "<input type=\"checkbox\" class=\"checkbox-value\">" + "</span>").insertAfter(_521); |
|
var t = $(_521); |
|
t.addClass("checkbox-f").hide(); |
|
var name = t.attr("name"); |
|
if (name) { |
|
t.removeAttr("name").attr("checkboxName", name); |
|
_522.find(".checkbox-value").attr("name", name); |
|
} |
|
return _522; |
|
}; |
|
function _523(_524) { |
|
var _525 = $.data(_524, "checkbox"); |
|
var opts = _525.options; |
|
var _526 = _525.checkbox; |
|
var _527 = "_easyui_checkbox_" + (++_520); |
|
var _528 = _526.find(".checkbox-value").attr("id", _527); |
|
_528._unbind(".checkbox")._bind("change.checkbox", function (e) { |
|
return false; |
|
}); |
|
if (opts.label) { |
|
if (typeof opts.label == "object") { |
|
_525.label = $(opts.label); |
|
_525.label.attr("for", _527); |
|
} else { |
|
$(_525.label).remove(); |
|
_525.label = $("<label class=\"textbox-label\"></label>").html(opts.label); |
|
_525.label.css("textAlign", opts.labelAlign).attr("for", _527); |
|
if (opts.labelPosition == "after") { |
|
_525.label.insertAfter(_526); |
|
} else { |
|
_525.label.insertBefore(_524); |
|
} |
|
_525.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"); |
|
_525.label.addClass("textbox-label-" + opts.labelPosition); |
|
} |
|
} else { |
|
$(_525.label).remove(); |
|
} |
|
$(_524).checkbox("setValue", opts.value); |
|
_529(_524, opts.checked); |
|
_52a(_524, opts.readonly); |
|
_52b(_524, opts.disabled); |
|
}; |
|
function _52c(_52d) { |
|
var _52e = $.data(_52d, "checkbox"); |
|
var opts = _52e.options; |
|
var _52f = _52e.checkbox; |
|
_52f._unbind(".checkbox")._bind("click.checkbox", function () { |
|
if (!opts.disabled && !opts.readonly) { |
|
_529(_52d, !opts.checked); |
|
} |
|
}); |
|
}; |
|
function _530(_531) { |
|
var _532 = $.data(_531, "checkbox"); |
|
var opts = _532.options; |
|
var _533 = _532.checkbox; |
|
_533._size(opts, _533.parent()); |
|
if (opts.label && opts.labelPosition) { |
|
if (opts.labelPosition == "top") { |
|
_532.label._size({ |
|
width: opts.labelWidth |
|
}, _533); |
|
} else { |
|
_532.label._size({ |
|
width: opts.labelWidth, |
|
height: _533.outerHeight() |
|
}, _533); |
|
_532.label.css("lineHeight", _533.outerHeight() + "px"); |
|
} |
|
} |
|
}; |
|
function _529(_534, _535) { |
|
var _536 = $.data(_534, "checkbox"); |
|
var opts = _536.options; |
|
var _537 = _536.checkbox; |
|
_537.find(".checkbox-value")._propAttr("checked", _535); |
|
var _538 = _537.find(".checkbox-inner").css("display", _535 ? "" : "none"); |
|
if (_535) { |
|
_537.addClass("checkbox-checked"); |
|
$(_536.label).addClass("textbox-label-checked"); |
|
} else { |
|
_537.removeClass("checkbox-checked"); |
|
$(_536.label).removeClass("textbox-label-checked"); |
|
} |
|
if (opts.checked != _535) { |
|
opts.checked = _535; |
|
opts.onChange.call(_534, _535); |
|
$(_534).closest("form").trigger("_change", [_534]); |
|
} |
|
}; |
|
function _52a(_539, mode) { |
|
var _53a = $.data(_539, "checkbox"); |
|
var opts = _53a.options; |
|
opts.readonly = mode == undefined ? true : mode; |
|
if (opts.readonly) { |
|
_53a.checkbox.addClass("checkbox-readonly"); |
|
$(_53a.label).addClass("textbox-label-readonly"); |
|
} else { |
|
_53a.checkbox.removeClass("checkbox-readonly"); |
|
$(_53a.label).removeClass("textbox-label-readonly"); |
|
} |
|
}; |
|
function _52b(_53b, _53c) { |
|
var _53d = $.data(_53b, "checkbox"); |
|
var opts = _53d.options; |
|
var _53e = _53d.checkbox; |
|
var rv = _53e.find(".checkbox-value"); |
|
opts.disabled = _53c; |
|
if (_53c) { |
|
$(_53b).add(rv)._propAttr("disabled", true); |
|
_53e.addClass("checkbox-disabled"); |
|
$(_53d.label).addClass("textbox-label-disabled"); |
|
} else { |
|
$(_53b).add(rv)._propAttr("disabled", false); |
|
_53e.removeClass("checkbox-disabled"); |
|
$(_53d.label).removeClass("textbox-label-disabled"); |
|
} |
|
}; |
|
$.fn.checkbox = function (_53f, _540) { |
|
if (typeof _53f == "string") { |
|
return $.fn.checkbox.methods[_53f](this, _540); |
|
} |
|
_53f = _53f || {}; |
|
return this.each(function () { |
|
var _541 = $.data(this, "checkbox"); |
|
if (_541) { |
|
$.extend(_541.options, _53f); |
|
} else { |
|
_541 = $.data(this, "checkbox", { |
|
options: $.extend({}, $.fn.checkbox.defaults, $.fn.checkbox.parseOptions(this), _53f), |
|
checkbox: init(this) |
|
}); |
|
} |
|
_541.options.originalChecked = _541.options.checked; |
|
_523(this); |
|
_52c(this); |
|
_530(this); |
|
}); |
|
}; |
|
$.fn.checkbox.methods = { |
|
options: function (jq) { |
|
var _542 = jq.data("checkbox"); |
|
return $.extend(_542.options, { |
|
value: _542.checkbox.find(".checkbox-value").val() |
|
}); |
|
}, |
|
setValue: function (jq, _543) { |
|
return jq.each(function () { |
|
$(this).val(_543); |
|
$.data(this, "checkbox").checkbox.find(".checkbox-value").val(_543); |
|
}); |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
_52b(this, false); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
_52b(this, true); |
|
}); |
|
}, |
|
readonly: function (jq, mode) { |
|
return jq.each(function () { |
|
_52a(this, mode); |
|
}); |
|
}, |
|
check: function (jq) { |
|
return jq.each(function () { |
|
_529(this, true); |
|
}); |
|
}, |
|
uncheck: function (jq) { |
|
return jq.each(function () { |
|
_529(this, false); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
_529(this, false); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).checkbox("options"); |
|
_529(this, opts.originalChecked); |
|
}); |
|
} |
|
}; |
|
$.fn.checkbox.parseOptions = function (_544) { |
|
var t = $(_544); |
|
return $.extend({}, $.parser.parseOptions(_544, ["label", "labelPosition", "labelAlign", { |
|
labelWidth: "number" |
|
} |
|
]), { |
|
value: (t.val() || undefined), |
|
checked: (t.attr("checked") ? true : undefined), |
|
disabled: (t.attr("disabled") ? true : undefined), |
|
readonly: (t.attr("readonly") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.checkbox.defaults = { |
|
width: 20, |
|
height: 20, |
|
value: null, |
|
disabled: false, |
|
readonly: false, |
|
checked: false, |
|
label: null, |
|
labelWidth: "auto", |
|
labelPosition: "before", |
|
labelAlign: "left", |
|
onChange: function (_545) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function init(_546) { |
|
$(_546).addClass("validatebox-text"); |
|
}; |
|
function _547(_548) { |
|
var _549 = $.data(_548, "validatebox"); |
|
_549.validating = false; |
|
if (_549.vtimer) { |
|
clearTimeout(_549.vtimer); |
|
} |
|
if (_549.ftimer) { |
|
clearTimeout(_549.ftimer); |
|
} |
|
$(_548).tooltip("destroy"); |
|
$(_548)._unbind(); |
|
$(_548).remove(); |
|
}; |
|
function _54a(_54b) { |
|
var opts = $.data(_54b, "validatebox").options; |
|
$(_54b)._unbind(".validatebox"); |
|
if (opts.novalidate || opts.disabled) { |
|
return; |
|
} |
|
for (var _54c in opts.events) { |
|
$(_54b)._bind(_54c + ".validatebox", { |
|
target: _54b |
|
}, opts.events[_54c]); |
|
} |
|
}; |
|
function _54d(e) { |
|
var _54e = e.data.target; |
|
var _54f = $.data(_54e, "validatebox"); |
|
var opts = _54f.options; |
|
if ($(_54e).attr("readonly")) { |
|
return; |
|
} |
|
_54f.validating = true; |
|
_54f.value = opts.val(_54e); |
|
(function () { |
|
if (!$(_54e).is(":visible")) { |
|
_54f.validating = false; |
|
} |
|
if (_54f.validating) { |
|
var _550 = opts.val(_54e); |
|
if (_54f.value != _550) { |
|
_54f.value = _550; |
|
if (_54f.vtimer) { |
|
clearTimeout(_54f.vtimer); |
|
} |
|
_54f.vtimer = setTimeout(function () { |
|
$(_54e).validatebox("validate"); |
|
}, opts.delay); |
|
} else { |
|
if (_54f.message) { |
|
opts.err(_54e, _54f.message); |
|
} |
|
} |
|
_54f.ftimer = setTimeout(arguments.callee, opts.interval); |
|
} |
|
})(); |
|
}; |
|
function _551(e) { |
|
var _552 = e.data.target; |
|
var _553 = $.data(_552, "validatebox"); |
|
var opts = _553.options; |
|
_553.validating = false; |
|
if (_553.vtimer) { |
|
clearTimeout(_553.vtimer); |
|
_553.vtimer = undefined; |
|
} |
|
if (_553.ftimer) { |
|
clearTimeout(_553.ftimer); |
|
_553.ftimer = undefined; |
|
} |
|
if (opts.validateOnBlur) { |
|
setTimeout(function () { |
|
$(_552).validatebox("validate"); |
|
}, 0); |
|
} |
|
opts.err(_552, _553.message, "hide"); |
|
}; |
|
function _554(e) { |
|
var _555 = e.data.target; |
|
var _556 = $.data(_555, "validatebox"); |
|
_556.options.err(_555, _556.message, "show"); |
|
}; |
|
function _557(e) { |
|
var _558 = e.data.target; |
|
var _559 = $.data(_558, "validatebox"); |
|
if (!_559.validating) { |
|
_559.options.err(_558, _559.message, "hide"); |
|
} |
|
}; |
|
function _55a(_55b, _55c, _55d) { |
|
var _55e = $.data(_55b, "validatebox"); |
|
var opts = _55e.options; |
|
var t = $(_55b); |
|
if (_55d == "hide" || !_55c) { |
|
t.tooltip("hide"); |
|
} else { |
|
if ((t.is(":focus") && _55e.validating) || _55d == "show") { |
|
t.tooltip($.extend({}, opts.tipOptions, { |
|
content: _55c, |
|
position: opts.tipPosition, |
|
deltaX: opts.deltaX, |
|
deltaY: opts.deltaY |
|
})).tooltip("show"); |
|
} |
|
} |
|
}; |
|
function _55f(_560) { |
|
var _561 = $.data(_560, "validatebox"); |
|
var opts = _561.options; |
|
var box = $(_560); |
|
opts.onBeforeValidate.call(_560); |
|
var _562 = _563(); |
|
_562 ? box.removeClass("validatebox-invalid") : box.addClass("validatebox-invalid"); |
|
opts.err(_560, _561.message); |
|
opts.onValidate.call(_560, _562); |
|
return _562; |
|
function _564(msg) { |
|
_561.message = msg; |
|
}; |
|
function _565(_566, _567) { |
|
var _568 = opts.val(_560); |
|
var _569 = /([a-zA-Z_]+)(.*)/.exec(_566); |
|
var rule = opts.rules[_569[1]]; |
|
if (rule && _568) { |
|
var _56a = _567 || opts.validParams || eval(_569[2]); |
|
if (!rule["validator"].call(_560, _568, _56a)) { |
|
var _56b = rule["message"]; |
|
if (_56a) { |
|
for (var i = 0; i < _56a.length; i++) { |
|
_56b = _56b.replace(new RegExp("\\{" + i + "\\}", "g"), _56a[i]); |
|
} |
|
} |
|
_564(opts.invalidMessage || _56b); |
|
return false; |
|
} |
|
} |
|
return true; |
|
}; |
|
function _563() { |
|
_564(""); |
|
if (!opts._validateOnCreate) { |
|
setTimeout(function () { |
|
opts._validateOnCreate = true; |
|
}, 0); |
|
return true; |
|
} |
|
if (opts.novalidate || opts.disabled) { |
|
return true; |
|
} |
|
if (opts.required) { |
|
if (opts.val(_560) == "") { |
|
_564(opts.missingMessage); |
|
return false; |
|
} |
|
} |
|
if (opts.validType) { |
|
if ($.isArray(opts.validType)) { |
|
for (var i = 0; i < opts.validType.length; i++) { |
|
if (!_565(opts.validType[i])) { |
|
return false; |
|
} |
|
} |
|
} else { |
|
if (typeof opts.validType == "string") { |
|
if (!_565(opts.validType)) { |
|
return false; |
|
} |
|
} else { |
|
for (var _56c in opts.validType) { |
|
var _56d = opts.validType[_56c]; |
|
if (!_565(_56c, _56d)) { |
|
return false; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return true; |
|
}; |
|
}; |
|
function _56e(_56f, _570) { |
|
var opts = $.data(_56f, "validatebox").options; |
|
if (_570 != undefined) { |
|
opts.disabled = _570; |
|
} |
|
if (opts.disabled) { |
|
$(_56f).addClass("validatebox-disabled")._propAttr("disabled", true); |
|
} else { |
|
$(_56f).removeClass("validatebox-disabled")._propAttr("disabled", false); |
|
} |
|
}; |
|
function _571(_572, mode) { |
|
var opts = $.data(_572, "validatebox").options; |
|
opts.readonly = mode == undefined ? true : mode; |
|
if (opts.readonly || !opts.editable) { |
|
$(_572).triggerHandler("blur.validatebox"); |
|
$(_572).addClass("validatebox-readonly")._propAttr("readonly", true); |
|
} else { |
|
$(_572).removeClass("validatebox-readonly")._propAttr("readonly", false); |
|
} |
|
}; |
|
$.fn.validatebox = function (_573, _574) { |
|
if (typeof _573 == "string") { |
|
return $.fn.validatebox.methods[_573](this, _574); |
|
} |
|
_573 = _573 || {}; |
|
return this.each(function () { |
|
var _575 = $.data(this, "validatebox"); |
|
if (_575) { |
|
$.extend(_575.options, _573); |
|
} else { |
|
init(this); |
|
_575 = $.data(this, "validatebox", { |
|
options: $.extend({}, $.fn.validatebox.defaults, $.fn.validatebox.parseOptions(this), _573) |
|
}); |
|
} |
|
_575.options._validateOnCreate = _575.options.validateOnCreate; |
|
_56e(this, _575.options.disabled); |
|
_571(this, _575.options.readonly); |
|
_54a(this); |
|
_55f(this); |
|
}); |
|
}; |
|
$.fn.validatebox.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "validatebox").options; |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
_547(this); |
|
}); |
|
}, |
|
validate: function (jq) { |
|
return jq.each(function () { |
|
_55f(this); |
|
}); |
|
}, |
|
isValid: function (jq) { |
|
return _55f(jq[0]); |
|
}, |
|
enableValidation: function (jq) { |
|
return jq.each(function () { |
|
$(this).validatebox("options").novalidate = false; |
|
_54a(this); |
|
_55f(this); |
|
}); |
|
}, |
|
disableValidation: function (jq) { |
|
return jq.each(function () { |
|
$(this).validatebox("options").novalidate = true; |
|
_54a(this); |
|
_55f(this); |
|
}); |
|
}, |
|
resetValidation: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).validatebox("options"); |
|
opts._validateOnCreate = opts.validateOnCreate; |
|
_55f(this); |
|
}); |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
_56e(this, false); |
|
_54a(this); |
|
_55f(this); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
_56e(this, true); |
|
_54a(this); |
|
_55f(this); |
|
}); |
|
}, |
|
readonly: function (jq, mode) { |
|
return jq.each(function () { |
|
_571(this, mode); |
|
_54a(this); |
|
_55f(this); |
|
}); |
|
} |
|
}; |
|
$.fn.validatebox.parseOptions = function (_576) { |
|
var t = $(_576); |
|
return $.extend({}, $.parser.parseOptions(_576, ["validType", "missingMessage", "invalidMessage", "tipPosition", { |
|
delay: "number", |
|
interval: "number", |
|
deltaX: "number" |
|
}, { |
|
editable: "boolean", |
|
validateOnCreate: "boolean", |
|
validateOnBlur: "boolean" |
|
} |
|
]), { |
|
required: (t.attr("required") ? true : undefined), |
|
disabled: (t.attr("disabled") ? true : undefined), |
|
readonly: (t.attr("readonly") ? true : undefined), |
|
novalidate: (t.attr("novalidate") != undefined ? true : undefined) |
|
}); |
|
}; |
|
$.fn.validatebox.defaults = { |
|
required: false, |
|
validType: null, |
|
validParams: null, |
|
delay: 200, |
|
interval: 200, |
|
missingMessage: "This field is required.", |
|
invalidMessage: null, |
|
tipPosition: "right", |
|
deltaX: 0, |
|
deltaY: 0, |
|
novalidate: false, |
|
editable: true, |
|
disabled: false, |
|
readonly: false, |
|
validateOnCreate: true, |
|
validateOnBlur: false, |
|
events: { |
|
focus: _54d, |
|
blur: _551, |
|
mouseenter: _554, |
|
mouseleave: _557, |
|
click: function (e) { |
|
var t = $(e.data.target); |
|
if (t.attr("type") == "checkbox" || t.attr("type") == "radio") { |
|
t.focus().validatebox("validate"); |
|
} |
|
} |
|
}, |
|
val: function (_577) { |
|
return $(_577).val(); |
|
}, |
|
err: function (_578, _579, _57a) { |
|
_55a(_578, _579, _57a); |
|
}, |
|
tipOptions: { |
|
showEvent: "none", |
|
hideEvent: "none", |
|
showDelay: 0, |
|
hideDelay: 0, |
|
zIndex: "", |
|
onShow: function () { |
|
$(this).tooltip("tip").css({ |
|
color: "#000", |
|
borderColor: "#CC9933", |
|
backgroundColor: "#FFFFCC" |
|
}); |
|
}, |
|
onHide: function () { |
|
$(this).tooltip("destroy"); |
|
} |
|
}, |
|
rules: { |
|
email: { |
|
validator: function (_57b) { |
|
return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(_57b); |
|
}, |
|
message: "Please enter a valid email address." |
|
}, |
|
url: { |
|
validator: function (_57c) { |
|
return /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(_57c); |
|
}, |
|
message: "Please enter a valid URL." |
|
}, |
|
length: { |
|
validator: function (_57d, _57e) { |
|
var len = $.trim(_57d).length; |
|
return len >= _57e[0] && len <= _57e[1]; |
|
}, |
|
message: "Please enter a value between {0} and {1}." |
|
}, |
|
remote: { |
|
validator: function (_57f, _580) { |
|
var data = {}; |
|
data[_580[1]] = _57f; |
|
var _581 = $.ajax({ |
|
url: _580[0], |
|
dataType: "json", |
|
data: data, |
|
async: false, |
|
cache: false, |
|
type: "post" |
|
}).responseText; |
|
return _581 == "true"; |
|
}, |
|
message: "Please fix this field." |
|
} |
|
}, |
|
onBeforeValidate: function () {}, |
|
onValidate: function (_582) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
var _583 = 0; |
|
function init(_584) { |
|
$(_584).addClass("textbox-f").hide(); |
|
var span = $("<span class=\"textbox\">" + "<input class=\"textbox-text\" autocomplete=\"off\">" + "<input type=\"hidden\" class=\"textbox-value\">" + "</span>").insertAfter(_584); |
|
var name = $(_584).attr("name"); |
|
if (name) { |
|
span.find("input.textbox-value").attr("name", name); |
|
$(_584).removeAttr("name").attr("textboxName", name); |
|
} |
|
return span; |
|
}; |
|
function _585(_586) { |
|
var _587 = $.data(_586, "textbox"); |
|
var opts = _587.options; |
|
var tb = _587.textbox; |
|
var _588 = "_easyui_textbox_input" + (++_583); |
|
tb.addClass(opts.cls); |
|
tb.find(".textbox-text").remove(); |
|
if (opts.multiline) { |
|
$("<textarea id=\"" + _588 + "\" class=\"textbox-text\" autocomplete=\"off\"></textarea>").prependTo(tb); |
|
} else { |
|
$("<input id=\"" + _588 + "\" type=\"" + opts.type + "\" class=\"textbox-text\" autocomplete=\"off\">").prependTo(tb); |
|
} |
|
$("#" + _588).attr("tabindex", $(_586).attr("tabindex") || "").css("text-align", _586.style.textAlign || ""); |
|
tb.find(".textbox-addon").remove(); |
|
var bb = opts.icons ? $.extend(true, [], opts.icons) : []; |
|
if (opts.iconCls) { |
|
bb.push({ |
|
iconCls: opts.iconCls, |
|
disabled: true |
|
}); |
|
} |
|
if (bb.length) { |
|
var bc = $("<span class=\"textbox-addon\"></span>").prependTo(tb); |
|
bc.addClass("textbox-addon-" + opts.iconAlign); |
|
for (var i = 0; i < bb.length; i++) { |
|
bc.append("<a href=\"javascript:;\" class=\"textbox-icon " + bb[i].iconCls + "\" icon-index=\"" + i + "\" tabindex=\"-1\"></a>"); |
|
} |
|
} |
|
tb.find(".textbox-button").remove(); |
|
if (opts.buttonText || opts.buttonIcon) { |
|
var btn = $("<a href=\"javascript:;\" class=\"textbox-button\"></a>").prependTo(tb); |
|
btn.addClass("textbox-button-" + opts.buttonAlign).linkbutton({ |
|
text: opts.buttonText, |
|
iconCls: opts.buttonIcon, |
|
onClick: function () { |
|
var t = $(this).parent().prev(); |
|
t.textbox("options").onClickButton.call(t[0]); |
|
} |
|
}); |
|
} |
|
if (opts.label) { |
|
if (typeof opts.label == "object") { |
|
_587.label = $(opts.label); |
|
_587.label.attr("for", _588); |
|
} else { |
|
$(_587.label).remove(); |
|
_587.label = $("<label class=\"textbox-label\"></label>").html(opts.label); |
|
_587.label.css("textAlign", opts.labelAlign).attr("for", _588); |
|
if (opts.labelPosition == "after") { |
|
_587.label.insertAfter(tb); |
|
} else { |
|
_587.label.insertBefore(_586); |
|
} |
|
_587.label.removeClass("textbox-label-left textbox-label-right textbox-label-top"); |
|
_587.label.addClass("textbox-label-" + opts.labelPosition); |
|
} |
|
} else { |
|
$(_587.label).remove(); |
|
} |
|
_589(_586); |
|
_58a(_586, opts.disabled); |
|
_58b(_586, opts.readonly); |
|
}; |
|
function _58c(_58d) { |
|
var _58e = $.data(_58d, "textbox"); |
|
var tb = _58e.textbox; |
|
tb.find(".textbox-text").validatebox("destroy"); |
|
tb.remove(); |
|
$(_58e.label).remove(); |
|
$(_58d).remove(); |
|
}; |
|
function _58f(_590, _591) { |
|
var _592 = $.data(_590, "textbox"); |
|
var opts = _592.options; |
|
var tb = _592.textbox; |
|
var _593 = tb.parent(); |
|
if (_591) { |
|
if (typeof _591 == "object") { |
|
$.extend(opts, _591); |
|
} else { |
|
opts.width = _591; |
|
} |
|
} |
|
if (isNaN(parseInt(opts.width))) { |
|
var c = $(_590).clone(); |
|
c.css("visibility", "hidden"); |
|
c.insertAfter(_590); |
|
opts.width = c.outerWidth(); |
|
c.remove(); |
|
} |
|
var _594 = tb.is(":visible"); |
|
if (!_594) { |
|
tb.appendTo("body"); |
|
} |
|
var _595 = tb.find(".textbox-text"); |
|
var btn = tb.find(".textbox-button"); |
|
var _596 = tb.find(".textbox-addon"); |
|
var _597 = _596.find(".textbox-icon"); |
|
if (opts.height == "auto") { |
|
_595.css({ |
|
margin: "", |
|
paddingTop: "", |
|
paddingBottom: "", |
|
height: "", |
|
lineHeight: "" |
|
}); |
|
} |
|
tb._size(opts, _593); |
|
if (opts.label && opts.labelPosition) { |
|
if (opts.labelPosition == "top") { |
|
_592.label._size({ |
|
width: opts.labelWidth == "auto" ? tb.outerWidth() : opts.labelWidth |
|
}, tb); |
|
if (opts.height != "auto") { |
|
tb._size("height", tb.outerHeight() - _592.label.outerHeight()); |
|
} |
|
} else { |
|
_592.label._size({ |
|
width: opts.labelWidth, |
|
height: tb.outerHeight() |
|
}, tb); |
|
if (!opts.multiline) { |
|
_592.label.css("lineHeight", _592.label.height() + "px"); |
|
} |
|
tb._size("width", tb.outerWidth() - _592.label.outerWidth()); |
|
} |
|
} |
|
if (opts.buttonAlign == "left" || opts.buttonAlign == "right") { |
|
btn.linkbutton("resize", { |
|
height: tb.height() |
|
}); |
|
} else { |
|
btn.linkbutton("resize", { |
|
width: "100%" |
|
}); |
|
} |
|
var _598 = tb.width() - _597.length * opts.iconWidth - _599("left") - _599("right"); |
|
var _59a = opts.height == "auto" ? _595.outerHeight() : (tb.height() - _599("top") - _599("bottom")); |
|
_596.css(opts.iconAlign, _599(opts.iconAlign) + "px"); |
|
_596.css("top", _599("top") + "px"); |
|
_597.css({ |
|
width: opts.iconWidth + "px", |
|
height: _59a + "px" |
|
}); |
|
_595.css({ |
|
paddingLeft: (_590.style.paddingLeft || ""), |
|
paddingRight: (_590.style.paddingRight || ""), |
|
marginLeft: _59b("left"), |
|
marginRight: _59b("right"), |
|
marginTop: _599("top"), |
|
marginBottom: _599("bottom") |
|
}); |
|
if (opts.multiline) { |
|
_595.css({ |
|
paddingTop: (_590.style.paddingTop || ""), |
|
paddingBottom: (_590.style.paddingBottom || "") |
|
}); |
|
_595._outerHeight(_59a); |
|
} else { |
|
_595.css({ |
|
paddingTop: 0, |
|
paddingBottom: 0, |
|
height: _59a + "px", |
|
lineHeight: _59a + "px" |
|
}); |
|
} |
|
_595._outerWidth(_598); |
|
opts.onResizing.call(_590, opts.width, opts.height); |
|
if (!_594) { |
|
tb.insertAfter(_590); |
|
} |
|
opts.onResize.call(_590, opts.width, opts.height); |
|
function _59b(_59c) { |
|
return (opts.iconAlign == _59c ? _596._outerWidth() : 0) + _599(_59c); |
|
}; |
|
function _599(_59d) { |
|
var w = 0; |
|
btn.filter(".textbox-button-" + _59d).each(function () { |
|
if (_59d == "left" || _59d == "right") { |
|
w += $(this).outerWidth(); |
|
} else { |
|
w += $(this).outerHeight(); |
|
} |
|
}); |
|
return w; |
|
}; |
|
}; |
|
function _589(_59e) { |
|
var opts = $(_59e).textbox("options"); |
|
var _59f = $(_59e).textbox("textbox"); |
|
_59f.validatebox($.extend({}, opts, { |
|
deltaX: function (_5a0) { |
|
return $(_59e).textbox("getTipX", _5a0); |
|
}, |
|
deltaY: function (_5a1) { |
|
return $(_59e).textbox("getTipY", _5a1); |
|
}, |
|
onBeforeValidate: function () { |
|
opts.onBeforeValidate.call(_59e); |
|
var box = $(this); |
|
if (!box.is(":focus")) { |
|
if (box.val() !== opts.value) { |
|
opts.oldInputValue = box.val(); |
|
box.val(opts.value); |
|
} |
|
} |
|
}, |
|
onValidate: function (_5a2) { |
|
var box = $(this); |
|
if (opts.oldInputValue != undefined) { |
|
box.val(opts.oldInputValue); |
|
opts.oldInputValue = undefined; |
|
} |
|
var tb = box.parent(); |
|
if (_5a2) { |
|
tb.removeClass("textbox-invalid"); |
|
} else { |
|
tb.addClass("textbox-invalid"); |
|
} |
|
opts.onValidate.call(_59e, _5a2); |
|
} |
|
})); |
|
}; |
|
function _5a3(_5a4) { |
|
var _5a5 = $.data(_5a4, "textbox"); |
|
var opts = _5a5.options; |
|
var tb = _5a5.textbox; |
|
var _5a6 = tb.find(".textbox-text"); |
|
_5a6.attr("placeholder", opts.prompt); |
|
_5a6._unbind(".textbox"); |
|
$(_5a5.label)._unbind(".textbox"); |
|
if (!opts.disabled && !opts.readonly) { |
|
if (_5a5.label) { |
|
$(_5a5.label)._bind("click.textbox", function (e) { |
|
if (!opts.hasFocusMe) { |
|
_5a6.focus(); |
|
$(_5a4).textbox("setSelectionRange", { |
|
start: 0, |
|
end: _5a6.val().length |
|
}); |
|
} |
|
}); |
|
} |
|
_5a6._bind("blur.textbox", function (e) { |
|
if (!tb.hasClass("textbox-focused")) { |
|
return; |
|
} |
|
opts.value = $(this).val(); |
|
if (opts.value == "") { |
|
$(this).val(opts.prompt).addClass("textbox-prompt"); |
|
} else { |
|
$(this).removeClass("textbox-prompt"); |
|
} |
|
tb.removeClass("textbox-focused"); |
|
tb.closest(".form-field").removeClass("form-field-focused"); |
|
})._bind("focus.textbox", function (e) { |
|
opts.hasFocusMe = true; |
|
if (tb.hasClass("textbox-focused")) { |
|
return; |
|
} |
|
if ($(this).val() != opts.value) { |
|
$(this).val(opts.value); |
|
} |
|
$(this).removeClass("textbox-prompt"); |
|
tb.addClass("textbox-focused"); |
|
tb.closest(".form-field").addClass("form-field-focused"); |
|
}); |
|
for (var _5a7 in opts.inputEvents) { |
|
_5a6._bind(_5a7 + ".textbox", { |
|
target: _5a4 |
|
}, opts.inputEvents[_5a7]); |
|
} |
|
} |
|
var _5a8 = tb.find(".textbox-addon"); |
|
_5a8._unbind()._bind("click", { |
|
target: _5a4 |
|
}, function (e) { |
|
var icon = $(e.target).closest("a.textbox-icon:not(.textbox-icon-disabled)"); |
|
if (icon.length) { |
|
var _5a9 = parseInt(icon.attr("icon-index")); |
|
var conf = opts.icons[_5a9]; |
|
if (conf && conf.handler) { |
|
conf.handler.call(icon[0], e); |
|
} |
|
opts.onClickIcon.call(_5a4, _5a9); |
|
} |
|
}); |
|
_5a8.find(".textbox-icon").each(function (_5aa) { |
|
var conf = opts.icons[_5aa]; |
|
var icon = $(this); |
|
if (!conf || conf.disabled || opts.disabled || opts.readonly) { |
|
icon.addClass("textbox-icon-disabled"); |
|
} else { |
|
icon.removeClass("textbox-icon-disabled"); |
|
} |
|
}); |
|
var btn = tb.find(".textbox-button"); |
|
btn.linkbutton((opts.disabled || opts.readonly) ? "disable" : "enable"); |
|
tb._unbind(".textbox")._bind("_resize.textbox", function (e, _5ab) { |
|
if ($(this).hasClass("easyui-fluid") || _5ab) { |
|
_58f(_5a4); |
|
} |
|
return false; |
|
}); |
|
}; |
|
function _58a(_5ac, _5ad) { |
|
var _5ae = $.data(_5ac, "textbox"); |
|
var opts = _5ae.options; |
|
var tb = _5ae.textbox; |
|
var _5af = tb.find(".textbox-text"); |
|
var ss = $(_5ac).add(tb.find(".textbox-value")); |
|
opts.disabled = _5ad; |
|
if (opts.disabled) { |
|
_5af.blur(); |
|
_5af.validatebox("disable"); |
|
tb.addClass("textbox-disabled"); |
|
ss._propAttr("disabled", true); |
|
$(_5ae.label).addClass("textbox-label-disabled"); |
|
} else { |
|
_5af.validatebox("enable"); |
|
tb.removeClass("textbox-disabled"); |
|
ss._propAttr("disabled", false); |
|
$(_5ae.label).removeClass("textbox-label-disabled"); |
|
} |
|
}; |
|
function _58b(_5b0, mode) { |
|
var _5b1 = $.data(_5b0, "textbox"); |
|
var opts = _5b1.options; |
|
var tb = _5b1.textbox; |
|
var _5b2 = tb.find(".textbox-text"); |
|
opts.readonly = mode == undefined ? true : mode; |
|
if (opts.readonly) { |
|
_5b2.triggerHandler("blur.textbox"); |
|
} |
|
_5b2.validatebox("readonly", opts.readonly); |
|
if (opts.readonly) { |
|
tb.addClass("textbox-readonly"); |
|
$(_5b1.label).addClass("textbox-label-readonly"); |
|
} else { |
|
tb.removeClass("textbox-readonly"); |
|
$(_5b1.label).removeClass("textbox-label-readonly"); |
|
} |
|
}; |
|
$.fn.textbox = function (_5b3, _5b4) { |
|
if (typeof _5b3 == "string") { |
|
var _5b5 = $.fn.textbox.methods[_5b3]; |
|
if (_5b5) { |
|
return _5b5(this, _5b4); |
|
} else { |
|
return this.each(function () { |
|
var _5b6 = $(this).textbox("textbox"); |
|
_5b6.validatebox(_5b3, _5b4); |
|
}); |
|
} |
|
} |
|
_5b3 = _5b3 || {}; |
|
return this.each(function () { |
|
var _5b7 = $.data(this, "textbox"); |
|
if (_5b7) { |
|
$.extend(_5b7.options, _5b3); |
|
if (_5b3.value != undefined) { |
|
_5b7.options.originalValue = _5b3.value; |
|
} |
|
} else { |
|
_5b7 = $.data(this, "textbox", { |
|
options: $.extend({}, $.fn.textbox.defaults, $.fn.textbox.parseOptions(this), _5b3), |
|
textbox: init(this) |
|
}); |
|
_5b7.options.originalValue = _5b7.options.value; |
|
} |
|
_585(this); |
|
_5a3(this); |
|
if (_5b7.options.doSize) { |
|
_58f(this); |
|
} |
|
var _5b8 = _5b7.options.value; |
|
_5b7.options.value = ""; |
|
$(this).textbox("initValue", _5b8); |
|
}); |
|
}; |
|
$.fn.textbox.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "textbox").options; |
|
}, |
|
cloneFrom: function (jq, from) { |
|
return jq.each(function () { |
|
var t = $(this); |
|
if (t.data("textbox")) { |
|
return; |
|
} |
|
if (!$(from).data("textbox")) { |
|
$(from).textbox(); |
|
} |
|
var opts = $.extend(true, {}, $(from).textbox("options")); |
|
var name = t.attr("name") || ""; |
|
t.addClass("textbox-f").hide(); |
|
t.removeAttr("name").attr("textboxName", name); |
|
var span = $(from).next().clone().insertAfter(t); |
|
var _5b9 = "_easyui_textbox_input" + (++_583); |
|
span.find(".textbox-value").attr("name", name); |
|
span.find(".textbox-text").attr("id", _5b9); |
|
var _5ba = $($(from).textbox("label")).clone(); |
|
if (_5ba.length) { |
|
_5ba.attr("for", _5b9); |
|
if (opts.labelPosition == "after") { |
|
_5ba.insertAfter(t.next()); |
|
} else { |
|
_5ba.insertBefore(t); |
|
} |
|
} |
|
$.data(this, "textbox", { |
|
options: opts, |
|
textbox: span, |
|
label: (_5ba.length ? _5ba : undefined) |
|
}); |
|
var _5bb = $(from).textbox("button"); |
|
if (_5bb.length) { |
|
t.textbox("button").linkbutton($.extend(true, {}, _5bb.linkbutton("options"))); |
|
} |
|
_5a3(this); |
|
_589(this); |
|
}); |
|
}, |
|
textbox: function (jq) { |
|
return $.data(jq[0], "textbox").textbox.find(".textbox-text"); |
|
}, |
|
button: function (jq) { |
|
return $.data(jq[0], "textbox").textbox.find(".textbox-button"); |
|
}, |
|
label: function (jq) { |
|
return $.data(jq[0], "textbox").label; |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
_58c(this); |
|
}); |
|
}, |
|
resize: function (jq, _5bc) { |
|
return jq.each(function () { |
|
_58f(this, _5bc); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
_58a(this, true); |
|
_5a3(this); |
|
}); |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
_58a(this, false); |
|
_5a3(this); |
|
}); |
|
}, |
|
readonly: function (jq, mode) { |
|
return jq.each(function () { |
|
_58b(this, mode); |
|
_5a3(this); |
|
}); |
|
}, |
|
isValid: function (jq) { |
|
return jq.textbox("textbox").validatebox("isValid"); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
$(this).textbox("setValue", ""); |
|
}); |
|
}, |
|
setText: function (jq, _5bd) { |
|
return jq.each(function () { |
|
var opts = $(this).textbox("options"); |
|
var _5be = $(this).textbox("textbox"); |
|
_5bd = _5bd == undefined ? "" : String(_5bd); |
|
if ($(this).textbox("getText") != _5bd) { |
|
_5be.val(_5bd); |
|
} |
|
opts.value = _5bd; |
|
if (!_5be.is(":focus")) { |
|
if (_5bd) { |
|
_5be.removeClass("textbox-prompt"); |
|
} else { |
|
_5be.val(opts.prompt).addClass("textbox-prompt"); |
|
} |
|
} |
|
if (opts.value) { |
|
$(this).closest(".form-field").removeClass("form-field-empty"); |
|
} else { |
|
$(this).closest(".form-field").addClass("form-field-empty"); |
|
} |
|
$(this).textbox("validate"); |
|
}); |
|
}, |
|
initValue: function (jq, _5bf) { |
|
return jq.each(function () { |
|
var _5c0 = $.data(this, "textbox"); |
|
$(this).textbox("setText", _5bf); |
|
_5c0.textbox.find(".textbox-value").val(_5bf); |
|
$(this).val(_5bf); |
|
}); |
|
}, |
|
setValue: function (jq, _5c1) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "textbox").options; |
|
var _5c2 = $(this).textbox("getValue"); |
|
$(this).textbox("initValue", _5c1); |
|
if (_5c2 != _5c1) { |
|
opts.onChange.call(this, _5c1, _5c2); |
|
$(this).closest("form").trigger("_change", [this]); |
|
} |
|
}); |
|
}, |
|
getText: function (jq) { |
|
var _5c3 = jq.textbox("textbox"); |
|
if (_5c3.is(":focus")) { |
|
return _5c3.val(); |
|
} else { |
|
return jq.textbox("options").value; |
|
} |
|
}, |
|
getValue: function (jq) { |
|
return jq.data("textbox").textbox.find(".textbox-value").val(); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).textbox("options"); |
|
$(this).textbox("textbox").val(opts.originalValue); |
|
$(this).textbox("setValue", opts.originalValue); |
|
}); |
|
}, |
|
getIcon: function (jq, _5c4) { |
|
return jq.data("textbox").textbox.find(".textbox-icon:eq(" + _5c4 + ")"); |
|
}, |
|
getTipX: function (jq, _5c5) { |
|
var _5c6 = jq.data("textbox"); |
|
var opts = _5c6.options; |
|
var tb = _5c6.textbox; |
|
var _5c7 = tb.find(".textbox-text"); |
|
var _5c5 = _5c5 || opts.tipPosition; |
|
var p1 = tb.offset(); |
|
var p2 = _5c7.offset(); |
|
var w1 = tb.outerWidth(); |
|
var w2 = _5c7.outerWidth(); |
|
if (_5c5 == "right") { |
|
return w1 - w2 - p2.left + p1.left; |
|
} else { |
|
if (_5c5 == "left") { |
|
return p1.left - p2.left; |
|
} else { |
|
return (w1 - w2 - p2.left + p1.left) / 2 - (p2.left - p1.left) / 2; |
|
} |
|
} |
|
}, |
|
getTipY: function (jq, _5c8) { |
|
var _5c9 = jq.data("textbox"); |
|
var opts = _5c9.options; |
|
var tb = _5c9.textbox; |
|
var _5ca = tb.find(".textbox-text"); |
|
var _5c8 = _5c8 || opts.tipPosition; |
|
var p1 = tb.offset(); |
|
var p2 = _5ca.offset(); |
|
var h1 = tb.outerHeight(); |
|
var h2 = _5ca.outerHeight(); |
|
if (_5c8 == "left" || _5c8 == "right") { |
|
return (h1 - h2 - p2.top + p1.top) / 2 - (p2.top - p1.top) / 2; |
|
} else { |
|
if (_5c8 == "bottom") { |
|
return (h1 - h2 - p2.top + p1.top); |
|
} else { |
|
return (p1.top - p2.top); |
|
} |
|
} |
|
}, |
|
getSelectionStart: function (jq) { |
|
return jq.textbox("getSelectionRange").start; |
|
}, |
|
getSelectionRange: function (jq) { |
|
var _5cb = jq.textbox("textbox")[0]; |
|
var _5cc = 0; |
|
var end = 0; |
|
if (typeof _5cb.selectionStart == "number") { |
|
_5cc = _5cb.selectionStart; |
|
end = _5cb.selectionEnd; |
|
} else { |
|
if (_5cb.createTextRange) { |
|
var s = document.selection.createRange(); |
|
var _5cd = _5cb.createTextRange(); |
|
_5cd.setEndPoint("EndToStart", s); |
|
_5cc = _5cd.text.length; |
|
end = _5cc + s.text.length; |
|
} |
|
} |
|
return { |
|
start: _5cc, |
|
end: end |
|
}; |
|
}, |
|
setSelectionRange: function (jq, _5ce) { |
|
return jq.each(function () { |
|
var _5cf = $(this).textbox("textbox")[0]; |
|
var _5d0 = _5ce.start; |
|
var end = _5ce.end; |
|
if (_5cf.setSelectionRange) { |
|
_5cf.setSelectionRange(_5d0, end); |
|
} else { |
|
if (_5cf.createTextRange) { |
|
var _5d1 = _5cf.createTextRange(); |
|
_5d1.collapse(); |
|
_5d1.moveEnd("character", end); |
|
_5d1.moveStart("character", _5d0); |
|
_5d1.select(); |
|
} |
|
} |
|
}); |
|
} |
|
}; |
|
$.fn.textbox.parseOptions = function (_5d2) { |
|
var t = $(_5d2); |
|
return $.extend({}, $.fn.validatebox.parseOptions(_5d2), $.parser.parseOptions(_5d2, ["prompt", "iconCls", "iconAlign", "buttonText", "buttonIcon", "buttonAlign", "label", "labelPosition", "labelAlign", { |
|
multiline: "boolean", |
|
iconWidth: "number", |
|
labelWidth: "number" |
|
} |
|
]), { |
|
value: (t.val() || undefined), |
|
type: (t.attr("type") ? t.attr("type") : undefined) |
|
}); |
|
}; |
|
$.fn.textbox.defaults = $.extend({}, $.fn.validatebox.defaults, { |
|
doSize: true, |
|
width: "auto", |
|
height: "auto", |
|
cls: null, |
|
prompt: "", |
|
value: "", |
|
type: "text", |
|
multiline: false, |
|
icons: [], |
|
iconCls: null, |
|
iconAlign: "right", |
|
iconWidth: 26, |
|
buttonText: "", |
|
buttonIcon: null, |
|
buttonAlign: "right", |
|
label: null, |
|
labelWidth: "auto", |
|
labelPosition: "before", |
|
labelAlign: "left", |
|
inputEvents: { |
|
blur: function (e) { |
|
var t = $(e.data.target); |
|
var opts = t.textbox("options"); |
|
if (t.textbox("getValue") != opts.value) { |
|
t.textbox("setValue", opts.value); |
|
} |
|
}, |
|
keydown: function (e) { |
|
if (e.keyCode == 13) { |
|
var t = $(e.data.target); |
|
t.textbox("setValue", t.textbox("getText")); |
|
} |
|
} |
|
}, |
|
onChange: function (_5d3, _5d4) {}, |
|
onResizing: function (_5d5, _5d6) {}, |
|
onResize: function (_5d7, _5d8) {}, |
|
onClickButton: function () {}, |
|
onClickIcon: function (_5d9) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _5da(_5db) { |
|
var _5dc = $.data(_5db, "passwordbox"); |
|
var opts = _5dc.options; |
|
var _5dd = $.extend(true, [], opts.icons); |
|
if (opts.showEye) { |
|
_5dd.push({ |
|
iconCls: "passwordbox-open", |
|
handler: function (e) { |
|
opts.revealed = !opts.revealed; |
|
_5de(_5db); |
|
} |
|
}); |
|
} |
|
$(_5db).addClass("passwordbox-f").textbox($.extend({}, opts, { |
|
icons: _5dd |
|
})); |
|
_5de(_5db); |
|
}; |
|
function _5df(_5e0, _5e1, all) { |
|
var _5e2 = $(_5e0).data("passwordbox"); |
|
var t = $(_5e0); |
|
var opts = t.passwordbox("options"); |
|
if (opts.revealed) { |
|
t.textbox("setValue", _5e1); |
|
return; |
|
} |
|
_5e2.converting = true; |
|
var _5e3 = unescape(opts.passwordChar); |
|
var cc = _5e1.split(""); |
|
var vv = t.passwordbox("getValue").split(""); |
|
for (var i = 0; i < cc.length; i++) { |
|
var c = cc[i]; |
|
if (c != vv[i]) { |
|
if (c != _5e3) { |
|
vv.splice(i, 0, c); |
|
} |
|
} |
|
} |
|
var pos = t.passwordbox("getSelectionStart"); |
|
if (cc.length < vv.length) { |
|
vv.splice(pos, vv.length - cc.length, ""); |
|
} |
|
for (var i = 0; i < cc.length; i++) { |
|
if (all || i != pos - 1) { |
|
cc[i] = _5e3; |
|
} |
|
} |
|
t.textbox("setValue", vv.join("")); |
|
t.textbox("setText", cc.join("")); |
|
t.textbox("setSelectionRange", { |
|
start: pos, |
|
end: pos |
|
}); |
|
setTimeout(function () { |
|
_5e2.converting = false; |
|
}, 0); |
|
}; |
|
function _5de(_5e4, _5e5) { |
|
var t = $(_5e4); |
|
var opts = t.passwordbox("options"); |
|
var icon = t.next().find(".passwordbox-open"); |
|
var _5e6 = unescape(opts.passwordChar); |
|
_5e5 = _5e5 == undefined ? t.textbox("getValue") : _5e5; |
|
t.textbox("setValue", _5e5); |
|
t.textbox("setText", opts.revealed ? _5e5 : _5e5.replace(/./ig, _5e6)); |
|
opts.revealed ? icon.addClass("passwordbox-close") : icon.removeClass("passwordbox-close"); |
|
}; |
|
function _5e7(e) { |
|
var _5e8 = e.data.target; |
|
var t = $(e.data.target); |
|
var _5e9 = t.data("passwordbox"); |
|
var opts = t.data("passwordbox").options; |
|
_5e9.checking = true; |
|
_5e9.value = t.passwordbox("getText"); |
|
(function () { |
|
if (_5e9.checking) { |
|
var _5ea = t.passwordbox("getText"); |
|
if (_5e9.value != _5ea) { |
|
_5e9.value = _5ea; |
|
if (_5e9.lastTimer) { |
|
clearTimeout(_5e9.lastTimer); |
|
_5e9.lastTimer = undefined; |
|
} |
|
_5df(_5e8, _5ea); |
|
_5e9.lastTimer = setTimeout(function () { |
|
_5df(_5e8, t.passwordbox("getText"), true); |
|
_5e9.lastTimer = undefined; |
|
}, opts.lastDelay); |
|
} |
|
setTimeout(arguments.callee, opts.checkInterval); |
|
} |
|
})(); |
|
}; |
|
function _5eb(e) { |
|
var _5ec = e.data.target; |
|
var _5ed = $(_5ec).data("passwordbox"); |
|
_5ed.checking = false; |
|
if (_5ed.lastTimer) { |
|
clearTimeout(_5ed.lastTimer); |
|
_5ed.lastTimer = undefined; |
|
} |
|
_5de(_5ec); |
|
}; |
|
$.fn.passwordbox = function (_5ee, _5ef) { |
|
if (typeof _5ee == "string") { |
|
var _5f0 = $.fn.passwordbox.methods[_5ee]; |
|
if (_5f0) { |
|
return _5f0(this, _5ef); |
|
} else { |
|
return this.textbox(_5ee, _5ef); |
|
} |
|
} |
|
_5ee = _5ee || {}; |
|
return this.each(function () { |
|
var _5f1 = $.data(this, "passwordbox"); |
|
if (_5f1) { |
|
$.extend(_5f1.options, _5ee); |
|
} else { |
|
_5f1 = $.data(this, "passwordbox", { |
|
options: $.extend({}, $.fn.passwordbox.defaults, $.fn.passwordbox.parseOptions(this), _5ee) |
|
}); |
|
} |
|
_5da(this); |
|
}); |
|
}; |
|
$.fn.passwordbox.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "passwordbox").options; |
|
}, |
|
setValue: function (jq, _5f2) { |
|
return jq.each(function () { |
|
_5de(this, _5f2); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
_5de(this, ""); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
$(this).textbox("reset"); |
|
_5de(this); |
|
}); |
|
}, |
|
showPassword: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).passwordbox("options"); |
|
opts.revealed = true; |
|
_5de(this); |
|
}); |
|
}, |
|
hidePassword: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).passwordbox("options"); |
|
opts.revealed = false; |
|
_5de(this); |
|
}); |
|
} |
|
}; |
|
$.fn.passwordbox.parseOptions = function (_5f3) { |
|
return $.extend({}, $.fn.textbox.parseOptions(_5f3), $.parser.parseOptions(_5f3, ["passwordChar", { |
|
checkInterval: "number", |
|
lastDelay: "number", |
|
revealed: "boolean", |
|
showEye: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.passwordbox.defaults = $.extend({}, $.fn.textbox.defaults, { |
|
passwordChar: "%u25CF", |
|
checkInterval: 200, |
|
lastDelay: 500, |
|
revealed: false, |
|
showEye: true, |
|
inputEvents: { |
|
focus: _5e7, |
|
blur: _5eb, |
|
keydown: function (e) { |
|
var _5f4 = $(e.data.target).data("passwordbox"); |
|
return !_5f4.converting; |
|
} |
|
}, |
|
val: function (_5f5) { |
|
return $(_5f5).parent().prev().passwordbox("getValue"); |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _5f6(_5f7) { |
|
var _5f8 = $(_5f7).data("maskedbox"); |
|
var opts = _5f8.options; |
|
$(_5f7).textbox(opts); |
|
$(_5f7).maskedbox("initValue", opts.value); |
|
}; |
|
function _5f9(_5fa, _5fb) { |
|
var opts = $(_5fa).maskedbox("options"); |
|
var tt = (_5fb || $(_5fa).maskedbox("getText") || "").split(""); |
|
var vv = []; |
|
for (var i = 0; i < opts.mask.length; i++) { |
|
if (opts.masks[opts.mask[i]]) { |
|
var t = tt[i]; |
|
vv.push(t != opts.promptChar ? t : " "); |
|
} |
|
} |
|
return vv.join(""); |
|
}; |
|
function _5fc(_5fd, _5fe) { |
|
var opts = $(_5fd).maskedbox("options"); |
|
var cc = _5fe.split(""); |
|
var tt = []; |
|
for (var i = 0; i < opts.mask.length; i++) { |
|
var m = opts.mask[i]; |
|
var r = opts.masks[m]; |
|
if (r) { |
|
var c = cc.shift(); |
|
if (c != undefined) { |
|
var d = new RegExp(r, "i"); |
|
if (d.test(c)) { |
|
tt.push(c); |
|
continue; |
|
} |
|
} |
|
tt.push(opts.promptChar); |
|
} else { |
|
tt.push(m); |
|
} |
|
} |
|
return tt.join(""); |
|
}; |
|
function _5ff(_600, c) { |
|
var opts = $(_600).maskedbox("options"); |
|
var _601 = $(_600).maskedbox("getSelectionRange"); |
|
var _602 = _603(_600, _601.start); |
|
var end = _603(_600, _601.end); |
|
if (_602 != -1) { |
|
var r = new RegExp(opts.masks[opts.mask[_602]], "i"); |
|
if (r.test(c)) { |
|
var vv = _5f9(_600).split(""); |
|
var _604 = _602 - _605(_600, _602); |
|
var _606 = end - _605(_600, end); |
|
vv.splice(_604, _606 - _604, c); |
|
$(_600).maskedbox("setValue", _5fc(_600, vv.join(""))); |
|
_602 = _603(_600, ++_602); |
|
$(_600).maskedbox("setSelectionRange", { |
|
start: _602, |
|
end: _602 |
|
}); |
|
} |
|
} |
|
}; |
|
function _607(_608, _609) { |
|
var opts = $(_608).maskedbox("options"); |
|
var vv = _5f9(_608).split(""); |
|
var _60a = $(_608).maskedbox("getSelectionRange"); |
|
if (_60a.start == _60a.end) { |
|
if (_609) { |
|
var _60b = _60c(_608, _60a.start); |
|
} else { |
|
var _60b = _603(_608, _60a.start); |
|
} |
|
var _60d = _60b - _605(_608, _60b); |
|
if (_60d >= 0) { |
|
vv.splice(_60d, 1); |
|
} |
|
} else { |
|
var _60b = _603(_608, _60a.start); |
|
var end = _60c(_608, _60a.end); |
|
var _60d = _60b - _605(_608, _60b); |
|
var _60e = end - _605(_608, end); |
|
vv.splice(_60d, _60e - _60d + 1); |
|
} |
|
$(_608).maskedbox("setValue", _5fc(_608, vv.join(""))); |
|
$(_608).maskedbox("setSelectionRange", { |
|
start: _60b, |
|
end: _60b |
|
}); |
|
}; |
|
function _605(_60f, pos) { |
|
var opts = $(_60f).maskedbox("options"); |
|
var _610 = 0; |
|
if (pos >= opts.mask.length) { |
|
pos--; |
|
} |
|
for (var i = pos; i >= 0; i--) { |
|
if (opts.masks[opts.mask[i]] == undefined) { |
|
_610++; |
|
} |
|
} |
|
return _610; |
|
}; |
|
function _603(_611, pos) { |
|
var opts = $(_611).maskedbox("options"); |
|
var m = opts.mask[pos]; |
|
var r = opts.masks[m]; |
|
while (pos < opts.mask.length && !r) { |
|
pos++; |
|
m = opts.mask[pos]; |
|
r = opts.masks[m]; |
|
} |
|
return pos; |
|
}; |
|
function _60c(_612, pos) { |
|
var opts = $(_612).maskedbox("options"); |
|
var m = opts.mask[--pos]; |
|
var r = opts.masks[m]; |
|
while (pos >= 0 && !r) { |
|
pos--; |
|
m = opts.mask[pos]; |
|
r = opts.masks[m]; |
|
} |
|
return pos < 0 ? 0 : pos; |
|
}; |
|
function _613(e) { |
|
if (e.metaKey || e.ctrlKey) { |
|
return; |
|
} |
|
var _614 = e.data.target; |
|
var opts = $(_614).maskedbox("options"); |
|
var _615 = [9, 13, 35, 36, 37, 39]; |
|
if ($.inArray(e.keyCode, _615) != -1) { |
|
return true; |
|
} |
|
if (e.keyCode >= 96 && e.keyCode <= 105) { |
|
e.keyCode -= 48; |
|
} |
|
var c = String.fromCharCode(e.keyCode); |
|
if (e.keyCode >= 65 && e.keyCode <= 90 && !e.shiftKey) { |
|
c = c.toLowerCase(); |
|
} else { |
|
if (e.keyCode == 189) { |
|
c = "-"; |
|
} else { |
|
if (e.keyCode == 187) { |
|
c = "+"; |
|
} else { |
|
if (e.keyCode == 190) { |
|
c = "."; |
|
} |
|
} |
|
} |
|
} |
|
if (e.keyCode == 8) { |
|
_607(_614, true); |
|
} else { |
|
if (e.keyCode == 46) { |
|
_607(_614, false); |
|
} else { |
|
_5ff(_614, c); |
|
} |
|
} |
|
return false; |
|
}; |
|
$.extend($.fn.textbox.methods, { |
|
inputMask: function (jq, _616) { |
|
return jq.each(function () { |
|
var _617 = this; |
|
var opts = $.extend({}, $.fn.maskedbox.defaults, _616); |
|
$.data(_617, "maskedbox", { |
|
options: opts |
|
}); |
|
var _618 = $(_617).textbox("textbox"); |
|
_618._unbind(".maskedbox"); |
|
for (var _619 in opts.inputEvents) { |
|
_618._bind(_619 + ".maskedbox", { |
|
target: _617 |
|
}, opts.inputEvents[_619]); |
|
} |
|
}); |
|
} |
|
}); |
|
$.fn.maskedbox = function (_61a, _61b) { |
|
if (typeof _61a == "string") { |
|
var _61c = $.fn.maskedbox.methods[_61a]; |
|
if (_61c) { |
|
return _61c(this, _61b); |
|
} else { |
|
return this.textbox(_61a, _61b); |
|
} |
|
} |
|
_61a = _61a || {}; |
|
return this.each(function () { |
|
var _61d = $.data(this, "maskedbox"); |
|
if (_61d) { |
|
$.extend(_61d.options, _61a); |
|
} else { |
|
$.data(this, "maskedbox", { |
|
options: $.extend({}, $.fn.maskedbox.defaults, $.fn.maskedbox.parseOptions(this), _61a) |
|
}); |
|
} |
|
_5f6(this); |
|
}); |
|
}; |
|
$.fn.maskedbox.methods = { |
|
options: function (jq) { |
|
var opts = jq.textbox("options"); |
|
return $.extend($.data(jq[0], "maskedbox").options, { |
|
width: opts.width, |
|
value: opts.value, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
}, |
|
initValue: function (jq, _61e) { |
|
return jq.each(function () { |
|
_61e = _5fc(this, _5f9(this, _61e)); |
|
$(this).textbox("initValue", _61e); |
|
}); |
|
}, |
|
setValue: function (jq, _61f) { |
|
return jq.each(function () { |
|
_61f = _5fc(this, _5f9(this, _61f)); |
|
$(this).textbox("setValue", _61f); |
|
}); |
|
} |
|
}; |
|
$.fn.maskedbox.parseOptions = function (_620) { |
|
var t = $(_620); |
|
return $.extend({}, $.fn.textbox.parseOptions(_620), $.parser.parseOptions(_620, ["mask", "promptChar"]), {}); |
|
}; |
|
$.fn.maskedbox.defaults = $.extend({}, $.fn.textbox.defaults, { |
|
mask: "", |
|
promptChar: "_", |
|
masks: { |
|
"9": "[0-9]", |
|
"a": "[a-zA-Z]", |
|
"*": "[0-9a-zA-Z]" |
|
}, |
|
inputEvents: { |
|
keydown: _613 |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
var _621 = 0; |
|
function _622(_623) { |
|
var _624 = $.data(_623, "filebox"); |
|
var opts = _624.options; |
|
opts.fileboxId = "filebox_file_id_" + (++_621); |
|
$(_623).addClass("filebox-f").textbox(opts); |
|
$(_623).textbox("textbox").attr("readonly", "readonly"); |
|
_624.filebox = $(_623).next().addClass("filebox"); |
|
var file = _625(_623); |
|
var btn = $(_623).filebox("button"); |
|
if (btn.length) { |
|
$("<label class=\"filebox-label\" for=\"" + opts.fileboxId + "\"></label>").appendTo(btn); |
|
if (btn.linkbutton("options").disabled) { |
|
file._propAttr("disabled", true); |
|
} else { |
|
file._propAttr("disabled", false); |
|
} |
|
} |
|
}; |
|
function _625(_626) { |
|
var _627 = $.data(_626, "filebox"); |
|
var opts = _627.options; |
|
_627.filebox.find(".textbox-value").remove(); |
|
opts.oldValue = ""; |
|
var file = $("<input type=\"file\" class=\"textbox-value\">").appendTo(_627.filebox); |
|
file.attr("id", opts.fileboxId).attr("name", $(_626).attr("textboxName") || ""); |
|
file.attr("accept", opts.accept); |
|
file.attr("capture", opts.capture); |
|
if (opts.multiple) { |
|
file.attr("multiple", "multiple"); |
|
} |
|
file.change(function () { |
|
var _628 = this.value; |
|
if (this.files) { |
|
_628 = $.map(this.files, function (file) { |
|
return file.name; |
|
}).join(opts.separator); |
|
} |
|
$(_626).filebox("setText", _628); |
|
opts.onChange.call(_626, _628, opts.oldValue); |
|
opts.oldValue = _628; |
|
}); |
|
return file; |
|
}; |
|
$.fn.filebox = function (_629, _62a) { |
|
if (typeof _629 == "string") { |
|
var _62b = $.fn.filebox.methods[_629]; |
|
if (_62b) { |
|
return _62b(this, _62a); |
|
} else { |
|
return this.textbox(_629, _62a); |
|
} |
|
} |
|
_629 = _629 || {}; |
|
return this.each(function () { |
|
var _62c = $.data(this, "filebox"); |
|
if (_62c) { |
|
$.extend(_62c.options, _629); |
|
} else { |
|
$.data(this, "filebox", { |
|
options: $.extend({}, $.fn.filebox.defaults, $.fn.filebox.parseOptions(this), _629) |
|
}); |
|
} |
|
_622(this); |
|
}); |
|
}; |
|
$.fn.filebox.methods = { |
|
options: function (jq) { |
|
var opts = jq.textbox("options"); |
|
return $.extend($.data(jq[0], "filebox").options, { |
|
width: opts.width, |
|
value: opts.value, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
$(this).textbox("clear"); |
|
_625(this); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
$(this).filebox("clear"); |
|
}); |
|
}, |
|
setValue: function (jq) { |
|
return jq; |
|
}, |
|
setValues: function (jq) { |
|
return jq; |
|
}, |
|
files: function (jq) { |
|
return jq.next().find(".textbox-value")[0].files; |
|
} |
|
}; |
|
$.fn.filebox.parseOptions = function (_62d) { |
|
var t = $(_62d); |
|
return $.extend({}, $.fn.textbox.parseOptions(_62d), $.parser.parseOptions(_62d, ["accept", "capture", "separator"]), { |
|
multiple: (t.attr("multiple") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.filebox.defaults = $.extend({}, $.fn.textbox.defaults, { |
|
buttonIcon: null, |
|
buttonText: "Choose File", |
|
buttonAlign: "right", |
|
inputEvents: {}, |
|
accept: "", |
|
capture: "", |
|
separator: ",", |
|
multiple: false |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _62e(_62f) { |
|
var _630 = $.data(_62f, "searchbox"); |
|
var opts = _630.options; |
|
var _631 = $.extend(true, [], opts.icons); |
|
_631.push({ |
|
iconCls: "searchbox-button", |
|
handler: function (e) { |
|
var t = $(e.data.target); |
|
var opts = t.searchbox("options"); |
|
opts.searcher.call(e.data.target, t.searchbox("getValue"), t.searchbox("getName")); |
|
} |
|
}); |
|
_632(); |
|
var _633 = _634(); |
|
$(_62f).addClass("searchbox-f").textbox($.extend({}, opts, { |
|
icons: _631, |
|
buttonText: (_633 ? _633.text : "") |
|
})); |
|
$(_62f).attr("searchboxName", $(_62f).attr("textboxName")); |
|
_630.searchbox = $(_62f).next(); |
|
_630.searchbox.addClass("searchbox"); |
|
_635(_633); |
|
function _632() { |
|
if (opts.menu) { |
|
_630.menu = $(opts.menu).menu(); |
|
var _636 = _630.menu.menu("options"); |
|
var _637 = _636.onClick; |
|
_636.onClick = function (item) { |
|
_635(item); |
|
_637.call(this, item); |
|
}; |
|
} else { |
|
if (_630.menu) { |
|
_630.menu.menu("destroy"); |
|
} |
|
_630.menu = null; |
|
} |
|
}; |
|
function _634() { |
|
if (_630.menu) { |
|
var item = _630.menu.children("div.menu-item:first"); |
|
_630.menu.children("div.menu-item").each(function () { |
|
var _638 = $.extend({}, $.parser.parseOptions(this), { |
|
selected: ($(this).attr("selected") ? true : undefined) |
|
}); |
|
if (_638.selected) { |
|
item = $(this); |
|
return false; |
|
} |
|
}); |
|
return _630.menu.menu("getItem", item[0]); |
|
} else { |
|
return null; |
|
} |
|
}; |
|
function _635(item) { |
|
if (!item) { |
|
return; |
|
} |
|
$(_62f).textbox("button").menubutton({ |
|
text: item.text, |
|
iconCls: (item.iconCls || null), |
|
menu: _630.menu, |
|
menuAlign: opts.buttonAlign, |
|
plain: false |
|
}); |
|
_630.searchbox.find("input.textbox-value").attr("name", item.name || item.text); |
|
$(_62f).searchbox("resize"); |
|
}; |
|
}; |
|
$.fn.searchbox = function (_639, _63a) { |
|
if (typeof _639 == "string") { |
|
var _63b = $.fn.searchbox.methods[_639]; |
|
if (_63b) { |
|
return _63b(this, _63a); |
|
} else { |
|
return this.textbox(_639, _63a); |
|
} |
|
} |
|
_639 = _639 || {}; |
|
return this.each(function () { |
|
var _63c = $.data(this, "searchbox"); |
|
if (_63c) { |
|
$.extend(_63c.options, _639); |
|
} else { |
|
$.data(this, "searchbox", { |
|
options: $.extend({}, $.fn.searchbox.defaults, $.fn.searchbox.parseOptions(this), _639) |
|
}); |
|
} |
|
_62e(this); |
|
}); |
|
}; |
|
$.fn.searchbox.methods = { |
|
options: function (jq) { |
|
var opts = jq.textbox("options"); |
|
return $.extend($.data(jq[0], "searchbox").options, { |
|
width: opts.width, |
|
value: opts.value, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
}, |
|
menu: function (jq) { |
|
return $.data(jq[0], "searchbox").menu; |
|
}, |
|
getName: function (jq) { |
|
return $.data(jq[0], "searchbox").searchbox.find("input.textbox-value").attr("name"); |
|
}, |
|
selectName: function (jq, name) { |
|
return jq.each(function () { |
|
var menu = $.data(this, "searchbox").menu; |
|
if (menu) { |
|
menu.children("div.menu-item").each(function () { |
|
var item = menu.menu("getItem", this); |
|
if (item.name == name) { |
|
$(this).trigger("click"); |
|
return false; |
|
} |
|
}); |
|
} |
|
}); |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
var menu = $(this).searchbox("menu"); |
|
if (menu) { |
|
menu.menu("destroy"); |
|
} |
|
$(this).textbox("destroy"); |
|
}); |
|
} |
|
}; |
|
$.fn.searchbox.parseOptions = function (_63d) { |
|
var t = $(_63d); |
|
return $.extend({}, $.fn.textbox.parseOptions(_63d), $.parser.parseOptions(_63d, ["menu"]), { |
|
searcher: (t.attr("searcher") ? eval(t.attr("searcher")) : undefined) |
|
}); |
|
}; |
|
$.fn.searchbox.defaults = $.extend({}, $.fn.textbox.defaults, { |
|
inputEvents: $.extend({}, $.fn.textbox.defaults.inputEvents, { |
|
keydown: function (e) { |
|
if (e.keyCode == 13) { |
|
e.preventDefault(); |
|
var t = $(e.data.target); |
|
var opts = t.searchbox("options"); |
|
t.searchbox("setValue", $(this).val()); |
|
opts.searcher.call(e.data.target, t.searchbox("getValue"), t.searchbox("getName")); |
|
return false; |
|
} |
|
} |
|
}), |
|
buttonAlign: "left", |
|
menu: null, |
|
searcher: function (_63e, name) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _63f(_640, _641) { |
|
var opts = $.data(_640, "form").options; |
|
$.extend(opts, _641 || {}); |
|
var _642 = $.extend({}, opts.queryParams); |
|
if (opts.onSubmit.call(_640, _642) == false) { |
|
return; |
|
} |
|
var _643 = $(_640).find(".textbox-text:focus"); |
|
_643.triggerHandler("blur"); |
|
_643.focus(); |
|
var _644 = null; |
|
if (opts.dirty) { |
|
var ff = []; |
|
$.map(opts.dirtyFields, function (f) { |
|
if ($(f).hasClass("textbox-f")) { |
|
$(f).next().find(".textbox-value").each(function () { |
|
ff.push(this); |
|
}); |
|
} else { |
|
ff.push(f); |
|
} |
|
}); |
|
_644 = $(_640).find("input[name]:enabled,textarea[name]:enabled,select[name]:enabled").filter(function () { |
|
return $.inArray(this, ff) == -1; |
|
}); |
|
_644._propAttr("disabled", true); |
|
} |
|
if (opts.ajax) { |
|
if (opts.iframe) { |
|
_645(_640, _642); |
|
} else { |
|
if (window.FormData !== undefined) { |
|
_646(_640, _642); |
|
} else { |
|
_645(_640, _642); |
|
} |
|
} |
|
} else { |
|
$(_640).submit(); |
|
} |
|
if (opts.dirty) { |
|
_644._propAttr("disabled", false); |
|
} |
|
}; |
|
function _645(_647, _648) { |
|
var opts = $.data(_647, "form").options; |
|
var _649 = "easyui_frame_" + (new Date().getTime()); |
|
var _64a = $("<iframe id=" + _649 + " name=" + _649 + "></iframe>").appendTo("body"); |
|
_64a.attr("src", window.ActiveXObject ? "javascript:false" : "about:blank"); |
|
_64a.css({ |
|
position: "absolute", |
|
top: -1000, |
|
left: -1000 |
|
}); |
|
_64a.bind("load", cb); |
|
_64b(_648); |
|
function _64b(_64c) { |
|
var form = $(_647); |
|
if (opts.url) { |
|
form.attr("action", opts.url); |
|
} |
|
var t = form.attr("target"), |
|
a = form.attr("action"); |
|
form.attr("target", _649); |
|
var _64d = $(); |
|
try { |
|
for (var n in _64c) { |
|
var _64e = $("<input type=\"hidden\" name=\"" + n + "\">").val(_64c[n]).appendTo(form); |
|
_64d = _64d.add(_64e); |
|
} |
|
_64f(); |
|
form[0].submit(); |
|
} |
|
finally { |
|
form.attr("action", a); |
|
t ? form.attr("target", t) : form.removeAttr("target"); |
|
_64d.remove(); |
|
} |
|
}; |
|
function _64f() { |
|
var f = $("#" + _649); |
|
if (!f.length) { |
|
return; |
|
} |
|
try { |
|
var s = f.contents()[0].readyState; |
|
if (s && s.toLowerCase() == "uninitialized") { |
|
setTimeout(_64f, 100); |
|
} |
|
} catch (e) { |
|
cb(); |
|
} |
|
}; |
|
var _650 = 10; |
|
function cb() { |
|
var f = $("#" + _649); |
|
if (!f.length) { |
|
return; |
|
} |
|
f.unbind(); |
|
var data = ""; |
|
try { |
|
var body = f.contents().find("body"); |
|
data = body.html(); |
|
if (data == "") { |
|
if (--_650) { |
|
setTimeout(cb, 100); |
|
return; |
|
} |
|
} |
|
var ta = body.find(">textarea"); |
|
if (ta.length) { |
|
data = ta.val(); |
|
} else { |
|
var pre = body.find(">pre"); |
|
if (pre.length) { |
|
data = pre.html(); |
|
} |
|
} |
|
} catch (e) {} |
|
opts.success.call(_647, data); |
|
setTimeout(function () { |
|
f.unbind(); |
|
f.remove(); |
|
}, 100); |
|
}; |
|
}; |
|
function _646(_651, _652) { |
|
var opts = $.data(_651, "form").options; |
|
var _653 = new FormData($(_651)[0]); |
|
for (var name in _652) { |
|
_653.append(name, _652[name]); |
|
} |
|
$.ajax({ |
|
url: opts.url, |
|
type: "post", |
|
xhr: function () { |
|
var xhr = $.ajaxSettings.xhr(); |
|
if (xhr.upload) { |
|
xhr.upload.addEventListener("progress", function (e) { |
|
if (e.lengthComputable) { |
|
var _654 = e.total; |
|
var _655 = e.loaded || e.position; |
|
var _656 = Math.ceil(_655 * 100 / _654); |
|
opts.onProgress.call(_651, _656); |
|
} |
|
}, false); |
|
} |
|
return xhr; |
|
}, |
|
data: _653, |
|
dataType: "html", |
|
cache: false, |
|
contentType: false, |
|
processData: false, |
|
complete: function (res) { |
|
opts.success.call(_651, res.responseText); |
|
} |
|
}); |
|
}; |
|
function load(_657, data) { |
|
var opts = $.data(_657, "form").options; |
|
if (typeof data == "string") { |
|
var _658 = {}; |
|
if (opts.onBeforeLoad.call(_657, _658) == false) { |
|
return; |
|
} |
|
$.ajax({ |
|
url: data, |
|
data: _658, |
|
dataType: "json", |
|
success: function (data) { |
|
_659(data); |
|
}, |
|
error: function () { |
|
opts.onLoadError.apply(_657, arguments); |
|
} |
|
}); |
|
} else { |
|
_659(data); |
|
} |
|
function _659(data) { |
|
var form = $(_657); |
|
for (var name in data) { |
|
var val = data[name]; |
|
if (!_65a(name, val)) { |
|
if (!_65b(name, val)) { |
|
form.find("input[name=\"" + name + "\"]").val(val); |
|
form.find("textarea[name=\"" + name + "\"]").val(val); |
|
form.find("select[name=\"" + name + "\"]").val(val); |
|
} |
|
} |
|
} |
|
opts.onLoadSuccess.call(_657, data); |
|
form.form("validate"); |
|
}; |
|
function _65a(name, val) { |
|
var _65c = ["switchbutton", "radiobutton", "checkbox"]; |
|
for (var i = 0; i < _65c.length; i++) { |
|
var _65d = _65c[i]; |
|
var cc = $(_657).find("[" + _65d + "Name=\"" + name + "\"]"); |
|
if (cc.length) { |
|
cc[_65d]("uncheck"); |
|
cc.each(function () { |
|
if (_65e($(this)[_65d]("options").value, val)) { |
|
$(this)[_65d]("check"); |
|
} |
|
}); |
|
return true; |
|
} |
|
} |
|
var cc = $(_657).find("input[name=\"" + name + "\"][type=radio], input[name=\"" + name + "\"][type=checkbox]"); |
|
if (cc.length) { |
|
cc._propAttr("checked", false); |
|
cc.each(function () { |
|
if (_65e($(this).val(), val)) { |
|
$(this)._propAttr("checked", true); |
|
} |
|
}); |
|
return true; |
|
} |
|
return false; |
|
}; |
|
function _65e(v, val) { |
|
if (v == String(val) || $.inArray(v, $.isArray(val) ? val : [val]) >= 0) { |
|
return true; |
|
} else { |
|
return false; |
|
} |
|
}; |
|
function _65b(name, val) { |
|
var _65f = $(_657).find("[textboxName=\"" + name + "\"],[sliderName=\"" + name + "\"]"); |
|
if (_65f.length) { |
|
for (var i = 0; i < opts.fieldTypes.length; i++) { |
|
var type = opts.fieldTypes[i]; |
|
var _660 = _65f.data(type); |
|
if (_660) { |
|
if (_660.options.multiple || _660.options.range) { |
|
_65f[type]("setValues", val); |
|
} else { |
|
_65f[type]("setValue", val); |
|
} |
|
return true; |
|
} |
|
} |
|
} |
|
return false; |
|
}; |
|
}; |
|
function _661(_662) { |
|
$("input,select,textarea", _662).each(function () { |
|
if ($(this).hasClass("textbox-value")) { |
|
return; |
|
} |
|
var t = this.type, |
|
tag = this.tagName.toLowerCase(); |
|
if (t == "text" || t == "hidden" || t == "password" || tag == "textarea") { |
|
this.value = ""; |
|
} else { |
|
if (t == "file") { |
|
var file = $(this); |
|
if (!file.hasClass("textbox-value")) { |
|
var _663 = file.clone().val(""); |
|
_663.insertAfter(file); |
|
if (file.data("validatebox")) { |
|
file.validatebox("destroy"); |
|
_663.validatebox(); |
|
} else { |
|
file.remove(); |
|
} |
|
} |
|
} else { |
|
if (t == "checkbox" || t == "radio") { |
|
this.checked = false; |
|
} else { |
|
if (tag == "select") { |
|
this.selectedIndex = -1; |
|
} |
|
} |
|
} |
|
} |
|
}); |
|
var tmp = $(); |
|
var form = $(_662); |
|
var opts = $.data(_662, "form").options; |
|
for (var i = 0; i < opts.fieldTypes.length; i++) { |
|
var type = opts.fieldTypes[i]; |
|
var _664 = form.find("." + type + "-f").not(tmp); |
|
if (_664.length && _664[type]) { |
|
_664[type]("clear"); |
|
tmp = tmp.add(_664); |
|
} |
|
} |
|
form.form("validate"); |
|
}; |
|
function _665(_666) { |
|
_666.reset(); |
|
var form = $(_666); |
|
var opts = $.data(_666, "form").options; |
|
for (var i = opts.fieldTypes.length - 1; i >= 0; i--) { |
|
var type = opts.fieldTypes[i]; |
|
var _667 = form.find("." + type + "-f"); |
|
if (_667.length && _667[type]) { |
|
_667[type]("reset"); |
|
} |
|
} |
|
form.form("validate"); |
|
}; |
|
function _668(_669) { |
|
var _66a = $.data(_669, "form").options; |
|
$(_669).unbind(".form"); |
|
if (_66a.ajax) { |
|
$(_669).bind("submit.form", function () { |
|
setTimeout(function () { |
|
_63f(_669, _66a); |
|
}, 0); |
|
return false; |
|
}); |
|
} |
|
$(_669).bind("_change.form", function (e, t) { |
|
if ($.inArray(t, _66a.dirtyFields) == -1) { |
|
_66a.dirtyFields.push(t); |
|
} |
|
_66a.onChange.call(this, t); |
|
}).bind("change.form", function (e) { |
|
var t = e.target; |
|
if (!$(t).hasClass("textbox-text")) { |
|
if ($.inArray(t, _66a.dirtyFields) == -1) { |
|
_66a.dirtyFields.push(t); |
|
} |
|
_66a.onChange.call(this, t); |
|
} |
|
}); |
|
_66b(_669, _66a.novalidate); |
|
}; |
|
function _66c(_66d, _66e) { |
|
_66e = _66e || {}; |
|
var _66f = $.data(_66d, "form"); |
|
if (_66f) { |
|
$.extend(_66f.options, _66e); |
|
} else { |
|
$.data(_66d, "form", { |
|
options: $.extend({}, $.fn.form.defaults, $.fn.form.parseOptions(_66d), _66e) |
|
}); |
|
} |
|
}; |
|
function _670(_671) { |
|
if ($.fn.validatebox) { |
|
var t = $(_671); |
|
t.find(".validatebox-text:not(:disabled)").validatebox("validate"); |
|
var _672 = t.find(".validatebox-invalid"); |
|
_672.filter(":not(:disabled):first").focus(); |
|
return _672.length == 0; |
|
} |
|
return true; |
|
}; |
|
function _66b(_673, _674) { |
|
var opts = $.data(_673, "form").options; |
|
opts.novalidate = _674; |
|
$(_673).find(".validatebox-text:not(:disabled)").validatebox(_674 ? "disableValidation" : "enableValidation"); |
|
}; |
|
$.fn.form = function (_675, _676) { |
|
if (typeof _675 == "string") { |
|
this.each(function () { |
|
_66c(this); |
|
}); |
|
return $.fn.form.methods[_675](this, _676); |
|
} |
|
return this.each(function () { |
|
_66c(this, _675); |
|
_668(this); |
|
}); |
|
}; |
|
$.fn.form.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "form").options; |
|
}, |
|
submit: function (jq, _677) { |
|
return jq.each(function () { |
|
_63f(this, _677); |
|
}); |
|
}, |
|
load: function (jq, data) { |
|
return jq.each(function () { |
|
load(this, data); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
_661(this); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
_665(this); |
|
}); |
|
}, |
|
validate: function (jq) { |
|
return _670(jq[0]); |
|
}, |
|
disableValidation: function (jq) { |
|
return jq.each(function () { |
|
_66b(this, true); |
|
}); |
|
}, |
|
enableValidation: function (jq) { |
|
return jq.each(function () { |
|
_66b(this, false); |
|
}); |
|
}, |
|
resetValidation: function (jq) { |
|
return jq.each(function () { |
|
$(this).find(".validatebox-text:not(:disabled)").validatebox("resetValidation"); |
|
}); |
|
}, |
|
resetDirty: function (jq) { |
|
return jq.each(function () { |
|
$(this).form("options").dirtyFields = []; |
|
}); |
|
} |
|
}; |
|
$.fn.form.parseOptions = function (_678) { |
|
var t = $(_678); |
|
return $.extend({}, $.parser.parseOptions(_678, [{ |
|
ajax: "boolean", |
|
dirty: "boolean" |
|
} |
|
]), { |
|
url: (t.attr("action") ? t.attr("action") : undefined) |
|
}); |
|
}; |
|
$.fn.form.defaults = { |
|
fieldTypes: ["tagbox", "combobox", "combotree", "combogrid", "combotreegrid", "datetimebox", "datebox", "timepicker", "combo", "datetimespinner", "timespinner", "numberspinner", "spinner", "slider", "searchbox", "numberbox", "passwordbox", "filebox", "textbox", "switchbutton", "radiobutton", "checkbox"], |
|
novalidate: false, |
|
ajax: true, |
|
iframe: true, |
|
dirty: false, |
|
dirtyFields: [], |
|
url: null, |
|
queryParams: {}, |
|
onSubmit: function (_679) { |
|
return $(this).form("validate"); |
|
}, |
|
onProgress: function (_67a) {}, |
|
success: function (data) {}, |
|
onBeforeLoad: function (_67b) {}, |
|
onLoadSuccess: function (data) {}, |
|
onLoadError: function () {}, |
|
onChange: function (_67c) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function _67d(_67e) { |
|
var _67f = $.data(_67e, "numberbox"); |
|
var opts = _67f.options; |
|
$(_67e).addClass("numberbox-f").textbox(opts); |
|
$(_67e).textbox("textbox").css({ |
|
imeMode: "disabled" |
|
}); |
|
$(_67e).attr("numberboxName", $(_67e).attr("textboxName")); |
|
_67f.numberbox = $(_67e).next(); |
|
_67f.numberbox.addClass("numberbox"); |
|
var _680 = opts.parser.call(_67e, opts.value); |
|
var _681 = opts.formatter.call(_67e, _680); |
|
$(_67e).numberbox("initValue", _680).numberbox("setText", _681); |
|
}; |
|
function _682(_683, _684) { |
|
var _685 = $.data(_683, "numberbox"); |
|
var opts = _685.options; |
|
opts.value = parseFloat(_684); |
|
var _684 = opts.parser.call(_683, _684); |
|
var text = opts.formatter.call(_683, _684); |
|
opts.value = _684; |
|
$(_683).textbox("setText", text).textbox("setValue", _684); |
|
text = opts.formatter.call(_683, $(_683).textbox("getValue")); |
|
$(_683).textbox("setText", text); |
|
}; |
|
$.fn.numberbox = function (_686, _687) { |
|
if (typeof _686 == "string") { |
|
var _688 = $.fn.numberbox.methods[_686]; |
|
if (_688) { |
|
return _688(this, _687); |
|
} else { |
|
return this.textbox(_686, _687); |
|
} |
|
} |
|
_686 = _686 || {}; |
|
return this.each(function () { |
|
var _689 = $.data(this, "numberbox"); |
|
if (_689) { |
|
$.extend(_689.options, _686); |
|
} else { |
|
_689 = $.data(this, "numberbox", { |
|
options: $.extend({}, $.fn.numberbox.defaults, $.fn.numberbox.parseOptions(this), _686) |
|
}); |
|
} |
|
_67d(this); |
|
}); |
|
}; |
|
$.fn.numberbox.methods = { |
|
options: function (jq) { |
|
var opts = jq.data("textbox") ? jq.textbox("options") : {}; |
|
return $.extend($.data(jq[0], "numberbox").options, { |
|
width: opts.width, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
}, |
|
cloneFrom: function (jq, from) { |
|
return jq.each(function () { |
|
$(this).textbox("cloneFrom", from); |
|
$.data(this, "numberbox", { |
|
options: $.extend(true, {}, $(from).numberbox("options")) |
|
}); |
|
$(this).addClass("numberbox-f"); |
|
}); |
|
}, |
|
fix: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).numberbox("options"); |
|
opts.value = null; |
|
var _68a = opts.parser.call(this, $(this).numberbox("getText")); |
|
$(this).numberbox("setValue", _68a); |
|
}); |
|
}, |
|
setValue: function (jq, _68b) { |
|
return jq.each(function () { |
|
_682(this, _68b); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
$(this).textbox("clear"); |
|
$(this).numberbox("options").value = ""; |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
$(this).textbox("reset"); |
|
$(this).numberbox("setValue", $(this).numberbox("getValue")); |
|
}); |
|
} |
|
}; |
|
$.fn.numberbox.parseOptions = function (_68c) { |
|
var t = $(_68c); |
|
return $.extend({}, $.fn.textbox.parseOptions(_68c), $.parser.parseOptions(_68c, ["decimalSeparator", "groupSeparator", "suffix", { |
|
min: "number", |
|
max: "number", |
|
precision: "number" |
|
} |
|
]), { |
|
prefix: (t.attr("prefix") ? t.attr("prefix") : undefined) |
|
}); |
|
}; |
|
$.fn.numberbox.defaults = $.extend({}, $.fn.textbox.defaults, { |
|
inputEvents: { |
|
keypress: function (e) { |
|
var _68d = e.data.target; |
|
var opts = $(_68d).numberbox("options"); |
|
return opts.filter.call(_68d, e); |
|
}, |
|
blur: function (e) { |
|
$(e.data.target).numberbox("fix"); |
|
}, |
|
keydown: function (e) { |
|
if (e.keyCode == 13) { |
|
$(e.data.target).numberbox("fix"); |
|
} |
|
} |
|
}, |
|
min: null, |
|
max: null, |
|
precision: 0, |
|
decimalSeparator: ".", |
|
groupSeparator: "", |
|
prefix: "", |
|
suffix: "", |
|
filter: function (e) { |
|
var opts = $(this).numberbox("options"); |
|
var s = $(this).numberbox("getText"); |
|
if (e.metaKey || e.ctrlKey) { |
|
return true; |
|
} |
|
if ($.inArray(String(e.which), ["46", "8", "13", "0"]) >= 0) { |
|
return true; |
|
} |
|
var tmp = $("<span></span>"); |
|
tmp.html(String.fromCharCode(e.which)); |
|
var c = tmp.text(); |
|
tmp.remove(); |
|
if (!c) { |
|
return true; |
|
} |
|
if (c == "-" && opts.min != null && opts.min >= 0) { |
|
return false; |
|
} |
|
if (c == "-" || c == opts.decimalSeparator) { |
|
return (s.indexOf(c) == -1) ? true : false; |
|
} else { |
|
if (c == opts.groupSeparator) { |
|
return true; |
|
} else { |
|
if ("0123456789".indexOf(c) >= 0) { |
|
return true; |
|
} else { |
|
return false; |
|
} |
|
} |
|
} |
|
}, |
|
formatter: function (_68e) { |
|
if (!_68e) { |
|
return _68e; |
|
} |
|
_68e = _68e + ""; |
|
var opts = $(this).numberbox("options"); |
|
var s1 = _68e, |
|
s2 = ""; |
|
var dpos = _68e.indexOf("."); |
|
if (dpos >= 0) { |
|
s1 = _68e.substring(0, dpos); |
|
s2 = _68e.substring(dpos + 1, _68e.length); |
|
} |
|
if (opts.groupSeparator) { |
|
var p = /(\d+)(\d{3})/; |
|
while (p.test(s1)) { |
|
s1 = s1.replace(p, "$1" + opts.groupSeparator + "$2"); |
|
} |
|
} |
|
if (s2) { |
|
return opts.prefix + s1 + opts.decimalSeparator + s2 + opts.suffix; |
|
} else { |
|
return opts.prefix + s1 + opts.suffix; |
|
} |
|
}, |
|
parser: function (s) { |
|
s = s + ""; |
|
var opts = $(this).numberbox("options"); |
|
if (opts.prefix) { |
|
s = $.trim(s.replace(new RegExp("\\" + $.trim(opts.prefix), "g"), "")); |
|
} |
|
if (opts.suffix) { |
|
s = $.trim(s.replace(new RegExp("\\" + $.trim(opts.suffix), "g"), "")); |
|
} |
|
if (parseFloat(s) != opts.value) { |
|
if (opts.groupSeparator) { |
|
s = $.trim(s.replace(new RegExp("\\" + opts.groupSeparator, "g"), "")); |
|
} |
|
if (opts.decimalSeparator) { |
|
s = $.trim(s.replace(new RegExp("\\" + opts.decimalSeparator, "g"), ".")); |
|
} |
|
s = s.replace(/\s/g, ""); |
|
} |
|
var val = parseFloat(s).toFixed(opts.precision); |
|
if (isNaN(val)) { |
|
val = ""; |
|
} else { |
|
if (typeof(opts.min) == "number" && val < opts.min) { |
|
val = opts.min.toFixed(opts.precision); |
|
} else { |
|
if (typeof(opts.max) == "number" && val > opts.max) { |
|
val = opts.max.toFixed(opts.precision); |
|
} |
|
} |
|
} |
|
return val; |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _68f(_690, _691) { |
|
var opts = $.data(_690, "calendar").options; |
|
var t = $(_690); |
|
if (_691) { |
|
$.extend(opts, { |
|
width: _691.width, |
|
height: _691.height |
|
}); |
|
} |
|
t._size(opts, t.parent()); |
|
t.find(".calendar-body")._outerHeight(t.height() - t.find(".calendar-header")._outerHeight()); |
|
if (t.find(".calendar-menu").is(":visible")) { |
|
_692(_690); |
|
} |
|
}; |
|
function init(_693) { |
|
$(_693).addClass("calendar").html("<div class=\"calendar-header\">" + "<div class=\"calendar-nav calendar-prevmonth\"></div>" + "<div class=\"calendar-nav calendar-nextmonth\"></div>" + "<div class=\"calendar-nav calendar-prevyear\"></div>" + "<div class=\"calendar-nav calendar-nextyear\"></div>" + "<div class=\"calendar-title\">" + "<span class=\"calendar-text\"></span>" + "</div>" + "</div>" + "<div class=\"calendar-body\">" + "<div class=\"calendar-menu\">" + "<div class=\"calendar-menu-year-inner\">" + "<span class=\"calendar-nav calendar-menu-prev\"></span>" + "<span><input class=\"calendar-menu-year\" type=\"text\"></span>" + "<span class=\"calendar-nav calendar-menu-next\"></span>" + "</div>" + "<div class=\"calendar-menu-month-inner\">" + "</div>" + "</div>" + "</div>"); |
|
$(_693)._bind("_resize", function (e, _694) { |
|
if ($(this).hasClass("easyui-fluid") || _694) { |
|
_68f(_693); |
|
} |
|
return false; |
|
}); |
|
}; |
|
function _695(_696) { |
|
var opts = $.data(_696, "calendar").options; |
|
var menu = $(_696).find(".calendar-menu"); |
|
menu.find(".calendar-menu-year")._unbind(".calendar")._bind("keypress.calendar", function (e) { |
|
if (e.keyCode == 13) { |
|
_697(true); |
|
} |
|
}); |
|
$(_696)._unbind(".calendar")._bind("mouseover.calendar", function (e) { |
|
var t = _698(e.target); |
|
if (t.hasClass("calendar-nav") || t.hasClass("calendar-text") || (t.hasClass("calendar-day") && !t.hasClass("calendar-disabled"))) { |
|
t.addClass("calendar-nav-hover"); |
|
} |
|
})._bind("mouseout.calendar", function (e) { |
|
var t = _698(e.target); |
|
if (t.hasClass("calendar-nav") || t.hasClass("calendar-text") || (t.hasClass("calendar-day") && !t.hasClass("calendar-disabled"))) { |
|
t.removeClass("calendar-nav-hover"); |
|
} |
|
})._bind("click.calendar", function (e) { |
|
var t = _698(e.target); |
|
if (t.hasClass("calendar-menu-next") || t.hasClass("calendar-nextyear")) { |
|
_699(1); |
|
} else { |
|
if (t.hasClass("calendar-menu-prev") || t.hasClass("calendar-prevyear")) { |
|
_699(-1); |
|
} else { |
|
if (t.hasClass("calendar-menu-month")) { |
|
menu.find(".calendar-selected").removeClass("calendar-selected"); |
|
t.addClass("calendar-selected"); |
|
_697(true); |
|
} else { |
|
if (t.hasClass("calendar-prevmonth")) { |
|
_69a(-1); |
|
} else { |
|
if (t.hasClass("calendar-nextmonth")) { |
|
_69a(1); |
|
} else { |
|
if (t.hasClass("calendar-text")) { |
|
if (menu.is(":visible")) { |
|
menu.hide(); |
|
} else { |
|
_692(_696); |
|
} |
|
} else { |
|
if (t.hasClass("calendar-day")) { |
|
if (t.hasClass("calendar-disabled")) { |
|
return; |
|
} |
|
var _69b = opts.current; |
|
t.closest("div.calendar-body").find(".calendar-selected").removeClass("calendar-selected"); |
|
t.addClass("calendar-selected"); |
|
var _69c = t.attr("abbr").split(","); |
|
var y = parseInt(_69c[0]); |
|
var m = parseInt(_69c[1]); |
|
var d = parseInt(_69c[2]); |
|
opts.current = new opts.Date(y, m - 1, d); |
|
opts.onSelect.call(_696, opts.current); |
|
if (!_69b || _69b.getTime() != opts.current.getTime()) { |
|
opts.onChange.call(_696, opts.current, _69b); |
|
} |
|
if (opts.year != y || opts.month != m) { |
|
opts.year = y; |
|
opts.month = m; |
|
show(_696); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}); |
|
function _698(t) { |
|
var day = $(t).closest(".calendar-day"); |
|
if (day.length) { |
|
return day; |
|
} else { |
|
return $(t); |
|
} |
|
}; |
|
function _697(_69d) { |
|
var menu = $(_696).find(".calendar-menu"); |
|
var year = menu.find(".calendar-menu-year").val(); |
|
var _69e = menu.find(".calendar-selected").attr("abbr"); |
|
if (!isNaN(year)) { |
|
opts.year = parseInt(year); |
|
opts.month = parseInt(_69e); |
|
show(_696); |
|
} |
|
if (_69d) { |
|
menu.hide(); |
|
} |
|
}; |
|
function _699(_69f) { |
|
opts.year += _69f; |
|
show(_696); |
|
menu.find(".calendar-menu-year").val(opts.year); |
|
}; |
|
function _69a(_6a0) { |
|
opts.month += _6a0; |
|
if (opts.month > 12) { |
|
opts.year++; |
|
opts.month = 1; |
|
} else { |
|
if (opts.month < 1) { |
|
opts.year--; |
|
opts.month = 12; |
|
} |
|
} |
|
show(_696); |
|
menu.find("td.calendar-selected").removeClass("calendar-selected"); |
|
menu.find("td:eq(" + (opts.month - 1) + ")").addClass("calendar-selected"); |
|
}; |
|
}; |
|
function _692(_6a1) { |
|
var opts = $.data(_6a1, "calendar").options; |
|
$(_6a1).find(".calendar-menu").show(); |
|
if ($(_6a1).find(".calendar-menu-month-inner").is(":empty")) { |
|
$(_6a1).find(".calendar-menu-month-inner").empty(); |
|
var t = $("<table class=\"calendar-mtable\"></table>").appendTo($(_6a1).find(".calendar-menu-month-inner")); |
|
var idx = 0; |
|
for (var i = 0; i < 3; i++) { |
|
var tr = $("<tr></tr>").appendTo(t); |
|
for (var j = 0; j < 4; j++) { |
|
$("<td class=\"calendar-nav calendar-menu-month\"></td>").html(opts.months[idx++]).attr("abbr", idx).appendTo(tr); |
|
} |
|
} |
|
} |
|
var body = $(_6a1).find(".calendar-body"); |
|
var sele = $(_6a1).find(".calendar-menu"); |
|
var _6a2 = sele.find(".calendar-menu-year-inner"); |
|
var _6a3 = sele.find(".calendar-menu-month-inner"); |
|
_6a2.find("input").val(opts.year).focus(); |
|
_6a3.find("td.calendar-selected").removeClass("calendar-selected"); |
|
_6a3.find("td:eq(" + (opts.month - 1) + ")").addClass("calendar-selected"); |
|
sele._outerWidth(body._outerWidth()); |
|
sele._outerHeight(body._outerHeight()); |
|
_6a3._outerHeight(sele.height() - _6a2._outerHeight()); |
|
}; |
|
function _6a4(_6a5, year, _6a6) { |
|
var opts = $.data(_6a5, "calendar").options; |
|
var _6a7 = []; |
|
var _6a8 = new opts.Date(year, _6a6, 0).getDate(); |
|
for (var i = 1; i <= _6a8; i++) { |
|
_6a7.push([year, _6a6, i]); |
|
} |
|
var _6a9 = [], |
|
week = []; |
|
var _6aa = -1; |
|
while (_6a7.length > 0) { |
|
var date = _6a7.shift(); |
|
week.push(date); |
|
var day = new opts.Date(date[0], date[1] - 1, date[2]).getDay(); |
|
if (_6aa == day) { |
|
day = 0; |
|
} else { |
|
if (day == (opts.firstDay == 0 ? 7 : opts.firstDay) - 1) { |
|
_6a9.push(week); |
|
week = []; |
|
} |
|
} |
|
_6aa = day; |
|
} |
|
if (week.length) { |
|
_6a9.push(week); |
|
} |
|
var _6ab = _6a9[0]; |
|
if (_6ab.length < 7) { |
|
while (_6ab.length < 7) { |
|
var _6ac = _6ab[0]; |
|
var date = new opts.Date(_6ac[0], _6ac[1] - 1, _6ac[2] - 1); |
|
_6ab.unshift([date.getFullYear(), date.getMonth() + 1, date.getDate()]); |
|
} |
|
} else { |
|
var _6ac = _6ab[0]; |
|
var week = []; |
|
for (var i = 1; i <= 7; i++) { |
|
var date = new opts.Date(_6ac[0], _6ac[1] - 1, _6ac[2] - i); |
|
week.unshift([date.getFullYear(), date.getMonth() + 1, date.getDate()]); |
|
} |
|
_6a9.unshift(week); |
|
} |
|
var _6ad = _6a9[_6a9.length - 1]; |
|
while (_6ad.length < 7) { |
|
var _6ae = _6ad[_6ad.length - 1]; |
|
var date = new opts.Date(_6ae[0], _6ae[1] - 1, _6ae[2] + 1); |
|
_6ad.push([date.getFullYear(), date.getMonth() + 1, date.getDate()]); |
|
} |
|
if (_6a9.length < 6) { |
|
var _6ae = _6ad[_6ad.length - 1]; |
|
var week = []; |
|
for (var i = 1; i <= 7; i++) { |
|
var date = new opts.Date(_6ae[0], _6ae[1] - 1, _6ae[2] + i); |
|
week.push([date.getFullYear(), date.getMonth() + 1, date.getDate()]); |
|
} |
|
_6a9.push(week); |
|
} |
|
return _6a9; |
|
}; |
|
function show(_6af) { |
|
var opts = $.data(_6af, "calendar").options; |
|
if (opts.current && !opts.validator.call(_6af, opts.current)) { |
|
opts.current = null; |
|
} |
|
var now = new opts.Date(); |
|
var _6b0 = now.getFullYear() + "," + (now.getMonth() + 1) + "," + now.getDate(); |
|
var _6b1 = opts.current ? (opts.current.getFullYear() + "," + (opts.current.getMonth() + 1) + "," + opts.current.getDate()) : ""; |
|
var _6b2 = 6 - opts.firstDay; |
|
var _6b3 = _6b2 + 1; |
|
if (_6b2 >= 7) { |
|
_6b2 -= 7; |
|
} |
|
if (_6b3 >= 7) { |
|
_6b3 -= 7; |
|
} |
|
$(_6af).find(".calendar-title span").html(opts.months[opts.month - 1] + " " + opts.year); |
|
var body = $(_6af).find("div.calendar-body"); |
|
body.children("table").remove(); |
|
var data = ["<table class=\"calendar-dtable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"]; |
|
data.push("<thead><tr>"); |
|
if (opts.showWeek) { |
|
data.push("<th class=\"calendar-week\">" + opts.weekNumberHeader + "</th>"); |
|
} |
|
for (var i = opts.firstDay; i < opts.weeks.length; i++) { |
|
data.push("<th>" + opts.weeks[i] + "</th>"); |
|
} |
|
for (var i = 0; i < opts.firstDay; i++) { |
|
data.push("<th>" + opts.weeks[i] + "</th>"); |
|
} |
|
data.push("</tr></thead>"); |
|
data.push("<tbody>"); |
|
var _6b4 = _6a4(_6af, opts.year, opts.month); |
|
for (var i = 0; i < _6b4.length; i++) { |
|
var week = _6b4[i]; |
|
var cls = ""; |
|
if (i == 0) { |
|
cls = "calendar-first"; |
|
} else { |
|
if (i == _6b4.length - 1) { |
|
cls = "calendar-last"; |
|
} |
|
} |
|
data.push("<tr class=\"" + cls + "\">"); |
|
if (opts.showWeek) { |
|
var _6b5 = opts.getWeekNumber(new opts.Date(week[0][0], parseInt(week[0][1]) - 1, week[0][2])); |
|
data.push("<td class=\"calendar-week\">" + _6b5 + "</td>"); |
|
} |
|
for (var j = 0; j < week.length; j++) { |
|
var day = week[j]; |
|
var s = day[0] + "," + day[1] + "," + day[2]; |
|
var _6b6 = new opts.Date(day[0], parseInt(day[1]) - 1, day[2]); |
|
var d = opts.formatter.call(_6af, _6b6); |
|
var css = opts.styler.call(_6af, _6b6); |
|
var _6b7 = ""; |
|
var _6b8 = ""; |
|
if (typeof css == "string") { |
|
_6b8 = css; |
|
} else { |
|
if (css) { |
|
_6b7 = css["class"] || ""; |
|
_6b8 = css["style"] || ""; |
|
} |
|
} |
|
var cls = "calendar-day"; |
|
if (!(opts.year == day[0] && opts.month == day[1])) { |
|
cls += " calendar-other-month"; |
|
} |
|
if (s == _6b0) { |
|
cls += " calendar-today"; |
|
} |
|
if (s == _6b1) { |
|
cls += " calendar-selected"; |
|
} |
|
if (j == _6b2) { |
|
cls += " calendar-saturday"; |
|
} else { |
|
if (j == _6b3) { |
|
cls += " calendar-sunday"; |
|
} |
|
} |
|
if (j == 0) { |
|
cls += " calendar-first"; |
|
} else { |
|
if (j == week.length - 1) { |
|
cls += " calendar-last"; |
|
} |
|
} |
|
cls += " " + _6b7; |
|
if (!opts.validator.call(_6af, _6b6)) { |
|
cls += " calendar-disabled"; |
|
} |
|
data.push("<td class=\"" + cls + "\" abbr=\"" + s + "\" style=\"" + _6b8 + "\">" + d + "</td>"); |
|
} |
|
data.push("</tr>"); |
|
} |
|
data.push("</tbody>"); |
|
data.push("</table>"); |
|
body.append(data.join("")); |
|
body.children("table.calendar-dtable").prependTo(body); |
|
opts.onNavigate.call(_6af, opts.year, opts.month); |
|
}; |
|
$.fn.calendar = function (_6b9, _6ba) { |
|
if (typeof _6b9 == "string") { |
|
return $.fn.calendar.methods[_6b9](this, _6ba); |
|
} |
|
_6b9 = _6b9 || {}; |
|
return this.each(function () { |
|
var _6bb = $.data(this, "calendar"); |
|
if (_6bb) { |
|
$.extend(_6bb.options, _6b9); |
|
} else { |
|
_6bb = $.data(this, "calendar", { |
|
options: $.extend({}, $.fn.calendar.defaults, $.fn.calendar.parseOptions(this), _6b9) |
|
}); |
|
init(this); |
|
} |
|
if (_6bb.options.border == false) { |
|
$(this).addClass("calendar-noborder"); |
|
} |
|
_68f(this); |
|
_695(this); |
|
show(this); |
|
$(this).find("div.calendar-menu").hide(); |
|
}); |
|
}; |
|
$.fn.calendar.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "calendar").options; |
|
}, |
|
resize: function (jq, _6bc) { |
|
return jq.each(function () { |
|
_68f(this, _6bc); |
|
}); |
|
}, |
|
moveTo: function (jq, date) { |
|
return jq.each(function () { |
|
var opts = $(this).calendar("options"); |
|
if (!date) { |
|
var now = new opts.Date(); |
|
$(this).calendar({ |
|
year: now.getFullYear(), |
|
month: now.getMonth() + 1, |
|
current: date |
|
}); |
|
return; |
|
} |
|
if (opts.validator.call(this, date)) { |
|
var _6bd = opts.current; |
|
$(this).calendar({ |
|
year: date.getFullYear(), |
|
month: date.getMonth() + 1, |
|
current: date |
|
}); |
|
if (!_6bd || _6bd.getTime() != date.getTime()) { |
|
opts.onChange.call(this, opts.current, _6bd); |
|
} |
|
} |
|
}); |
|
} |
|
}; |
|
$.fn.calendar.parseOptions = function (_6be) { |
|
var t = $(_6be); |
|
return $.extend({}, $.parser.parseOptions(_6be, ["weekNumberHeader", { |
|
firstDay: "number", |
|
fit: "boolean", |
|
border: "boolean", |
|
showWeek: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.calendar.defaults = { |
|
Date: Date, |
|
width: 180, |
|
height: 180, |
|
fit: false, |
|
border: true, |
|
showWeek: false, |
|
firstDay: 0, |
|
weeks: ["S", "M", "T", "W", "T", "F", "S"], |
|
months: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], |
|
year: new Date().getFullYear(), |
|
month: new Date().getMonth() + 1, |
|
current: (function () { |
|
var d = new Date(); |
|
return new Date(d.getFullYear(), d.getMonth(), d.getDate()); |
|
})(), |
|
weekNumberHeader: "", |
|
getWeekNumber: function (date) { |
|
var _6bf = new Date(date.getTime()); |
|
_6bf.setDate(_6bf.getDate() + 4 - (_6bf.getDay() || 7)); |
|
var time = _6bf.getTime(); |
|
_6bf.setMonth(0); |
|
_6bf.setDate(1); |
|
return Math.floor(Math.round((time - _6bf) / 86400000) / 7) + 1; |
|
}, |
|
formatter: function (date) { |
|
return date.getDate(); |
|
}, |
|
styler: function (date) { |
|
return ""; |
|
}, |
|
validator: function (date) { |
|
return true; |
|
}, |
|
onSelect: function (date) {}, |
|
onChange: function (_6c0, _6c1) {}, |
|
onNavigate: function (year, _6c2) {} |
|
}; |
|
})(jQuery); |
|
(function ($) { |
|
function _6c3(_6c4) { |
|
var _6c5 = $.data(_6c4, "spinner"); |
|
var opts = _6c5.options; |
|
var _6c6 = $.extend(true, [], opts.icons); |
|
if (opts.spinAlign == "left" || opts.spinAlign == "right") { |
|
opts.spinArrow = true; |
|
opts.iconAlign = opts.spinAlign; |
|
var _6c7 = { |
|
iconCls: "spinner-button-updown", |
|
handler: function (e) { |
|
var spin = $(e.target).closest(".spinner-arrow-up,.spinner-arrow-down"); |
|
_6d1(e.data.target, spin.hasClass("spinner-arrow-down")); |
|
} |
|
}; |
|
if (opts.spinAlign == "left") { |
|
_6c6.unshift(_6c7); |
|
} else { |
|
_6c6.push(_6c7); |
|
} |
|
} else { |
|
opts.spinArrow = false; |
|
if (opts.spinAlign == "vertical") { |
|
if (opts.buttonAlign != "top") { |
|
opts.buttonAlign = "bottom"; |
|
} |
|
opts.clsLeft = "textbox-button-bottom"; |
|
opts.clsRight = "textbox-button-top"; |
|
} else { |
|
opts.clsLeft = "textbox-button-left"; |
|
opts.clsRight = "textbox-button-right"; |
|
} |
|
} |
|
$(_6c4).addClass("spinner-f").textbox($.extend({}, opts, { |
|
icons: _6c6, |
|
doSize: false, |
|
onResize: function (_6c8, _6c9) { |
|
if (!opts.spinArrow) { |
|
var span = $(this).next(); |
|
var btn = span.find(".textbox-button:not(.spinner-button)"); |
|
if (btn.length) { |
|
var _6ca = btn.outerWidth(); |
|
var _6cb = btn.outerHeight(); |
|
var _6cc = span.find(".spinner-button." + opts.clsLeft); |
|
var _6cd = span.find(".spinner-button." + opts.clsRight); |
|
if (opts.buttonAlign == "right") { |
|
_6cd.css("marginRight", _6ca + "px"); |
|
} else { |
|
if (opts.buttonAlign == "left") { |
|
_6cc.css("marginLeft", _6ca + "px"); |
|
} else { |
|
if (opts.buttonAlign == "top") { |
|
_6cd.css("marginTop", _6cb + "px"); |
|
} else { |
|
_6cc.css("marginBottom", _6cb + "px"); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
opts.onResize.call(this, _6c8, _6c9); |
|
} |
|
})); |
|
$(_6c4).attr("spinnerName", $(_6c4).attr("textboxName")); |
|
_6c5.spinner = $(_6c4).next(); |
|
_6c5.spinner.addClass("spinner"); |
|
if (opts.spinArrow) { |
|
var _6ce = _6c5.spinner.find(".spinner-button-updown"); |
|
_6ce.append("<span class=\"spinner-arrow spinner-button-top\">" + "<span class=\"spinner-arrow-up\"></span>" + "</span>" + "<span class=\"spinner-arrow spinner-button-bottom\">" + "<span class=\"spinner-arrow-down\"></span>" + "</span>"); |
|
} else { |
|
var _6cf = $("<a href=\"javascript:;\" class=\"textbox-button spinner-button\"></a>").addClass(opts.clsLeft).appendTo(_6c5.spinner); |
|
var _6d0 = $("<a href=\"javascript:;\" class=\"textbox-button spinner-button\"></a>").addClass(opts.clsRight).appendTo(_6c5.spinner); |
|
_6cf.linkbutton({ |
|
iconCls: opts.reversed ? "spinner-button-up" : "spinner-button-down", |
|
onClick: function () { |
|
_6d1(_6c4, !opts.reversed); |
|
} |
|
}); |
|
_6d0.linkbutton({ |
|
iconCls: opts.reversed ? "spinner-button-down" : "spinner-button-up", |
|
onClick: function () { |
|
_6d1(_6c4, opts.reversed); |
|
} |
|
}); |
|
if (opts.disabled) { |
|
$(_6c4).spinner("disable"); |
|
} |
|
if (opts.readonly) { |
|
$(_6c4).spinner("readonly"); |
|
} |
|
} |
|
$(_6c4).spinner("resize"); |
|
}; |
|
function _6d1(_6d2, down) { |
|
var opts = $(_6d2).spinner("options"); |
|
opts.spin.call(_6d2, down); |
|
opts[down ? "onSpinDown" : "onSpinUp"].call(_6d2); |
|
$(_6d2).spinner("validate"); |
|
}; |
|
$.fn.spinner = function (_6d3, _6d4) { |
|
if (typeof _6d3 == "string") { |
|
var _6d5 = $.fn.spinner.methods[_6d3]; |
|
if (_6d5) { |
|
return _6d5(this, _6d4); |
|
} else { |
|
return this.textbox(_6d3, _6d4); |
|
} |
|
} |
|
_6d3 = _6d3 || {}; |
|
return this.each(function () { |
|
var _6d6 = $.data(this, "spinner"); |
|
if (_6d6) { |
|
$.extend(_6d6.options, _6d3); |
|
} else { |
|
_6d6 = $.data(this, "spinner", { |
|
options: $.extend({}, $.fn.spinner.defaults, $.fn.spinner.parseOptions(this), _6d3) |
|
}); |
|
} |
|
_6c3(this); |
|
}); |
|
}; |
|
$.fn.spinner.methods = { |
|
options: function (jq) { |
|
var opts = jq.textbox("options"); |
|
return $.extend($.data(jq[0], "spinner").options, { |
|
width: opts.width, |
|
value: opts.value, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
} |
|
}; |
|
$.fn.spinner.parseOptions = function (_6d7) { |
|
return $.extend({}, $.fn.textbox.parseOptions(_6d7), $.parser.parseOptions(_6d7, ["min", "max", "spinAlign", { |
|
increment: "number", |
|
reversed: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.spinner.defaults = $.extend({}, $.fn.textbox.defaults, { |
|
min: null, |
|
max: null, |
|
increment: 1, |
|
spinAlign: "right", |
|
reversed: false, |
|
spin: function (down) {}, |
|
onSpinUp: function () {}, |
|
onSpinDown: function () {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _6d8(_6d9) { |
|
$(_6d9).addClass("numberspinner-f"); |
|
var opts = $.data(_6d9, "numberspinner").options; |
|
$(_6d9).numberbox($.extend({}, opts, { |
|
doSize: false |
|
})).spinner(opts); |
|
$(_6d9).numberbox("setValue", opts.value); |
|
}; |
|
function _6da(_6db, down) { |
|
var opts = $.data(_6db, "numberspinner").options; |
|
var v = parseFloat($(_6db).numberbox("getValue") || opts.value) || 0; |
|
if (down) { |
|
v -= opts.increment; |
|
} else { |
|
v += opts.increment; |
|
} |
|
$(_6db).numberbox("setValue", v); |
|
}; |
|
$.fn.numberspinner = function (_6dc, _6dd) { |
|
if (typeof _6dc == "string") { |
|
var _6de = $.fn.numberspinner.methods[_6dc]; |
|
if (_6de) { |
|
return _6de(this, _6dd); |
|
} else { |
|
return this.numberbox(_6dc, _6dd); |
|
} |
|
} |
|
_6dc = _6dc || {}; |
|
return this.each(function () { |
|
var _6df = $.data(this, "numberspinner"); |
|
if (_6df) { |
|
$.extend(_6df.options, _6dc); |
|
} else { |
|
$.data(this, "numberspinner", { |
|
options: $.extend({}, $.fn.numberspinner.defaults, $.fn.numberspinner.parseOptions(this), _6dc) |
|
}); |
|
} |
|
_6d8(this); |
|
}); |
|
}; |
|
$.fn.numberspinner.methods = { |
|
options: function (jq) { |
|
var opts = jq.numberbox("options"); |
|
return $.extend($.data(jq[0], "numberspinner").options, { |
|
width: opts.width, |
|
value: opts.value, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
} |
|
}; |
|
$.fn.numberspinner.parseOptions = function (_6e0) { |
|
return $.extend({}, $.fn.spinner.parseOptions(_6e0), $.fn.numberbox.parseOptions(_6e0), {}); |
|
}; |
|
$.fn.numberspinner.defaults = $.extend({}, $.fn.spinner.defaults, $.fn.numberbox.defaults, { |
|
spin: function (down) { |
|
_6da(this, down); |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _6e1(_6e2) { |
|
var opts = $.data(_6e2, "timespinner").options; |
|
$(_6e2).addClass("timespinner-f").spinner(opts); |
|
var _6e3 = opts.formatter.call(_6e2, opts.parser.call(_6e2, opts.value)); |
|
$(_6e2).timespinner("initValue", _6e3); |
|
}; |
|
function _6e4(e) { |
|
var _6e5 = e.data.target; |
|
var opts = $.data(_6e5, "timespinner").options; |
|
var _6e6 = $(_6e5).timespinner("getSelectionStart"); |
|
for (var i = 0; i < opts.selections.length; i++) { |
|
var _6e7 = opts.selections[i]; |
|
if (_6e6 >= _6e7[0] && _6e6 <= _6e7[1]) { |
|
_6e8(_6e5, i); |
|
return; |
|
} |
|
} |
|
}; |
|
function _6e8(_6e9, _6ea) { |
|
var opts = $.data(_6e9, "timespinner").options; |
|
if (_6ea != undefined) { |
|
opts.highlight = _6ea; |
|
} |
|
var _6eb = opts.selections[opts.highlight]; |
|
if (_6eb) { |
|
var tb = $(_6e9).timespinner("textbox"); |
|
$(_6e9).timespinner("setSelectionRange", { |
|
start: _6eb[0], |
|
end: _6eb[1] |
|
}); |
|
tb.focus(); |
|
} |
|
}; |
|
function _6ec(_6ed, _6ee) { |
|
var opts = $.data(_6ed, "timespinner").options; |
|
var _6ee = opts.parser.call(_6ed, _6ee); |
|
var text = opts.formatter.call(_6ed, _6ee); |
|
$(_6ed).spinner("setValue", text); |
|
}; |
|
function _6ef(_6f0, down) { |
|
var opts = $.data(_6f0, "timespinner").options; |
|
var s = $(_6f0).timespinner("getValue"); |
|
var _6f1 = opts.selections[opts.highlight]; |
|
var s1 = s.substring(0, _6f1[0]); |
|
var s2 = s.substring(_6f1[0], _6f1[1]); |
|
var s3 = s.substring(_6f1[1]); |
|
if (s2 == opts.ampm[0]) { |
|
s2 = opts.ampm[1]; |
|
} else { |
|
if (s2 == opts.ampm[1]) { |
|
s2 = opts.ampm[0]; |
|
} else { |
|
s2 = parseInt(s2, 10) || 0; |
|
if (opts.selections.length - 4 == opts.highlight && opts.hour12) { |
|
if (s2 == 12) { |
|
s2 = 0; |
|
} else { |
|
if (s2 == 11 && !down) { |
|
var tmp = s3.replace(opts.ampm[0], opts.ampm[1]); |
|
if (s3 != tmp) { |
|
s3 = tmp; |
|
} else { |
|
s3 = s3.replace(opts.ampm[1], opts.ampm[0]); |
|
} |
|
} |
|
} |
|
} |
|
s2 = s2 + opts.increment * (down ? -1 : 1); |
|
} |
|
} |
|
var v = s1 + s2 + s3; |
|
$(_6f0).timespinner("setValue", v); |
|
_6e8(_6f0); |
|
}; |
|
$.fn.timespinner = function (_6f2, _6f3) { |
|
if (typeof _6f2 == "string") { |
|
var _6f4 = $.fn.timespinner.methods[_6f2]; |
|
if (_6f4) { |
|
return _6f4(this, _6f3); |
|
} else { |
|
return this.spinner(_6f2, _6f3); |
|
} |
|
} |
|
_6f2 = _6f2 || {}; |
|
return this.each(function () { |
|
var _6f5 = $.data(this, "timespinner"); |
|
if (_6f5) { |
|
$.extend(_6f5.options, _6f2); |
|
} else { |
|
$.data(this, "timespinner", { |
|
options: $.extend({}, $.fn.timespinner.defaults, $.fn.timespinner.parseOptions(this), _6f2) |
|
}); |
|
} |
|
_6e1(this); |
|
}); |
|
}; |
|
$.fn.timespinner.methods = { |
|
options: function (jq) { |
|
var opts = jq.data("spinner") ? jq.spinner("options") : {}; |
|
return $.extend($.data(jq[0], "timespinner").options, { |
|
width: opts.width, |
|
value: opts.value, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
}, |
|
setValue: function (jq, _6f6) { |
|
return jq.each(function () { |
|
_6ec(this, _6f6); |
|
}); |
|
}, |
|
getHours: function (jq) { |
|
var opts = $.data(jq[0], "timespinner").options; |
|
var date = opts.parser.call(jq[0], jq.timespinner("getValue")); |
|
return date ? date.getHours() : null; |
|
}, |
|
getMinutes: function (jq) { |
|
var opts = $.data(jq[0], "timespinner").options; |
|
var date = opts.parser.call(jq[0], jq.timespinner("getValue")); |
|
return date ? date.getMinutes() : null; |
|
}, |
|
getSeconds: function (jq) { |
|
var opts = $.data(jq[0], "timespinner").options; |
|
var date = opts.parser.call(jq[0], jq.timespinner("getValue")); |
|
return date ? date.getSeconds() : null; |
|
} |
|
}; |
|
$.fn.timespinner.parseOptions = function (_6f7) { |
|
return $.extend({}, $.fn.spinner.parseOptions(_6f7), $.parser.parseOptions(_6f7, ["separator", { |
|
hour12: "boolean", |
|
showSeconds: "boolean", |
|
highlight: "number" |
|
} |
|
])); |
|
}; |
|
$.fn.timespinner.defaults = $.extend({}, $.fn.spinner.defaults, { |
|
inputEvents: $.extend({}, $.fn.spinner.defaults.inputEvents, { |
|
click: function (e) { |
|
_6e4.call(this, e); |
|
}, |
|
blur: function (e) { |
|
var t = $(e.data.target); |
|
t.timespinner("setValue", t.timespinner("getText")); |
|
}, |
|
keydown: function (e) { |
|
if (e.keyCode == 13) { |
|
var t = $(e.data.target); |
|
t.timespinner("setValue", t.timespinner("getText")); |
|
} |
|
} |
|
}), |
|
formatter: function (date) { |
|
if (!date) { |
|
return ""; |
|
} |
|
var opts = $(this).timespinner("options"); |
|
var hour = date.getHours(); |
|
var _6f8 = date.getMinutes(); |
|
var _6f9 = date.getSeconds(); |
|
var ampm = ""; |
|
if (opts.hour12) { |
|
ampm = hour >= 12 ? opts.ampm[1] : opts.ampm[0]; |
|
hour = hour % 12; |
|
if (hour == 0) { |
|
hour = 12; |
|
} |
|
} |
|
var tt = [_6fa(hour), _6fa(_6f8)]; |
|
if (opts.showSeconds) { |
|
tt.push(_6fa(_6f9)); |
|
} |
|
var s = tt.join(opts.separator) + " " + ampm; |
|
return $.trim(s); |
|
function _6fa(_6fb) { |
|
return (_6fb < 10 ? "0" : "") + _6fb; |
|
}; |
|
}, |
|
parser: function (s) { |
|
var opts = $(this).timespinner("options"); |
|
var date = _6fc(s); |
|
if (date) { |
|
var min = _6fc(opts.min); |
|
var max = _6fc(opts.max); |
|
if (min && min > date) { |
|
date = min; |
|
} |
|
if (max && max < date) { |
|
date = max; |
|
} |
|
} |
|
return date; |
|
function _6fc(s) { |
|
if (!s) { |
|
return null; |
|
} |
|
var ss = s.split(" "); |
|
var tt = ss[0].split(opts.separator); |
|
var hour = parseInt(tt[0], 10) || 0; |
|
var _6fd = parseInt(tt[1], 10) || 0; |
|
var _6fe = parseInt(tt[2], 10) || 0; |
|
if (opts.hour12) { |
|
var ampm = ss[1]; |
|
if (ampm == opts.ampm[1] && hour < 12) { |
|
hour += 12; |
|
} else { |
|
if (ampm == opts.ampm[0] && hour == 12) { |
|
hour -= 12; |
|
} |
|
} |
|
} |
|
return new Date(1900, 0, 0, hour, _6fd, _6fe); |
|
}; |
|
}, |
|
selections: [[0, 2], [3, 5], [6, 8], [9, 11]], |
|
separator: ":", |
|
showSeconds: false, |
|
highlight: 0, |
|
hour12: false, |
|
ampm: ["AM", "PM"], |
|
spin: function (down) { |
|
_6ef(this, down); |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _6ff(_700) { |
|
var opts = $.data(_700, "datetimespinner").options; |
|
$(_700).addClass("datetimespinner-f").timespinner(opts); |
|
}; |
|
$.fn.datetimespinner = function (_701, _702) { |
|
if (typeof _701 == "string") { |
|
var _703 = $.fn.datetimespinner.methods[_701]; |
|
if (_703) { |
|
return _703(this, _702); |
|
} else { |
|
return this.timespinner(_701, _702); |
|
} |
|
} |
|
_701 = _701 || {}; |
|
return this.each(function () { |
|
var _704 = $.data(this, "datetimespinner"); |
|
if (_704) { |
|
$.extend(_704.options, _701); |
|
} else { |
|
$.data(this, "datetimespinner", { |
|
options: $.extend({}, $.fn.datetimespinner.defaults, $.fn.datetimespinner.parseOptions(this), _701) |
|
}); |
|
} |
|
_6ff(this); |
|
}); |
|
}; |
|
$.fn.datetimespinner.methods = { |
|
options: function (jq) { |
|
var opts = jq.timespinner("options"); |
|
return $.extend($.data(jq[0], "datetimespinner").options, { |
|
width: opts.width, |
|
value: opts.value, |
|
originalValue: opts.originalValue, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
} |
|
}; |
|
$.fn.datetimespinner.parseOptions = function (_705) { |
|
return $.extend({}, $.fn.timespinner.parseOptions(_705), $.parser.parseOptions(_705, [])); |
|
}; |
|
$.fn.datetimespinner.defaults = $.extend({}, $.fn.timespinner.defaults, { |
|
formatter: function (date) { |
|
if (!date) { |
|
return ""; |
|
} |
|
return $.fn.datebox.defaults.formatter.call(this, date) + " " + $.fn.timespinner.defaults.formatter.call(this, date); |
|
}, |
|
parser: function (s) { |
|
s = $.trim(s); |
|
if (!s) { |
|
return null; |
|
} |
|
var dt = s.split(" "); |
|
var _706 = $.fn.datebox.defaults.parser.call(this, dt[0]); |
|
if (dt.length < 2) { |
|
return _706; |
|
} |
|
var _707 = $.fn.timespinner.defaults.parser.call(this, dt[1] + (dt[2] ? " " + dt[2] : "")); |
|
return new Date(_706.getFullYear(), _706.getMonth(), _706.getDate(), _707.getHours(), _707.getMinutes(), _707.getSeconds()); |
|
}, |
|
selections: [[0, 2], [3, 5], [6, 10], [11, 13], [14, 16], [17, 19], [20, 22]] |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
var _708 = 0; |
|
function _709(a, o) { |
|
return $.easyui.indexOfArray(a, o); |
|
}; |
|
function _70a(a, o, id) { |
|
$.easyui.removeArrayItem(a, o, id); |
|
}; |
|
function _70b(a, o, r) { |
|
$.easyui.addArrayItem(a, o, r); |
|
}; |
|
function _70c(_70d, aa) { |
|
return $.data(_70d, "treegrid") ? aa.slice(1) : aa; |
|
}; |
|
function _70e(_70f) { |
|
var _710 = $.data(_70f, "datagrid"); |
|
var opts = _710.options; |
|
var _711 = _710.panel; |
|
var dc = _710.dc; |
|
var ss = null; |
|
if (opts.sharedStyleSheet) { |
|
ss = typeof opts.sharedStyleSheet == "boolean" ? "head" : opts.sharedStyleSheet; |
|
} else { |
|
ss = _711.closest("div.datagrid-view"); |
|
if (!ss.length) { |
|
ss = dc.view; |
|
} |
|
} |
|
var cc = $(ss); |
|
var _712 = $.data(cc[0], "ss"); |
|
if (!_712) { |
|
_712 = $.data(cc[0], "ss", { |
|
cache: {}, |
|
dirty: [] |
|
}); |
|
} |
|
return { |
|
add: function (_713) { |
|
var ss = ["<style type=\"text/css\" easyui=\"true\">"]; |
|
for (var i = 0; i < _713.length; i++) { |
|
_712.cache[_713[i][0]] = { |
|
width: _713[i][1] |
|
}; |
|
} |
|
var _714 = 0; |
|
for (var s in _712.cache) { |
|
var item = _712.cache[s]; |
|
item.index = _714++; |
|
ss.push(s + "{width:" + item.width + "}"); |
|
} |
|
ss.push("</style>"); |
|
$(ss.join("\n")).appendTo(cc); |
|
cc.children("style[easyui]:not(:last)").remove(); |
|
}, |
|
getRule: function (_715) { |
|
var _716 = cc.children("style[easyui]:last")[0]; |
|
var _717 = _716.styleSheet ? _716.styleSheet : (_716.sheet || document.styleSheets[document.styleSheets.length - 1]); |
|
var _718 = _717.cssRules || _717.rules; |
|
return _718[_715]; |
|
}, |
|
set: function (_719, _71a) { |
|
var item = _712.cache[_719]; |
|
if (item) { |
|
item.width = _71a; |
|
var rule = this.getRule(item.index); |
|
if (rule) { |
|
rule.style["width"] = _71a; |
|
} |
|
} |
|
}, |
|
remove: function (_71b) { |
|
var tmp = []; |
|
for (var s in _712.cache) { |
|
if (s.indexOf(_71b) == -1) { |
|
tmp.push([s, _712.cache[s].width]); |
|
} |
|
} |
|
_712.cache = {}; |
|
this.add(tmp); |
|
}, |
|
dirty: function (_71c) { |
|
if (_71c) { |
|
_712.dirty.push(_71c); |
|
} |
|
}, |
|
clean: function () { |
|
for (var i = 0; i < _712.dirty.length; i++) { |
|
this.remove(_712.dirty[i]); |
|
} |
|
_712.dirty = []; |
|
} |
|
}; |
|
}; |
|
function _71d(_71e, _71f) { |
|
var _720 = $.data(_71e, "datagrid"); |
|
var opts = _720.options; |
|
var _721 = _720.panel; |
|
if (_71f) { |
|
$.extend(opts, _71f); |
|
} |
|
if (opts.fit == true) { |
|
var p = _721.panel("panel").parent(); |
|
opts.width = p.width(); |
|
opts.height = p.height(); |
|
} |
|
_721.panel("resize", opts); |
|
}; |
|
function _722(_723) { |
|
var _724 = $.data(_723, "datagrid"); |
|
var opts = _724.options; |
|
var dc = _724.dc; |
|
var wrap = _724.panel; |
|
if (!wrap.is(":visible")) { |
|
return; |
|
} |
|
var _725 = wrap.width(); |
|
var _726 = wrap.height(); |
|
var view = dc.view; |
|
var _727 = dc.view1; |
|
var _728 = dc.view2; |
|
var _729 = _727.children("div.datagrid-header"); |
|
var _72a = _728.children("div.datagrid-header"); |
|
var _72b = _729.find("table"); |
|
var _72c = _72a.find("table"); |
|
view.width(_725); |
|
var _72d = _729.children("div.datagrid-header-inner").show(); |
|
_727.width(_72d.find("table").width()); |
|
if (!opts.showHeader) { |
|
_72d.hide(); |
|
} |
|
_728.width(_725 - _727._outerWidth()); |
|
_727.children()._outerWidth(_727.width()); |
|
_728.children()._outerWidth(_728.width()); |
|
var all = _729.add(_72a).add(_72b).add(_72c); |
|
all.css("height", ""); |
|
var hh = Math.max(_72b.height(), _72c.height()); |
|
all._outerHeight(hh); |
|
view.children(".datagrid-empty").css("top", hh + "px"); |
|
dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({ |
|
position: "absolute", |
|
top: dc.header2._outerHeight() |
|
}); |
|
var _72e = dc.body2.children("table.datagrid-btable-frozen")._outerHeight(); |
|
var _72f = _72e + _72a._outerHeight() + _728.children(".datagrid-footer")._outerHeight(); |
|
wrap.children(":not(.datagrid-view,.datagrid-mask,.datagrid-mask-msg)").each(function () { |
|
_72f += $(this)._outerHeight(); |
|
}); |
|
var _730 = wrap.outerHeight() - wrap.height(); |
|
var _731 = wrap._size("minHeight") || ""; |
|
var _732 = wrap._size("maxHeight") || ""; |
|
_727.add(_728).children("div.datagrid-body").css({ |
|
marginTop: _72e, |
|
height: (isNaN(parseInt(opts.height)) ? "" : (_726 - _72f)), |
|
minHeight: (_731 ? _731 - _730 - _72f : ""), |
|
maxHeight: (_732 ? _732 - _730 - _72f : "") |
|
}); |
|
view.height(_728.height()); |
|
}; |
|
function _733(_734, _735, _736) { |
|
var rows = $.data(_734, "datagrid").data.rows; |
|
var opts = $.data(_734, "datagrid").options; |
|
var dc = $.data(_734, "datagrid").dc; |
|
var tmp = $("<tr class=\"datagrid-row\" style=\"position:absolute;left:-999999px\"></tr>").appendTo("body"); |
|
var _737 = tmp.outerHeight(); |
|
tmp.remove(); |
|
if (!dc.body1.is(":empty") && (!opts.nowrap || opts.autoRowHeight || _736)) { |
|
if (_735 != undefined) { |
|
var tr1 = opts.finder.getTr(_734, _735, "body", 1); |
|
var tr2 = opts.finder.getTr(_734, _735, "body", 2); |
|
_738(tr1, tr2); |
|
} else { |
|
var tr1 = opts.finder.getTr(_734, 0, "allbody", 1); |
|
var tr2 = opts.finder.getTr(_734, 0, "allbody", 2); |
|
_738(tr1, tr2); |
|
if (opts.showFooter) { |
|
var tr1 = opts.finder.getTr(_734, 0, "allfooter", 1); |
|
var tr2 = opts.finder.getTr(_734, 0, "allfooter", 2); |
|
_738(tr1, tr2); |
|
} |
|
} |
|
} |
|
_722(_734); |
|
if (opts.height == "auto") { |
|
var _739 = dc.body1.parent(); |
|
var _73a = dc.body2; |
|
var _73b = _73c(_73a); |
|
var _73d = _73b.height; |
|
if (_73b.width > _73a.width()) { |
|
_73d += 18; |
|
} |
|
_73d -= parseInt(_73a.css("marginTop")) || 0; |
|
_739.height(_73d); |
|
_73a.height(_73d); |
|
dc.view.height(dc.view2.height()); |
|
} |
|
dc.body2.triggerHandler("scroll"); |
|
function _738(trs1, trs2) { |
|
for (var i = 0; i < trs2.length; i++) { |
|
var tr1 = $(trs1[i]); |
|
var tr2 = $(trs2[i]); |
|
tr1.css("height", ""); |
|
tr2.css("height", ""); |
|
var _73e = Math.max(tr1.outerHeight(), tr2.outerHeight()); |
|
if (_73e != _737) { |
|
_73e = Math.max(_73e, _737) + 1; |
|
tr1.css("height", _73e); |
|
tr2.css("height", _73e); |
|
} |
|
} |
|
}; |
|
function _73c(cc) { |
|
var _73f = 0; |
|
var _740 = 0; |
|
$(cc).children().each(function () { |
|
var c = $(this); |
|
if (c.is(":visible")) { |
|
_740 += c._outerHeight(); |
|
if (_73f < c._outerWidth()) { |
|
_73f = c._outerWidth(); |
|
} |
|
} |
|
}); |
|
return { |
|
width: _73f, |
|
height: _740 |
|
}; |
|
}; |
|
}; |
|
function _741(_742, _743) { |
|
var _744 = $.data(_742, "datagrid"); |
|
var opts = _744.options; |
|
var dc = _744.dc; |
|
if (!dc.body2.children("table.datagrid-btable-frozen").length) { |
|
dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>"); |
|
} |
|
_745(true); |
|
_745(false); |
|
_722(_742); |
|
function _745(_746) { |
|
var _747 = _746 ? 1 : 2; |
|
var tr = opts.finder.getTr(_742, _743, "body", _747); |
|
(_746 ? dc.body1 : dc.body2).children("table.datagrid-btable-frozen").append(tr); |
|
}; |
|
}; |
|
function _748(_749, _74a) { |
|
function _74b() { |
|
var _74c = []; |
|
var _74d = []; |
|
$(_749).children("thead").each(function () { |
|
var opt = $.parser.parseOptions(this, [{ |
|
frozen: "boolean" |
|
} |
|
]); |
|
$(this).find("tr").each(function () { |
|
var cols = []; |
|
$(this).find("th").each(function () { |
|
var th = $(this); |
|
var col = $.extend({}, $.parser.parseOptions(this, ["id", "field", "align", "halign", "order", "width", { |
|
sortable: "boolean", |
|
checkbox: "boolean", |
|
resizable: "boolean", |
|
fixed: "boolean" |
|
}, { |
|
rowspan: "number", |
|
colspan: "number" |
|
} |
|
]), { |
|
title: (th.html() || undefined), |
|
hidden: (th.attr("hidden") ? true : undefined), |
|
hformatter: (th.attr("hformatter") ? eval(th.attr("hformatter")) : undefined), |
|
hstyler: (th.attr("hstyler") ? eval(th.attr("hstyler")) : undefined), |
|
formatter: (th.attr("formatter") ? eval(th.attr("formatter")) : undefined), |
|
styler: (th.attr("styler") ? eval(th.attr("styler")) : undefined), |
|
sorter: (th.attr("sorter") ? eval(th.attr("sorter")) : undefined) |
|
}); |
|
if (col.width && String(col.width).indexOf("%") == -1) { |
|
col.width = parseInt(col.width); |
|
} |
|
if (th.attr("editor")) { |
|
var s = $.trim(th.attr("editor")); |
|
if (s.substr(0, 1) == "{") { |
|
col.editor = eval("(" + s + ")"); |
|
} else { |
|
col.editor = s; |
|
} |
|
} |
|
cols.push(col); |
|
}); |
|
opt.frozen ? _74c.push(cols) : _74d.push(cols); |
|
}); |
|
}); |
|
return [_74c, _74d]; |
|
}; |
|
var _74e = $("<div class=\"datagrid-wrap\">" + "<div class=\"datagrid-view\">" + "<div class=\"datagrid-view1\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\">" + "<div class=\"datagrid-body-inner\"></div>" + "</div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "<div class=\"datagrid-view2\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\"></div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "</div>" + "</div>").insertAfter(_749); |
|
_74e.panel({ |
|
doSize: false, |
|
cls: "datagrid" |
|
}); |
|
$(_749).addClass("datagrid-f").hide().appendTo(_74e.children("div.datagrid-view")); |
|
var cc = _74b(); |
|
var view = _74e.children("div.datagrid-view"); |
|
var _74f = view.children("div.datagrid-view1"); |
|
var _750 = view.children("div.datagrid-view2"); |
|
return { |
|
panel: _74e, |
|
frozenColumns: cc[0], |
|
columns: cc[1], |
|
dc: { |
|
view: view, |
|
view1: _74f, |
|
view2: _750, |
|
header1: _74f.children("div.datagrid-header").children("div.datagrid-header-inner"), |
|
header2: _750.children("div.datagrid-header").children("div.datagrid-header-inner"), |
|
body1: _74f.children("div.datagrid-body").children("div.datagrid-body-inner"), |
|
body2: _750.children("div.datagrid-body"), |
|
footer1: _74f.children("div.datagrid-footer").children("div.datagrid-footer-inner"), |
|
footer2: _750.children("div.datagrid-footer").children("div.datagrid-footer-inner") |
|
} |
|
}; |
|
}; |
|
function _751(_752) { |
|
var _753 = $.data(_752, "datagrid"); |
|
var opts = _753.options; |
|
var dc = _753.dc; |
|
var _754 = _753.panel; |
|
_753.ss = $(_752).datagrid("createStyleSheet"); |
|
_754.panel($.extend({}, opts, { |
|
id: null, |
|
doSize: false, |
|
onResize: function (_755, _756) { |
|
if ($.data(_752, "datagrid")) { |
|
_722(_752); |
|
$(_752).datagrid("fitColumns"); |
|
opts.onResize.call(_754, _755, _756); |
|
} |
|
}, |
|
onExpand: function () { |
|
if ($.data(_752, "datagrid")) { |
|
$(_752).datagrid("fixRowHeight").datagrid("fitColumns"); |
|
opts.onExpand.call(_754); |
|
} |
|
} |
|
})); |
|
var _757 = $(_752).attr("id") || ""; |
|
if (_757) { |
|
_757 += "_"; |
|
} |
|
_753.rowIdPrefix = _757 + "datagrid-row-r" + (++_708); |
|
_753.cellClassPrefix = _757 + "datagrid-cell-c" + _708; |
|
_758(dc.header1, opts.frozenColumns, true); |
|
_758(dc.header2, opts.columns, false); |
|
_759(); |
|
dc.header1.add(dc.header2).css("display", opts.showHeader ? "block" : "none"); |
|
dc.footer1.add(dc.footer2).css("display", opts.showFooter ? "block" : "none"); |
|
if (opts.toolbar) { |
|
if ($.isArray(opts.toolbar)) { |
|
$("div.datagrid-toolbar", _754).remove(); |
|
var tb = $("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_754); |
|
var tr = tb.find("tr"); |
|
for (var i = 0; i < opts.toolbar.length; i++) { |
|
var btn = opts.toolbar[i]; |
|
if (btn == "-") { |
|
$("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr); |
|
} else { |
|
var td = $("<td></td>").appendTo(tr); |
|
var tool = $("<a href=\"javascript:;\"></a>").appendTo(td); |
|
tool[0].onclick = eval(btn.handler || function () {}); |
|
tool.linkbutton($.extend({}, btn, { |
|
plain: true |
|
})); |
|
} |
|
} |
|
} else { |
|
$(opts.toolbar).addClass("datagrid-toolbar").prependTo(_754); |
|
$(opts.toolbar).show(); |
|
} |
|
} else { |
|
$("div.datagrid-toolbar", _754).remove(); |
|
} |
|
$("div.datagrid-pager", _754).remove(); |
|
if (opts.pagination) { |
|
var _75a = $("<div class=\"datagrid-pager\"></div>"); |
|
if (opts.pagePosition == "bottom") { |
|
_75a.appendTo(_754); |
|
} else { |
|
if (opts.pagePosition == "top") { |
|
_75a.addClass("datagrid-pager-top").prependTo(_754); |
|
} else { |
|
var ptop = $("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_754); |
|
_75a.appendTo(_754); |
|
_75a = _75a.add(ptop); |
|
} |
|
} |
|
_75a.pagination({ |
|
total: 0, |
|
pageNumber: opts.pageNumber, |
|
pageSize: opts.pageSize, |
|
pageList: opts.pageList, |
|
onSelectPage: function (_75b, _75c) { |
|
opts.pageNumber = _75b || 1; |
|
opts.pageSize = _75c; |
|
_75a.pagination("refresh", { |
|
pageNumber: _75b, |
|
pageSize: _75c |
|
}); |
|
_7a6(_752); |
|
} |
|
}); |
|
opts.pageSize = _75a.pagination("options").pageSize; |
|
} |
|
function _758(_75d, _75e, _75f) { |
|
if (!_75e) { |
|
return; |
|
} |
|
$(_75d).show(); |
|
$(_75d).empty(); |
|
var tmp = $("<div class=\"datagrid-cell\" style=\"position:absolute;left:-99999px\"></div>").appendTo("body"); |
|
tmp._outerWidth(99); |
|
var _760 = 100 - parseInt(tmp[0].style.width); |
|
tmp.remove(); |
|
var _761 = []; |
|
var _762 = []; |
|
var _763 = []; |
|
if (opts.sortName) { |
|
_761 = opts.sortName.split(","); |
|
_762 = opts.sortOrder.split(","); |
|
} |
|
var t = $("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_75d); |
|
for (var i = 0; i < _75e.length; i++) { |
|
var tr = $("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody", t)); |
|
var cols = _75e[i]; |
|
for (var j = 0; j < cols.length; j++) { |
|
var col = cols[j]; |
|
var attr = ""; |
|
if (col.rowspan) { |
|
attr += "rowspan=\"" + col.rowspan + "\" "; |
|
} |
|
if (col.colspan) { |
|
attr += "colspan=\"" + col.colspan + "\" "; |
|
if (!col.id) { |
|
col.id = ["datagrid-td-group" + _708, i, j].join("-"); |
|
} |
|
} |
|
if (col.id) { |
|
attr += "id=\"" + col.id + "\""; |
|
} |
|
var css = col.hstyler ? col.hstyler(col.title, col) : ""; |
|
if (typeof css == "string") { |
|
var _764 = css; |
|
var _765 = ""; |
|
} else { |
|
css = css || {}; |
|
var _764 = css["style"] || ""; |
|
var _765 = css["class"] || ""; |
|
} |
|
var td = $("<td " + attr + " class=\"" + _765 + "\" style=\"" + _764 + "\"" + "></td>").appendTo(tr); |
|
if (col.checkbox) { |
|
td.attr("field", col.field); |
|
$("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\">").appendTo(td); |
|
} else { |
|
if (col.field) { |
|
td.attr("field", col.field); |
|
td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>"); |
|
td.find("span:first").html(col.hformatter ? col.hformatter(col.title, col) : col.title); |
|
var cell = td.find("div.datagrid-cell"); |
|
var pos = _709(_761, col.field); |
|
if (pos >= 0) { |
|
cell.addClass("datagrid-sort-" + _762[pos]); |
|
} |
|
if (col.sortable) { |
|
cell.addClass("datagrid-sort"); |
|
} |
|
if (col.resizable == false) { |
|
cell.attr("resizable", "false"); |
|
} |
|
if (col.width) { |
|
var _766 = $.parser.parseValue("width", col.width, dc.view, opts.scrollbarSize + (opts.rownumbers ? opts.rownumberWidth : 0)); |
|
col.deltaWidth = _760; |
|
col.boxWidth = _766 - _760; |
|
} else { |
|
col.auto = true; |
|
} |
|
cell.css("text-align", (col.halign || col.align || "")); |
|
col.cellClass = _753.cellClassPrefix + "-" + col.field.replace(/[\.|\s]/g, "-"); |
|
cell.addClass(col.cellClass); |
|
} else { |
|
$("<div class=\"datagrid-cell-group\"></div>").html(col.hformatter ? col.hformatter(col.title, col) : col.title).appendTo(td); |
|
} |
|
} |
|
if (col.hidden) { |
|
td.hide(); |
|
_763.push(col.field); |
|
} |
|
} |
|
} |
|
if (_75f && opts.rownumbers) { |
|
var td = $("<td rowspan=\"" + opts.frozenColumns.length + "\"><div class=\"datagrid-header-rownumber\"></div></td>"); |
|
if ($("tr", t).length == 0) { |
|
td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody", t)); |
|
} else { |
|
td.prependTo($("tr:first", t)); |
|
} |
|
} |
|
for (var i = 0; i < _763.length; i++) { |
|
_7a8(_752, _763[i], -1); |
|
} |
|
}; |
|
function _759() { |
|
var _767 = [[".datagrid-header-rownumber", (opts.rownumberWidth - 1) + "px"], [".datagrid-cell-rownumber", (opts.rownumberWidth - 1) + "px"]]; |
|
var _768 = _769(_752, true).concat(_769(_752)); |
|
for (var i = 0; i < _768.length; i++) { |
|
var col = _76a(_752, _768[i]); |
|
if (col && !col.checkbox) { |
|
_767.push(["." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto"]); |
|
} |
|
} |
|
_753.ss.add(_767); |
|
_753.ss.dirty(_753.cellSelectorPrefix); |
|
_753.cellSelectorPrefix = "." + _753.cellClassPrefix; |
|
}; |
|
}; |
|
function _76b(_76c) { |
|
var _76d = $.data(_76c, "datagrid"); |
|
var _76e = _76d.panel; |
|
var opts = _76d.options; |
|
var dc = _76d.dc; |
|
var _76f = dc.header1.add(dc.header2); |
|
_76f._unbind(".datagrid"); |
|
for (var _770 in opts.headerEvents) { |
|
_76f._bind(_770 + ".datagrid", opts.headerEvents[_770]); |
|
} |
|
var _771 = _76f.find("div.datagrid-cell"); |
|
var _772 = opts.resizeHandle == "right" ? "e" : (opts.resizeHandle == "left" ? "w" : "e,w"); |
|
_771.each(function () { |
|
$(this).resizable({ |
|
handles: _772, |
|
edge: opts.resizeEdge, |
|
disabled: ($(this).attr("resizable") ? $(this).attr("resizable") == "false" : false), |
|
minWidth: 25, |
|
onStartResize: function (e) { |
|
_76d.resizing = true; |
|
_76f.css("cursor", $("body").css("cursor")); |
|
if (!_76d.proxy) { |
|
_76d.proxy = $("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view); |
|
} |
|
if (e.data.dir == "e") { |
|
e.data.deltaEdge = $(this)._outerWidth() - (e.pageX - $(this).offset().left); |
|
} else { |
|
e.data.deltaEdge = $(this).offset().left - e.pageX - 1; |
|
} |
|
_76d.proxy.css({ |
|
left: e.pageX - $(_76e).offset().left - 1 + e.data.deltaEdge, |
|
display: "none" |
|
}); |
|
setTimeout(function () { |
|
if (_76d.proxy) { |
|
_76d.proxy.show(); |
|
} |
|
}, 500); |
|
}, |
|
onResize: function (e) { |
|
_76d.proxy.css({ |
|
left: e.pageX - $(_76e).offset().left - 1 + e.data.deltaEdge, |
|
display: "block" |
|
}); |
|
return false; |
|
}, |
|
onStopResize: function (e) { |
|
_76f.css("cursor", ""); |
|
$(this).css("height", ""); |
|
var _773 = $(this).parent().attr("field"); |
|
var col = _76a(_76c, _773); |
|
col.width = $(this)._outerWidth() + 1; |
|
col.boxWidth = col.width - col.deltaWidth; |
|
col.auto = undefined; |
|
$(this).css("width", ""); |
|
$(_76c).datagrid("fixColumnSize", _773); |
|
_76d.proxy.remove(); |
|
_76d.proxy = null; |
|
if ($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")) { |
|
_722(_76c); |
|
} |
|
$(_76c).datagrid("fitColumns"); |
|
opts.onResizeColumn.call(_76c, _773, col.width); |
|
setTimeout(function () { |
|
_76d.resizing = false; |
|
}, 0); |
|
} |
|
}); |
|
}); |
|
var bb = dc.body1.add(dc.body2); |
|
bb._unbind(); |
|
for (var _770 in opts.rowEvents) { |
|
bb._bind(_770, opts.rowEvents[_770]); |
|
} |
|
dc.body1._bind("mousewheel DOMMouseScroll MozMousePixelScroll", function (e) { |
|
e.preventDefault(); |
|
var e1 = e.originalEvent || window.event; |
|
var _774 = e1.wheelDelta || e1.detail * (-1); |
|
if ("deltaY" in e1) { |
|
_774 = e1.deltaY * -1; |
|
} |
|
var dg = $(e.target).closest("div.datagrid-view").children(".datagrid-f"); |
|
var dc = dg.data("datagrid").dc; |
|
dc.body2.scrollTop(dc.body2.scrollTop() - _774); |
|
}); |
|
dc.body2._bind("scroll", function () { |
|
var b1 = dc.view1.children("div.datagrid-body"); |
|
var stv = $(this).scrollTop(); |
|
$(this).scrollTop(stv); |
|
b1.scrollTop(stv); |
|
var c1 = dc.body1.children(":first"); |
|
var c2 = dc.body2.children(":first"); |
|
if (c1.length && c2.length) { |
|
var top1 = c1.offset().top; |
|
var top2 = c2.offset().top; |
|
if (top1 != top2) { |
|
b1.scrollTop(b1.scrollTop() + top1 - top2); |
|
} |
|
} |
|
dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft()); |
|
dc.body2.children("table.datagrid-btable-frozen").css("left", -$(this)._scrollLeft()); |
|
}); |
|
}; |
|
function _775(_776) { |
|
return function (e) { |
|
var td = $(e.target).closest("td[field]"); |
|
if (td.length) { |
|
var _777 = _778(td); |
|
if (!$(_777).data("datagrid").resizing && _776) { |
|
td.addClass("datagrid-header-over"); |
|
} else { |
|
td.removeClass("datagrid-header-over"); |
|
} |
|
} |
|
}; |
|
}; |
|
function _779(e) { |
|
var _77a = _778(e.target); |
|
var opts = $(_77a).datagrid("options"); |
|
var ck = $(e.target).closest("input[type=checkbox]"); |
|
if (ck.length) { |
|
if (opts.singleSelect && opts.selectOnCheck) { |
|
return false; |
|
} |
|
if (ck.is(":checked")) { |
|
_77b(_77a); |
|
} else { |
|
_77c(_77a); |
|
} |
|
e.stopPropagation(); |
|
} else { |
|
var cell = $(e.target).closest(".datagrid-cell"); |
|
if (cell.length) { |
|
var p1 = cell.offset().left + 5; |
|
var p2 = cell.offset().left + cell._outerWidth() - 5; |
|
if (e.pageX < p2 && e.pageX > p1) { |
|
_77d(_77a, cell.parent().attr("field")); |
|
} |
|
} |
|
} |
|
}; |
|
function _77e(e) { |
|
var _77f = _778(e.target); |
|
var opts = $(_77f).datagrid("options"); |
|
var cell = $(e.target).closest(".datagrid-cell"); |
|
if (cell.length) { |
|
var p1 = cell.offset().left + 5; |
|
var p2 = cell.offset().left + cell._outerWidth() - 5; |
|
var cond = opts.resizeHandle == "right" ? (e.pageX > p2) : (opts.resizeHandle == "left" ? (e.pageX < p1) : (e.pageX < p1 || e.pageX > p2)); |
|
if (cond) { |
|
var _780 = cell.parent().attr("field"); |
|
var col = _76a(_77f, _780); |
|
if (col.resizable == false) { |
|
return; |
|
} |
|
$(_77f).datagrid("autoSizeColumn", _780); |
|
col.auto = false; |
|
} |
|
} |
|
}; |
|
function _781(e) { |
|
var _782 = _778(e.target); |
|
var opts = $(_782).datagrid("options"); |
|
var td = $(e.target).closest("td[field]"); |
|
opts.onHeaderContextMenu.call(_782, e, td.attr("field")); |
|
}; |
|
function _783(_784) { |
|
return function (e) { |
|
var tr = _785(e.target); |
|
if (!tr) { |
|
return; |
|
} |
|
var _786 = _778(tr); |
|
if ($.data(_786, "datagrid").resizing) { |
|
return; |
|
} |
|
var _787 = _788(tr); |
|
if (_784) { |
|
_789(_786, _787); |
|
} else { |
|
var opts = $.data(_786, "datagrid").options; |
|
opts.finder.getTr(_786, _787).removeClass("datagrid-row-over"); |
|
} |
|
}; |
|
}; |
|
function _78a(e) { |
|
var tr = _785(e.target); |
|
if (!tr) { |
|
return; |
|
} |
|
var _78b = _778(tr); |
|
var opts = $.data(_78b, "datagrid").options; |
|
var _78c = _788(tr); |
|
var tt = $(e.target); |
|
if (tt.parent().hasClass("datagrid-cell-check")) { |
|
if (opts.singleSelect && opts.selectOnCheck) { |
|
tt._propAttr("checked", !tt.is(":checked")); |
|
_78d(_78b, _78c); |
|
} else { |
|
if (tt.is(":checked")) { |
|
tt._propAttr("checked", false); |
|
_78d(_78b, _78c); |
|
} else { |
|
tt._propAttr("checked", true); |
|
_78e(_78b, _78c); |
|
} |
|
} |
|
} else { |
|
var row = opts.finder.getRow(_78b, _78c); |
|
var td = tt.closest("td[field]", tr); |
|
if (td.length) { |
|
var _78f = td.attr("field"); |
|
opts.onClickCell.call(_78b, _78c, _78f, row[_78f]); |
|
} |
|
if (opts.singleSelect == true) { |
|
_790(_78b, _78c); |
|
} else { |
|
if (opts.ctrlSelect) { |
|
if (e.metaKey || e.ctrlKey) { |
|
if (tr.hasClass("datagrid-row-selected")) { |
|
_791(_78b, _78c); |
|
} else { |
|
_790(_78b, _78c); |
|
} |
|
} else { |
|
if (e.shiftKey) { |
|
$(_78b).datagrid("clearSelections"); |
|
var _792 = Math.min(opts.lastSelectedIndex || 0, _78c); |
|
var _793 = Math.max(opts.lastSelectedIndex || 0, _78c); |
|
for (var i = _792; i <= _793; i++) { |
|
_790(_78b, i); |
|
} |
|
} else { |
|
$(_78b).datagrid("clearSelections"); |
|
_790(_78b, _78c); |
|
opts.lastSelectedIndex = _78c; |
|
} |
|
} |
|
} else { |
|
if (tr.hasClass("datagrid-row-selected")) { |
|
_791(_78b, _78c); |
|
} else { |
|
_790(_78b, _78c); |
|
} |
|
} |
|
} |
|
opts.onClickRow.apply(_78b, _70c(_78b, [_78c, row])); |
|
} |
|
}; |
|
function _794(e) { |
|
var tr = _785(e.target); |
|
if (!tr) { |
|
return; |
|
} |
|
var _795 = _778(tr); |
|
var opts = $.data(_795, "datagrid").options; |
|
var _796 = _788(tr); |
|
var row = opts.finder.getRow(_795, _796); |
|
var td = $(e.target).closest("td[field]", tr); |
|
if (td.length) { |
|
var _797 = td.attr("field"); |
|
opts.onDblClickCell.call(_795, _796, _797, row[_797]); |
|
} |
|
opts.onDblClickRow.apply(_795, _70c(_795, [_796, row])); |
|
}; |
|
function _798(e) { |
|
var tr = _785(e.target); |
|
if (tr) { |
|
var _799 = _778(tr); |
|
var opts = $.data(_799, "datagrid").options; |
|
var _79a = _788(tr); |
|
var row = opts.finder.getRow(_799, _79a); |
|
opts.onRowContextMenu.call(_799, e, _79a, row); |
|
} else { |
|
var body = _785(e.target, ".datagrid-body"); |
|
if (body) { |
|
var _799 = _778(body); |
|
var opts = $.data(_799, "datagrid").options; |
|
opts.onRowContextMenu.call(_799, e, -1, null); |
|
} |
|
} |
|
}; |
|
function _778(t) { |
|
return $(t).closest("div.datagrid-view").children(".datagrid-f")[0]; |
|
}; |
|
function _785(t, _79b) { |
|
var tr = $(t).closest(_79b || "tr.datagrid-row"); |
|
if (tr.length && tr.parent().length) { |
|
return tr; |
|
} else { |
|
return undefined; |
|
} |
|
}; |
|
function _788(tr) { |
|
if (tr.attr("datagrid-row-index")) { |
|
return parseInt(tr.attr("datagrid-row-index")); |
|
} else { |
|
return tr.attr("node-id"); |
|
} |
|
}; |
|
function _77d(_79c, _79d) { |
|
var _79e = $.data(_79c, "datagrid"); |
|
var opts = _79e.options; |
|
_79d = _79d || {}; |
|
var _79f = { |
|
sortName: opts.sortName, |
|
sortOrder: opts.sortOrder |
|
}; |
|
if (typeof _79d == "object") { |
|
$.extend(_79f, _79d); |
|
} |
|
var _7a0 = []; |
|
var _7a1 = []; |
|
if (_79f.sortName) { |
|
_7a0 = _79f.sortName.split(","); |
|
_7a1 = _79f.sortOrder.split(","); |
|
} |
|
if (typeof _79d == "string") { |
|
var _7a2 = _79d; |
|
var col = _76a(_79c, _7a2); |
|
if (!col.sortable || _79e.resizing) { |
|
return; |
|
} |
|
var _7a3 = col.order || "asc"; |
|
var pos = _709(_7a0, _7a2); |
|
if (pos >= 0) { |
|
var _7a4 = _7a1[pos] == "asc" ? "desc" : "asc"; |
|
if (opts.multiSort && _7a4 == _7a3) { |
|
_7a0.splice(pos, 1); |
|
_7a1.splice(pos, 1); |
|
} else { |
|
_7a1[pos] = _7a4; |
|
} |
|
} else { |
|
if (opts.multiSort) { |
|
_7a0.push(_7a2); |
|
_7a1.push(_7a3); |
|
} else { |
|
_7a0 = [_7a2]; |
|
_7a1 = [_7a3]; |
|
} |
|
} |
|
_79f.sortName = _7a0.join(","); |
|
_79f.sortOrder = _7a1.join(","); |
|
} |
|
if (opts.onBeforeSortColumn.call(_79c, _79f.sortName, _79f.sortOrder) == false) { |
|
return; |
|
} |
|
$.extend(opts, _79f); |
|
var dc = _79e.dc; |
|
var _7a5 = dc.header1.add(dc.header2); |
|
_7a5.find("div.datagrid-cell").removeClass("datagrid-sort-asc datagrid-sort-desc"); |
|
for (var i = 0; i < _7a0.length; i++) { |
|
var col = _76a(_79c, _7a0[i]); |
|
_7a5.find("div." + col.cellClass).addClass("datagrid-sort-" + _7a1[i]); |
|
} |
|
if (opts.remoteSort) { |
|
_7a6(_79c); |
|
} else { |
|
_7a7(_79c, $(_79c).datagrid("getData")); |
|
} |
|
opts.onSortColumn.call(_79c, opts.sortName, opts.sortOrder); |
|
}; |
|
function _7a8(_7a9, _7aa, _7ab) { |
|
_7ac(true); |
|
_7ac(false); |
|
function _7ac(_7ad) { |
|
var aa = _7ae(_7a9, _7ad); |
|
if (aa.length) { |
|
var _7af = aa[aa.length - 1]; |
|
var _7b0 = _709(_7af, _7aa); |
|
if (_7b0 >= 0) { |
|
for (var _7b1 = 0; _7b1 < aa.length - 1; _7b1++) { |
|
var td = $("#" + aa[_7b1][_7b0]); |
|
var _7b2 = parseInt(td.attr("colspan") || 1) + (_7ab || 0); |
|
td.attr("colspan", _7b2); |
|
if (_7b2) { |
|
td.show(); |
|
} else { |
|
td.hide(); |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
}; |
|
function _7b3(_7b4) { |
|
var _7b5 = $.data(_7b4, "datagrid"); |
|
var opts = _7b5.options; |
|
var dc = _7b5.dc; |
|
var _7b6 = dc.view2.children("div.datagrid-header"); |
|
var _7b7 = _7b6.children("div.datagrid-header-inner"); |
|
dc.body2.css("overflow-x", ""); |
|
_7b8(); |
|
_7b9(); |
|
_7ba(); |
|
_7b8(true); |
|
_7b7.show(); |
|
if (_7b6.width() >= _7b6.find("table").width()) { |
|
dc.body2.css("overflow-x", "hidden"); |
|
} |
|
if (!opts.showHeader) { |
|
_7b7.hide(); |
|
} |
|
function _7ba() { |
|
if (!opts.fitColumns) { |
|
return; |
|
} |
|
if (!_7b5.leftWidth) { |
|
_7b5.leftWidth = 0; |
|
} |
|
var _7bb = 0; |
|
var cc = []; |
|
var _7bc = _769(_7b4, false); |
|
for (var i = 0; i < _7bc.length; i++) { |
|
var col = _76a(_7b4, _7bc[i]); |
|
if (_7bd(col)) { |
|
_7bb += col.width; |
|
cc.push({ |
|
field: col.field, |
|
col: col, |
|
addingWidth: 0 |
|
}); |
|
} |
|
} |
|
if (!_7bb) { |
|
return; |
|
} |
|
cc[cc.length - 1].addingWidth -= _7b5.leftWidth; |
|
_7b7.show(); |
|
var _7be = _7b6.width() - _7b6.find("table").width() - opts.scrollbarSize + _7b5.leftWidth; |
|
var rate = _7be / _7bb; |
|
if (!opts.showHeader) { |
|
_7b7.hide(); |
|
} |
|
for (var i = 0; i < cc.length; i++) { |
|
var c = cc[i]; |
|
var _7bf = parseInt(c.col.width * rate); |
|
c.addingWidth += _7bf; |
|
_7be -= _7bf; |
|
} |
|
cc[cc.length - 1].addingWidth += _7be; |
|
for (var i = 0; i < cc.length; i++) { |
|
var c = cc[i]; |
|
if (c.col.boxWidth + c.addingWidth > 0) { |
|
c.col.boxWidth += c.addingWidth; |
|
c.col.width += c.addingWidth; |
|
} |
|
} |
|
_7b5.leftWidth = _7be; |
|
$(_7b4).datagrid("fixColumnSize"); |
|
}; |
|
function _7b9() { |
|
var _7c0 = false; |
|
var _7c1 = _769(_7b4, true).concat(_769(_7b4, false)); |
|
$.map(_7c1, function (_7c2) { |
|
var col = _76a(_7b4, _7c2); |
|
if (String(col.width || "").indexOf("%") >= 0) { |
|
var _7c3 = $.parser.parseValue("width", col.width, dc.view, opts.scrollbarSize + (opts.rownumbers ? opts.rownumberWidth : 0)) - col.deltaWidth; |
|
if (_7c3 > 0) { |
|
col.boxWidth = _7c3; |
|
_7c0 = true; |
|
} |
|
} |
|
}); |
|
if (_7c0) { |
|
$(_7b4).datagrid("fixColumnSize"); |
|
} |
|
}; |
|
function _7b8(fit) { |
|
var _7c4 = dc.header1.add(dc.header2).find(".datagrid-cell-group"); |
|
if (_7c4.length) { |
|
_7c4.each(function () { |
|
$(this)._outerWidth(fit ? $(this).parent().width() : 10); |
|
}); |
|
if (fit) { |
|
_722(_7b4); |
|
} |
|
} |
|
}; |
|
function _7bd(col) { |
|
if (String(col.width || "").indexOf("%") >= 0) { |
|
return false; |
|
} |
|
if (!col.hidden && !col.checkbox && !col.auto && !col.fixed) { |
|
return true; |
|
} |
|
}; |
|
}; |
|
function _7c5(_7c6, _7c7) { |
|
var _7c8 = $.data(_7c6, "datagrid"); |
|
var opts = _7c8.options; |
|
var dc = _7c8.dc; |
|
var tmp = $("<div class=\"datagrid-cell\" style=\"position:absolute;left:-9999px\"></div>").appendTo("body"); |
|
if (_7c7) { |
|
_71d(_7c7); |
|
$(_7c6).datagrid("fitColumns"); |
|
} else { |
|
var _7c9 = false; |
|
var _7ca = _769(_7c6, true).concat(_769(_7c6, false)); |
|
for (var i = 0; i < _7ca.length; i++) { |
|
var _7c7 = _7ca[i]; |
|
var col = _76a(_7c6, _7c7); |
|
if (col.auto) { |
|
_71d(_7c7); |
|
_7c9 = true; |
|
} |
|
} |
|
if (_7c9) { |
|
$(_7c6).datagrid("fitColumns"); |
|
} |
|
} |
|
tmp.remove(); |
|
function _71d(_7cb) { |
|
var _7cc = dc.view.find("div.datagrid-header td[field=\"" + _7cb + "\"] div.datagrid-cell"); |
|
_7cc.css("width", ""); |
|
var col = $(_7c6).datagrid("getColumnOption", _7cb); |
|
col.width = undefined; |
|
col.boxWidth = undefined; |
|
col.auto = true; |
|
$(_7c6).datagrid("fixColumnSize", _7cb); |
|
var _7cd = Math.max(_7ce("header"), _7ce("allbody"), _7ce("allfooter")) + 1; |
|
_7cc._outerWidth(_7cd - 1); |
|
col.width = _7cd; |
|
col.boxWidth = parseInt(_7cc[0].style.width); |
|
col.deltaWidth = _7cd - col.boxWidth; |
|
_7cc.css("width", ""); |
|
$(_7c6).datagrid("fixColumnSize", _7cb); |
|
opts.onResizeColumn.call(_7c6, _7cb, col.width); |
|
function _7ce(type) { |
|
var _7cf = 0; |
|
if (type == "header") { |
|
_7cf = _7d0(_7cc); |
|
} else { |
|
opts.finder.getTr(_7c6, 0, type).find("td[field=\"" + _7cb + "\"] div.datagrid-cell").each(function () { |
|
var w = _7d0($(this)); |
|
if (_7cf < w) { |
|
_7cf = w; |
|
} |
|
}); |
|
} |
|
return _7cf; |
|
function _7d0(cell) { |
|
return cell.is(":visible") ? cell._outerWidth() : tmp.html(cell.html())._outerWidth(); |
|
}; |
|
}; |
|
}; |
|
}; |
|
function _7d1(_7d2, _7d3) { |
|
var _7d4 = $.data(_7d2, "datagrid"); |
|
var opts = _7d4.options; |
|
var dc = _7d4.dc; |
|
var _7d5 = dc.view.find("table.datagrid-btable,table.datagrid-ftable"); |
|
_7d5.css("table-layout", "fixed"); |
|
if (_7d3) { |
|
fix(_7d3); |
|
} else { |
|
var ff = _769(_7d2, true).concat(_769(_7d2, false)); |
|
for (var i = 0; i < ff.length; i++) { |
|
fix(ff[i]); |
|
} |
|
} |
|
_7d5.css("table-layout", ""); |
|
_7d6(_7d2); |
|
_733(_7d2); |
|
_7d7(_7d2); |
|
function fix(_7d8) { |
|
var col = _76a(_7d2, _7d8); |
|
if (col.cellClass) { |
|
_7d4.ss.set("." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto"); |
|
} |
|
}; |
|
}; |
|
function _7d6(_7d9, tds) { |
|
var dc = $.data(_7d9, "datagrid").dc; |
|
tds = tds || dc.view.find("td.datagrid-td-merged"); |
|
tds.each(function () { |
|
var td = $(this); |
|
var _7da = td.attr("colspan") || 1; |
|
if (_7da > 1) { |
|
var col = _76a(_7d9, td.attr("field")); |
|
var _7db = col.boxWidth + col.deltaWidth - 1; |
|
for (var i = 1; i < _7da; i++) { |
|
td = td.next(); |
|
col = _76a(_7d9, td.attr("field")); |
|
_7db += col.boxWidth + col.deltaWidth; |
|
} |
|
$(this).children("div.datagrid-cell")._outerWidth(_7db); |
|
} |
|
}); |
|
}; |
|
function _7d7(_7dc) { |
|
var dc = $.data(_7dc, "datagrid").dc; |
|
dc.view.find("div.datagrid-editable").each(function () { |
|
var cell = $(this); |
|
var _7dd = cell.parent().attr("field"); |
|
var col = $(_7dc).datagrid("getColumnOption", _7dd); |
|
cell._outerWidth(col.boxWidth + col.deltaWidth - 1); |
|
var ed = $.data(this, "datagrid.editor"); |
|
if (ed.actions.resize) { |
|
ed.actions.resize(ed.target, cell.width()); |
|
} |
|
}); |
|
}; |
|
function _76a(_7de, _7df) { |
|
function find(_7e0) { |
|
if (_7e0) { |
|
for (var i = 0; i < _7e0.length; i++) { |
|
var cc = _7e0[i]; |
|
for (var j = 0; j < cc.length; j++) { |
|
var c = cc[j]; |
|
if (c.field == _7df) { |
|
return c; |
|
} |
|
} |
|
} |
|
} |
|
return null; |
|
}; |
|
var opts = $.data(_7de, "datagrid").options; |
|
var col = find(opts.columns); |
|
if (!col) { |
|
col = find(opts.frozenColumns); |
|
} |
|
return col; |
|
}; |
|
function _7ae(_7e1, _7e2) { |
|
var opts = $.data(_7e1, "datagrid").options; |
|
var _7e3 = _7e2 ? opts.frozenColumns : opts.columns; |
|
var aa = []; |
|
var _7e4 = _7e5(); |
|
for (var i = 0; i < _7e3.length; i++) { |
|
aa[i] = new Array(_7e4); |
|
} |
|
for (var _7e6 = 0; _7e6 < _7e3.length; _7e6++) { |
|
$.map(_7e3[_7e6], function (col) { |
|
var _7e7 = _7e8(aa[_7e6]); |
|
if (_7e7 >= 0) { |
|
var _7e9 = col.field || col.id || ""; |
|
for (var c = 0; c < (col.colspan || 1); c++) { |
|
for (var r = 0; r < (col.rowspan || 1); r++) { |
|
aa[_7e6 + r][_7e7] = _7e9; |
|
} |
|
_7e7++; |
|
} |
|
} |
|
}); |
|
} |
|
return aa; |
|
function _7e5() { |
|
var _7ea = 0; |
|
$.map(_7e3[0] || [], function (col) { |
|
_7ea += col.colspan || 1; |
|
}); |
|
return _7ea; |
|
}; |
|
function _7e8(a) { |
|
for (var i = 0; i < a.length; i++) { |
|
if (a[i] == undefined) { |
|
return i; |
|
} |
|
} |
|
return -1; |
|
}; |
|
}; |
|
function _769(_7eb, _7ec) { |
|
var aa = _7ae(_7eb, _7ec); |
|
return aa.length ? aa[aa.length - 1] : aa; |
|
}; |
|
function _7a7(_7ed, data) { |
|
var _7ee = $.data(_7ed, "datagrid"); |
|
var opts = _7ee.options; |
|
var dc = _7ee.dc; |
|
data = opts.loadFilter.call(_7ed, data); |
|
if ($.isArray(data)) { |
|
data = { |
|
total: data.length, |
|
rows: data |
|
}; |
|
} |
|
data.total = parseInt(data.total); |
|
_7ee.data = data; |
|
if (data.footer) { |
|
_7ee.footer = data.footer; |
|
} |
|
if (!opts.remoteSort && opts.sortName) { |
|
var _7ef = opts.sortName.split(","); |
|
var _7f0 = opts.sortOrder.split(","); |
|
data.rows.sort(function (r1, r2) { |
|
var r = 0; |
|
for (var i = 0; i < _7ef.length; i++) { |
|
var sn = _7ef[i]; |
|
var so = _7f0[i]; |
|
var col = _76a(_7ed, sn); |
|
var _7f1 = col.sorter || function (a, b) { |
|
return a == b ? 0 : (a > b ? 1 : -1); |
|
}; |
|
r = _7f1(r1[sn], r2[sn], r1, r2) * (so == "asc" ? 1 : -1); |
|
if (r != 0) { |
|
return r; |
|
} |
|
} |
|
return r; |
|
}); |
|
} |
|
if (opts.view.onBeforeRender) { |
|
opts.view.onBeforeRender.call(opts.view, _7ed, data.rows); |
|
} |
|
opts.view.render.call(opts.view, _7ed, dc.body2, false); |
|
opts.view.render.call(opts.view, _7ed, dc.body1, true); |
|
if (opts.showFooter) { |
|
opts.view.renderFooter.call(opts.view, _7ed, dc.footer2, false); |
|
opts.view.renderFooter.call(opts.view, _7ed, dc.footer1, true); |
|
} |
|
if (opts.view.onAfterRender) { |
|
opts.view.onAfterRender.call(opts.view, _7ed); |
|
} |
|
_7ee.ss.clean(); |
|
var _7f2 = $(_7ed).datagrid("getPager"); |
|
if (_7f2.length) { |
|
var _7f3 = _7f2.pagination("options"); |
|
if (_7f3.total != data.total) { |
|
_7f2.pagination("refresh", { |
|
pageNumber: opts.pageNumber, |
|
total: data.total |
|
}); |
|
if (opts.pageNumber != _7f3.pageNumber && _7f3.pageNumber > 0) { |
|
opts.pageNumber = _7f3.pageNumber; |
|
_7a6(_7ed); |
|
} |
|
} |
|
} |
|
_733(_7ed); |
|
dc.body2.triggerHandler("scroll"); |
|
$(_7ed).datagrid("setSelectionState"); |
|
$(_7ed).datagrid("autoSizeColumn"); |
|
opts.onLoadSuccess.call(_7ed, data); |
|
}; |
|
function _7f4(_7f5) { |
|
var _7f6 = $.data(_7f5, "datagrid"); |
|
var opts = _7f6.options; |
|
var dc = _7f6.dc; |
|
dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked", false); |
|
if (opts.idField) { |
|
var _7f7 = $.data(_7f5, "treegrid") ? true : false; |
|
var _7f8 = opts.onSelect; |
|
var _7f9 = opts.onCheck; |
|
opts.onSelect = opts.onCheck = function () {}; |
|
var rows = opts.finder.getRows(_7f5); |
|
for (var i = 0; i < rows.length; i++) { |
|
var row = rows[i]; |
|
var _7fa = _7f7 ? row[opts.idField] : $(_7f5).datagrid("getRowIndex", row[opts.idField]); |
|
if (_7fb(_7f6.selectedRows, row)) { |
|
_790(_7f5, _7fa, true, true); |
|
} |
|
if (_7fb(_7f6.checkedRows, row)) { |
|
_78d(_7f5, _7fa, true); |
|
} |
|
} |
|
opts.onSelect = _7f8; |
|
opts.onCheck = _7f9; |
|
} |
|
function _7fb(a, r) { |
|
for (var i = 0; i < a.length; i++) { |
|
if (a[i][opts.idField] == r[opts.idField]) { |
|
a[i] = r; |
|
return true; |
|
} |
|
} |
|
return false; |
|
}; |
|
}; |
|
function _7fc(_7fd, row) { |
|
var _7fe = $.data(_7fd, "datagrid"); |
|
var opts = _7fe.options; |
|
var rows = _7fe.data.rows; |
|
if (typeof row == "object") { |
|
return _709(rows, row); |
|
} else { |
|
for (var i = 0; i < rows.length; i++) { |
|
if (rows[i][opts.idField] == row) { |
|
return i; |
|
} |
|
} |
|
return -1; |
|
} |
|
}; |
|
function _7ff(_800) { |
|
var _801 = $.data(_800, "datagrid"); |
|
var opts = _801.options; |
|
var data = _801.data; |
|
if (opts.idField) { |
|
return _801.selectedRows; |
|
} else { |
|
var rows = []; |
|
opts.finder.getTr(_800, "", "selected", 2).each(function () { |
|
rows.push(opts.finder.getRow(_800, $(this))); |
|
}); |
|
return rows; |
|
} |
|
}; |
|
function _802(_803) { |
|
var _804 = $.data(_803, "datagrid"); |
|
var opts = _804.options; |
|
if (opts.idField) { |
|
return _804.checkedRows; |
|
} else { |
|
var rows = []; |
|
opts.finder.getTr(_803, "", "checked", 2).each(function () { |
|
rows.push(opts.finder.getRow(_803, $(this))); |
|
}); |
|
return rows; |
|
} |
|
}; |
|
function _805(_806, _807) { |
|
var _808 = $.data(_806, "datagrid"); |
|
var dc = _808.dc; |
|
var opts = _808.options; |
|
var tr = opts.finder.getTr(_806, _807); |
|
if (tr.length) { |
|
if (tr.closest("table").hasClass("datagrid-btable-frozen")) { |
|
return; |
|
} |
|
var _809 = dc.view2.children("div.datagrid-header")._outerHeight(); |
|
var _80a = dc.body2; |
|
var _80b = opts.scrollbarSize; |
|
if (_80a[0].offsetHeight && _80a[0].clientHeight && _80a[0].offsetHeight <= _80a[0].clientHeight) { |
|
_80b = 0; |
|
} |
|
var _80c = _80a.outerHeight(true) - _80a.outerHeight(); |
|
var top = tr.offset().top - dc.view2.offset().top - _809 - _80c; |
|
if (top < 0) { |
|
_80a.scrollTop(_80a.scrollTop() + top); |
|
} else { |
|
if (top + tr._outerHeight() > _80a.height() - _80b) { |
|
_80a.scrollTop(_80a.scrollTop() + top + tr._outerHeight() - _80a.height() + _80b); |
|
} |
|
} |
|
} |
|
}; |
|
function _789(_80d, _80e) { |
|
var _80f = $.data(_80d, "datagrid"); |
|
var opts = _80f.options; |
|
opts.finder.getTr(_80d, _80f.highlightIndex).removeClass("datagrid-row-over"); |
|
opts.finder.getTr(_80d, _80e).addClass("datagrid-row-over"); |
|
_80f.highlightIndex = _80e; |
|
}; |
|
function _790(_810, _811, _812, _813) { |
|
var _814 = $.data(_810, "datagrid"); |
|
var opts = _814.options; |
|
var row = opts.finder.getRow(_810, _811); |
|
if (!row) { |
|
return; |
|
} |
|
if (opts.onBeforeSelect.apply(_810, _70c(_810, [_811, row])) == false) { |
|
return; |
|
} |
|
if (opts.singleSelect) { |
|
_815(_810, true); |
|
_814.selectedRows = []; |
|
} |
|
if (!_812 && opts.checkOnSelect) { |
|
_78d(_810, _811, true); |
|
} |
|
if (opts.idField) { |
|
_70b(_814.selectedRows, opts.idField, row); |
|
} |
|
opts.finder.getTr(_810, _811).addClass("datagrid-row-selected"); |
|
opts.onSelect.apply(_810, _70c(_810, [_811, row])); |
|
if (!_813 && opts.scrollOnSelect) { |
|
_805(_810, _811); |
|
} |
|
}; |
|
function _791(_816, _817, _818) { |
|
var _819 = $.data(_816, "datagrid"); |
|
var dc = _819.dc; |
|
var opts = _819.options; |
|
var row = opts.finder.getRow(_816, _817); |
|
if (!row) { |
|
return; |
|
} |
|
if (opts.onBeforeUnselect.apply(_816, _70c(_816, [_817, row])) == false) { |
|
return; |
|
} |
|
if (!_818 && opts.checkOnSelect) { |
|
_78e(_816, _817, true); |
|
} |
|
opts.finder.getTr(_816, _817).removeClass("datagrid-row-selected"); |
|
if (opts.idField) { |
|
_70a(_819.selectedRows, opts.idField, row[opts.idField]); |
|
} |
|
opts.onUnselect.apply(_816, _70c(_816, [_817, row])); |
|
}; |
|
function _81a(_81b, _81c) { |
|
var _81d = $.data(_81b, "datagrid"); |
|
var opts = _81d.options; |
|
var rows = opts.finder.getRows(_81b); |
|
var _81e = $.data(_81b, "datagrid").selectedRows; |
|
if (!_81c && opts.checkOnSelect) { |
|
_77b(_81b, true); |
|
} |
|
opts.finder.getTr(_81b, "", "allbody").addClass("datagrid-row-selected"); |
|
if (opts.idField) { |
|
for (var _81f = 0; _81f < rows.length; _81f++) { |
|
_70b(_81e, opts.idField, rows[_81f]); |
|
} |
|
} |
|
opts.onSelectAll.call(_81b, rows); |
|
}; |
|
function _815(_820, _821) { |
|
var _822 = $.data(_820, "datagrid"); |
|
var opts = _822.options; |
|
var rows = opts.finder.getRows(_820); |
|
var _823 = $.data(_820, "datagrid").selectedRows; |
|
if (!_821 && opts.checkOnSelect) { |
|
_77c(_820, true); |
|
} |
|
opts.finder.getTr(_820, "", "selected").removeClass("datagrid-row-selected"); |
|
if (opts.idField) { |
|
for (var _824 = 0; _824 < rows.length; _824++) { |
|
_70a(_823, opts.idField, rows[_824][opts.idField]); |
|
} |
|
} |
|
opts.onUnselectAll.call(_820, rows); |
|
}; |
|
function _78d(_825, _826, _827) { |
|
var _828 = $.data(_825, "datagrid"); |
|
var opts = _828.options; |
|
var row = opts.finder.getRow(_825, _826); |
|
if (!row) { |
|
return; |
|
} |
|
if (opts.onBeforeCheck.apply(_825, _70c(_825, [_826, row])) == false) { |
|
return; |
|
} |
|
if (opts.singleSelect && opts.selectOnCheck) { |
|
_77c(_825, true); |
|
_828.checkedRows = []; |
|
} |
|
if (!_827 && opts.selectOnCheck) { |
|
_790(_825, _826, true); |
|
} |
|
var tr = opts.finder.getTr(_825, _826).addClass("datagrid-row-checked"); |
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true); |
|
tr = opts.finder.getTr(_825, "", "checked", 2); |
|
if (tr.length == opts.finder.getRows(_825).length) { |
|
var dc = _828.dc; |
|
dc.header1.add(dc.header2).find("input[type=checkbox]")._propAttr("checked", true); |
|
} |
|
if (opts.idField) { |
|
_70b(_828.checkedRows, opts.idField, row); |
|
} |
|
opts.onCheck.apply(_825, _70c(_825, [_826, row])); |
|
}; |
|
function _78e(_829, _82a, _82b) { |
|
var _82c = $.data(_829, "datagrid"); |
|
var opts = _82c.options; |
|
var row = opts.finder.getRow(_829, _82a); |
|
if (!row) { |
|
return; |
|
} |
|
if (opts.onBeforeUncheck.apply(_829, _70c(_829, [_82a, row])) == false) { |
|
return; |
|
} |
|
if (!_82b && opts.selectOnCheck) { |
|
_791(_829, _82a, true); |
|
} |
|
var tr = opts.finder.getTr(_829, _82a).removeClass("datagrid-row-checked"); |
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", false); |
|
var dc = _82c.dc; |
|
var _82d = dc.header1.add(dc.header2); |
|
_82d.find("input[type=checkbox]")._propAttr("checked", false); |
|
if (opts.idField) { |
|
_70a(_82c.checkedRows, opts.idField, row[opts.idField]); |
|
} |
|
opts.onUncheck.apply(_829, _70c(_829, [_82a, row])); |
|
}; |
|
function _77b(_82e, _82f) { |
|
var _830 = $.data(_82e, "datagrid"); |
|
var opts = _830.options; |
|
var rows = opts.finder.getRows(_82e); |
|
if (!_82f && opts.selectOnCheck) { |
|
_81a(_82e, true); |
|
} |
|
var dc = _830.dc; |
|
var hck = dc.header1.add(dc.header2).find("input[type=checkbox]"); |
|
var bck = opts.finder.getTr(_82e, "", "allbody").addClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]"); |
|
hck.add(bck)._propAttr("checked", true); |
|
if (opts.idField) { |
|
for (var i = 0; i < rows.length; i++) { |
|
_70b(_830.checkedRows, opts.idField, rows[i]); |
|
} |
|
} |
|
opts.onCheckAll.call(_82e, rows); |
|
}; |
|
function _77c(_831, _832) { |
|
var _833 = $.data(_831, "datagrid"); |
|
var opts = _833.options; |
|
var rows = opts.finder.getRows(_831); |
|
if (!_832 && opts.selectOnCheck) { |
|
_815(_831, true); |
|
} |
|
var dc = _833.dc; |
|
var hck = dc.header1.add(dc.header2).find("input[type=checkbox]"); |
|
var bck = opts.finder.getTr(_831, "", "checked").removeClass("datagrid-row-checked").find("div.datagrid-cell-check input[type=checkbox]"); |
|
hck.add(bck)._propAttr("checked", false); |
|
if (opts.idField) { |
|
for (var i = 0; i < rows.length; i++) { |
|
_70a(_833.checkedRows, opts.idField, rows[i][opts.idField]); |
|
} |
|
} |
|
opts.onUncheckAll.call(_831, rows); |
|
}; |
|
function _834(_835, _836) { |
|
var opts = $.data(_835, "datagrid").options; |
|
var tr = opts.finder.getTr(_835, _836); |
|
var row = opts.finder.getRow(_835, _836); |
|
if (tr.hasClass("datagrid-row-editing")) { |
|
return; |
|
} |
|
if (opts.onBeforeEdit.apply(_835, _70c(_835, [_836, row])) == false) { |
|
return; |
|
} |
|
tr.addClass("datagrid-row-editing"); |
|
_837(_835, _836); |
|
_7d7(_835); |
|
tr.find("div.datagrid-editable").each(function () { |
|
var _838 = $(this).parent().attr("field"); |
|
var ed = $.data(this, "datagrid.editor"); |
|
ed.actions.setValue(ed.target, row[_838]); |
|
}); |
|
_839(_835, _836); |
|
opts.onBeginEdit.apply(_835, _70c(_835, [_836, row])); |
|
}; |
|
function _83a(_83b, _83c, _83d) { |
|
var _83e = $.data(_83b, "datagrid"); |
|
var opts = _83e.options; |
|
var _83f = _83e.updatedRows; |
|
var _840 = _83e.insertedRows; |
|
var tr = opts.finder.getTr(_83b, _83c); |
|
var row = opts.finder.getRow(_83b, _83c); |
|
if (!tr.hasClass("datagrid-row-editing")) { |
|
return; |
|
} |
|
if (!_83d) { |
|
if (!_839(_83b, _83c)) { |
|
return; |
|
} |
|
var _841 = false; |
|
var _842 = {}; |
|
tr.find("div.datagrid-editable").each(function () { |
|
var _843 = $(this).parent().attr("field"); |
|
var ed = $.data(this, "datagrid.editor"); |
|
var t = $(ed.target); |
|
var _844 = t.data("textbox") ? t.textbox("textbox") : t; |
|
if (_844.is(":focus")) { |
|
_844.triggerHandler("blur"); |
|
} |
|
var _845 = ed.actions.getValue(ed.target); |
|
if (row[_843] !== _845) { |
|
row[_843] = _845; |
|
_841 = true; |
|
_842[_843] = _845; |
|
} |
|
}); |
|
if (_841) { |
|
if (_709(_840, row) == -1) { |
|
if (_709(_83f, row) == -1) { |
|
_83f.push(row); |
|
} |
|
} |
|
} |
|
opts.onEndEdit.apply(_83b, _70c(_83b, [_83c, row, _842])); |
|
} |
|
tr.removeClass("datagrid-row-editing"); |
|
_846(_83b, _83c); |
|
$(_83b).datagrid("refreshRow", _83c); |
|
if (!_83d) { |
|
opts.onAfterEdit.apply(_83b, _70c(_83b, [_83c, row, _842])); |
|
} else { |
|
opts.onCancelEdit.apply(_83b, _70c(_83b, [_83c, row])); |
|
} |
|
}; |
|
function _847(_848, _849) { |
|
var opts = $.data(_848, "datagrid").options; |
|
var tr = opts.finder.getTr(_848, _849); |
|
var _84a = []; |
|
tr.children("td").each(function () { |
|
var cell = $(this).find("div.datagrid-editable"); |
|
if (cell.length) { |
|
var ed = $.data(cell[0], "datagrid.editor"); |
|
_84a.push(ed); |
|
} |
|
}); |
|
return _84a; |
|
}; |
|
function _84b(_84c, _84d) { |
|
var _84e = _847(_84c, _84d.index != undefined ? _84d.index : _84d.id); |
|
for (var i = 0; i < _84e.length; i++) { |
|
if (_84e[i].field == _84d.field) { |
|
return _84e[i]; |
|
} |
|
} |
|
return null; |
|
}; |
|
function _837(_84f, _850) { |
|
var opts = $.data(_84f, "datagrid").options; |
|
var tr = opts.finder.getTr(_84f, _850); |
|
tr.children("td").each(function () { |
|
var cell = $(this).find("div.datagrid-cell"); |
|
var _851 = $(this).attr("field"); |
|
var col = _76a(_84f, _851); |
|
if (col && col.editor) { |
|
var _852, |
|
_853; |
|
if (typeof col.editor == "string") { |
|
_852 = col.editor; |
|
} else { |
|
_852 = col.editor.type; |
|
_853 = col.editor.options; |
|
} |
|
var _854 = opts.editors[_852]; |
|
if (_854) { |
|
var _855 = cell.html(); |
|
var _856 = cell._outerWidth(); |
|
cell.addClass("datagrid-editable"); |
|
cell._outerWidth(_856); |
|
cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>"); |
|
cell.children("table")._bind("click dblclick contextmenu", function (e) { |
|
e.stopPropagation(); |
|
}); |
|
$.data(cell[0], "datagrid.editor", { |
|
actions: _854, |
|
target: _854.init(cell.find("td"), $.extend({ |
|
height: opts.editorHeight |
|
}, _853)), |
|
field: _851, |
|
type: _852, |
|
oldHtml: _855 |
|
}); |
|
} |
|
} |
|
}); |
|
_733(_84f, _850, true); |
|
}; |
|
function _846(_857, _858) { |
|
var opts = $.data(_857, "datagrid").options; |
|
var tr = opts.finder.getTr(_857, _858); |
|
tr.children("td").each(function () { |
|
var cell = $(this).find("div.datagrid-editable"); |
|
if (cell.length) { |
|
var ed = $.data(cell[0], "datagrid.editor"); |
|
if (ed.actions.destroy) { |
|
ed.actions.destroy(ed.target); |
|
} |
|
cell.html(ed.oldHtml); |
|
$.removeData(cell[0], "datagrid.editor"); |
|
cell.removeClass("datagrid-editable"); |
|
cell.css("width", ""); |
|
} |
|
}); |
|
}; |
|
function _839(_859, _85a) { |
|
var tr = $.data(_859, "datagrid").options.finder.getTr(_859, _85a); |
|
if (!tr.hasClass("datagrid-row-editing")) { |
|
return true; |
|
} |
|
var vbox = tr.find(".validatebox-text"); |
|
vbox.validatebox("validate"); |
|
vbox.trigger("mouseleave"); |
|
var _85b = tr.find(".validatebox-invalid"); |
|
return _85b.length == 0; |
|
}; |
|
function _85c(_85d, _85e) { |
|
var _85f = $.data(_85d, "datagrid").insertedRows; |
|
var _860 = $.data(_85d, "datagrid").deletedRows; |
|
var _861 = $.data(_85d, "datagrid").updatedRows; |
|
if (!_85e) { |
|
var rows = []; |
|
rows = rows.concat(_85f); |
|
rows = rows.concat(_860); |
|
rows = rows.concat(_861); |
|
return rows; |
|
} else { |
|
if (_85e == "inserted") { |
|
return _85f; |
|
} else { |
|
if (_85e == "deleted") { |
|
return _860; |
|
} else { |
|
if (_85e == "updated") { |
|
return _861; |
|
} |
|
} |
|
} |
|
} |
|
return []; |
|
}; |
|
function _862(_863, _864) { |
|
var _865 = $.data(_863, "datagrid"); |
|
var opts = _865.options; |
|
var data = _865.data; |
|
var _866 = _865.insertedRows; |
|
var _867 = _865.deletedRows; |
|
$(_863).datagrid("cancelEdit", _864); |
|
var row = opts.finder.getRow(_863, _864); |
|
if (_709(_866, row) >= 0) { |
|
_70a(_866, row); |
|
} else { |
|
_867.push(row); |
|
} |
|
_70a(_865.selectedRows, opts.idField, row[opts.idField]); |
|
_70a(_865.checkedRows, opts.idField, row[opts.idField]); |
|
opts.view.deleteRow.call(opts.view, _863, _864); |
|
if (opts.height == "auto") { |
|
_733(_863); |
|
} |
|
$(_863).datagrid("getPager").pagination("refresh", { |
|
total: data.total |
|
}); |
|
}; |
|
function _868(_869, _86a) { |
|
var data = $.data(_869, "datagrid").data; |
|
var view = $.data(_869, "datagrid").options.view; |
|
var _86b = $.data(_869, "datagrid").insertedRows; |
|
view.insertRow.call(view, _869, _86a.index, _86a.row); |
|
_86b.push(_86a.row); |
|
$(_869).datagrid("getPager").pagination("refresh", { |
|
total: data.total |
|
}); |
|
}; |
|
function _86c(_86d, row) { |
|
var data = $.data(_86d, "datagrid").data; |
|
var view = $.data(_86d, "datagrid").options.view; |
|
var _86e = $.data(_86d, "datagrid").insertedRows; |
|
view.insertRow.call(view, _86d, null, row); |
|
_86e.push(row); |
|
$(_86d).datagrid("getPager").pagination("refresh", { |
|
total: data.total |
|
}); |
|
}; |
|
function _86f(_870, _871) { |
|
var _872 = $.data(_870, "datagrid"); |
|
var opts = _872.options; |
|
var row = opts.finder.getRow(_870, _871.index); |
|
var _873 = false; |
|
_871.row = _871.row || {}; |
|
for (var _874 in _871.row) { |
|
if (row[_874] !== _871.row[_874]) { |
|
_873 = true; |
|
break; |
|
} |
|
} |
|
if (_873) { |
|
if (_709(_872.insertedRows, row) == -1) { |
|
if (_709(_872.updatedRows, row) == -1) { |
|
_872.updatedRows.push(row); |
|
} |
|
} |
|
opts.view.updateRow.call(opts.view, _870, _871.index, _871.row); |
|
} |
|
}; |
|
function _875(_876) { |
|
var _877 = $.data(_876, "datagrid"); |
|
var data = _877.data; |
|
var rows = data.rows; |
|
var _878 = []; |
|
for (var i = 0; i < rows.length; i++) { |
|
_878.push($.extend({}, rows[i])); |
|
} |
|
_877.originalRows = _878; |
|
_877.updatedRows = []; |
|
_877.insertedRows = []; |
|
_877.deletedRows = []; |
|
}; |
|
function _879(_87a) { |
|
var data = $.data(_87a, "datagrid").data; |
|
var ok = true; |
|
for (var i = 0, len = data.rows.length; i < len; i++) { |
|
if (_839(_87a, i)) { |
|
$(_87a).datagrid("endEdit", i); |
|
} else { |
|
ok = false; |
|
} |
|
} |
|
if (ok) { |
|
_875(_87a); |
|
} |
|
}; |
|
function _87b(_87c) { |
|
var _87d = $.data(_87c, "datagrid"); |
|
var opts = _87d.options; |
|
var _87e = _87d.originalRows; |
|
var _87f = _87d.insertedRows; |
|
var _880 = _87d.deletedRows; |
|
var _881 = _87d.selectedRows; |
|
var _882 = _87d.checkedRows; |
|
var data = _87d.data; |
|
function _883(a) { |
|
var ids = []; |
|
for (var i = 0; i < a.length; i++) { |
|
ids.push(a[i][opts.idField]); |
|
} |
|
return ids; |
|
}; |
|
function _884(ids, _885) { |
|
for (var i = 0; i < ids.length; i++) { |
|
var _886 = _7fc(_87c, ids[i]); |
|
if (_886 >= 0) { |
|
(_885 == "s" ? _790 : _78d)(_87c, _886, true); |
|
} |
|
} |
|
}; |
|
for (var i = 0; i < data.rows.length; i++) { |
|
$(_87c).datagrid("cancelEdit", i); |
|
} |
|
var _887 = _883(_881); |
|
var _888 = _883(_882); |
|
_881.splice(0, _881.length); |
|
_882.splice(0, _882.length); |
|
data.total += _880.length - _87f.length; |
|
data.rows = _87e; |
|
_7a7(_87c, data); |
|
_884(_887, "s"); |
|
_884(_888, "c"); |
|
_875(_87c); |
|
}; |
|
function _7a6(_889, _88a, cb) { |
|
var opts = $.data(_889, "datagrid").options; |
|
if (_88a) { |
|
opts.queryParams = _88a; |
|
} |
|
var _88b = $.extend({}, opts.queryParams); |
|
if (opts.pagination) { |
|
$.extend(_88b, { |
|
page: opts.pageNumber || 1, |
|
rows: opts.pageSize |
|
}); |
|
} |
|
if (opts.sortName && opts.remoteSort) { |
|
$.extend(_88b, { |
|
sort: opts.sortName, |
|
order: opts.sortOrder |
|
}); |
|
} |
|
if (opts.onBeforeLoad.call(_889, _88b) == false) { |
|
opts.view.setEmptyMsg(_889); |
|
return; |
|
} |
|
$(_889).datagrid("loading"); |
|
var _88c = opts.loader.call(_889, _88b, function (data) { |
|
$(_889).datagrid("loaded"); |
|
$(_889).datagrid("loadData", data); |
|
if (cb) { |
|
cb(); |
|
} |
|
}, function () { |
|
$(_889).datagrid("loaded"); |
|
opts.onLoadError.apply(_889, arguments); |
|
}); |
|
if (_88c == false) { |
|
$(_889).datagrid("loaded"); |
|
opts.view.setEmptyMsg(_889); |
|
} |
|
}; |
|
function _88d(_88e, _88f) { |
|
var opts = $.data(_88e, "datagrid").options; |
|
_88f.type = _88f.type || "body"; |
|
_88f.rowspan = _88f.rowspan || 1; |
|
_88f.colspan = _88f.colspan || 1; |
|
if (_88f.rowspan == 1 && _88f.colspan == 1) { |
|
return; |
|
} |
|
var tr = opts.finder.getTr(_88e, (_88f.index != undefined ? _88f.index : _88f.id), _88f.type); |
|
if (!tr.length) { |
|
return; |
|
} |
|
var td = tr.find("td[field=\"" + _88f.field + "\"]"); |
|
td.attr("rowspan", _88f.rowspan).attr("colspan", _88f.colspan); |
|
td.addClass("datagrid-td-merged"); |
|
_890(td.next(), _88f.colspan - 1); |
|
for (var i = 1; i < _88f.rowspan; i++) { |
|
tr = tr.next(); |
|
if (!tr.length) { |
|
break; |
|
} |
|
_890(tr.find("td[field=\"" + _88f.field + "\"]"), _88f.colspan); |
|
} |
|
_7d6(_88e, td); |
|
function _890(td, _891) { |
|
for (var i = 0; i < _891; i++) { |
|
td.hide(); |
|
td = td.next(); |
|
} |
|
}; |
|
}; |
|
$.fn.datagrid = function (_892, _893) { |
|
if (typeof _892 == "string") { |
|
return $.fn.datagrid.methods[_892](this, _893); |
|
} |
|
_892 = _892 || {}; |
|
return this.each(function () { |
|
var _894 = $.data(this, "datagrid"); |
|
var opts; |
|
if (_894) { |
|
opts = $.extend(_894.options, _892); |
|
_894.options = opts; |
|
} else { |
|
opts = $.extend({}, $.extend({}, $.fn.datagrid.defaults, { |
|
queryParams: {} |
|
}), $.fn.datagrid.parseOptions(this), _892); |
|
$(this).css("width", "").css("height", ""); |
|
var _895 = _748(this, opts.rownumbers); |
|
if (!opts.columns) { |
|
opts.columns = _895.columns; |
|
} |
|
if (!opts.frozenColumns) { |
|
opts.frozenColumns = _895.frozenColumns; |
|
} |
|
opts.columns = $.extend(true, [], opts.columns); |
|
opts.frozenColumns = $.extend(true, [], opts.frozenColumns); |
|
opts.view = $.extend({}, opts.view); |
|
$.data(this, "datagrid", { |
|
options: opts, |
|
panel: _895.panel, |
|
dc: _895.dc, |
|
ss: null, |
|
selectedRows: [], |
|
checkedRows: [], |
|
data: { |
|
total: 0, |
|
rows: [] |
|
}, |
|
originalRows: [], |
|
updatedRows: [], |
|
insertedRows: [], |
|
deletedRows: [] |
|
}); |
|
} |
|
_751(this); |
|
_76b(this); |
|
_71d(this); |
|
if (opts.data) { |
|
$(this).datagrid("loadData", opts.data); |
|
} else { |
|
var data = $.fn.datagrid.parseData(this); |
|
if (data.total > 0) { |
|
$(this).datagrid("loadData", data); |
|
} else { |
|
$(this).datagrid("autoSizeColumn"); |
|
} |
|
} |
|
_7a6(this); |
|
}); |
|
}; |
|
function _896(_897) { |
|
var _898 = {}; |
|
$.map(_897, function (name) { |
|
_898[name] = _899(name); |
|
}); |
|
return _898; |
|
function _899(name) { |
|
function isA(_89a) { |
|
return $.data($(_89a)[0], name) != undefined; |
|
}; |
|
return { |
|
init: function (_89b, _89c) { |
|
var _89d = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_89b); |
|
if (_89d[name] && name != "text") { |
|
return _89d[name](_89c); |
|
} else { |
|
return _89d; |
|
} |
|
}, |
|
destroy: function (_89e) { |
|
if (isA(_89e, name)) { |
|
$(_89e)[name]("destroy"); |
|
} |
|
}, |
|
getValue: function (_89f) { |
|
if (isA(_89f, name)) { |
|
var opts = $(_89f)[name]("options"); |
|
if (opts.multiple) { |
|
return $(_89f)[name]("getValues").join(opts.separator); |
|
} else { |
|
return $(_89f)[name]("getValue"); |
|
} |
|
} else { |
|
return $(_89f).val(); |
|
} |
|
}, |
|
setValue: function (_8a0, _8a1) { |
|
if (isA(_8a0, name)) { |
|
var opts = $(_8a0)[name]("options"); |
|
if (opts.multiple) { |
|
if (_8a1) { |
|
$(_8a0)[name]("setValues", _8a1.split(opts.separator)); |
|
} else { |
|
$(_8a0)[name]("clear"); |
|
} |
|
} else { |
|
$(_8a0)[name]("setValue", _8a1); |
|
} |
|
} else { |
|
$(_8a0).val(_8a1); |
|
} |
|
}, |
|
resize: function (_8a2, _8a3) { |
|
if (isA(_8a2, name)) { |
|
$(_8a2)[name]("resize", _8a3); |
|
} else { |
|
$(_8a2)._size({ |
|
width: _8a3, |
|
height: $.fn.datagrid.defaults.editorHeight |
|
}); |
|
} |
|
} |
|
}; |
|
}; |
|
}; |
|
var _8a4 = $.extend({}, _896(["text", "textbox", "passwordbox", "filebox", "numberbox", "numberspinner", "combobox", "combotree", "combogrid", "combotreegrid", "datebox", "datetimebox", "timespinner", "datetimespinner"]), { |
|
textarea: { |
|
init: function (_8a5, _8a6) { |
|
var _8a7 = $("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_8a5); |
|
_8a7.css("vertical-align", "middle")._outerHeight(_8a6.height); |
|
return _8a7; |
|
}, |
|
getValue: function (_8a8) { |
|
return $(_8a8).val(); |
|
}, |
|
setValue: function (_8a9, _8aa) { |
|
$(_8a9).val(_8aa); |
|
}, |
|
resize: function (_8ab, _8ac) { |
|
$(_8ab)._outerWidth(_8ac); |
|
} |
|
}, |
|
checkbox: { |
|
init: function (_8ad, _8ae) { |
|
var _8af = $("<input type=\"checkbox\">").appendTo(_8ad); |
|
_8af.val(_8ae.on); |
|
_8af.attr("offval", _8ae.off); |
|
return _8af; |
|
}, |
|
getValue: function (_8b0) { |
|
if ($(_8b0).is(":checked")) { |
|
return $(_8b0).val(); |
|
} else { |
|
return $(_8b0).attr("offval"); |
|
} |
|
}, |
|
setValue: function (_8b1, _8b2) { |
|
var _8b3 = false; |
|
if ($(_8b1).val() == _8b2) { |
|
_8b3 = true; |
|
} |
|
$(_8b1)._propAttr("checked", _8b3); |
|
} |
|
}, |
|
validatebox: { |
|
init: function (_8b4, _8b5) { |
|
var _8b6 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_8b4); |
|
_8b6.validatebox(_8b5); |
|
return _8b6; |
|
}, |
|
destroy: function (_8b7) { |
|
$(_8b7).validatebox("destroy"); |
|
}, |
|
getValue: function (_8b8) { |
|
return $(_8b8).val(); |
|
}, |
|
setValue: function (_8b9, _8ba) { |
|
$(_8b9).val(_8ba); |
|
}, |
|
resize: function (_8bb, _8bc) { |
|
$(_8bb)._outerWidth(_8bc)._outerHeight($.fn.datagrid.defaults.editorHeight); |
|
} |
|
} |
|
}); |
|
$.fn.datagrid.methods = { |
|
options: function (jq) { |
|
var _8bd = $.data(jq[0], "datagrid").options; |
|
var _8be = $.data(jq[0], "datagrid").panel.panel("options"); |
|
var opts = $.extend(_8bd, { |
|
width: _8be.width, |
|
height: _8be.height, |
|
closed: _8be.closed, |
|
collapsed: _8be.collapsed, |
|
minimized: _8be.minimized, |
|
maximized: _8be.maximized |
|
}); |
|
return opts; |
|
}, |
|
setSelectionState: function (jq) { |
|
return jq.each(function () { |
|
_7f4(this); |
|
}); |
|
}, |
|
createStyleSheet: function (jq) { |
|
return _70e(jq[0]); |
|
}, |
|
getPanel: function (jq) { |
|
return $.data(jq[0], "datagrid").panel; |
|
}, |
|
getPager: function (jq) { |
|
return $.data(jq[0], "datagrid").panel.children("div.datagrid-pager"); |
|
}, |
|
getColumnFields: function (jq, _8bf) { |
|
return _769(jq[0], _8bf); |
|
}, |
|
getColumnOption: function (jq, _8c0) { |
|
return _76a(jq[0], _8c0); |
|
}, |
|
resize: function (jq, _8c1) { |
|
return jq.each(function () { |
|
_71d(this, _8c1); |
|
}); |
|
}, |
|
load: function (jq, _8c2) { |
|
return jq.each(function () { |
|
var opts = $(this).datagrid("options"); |
|
if (typeof _8c2 == "string") { |
|
opts.url = _8c2; |
|
_8c2 = null; |
|
} |
|
opts.pageNumber = 1; |
|
var _8c3 = $(this).datagrid("getPager"); |
|
_8c3.pagination("refresh", { |
|
pageNumber: 1 |
|
}); |
|
_7a6(this, _8c2); |
|
}); |
|
}, |
|
reload: function (jq, _8c4) { |
|
return jq.each(function () { |
|
var opts = $(this).datagrid("options"); |
|
if (typeof _8c4 == "string") { |
|
opts.url = _8c4; |
|
_8c4 = null; |
|
} |
|
_7a6(this, _8c4); |
|
}); |
|
}, |
|
reloadFooter: function (jq, _8c5) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "datagrid").options; |
|
var dc = $.data(this, "datagrid").dc; |
|
if (_8c5) { |
|
$.data(this, "datagrid").footer = _8c5; |
|
} |
|
if (opts.showFooter) { |
|
opts.view.renderFooter.call(opts.view, this, dc.footer2, false); |
|
opts.view.renderFooter.call(opts.view, this, dc.footer1, true); |
|
if (opts.view.onAfterRender) { |
|
opts.view.onAfterRender.call(opts.view, this); |
|
} |
|
$(this).datagrid("fixRowHeight"); |
|
} |
|
}); |
|
}, |
|
loading: function (jq) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "datagrid").options; |
|
$(this).datagrid("getPager").pagination("loading"); |
|
if (opts.loadMsg) { |
|
var _8c6 = $(this).datagrid("getPanel"); |
|
if (!_8c6.children("div.datagrid-mask").length) { |
|
$("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_8c6); |
|
var msg = $("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_8c6); |
|
msg._outerHeight(40); |
|
msg.css({ |
|
marginLeft: (-msg.outerWidth() / 2), |
|
lineHeight: (msg.height() + "px") |
|
}); |
|
} |
|
} |
|
}); |
|
}, |
|
loaded: function (jq) { |
|
return jq.each(function () { |
|
$(this).datagrid("getPager").pagination("loaded"); |
|
var _8c7 = $(this).datagrid("getPanel"); |
|
_8c7.children("div.datagrid-mask-msg").remove(); |
|
_8c7.children("div.datagrid-mask").remove(); |
|
}); |
|
}, |
|
fitColumns: function (jq) { |
|
return jq.each(function () { |
|
_7b3(this); |
|
}); |
|
}, |
|
fixColumnSize: function (jq, _8c8) { |
|
return jq.each(function () { |
|
_7d1(this, _8c8); |
|
}); |
|
}, |
|
fixRowHeight: function (jq, _8c9) { |
|
return jq.each(function () { |
|
_733(this, _8c9); |
|
}); |
|
}, |
|
freezeRow: function (jq, _8ca) { |
|
return jq.each(function () { |
|
_741(this, _8ca); |
|
}); |
|
}, |
|
autoSizeColumn: function (jq, _8cb) { |
|
return jq.each(function () { |
|
_7c5(this, _8cb); |
|
}); |
|
}, |
|
loadData: function (jq, data) { |
|
return jq.each(function () { |
|
_7a7(this, data); |
|
_875(this); |
|
}); |
|
}, |
|
getData: function (jq) { |
|
return $.data(jq[0], "datagrid").data; |
|
}, |
|
getRows: function (jq) { |
|
return $.data(jq[0], "datagrid").data.rows; |
|
}, |
|
getFooterRows: function (jq) { |
|
return $.data(jq[0], "datagrid").footer; |
|
}, |
|
getRowIndex: function (jq, id) { |
|
return _7fc(jq[0], id); |
|
}, |
|
getChecked: function (jq) { |
|
return _802(jq[0]); |
|
}, |
|
getSelected: function (jq) { |
|
var rows = _7ff(jq[0]); |
|
return rows.length > 0 ? rows[0] : null; |
|
}, |
|
getSelections: function (jq) { |
|
return _7ff(jq[0]); |
|
}, |
|
clearSelections: function (jq) { |
|
return jq.each(function () { |
|
var _8cc = $.data(this, "datagrid"); |
|
var _8cd = _8cc.selectedRows; |
|
var _8ce = _8cc.checkedRows; |
|
_8cd.splice(0, _8cd.length); |
|
_815(this); |
|
if (_8cc.options.checkOnSelect) { |
|
_8ce.splice(0, _8ce.length); |
|
} |
|
}); |
|
}, |
|
clearChecked: function (jq) { |
|
return jq.each(function () { |
|
var _8cf = $.data(this, "datagrid"); |
|
var _8d0 = _8cf.selectedRows; |
|
var _8d1 = _8cf.checkedRows; |
|
_8d1.splice(0, _8d1.length); |
|
_77c(this); |
|
if (_8cf.options.selectOnCheck) { |
|
_8d0.splice(0, _8d0.length); |
|
} |
|
}); |
|
}, |
|
scrollTo: function (jq, _8d2) { |
|
return jq.each(function () { |
|
_805(this, _8d2); |
|
}); |
|
}, |
|
highlightRow: function (jq, _8d3) { |
|
return jq.each(function () { |
|
_789(this, _8d3); |
|
_805(this, _8d3); |
|
}); |
|
}, |
|
selectAll: function (jq) { |
|
return jq.each(function () { |
|
_81a(this); |
|
}); |
|
}, |
|
unselectAll: function (jq) { |
|
return jq.each(function () { |
|
_815(this); |
|
}); |
|
}, |
|
selectRow: function (jq, _8d4) { |
|
return jq.each(function () { |
|
_790(this, _8d4); |
|
}); |
|
}, |
|
selectRecord: function (jq, id) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "datagrid").options; |
|
if (opts.idField) { |
|
var _8d5 = _7fc(this, id); |
|
if (_8d5 >= 0) { |
|
$(this).datagrid("selectRow", _8d5); |
|
} |
|
} |
|
}); |
|
}, |
|
unselectRow: function (jq, _8d6) { |
|
return jq.each(function () { |
|
_791(this, _8d6); |
|
}); |
|
}, |
|
checkRow: function (jq, _8d7) { |
|
return jq.each(function () { |
|
_78d(this, _8d7); |
|
}); |
|
}, |
|
uncheckRow: function (jq, _8d8) { |
|
return jq.each(function () { |
|
_78e(this, _8d8); |
|
}); |
|
}, |
|
checkAll: function (jq) { |
|
return jq.each(function () { |
|
_77b(this); |
|
}); |
|
}, |
|
uncheckAll: function (jq) { |
|
return jq.each(function () { |
|
_77c(this); |
|
}); |
|
}, |
|
beginEdit: function (jq, _8d9) { |
|
return jq.each(function () { |
|
_834(this, _8d9); |
|
}); |
|
}, |
|
endEdit: function (jq, _8da) { |
|
return jq.each(function () { |
|
_83a(this, _8da, false); |
|
}); |
|
}, |
|
cancelEdit: function (jq, _8db) { |
|
return jq.each(function () { |
|
_83a(this, _8db, true); |
|
}); |
|
}, |
|
getEditors: function (jq, _8dc) { |
|
return _847(jq[0], _8dc); |
|
}, |
|
getEditor: function (jq, _8dd) { |
|
return _84b(jq[0], _8dd); |
|
}, |
|
refreshRow: function (jq, _8de) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "datagrid").options; |
|
opts.view.refreshRow.call(opts.view, this, _8de); |
|
}); |
|
}, |
|
validateRow: function (jq, _8df) { |
|
return _839(jq[0], _8df); |
|
}, |
|
updateRow: function (jq, _8e0) { |
|
return jq.each(function () { |
|
_86f(this, _8e0); |
|
}); |
|
}, |
|
appendRow: function (jq, row) { |
|
return jq.each(function () { |
|
_86c(this, row); |
|
}); |
|
}, |
|
insertRow: function (jq, _8e1) { |
|
return jq.each(function () { |
|
_868(this, _8e1); |
|
}); |
|
}, |
|
deleteRow: function (jq, _8e2) { |
|
return jq.each(function () { |
|
_862(this, _8e2); |
|
}); |
|
}, |
|
getChanges: function (jq, _8e3) { |
|
return _85c(jq[0], _8e3); |
|
}, |
|
acceptChanges: function (jq) { |
|
return jq.each(function () { |
|
_879(this); |
|
}); |
|
}, |
|
rejectChanges: function (jq) { |
|
return jq.each(function () { |
|
_87b(this); |
|
}); |
|
}, |
|
mergeCells: function (jq, _8e4) { |
|
return jq.each(function () { |
|
_88d(this, _8e4); |
|
}); |
|
}, |
|
showColumn: function (jq, _8e5) { |
|
return jq.each(function () { |
|
var col = $(this).datagrid("getColumnOption", _8e5); |
|
if (col.hidden) { |
|
col.hidden = false; |
|
$(this).datagrid("getPanel").find("td[field=\"" + _8e5 + "\"]").show(); |
|
_7a8(this, _8e5, 1); |
|
$(this).datagrid("fitColumns"); |
|
} |
|
}); |
|
}, |
|
hideColumn: function (jq, _8e6) { |
|
return jq.each(function () { |
|
var col = $(this).datagrid("getColumnOption", _8e6); |
|
if (!col.hidden) { |
|
col.hidden = true; |
|
$(this).datagrid("getPanel").find("td[field=\"" + _8e6 + "\"]").hide(); |
|
_7a8(this, _8e6, -1); |
|
$(this).datagrid("fitColumns"); |
|
} |
|
}); |
|
}, |
|
sort: function (jq, _8e7) { |
|
return jq.each(function () { |
|
_77d(this, _8e7); |
|
}); |
|
}, |
|
gotoPage: function (jq, _8e8) { |
|
return jq.each(function () { |
|
var _8e9 = this; |
|
var page, |
|
cb; |
|
if (typeof _8e8 == "object") { |
|
page = _8e8.page; |
|
cb = _8e8.callback; |
|
} else { |
|
page = _8e8; |
|
} |
|
$(_8e9).datagrid("options").pageNumber = page; |
|
$(_8e9).datagrid("getPager").pagination("refresh", { |
|
pageNumber: page |
|
}); |
|
_7a6(_8e9, null, function () { |
|
if (cb) { |
|
cb.call(_8e9, page); |
|
} |
|
}); |
|
}); |
|
} |
|
}; |
|
$.fn.datagrid.parseOptions = function (_8ea) { |
|
var t = $(_8ea); |
|
return $.extend({}, $.fn.panel.parseOptions(_8ea), $.parser.parseOptions(_8ea, ["url", "toolbar", "idField", "sortName", "sortOrder", "pagePosition", "resizeHandle", { |
|
sharedStyleSheet: "boolean", |
|
fitColumns: "boolean", |
|
autoRowHeight: "boolean", |
|
striped: "boolean", |
|
nowrap: "boolean" |
|
}, { |
|
rownumbers: "boolean", |
|
singleSelect: "boolean", |
|
ctrlSelect: "boolean", |
|
checkOnSelect: "boolean", |
|
selectOnCheck: "boolean" |
|
}, { |
|
pagination: "boolean", |
|
pageSize: "number", |
|
pageNumber: "number" |
|
}, { |
|
multiSort: "boolean", |
|
remoteSort: "boolean", |
|
showHeader: "boolean", |
|
showFooter: "boolean" |
|
}, { |
|
scrollbarSize: "number", |
|
scrollOnSelect: "boolean" |
|
} |
|
]), { |
|
pageList: (t.attr("pageList") ? eval(t.attr("pageList")) : undefined), |
|
loadMsg: (t.attr("loadMsg") != undefined ? t.attr("loadMsg") : undefined), |
|
rowStyler: (t.attr("rowStyler") ? eval(t.attr("rowStyler")) : undefined) |
|
}); |
|
}; |
|
$.fn.datagrid.parseData = function (_8eb) { |
|
var t = $(_8eb); |
|
var data = { |
|
total: 0, |
|
rows: [] |
|
}; |
|
var _8ec = t.datagrid("getColumnFields", true).concat(t.datagrid("getColumnFields", false)); |
|
t.find("tbody tr").each(function () { |
|
data.total++; |
|
var row = {}; |
|
$.extend(row, $.parser.parseOptions(this, ["iconCls", "state"])); |
|
for (var i = 0; i < _8ec.length; i++) { |
|
row[_8ec[i]] = $(this).find("td:eq(" + i + ")").html(); |
|
} |
|
data.rows.push(row); |
|
}); |
|
return data; |
|
}; |
|
var _8ed = { |
|
render: function (_8ee, _8ef, _8f0) { |
|
var rows = $(_8ee).datagrid("getRows"); |
|
$(_8ef).empty().html(this.renderTable(_8ee, 0, rows, _8f0)); |
|
}, |
|
renderFooter: function (_8f1, _8f2, _8f3) { |
|
var opts = $.data(_8f1, "datagrid").options; |
|
var rows = $.data(_8f1, "datagrid").footer || []; |
|
var _8f4 = $(_8f1).datagrid("getColumnFields", _8f3); |
|
var _8f5 = ["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"]; |
|
for (var i = 0; i < rows.length; i++) { |
|
_8f5.push("<tr class=\"datagrid-row\" datagrid-row-index=\"" + i + "\">"); |
|
_8f5.push(this.renderRow.call(this, _8f1, _8f4, _8f3, i, rows[i])); |
|
_8f5.push("</tr>"); |
|
} |
|
_8f5.push("</tbody></table>"); |
|
$(_8f2).html(_8f5.join("")); |
|
}, |
|
renderTable: function (_8f6, _8f7, rows, _8f8) { |
|
var _8f9 = $.data(_8f6, "datagrid"); |
|
var opts = _8f9.options; |
|
if (_8f8) { |
|
if (!(opts.rownumbers || (opts.frozenColumns && opts.frozenColumns.length))) { |
|
return ""; |
|
} |
|
} |
|
var _8fa = $(_8f6).datagrid("getColumnFields", _8f8); |
|
var _8fb = ["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"]; |
|
for (var i = 0; i < rows.length; i++) { |
|
var row = rows[i]; |
|
var css = opts.rowStyler ? opts.rowStyler.call(_8f6, _8f7, row) : ""; |
|
var cs = this.getStyleValue(css); |
|
var cls = "class=\"datagrid-row " + (_8f7 % 2 && opts.striped ? "datagrid-row-alt " : " ") + cs.c + "\""; |
|
var _8fc = cs.s ? "style=\"" + cs.s + "\"" : ""; |
|
var _8fd = _8f9.rowIdPrefix + "-" + (_8f8 ? 1 : 2) + "-" + _8f7; |
|
_8fb.push("<tr id=\"" + _8fd + "\" datagrid-row-index=\"" + _8f7 + "\" " + cls + " " + _8fc + ">"); |
|
_8fb.push(this.renderRow.call(this, _8f6, _8fa, _8f8, _8f7, row)); |
|
_8fb.push("</tr>"); |
|
_8f7++; |
|
} |
|
_8fb.push("</tbody></table>"); |
|
return _8fb.join(""); |
|
}, |
|
renderRow: function (_8fe, _8ff, _900, _901, _902) { |
|
var opts = $.data(_8fe, "datagrid").options; |
|
var cc = []; |
|
if (_900 && opts.rownumbers) { |
|
var _903 = _901 + 1; |
|
if (opts.pagination) { |
|
_903 += (opts.pageNumber - 1) * opts.pageSize; |
|
} |
|
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">" + _903 + "</div></td>"); |
|
} |
|
for (var i = 0; i < _8ff.length; i++) { |
|
var _904 = _8ff[i]; |
|
var col = $(_8fe).datagrid("getColumnOption", _904); |
|
if (col) { |
|
var _905 = _902[_904]; |
|
var css = col.styler ? (col.styler.call(_8fe, _905, _902, _901) || "") : ""; |
|
var cs = this.getStyleValue(css); |
|
var cls = cs.c ? "class=\"" + cs.c + "\"" : ""; |
|
var _906 = col.hidden ? "style=\"display:none;" + cs.s + "\"" : (cs.s ? "style=\"" + cs.s + "\"" : ""); |
|
cc.push("<td field=\"" + _904 + "\" " + cls + " " + _906 + ">"); |
|
var _906 = ""; |
|
if (!col.checkbox) { |
|
if (col.align) { |
|
_906 += "text-align:" + col.align + ";"; |
|
} |
|
if (!opts.nowrap) { |
|
_906 += "white-space:normal;height:auto;"; |
|
} else { |
|
if (opts.autoRowHeight) { |
|
_906 += "height:auto;"; |
|
} |
|
} |
|
} |
|
cc.push("<div style=\"" + _906 + "\" "); |
|
cc.push(col.checkbox ? "class=\"datagrid-cell-check\"" : "class=\"datagrid-cell " + col.cellClass + "\""); |
|
cc.push(">"); |
|
if (col.checkbox) { |
|
cc.push("<input type=\"checkbox\" " + (_902.checked ? "checked=\"checked\"" : "")); |
|
cc.push(" name=\"" + _904 + "\" value=\"" + (_905 != undefined ? _905 : "") + "\">"); |
|
} else { |
|
if (col.formatter) { |
|
cc.push(col.formatter(_905, _902, _901)); |
|
} else { |
|
cc.push(_905); |
|
} |
|
} |
|
cc.push("</div>"); |
|
cc.push("</td>"); |
|
} |
|
} |
|
return cc.join(""); |
|
}, |
|
getStyleValue: function (css) { |
|
var _907 = ""; |
|
var _908 = ""; |
|
if (typeof css == "string") { |
|
_908 = css; |
|
} else { |
|
if (css) { |
|
_907 = css["class"] || ""; |
|
_908 = css["style"] || ""; |
|
} |
|
} |
|
return { |
|
c: _907, |
|
s: _908 |
|
}; |
|
}, |
|
refreshRow: function (_909, _90a) { |
|
this.updateRow.call(this, _909, _90a, {}); |
|
}, |
|
updateRow: function (_90b, _90c, row) { |
|
var opts = $.data(_90b, "datagrid").options; |
|
var _90d = opts.finder.getRow(_90b, _90c); |
|
$.extend(_90d, row); |
|
var cs = _90e.call(this, _90c); |
|
var _90f = cs.s; |
|
var cls = "datagrid-row " + (_90c % 2 && opts.striped ? "datagrid-row-alt " : " ") + cs.c; |
|
function _90e(_910) { |
|
var css = opts.rowStyler ? opts.rowStyler.call(_90b, _910, _90d) : ""; |
|
return this.getStyleValue(css); |
|
}; |
|
function _911(_912) { |
|
var tr = opts.finder.getTr(_90b, _90c, "body", (_912 ? 1 : 2)); |
|
if (!tr.length) { |
|
return; |
|
} |
|
var _913 = $(_90b).datagrid("getColumnFields", _912); |
|
var _914 = tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"); |
|
tr.html(this.renderRow.call(this, _90b, _913, _912, _90c, _90d)); |
|
var _915 = (tr.hasClass("datagrid-row-checked") ? " datagrid-row-checked" : "") + (tr.hasClass("datagrid-row-selected") ? " datagrid-row-selected" : ""); |
|
tr.attr("style", _90f).attr("class", cls + _915); |
|
if (_914) { |
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true); |
|
} |
|
}; |
|
_911.call(this, true); |
|
_911.call(this, false); |
|
$(_90b).datagrid("fixRowHeight", _90c); |
|
}, |
|
insertRow: function (_916, _917, row) { |
|
var _918 = $.data(_916, "datagrid"); |
|
var opts = _918.options; |
|
var dc = _918.dc; |
|
var data = _918.data; |
|
if (_917 == undefined || _917 == null) { |
|
_917 = data.rows.length; |
|
} |
|
if (_917 > data.rows.length) { |
|
_917 = data.rows.length; |
|
} |
|
function _919(_91a) { |
|
var _91b = _91a ? 1 : 2; |
|
for (var i = data.rows.length - 1; i >= _917; i--) { |
|
var tr = opts.finder.getTr(_916, i, "body", _91b); |
|
tr.attr("datagrid-row-index", i + 1); |
|
tr.attr("id", _918.rowIdPrefix + "-" + _91b + "-" + (i + 1)); |
|
if (_91a && opts.rownumbers) { |
|
var _91c = i + 2; |
|
if (opts.pagination) { |
|
_91c += (opts.pageNumber - 1) * opts.pageSize; |
|
} |
|
tr.find("div.datagrid-cell-rownumber").html(_91c); |
|
} |
|
if (opts.striped) { |
|
tr.removeClass("datagrid-row-alt").addClass((i + 1) % 2 ? "datagrid-row-alt" : ""); |
|
} |
|
} |
|
}; |
|
function _91d(_91e) { |
|
var _91f = _91e ? 1 : 2; |
|
var _920 = $(_916).datagrid("getColumnFields", _91e); |
|
var _921 = _918.rowIdPrefix + "-" + _91f + "-" + _917; |
|
var tr = "<tr id=\"" + _921 + "\" class=\"datagrid-row\" datagrid-row-index=\"" + _917 + "\"></tr>"; |
|
if (_917 >= data.rows.length) { |
|
if (data.rows.length) { |
|
opts.finder.getTr(_916, "", "last", _91f).after(tr); |
|
} else { |
|
var cc = _91e ? dc.body1 : dc.body2; |
|
cc.html("<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>" + tr + "</tbody></table>"); |
|
} |
|
} else { |
|
opts.finder.getTr(_916, _917 + 1, "body", _91f).before(tr); |
|
} |
|
}; |
|
_919.call(this, true); |
|
_919.call(this, false); |
|
_91d.call(this, true); |
|
_91d.call(this, false); |
|
data.total += 1; |
|
data.rows.splice(_917, 0, row); |
|
this.setEmptyMsg(_916); |
|
this.refreshRow.call(this, _916, _917); |
|
}, |
|
deleteRow: function (_922, _923) { |
|
var _924 = $.data(_922, "datagrid"); |
|
var opts = _924.options; |
|
var data = _924.data; |
|
function _925(_926) { |
|
var _927 = _926 ? 1 : 2; |
|
for (var i = _923 + 1; i < data.rows.length; i++) { |
|
var tr = opts.finder.getTr(_922, i, "body", _927); |
|
tr.attr("datagrid-row-index", i - 1); |
|
tr.attr("id", _924.rowIdPrefix + "-" + _927 + "-" + (i - 1)); |
|
if (_926 && opts.rownumbers) { |
|
var _928 = i; |
|
if (opts.pagination) { |
|
_928 += (opts.pageNumber - 1) * opts.pageSize; |
|
} |
|
tr.find("div.datagrid-cell-rownumber").html(_928); |
|
} |
|
if (opts.striped) { |
|
tr.removeClass("datagrid-row-alt").addClass((i - 1) % 2 ? "datagrid-row-alt" : ""); |
|
} |
|
} |
|
}; |
|
opts.finder.getTr(_922, _923).remove(); |
|
_925.call(this, true); |
|
_925.call(this, false); |
|
data.total -= 1; |
|
data.rows.splice(_923, 1); |
|
this.setEmptyMsg(_922); |
|
}, |
|
onBeforeRender: function (_929, rows) {}, |
|
onAfterRender: function (_92a) { |
|
var _92b = $.data(_92a, "datagrid"); |
|
var opts = _92b.options; |
|
if (opts.showFooter) { |
|
var _92c = $(_92a).datagrid("getPanel").find("div.datagrid-footer"); |
|
_92c.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility", "hidden"); |
|
} |
|
this.setEmptyMsg(_92a); |
|
}, |
|
setEmptyMsg: function (_92d) { |
|
var _92e = $.data(_92d, "datagrid"); |
|
var opts = _92e.options; |
|
var _92f = opts.finder.getRows(_92d).length == 0; |
|
if (_92f) { |
|
this.renderEmptyRow(_92d); |
|
} |
|
if (opts.emptyMsg) { |
|
_92e.dc.view.children(".datagrid-empty").remove(); |
|
if (_92f) { |
|
var h = _92e.dc.header2.parent().outerHeight(); |
|
var d = $("<div class=\"datagrid-empty\"></div>").appendTo(_92e.dc.view); |
|
d.html(opts.emptyMsg).css("top", h + "px"); |
|
} |
|
} |
|
}, |
|
renderEmptyRow: function (_930) { |
|
var opts = $(_930).datagrid("options"); |
|
var cols = $.map($(_930).datagrid("getColumnFields"), function (_931) { |
|
return $(_930).datagrid("getColumnOption", _931); |
|
}); |
|
$.map(cols, function (col) { |
|
col.formatter1 = col.formatter; |
|
col.styler1 = col.styler; |
|
col.formatter = col.styler = undefined; |
|
}); |
|
var _932 = opts.rowStyler; |
|
opts.rowStyler = function () {}; |
|
var _933 = $.data(_930, "datagrid").dc.body2; |
|
_933.html(this.renderTable(_930, 0, [{} |
|
], false)); |
|
_933.find("tbody *").css({ |
|
height: 1, |
|
borderColor: "transparent", |
|
background: "transparent" |
|
}); |
|
var tr = _933.find(".datagrid-row"); |
|
tr.removeClass("datagrid-row").removeAttr("datagrid-row-index"); |
|
tr.find(".datagrid-cell,.datagrid-cell-check").empty(); |
|
$.map(cols, function (col) { |
|
col.formatter = col.formatter1; |
|
col.styler = col.styler1; |
|
col.formatter1 = col.styler1 = undefined; |
|
}); |
|
opts.rowStyler = _932; |
|
} |
|
}; |
|
$.fn.datagrid.defaults = $.extend({}, $.fn.panel.defaults, { |
|
sharedStyleSheet: false, |
|
frozenColumns: undefined, |
|
columns: undefined, |
|
fitColumns: false, |
|
resizeHandle: "right", |
|
resizeEdge: 5, |
|
autoRowHeight: true, |
|
toolbar: null, |
|
striped: false, |
|
method: "post", |
|
nowrap: true, |
|
idField: null, |
|
url: null, |
|
data: null, |
|
loadMsg: "Processing, please wait ...", |
|
emptyMsg: "", |
|
rownumbers: false, |
|
singleSelect: false, |
|
ctrlSelect: false, |
|
selectOnCheck: true, |
|
checkOnSelect: true, |
|
pagination: false, |
|
pagePosition: "bottom", |
|
pageNumber: 1, |
|
pageSize: 10, |
|
pageList: [10, 20, 30, 40, 50], |
|
queryParams: {}, |
|
sortName: null, |
|
sortOrder: "asc", |
|
multiSort: false, |
|
remoteSort: true, |
|
showHeader: true, |
|
showFooter: false, |
|
scrollOnSelect: true, |
|
scrollbarSize: 18, |
|
rownumberWidth: 30, |
|
editorHeight: 31, |
|
headerEvents: { |
|
mouseover: _775(true), |
|
mouseout: _775(false), |
|
click: _779, |
|
dblclick: _77e, |
|
contextmenu: _781 |
|
}, |
|
rowEvents: { |
|
mouseover: _783(true), |
|
mouseout: _783(false), |
|
click: _78a, |
|
dblclick: _794, |
|
contextmenu: _798 |
|
}, |
|
rowStyler: function (_934, _935) {}, |
|
loader: function (_936, _937, _938) { |
|
var opts = $(this).datagrid("options"); |
|
if (!opts.url) { |
|
return false; |
|
} |
|
$.ajax({ |
|
type: opts.method, |
|
url: opts.url, |
|
data: _936, |
|
dataType: "json", |
|
success: function (data) { |
|
_937(data); |
|
}, |
|
error: function () { |
|
_938.apply(this, arguments); |
|
} |
|
}); |
|
}, |
|
loadFilter: function (data) { |
|
return data; |
|
}, |
|
editors: _8a4, |
|
finder: { |
|
getTr: function (_939, _93a, type, _93b) { |
|
type = type || "body"; |
|
_93b = _93b || 0; |
|
var _93c = $.data(_939, "datagrid"); |
|
var dc = _93c.dc; |
|
var opts = _93c.options; |
|
if (_93b == 0) { |
|
var tr1 = opts.finder.getTr(_939, _93a, type, 1); |
|
var tr2 = opts.finder.getTr(_939, _93a, type, 2); |
|
return tr1.add(tr2); |
|
} else { |
|
if (type == "body") { |
|
var tr = $("#" + _93c.rowIdPrefix + "-" + _93b + "-" + _93a); |
|
if (!tr.length) { |
|
tr = (_93b == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index=" + _93a + "]"); |
|
} |
|
return tr; |
|
} else { |
|
if (type == "footer") { |
|
return (_93b == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index=" + _93a + "]"); |
|
} else { |
|
if (type == "selected") { |
|
return (_93b == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-selected"); |
|
} else { |
|
if (type == "highlight") { |
|
return (_93b == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-over"); |
|
} else { |
|
if (type == "checked") { |
|
return (_93b == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-checked"); |
|
} else { |
|
if (type == "editing") { |
|
return (_93b == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-editing"); |
|
} else { |
|
if (type == "last") { |
|
return (_93b == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]:last"); |
|
} else { |
|
if (type == "allbody") { |
|
return (_93b == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]"); |
|
} else { |
|
if (type == "allfooter") { |
|
return (_93b == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index]"); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}, |
|
getRow: function (_93d, p) { |
|
var _93e = (typeof p == "object") ? p.attr("datagrid-row-index") : p; |
|
return $.data(_93d, "datagrid").data.rows[parseInt(_93e)]; |
|
}, |
|
getRows: function (_93f) { |
|
return $(_93f).datagrid("getRows"); |
|
} |
|
}, |
|
view: _8ed, |
|
onBeforeLoad: function (_940) {}, |
|
onLoadSuccess: function () {}, |
|
onLoadError: function () {}, |
|
onClickRow: function (_941, _942) {}, |
|
onDblClickRow: function (_943, _944) {}, |
|
onClickCell: function (_945, _946, _947) {}, |
|
onDblClickCell: function (_948, _949, _94a) {}, |
|
onBeforeSortColumn: function (sort, _94b) {}, |
|
onSortColumn: function (sort, _94c) {}, |
|
onResizeColumn: function (_94d, _94e) {}, |
|
onBeforeSelect: function (_94f, _950) {}, |
|
onSelect: function (_951, _952) {}, |
|
onBeforeUnselect: function (_953, _954) {}, |
|
onUnselect: function (_955, _956) {}, |
|
onSelectAll: function (rows) {}, |
|
onUnselectAll: function (rows) {}, |
|
onBeforeCheck: function (_957, _958) {}, |
|
onCheck: function (_959, _95a) {}, |
|
onBeforeUncheck: function (_95b, _95c) {}, |
|
onUncheck: function (_95d, _95e) {}, |
|
onCheckAll: function (rows) {}, |
|
onUncheckAll: function (rows) {}, |
|
onBeforeEdit: function (_95f, _960) {}, |
|
onBeginEdit: function (_961, _962) {}, |
|
onEndEdit: function (_963, _964, _965) {}, |
|
onAfterEdit: function (_966, _967, _968) {}, |
|
onCancelEdit: function (_969, _96a) {}, |
|
onHeaderContextMenu: function (e, _96b) {}, |
|
onRowContextMenu: function (e, _96c, _96d) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
var _96e; |
|
$(document)._unbind(".propertygrid")._bind("mousedown.propertygrid", function (e) { |
|
var p = $(e.target).closest("div.datagrid-view,div.combo-panel"); |
|
if (p.length) { |
|
return; |
|
} |
|
_96f(_96e); |
|
_96e = undefined; |
|
}); |
|
function _970(_971) { |
|
var _972 = $.data(_971, "propertygrid"); |
|
var opts = $.data(_971, "propertygrid").options; |
|
$(_971).datagrid($.extend({}, opts, { |
|
cls: "propertygrid", |
|
view: (opts.showGroup ? opts.groupView : opts.view), |
|
onBeforeEdit: function (_973, row) { |
|
if (opts.onBeforeEdit.call(_971, _973, row) == false) { |
|
return false; |
|
} |
|
var dg = $(this); |
|
var row = dg.datagrid("getRows")[_973]; |
|
var col = dg.datagrid("getColumnOption", "value"); |
|
col.editor = row.editor; |
|
}, |
|
onClickCell: function (_974, _975, _976) { |
|
if (_96e != this) { |
|
_96f(_96e); |
|
_96e = this; |
|
} |
|
if (opts.editIndex != _974) { |
|
_96f(_96e); |
|
$(this).datagrid("beginEdit", _974); |
|
var ed = $(this).datagrid("getEditor", { |
|
index: _974, |
|
field: _975 |
|
}); |
|
if (!ed) { |
|
ed = $(this).datagrid("getEditor", { |
|
index: _974, |
|
field: "value" |
|
}); |
|
} |
|
if (ed) { |
|
var t = $(ed.target); |
|
var _977 = t.data("textbox") ? t.textbox("textbox") : t; |
|
_977.focus(); |
|
opts.editIndex = _974; |
|
} |
|
} |
|
opts.onClickCell.call(_971, _974, _975, _976); |
|
}, |
|
loadFilter: function (data) { |
|
_96f(this); |
|
return opts.loadFilter.call(this, data); |
|
} |
|
})); |
|
}; |
|
function _96f(_978) { |
|
var t = $(_978); |
|
if (!t.length) { |
|
return; |
|
} |
|
var opts = $.data(_978, "propertygrid").options; |
|
opts.finder.getTr(_978, null, "editing").each(function () { |
|
var _979 = parseInt($(this).attr("datagrid-row-index")); |
|
if (t.datagrid("validateRow", _979)) { |
|
t.datagrid("endEdit", _979); |
|
} else { |
|
t.datagrid("cancelEdit", _979); |
|
} |
|
}); |
|
opts.editIndex = undefined; |
|
}; |
|
$.fn.propertygrid = function (_97a, _97b) { |
|
if (typeof _97a == "string") { |
|
var _97c = $.fn.propertygrid.methods[_97a]; |
|
if (_97c) { |
|
return _97c(this, _97b); |
|
} else { |
|
return this.datagrid(_97a, _97b); |
|
} |
|
} |
|
_97a = _97a || {}; |
|
return this.each(function () { |
|
var _97d = $.data(this, "propertygrid"); |
|
if (_97d) { |
|
$.extend(_97d.options, _97a); |
|
} else { |
|
var opts = $.extend({}, $.fn.propertygrid.defaults, $.fn.propertygrid.parseOptions(this), _97a); |
|
opts.frozenColumns = $.extend(true, [], opts.frozenColumns); |
|
opts.columns = $.extend(true, [], opts.columns); |
|
$.data(this, "propertygrid", { |
|
options: opts |
|
}); |
|
} |
|
_970(this); |
|
}); |
|
}; |
|
$.fn.propertygrid.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "propertygrid").options; |
|
} |
|
}; |
|
$.fn.propertygrid.parseOptions = function (_97e) { |
|
return $.extend({}, $.fn.datagrid.parseOptions(_97e), $.parser.parseOptions(_97e, [{ |
|
showGroup: "boolean" |
|
} |
|
])); |
|
}; |
|
var _97f = $.extend({}, $.fn.datagrid.defaults.view, { |
|
render: function (_980, _981, _982) { |
|
var _983 = []; |
|
var _984 = this.groups; |
|
for (var i = 0; i < _984.length; i++) { |
|
_983.push(this.renderGroup.call(this, _980, i, _984[i], _982)); |
|
} |
|
$(_981).html(_983.join("")); |
|
}, |
|
renderGroup: function (_985, _986, _987, _988) { |
|
var _989 = $.data(_985, "datagrid"); |
|
var opts = _989.options; |
|
var _98a = $(_985).datagrid("getColumnFields", _988); |
|
var _98b = opts.frozenColumns && opts.frozenColumns.length; |
|
if (_988) { |
|
if (!(opts.rownumbers || _98b)) { |
|
return ""; |
|
} |
|
} |
|
var _98c = []; |
|
var css = opts.groupStyler.call(_985, _987.value, _987.rows); |
|
var cs = _98d(css, "datagrid-group"); |
|
_98c.push("<div group-index=" + _986 + " " + cs + ">"); |
|
if ((_988 && (opts.rownumbers || opts.frozenColumns.length)) || (!_988 && !(opts.rownumbers || opts.frozenColumns.length))) { |
|
_98c.push("<span class=\"datagrid-group-expander\">"); |
|
_98c.push("<span class=\"datagrid-row-expander datagrid-row-collapse\"> </span>"); |
|
_98c.push("</span>"); |
|
} |
|
if ((_988 && _98b) || (!_988)) { |
|
_98c.push("<span class=\"datagrid-group-title\">"); |
|
_98c.push(opts.groupFormatter.call(_985, _987.value, _987.rows)); |
|
_98c.push("</span>"); |
|
} |
|
_98c.push("</div>"); |
|
_98c.push("<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"); |
|
var _98e = _987.startIndex; |
|
for (var j = 0; j < _987.rows.length; j++) { |
|
var css = opts.rowStyler ? opts.rowStyler.call(_985, _98e, _987.rows[j]) : ""; |
|
var _98f = ""; |
|
var _990 = ""; |
|
if (typeof css == "string") { |
|
_990 = css; |
|
} else { |
|
if (css) { |
|
_98f = css["class"] || ""; |
|
_990 = css["style"] || ""; |
|
} |
|
} |
|
var cls = "class=\"datagrid-row " + (_98e % 2 && opts.striped ? "datagrid-row-alt " : " ") + _98f + "\""; |
|
var _991 = _990 ? "style=\"" + _990 + "\"" : ""; |
|
var _992 = _989.rowIdPrefix + "-" + (_988 ? 1 : 2) + "-" + _98e; |
|
_98c.push("<tr id=\"" + _992 + "\" datagrid-row-index=\"" + _98e + "\" " + cls + " " + _991 + ">"); |
|
_98c.push(this.renderRow.call(this, _985, _98a, _988, _98e, _987.rows[j])); |
|
_98c.push("</tr>"); |
|
_98e++; |
|
} |
|
_98c.push("</tbody></table>"); |
|
return _98c.join(""); |
|
function _98d(css, cls) { |
|
var _993 = ""; |
|
var _994 = ""; |
|
if (typeof css == "string") { |
|
_994 = css; |
|
} else { |
|
if (css) { |
|
_993 = css["class"] || ""; |
|
_994 = css["style"] || ""; |
|
} |
|
} |
|
return "class=\"" + cls + (_993 ? " " + _993 : "") + "\" " + "style=\"" + _994 + "\""; |
|
}; |
|
}, |
|
bindEvents: function (_995) { |
|
var _996 = $.data(_995, "datagrid"); |
|
var dc = _996.dc; |
|
var body = dc.body1.add(dc.body2); |
|
var _997 = ($.data(body[0], "events") || $._data(body[0], "events")).click[0].handler; |
|
body._unbind("click")._bind("click", function (e) { |
|
var tt = $(e.target); |
|
var _998 = tt.closest("span.datagrid-row-expander"); |
|
if (_998.length) { |
|
var _999 = _998.closest("div.datagrid-group").attr("group-index"); |
|
if (_998.hasClass("datagrid-row-collapse")) { |
|
$(_995).datagrid("collapseGroup", _999); |
|
} else { |
|
$(_995).datagrid("expandGroup", _999); |
|
} |
|
} else { |
|
_997(e); |
|
} |
|
e.stopPropagation(); |
|
}); |
|
}, |
|
onBeforeRender: function (_99a, rows) { |
|
var _99b = $.data(_99a, "datagrid"); |
|
var opts = _99b.options; |
|
_99c(); |
|
var _99d = []; |
|
for (var i = 0; i < rows.length; i++) { |
|
var row = rows[i]; |
|
var _99e = _99f(row[opts.groupField]); |
|
if (!_99e) { |
|
_99e = { |
|
value: row[opts.groupField], |
|
rows: [row] |
|
}; |
|
_99d.push(_99e); |
|
} else { |
|
_99e.rows.push(row); |
|
} |
|
} |
|
var _9a0 = 0; |
|
var _9a1 = []; |
|
for (var i = 0; i < _99d.length; i++) { |
|
var _99e = _99d[i]; |
|
_99e.startIndex = _9a0; |
|
_9a0 += _99e.rows.length; |
|
_9a1 = _9a1.concat(_99e.rows); |
|
} |
|
_99b.data.rows = _9a1; |
|
this.groups = _99d; |
|
var that = this; |
|
setTimeout(function () { |
|
that.bindEvents(_99a); |
|
}, 0); |
|
function _99f(_9a2) { |
|
for (var i = 0; i < _99d.length; i++) { |
|
var _9a3 = _99d[i]; |
|
if (_9a3.value == _9a2) { |
|
return _9a3; |
|
} |
|
} |
|
return null; |
|
}; |
|
function _99c() { |
|
if (!$("#datagrid-group-style").length) { |
|
$("head").append("<style id=\"datagrid-group-style\">" + ".datagrid-group{height:" + opts.groupHeight + "px;overflow:hidden;font-weight:bold;border-bottom:1px solid #ccc;white-space:nowrap;word-break:normal;}" + ".datagrid-group-title,.datagrid-group-expander{display:inline-block;vertical-align:bottom;height:100%;line-height:" + opts.groupHeight + "px;padding:0 4px;}" + ".datagrid-group-title{position:relative;}" + ".datagrid-group-expander{width:" + opts.expanderWidth + "px;text-align:center;padding:0}" + ".datagrid-group-expander .datagrid-row-expander{margin:" + Math.floor((opts.groupHeight - 16) / 2) + "px 0;display:inline-block;width:16px;height:16px;cursor:pointer}" + "</style>"); |
|
} |
|
}; |
|
}, |
|
onAfterRender: function (_9a4) { |
|
$.fn.datagrid.defaults.view.onAfterRender.call(this, _9a4); |
|
var view = this; |
|
var _9a5 = $.data(_9a4, "datagrid"); |
|
var opts = _9a5.options; |
|
if (!_9a5.onResizeColumn) { |
|
_9a5.onResizeColumn = opts.onResizeColumn; |
|
} |
|
if (!_9a5.onResize) { |
|
_9a5.onResize = opts.onResize; |
|
} |
|
opts.onResizeColumn = function (_9a6, _9a7) { |
|
view.resizeGroup(_9a4); |
|
_9a5.onResizeColumn.call(_9a4, _9a6, _9a7); |
|
}; |
|
opts.onResize = function (_9a8, _9a9) { |
|
view.resizeGroup(_9a4); |
|
_9a5.onResize.call($(_9a4).datagrid("getPanel")[0], _9a8, _9a9); |
|
}; |
|
view.resizeGroup(_9a4); |
|
} |
|
}); |
|
$.extend($.fn.datagrid.methods, { |
|
groups: function (jq) { |
|
return jq.datagrid("options").view.groups; |
|
}, |
|
expandGroup: function (jq, _9aa) { |
|
return jq.each(function () { |
|
var opts = $(this).datagrid("options"); |
|
var view = $.data(this, "datagrid").dc.view; |
|
var _9ab = view.find(_9aa != undefined ? "div.datagrid-group[group-index=\"" + _9aa + "\"]" : "div.datagrid-group"); |
|
var _9ac = _9ab.find("span.datagrid-row-expander"); |
|
if (_9ac.hasClass("datagrid-row-expand")) { |
|
_9ac.removeClass("datagrid-row-expand").addClass("datagrid-row-collapse"); |
|
_9ab.next("table").show(); |
|
} |
|
$(this).datagrid("fixRowHeight"); |
|
if (opts.onExpandGroup) { |
|
opts.onExpandGroup.call(this, _9aa); |
|
} |
|
}); |
|
}, |
|
collapseGroup: function (jq, _9ad) { |
|
return jq.each(function () { |
|
var opts = $(this).datagrid("options"); |
|
var view = $.data(this, "datagrid").dc.view; |
|
var _9ae = view.find(_9ad != undefined ? "div.datagrid-group[group-index=\"" + _9ad + "\"]" : "div.datagrid-group"); |
|
var _9af = _9ae.find("span.datagrid-row-expander"); |
|
if (_9af.hasClass("datagrid-row-collapse")) { |
|
_9af.removeClass("datagrid-row-collapse").addClass("datagrid-row-expand"); |
|
_9ae.next("table").hide(); |
|
} |
|
$(this).datagrid("fixRowHeight"); |
|
if (opts.onCollapseGroup) { |
|
opts.onCollapseGroup.call(this, _9ad); |
|
} |
|
}); |
|
}, |
|
scrollToGroup: function (jq, _9b0) { |
|
return jq.each(function () { |
|
var _9b1 = $.data(this, "datagrid"); |
|
var dc = _9b1.dc; |
|
var grow = dc.body2.children("div.datagrid-group[group-index=\"" + _9b0 + "\"]"); |
|
if (grow.length) { |
|
var _9b2 = grow.outerHeight(); |
|
var _9b3 = dc.view2.children("div.datagrid-header")._outerHeight(); |
|
var _9b4 = dc.body2.outerHeight(true) - dc.body2.outerHeight(); |
|
var top = grow.position().top - _9b3 - _9b4; |
|
if (top < 0) { |
|
dc.body2.scrollTop(dc.body2.scrollTop() + top); |
|
} else { |
|
if (top + _9b2 > dc.body2.height() - 18) { |
|
dc.body2.scrollTop(dc.body2.scrollTop() + top + _9b2 - dc.body2.height() + 18); |
|
} |
|
} |
|
} |
|
}); |
|
} |
|
}); |
|
$.extend(_97f, { |
|
refreshGroupTitle: function (_9b5, _9b6) { |
|
var _9b7 = $.data(_9b5, "datagrid"); |
|
var opts = _9b7.options; |
|
var dc = _9b7.dc; |
|
var _9b8 = this.groups[_9b6]; |
|
var span = dc.body1.add(dc.body2).children("div.datagrid-group[group-index=" + _9b6 + "]").find("span.datagrid-group-title"); |
|
span.html(opts.groupFormatter.call(_9b5, _9b8.value, _9b8.rows)); |
|
}, |
|
resizeGroup: function (_9b9, _9ba) { |
|
var _9bb = $.data(_9b9, "datagrid"); |
|
var dc = _9bb.dc; |
|
var ht = dc.header2.find("table"); |
|
var fr = ht.find("tr.datagrid-filter-row").hide(); |
|
var ww = dc.body2.children("table.datagrid-btable:first").width(); |
|
if (_9ba == undefined) { |
|
var _9bc = dc.body2.children("div.datagrid-group"); |
|
} else { |
|
var _9bc = dc.body2.children("div.datagrid-group[group-index=" + _9ba + "]"); |
|
} |
|
_9bc._outerWidth(ww); |
|
var opts = _9bb.options; |
|
if (opts.frozenColumns && opts.frozenColumns.length) { |
|
var _9bd = dc.view1.width() - opts.expanderWidth; |
|
var _9be = dc.view1.css("direction").toLowerCase() == "rtl"; |
|
_9bc.find(".datagrid-group-title").css(_9be ? "right" : "left", -_9bd + "px"); |
|
} |
|
if (fr.length) { |
|
if (opts.showFilterBar) { |
|
fr.show(); |
|
} |
|
} |
|
}, |
|
insertRow: function (_9bf, _9c0, row) { |
|
var _9c1 = $.data(_9bf, "datagrid"); |
|
var opts = _9c1.options; |
|
var dc = _9c1.dc; |
|
var _9c2 = null; |
|
var _9c3; |
|
if (!_9c1.data.rows.length) { |
|
$(_9bf).datagrid("loadData", [row]); |
|
return; |
|
} |
|
for (var i = 0; i < this.groups.length; i++) { |
|
if (this.groups[i].value == row[opts.groupField]) { |
|
_9c2 = this.groups[i]; |
|
_9c3 = i; |
|
break; |
|
} |
|
} |
|
if (_9c2) { |
|
if (_9c0 == undefined || _9c0 == null) { |
|
_9c0 = _9c1.data.rows.length; |
|
} |
|
if (_9c0 < _9c2.startIndex) { |
|
_9c0 = _9c2.startIndex; |
|
} else { |
|
if (_9c0 > _9c2.startIndex + _9c2.rows.length) { |
|
_9c0 = _9c2.startIndex + _9c2.rows.length; |
|
} |
|
} |
|
$.fn.datagrid.defaults.view.insertRow.call(this, _9bf, _9c0, row); |
|
if (_9c0 >= _9c2.startIndex + _9c2.rows.length) { |
|
_9c4(_9c0, true); |
|
_9c4(_9c0, false); |
|
} |
|
_9c2.rows.splice(_9c0 - _9c2.startIndex, 0, row); |
|
} else { |
|
_9c2 = { |
|
value: row[opts.groupField], |
|
rows: [row], |
|
startIndex: _9c1.data.rows.length |
|
}; |
|
_9c3 = this.groups.length; |
|
dc.body1.append(this.renderGroup.call(this, _9bf, _9c3, _9c2, true)); |
|
dc.body2.append(this.renderGroup.call(this, _9bf, _9c3, _9c2, false)); |
|
this.groups.push(_9c2); |
|
_9c1.data.rows.push(row); |
|
} |
|
this.setGroupIndex(_9bf); |
|
this.refreshGroupTitle(_9bf, _9c3); |
|
this.resizeGroup(_9bf); |
|
function _9c4(_9c5, _9c6) { |
|
var _9c7 = _9c6 ? 1 : 2; |
|
var _9c8 = opts.finder.getTr(_9bf, _9c5 - 1, "body", _9c7); |
|
var tr = opts.finder.getTr(_9bf, _9c5, "body", _9c7); |
|
tr.insertAfter(_9c8); |
|
}; |
|
}, |
|
updateRow: function (_9c9, _9ca, row) { |
|
var opts = $.data(_9c9, "datagrid").options; |
|
$.fn.datagrid.defaults.view.updateRow.call(this, _9c9, _9ca, row); |
|
var tb = opts.finder.getTr(_9c9, _9ca, "body", 2).closest("table.datagrid-btable"); |
|
var _9cb = parseInt(tb.prev().attr("group-index")); |
|
this.refreshGroupTitle(_9c9, _9cb); |
|
}, |
|
deleteRow: function (_9cc, _9cd) { |
|
var _9ce = $.data(_9cc, "datagrid"); |
|
var opts = _9ce.options; |
|
var dc = _9ce.dc; |
|
var body = dc.body1.add(dc.body2); |
|
var tb = opts.finder.getTr(_9cc, _9cd, "body", 2).closest("table.datagrid-btable"); |
|
var _9cf = parseInt(tb.prev().attr("group-index")); |
|
$.fn.datagrid.defaults.view.deleteRow.call(this, _9cc, _9cd); |
|
var _9d0 = this.groups[_9cf]; |
|
if (_9d0.rows.length > 1) { |
|
_9d0.rows.splice(_9cd - _9d0.startIndex, 1); |
|
this.refreshGroupTitle(_9cc, _9cf); |
|
} else { |
|
body.children("div.datagrid-group[group-index=" + _9cf + "]").remove(); |
|
for (var i = _9cf + 1; i < this.groups.length; i++) { |
|
body.children("div.datagrid-group[group-index=" + i + "]").attr("group-index", i - 1); |
|
} |
|
this.groups.splice(_9cf, 1); |
|
} |
|
this.setGroupIndex(_9cc); |
|
}, |
|
setGroupIndex: function (_9d1) { |
|
var _9d2 = 0; |
|
for (var i = 0; i < this.groups.length; i++) { |
|
var _9d3 = this.groups[i]; |
|
_9d3.startIndex = _9d2; |
|
_9d2 += _9d3.rows.length; |
|
} |
|
} |
|
}); |
|
$.fn.propertygrid.defaults = $.extend({}, $.fn.datagrid.defaults, { |
|
groupHeight: 28, |
|
expanderWidth: 20, |
|
singleSelect: true, |
|
remoteSort: false, |
|
fitColumns: true, |
|
loadMsg: "", |
|
frozenColumns: [[{ |
|
field: "f", |
|
width: 20, |
|
resizable: false |
|
} |
|
]], |
|
columns: [[{ |
|
field: "name", |
|
title: "Name", |
|
width: 100, |
|
sortable: true |
|
}, { |
|
field: "value", |
|
title: "Value", |
|
width: 100, |
|
resizable: false |
|
} |
|
]], |
|
showGroup: false, |
|
groupView: _97f, |
|
groupField: "group", |
|
groupStyler: function (_9d4, rows) { |
|
return ""; |
|
}, |
|
groupFormatter: function (_9d5, rows) { |
|
return _9d5; |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _9d6(_9d7) { |
|
var _9d8 = $.data(_9d7, "treegrid"); |
|
var opts = _9d8.options; |
|
$(_9d7).datagrid($.extend({}, opts, { |
|
url: null, |
|
data: null, |
|
loader: function () { |
|
return false; |
|
}, |
|
onBeforeLoad: function () { |
|
return false; |
|
}, |
|
onLoadSuccess: function () {}, |
|
onResizeColumn: function (_9d9, _9da) { |
|
_9e7(_9d7); |
|
opts.onResizeColumn.call(_9d7, _9d9, _9da); |
|
}, |
|
onBeforeSortColumn: function (sort, _9db) { |
|
if (opts.onBeforeSortColumn.call(_9d7, sort, _9db) == false) { |
|
return false; |
|
} |
|
}, |
|
onSortColumn: function (sort, _9dc) { |
|
opts.sortName = sort; |
|
opts.sortOrder = _9dc; |
|
if (opts.remoteSort) { |
|
_9e6(_9d7); |
|
} else { |
|
var data = $(_9d7).treegrid("getData"); |
|
_a15(_9d7, null, data); |
|
} |
|
opts.onSortColumn.call(_9d7, sort, _9dc); |
|
}, |
|
onClickCell: function (_9dd, _9de) { |
|
opts.onClickCell.call(_9d7, _9de, find(_9d7, _9dd)); |
|
}, |
|
onDblClickCell: function (_9df, _9e0) { |
|
opts.onDblClickCell.call(_9d7, _9e0, find(_9d7, _9df)); |
|
}, |
|
onRowContextMenu: function (e, _9e1) { |
|
opts.onContextMenu.call(_9d7, e, find(_9d7, _9e1)); |
|
} |
|
})); |
|
var _9e2 = $.data(_9d7, "datagrid").options; |
|
opts.columns = _9e2.columns; |
|
opts.frozenColumns = _9e2.frozenColumns; |
|
_9d8.dc = $.data(_9d7, "datagrid").dc; |
|
if (opts.pagination) { |
|
var _9e3 = $(_9d7).datagrid("getPager"); |
|
_9e3.pagination({ |
|
total: 0, |
|
pageNumber: opts.pageNumber, |
|
pageSize: opts.pageSize, |
|
pageList: opts.pageList, |
|
onSelectPage: function (_9e4, _9e5) { |
|
opts.pageNumber = _9e4 || 1; |
|
opts.pageSize = _9e5; |
|
_9e3.pagination("refresh", { |
|
pageNumber: _9e4, |
|
pageSize: _9e5 |
|
}); |
|
_9e6(_9d7); |
|
} |
|
}); |
|
opts.pageSize = _9e3.pagination("options").pageSize; |
|
} |
|
}; |
|
function _9e7(_9e8, _9e9) { |
|
var opts = $.data(_9e8, "datagrid").options; |
|
var dc = $.data(_9e8, "datagrid").dc; |
|
if (!dc.body1.is(":empty") && (!opts.nowrap || opts.autoRowHeight)) { |
|
if (_9e9 != undefined) { |
|
var _9ea = _9eb(_9e8, _9e9); |
|
for (var i = 0; i < _9ea.length; i++) { |
|
_9ec(_9ea[i][opts.idField]); |
|
} |
|
} |
|
} |
|
$(_9e8).datagrid("fixRowHeight", _9e9); |
|
function _9ec(_9ed) { |
|
var tr1 = opts.finder.getTr(_9e8, _9ed, "body", 1); |
|
var tr2 = opts.finder.getTr(_9e8, _9ed, "body", 2); |
|
tr1.css("height", ""); |
|
tr2.css("height", ""); |
|
var _9ee = Math.max(tr1.height(), tr2.height()); |
|
tr1.css("height", _9ee); |
|
tr2.css("height", _9ee); |
|
}; |
|
}; |
|
function _9ef(_9f0) { |
|
var dc = $.data(_9f0, "datagrid").dc; |
|
var opts = $.data(_9f0, "treegrid").options; |
|
if (!opts.rownumbers) { |
|
return; |
|
} |
|
dc.body1.find("div.datagrid-cell-rownumber").each(function (i) { |
|
$(this).html(i + 1); |
|
}); |
|
}; |
|
function _9f1(_9f2) { |
|
return function (e) { |
|
$.fn.datagrid.defaults.rowEvents[_9f2 ? "mouseover" : "mouseout"](e); |
|
var tt = $(e.target); |
|
var fn = _9f2 ? "addClass" : "removeClass"; |
|
if (tt.hasClass("tree-hit")) { |
|
tt.hasClass("tree-expanded") ? tt[fn]("tree-expanded-hover") : tt[fn]("tree-collapsed-hover"); |
|
} |
|
}; |
|
}; |
|
function _9f3(e) { |
|
var tt = $(e.target); |
|
var tr = tt.closest("tr.datagrid-row"); |
|
if (!tr.length || !tr.parent().length) { |
|
return; |
|
} |
|
var _9f4 = tr.attr("node-id"); |
|
var _9f5 = _9f6(tr); |
|
if (tt.hasClass("tree-hit")) { |
|
_9f7(_9f5, _9f4); |
|
} else { |
|
if (tt.hasClass("tree-checkbox")) { |
|
_9f8(_9f5, _9f4); |
|
} else { |
|
var opts = $(_9f5).datagrid("options"); |
|
if (!tt.parent().hasClass("datagrid-cell-check") && !opts.singleSelect && e.shiftKey) { |
|
var rows = $(_9f5).treegrid("getChildren"); |
|
var idx1 = $.easyui.indexOfArray(rows, opts.idField, opts.lastSelectedIndex); |
|
var idx2 = $.easyui.indexOfArray(rows, opts.idField, _9f4); |
|
var from = Math.min(Math.max(idx1, 0), idx2); |
|
var to = Math.max(idx1, idx2); |
|
var row = rows[idx2]; |
|
var td = tt.closest("td[field]", tr); |
|
if (td.length) { |
|
var _9f9 = td.attr("field"); |
|
opts.onClickCell.call(_9f5, _9f4, _9f9, row[_9f9]); |
|
} |
|
$(_9f5).treegrid("clearSelections"); |
|
for (var i = from; i <= to; i++) { |
|
$(_9f5).treegrid("selectRow", rows[i][opts.idField]); |
|
} |
|
opts.onClickRow.call(_9f5, row); |
|
} else { |
|
$.fn.datagrid.defaults.rowEvents.click(e); |
|
} |
|
} |
|
} |
|
}; |
|
function _9f6(t) { |
|
return $(t).closest("div.datagrid-view").children(".datagrid-f")[0]; |
|
}; |
|
function _9f8(_9fa, _9fb, _9fc, _9fd) { |
|
var _9fe = $.data(_9fa, "treegrid"); |
|
var _9ff = _9fe.checkedRows; |
|
var opts = _9fe.options; |
|
if (!opts.checkbox) { |
|
return; |
|
} |
|
var row = find(_9fa, _9fb); |
|
if (!row.checkState) { |
|
return; |
|
} |
|
var tr = opts.finder.getTr(_9fa, _9fb); |
|
var ck = tr.find(".tree-checkbox"); |
|
if (_9fc == undefined) { |
|
if (ck.hasClass("tree-checkbox1")) { |
|
_9fc = false; |
|
} else { |
|
if (ck.hasClass("tree-checkbox0")) { |
|
_9fc = true; |
|
} else { |
|
if (row._checked == undefined) { |
|
row._checked = ck.hasClass("tree-checkbox1"); |
|
} |
|
_9fc = !row._checked; |
|
} |
|
} |
|
} |
|
row._checked = _9fc; |
|
if (_9fc) { |
|
if (ck.hasClass("tree-checkbox1")) { |
|
return; |
|
} |
|
} else { |
|
if (ck.hasClass("tree-checkbox0")) { |
|
return; |
|
} |
|
} |
|
if (!_9fd) { |
|
if (opts.onBeforeCheckNode.call(_9fa, row, _9fc) == false) { |
|
return; |
|
} |
|
} |
|
if (opts.cascadeCheck) { |
|
_a00(_9fa, row, _9fc); |
|
_a01(_9fa, row); |
|
} else { |
|
_a02(_9fa, row, _9fc ? "1" : "0"); |
|
} |
|
if (!_9fd) { |
|
opts.onCheckNode.call(_9fa, row, _9fc); |
|
} |
|
}; |
|
function _a02(_a03, row, flag) { |
|
var _a04 = $.data(_a03, "treegrid"); |
|
var _a05 = _a04.checkedRows; |
|
var opts = _a04.options; |
|
if (!row.checkState || flag == undefined) { |
|
return; |
|
} |
|
var tr = opts.finder.getTr(_a03, row[opts.idField]); |
|
var ck = tr.find(".tree-checkbox"); |
|
if (!ck.length) { |
|
return; |
|
} |
|
row.checkState = ["unchecked", "checked", "indeterminate"][flag]; |
|
row.checked = (row.checkState == "checked"); |
|
ck.removeClass("tree-checkbox0 tree-checkbox1 tree-checkbox2"); |
|
ck.addClass("tree-checkbox" + flag); |
|
if (flag == 0) { |
|
$.easyui.removeArrayItem(_a05, opts.idField, row[opts.idField]); |
|
} else { |
|
$.easyui.addArrayItem(_a05, opts.idField, row); |
|
} |
|
}; |
|
function _a00(_a06, row, _a07) { |
|
var flag = _a07 ? 1 : 0; |
|
_a02(_a06, row, flag); |
|
$.easyui.forEach(row.children || [], true, function (r) { |
|
_a02(_a06, r, flag); |
|
}); |
|
}; |
|
function _a01(_a08, row) { |
|
var opts = $.data(_a08, "treegrid").options; |
|
var prow = _a09(_a08, row[opts.idField]); |
|
if (prow) { |
|
_a02(_a08, prow, _a0a(prow)); |
|
_a01(_a08, prow); |
|
} |
|
}; |
|
function _a0a(row) { |
|
var len = 0; |
|
var c0 = 0; |
|
var c1 = 0; |
|
$.easyui.forEach(row.children || [], false, function (r) { |
|
if (r.checkState) { |
|
len++; |
|
if (r.checkState == "checked") { |
|
c1++; |
|
} else { |
|
if (r.checkState == "unchecked") { |
|
c0++; |
|
} |
|
} |
|
} |
|
}); |
|
if (len == 0) { |
|
return undefined; |
|
} |
|
var flag = 0; |
|
if (c0 == len) { |
|
flag = 0; |
|
} else { |
|
if (c1 == len) { |
|
flag = 1; |
|
} else { |
|
flag = 2; |
|
} |
|
} |
|
return flag; |
|
}; |
|
function _a0b(_a0c, _a0d) { |
|
var opts = $.data(_a0c, "treegrid").options; |
|
if (!opts.checkbox) { |
|
return; |
|
} |
|
var row = find(_a0c, _a0d); |
|
var tr = opts.finder.getTr(_a0c, _a0d); |
|
var ck = tr.find(".tree-checkbox"); |
|
if (opts.view.hasCheckbox(_a0c, row)) { |
|
if (!ck.length) { |
|
row.checkState = row.checkState || "unchecked"; |
|
$("<span class=\"tree-checkbox\"></span>").insertBefore(tr.find(".tree-title")); |
|
} |
|
if (row.checkState == "checked") { |
|
_9f8(_a0c, _a0d, true, true); |
|
} else { |
|
if (row.checkState == "unchecked") { |
|
_9f8(_a0c, _a0d, false, true); |
|
} else { |
|
var flag = _a0a(row); |
|
if (flag === 0) { |
|
_9f8(_a0c, _a0d, false, true); |
|
} else { |
|
if (flag === 1) { |
|
_9f8(_a0c, _a0d, true, true); |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
ck.remove(); |
|
row.checkState = undefined; |
|
row.checked = undefined; |
|
_a01(_a0c, row); |
|
} |
|
}; |
|
function _a0e(_a0f, _a10) { |
|
var opts = $.data(_a0f, "treegrid").options; |
|
var tr1 = opts.finder.getTr(_a0f, _a10, "body", 1); |
|
var tr2 = opts.finder.getTr(_a0f, _a10, "body", 2); |
|
var _a11 = $(_a0f).datagrid("getColumnFields", true).length + (opts.rownumbers ? 1 : 0); |
|
var _a12 = $(_a0f).datagrid("getColumnFields", false).length; |
|
_a13(tr1, _a11); |
|
_a13(tr2, _a12); |
|
function _a13(tr, _a14) { |
|
$("<tr class=\"treegrid-tr-tree\">" + "<td style=\"border:0px\" colspan=\"" + _a14 + "\">" + "<div></div>" + "</td>" + "</tr>").insertAfter(tr); |
|
}; |
|
}; |
|
function _a15(_a16, _a17, data, _a18, _a19) { |
|
var _a1a = $.data(_a16, "treegrid"); |
|
var opts = _a1a.options; |
|
var dc = _a1a.dc; |
|
data = opts.loadFilter.call(_a16, data, _a17); |
|
var node = find(_a16, _a17); |
|
if (node) { |
|
var _a1b = opts.finder.getTr(_a16, _a17, "body", 1); |
|
var _a1c = opts.finder.getTr(_a16, _a17, "body", 2); |
|
var cc1 = _a1b.next("tr.treegrid-tr-tree").children("td").children("div"); |
|
var cc2 = _a1c.next("tr.treegrid-tr-tree").children("td").children("div"); |
|
if (!_a18) { |
|
node.children = []; |
|
} |
|
} else { |
|
var cc1 = dc.body1; |
|
var cc2 = dc.body2; |
|
if (!_a18) { |
|
_a1a.data = []; |
|
} |
|
} |
|
if (!_a18) { |
|
cc1.empty(); |
|
cc2.empty(); |
|
} |
|
if (opts.view.onBeforeRender) { |
|
opts.view.onBeforeRender.call(opts.view, _a16, _a17, data); |
|
} |
|
opts.view.render.call(opts.view, _a16, cc1, true); |
|
opts.view.render.call(opts.view, _a16, cc2, false); |
|
if (opts.showFooter) { |
|
opts.view.renderFooter.call(opts.view, _a16, dc.footer1, true); |
|
opts.view.renderFooter.call(opts.view, _a16, dc.footer2, false); |
|
} |
|
if (opts.view.onAfterRender) { |
|
opts.view.onAfterRender.call(opts.view, _a16); |
|
} |
|
if (!_a17 && opts.pagination) { |
|
var _a1d = $.data(_a16, "treegrid").total; |
|
var _a1e = $(_a16).datagrid("getPager"); |
|
var _a1f = _a1e.pagination("options"); |
|
if (_a1f.total != data.total) { |
|
_a1e.pagination("refresh", { |
|
pageNumber: opts.pageNumber, |
|
total: data.total |
|
}); |
|
if (opts.pageNumber != _a1f.pageNumber && _a1f.pageNumber > 0) { |
|
opts.pageNumber = _a1f.pageNumber; |
|
_9e6(_a16); |
|
} |
|
} |
|
} |
|
_9e7(_a16); |
|
_9ef(_a16); |
|
$(_a16).treegrid("showLines"); |
|
$(_a16).treegrid("setSelectionState"); |
|
$(_a16).treegrid("autoSizeColumn"); |
|
if (!_a19) { |
|
opts.onLoadSuccess.call(_a16, node, data); |
|
} |
|
}; |
|
function _9e6(_a20, _a21, _a22, _a23, _a24) { |
|
var opts = $.data(_a20, "treegrid").options; |
|
var body = $(_a20).datagrid("getPanel").find("div.datagrid-body"); |
|
if (_a21 == undefined && opts.queryParams) { |
|
opts.queryParams.id = undefined; |
|
} |
|
if (_a22) { |
|
opts.queryParams = _a22; |
|
} |
|
var _a25 = $.extend({}, opts.queryParams); |
|
if (opts.pagination) { |
|
$.extend(_a25, { |
|
page: opts.pageNumber, |
|
rows: opts.pageSize |
|
}); |
|
} |
|
if (opts.sortName) { |
|
$.extend(_a25, { |
|
sort: opts.sortName, |
|
order: opts.sortOrder |
|
}); |
|
} |
|
var row = find(_a20, _a21); |
|
if (opts.onBeforeLoad.call(_a20, row, _a25) == false) { |
|
return; |
|
} |
|
var _a26 = body.find("tr[node-id=\"" + _a21 + "\"] span.tree-folder"); |
|
_a26.addClass("tree-loading"); |
|
$(_a20).treegrid("loading"); |
|
var _a27 = opts.loader.call(_a20, _a25, function (data) { |
|
_a26.removeClass("tree-loading"); |
|
$(_a20).treegrid("loaded"); |
|
_a15(_a20, _a21, data, _a23); |
|
if (_a24) { |
|
_a24(); |
|
} |
|
}, function () { |
|
_a26.removeClass("tree-loading"); |
|
$(_a20).treegrid("loaded"); |
|
opts.onLoadError.apply(_a20, arguments); |
|
if (_a24) { |
|
_a24(); |
|
} |
|
}); |
|
if (_a27 == false) { |
|
_a26.removeClass("tree-loading"); |
|
$(_a20).treegrid("loaded"); |
|
} |
|
}; |
|
function _a28(_a29) { |
|
var _a2a = _a2b(_a29); |
|
return _a2a.length ? _a2a[0] : null; |
|
}; |
|
function _a2b(_a2c) { |
|
return $.data(_a2c, "treegrid").data; |
|
}; |
|
function _a09(_a2d, _a2e) { |
|
var row = find(_a2d, _a2e); |
|
if (row._parentId) { |
|
return find(_a2d, row._parentId); |
|
} else { |
|
return null; |
|
} |
|
}; |
|
function _9eb(_a2f, _a30) { |
|
var data = $.data(_a2f, "treegrid").data; |
|
if (_a30) { |
|
var _a31 = find(_a2f, _a30); |
|
data = _a31 ? (_a31.children || []) : []; |
|
} |
|
var _a32 = []; |
|
$.easyui.forEach(data, true, function (node) { |
|
_a32.push(node); |
|
}); |
|
return _a32; |
|
}; |
|
function _a33(_a34, _a35) { |
|
var opts = $.data(_a34, "treegrid").options; |
|
var tr = opts.finder.getTr(_a34, _a35); |
|
var node = tr.children("td[field=\"" + opts.treeField + "\"]"); |
|
return node.find("span.tree-indent,span.tree-hit").length; |
|
}; |
|
function find(_a36, _a37) { |
|
var _a38 = $.data(_a36, "treegrid"); |
|
var opts = _a38.options; |
|
var _a39 = null; |
|
$.easyui.forEach(_a38.data, true, function (node) { |
|
if (node[opts.idField] == _a37) { |
|
_a39 = node; |
|
return false; |
|
} |
|
}); |
|
return _a39; |
|
}; |
|
function _a3a(_a3b, _a3c) { |
|
var opts = $.data(_a3b, "treegrid").options; |
|
var row = find(_a3b, _a3c); |
|
var tr = opts.finder.getTr(_a3b, _a3c); |
|
var hit = tr.find("span.tree-hit"); |
|
if (hit.length == 0) { |
|
return; |
|
} |
|
if (hit.hasClass("tree-collapsed")) { |
|
return; |
|
} |
|
if (opts.onBeforeCollapse.call(_a3b, row) == false) { |
|
return; |
|
} |
|
hit.removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); |
|
hit.next().removeClass("tree-folder-open"); |
|
row.state = "closed"; |
|
tr = tr.next("tr.treegrid-tr-tree"); |
|
var cc = tr.children("td").children("div"); |
|
if (opts.animate) { |
|
cc.slideUp("normal", function () { |
|
$(_a3b).treegrid("autoSizeColumn"); |
|
_9e7(_a3b, _a3c); |
|
opts.onCollapse.call(_a3b, row); |
|
}); |
|
} else { |
|
cc.hide(); |
|
$(_a3b).treegrid("autoSizeColumn"); |
|
_9e7(_a3b, _a3c); |
|
opts.onCollapse.call(_a3b, row); |
|
} |
|
}; |
|
function _a3d(_a3e, _a3f) { |
|
var opts = $.data(_a3e, "treegrid").options; |
|
var tr = opts.finder.getTr(_a3e, _a3f); |
|
var hit = tr.find("span.tree-hit"); |
|
var row = find(_a3e, _a3f); |
|
if (hit.length == 0) { |
|
return; |
|
} |
|
if (hit.hasClass("tree-expanded")) { |
|
return; |
|
} |
|
if (opts.onBeforeExpand.call(_a3e, row) == false) { |
|
return; |
|
} |
|
hit.removeClass("tree-collapsed tree-collapsed-hover").addClass("tree-expanded"); |
|
hit.next().addClass("tree-folder-open"); |
|
var _a40 = tr.next("tr.treegrid-tr-tree"); |
|
if (_a40.length) { |
|
var cc = _a40.children("td").children("div"); |
|
_a41(cc); |
|
} else { |
|
_a0e(_a3e, row[opts.idField]); |
|
var _a40 = tr.next("tr.treegrid-tr-tree"); |
|
var cc = _a40.children("td").children("div"); |
|
cc.hide(); |
|
var _a42 = $.extend({}, opts.queryParams || {}); |
|
_a42.id = row[opts.idField]; |
|
_9e6(_a3e, row[opts.idField], _a42, true, function () { |
|
if (cc.is(":empty")) { |
|
_a40.remove(); |
|
} else { |
|
_a41(cc); |
|
} |
|
}); |
|
} |
|
function _a41(cc) { |
|
row.state = "open"; |
|
if (opts.animate) { |
|
cc.slideDown("normal", function () { |
|
$(_a3e).treegrid("autoSizeColumn"); |
|
_9e7(_a3e, _a3f); |
|
opts.onExpand.call(_a3e, row); |
|
}); |
|
} else { |
|
cc.show(); |
|
$(_a3e).treegrid("autoSizeColumn"); |
|
_9e7(_a3e, _a3f); |
|
opts.onExpand.call(_a3e, row); |
|
} |
|
}; |
|
}; |
|
function _9f7(_a43, _a44) { |
|
var opts = $.data(_a43, "treegrid").options; |
|
var tr = opts.finder.getTr(_a43, _a44); |
|
var hit = tr.find("span.tree-hit"); |
|
if (hit.hasClass("tree-expanded")) { |
|
_a3a(_a43, _a44); |
|
} else { |
|
_a3d(_a43, _a44); |
|
} |
|
}; |
|
function _a45(_a46, _a47) { |
|
var opts = $.data(_a46, "treegrid").options; |
|
var _a48 = _9eb(_a46, _a47); |
|
if (_a47) { |
|
_a48.unshift(find(_a46, _a47)); |
|
} |
|
for (var i = 0; i < _a48.length; i++) { |
|
_a3a(_a46, _a48[i][opts.idField]); |
|
} |
|
}; |
|
function _a49(_a4a, _a4b) { |
|
var opts = $.data(_a4a, "treegrid").options; |
|
var _a4c = _9eb(_a4a, _a4b); |
|
if (_a4b) { |
|
_a4c.unshift(find(_a4a, _a4b)); |
|
} |
|
for (var i = 0; i < _a4c.length; i++) { |
|
_a3d(_a4a, _a4c[i][opts.idField]); |
|
} |
|
}; |
|
function _a4d(_a4e, _a4f) { |
|
var opts = $.data(_a4e, "treegrid").options; |
|
var ids = []; |
|
var p = _a09(_a4e, _a4f); |
|
while (p) { |
|
var id = p[opts.idField]; |
|
ids.unshift(id); |
|
p = _a09(_a4e, id); |
|
} |
|
for (var i = 0; i < ids.length; i++) { |
|
_a3d(_a4e, ids[i]); |
|
} |
|
}; |
|
function _a50(_a51, _a52) { |
|
var _a53 = $.data(_a51, "treegrid"); |
|
var opts = _a53.options; |
|
if (_a52.parent) { |
|
var tr = opts.finder.getTr(_a51, _a52.parent); |
|
if (tr.next("tr.treegrid-tr-tree").length == 0) { |
|
_a0e(_a51, _a52.parent); |
|
} |
|
var cell = tr.children("td[field=\"" + opts.treeField + "\"]").children("div.datagrid-cell"); |
|
var _a54 = cell.children("span.tree-icon"); |
|
if (_a54.hasClass("tree-file")) { |
|
_a54.removeClass("tree-file").addClass("tree-folder tree-folder-open"); |
|
var hit = $("<span class=\"tree-hit tree-expanded\"></span>").insertBefore(_a54); |
|
if (hit.prev().length) { |
|
hit.prev().remove(); |
|
} |
|
} |
|
} |
|
_a15(_a51, _a52.parent, _a52.data, _a53.data.length > 0, true); |
|
}; |
|
function _a55(_a56, _a57) { |
|
var ref = _a57.before || _a57.after; |
|
var opts = $.data(_a56, "treegrid").options; |
|
var _a58 = _a09(_a56, ref); |
|
_a50(_a56, { |
|
parent: (_a58 ? _a58[opts.idField] : null), |
|
data: [_a57.data] |
|
}); |
|
var _a59 = _a58 ? _a58.children : $(_a56).treegrid("getRoots"); |
|
for (var i = 0; i < _a59.length; i++) { |
|
if (_a59[i][opts.idField] == ref) { |
|
var _a5a = _a59[_a59.length - 1]; |
|
_a59.splice(_a57.before ? i : (i + 1), 0, _a5a); |
|
_a59.splice(_a59.length - 1, 1); |
|
break; |
|
} |
|
} |
|
_a5b(true); |
|
_a5b(false); |
|
_9ef(_a56); |
|
$(_a56).treegrid("showLines"); |
|
function _a5b(_a5c) { |
|
var _a5d = _a5c ? 1 : 2; |
|
var tr = opts.finder.getTr(_a56, _a57.data[opts.idField], "body", _a5d); |
|
var _a5e = tr.closest("table.datagrid-btable"); |
|
tr = tr.parent().children(); |
|
var dest = opts.finder.getTr(_a56, ref, "body", _a5d); |
|
if (_a57.before) { |
|
tr.insertBefore(dest); |
|
} else { |
|
var sub = dest.next("tr.treegrid-tr-tree"); |
|
tr.insertAfter(sub.length ? sub : dest); |
|
} |
|
_a5e.remove(); |
|
}; |
|
}; |
|
function _a5f(_a60, _a61) { |
|
var _a62 = $.data(_a60, "treegrid"); |
|
var opts = _a62.options; |
|
var prow = _a09(_a60, _a61); |
|
$(_a60).datagrid("deleteRow", _a61); |
|
$.easyui.removeArrayItem(_a62.checkedRows, opts.idField, _a61); |
|
_9ef(_a60); |
|
if (prow) { |
|
_a0b(_a60, prow[opts.idField]); |
|
} |
|
_a62.total -= 1; |
|
$(_a60).datagrid("getPager").pagination("refresh", { |
|
total: _a62.total |
|
}); |
|
$(_a60).treegrid("showLines"); |
|
}; |
|
function _a63(_a64) { |
|
var t = $(_a64); |
|
var opts = t.treegrid("options"); |
|
if (opts.lines) { |
|
t.treegrid("getPanel").addClass("tree-lines"); |
|
} else { |
|
t.treegrid("getPanel").removeClass("tree-lines"); |
|
return; |
|
} |
|
t.treegrid("getPanel").find("span.tree-indent").removeClass("tree-line tree-join tree-joinbottom"); |
|
t.treegrid("getPanel").find("div.datagrid-cell").removeClass("tree-node-last tree-root-first tree-root-one"); |
|
var _a65 = t.treegrid("getRoots"); |
|
if (_a65.length > 1) { |
|
_a66(_a65[0]).addClass("tree-root-first"); |
|
} else { |
|
if (_a65.length == 1) { |
|
_a66(_a65[0]).addClass("tree-root-one"); |
|
} |
|
} |
|
_a67(_a65); |
|
_a68(_a65); |
|
function _a67(_a69) { |
|
$.map(_a69, function (node) { |
|
if (node.children && node.children.length) { |
|
_a67(node.children); |
|
} else { |
|
var cell = _a66(node); |
|
cell.find(".tree-icon").prev().addClass("tree-join"); |
|
} |
|
}); |
|
if (_a69.length) { |
|
var cell = _a66(_a69[_a69.length - 1]); |
|
cell.addClass("tree-node-last"); |
|
cell.find(".tree-join").removeClass("tree-join").addClass("tree-joinbottom"); |
|
} |
|
}; |
|
function _a68(_a6a) { |
|
$.map(_a6a, function (node) { |
|
if (node.children && node.children.length) { |
|
_a68(node.children); |
|
} |
|
}); |
|
for (var i = 0; i < _a6a.length - 1; i++) { |
|
var node = _a6a[i]; |
|
var _a6b = t.treegrid("getLevel", node[opts.idField]); |
|
var tr = opts.finder.getTr(_a64, node[opts.idField]); |
|
var cc = tr.next().find("tr.datagrid-row td[field=\"" + opts.treeField + "\"] div.datagrid-cell"); |
|
cc.find("span:eq(" + (_a6b - 1) + ")").addClass("tree-line"); |
|
} |
|
}; |
|
function _a66(node) { |
|
var tr = opts.finder.getTr(_a64, node[opts.idField]); |
|
var cell = tr.find("td[field=\"" + opts.treeField + "\"] div.datagrid-cell"); |
|
return cell; |
|
}; |
|
}; |
|
$.fn.treegrid = function (_a6c, _a6d) { |
|
if (typeof _a6c == "string") { |
|
var _a6e = $.fn.treegrid.methods[_a6c]; |
|
if (_a6e) { |
|
return _a6e(this, _a6d); |
|
} else { |
|
return this.datagrid(_a6c, _a6d); |
|
} |
|
} |
|
_a6c = _a6c || {}; |
|
return this.each(function () { |
|
var _a6f = $.data(this, "treegrid"); |
|
if (_a6f) { |
|
$.extend(_a6f.options, _a6c); |
|
} else { |
|
_a6f = $.data(this, "treegrid", { |
|
options: $.extend({}, $.fn.treegrid.defaults, $.fn.treegrid.parseOptions(this), _a6c), |
|
data: [], |
|
checkedRows: [], |
|
tmpIds: [] |
|
}); |
|
} |
|
_9d6(this); |
|
if (_a6f.options.data) { |
|
$(this).treegrid("loadData", _a6f.options.data); |
|
} |
|
_9e6(this); |
|
}); |
|
}; |
|
$.fn.treegrid.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "treegrid").options; |
|
}, |
|
resize: function (jq, _a70) { |
|
return jq.each(function () { |
|
$(this).datagrid("resize", _a70); |
|
}); |
|
}, |
|
fixRowHeight: function (jq, _a71) { |
|
return jq.each(function () { |
|
_9e7(this, _a71); |
|
}); |
|
}, |
|
loadData: function (jq, data) { |
|
return jq.each(function () { |
|
_a15(this, data.parent, data); |
|
}); |
|
}, |
|
load: function (jq, _a72) { |
|
return jq.each(function () { |
|
$(this).treegrid("options").pageNumber = 1; |
|
$(this).treegrid("getPager").pagination({ |
|
pageNumber: 1 |
|
}); |
|
$(this).treegrid("reload", _a72); |
|
}); |
|
}, |
|
reload: function (jq, id) { |
|
return jq.each(function () { |
|
var opts = $(this).treegrid("options"); |
|
var _a73 = {}; |
|
if (typeof id == "object") { |
|
_a73 = id; |
|
} else { |
|
_a73 = $.extend({}, opts.queryParams); |
|
_a73.id = id; |
|
} |
|
if (_a73.id) { |
|
var node = $(this).treegrid("find", _a73.id); |
|
if (node.children) { |
|
node.children.splice(0, node.children.length); |
|
} |
|
opts.queryParams = _a73; |
|
var tr = opts.finder.getTr(this, _a73.id); |
|
tr.next("tr.treegrid-tr-tree").remove(); |
|
tr.find("span.tree-hit").removeClass("tree-expanded tree-expanded-hover").addClass("tree-collapsed"); |
|
_a3d(this, _a73.id); |
|
} else { |
|
_9e6(this, null, _a73); |
|
} |
|
}); |
|
}, |
|
reloadFooter: function (jq, _a74) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "treegrid").options; |
|
var dc = $.data(this, "datagrid").dc; |
|
if (_a74) { |
|
$.data(this, "treegrid").footer = _a74; |
|
} |
|
if (opts.showFooter) { |
|
opts.view.renderFooter.call(opts.view, this, dc.footer1, true); |
|
opts.view.renderFooter.call(opts.view, this, dc.footer2, false); |
|
if (opts.view.onAfterRender) { |
|
opts.view.onAfterRender.call(opts.view, this); |
|
} |
|
$(this).treegrid("fixRowHeight"); |
|
} |
|
}); |
|
}, |
|
getData: function (jq) { |
|
return $.data(jq[0], "treegrid").data; |
|
}, |
|
getFooterRows: function (jq) { |
|
return $.data(jq[0], "treegrid").footer; |
|
}, |
|
getRoot: function (jq) { |
|
return _a28(jq[0]); |
|
}, |
|
getRoots: function (jq) { |
|
return _a2b(jq[0]); |
|
}, |
|
getParent: function (jq, id) { |
|
return _a09(jq[0], id); |
|
}, |
|
getChildren: function (jq, id) { |
|
return _9eb(jq[0], id); |
|
}, |
|
getLevel: function (jq, id) { |
|
return _a33(jq[0], id); |
|
}, |
|
find: function (jq, id) { |
|
return find(jq[0], id); |
|
}, |
|
isLeaf: function (jq, id) { |
|
var opts = $.data(jq[0], "treegrid").options; |
|
var tr = opts.finder.getTr(jq[0], id); |
|
var hit = tr.find("span.tree-hit"); |
|
return hit.length == 0; |
|
}, |
|
select: function (jq, id) { |
|
return jq.each(function () { |
|
$(this).datagrid("selectRow", id); |
|
}); |
|
}, |
|
unselect: function (jq, id) { |
|
return jq.each(function () { |
|
$(this).datagrid("unselectRow", id); |
|
}); |
|
}, |
|
collapse: function (jq, id) { |
|
return jq.each(function () { |
|
_a3a(this, id); |
|
}); |
|
}, |
|
expand: function (jq, id) { |
|
return jq.each(function () { |
|
_a3d(this, id); |
|
}); |
|
}, |
|
toggle: function (jq, id) { |
|
return jq.each(function () { |
|
_9f7(this, id); |
|
}); |
|
}, |
|
collapseAll: function (jq, id) { |
|
return jq.each(function () { |
|
_a45(this, id); |
|
}); |
|
}, |
|
expandAll: function (jq, id) { |
|
return jq.each(function () { |
|
_a49(this, id); |
|
}); |
|
}, |
|
expandTo: function (jq, id) { |
|
return jq.each(function () { |
|
_a4d(this, id); |
|
}); |
|
}, |
|
append: function (jq, _a75) { |
|
return jq.each(function () { |
|
_a50(this, _a75); |
|
}); |
|
}, |
|
insert: function (jq, _a76) { |
|
return jq.each(function () { |
|
_a55(this, _a76); |
|
}); |
|
}, |
|
remove: function (jq, id) { |
|
return jq.each(function () { |
|
_a5f(this, id); |
|
}); |
|
}, |
|
pop: function (jq, id) { |
|
var row = jq.treegrid("find", id); |
|
jq.treegrid("remove", id); |
|
return row; |
|
}, |
|
refresh: function (jq, id) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "treegrid").options; |
|
opts.view.refreshRow.call(opts.view, this, id); |
|
}); |
|
}, |
|
update: function (jq, _a77) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "treegrid").options; |
|
var row = _a77.row; |
|
opts.view.updateRow.call(opts.view, this, _a77.id, row); |
|
if (row.checked != undefined) { |
|
row = find(this, _a77.id); |
|
$.extend(row, { |
|
checkState: row.checked ? "checked" : (row.checked === false ? "unchecked" : undefined) |
|
}); |
|
_a0b(this, _a77.id); |
|
} |
|
}); |
|
}, |
|
beginEdit: function (jq, id) { |
|
return jq.each(function () { |
|
$(this).datagrid("beginEdit", id); |
|
$(this).treegrid("fixRowHeight", id); |
|
}); |
|
}, |
|
endEdit: function (jq, id) { |
|
return jq.each(function () { |
|
$(this).datagrid("endEdit", id); |
|
}); |
|
}, |
|
cancelEdit: function (jq, id) { |
|
return jq.each(function () { |
|
$(this).datagrid("cancelEdit", id); |
|
}); |
|
}, |
|
showLines: function (jq) { |
|
return jq.each(function () { |
|
_a63(this); |
|
}); |
|
}, |
|
setSelectionState: function (jq) { |
|
return jq.each(function () { |
|
$(this).datagrid("setSelectionState"); |
|
var _a78 = $(this).data("treegrid"); |
|
for (var i = 0; i < _a78.tmpIds.length; i++) { |
|
_9f8(this, _a78.tmpIds[i], true, true); |
|
} |
|
_a78.tmpIds = []; |
|
}); |
|
}, |
|
getCheckedNodes: function (jq, _a79) { |
|
_a79 = _a79 || "checked"; |
|
var rows = []; |
|
$.easyui.forEach(jq.data("treegrid").checkedRows, false, function (row) { |
|
if (row.checkState == _a79) { |
|
rows.push(row); |
|
} |
|
}); |
|
return rows; |
|
}, |
|
checkNode: function (jq, id) { |
|
return jq.each(function () { |
|
_9f8(this, id, true); |
|
}); |
|
}, |
|
uncheckNode: function (jq, id) { |
|
return jq.each(function () { |
|
_9f8(this, id, false); |
|
}); |
|
}, |
|
clearChecked: function (jq) { |
|
return jq.each(function () { |
|
var _a7a = this; |
|
var opts = $(_a7a).treegrid("options"); |
|
$(_a7a).datagrid("clearChecked"); |
|
$.map($(_a7a).treegrid("getCheckedNodes"), function (row) { |
|
_9f8(_a7a, row[opts.idField], false, true); |
|
}); |
|
}); |
|
} |
|
}; |
|
$.fn.treegrid.parseOptions = function (_a7b) { |
|
return $.extend({}, $.fn.datagrid.parseOptions(_a7b), $.parser.parseOptions(_a7b, ["treeField", { |
|
checkbox: "boolean", |
|
cascadeCheck: "boolean", |
|
onlyLeafCheck: "boolean" |
|
}, { |
|
animate: "boolean" |
|
} |
|
])); |
|
}; |
|
var _a7c = $.extend({}, $.fn.datagrid.defaults.view, { |
|
render: function (_a7d, _a7e, _a7f) { |
|
var opts = $.data(_a7d, "treegrid").options; |
|
var _a80 = $(_a7d).datagrid("getColumnFields", _a7f); |
|
var _a81 = $.data(_a7d, "datagrid").rowIdPrefix; |
|
if (_a7f) { |
|
if (!(opts.rownumbers || (opts.frozenColumns && opts.frozenColumns.length))) { |
|
return; |
|
} |
|
} |
|
var view = this; |
|
if (this.treeNodes && this.treeNodes.length) { |
|
var _a82 = _a83.call(this, _a7f, this.treeLevel, this.treeNodes); |
|
$(_a7e).append(_a82.join("")); |
|
} |
|
function _a83(_a84, _a85, _a86) { |
|
var _a87 = $(_a7d).treegrid("getParent", _a86[0][opts.idField]); |
|
var _a88 = (_a87 ? _a87.children.length : $(_a7d).treegrid("getRoots").length) - _a86.length; |
|
var _a89 = ["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"]; |
|
for (var i = 0; i < _a86.length; i++) { |
|
var row = _a86[i]; |
|
if (row.state != "open" && row.state != "closed") { |
|
row.state = "open"; |
|
} |
|
var css = opts.rowStyler ? opts.rowStyler.call(_a7d, row) : ""; |
|
var cs = this.getStyleValue(css); |
|
var cls = "class=\"datagrid-row " + (_a88++ % 2 && opts.striped ? "datagrid-row-alt " : " ") + cs.c + "\""; |
|
var _a8a = cs.s ? "style=\"" + cs.s + "\"" : ""; |
|
var _a8b = _a81 + "-" + (_a84 ? 1 : 2) + "-" + row[opts.idField]; |
|
_a89.push("<tr id=\"" + _a8b + "\" node-id=\"" + row[opts.idField] + "\" " + cls + " " + _a8a + ">"); |
|
_a89 = _a89.concat(view.renderRow.call(view, _a7d, _a80, _a84, _a85, row)); |
|
_a89.push("</tr>"); |
|
if (row.children && row.children.length) { |
|
var tt = _a83.call(this, _a84, _a85 + 1, row.children); |
|
var v = row.state == "closed" ? "none" : "block"; |
|
_a89.push("<tr class=\"treegrid-tr-tree\"><td style=\"border:0px\" colspan=" + (_a80.length + (opts.rownumbers ? 1 : 0)) + "><div style=\"display:" + v + "\">"); |
|
_a89 = _a89.concat(tt); |
|
_a89.push("</div></td></tr>"); |
|
} |
|
} |
|
_a89.push("</tbody></table>"); |
|
return _a89; |
|
}; |
|
}, |
|
renderFooter: function (_a8c, _a8d, _a8e) { |
|
var opts = $.data(_a8c, "treegrid").options; |
|
var rows = $.data(_a8c, "treegrid").footer || []; |
|
var _a8f = $(_a8c).datagrid("getColumnFields", _a8e); |
|
var _a90 = ["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"]; |
|
for (var i = 0; i < rows.length; i++) { |
|
var row = rows[i]; |
|
row[opts.idField] = row[opts.idField] || ("foot-row-id" + i); |
|
_a90.push("<tr class=\"datagrid-row\" node-id=\"" + row[opts.idField] + "\">"); |
|
_a90.push(this.renderRow.call(this, _a8c, _a8f, _a8e, 0, row)); |
|
_a90.push("</tr>"); |
|
} |
|
_a90.push("</tbody></table>"); |
|
$(_a8d).html(_a90.join("")); |
|
}, |
|
renderRow: function (_a91, _a92, _a93, _a94, row) { |
|
var _a95 = $.data(_a91, "treegrid"); |
|
var opts = _a95.options; |
|
var cc = []; |
|
if (_a93 && opts.rownumbers) { |
|
cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">0</div></td>"); |
|
} |
|
for (var i = 0; i < _a92.length; i++) { |
|
var _a96 = _a92[i]; |
|
var col = $(_a91).datagrid("getColumnOption", _a96); |
|
if (col) { |
|
var css = col.styler ? (col.styler(row[_a96], row) || "") : ""; |
|
var cs = this.getStyleValue(css); |
|
var cls = cs.c ? "class=\"" + cs.c + "\"" : ""; |
|
var _a97 = col.hidden ? "style=\"display:none;" + cs.s + "\"" : (cs.s ? "style=\"" + cs.s + "\"" : ""); |
|
cc.push("<td field=\"" + _a96 + "\" " + cls + " " + _a97 + ">"); |
|
var _a97 = ""; |
|
if (!col.checkbox) { |
|
if (col.align) { |
|
_a97 += "text-align:" + col.align + ";"; |
|
} |
|
if (!opts.nowrap) { |
|
_a97 += "white-space:normal;height:auto;"; |
|
} else { |
|
if (opts.autoRowHeight) { |
|
_a97 += "height:auto;"; |
|
} |
|
} |
|
} |
|
cc.push("<div style=\"" + _a97 + "\" "); |
|
if (col.checkbox) { |
|
cc.push("class=\"datagrid-cell-check "); |
|
} else { |
|
cc.push("class=\"datagrid-cell " + col.cellClass); |
|
} |
|
if (_a96 == opts.treeField) { |
|
cc.push(" tree-node"); |
|
} |
|
cc.push("\">"); |
|
if (col.checkbox) { |
|
if (row.checked) { |
|
cc.push("<input type=\"checkbox\" checked=\"checked\""); |
|
} else { |
|
cc.push("<input type=\"checkbox\""); |
|
} |
|
cc.push(" name=\"" + _a96 + "\" value=\"" + (row[_a96] != undefined ? row[_a96] : "") + "\">"); |
|
} else { |
|
var val = null; |
|
if (col.formatter) { |
|
val = col.formatter(row[_a96], row); |
|
} else { |
|
val = row[_a96]; |
|
} |
|
if (_a96 == opts.treeField) { |
|
for (var j = 0; j < _a94; j++) { |
|
cc.push("<span class=\"tree-indent\"></span>"); |
|
} |
|
if (row.state == "closed") { |
|
cc.push("<span class=\"tree-hit tree-collapsed\"></span>"); |
|
cc.push("<span class=\"tree-icon tree-folder " + (row.iconCls ? row.iconCls : "") + "\"></span>"); |
|
} else { |
|
if (row.children && row.children.length) { |
|
cc.push("<span class=\"tree-hit tree-expanded\"></span>"); |
|
cc.push("<span class=\"tree-icon tree-folder tree-folder-open " + (row.iconCls ? row.iconCls : "") + "\"></span>"); |
|
} else { |
|
cc.push("<span class=\"tree-indent\"></span>"); |
|
cc.push("<span class=\"tree-icon tree-file " + (row.iconCls ? row.iconCls : "") + "\"></span>"); |
|
} |
|
} |
|
if (this.hasCheckbox(_a91, row)) { |
|
var flag = 0; |
|
var crow = $.easyui.getArrayItem(_a95.checkedRows, opts.idField, row[opts.idField]); |
|
if (crow) { |
|
flag = crow.checkState == "checked" ? 1 : 2; |
|
row.checkState = crow.checkState; |
|
row.checked = crow.checked; |
|
$.easyui.addArrayItem(_a95.checkedRows, opts.idField, row); |
|
} else { |
|
var prow = $.easyui.getArrayItem(_a95.checkedRows, opts.idField, row._parentId); |
|
if (prow && prow.checkState == "checked" && opts.cascadeCheck) { |
|
flag = 1; |
|
row.checked = true; |
|
$.easyui.addArrayItem(_a95.checkedRows, opts.idField, row); |
|
} else { |
|
if (row.checked) { |
|
$.easyui.addArrayItem(_a95.tmpIds, row[opts.idField]); |
|
} |
|
} |
|
row.checkState = flag ? "checked" : "unchecked"; |
|
} |
|
cc.push("<span class=\"tree-checkbox tree-checkbox" + flag + "\"></span>"); |
|
} else { |
|
row.checkState = undefined; |
|
row.checked = undefined; |
|
} |
|
cc.push("<span class=\"tree-title\">" + val + "</span>"); |
|
} else { |
|
cc.push(val); |
|
} |
|
} |
|
cc.push("</div>"); |
|
cc.push("</td>"); |
|
} |
|
} |
|
return cc.join(""); |
|
}, |
|
hasCheckbox: function (_a98, row) { |
|
var opts = $.data(_a98, "treegrid").options; |
|
if (opts.checkbox) { |
|
if ($.isFunction(opts.checkbox)) { |
|
if (opts.checkbox.call(_a98, row)) { |
|
return true; |
|
} else { |
|
return false; |
|
} |
|
} else { |
|
if (opts.onlyLeafCheck) { |
|
if (row.state == "open" && !(row.children && row.children.length)) { |
|
return true; |
|
} |
|
} else { |
|
return true; |
|
} |
|
} |
|
} |
|
return false; |
|
}, |
|
refreshRow: function (_a99, id) { |
|
this.updateRow.call(this, _a99, id, {}); |
|
}, |
|
updateRow: function (_a9a, id, row) { |
|
var opts = $.data(_a9a, "treegrid").options; |
|
var _a9b = $(_a9a).treegrid("find", id); |
|
$.extend(_a9b, row); |
|
var _a9c = $(_a9a).treegrid("getLevel", id) - 1; |
|
var _a9d = opts.rowStyler ? opts.rowStyler.call(_a9a, _a9b) : ""; |
|
var _a9e = $.data(_a9a, "datagrid").rowIdPrefix; |
|
var _a9f = _a9b[opts.idField]; |
|
function _aa0(_aa1) { |
|
var _aa2 = $(_a9a).treegrid("getColumnFields", _aa1); |
|
var tr = opts.finder.getTr(_a9a, id, "body", (_aa1 ? 1 : 2)); |
|
var _aa3 = tr.find("div.datagrid-cell-rownumber").html(); |
|
var _aa4 = tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked"); |
|
tr.html(this.renderRow(_a9a, _aa2, _aa1, _a9c, _a9b)); |
|
tr.attr("style", _a9d || ""); |
|
tr.find("div.datagrid-cell-rownumber").html(_aa3); |
|
if (_aa4) { |
|
tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true); |
|
} |
|
if (_a9f != id) { |
|
tr.attr("id", _a9e + "-" + (_aa1 ? 1 : 2) + "-" + _a9f); |
|
tr.attr("node-id", _a9f); |
|
} |
|
}; |
|
_aa0.call(this, true); |
|
_aa0.call(this, false); |
|
$(_a9a).treegrid("fixRowHeight", id); |
|
}, |
|
deleteRow: function (_aa5, id) { |
|
var opts = $.data(_aa5, "treegrid").options; |
|
var tr = opts.finder.getTr(_aa5, id); |
|
tr.next("tr.treegrid-tr-tree").remove(); |
|
tr.remove(); |
|
var _aa6 = del(id); |
|
if (_aa6) { |
|
if (_aa6.children.length == 0) { |
|
tr = opts.finder.getTr(_aa5, _aa6[opts.idField]); |
|
tr.next("tr.treegrid-tr-tree").remove(); |
|
var cell = tr.children("td[field=\"" + opts.treeField + "\"]").children("div.datagrid-cell"); |
|
cell.find(".tree-icon").removeClass("tree-folder").addClass("tree-file"); |
|
cell.find(".tree-hit").remove(); |
|
$("<span class=\"tree-indent\"></span>").prependTo(cell); |
|
} |
|
} |
|
this.setEmptyMsg(_aa5); |
|
function del(id) { |
|
var cc; |
|
var _aa7 = $(_aa5).treegrid("getParent", id); |
|
if (_aa7) { |
|
cc = _aa7.children; |
|
} else { |
|
cc = $(_aa5).treegrid("getData"); |
|
} |
|
for (var i = 0; i < cc.length; i++) { |
|
if (cc[i][opts.idField] == id) { |
|
cc.splice(i, 1); |
|
break; |
|
} |
|
} |
|
return _aa7; |
|
}; |
|
}, |
|
onBeforeRender: function (_aa8, _aa9, data) { |
|
if ($.isArray(_aa9)) { |
|
data = { |
|
total: _aa9.length, |
|
rows: _aa9 |
|
}; |
|
_aa9 = null; |
|
} |
|
if (!data) { |
|
return false; |
|
} |
|
var _aaa = $.data(_aa8, "treegrid"); |
|
var opts = _aaa.options; |
|
if (data.length == undefined) { |
|
if (data.footer) { |
|
_aaa.footer = data.footer; |
|
} |
|
if (data.total) { |
|
_aaa.total = data.total; |
|
} |
|
data = this.transfer(_aa8, _aa9, data.rows); |
|
} else { |
|
function _aab(_aac, _aad) { |
|
for (var i = 0; i < _aac.length; i++) { |
|
var row = _aac[i]; |
|
row._parentId = _aad; |
|
if (row.children && row.children.length) { |
|
_aab(row.children, row[opts.idField]); |
|
} |
|
} |
|
}; |
|
_aab(data, _aa9); |
|
} |
|
this.sort(_aa8, data); |
|
this.treeNodes = data; |
|
this.treeLevel = $(_aa8).treegrid("getLevel", _aa9); |
|
var node = find(_aa8, _aa9); |
|
if (node) { |
|
if (node.children) { |
|
node.children = node.children.concat(data); |
|
} else { |
|
node.children = data; |
|
} |
|
} else { |
|
_aaa.data = _aaa.data.concat(data); |
|
} |
|
}, |
|
sort: function (_aae, data) { |
|
var opts = $.data(_aae, "treegrid").options; |
|
if (!opts.remoteSort && opts.sortName) { |
|
var _aaf = opts.sortName.split(","); |
|
var _ab0 = opts.sortOrder.split(","); |
|
_ab1(data); |
|
} |
|
function _ab1(rows) { |
|
rows.sort(function (r1, r2) { |
|
var r = 0; |
|
for (var i = 0; i < _aaf.length; i++) { |
|
var sn = _aaf[i]; |
|
var so = _ab0[i]; |
|
var col = $(_aae).treegrid("getColumnOption", sn); |
|
var _ab2 = col.sorter || function (a, b) { |
|
return a == b ? 0 : (a > b ? 1 : -1); |
|
}; |
|
r = _ab2(r1[sn], r2[sn]) * (so == "asc" ? 1 : -1); |
|
if (r != 0) { |
|
return r; |
|
} |
|
} |
|
return r; |
|
}); |
|
for (var i = 0; i < rows.length; i++) { |
|
var _ab3 = rows[i].children; |
|
if (_ab3 && _ab3.length) { |
|
_ab1(_ab3); |
|
} |
|
} |
|
}; |
|
}, |
|
transfer: function (_ab4, _ab5, data) { |
|
var opts = $.data(_ab4, "treegrid").options; |
|
var rows = $.extend([], data); |
|
var _ab6 = _ab7(_ab5, rows); |
|
var toDo = $.extend([], _ab6); |
|
while (toDo.length) { |
|
var node = toDo.shift(); |
|
var _ab8 = _ab7(node[opts.idField], rows); |
|
if (_ab8.length) { |
|
if (node.children) { |
|
node.children = node.children.concat(_ab8); |
|
} else { |
|
node.children = _ab8; |
|
} |
|
toDo = toDo.concat(_ab8); |
|
} |
|
} |
|
return _ab6; |
|
function _ab7(_ab9, rows) { |
|
var rr = []; |
|
for (var i = 0; i < rows.length; i++) { |
|
var row = rows[i]; |
|
if (row._parentId == _ab9) { |
|
rr.push(row); |
|
rows.splice(i, 1); |
|
i--; |
|
} |
|
} |
|
return rr; |
|
}; |
|
} |
|
}); |
|
$.fn.treegrid.defaults = $.extend({}, $.fn.datagrid.defaults, { |
|
treeField: null, |
|
checkbox: false, |
|
cascadeCheck: true, |
|
onlyLeafCheck: false, |
|
lines: false, |
|
animate: false, |
|
singleSelect: true, |
|
view: _a7c, |
|
rowEvents: $.extend({}, $.fn.datagrid.defaults.rowEvents, { |
|
mouseover: _9f1(true), |
|
mouseout: _9f1(false), |
|
click: _9f3 |
|
}), |
|
loader: function (_aba, _abb, _abc) { |
|
var opts = $(this).treegrid("options"); |
|
if (!opts.url) { |
|
return false; |
|
} |
|
$.ajax({ |
|
type: opts.method, |
|
url: opts.url, |
|
data: _aba, |
|
dataType: "json", |
|
success: function (data) { |
|
_abb(data); |
|
}, |
|
error: function () { |
|
_abc.apply(this, arguments); |
|
} |
|
}); |
|
}, |
|
loadFilter: function (data, _abd) { |
|
return data; |
|
}, |
|
finder: { |
|
getTr: function (_abe, id, type, _abf) { |
|
type = type || "body"; |
|
_abf = _abf || 0; |
|
var dc = $.data(_abe, "datagrid").dc; |
|
if (_abf == 0) { |
|
var opts = $.data(_abe, "treegrid").options; |
|
var tr1 = opts.finder.getTr(_abe, id, type, 1); |
|
var tr2 = opts.finder.getTr(_abe, id, type, 2); |
|
return tr1.add(tr2); |
|
} else { |
|
if (type == "body") { |
|
var tr = $("#" + $.data(_abe, "datagrid").rowIdPrefix + "-" + _abf + "-" + id); |
|
if (!tr.length) { |
|
tr = (_abf == 1 ? dc.body1 : dc.body2).find("tr[node-id=\"" + id + "\"]"); |
|
} |
|
return tr; |
|
} else { |
|
if (type == "footer") { |
|
return (_abf == 1 ? dc.footer1 : dc.footer2).find("tr[node-id=\"" + id + "\"]"); |
|
} else { |
|
if (type == "selected") { |
|
return (_abf == 1 ? dc.body1 : dc.body2).find("tr.datagrid-row-selected"); |
|
} else { |
|
if (type == "highlight") { |
|
return (_abf == 1 ? dc.body1 : dc.body2).find("tr.datagrid-row-over"); |
|
} else { |
|
if (type == "checked") { |
|
return (_abf == 1 ? dc.body1 : dc.body2).find("tr.datagrid-row-checked"); |
|
} else { |
|
if (type == "last") { |
|
return (_abf == 1 ? dc.body1 : dc.body2).find("tr:last[node-id]"); |
|
} else { |
|
if (type == "allbody") { |
|
return (_abf == 1 ? dc.body1 : dc.body2).find("tr[node-id]"); |
|
} else { |
|
if (type == "allfooter") { |
|
return (_abf == 1 ? dc.footer1 : dc.footer2).find("tr[node-id]"); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
}, |
|
getRow: function (_ac0, p) { |
|
var id = (typeof p == "object") ? p.attr("node-id") : p; |
|
return $(_ac0).treegrid("find", id); |
|
}, |
|
getRows: function (_ac1) { |
|
return $(_ac1).treegrid("getChildren"); |
|
} |
|
}, |
|
onBeforeLoad: function (row, _ac2) {}, |
|
onLoadSuccess: function (row, data) {}, |
|
onLoadError: function () {}, |
|
onBeforeCollapse: function (row) {}, |
|
onCollapse: function (row) {}, |
|
onBeforeExpand: function (row) {}, |
|
onExpand: function (row) {}, |
|
onClickRow: function (row) {}, |
|
onDblClickRow: function (row) {}, |
|
onClickCell: function (_ac3, row) {}, |
|
onDblClickCell: function (_ac4, row) {}, |
|
onContextMenu: function (e, row) {}, |
|
onBeforeEdit: function (row) {}, |
|
onAfterEdit: function (row, _ac5) {}, |
|
onCancelEdit: function (row) {}, |
|
onBeforeCheckNode: function (row, _ac6) {}, |
|
onCheckNode: function (row, _ac7) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _ac8(_ac9) { |
|
var opts = $.data(_ac9, "datalist").options; |
|
$(_ac9).datagrid($.extend({}, opts, { |
|
cls: "datalist" + (opts.lines ? " datalist-lines" : ""), |
|
frozenColumns: (opts.frozenColumns && opts.frozenColumns.length) ? opts.frozenColumns : (opts.checkbox ? [[{ |
|
field: "_ck", |
|
checkbox: true |
|
} |
|
]] : undefined), |
|
columns: (opts.columns && opts.columns.length) ? opts.columns : [[{ |
|
field: opts.textField, |
|
width: "100%", |
|
formatter: function (_aca, row, _acb) { |
|
return opts.textFormatter ? opts.textFormatter(_aca, row, _acb) : _aca; |
|
} |
|
} |
|
]] |
|
})); |
|
}; |
|
var _acc = $.extend({}, $.fn.datagrid.defaults.view, { |
|
render: function (_acd, _ace, _acf) { |
|
var _ad0 = $.data(_acd, "datagrid"); |
|
var opts = _ad0.options; |
|
if (opts.groupField) { |
|
var g = this.groupRows(_acd, _ad0.data.rows); |
|
this.groups = g.groups; |
|
_ad0.data.rows = g.rows; |
|
var _ad1 = []; |
|
for (var i = 0; i < g.groups.length; i++) { |
|
_ad1.push(this.renderGroup.call(this, _acd, i, g.groups[i], _acf)); |
|
} |
|
$(_ace).html(_ad1.join("")); |
|
} else { |
|
$(_ace).html(this.renderTable(_acd, 0, _ad0.data.rows, _acf)); |
|
} |
|
}, |
|
renderGroup: function (_ad2, _ad3, _ad4, _ad5) { |
|
var _ad6 = $.data(_ad2, "datagrid"); |
|
var opts = _ad6.options; |
|
var _ad7 = $(_ad2).datagrid("getColumnFields", _ad5); |
|
var _ad8 = []; |
|
_ad8.push("<div class=\"datagrid-group\" group-index=" + _ad3 + ">"); |
|
if (!_ad5) { |
|
_ad8.push("<span class=\"datagrid-group-title\">"); |
|
_ad8.push(opts.groupFormatter.call(_ad2, _ad4.value, _ad4.rows)); |
|
_ad8.push("</span>"); |
|
} |
|
_ad8.push("</div>"); |
|
_ad8.push(this.renderTable(_ad2, _ad4.startIndex, _ad4.rows, _ad5)); |
|
return _ad8.join(""); |
|
}, |
|
groupRows: function (_ad9, rows) { |
|
var _ada = $.data(_ad9, "datagrid"); |
|
var opts = _ada.options; |
|
var _adb = []; |
|
for (var i = 0; i < rows.length; i++) { |
|
var row = rows[i]; |
|
var _adc = _add(row[opts.groupField]); |
|
if (!_adc) { |
|
_adc = { |
|
value: row[opts.groupField], |
|
rows: [row] |
|
}; |
|
_adb.push(_adc); |
|
} else { |
|
_adc.rows.push(row); |
|
} |
|
} |
|
var _ade = 0; |
|
var rows = []; |
|
for (var i = 0; i < _adb.length; i++) { |
|
var _adc = _adb[i]; |
|
_adc.startIndex = _ade; |
|
_ade += _adc.rows.length; |
|
rows = rows.concat(_adc.rows); |
|
} |
|
return { |
|
groups: _adb, |
|
rows: rows |
|
}; |
|
function _add(_adf) { |
|
for (var i = 0; i < _adb.length; i++) { |
|
var _ae0 = _adb[i]; |
|
if (_ae0.value == _adf) { |
|
return _ae0; |
|
} |
|
} |
|
return null; |
|
}; |
|
} |
|
}); |
|
$.fn.datalist = function (_ae1, _ae2) { |
|
if (typeof _ae1 == "string") { |
|
var _ae3 = $.fn.datalist.methods[_ae1]; |
|
if (_ae3) { |
|
return _ae3(this, _ae2); |
|
} else { |
|
return this.datagrid(_ae1, _ae2); |
|
} |
|
} |
|
_ae1 = _ae1 || {}; |
|
return this.each(function () { |
|
var _ae4 = $.data(this, "datalist"); |
|
if (_ae4) { |
|
$.extend(_ae4.options, _ae1); |
|
} else { |
|
var opts = $.extend({}, $.fn.datalist.defaults, $.fn.datalist.parseOptions(this), _ae1); |
|
opts.columns = $.extend(true, [], opts.columns); |
|
_ae4 = $.data(this, "datalist", { |
|
options: opts |
|
}); |
|
} |
|
_ac8(this); |
|
if (!_ae4.options.data) { |
|
var data = $.fn.datalist.parseData(this); |
|
if (data.total) { |
|
$(this).datalist("loadData", data); |
|
} |
|
} |
|
}); |
|
}; |
|
$.fn.datalist.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "datalist").options; |
|
} |
|
}; |
|
$.fn.datalist.parseOptions = function (_ae5) { |
|
return $.extend({}, $.fn.datagrid.parseOptions(_ae5), $.parser.parseOptions(_ae5, ["valueField", "textField", "groupField", { |
|
checkbox: "boolean", |
|
lines: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.datalist.parseData = function (_ae6) { |
|
var opts = $.data(_ae6, "datalist").options; |
|
var data = { |
|
total: 0, |
|
rows: [] |
|
}; |
|
$(_ae6).children().each(function () { |
|
var _ae7 = $.parser.parseOptions(this, ["value", "group"]); |
|
var row = {}; |
|
var html = $(this).html(); |
|
row[opts.valueField] = _ae7.value != undefined ? _ae7.value : html; |
|
row[opts.textField] = html; |
|
if (opts.groupField) { |
|
row[opts.groupField] = _ae7.group; |
|
} |
|
data.total++; |
|
data.rows.push(row); |
|
}); |
|
return data; |
|
}; |
|
$.fn.datalist.defaults = $.extend({}, $.fn.datagrid.defaults, { |
|
fitColumns: true, |
|
singleSelect: true, |
|
showHeader: false, |
|
checkbox: false, |
|
lines: false, |
|
valueField: "value", |
|
textField: "text", |
|
groupField: "", |
|
view: _acc, |
|
textFormatter: function (_ae8, row) { |
|
return _ae8; |
|
}, |
|
groupFormatter: function (_ae9, rows) { |
|
return _ae9; |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
$(function () { |
|
$(document)._unbind(".combo")._bind("mousedown.combo mousewheel.combo", function (e) { |
|
var p = $(e.target).closest("span.combo,div.combo-p,div.menu"); |
|
if (p.length) { |
|
_aea(p); |
|
return; |
|
} |
|
$("body>div.combo-p>div.combo-panel:visible").panel("close"); |
|
}); |
|
}); |
|
function _aeb(_aec) { |
|
var _aed = $.data(_aec, "combo"); |
|
var opts = _aed.options; |
|
if (!_aed.panel) { |
|
_aed.panel = $("<div class=\"combo-panel\"></div>").appendTo("html>body"); |
|
_aed.panel.panel({ |
|
minWidth: opts.panelMinWidth, |
|
maxWidth: opts.panelMaxWidth, |
|
minHeight: opts.panelMinHeight, |
|
maxHeight: opts.panelMaxHeight, |
|
doSize: false, |
|
closed: true, |
|
cls: "combo-p", |
|
style: { |
|
position: "absolute", |
|
zIndex: 10 |
|
}, |
|
onOpen: function () { |
|
var _aee = $(this).panel("options").comboTarget; |
|
var _aef = $.data(_aee, "combo"); |
|
if (_aef) { |
|
_aef.options.onShowPanel.call(_aee); |
|
} |
|
}, |
|
onBeforeClose: function () { |
|
_aea($(this).parent()); |
|
}, |
|
onClose: function () { |
|
var _af0 = $(this).panel("options").comboTarget; |
|
var _af1 = $(_af0).data("combo"); |
|
if (_af1) { |
|
_af1.options.onHidePanel.call(_af0); |
|
} |
|
} |
|
}); |
|
} |
|
var _af2 = $.extend(true, [], opts.icons); |
|
if (opts.hasDownArrow) { |
|
_af2.push({ |
|
iconCls: "combo-arrow", |
|
handler: function (e) { |
|
_af7(e.data.target); |
|
} |
|
}); |
|
} |
|
$(_aec).addClass("combo-f").textbox($.extend({}, opts, { |
|
icons: _af2, |
|
onChange: function () {} |
|
})); |
|
$(_aec).attr("comboName", $(_aec).attr("textboxName")); |
|
_aed.combo = $(_aec).next(); |
|
_aed.combo.addClass("combo"); |
|
_aed.panel._unbind(".combo"); |
|
for (var _af3 in opts.panelEvents) { |
|
_aed.panel._bind(_af3 + ".combo", { |
|
target: _aec |
|
}, opts.panelEvents[_af3]); |
|
} |
|
}; |
|
function _af4(_af5) { |
|
var _af6 = $.data(_af5, "combo"); |
|
var opts = _af6.options; |
|
var p = _af6.panel; |
|
if (p.is(":visible")) { |
|
p.panel("close"); |
|
} |
|
if (!opts.cloned) { |
|
p.panel("destroy"); |
|
} |
|
$(_af5).textbox("destroy"); |
|
}; |
|
function _af7(_af8) { |
|
var _af9 = $.data(_af8, "combo").panel; |
|
if (_af9.is(":visible")) { |
|
var _afa = _af9.combo("combo"); |
|
_afb(_afa); |
|
if (_afa != _af8) { |
|
$(_af8).combo("showPanel"); |
|
} |
|
} else { |
|
var p = $(_af8).closest("div.combo-p").children(".combo-panel"); |
|
$("div.combo-panel:visible").not(_af9).not(p).panel("close"); |
|
$(_af8).combo("showPanel"); |
|
} |
|
$(_af8).combo("textbox").focus(); |
|
}; |
|
function _aea(_afc) { |
|
$(_afc).find(".combo-f").each(function () { |
|
var p = $(this).combo("panel"); |
|
if (p.is(":visible")) { |
|
p.panel("close"); |
|
} |
|
}); |
|
}; |
|
function _afd(e) { |
|
var _afe = e.data.target; |
|
var _aff = $.data(_afe, "combo"); |
|
var opts = _aff.options; |
|
if (!opts.editable) { |
|
_af7(_afe); |
|
} else { |
|
var p = $(_afe).closest("div.combo-p").children(".combo-panel"); |
|
$("div.combo-panel:visible").not(p).each(function () { |
|
var _b00 = $(this).combo("combo"); |
|
if (_b00 != _afe) { |
|
_afb(_b00); |
|
} |
|
}); |
|
} |
|
}; |
|
function _b01(e) { |
|
var _b02 = e.data.target; |
|
var t = $(_b02); |
|
var _b03 = t.data("combo"); |
|
var opts = t.combo("options"); |
|
_b03.panel.panel("options").comboTarget = _b02; |
|
switch (e.keyCode) { |
|
case 38: |
|
opts.keyHandler.up.call(_b02, e); |
|
break; |
|
case 40: |
|
opts.keyHandler.down.call(_b02, e); |
|
break; |
|
case 37: |
|
opts.keyHandler.left.call(_b02, e); |
|
break; |
|
case 39: |
|
opts.keyHandler.right.call(_b02, e); |
|
break; |
|
case 13: |
|
e.preventDefault(); |
|
opts.keyHandler.enter.call(_b02, e); |
|
return false; |
|
case 9: |
|
case 27: |
|
_afb(_b02); |
|
break; |
|
default: |
|
if (opts.editable) { |
|
if (_b03.timer) { |
|
clearTimeout(_b03.timer); |
|
} |
|
_b03.timer = setTimeout(function () { |
|
var q = t.combo("getText"); |
|
if (_b03.previousText != q) { |
|
_b03.previousText = q; |
|
t.combo("showPanel"); |
|
opts.keyHandler.query.call(_b02, q, e); |
|
t.combo("validate"); |
|
} |
|
}, opts.delay); |
|
} |
|
} |
|
}; |
|
function _b04(e) { |
|
var _b05 = e.data.target; |
|
var _b06 = $(_b05).data("combo"); |
|
if (_b06.timer) { |
|
clearTimeout(_b06.timer); |
|
} |
|
}; |
|
function _b07(_b08) { |
|
var _b09 = $.data(_b08, "combo"); |
|
var _b0a = _b09.combo; |
|
var _b0b = _b09.panel; |
|
var opts = $(_b08).combo("options"); |
|
var _b0c = _b0b.panel("options"); |
|
_b0c.comboTarget = _b08; |
|
if (_b0c.closed) { |
|
_b0b.panel("panel").show().css({ |
|
zIndex: ($.fn.menu ? $.fn.menu.defaults.zIndex++ : ($.fn.window ? $.fn.window.defaults.zIndex++ : 99)), |
|
left: -999999 |
|
}); |
|
_b0b.panel("resize", { |
|
width: (opts.panelWidth ? opts.panelWidth : _b0a._outerWidth()), |
|
height: opts.panelHeight |
|
}); |
|
_b0b.panel("panel").hide(); |
|
_b0b.panel("open"); |
|
} |
|
(function () { |
|
if (_b0c.comboTarget == _b08 && _b0b.is(":visible")) { |
|
_b0b.panel("move", { |
|
left: _b0d(), |
|
top: _b0e() |
|
}); |
|
setTimeout(arguments.callee, 200); |
|
} |
|
})(); |
|
function _b0d() { |
|
var left = _b0a.offset().left; |
|
if (opts.panelAlign == "right") { |
|
left += _b0a._outerWidth() - _b0b._outerWidth(); |
|
} |
|
if (left + _b0b._outerWidth() > $(window)._outerWidth() + $(document).scrollLeft()) { |
|
left = $(window)._outerWidth() + $(document).scrollLeft() - _b0b._outerWidth(); |
|
} |
|
if (left < 0) { |
|
left = 0; |
|
} |
|
return left; |
|
}; |
|
function _b0e() { |
|
if (opts.panelValign == "top") { |
|
var top = _b0a.offset().top - _b0b._outerHeight(); |
|
} else { |
|
if (opts.panelValign == "bottom") { |
|
var top = _b0a.offset().top + _b0a._outerHeight(); |
|
} else { |
|
var top = _b0a.offset().top + _b0a._outerHeight(); |
|
if (top + _b0b._outerHeight() > $(window)._outerHeight() + $(document).scrollTop()) { |
|
top = _b0a.offset().top - _b0b._outerHeight(); |
|
} |
|
if (top < $(document).scrollTop()) { |
|
top = _b0a.offset().top + _b0a._outerHeight(); |
|
} |
|
} |
|
} |
|
return top; |
|
}; |
|
}; |
|
function _afb(_b0f) { |
|
var _b10 = $.data(_b0f, "combo").panel; |
|
_b10.panel("close"); |
|
}; |
|
function _b11(_b12, text) { |
|
var _b13 = $.data(_b12, "combo"); |
|
var _b14 = $(_b12).textbox("getText"); |
|
if (_b14 != text) { |
|
$(_b12).textbox("setText", text); |
|
} |
|
_b13.previousText = text; |
|
}; |
|
function _b15(_b16) { |
|
var _b17 = $.data(_b16, "combo"); |
|
var opts = _b17.options; |
|
var _b18 = $(_b16).next(); |
|
var _b19 = []; |
|
_b18.find(".textbox-value").each(function () { |
|
_b19.push($(this).val()); |
|
}); |
|
if (opts.multivalue) { |
|
return _b19; |
|
} else { |
|
return _b19.length ? _b19[0].split(opts.separator) : _b19; |
|
} |
|
}; |
|
function _b1a(_b1b, _b1c) { |
|
var _b1d = $.data(_b1b, "combo"); |
|
var _b1e = _b1d.combo; |
|
var opts = $(_b1b).combo("options"); |
|
if (!$.isArray(_b1c)) { |
|
_b1c = _b1c.split(opts.separator); |
|
} |
|
var _b1f = _b15(_b1b); |
|
_b1e.find(".textbox-value").remove(); |
|
if (_b1c.length) { |
|
if (opts.multivalue) { |
|
for (var i = 0; i < _b1c.length; i++) { |
|
_b20(_b1c[i]); |
|
} |
|
} else { |
|
_b20(_b1c.join(opts.separator)); |
|
} |
|
} |
|
function _b20(_b21) { |
|
var name = $(_b1b).attr("textboxName") || ""; |
|
var _b22 = $("<input type=\"hidden\" class=\"textbox-value\">").appendTo(_b1e); |
|
_b22.attr("name", name); |
|
if (opts.disabled) { |
|
_b22.attr("disabled", "disabled"); |
|
} |
|
_b22.val(_b21); |
|
}; |
|
var _b23 = (function () { |
|
if (opts.onChange == $.parser.emptyFn) { |
|
return false; |
|
} |
|
if (_b1f.length != _b1c.length) { |
|
return true; |
|
} |
|
for (var i = 0; i < _b1c.length; i++) { |
|
if (_b1c[i] != _b1f[i]) { |
|
return true; |
|
} |
|
} |
|
return false; |
|
})(); |
|
if (_b23) { |
|
$(_b1b).val(_b1c.join(opts.separator)); |
|
if (opts.multiple) { |
|
opts.onChange.call(_b1b, _b1c, _b1f); |
|
} else { |
|
opts.onChange.call(_b1b, _b1c[0], _b1f[0]); |
|
} |
|
$(_b1b).closest("form").trigger("_change", [_b1b]); |
|
} |
|
}; |
|
function _b24(_b25) { |
|
var _b26 = _b15(_b25); |
|
return _b26[0]; |
|
}; |
|
function _b27(_b28, _b29) { |
|
_b1a(_b28, [_b29]); |
|
}; |
|
function _b2a(_b2b) { |
|
var opts = $.data(_b2b, "combo").options; |
|
var _b2c = opts.onChange; |
|
opts.onChange = $.parser.emptyFn; |
|
if (opts.multiple) { |
|
_b1a(_b2b, opts.value ? opts.value : []); |
|
} else { |
|
_b27(_b2b, opts.value); |
|
} |
|
opts.onChange = _b2c; |
|
}; |
|
$.fn.combo = function (_b2d, _b2e) { |
|
if (typeof _b2d == "string") { |
|
var _b2f = $.fn.combo.methods[_b2d]; |
|
if (_b2f) { |
|
return _b2f(this, _b2e); |
|
} else { |
|
return this.textbox(_b2d, _b2e); |
|
} |
|
} |
|
_b2d = _b2d || {}; |
|
return this.each(function () { |
|
var _b30 = $.data(this, "combo"); |
|
if (_b30) { |
|
$.extend(_b30.options, _b2d); |
|
if (_b2d.value != undefined) { |
|
_b30.options.originalValue = _b2d.value; |
|
} |
|
} else { |
|
_b30 = $.data(this, "combo", { |
|
options: $.extend({}, $.fn.combo.defaults, $.fn.combo.parseOptions(this), _b2d), |
|
previousText: "" |
|
}); |
|
if (_b30.options.multiple && _b30.options.value == "") { |
|
_b30.options.originalValue = []; |
|
} else { |
|
_b30.options.originalValue = _b30.options.value; |
|
} |
|
} |
|
_aeb(this); |
|
_b2a(this); |
|
}); |
|
}; |
|
$.fn.combo.methods = { |
|
options: function (jq) { |
|
var opts = jq.textbox("options"); |
|
return $.extend($.data(jq[0], "combo").options, { |
|
width: opts.width, |
|
height: opts.height, |
|
disabled: opts.disabled, |
|
readonly: opts.readonly |
|
}); |
|
}, |
|
cloneFrom: function (jq, from) { |
|
return jq.each(function () { |
|
$(this).textbox("cloneFrom", from); |
|
$.data(this, "combo", { |
|
options: $.extend(true, { |
|
cloned: true |
|
}, $(from).combo("options")), |
|
combo: $(this).next(), |
|
panel: $(from).combo("panel") |
|
}); |
|
$(this).addClass("combo-f").attr("comboName", $(this).attr("textboxName")); |
|
}); |
|
}, |
|
combo: function (jq) { |
|
return jq.closest(".combo-panel").panel("options").comboTarget; |
|
}, |
|
panel: function (jq) { |
|
return $.data(jq[0], "combo").panel; |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
_af4(this); |
|
}); |
|
}, |
|
showPanel: function (jq) { |
|
return jq.each(function () { |
|
_b07(this); |
|
}); |
|
}, |
|
hidePanel: function (jq) { |
|
return jq.each(function () { |
|
_afb(this); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
$(this).textbox("setText", ""); |
|
var opts = $.data(this, "combo").options; |
|
if (opts.multiple) { |
|
$(this).combo("setValues", []); |
|
} else { |
|
$(this).combo("setValue", ""); |
|
} |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "combo").options; |
|
if (opts.multiple) { |
|
$(this).combo("setValues", opts.originalValue); |
|
} else { |
|
$(this).combo("setValue", opts.originalValue); |
|
} |
|
}); |
|
}, |
|
setText: function (jq, text) { |
|
return jq.each(function () { |
|
_b11(this, text); |
|
}); |
|
}, |
|
getValues: function (jq) { |
|
return _b15(jq[0]); |
|
}, |
|
setValues: function (jq, _b31) { |
|
return jq.each(function () { |
|
_b1a(this, _b31); |
|
}); |
|
}, |
|
getValue: function (jq) { |
|
return _b24(jq[0]); |
|
}, |
|
setValue: function (jq, _b32) { |
|
return jq.each(function () { |
|
_b27(this, _b32); |
|
}); |
|
} |
|
}; |
|
$.fn.combo.parseOptions = function (_b33) { |
|
var t = $(_b33); |
|
return $.extend({}, $.fn.textbox.parseOptions(_b33), $.parser.parseOptions(_b33, ["separator", "panelAlign", { |
|
panelWidth: "number", |
|
hasDownArrow: "boolean", |
|
delay: "number", |
|
reversed: "boolean", |
|
multivalue: "boolean", |
|
selectOnNavigation: "boolean" |
|
}, { |
|
panelMinWidth: "number", |
|
panelMaxWidth: "number", |
|
panelMinHeight: "number", |
|
panelMaxHeight: "number" |
|
} |
|
]), { |
|
panelHeight: (t.attr("panelHeight") == "auto" ? "auto" : parseInt(t.attr("panelHeight")) || undefined), |
|
multiple: (t.attr("multiple") ? true : undefined) |
|
}); |
|
}; |
|
$.fn.combo.defaults = $.extend({}, $.fn.textbox.defaults, { |
|
inputEvents: { |
|
click: _afd, |
|
keydown: _b01, |
|
paste: _b01, |
|
drop: _b01, |
|
blur: _b04 |
|
}, |
|
panelEvents: { |
|
mousedown: function (e) { |
|
e.preventDefault(); |
|
e.stopPropagation(); |
|
} |
|
}, |
|
panelWidth: null, |
|
panelHeight: 300, |
|
panelMinWidth: null, |
|
panelMaxWidth: null, |
|
panelMinHeight: null, |
|
panelMaxHeight: null, |
|
panelAlign: "left", |
|
panelValign: "auto", |
|
reversed: false, |
|
multiple: false, |
|
multivalue: true, |
|
selectOnNavigation: true, |
|
separator: ",", |
|
hasDownArrow: true, |
|
delay: 200, |
|
keyHandler: { |
|
up: function (e) {}, |
|
down: function (e) {}, |
|
left: function (e) {}, |
|
right: function (e) {}, |
|
enter: function (e) {}, |
|
query: function (q, e) {} |
|
}, |
|
onShowPanel: function () {}, |
|
onHidePanel: function () {}, |
|
onChange: function (_b34, _b35) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _b36(_b37, _b38) { |
|
var _b39 = $.data(_b37, "combobox"); |
|
return $.easyui.indexOfArray(_b39.data, _b39.options.valueField, _b38); |
|
}; |
|
function _b3a(_b3b, _b3c) { |
|
var opts = $.data(_b3b, "combobox").options; |
|
var _b3d = $(_b3b).combo("panel"); |
|
var item = opts.finder.getEl(_b3b, _b3c); |
|
if (item.length) { |
|
if (item.position().top <= 0) { |
|
var h = _b3d.scrollTop() + item.position().top; |
|
_b3d.scrollTop(h); |
|
} else { |
|
if (item.position().top + item.outerHeight() > _b3d.height()) { |
|
var h = _b3d.scrollTop() + item.position().top + item.outerHeight() - _b3d.height(); |
|
_b3d.scrollTop(h); |
|
} |
|
} |
|
} |
|
_b3d.triggerHandler("scroll"); |
|
}; |
|
function nav(_b3e, dir) { |
|
var opts = $.data(_b3e, "combobox").options; |
|
var _b3f = $(_b3e).combobox("panel"); |
|
var item = _b3f.children("div.combobox-item-hover"); |
|
if (!item.length) { |
|
item = _b3f.children("div.combobox-item-selected"); |
|
} |
|
item.removeClass("combobox-item-hover"); |
|
var _b40 = "div.combobox-item:visible:not(.combobox-item-disabled):first"; |
|
var _b41 = "div.combobox-item:visible:not(.combobox-item-disabled):last"; |
|
if (!item.length) { |
|
item = _b3f.children(dir == "next" ? _b40 : _b41); |
|
} else { |
|
if (dir == "next") { |
|
item = item.nextAll(_b40); |
|
if (!item.length) { |
|
item = _b3f.children(_b40); |
|
} |
|
} else { |
|
item = item.prevAll(_b40); |
|
if (!item.length) { |
|
item = _b3f.children(_b41); |
|
} |
|
} |
|
} |
|
if (item.length) { |
|
item.addClass("combobox-item-hover"); |
|
var row = opts.finder.getRow(_b3e, item); |
|
if (row) { |
|
$(_b3e).combobox("scrollTo", row[opts.valueField]); |
|
if (opts.selectOnNavigation) { |
|
_b42(_b3e, row[opts.valueField]); |
|
} |
|
} |
|
} |
|
}; |
|
function _b42(_b43, _b44, _b45) { |
|
var opts = $.data(_b43, "combobox").options; |
|
var _b46 = $(_b43).combo("getValues"); |
|
if ($.inArray(_b44 + "", _b46) == -1) { |
|
if (opts.multiple) { |
|
_b46.push(_b44); |
|
} else { |
|
_b46 = [_b44]; |
|
} |
|
_b47(_b43, _b46, _b45); |
|
} |
|
}; |
|
function _b48(_b49, _b4a) { |
|
var opts = $.data(_b49, "combobox").options; |
|
var _b4b = $(_b49).combo("getValues"); |
|
var _b4c = $.inArray(_b4a + "", _b4b); |
|
if (_b4c >= 0) { |
|
_b4b.splice(_b4c, 1); |
|
_b47(_b49, _b4b); |
|
} |
|
}; |
|
function _b47(_b4d, _b4e, _b4f) { |
|
var opts = $.data(_b4d, "combobox").options; |
|
var _b50 = $(_b4d).combo("panel"); |
|
if (!$.isArray(_b4e)) { |
|
_b4e = _b4e.split(opts.separator); |
|
} |
|
if (!opts.multiple) { |
|
_b4e = _b4e.length ? [_b4e[0]] : [""]; |
|
} |
|
var _b51 = $(_b4d).combo("getValues"); |
|
if (_b50.is(":visible")) { |
|
_b50.find(".combobox-item-selected").each(function () { |
|
var row = opts.finder.getRow(_b4d, $(this)); |
|
if (row) { |
|
if ($.easyui.indexOfArray(_b51, row[opts.valueField]) == -1) { |
|
$(this).removeClass("combobox-item-selected"); |
|
} |
|
} |
|
}); |
|
} |
|
$.map(_b51, function (v) { |
|
if ($.easyui.indexOfArray(_b4e, v) == -1) { |
|
var el = opts.finder.getEl(_b4d, v); |
|
if (el.hasClass("combobox-item-selected")) { |
|
el.removeClass("combobox-item-selected"); |
|
opts.onUnselect.call(_b4d, opts.finder.getRow(_b4d, v)); |
|
} |
|
} |
|
}); |
|
var _b52 = null; |
|
var vv = [], |
|
ss = []; |
|
for (var i = 0; i < _b4e.length; i++) { |
|
var v = _b4e[i]; |
|
var s = v; |
|
var row = opts.finder.getRow(_b4d, v); |
|
if (row) { |
|
s = row[opts.textField]; |
|
_b52 = row; |
|
var el = opts.finder.getEl(_b4d, v); |
|
if (!el.hasClass("combobox-item-selected")) { |
|
el.addClass("combobox-item-selected"); |
|
opts.onSelect.call(_b4d, row); |
|
} |
|
} else { |
|
s = _b53(v, opts.mappingRows) || v; |
|
} |
|
vv.push(v); |
|
ss.push(s); |
|
} |
|
if (!_b4f) { |
|
$(_b4d).combo("setText", ss.join(opts.separator)); |
|
} |
|
if (opts.showItemIcon) { |
|
var tb = $(_b4d).combobox("textbox"); |
|
tb.removeClass("textbox-bgicon " + opts.textboxIconCls); |
|
if (_b52 && _b52.iconCls) { |
|
tb.addClass("textbox-bgicon " + _b52.iconCls); |
|
opts.textboxIconCls = _b52.iconCls; |
|
} |
|
} |
|
$(_b4d).combo("setValues", vv); |
|
_b50.triggerHandler("scroll"); |
|
function _b53(_b54, a) { |
|
var item = $.easyui.getArrayItem(a, opts.valueField, _b54); |
|
return item ? item[opts.textField] : undefined; |
|
}; |
|
}; |
|
function _b55(_b56, data, _b57) { |
|
var _b58 = $.data(_b56, "combobox"); |
|
var opts = _b58.options; |
|
_b58.data = opts.loadFilter.call(_b56, data); |
|
opts.view.render.call(opts.view, _b56, $(_b56).combo("panel"), _b58.data); |
|
var vv = $(_b56).combobox("getValues"); |
|
$.easyui.forEach(_b58.data, false, function (row) { |
|
if (row["selected"]) { |
|
$.easyui.addArrayItem(vv, row[opts.valueField] + ""); |
|
} |
|
}); |
|
if (opts.multiple) { |
|
_b47(_b56, vv, _b57); |
|
} else { |
|
_b47(_b56, vv.length ? [vv[vv.length - 1]] : [], _b57); |
|
} |
|
opts.onLoadSuccess.call(_b56, data); |
|
}; |
|
function _b59(_b5a, url, _b5b, _b5c) { |
|
var opts = $.data(_b5a, "combobox").options; |
|
if (url) { |
|
opts.url = url; |
|
} |
|
_b5b = $.extend({}, opts.queryParams, _b5b || {}); |
|
if (opts.onBeforeLoad.call(_b5a, _b5b) == false) { |
|
return; |
|
} |
|
opts.loader.call(_b5a, _b5b, function (data) { |
|
_b55(_b5a, data, _b5c); |
|
}, function () { |
|
opts.onLoadError.apply(this, arguments); |
|
}); |
|
}; |
|
function _b5d(_b5e, q) { |
|
var _b5f = $.data(_b5e, "combobox"); |
|
var opts = _b5f.options; |
|
var _b60 = $(); |
|
var qq = opts.multiple ? q.split(opts.separator) : [q]; |
|
if (opts.mode == "remote") { |
|
_b61(qq); |
|
_b59(_b5e, null, { |
|
q: q |
|
}, true); |
|
} else { |
|
var _b62 = $(_b5e).combo("panel"); |
|
_b62.find(".combobox-item-hover").removeClass("combobox-item-hover"); |
|
_b62.find(".combobox-item,.combobox-group").hide(); |
|
var data = _b5f.data; |
|
var vv = []; |
|
$.map(qq, function (q) { |
|
q = $.trim(q); |
|
var _b63 = q; |
|
var _b64 = undefined; |
|
_b60 = $(); |
|
for (var i = 0; i < data.length; i++) { |
|
var row = data[i]; |
|
if (opts.filter.call(_b5e, q, row)) { |
|
var v = row[opts.valueField]; |
|
var s = row[opts.textField]; |
|
var g = row[opts.groupField]; |
|
var item = opts.finder.getEl(_b5e, v).show(); |
|
if (s.toLowerCase() == q.toLowerCase()) { |
|
_b63 = v; |
|
if (opts.reversed) { |
|
_b60 = item; |
|
} else { |
|
_b42(_b5e, v, true); |
|
} |
|
} |
|
if (opts.groupField && _b64 != g) { |
|
opts.finder.getGroupEl(_b5e, g).show(); |
|
_b64 = g; |
|
} |
|
} |
|
} |
|
vv.push(_b63); |
|
}); |
|
_b61(vv); |
|
} |
|
function _b61(vv) { |
|
if (opts.reversed) { |
|
_b60.addClass("combobox-item-hover"); |
|
} else { |
|
_b47(_b5e, opts.multiple ? (q ? vv : []) : vv, true); |
|
} |
|
}; |
|
}; |
|
function _b65(_b66) { |
|
var t = $(_b66); |
|
var opts = t.combobox("options"); |
|
var _b67 = t.combobox("panel"); |
|
var item = _b67.children("div.combobox-item-hover"); |
|
if (item.length) { |
|
item.removeClass("combobox-item-hover"); |
|
var row = opts.finder.getRow(_b66, item); |
|
var _b68 = row[opts.valueField]; |
|
if (opts.multiple) { |
|
if (item.hasClass("combobox-item-selected")) { |
|
t.combobox("unselect", _b68); |
|
} else { |
|
t.combobox("select", _b68); |
|
} |
|
} else { |
|
t.combobox("select", _b68); |
|
} |
|
} |
|
var vv = []; |
|
$.map(t.combobox("getValues"), function (v) { |
|
if (_b36(_b66, v) >= 0) { |
|
vv.push(v); |
|
} |
|
}); |
|
t.combobox("setValues", vv); |
|
if (!opts.multiple) { |
|
t.combobox("hidePanel"); |
|
} |
|
}; |
|
function _b69(_b6a) { |
|
var _b6b = $.data(_b6a, "combobox"); |
|
var opts = _b6b.options; |
|
$(_b6a).addClass("combobox-f"); |
|
$(_b6a).combo($.extend({}, opts, { |
|
onShowPanel: function () { |
|
$(this).combo("panel").find("div.combobox-item:hidden,div.combobox-group:hidden").show(); |
|
_b47(this, $(this).combobox("getValues"), true); |
|
$(this).combobox("scrollTo", $(this).combobox("getValue")); |
|
opts.onShowPanel.call(this); |
|
} |
|
})); |
|
}; |
|
function _b6c(e) { |
|
$(this).children("div.combobox-item-hover").removeClass("combobox-item-hover"); |
|
var item = $(e.target).closest("div.combobox-item"); |
|
if (!item.hasClass("combobox-item-disabled")) { |
|
item.addClass("combobox-item-hover"); |
|
} |
|
e.stopPropagation(); |
|
}; |
|
function _b6d(e) { |
|
$(e.target).closest("div.combobox-item").removeClass("combobox-item-hover"); |
|
e.stopPropagation(); |
|
}; |
|
function _b6e(e) { |
|
var _b6f = $(this).panel("options").comboTarget; |
|
if (!_b6f) { |
|
return; |
|
} |
|
var opts = $(_b6f).combobox("options"); |
|
var item = $(e.target).closest("div.combobox-item"); |
|
if (!item.length || item.hasClass("combobox-item-disabled")) { |
|
return; |
|
} |
|
var row = opts.finder.getRow(_b6f, item); |
|
if (!row) { |
|
return; |
|
} |
|
if (opts.blurTimer) { |
|
clearTimeout(opts.blurTimer); |
|
opts.blurTimer = null; |
|
} |
|
opts.onClick.call(_b6f, row); |
|
var _b70 = row[opts.valueField]; |
|
if (opts.multiple) { |
|
if (item.hasClass("combobox-item-selected")) { |
|
_b48(_b6f, _b70); |
|
} else { |
|
_b42(_b6f, _b70); |
|
} |
|
} else { |
|
$(_b6f).combobox("setValue", _b70).combobox("hidePanel"); |
|
} |
|
e.stopPropagation(); |
|
}; |
|
function _b71(e) { |
|
var _b72 = $(this).panel("options").comboTarget; |
|
if (!_b72) { |
|
return; |
|
} |
|
var opts = $(_b72).combobox("options"); |
|
if (opts.groupPosition == "sticky") { |
|
var _b73 = $(this).children(".combobox-stick"); |
|
if (!_b73.length) { |
|
_b73 = $("<div class=\"combobox-stick\"></div>").appendTo(this); |
|
} |
|
_b73.hide(); |
|
var _b74 = $(_b72).data("combobox"); |
|
$(this).children(".combobox-group:visible").each(function () { |
|
var g = $(this); |
|
var _b75 = opts.finder.getGroup(_b72, g); |
|
var _b76 = _b74.data[_b75.startIndex + _b75.count - 1]; |
|
var last = opts.finder.getEl(_b72, _b76[opts.valueField]); |
|
if (g.position().top < 0 && last.position().top > 0) { |
|
_b73.show().html(g.html()); |
|
return false; |
|
} |
|
}); |
|
} |
|
}; |
|
$.fn.combobox = function (_b77, _b78) { |
|
if (typeof _b77 == "string") { |
|
var _b79 = $.fn.combobox.methods[_b77]; |
|
if (_b79) { |
|
return _b79(this, _b78); |
|
} else { |
|
return this.combo(_b77, _b78); |
|
} |
|
} |
|
_b77 = _b77 || {}; |
|
return this.each(function () { |
|
var _b7a = $.data(this, "combobox"); |
|
if (_b7a) { |
|
$.extend(_b7a.options, _b77); |
|
} else { |
|
_b7a = $.data(this, "combobox", { |
|
options: $.extend({}, $.fn.combobox.defaults, $.fn.combobox.parseOptions(this), _b77), |
|
data: [] |
|
}); |
|
} |
|
_b69(this); |
|
if (_b7a.options.data) { |
|
_b55(this, _b7a.options.data); |
|
} else { |
|
var data = $.fn.combobox.parseData(this); |
|
if (data.length) { |
|
_b55(this, data); |
|
} |
|
} |
|
_b59(this); |
|
}); |
|
}; |
|
$.fn.combobox.methods = { |
|
options: function (jq) { |
|
var _b7b = jq.combo("options"); |
|
return $.extend($.data(jq[0], "combobox").options, { |
|
width: _b7b.width, |
|
height: _b7b.height, |
|
originalValue: _b7b.originalValue, |
|
disabled: _b7b.disabled, |
|
readonly: _b7b.readonly |
|
}); |
|
}, |
|
cloneFrom: function (jq, from) { |
|
return jq.each(function () { |
|
$(this).combo("cloneFrom", from); |
|
$.data(this, "combobox", $(from).data("combobox")); |
|
$(this).addClass("combobox-f").attr("comboboxName", $(this).attr("textboxName")); |
|
}); |
|
}, |
|
getData: function (jq) { |
|
return $.data(jq[0], "combobox").data; |
|
}, |
|
setValues: function (jq, _b7c) { |
|
return jq.each(function () { |
|
var opts = $(this).combobox("options"); |
|
if ($.isArray(_b7c)) { |
|
_b7c = $.map(_b7c, function (_b7d) { |
|
if (_b7d && typeof _b7d == "object") { |
|
$.easyui.addArrayItem(opts.mappingRows, opts.valueField, _b7d); |
|
return _b7d[opts.valueField]; |
|
} else { |
|
return _b7d; |
|
} |
|
}); |
|
} |
|
_b47(this, _b7c); |
|
}); |
|
}, |
|
setValue: function (jq, _b7e) { |
|
return jq.each(function () { |
|
$(this).combobox("setValues", $.isArray(_b7e) ? _b7e : [_b7e]); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
_b47(this, []); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).combobox("options"); |
|
if (opts.multiple) { |
|
$(this).combobox("setValues", opts.originalValue); |
|
} else { |
|
$(this).combobox("setValue", opts.originalValue); |
|
} |
|
}); |
|
}, |
|
loadData: function (jq, data) { |
|
return jq.each(function () { |
|
_b55(this, data); |
|
}); |
|
}, |
|
reload: function (jq, url) { |
|
return jq.each(function () { |
|
if (typeof url == "string") { |
|
_b59(this, url); |
|
} else { |
|
if (url) { |
|
var opts = $(this).combobox("options"); |
|
opts.queryParams = url; |
|
} |
|
_b59(this); |
|
} |
|
}); |
|
}, |
|
select: function (jq, _b7f) { |
|
return jq.each(function () { |
|
_b42(this, _b7f); |
|
}); |
|
}, |
|
unselect: function (jq, _b80) { |
|
return jq.each(function () { |
|
_b48(this, _b80); |
|
}); |
|
}, |
|
scrollTo: function (jq, _b81) { |
|
return jq.each(function () { |
|
_b3a(this, _b81); |
|
}); |
|
} |
|
}; |
|
$.fn.combobox.parseOptions = function (_b82) { |
|
var t = $(_b82); |
|
return $.extend({}, $.fn.combo.parseOptions(_b82), $.parser.parseOptions(_b82, ["valueField", "textField", "groupField", "groupPosition", "mode", "method", "url", { |
|
showItemIcon: "boolean", |
|
limitToList: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.combobox.parseData = function (_b83) { |
|
var data = []; |
|
var opts = $(_b83).combobox("options"); |
|
$(_b83).children().each(function () { |
|
if (this.tagName.toLowerCase() == "optgroup") { |
|
var _b84 = $(this).attr("label"); |
|
$(this).children().each(function () { |
|
_b85(this, _b84); |
|
}); |
|
} else { |
|
_b85(this); |
|
} |
|
}); |
|
return data; |
|
function _b85(el, _b86) { |
|
var t = $(el); |
|
var row = {}; |
|
row[opts.valueField] = t.attr("value") != undefined ? t.attr("value") : t.text(); |
|
row[opts.textField] = t.text(); |
|
row["iconCls"] = $.parser.parseOptions(el, ["iconCls"]).iconCls; |
|
row["selected"] = t.is(":selected"); |
|
row["disabled"] = t.is(":disabled"); |
|
if (_b86) { |
|
opts.groupField = opts.groupField || "group"; |
|
row[opts.groupField] = _b86; |
|
} |
|
data.push(row); |
|
}; |
|
}; |
|
var _b87 = 0; |
|
var _b88 = { |
|
render: function (_b89, _b8a, data) { |
|
var _b8b = $.data(_b89, "combobox"); |
|
var opts = _b8b.options; |
|
var _b8c = $(_b89).attr("id") || ""; |
|
_b87++; |
|
_b8b.itemIdPrefix = _b8c + "_easyui_combobox_i" + _b87; |
|
_b8b.groupIdPrefix = _b8c + "_easyui_combobox_g" + _b87; |
|
_b8b.groups = []; |
|
var dd = []; |
|
var _b8d = undefined; |
|
for (var i = 0; i < data.length; i++) { |
|
var row = data[i]; |
|
var v = row[opts.valueField] + ""; |
|
var s = row[opts.textField]; |
|
var g = row[opts.groupField]; |
|
if (g) { |
|
if (_b8d != g) { |
|
_b8d = g; |
|
_b8b.groups.push({ |
|
value: g, |
|
startIndex: i, |
|
count: 1 |
|
}); |
|
dd.push("<div id=\"" + (_b8b.groupIdPrefix + "_" + (_b8b.groups.length - 1)) + "\" class=\"combobox-group\">"); |
|
dd.push(opts.groupFormatter ? opts.groupFormatter.call(_b89, g) : g); |
|
dd.push("</div>"); |
|
} else { |
|
_b8b.groups[_b8b.groups.length - 1].count++; |
|
} |
|
} else { |
|
_b8d = undefined; |
|
} |
|
var cls = "combobox-item" + (row.disabled ? " combobox-item-disabled" : "") + (g ? " combobox-gitem" : ""); |
|
dd.push("<div id=\"" + (_b8b.itemIdPrefix + "_" + i) + "\" class=\"" + cls + "\">"); |
|
if (opts.showItemIcon && row.iconCls) { |
|
dd.push("<span class=\"combobox-icon " + row.iconCls + "\"></span>"); |
|
} |
|
dd.push(opts.formatter ? opts.formatter.call(_b89, row) : s); |
|
dd.push("</div>"); |
|
} |
|
$(_b8a).html(dd.join("")); |
|
} |
|
}; |
|
$.fn.combobox.defaults = $.extend({}, $.fn.combo.defaults, { |
|
valueField: "value", |
|
textField: "text", |
|
groupPosition: "static", |
|
groupField: null, |
|
groupFormatter: function (_b8e) { |
|
return _b8e; |
|
}, |
|
mode: "local", |
|
method: "post", |
|
url: null, |
|
data: null, |
|
queryParams: {}, |
|
showItemIcon: false, |
|
limitToList: false, |
|
unselectedValues: [], |
|
mappingRows: [], |
|
view: _b88, |
|
keyHandler: { |
|
up: function (e) { |
|
nav(this, "prev"); |
|
e.preventDefault(); |
|
}, |
|
down: function (e) { |
|
nav(this, "next"); |
|
e.preventDefault(); |
|
}, |
|
left: function (e) {}, |
|
right: function (e) {}, |
|
enter: function (e) { |
|
_b65(this); |
|
}, |
|
query: function (q, e) { |
|
_b5d(this, q); |
|
} |
|
}, |
|
inputEvents: $.extend({}, $.fn.combo.defaults.inputEvents, { |
|
blur: function (e) { |
|
$.fn.combo.defaults.inputEvents.blur(e); |
|
var _b8f = e.data.target; |
|
var opts = $(_b8f).combobox("options"); |
|
if (opts.reversed || opts.limitToList) { |
|
if (opts.blurTimer) { |
|
clearTimeout(opts.blurTimer); |
|
} |
|
opts.blurTimer = setTimeout(function () { |
|
var _b90 = $(_b8f).parent().length; |
|
if (_b90) { |
|
if (opts.reversed) { |
|
$(_b8f).combobox("setValues", $(_b8f).combobox("getValues")); |
|
} else { |
|
if (opts.limitToList) { |
|
var vv = []; |
|
$.map($(_b8f).combobox("getValues"), function (v) { |
|
var _b91 = $.easyui.indexOfArray($(_b8f).combobox("getData"), opts.valueField, v); |
|
if (_b91 >= 0) { |
|
vv.push(v); |
|
} |
|
}); |
|
$(_b8f).combobox("setValues", vv); |
|
} |
|
} |
|
opts.blurTimer = null; |
|
} |
|
}, 50); |
|
} |
|
} |
|
}), |
|
panelEvents: { |
|
mouseover: _b6c, |
|
mouseout: _b6d, |
|
mousedown: function (e) { |
|
e.preventDefault(); |
|
e.stopPropagation(); |
|
}, |
|
click: _b6e, |
|
scroll: _b71 |
|
}, |
|
filter: function (q, row) { |
|
var opts = $(this).combobox("options"); |
|
return row[opts.textField].toLowerCase().indexOf(q.toLowerCase()) >= 0; |
|
}, |
|
formatter: function (row) { |
|
var opts = $(this).combobox("options"); |
|
return row[opts.textField]; |
|
}, |
|
loader: function (_b92, _b93, _b94) { |
|
var opts = $(this).combobox("options"); |
|
if (!opts.url) { |
|
return false; |
|
} |
|
$.ajax({ |
|
type: opts.method, |
|
url: opts.url, |
|
data: _b92, |
|
dataType: "json", |
|
success: function (data) { |
|
_b93(data); |
|
}, |
|
error: function () { |
|
_b94.apply(this, arguments); |
|
} |
|
}); |
|
}, |
|
loadFilter: function (data) { |
|
return data; |
|
}, |
|
finder: { |
|
getEl: function (_b95, _b96) { |
|
var _b97 = _b36(_b95, _b96); |
|
var id = $.data(_b95, "combobox").itemIdPrefix + "_" + _b97; |
|
return $("#" + id); |
|
}, |
|
getGroupEl: function (_b98, _b99) { |
|
var _b9a = $.data(_b98, "combobox"); |
|
var _b9b = $.easyui.indexOfArray(_b9a.groups, "value", _b99); |
|
var id = _b9a.groupIdPrefix + "_" + _b9b; |
|
return $("#" + id); |
|
}, |
|
getGroup: function (_b9c, p) { |
|
var _b9d = $.data(_b9c, "combobox"); |
|
var _b9e = p.attr("id").substr(_b9d.groupIdPrefix.length + 1); |
|
return _b9d.groups[parseInt(_b9e)]; |
|
}, |
|
getRow: function (_b9f, p) { |
|
var _ba0 = $.data(_b9f, "combobox"); |
|
var _ba1 = (p instanceof $) ? p.attr("id").substr(_ba0.itemIdPrefix.length + 1) : _b36(_b9f, p); |
|
return _ba0.data[parseInt(_ba1)]; |
|
} |
|
}, |
|
onBeforeLoad: function (_ba2) {}, |
|
onLoadSuccess: function (data) {}, |
|
onLoadError: function () {}, |
|
onSelect: function (_ba3) {}, |
|
onUnselect: function (_ba4) {}, |
|
onClick: function (_ba5) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _ba6(_ba7) { |
|
var _ba8 = $.data(_ba7, "combotree"); |
|
var opts = _ba8.options; |
|
var tree = _ba8.tree; |
|
$(_ba7).addClass("combotree-f"); |
|
$(_ba7).combo($.extend({}, opts, { |
|
onShowPanel: function () { |
|
if (opts.editable) { |
|
tree.tree("doFilter", ""); |
|
} |
|
opts.onShowPanel.call(this); |
|
} |
|
})); |
|
var _ba9 = $(_ba7).combo("panel"); |
|
if (!tree) { |
|
tree = $("<ul></ul>").appendTo(_ba9); |
|
_ba8.tree = tree; |
|
} |
|
tree.tree($.extend({}, opts, { |
|
checkbox: opts.multiple, |
|
onLoadSuccess: function (node, data) { |
|
var _baa = $(_ba7).combotree("getValues"); |
|
if (opts.multiple) { |
|
$.map(tree.tree("getChecked"), function (node) { |
|
$.easyui.addArrayItem(_baa, node.id); |
|
}); |
|
} |
|
_baf(_ba7, _baa, _ba8.remainText); |
|
opts.onLoadSuccess.call(this, node, data); |
|
}, |
|
onClick: function (node) { |
|
if (opts.multiple) { |
|
$(this).tree(node.checked ? "uncheck" : "check", node.target); |
|
} else { |
|
$(_ba7).combo("hidePanel"); |
|
} |
|
_ba8.remainText = false; |
|
_bac(_ba7); |
|
opts.onClick.call(this, node); |
|
}, |
|
onCheck: function (node, _bab) { |
|
_ba8.remainText = false; |
|
_bac(_ba7); |
|
opts.onCheck.call(this, node, _bab); |
|
} |
|
})); |
|
}; |
|
function _bac(_bad) { |
|
var _bae = $.data(_bad, "combotree"); |
|
var opts = _bae.options; |
|
var tree = _bae.tree; |
|
var vv = []; |
|
if (opts.multiple) { |
|
vv = $.map(tree.tree("getChecked"), function (node) { |
|
return node.id; |
|
}); |
|
} else { |
|
var node = tree.tree("getSelected"); |
|
if (node) { |
|
vv.push(node.id); |
|
} |
|
} |
|
vv = vv.concat(opts.unselectedValues); |
|
_baf(_bad, vv, _bae.remainText); |
|
}; |
|
function _baf(_bb0, _bb1, _bb2) { |
|
var _bb3 = $.data(_bb0, "combotree"); |
|
var opts = _bb3.options; |
|
var tree = _bb3.tree; |
|
var _bb4 = tree.tree("options"); |
|
var _bb5 = _bb4.onBeforeCheck; |
|
var _bb6 = _bb4.onCheck; |
|
var _bb7 = _bb4.onBeforeSelect; |
|
var _bb8 = _bb4.onSelect; |
|
_bb4.onBeforeCheck = _bb4.onCheck = _bb4.onBeforeSelect = _bb4.onSelect = function () {}; |
|
if (!$.isArray(_bb1)) { |
|
_bb1 = _bb1.split(opts.separator); |
|
} |
|
if (!opts.multiple) { |
|
_bb1 = _bb1.length ? [_bb1[0]] : [""]; |
|
} |
|
var vv = $.map(_bb1, function (_bb9) { |
|
return String(_bb9); |
|
}); |
|
tree.find("div.tree-node-selected").removeClass("tree-node-selected"); |
|
$.map(tree.tree("getChecked"), function (node) { |
|
if ($.inArray(String(node.id), vv) == -1) { |
|
tree.tree("uncheck", node.target); |
|
} |
|
}); |
|
var ss = []; |
|
opts.unselectedValues = []; |
|
$.map(vv, function (v) { |
|
var node = tree.tree("find", v); |
|
if (node) { |
|
tree.tree("check", node.target).tree("select", node.target); |
|
ss.push(_bba(node)); |
|
} else { |
|
ss.push(_bbb(v, opts.mappingRows) || v); |
|
opts.unselectedValues.push(v); |
|
} |
|
}); |
|
if (opts.multiple) { |
|
$.map(tree.tree("getChecked"), function (node) { |
|
var id = String(node.id); |
|
if ($.inArray(id, vv) == -1) { |
|
vv.push(id); |
|
ss.push(_bba(node)); |
|
} |
|
}); |
|
} |
|
_bb4.onBeforeCheck = _bb5; |
|
_bb4.onCheck = _bb6; |
|
_bb4.onBeforeSelect = _bb7; |
|
_bb4.onSelect = _bb8; |
|
if (!_bb2) { |
|
var s = ss.join(opts.separator); |
|
if ($(_bb0).combo("getText") != s) { |
|
$(_bb0).combo("setText", s); |
|
} |
|
} |
|
$(_bb0).combo("setValues", vv); |
|
function _bbb(_bbc, a) { |
|
var item = $.easyui.getArrayItem(a, "id", _bbc); |
|
return item ? _bba(item) : undefined; |
|
}; |
|
function _bba(node) { |
|
return node[opts.textField || ""] || node.text; |
|
}; |
|
}; |
|
function _bbd(_bbe, q) { |
|
var _bbf = $.data(_bbe, "combotree"); |
|
var opts = _bbf.options; |
|
var tree = _bbf.tree; |
|
_bbf.remainText = true; |
|
tree.tree("doFilter", opts.multiple ? q.split(opts.separator) : q); |
|
}; |
|
function _bc0(_bc1) { |
|
var _bc2 = $.data(_bc1, "combotree"); |
|
_bc2.remainText = false; |
|
$(_bc1).combotree("setValues", $(_bc1).combotree("getValues")); |
|
$(_bc1).combotree("hidePanel"); |
|
}; |
|
$.fn.combotree = function (_bc3, _bc4) { |
|
if (typeof _bc3 == "string") { |
|
var _bc5 = $.fn.combotree.methods[_bc3]; |
|
if (_bc5) { |
|
return _bc5(this, _bc4); |
|
} else { |
|
return this.combo(_bc3, _bc4); |
|
} |
|
} |
|
_bc3 = _bc3 || {}; |
|
return this.each(function () { |
|
var _bc6 = $.data(this, "combotree"); |
|
if (_bc6) { |
|
$.extend(_bc6.options, _bc3); |
|
} else { |
|
$.data(this, "combotree", { |
|
options: $.extend({}, $.fn.combotree.defaults, $.fn.combotree.parseOptions(this), _bc3) |
|
}); |
|
} |
|
_ba6(this); |
|
}); |
|
}; |
|
$.fn.combotree.methods = { |
|
options: function (jq) { |
|
var _bc7 = jq.combo("options"); |
|
return $.extend($.data(jq[0], "combotree").options, { |
|
width: _bc7.width, |
|
height: _bc7.height, |
|
originalValue: _bc7.originalValue, |
|
disabled: _bc7.disabled, |
|
readonly: _bc7.readonly |
|
}); |
|
}, |
|
clone: function (jq, _bc8) { |
|
var t = jq.combo("clone", _bc8); |
|
t.data("combotree", { |
|
options: $.extend(true, {}, jq.combotree("options")), |
|
tree: jq.combotree("tree") |
|
}); |
|
return t; |
|
}, |
|
tree: function (jq) { |
|
return $.data(jq[0], "combotree").tree; |
|
}, |
|
loadData: function (jq, data) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "combotree").options; |
|
opts.data = data; |
|
var tree = $.data(this, "combotree").tree; |
|
tree.tree("loadData", data); |
|
}); |
|
}, |
|
reload: function (jq, url) { |
|
return jq.each(function () { |
|
var opts = $.data(this, "combotree").options; |
|
var tree = $.data(this, "combotree").tree; |
|
if (url) { |
|
opts.url = url; |
|
} |
|
tree.tree({ |
|
url: opts.url |
|
}); |
|
}); |
|
}, |
|
setValues: function (jq, _bc9) { |
|
return jq.each(function () { |
|
var opts = $(this).combotree("options"); |
|
if ($.isArray(_bc9)) { |
|
_bc9 = $.map(_bc9, function (_bca) { |
|
if (_bca && typeof _bca == "object") { |
|
$.easyui.addArrayItem(opts.mappingRows, "id", _bca); |
|
return _bca.id; |
|
} else { |
|
return _bca; |
|
} |
|
}); |
|
} |
|
_baf(this, _bc9); |
|
}); |
|
}, |
|
setValue: function (jq, _bcb) { |
|
return jq.each(function () { |
|
$(this).combotree("setValues", $.isArray(_bcb) ? _bcb : [_bcb]); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
$(this).combotree("setValues", []); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).combotree("options"); |
|
if (opts.multiple) { |
|
$(this).combotree("setValues", opts.originalValue); |
|
} else { |
|
$(this).combotree("setValue", opts.originalValue); |
|
} |
|
}); |
|
} |
|
}; |
|
$.fn.combotree.parseOptions = function (_bcc) { |
|
return $.extend({}, $.fn.combo.parseOptions(_bcc), $.fn.tree.parseOptions(_bcc)); |
|
}; |
|
$.fn.combotree.defaults = $.extend({}, $.fn.combo.defaults, $.fn.tree.defaults, { |
|
editable: false, |
|
textField: null, |
|
unselectedValues: [], |
|
mappingRows: [], |
|
keyHandler: { |
|
up: function (e) {}, |
|
down: function (e) {}, |
|
left: function (e) {}, |
|
right: function (e) {}, |
|
enter: function (e) { |
|
_bc0(this); |
|
}, |
|
query: function (q, e) { |
|
_bbd(this, q); |
|
} |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _bcd(_bce) { |
|
var _bcf = $.data(_bce, "combogrid"); |
|
var opts = _bcf.options; |
|
var grid = _bcf.grid; |
|
$(_bce).addClass("combogrid-f").combo($.extend({}, opts, { |
|
onShowPanel: function () { |
|
_be6(this, $(this).combogrid("getValues"), true); |
|
var p = $(this).combogrid("panel"); |
|
var _bd0 = p.outerHeight() - p.height(); |
|
var _bd1 = p._size("minHeight"); |
|
var _bd2 = p._size("maxHeight"); |
|
var dg = $(this).combogrid("grid"); |
|
dg.datagrid("resize", { |
|
width: "100%", |
|
height: (isNaN(parseInt(opts.panelHeight)) ? "auto" : "100%"), |
|
minHeight: (_bd1 ? _bd1 - _bd0 : ""), |
|
maxHeight: (_bd2 ? _bd2 - _bd0 : "") |
|
}); |
|
var row = dg.datagrid("getSelected"); |
|
if (row) { |
|
dg.datagrid("scrollTo", dg.datagrid("getRowIndex", row)); |
|
} |
|
opts.onShowPanel.call(this); |
|
} |
|
})); |
|
var _bd3 = $(_bce).combo("panel"); |
|
if (!grid) { |
|
grid = $("<table></table>").appendTo(_bd3); |
|
_bcf.grid = grid; |
|
} |
|
grid.datagrid($.extend({}, opts, { |
|
border: false, |
|
singleSelect: (!opts.multiple), |
|
onLoadSuccess: _bd4, |
|
onClickRow: _bd5, |
|
onSelect: _bd6("onSelect"), |
|
onUnselect: _bd6("onUnselect"), |
|
onSelectAll: _bd6("onSelectAll"), |
|
onUnselectAll: _bd6("onUnselectAll") |
|
})); |
|
function _bd7(dg) { |
|
return $(dg).closest(".combo-panel").panel("options").comboTarget || _bce; |
|
}; |
|
function _bd4(data) { |
|
var _bd8 = _bd7(this); |
|
var _bd9 = $(_bd8).data("combogrid"); |
|
var opts = _bd9.options; |
|
var _bda = $(_bd8).combo("getValues"); |
|
_be6(_bd8, _bda, _bd9.remainText); |
|
opts.onLoadSuccess.call(this, data); |
|
}; |
|
function _bd5(_bdb, row) { |
|
var _bdc = _bd7(this); |
|
var _bdd = $(_bdc).data("combogrid"); |
|
var opts = _bdd.options; |
|
_bdd.remainText = false; |
|
_bde.call(this); |
|
if (!opts.multiple) { |
|
$(_bdc).combo("hidePanel"); |
|
} |
|
opts.onClickRow.call(this, _bdb, row); |
|
}; |
|
function _bd6(_bdf) { |
|
return function (_be0, row) { |
|
var _be1 = _bd7(this); |
|
var opts = $(_be1).combogrid("options"); |
|
if (_bdf == "onUnselectAll") { |
|
if (opts.multiple) { |
|
_bde.call(this); |
|
} |
|
} else { |
|
_bde.call(this); |
|
} |
|
opts[_bdf].call(this, _be0, row); |
|
}; |
|
}; |
|
function _bde() { |
|
var dg = $(this); |
|
var _be2 = _bd7(dg); |
|
var _be3 = $(_be2).data("combogrid"); |
|
var opts = _be3.options; |
|
var vv = $.map(dg.datagrid("getSelections"), function (row) { |
|
return row[opts.idField]; |
|
}); |
|
vv = vv.concat(opts.unselectedValues); |
|
var _be4 = dg.data("datagrid").dc.body2; |
|
var _be5 = _be4.scrollTop(); |
|
_be6(_be2, vv, _be3.remainText); |
|
_be4.scrollTop(_be5); |
|
}; |
|
}; |
|
function nav(_be7, dir) { |
|
var _be8 = $.data(_be7, "combogrid"); |
|
var opts = _be8.options; |
|
var grid = _be8.grid; |
|
var _be9 = grid.datagrid("getRows").length; |
|
if (!_be9) { |
|
return; |
|
} |
|
var tr = opts.finder.getTr(grid[0], null, "highlight"); |
|
if (!tr.length) { |
|
tr = opts.finder.getTr(grid[0], null, "selected"); |
|
} |
|
var _bea; |
|
if (!tr.length) { |
|
_bea = (dir == "next" ? 0 : _be9 - 1); |
|
} else { |
|
var _bea = parseInt(tr.attr("datagrid-row-index")); |
|
_bea += (dir == "next" ? 1 : -1); |
|
if (_bea < 0) { |
|
_bea = _be9 - 1; |
|
} |
|
if (_bea >= _be9) { |
|
_bea = 0; |
|
} |
|
} |
|
grid.datagrid("highlightRow", _bea); |
|
if (opts.selectOnNavigation) { |
|
_be8.remainText = false; |
|
grid.datagrid("selectRow", _bea); |
|
} |
|
}; |
|
function _be6(_beb, _bec, _bed) { |
|
var _bee = $.data(_beb, "combogrid"); |
|
var opts = _bee.options; |
|
var grid = _bee.grid; |
|
var _bef = $(_beb).combo("getValues"); |
|
var _bf0 = $(_beb).combo("options"); |
|
var _bf1 = _bf0.onChange; |
|
_bf0.onChange = function () {}; |
|
var _bf2 = grid.datagrid("options"); |
|
var _bf3 = _bf2.onSelect; |
|
var _bf4 = _bf2.onUnselectAll; |
|
_bf2.onSelect = _bf2.onUnselectAll = function () {}; |
|
if (!$.isArray(_bec)) { |
|
_bec = _bec.split(opts.separator); |
|
} |
|
if (!opts.multiple) { |
|
_bec = _bec.length ? [_bec[0]] : [""]; |
|
} |
|
var vv = $.map(_bec, function (_bf5) { |
|
return String(_bf5); |
|
}); |
|
vv = $.grep(vv, function (v, _bf6) { |
|
return _bf6 === $.inArray(v, vv); |
|
}); |
|
var _bf7 = $.grep(grid.datagrid("getSelections"), function (row, _bf8) { |
|
return $.inArray(String(row[opts.idField]), vv) >= 0; |
|
}); |
|
grid.datagrid("clearSelections"); |
|
grid.data("datagrid").selectedRows = _bf7; |
|
var ss = []; |
|
opts.unselectedValues = []; |
|
$.map(vv, function (v) { |
|
var _bf9 = grid.datagrid("getRowIndex", v); |
|
if (_bf9 >= 0) { |
|
grid.datagrid("selectRow", _bf9); |
|
} else { |
|
if ($.easyui.indexOfArray(_bf7, opts.idField, v) == -1) { |
|
opts.unselectedValues.push(v); |
|
} |
|
} |
|
ss.push(_bfa(v, grid.datagrid("getRows")) || _bfa(v, _bf7) || _bfa(v, opts.mappingRows) || v); |
|
}); |
|
$(_beb).combo("setValues", _bef); |
|
_bf0.onChange = _bf1; |
|
_bf2.onSelect = _bf3; |
|
_bf2.onUnselectAll = _bf4; |
|
if (!_bed) { |
|
var s = ss.join(opts.separator); |
|
if ($(_beb).combo("getText") != s) { |
|
$(_beb).combo("setText", s); |
|
} |
|
} |
|
$(_beb).combo("setValues", _bec); |
|
function _bfa(_bfb, a) { |
|
var item = $.easyui.getArrayItem(a, opts.idField, _bfb); |
|
return item ? item[opts.textField] : undefined; |
|
}; |
|
}; |
|
function _bfc(_bfd, q) { |
|
var _bfe = $.data(_bfd, "combogrid"); |
|
var opts = _bfe.options; |
|
var grid = _bfe.grid; |
|
_bfe.remainText = true; |
|
var qq = opts.multiple ? q.split(opts.separator) : [q]; |
|
qq = $.grep(qq, function (q) { |
|
return $.trim(q) != ""; |
|
}); |
|
if (opts.mode == "remote") { |
|
_bff(qq); |
|
grid.datagrid("load", $.extend({}, opts.queryParams, { |
|
q: q |
|
})); |
|
} else { |
|
grid.datagrid("highlightRow", -1); |
|
var rows = grid.datagrid("getRows"); |
|
var vv = []; |
|
$.map(qq, function (q) { |
|
q = $.trim(q); |
|
var _c00 = q; |
|
_c01(opts.mappingRows, q); |
|
_c01(grid.datagrid("getSelections"), q); |
|
var _c02 = _c01(rows, q); |
|
if (_c02 >= 0) { |
|
if (opts.reversed) { |
|
grid.datagrid("highlightRow", _c02); |
|
} |
|
} else { |
|
$.map(rows, function (row, i) { |
|
if (opts.filter.call(_bfd, q, row)) { |
|
grid.datagrid("highlightRow", i); |
|
} |
|
}); |
|
} |
|
}); |
|
_bff(vv); |
|
} |
|
function _c01(rows, q) { |
|
for (var i = 0; i < rows.length; i++) { |
|
var row = rows[i]; |
|
if ((row[opts.textField] || "").toLowerCase() == q.toLowerCase()) { |
|
vv.push(row[opts.idField]); |
|
return i; |
|
} |
|
} |
|
return -1; |
|
}; |
|
function _bff(vv) { |
|
if (!opts.reversed) { |
|
_be6(_bfd, vv, true); |
|
} |
|
}; |
|
}; |
|
function _c03(_c04) { |
|
var _c05 = $.data(_c04, "combogrid"); |
|
var opts = _c05.options; |
|
var grid = _c05.grid; |
|
var tr = opts.finder.getTr(grid[0], null, "highlight"); |
|
_c05.remainText = false; |
|
if (tr.length) { |
|
var _c06 = parseInt(tr.attr("datagrid-row-index")); |
|
if (opts.multiple) { |
|
if (tr.hasClass("datagrid-row-selected")) { |
|
grid.datagrid("unselectRow", _c06); |
|
} else { |
|
grid.datagrid("selectRow", _c06); |
|
} |
|
} else { |
|
grid.datagrid("selectRow", _c06); |
|
} |
|
} |
|
var vv = []; |
|
$.map(grid.datagrid("getSelections"), function (row) { |
|
vv.push(row[opts.idField]); |
|
}); |
|
$.map(opts.unselectedValues, function (v) { |
|
if ($.easyui.indexOfArray(opts.mappingRows, opts.idField, v) >= 0) { |
|
$.easyui.addArrayItem(vv, v); |
|
} |
|
}); |
|
$(_c04).combogrid("setValues", vv); |
|
if (!opts.multiple) { |
|
$(_c04).combogrid("hidePanel"); |
|
} |
|
}; |
|
$.fn.combogrid = function (_c07, _c08) { |
|
if (typeof _c07 == "string") { |
|
var _c09 = $.fn.combogrid.methods[_c07]; |
|
if (_c09) { |
|
return _c09(this, _c08); |
|
} else { |
|
return this.combo(_c07, _c08); |
|
} |
|
} |
|
_c07 = _c07 || {}; |
|
return this.each(function () { |
|
var _c0a = $.data(this, "combogrid"); |
|
if (_c0a) { |
|
$.extend(_c0a.options, _c07); |
|
} else { |
|
_c0a = $.data(this, "combogrid", { |
|
options: $.extend({}, $.fn.combogrid.defaults, $.fn.combogrid.parseOptions(this), _c07) |
|
}); |
|
} |
|
_bcd(this); |
|
}); |
|
}; |
|
$.fn.combogrid.methods = { |
|
options: function (jq) { |
|
var _c0b = jq.combo("options"); |
|
return $.extend($.data(jq[0], "combogrid").options, { |
|
width: _c0b.width, |
|
height: _c0b.height, |
|
originalValue: _c0b.originalValue, |
|
disabled: _c0b.disabled, |
|
readonly: _c0b.readonly |
|
}); |
|
}, |
|
cloneFrom: function (jq, from) { |
|
return jq.each(function () { |
|
$(this).combo("cloneFrom", from); |
|
$.data(this, "combogrid", { |
|
options: $.extend(true, { |
|
cloned: true |
|
}, $(from).combogrid("options")), |
|
combo: $(this).next(), |
|
panel: $(from).combo("panel"), |
|
grid: $(from).combogrid("grid") |
|
}); |
|
}); |
|
}, |
|
grid: function (jq) { |
|
return $.data(jq[0], "combogrid").grid; |
|
}, |
|
setValues: function (jq, _c0c) { |
|
return jq.each(function () { |
|
var opts = $(this).combogrid("options"); |
|
if ($.isArray(_c0c)) { |
|
_c0c = $.map(_c0c, function (_c0d) { |
|
if (_c0d && typeof _c0d == "object") { |
|
$.easyui.addArrayItem(opts.mappingRows, opts.idField, _c0d); |
|
return _c0d[opts.idField]; |
|
} else { |
|
return _c0d; |
|
} |
|
}); |
|
} |
|
_be6(this, _c0c); |
|
}); |
|
}, |
|
setValue: function (jq, _c0e) { |
|
return jq.each(function () { |
|
$(this).combogrid("setValues", $.isArray(_c0e) ? _c0e : [_c0e]); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
$(this).combogrid("setValues", []); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).combogrid("options"); |
|
if (opts.multiple) { |
|
$(this).combogrid("setValues", opts.originalValue); |
|
} else { |
|
$(this).combogrid("setValue", opts.originalValue); |
|
} |
|
}); |
|
} |
|
}; |
|
$.fn.combogrid.parseOptions = function (_c0f) { |
|
var t = $(_c0f); |
|
return $.extend({}, $.fn.combo.parseOptions(_c0f), $.fn.datagrid.parseOptions(_c0f), $.parser.parseOptions(_c0f, ["idField", "textField", "mode"])); |
|
}; |
|
$.fn.combogrid.defaults = $.extend({}, $.fn.combo.defaults, $.fn.datagrid.defaults, { |
|
loadMsg: null, |
|
idField: null, |
|
textField: null, |
|
unselectedValues: [], |
|
mappingRows: [], |
|
mode: "local", |
|
keyHandler: { |
|
up: function (e) { |
|
nav(this, "prev"); |
|
e.preventDefault(); |
|
}, |
|
down: function (e) { |
|
nav(this, "next"); |
|
e.preventDefault(); |
|
}, |
|
left: function (e) {}, |
|
right: function (e) {}, |
|
enter: function (e) { |
|
_c03(this); |
|
}, |
|
query: function (q, e) { |
|
_bfc(this, q); |
|
} |
|
}, |
|
inputEvents: $.extend({}, $.fn.combo.defaults.inputEvents, { |
|
blur: function (e) { |
|
$.fn.combo.defaults.inputEvents.blur(e); |
|
var _c10 = e.data.target; |
|
var opts = $(_c10).combogrid("options"); |
|
if (opts.reversed) { |
|
$(_c10).combogrid("setValues", $(_c10).combogrid("getValues")); |
|
} |
|
} |
|
}), |
|
panelEvents: { |
|
mousedown: function (e) {} |
|
}, |
|
filter: function (q, row) { |
|
var opts = $(this).combogrid("options"); |
|
return (row[opts.textField] || "").toLowerCase().indexOf(q.toLowerCase()) >= 0; |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _c11(_c12) { |
|
var _c13 = $.data(_c12, "combotreegrid"); |
|
var opts = _c13.options; |
|
$(_c12).addClass("combotreegrid-f").combo($.extend({}, opts, { |
|
onShowPanel: function () { |
|
var p = $(this).combotreegrid("panel"); |
|
var _c14 = p.outerHeight() - p.height(); |
|
var _c15 = p._size("minHeight"); |
|
var _c16 = p._size("maxHeight"); |
|
var dg = $(this).combotreegrid("grid"); |
|
dg.treegrid("resize", { |
|
width: "100%", |
|
height: (isNaN(parseInt(opts.panelHeight)) ? "auto" : "100%"), |
|
minHeight: (_c15 ? _c15 - _c14 : ""), |
|
maxHeight: (_c16 ? _c16 - _c14 : "") |
|
}); |
|
var row = dg.treegrid("getSelected"); |
|
if (row) { |
|
dg.treegrid("scrollTo", row[opts.idField]); |
|
} |
|
opts.onShowPanel.call(this); |
|
} |
|
})); |
|
if (!_c13.grid) { |
|
var _c17 = $(_c12).combo("panel"); |
|
_c13.grid = $("<table></table>").appendTo(_c17); |
|
} |
|
_c13.grid.treegrid($.extend({}, opts, { |
|
border: false, |
|
checkbox: opts.multiple, |
|
onLoadSuccess: function (row, data) { |
|
var _c18 = $(_c12).combotreegrid("getValues"); |
|
if (opts.multiple) { |
|
$.map($(this).treegrid("getCheckedNodes"), function (row) { |
|
$.easyui.addArrayItem(_c18, row[opts.idField]); |
|
}); |
|
} |
|
_c1d(_c12, _c18); |
|
opts.onLoadSuccess.call(this, row, data); |
|
_c13.remainText = false; |
|
}, |
|
onClickRow: function (row) { |
|
if (opts.multiple) { |
|
$(this).treegrid(row.checked ? "uncheckNode" : "checkNode", row[opts.idField]); |
|
$(this).treegrid("unselect", row[opts.idField]); |
|
} else { |
|
$(_c12).combo("hidePanel"); |
|
} |
|
_c1a(_c12); |
|
opts.onClickRow.call(this, row); |
|
}, |
|
onCheckNode: function (row, _c19) { |
|
_c1a(_c12); |
|
opts.onCheckNode.call(this, row, _c19); |
|
} |
|
})); |
|
}; |
|
function _c1a(_c1b) { |
|
var _c1c = $.data(_c1b, "combotreegrid"); |
|
var opts = _c1c.options; |
|
var grid = _c1c.grid; |
|
var vv = []; |
|
if (opts.multiple) { |
|
vv = $.map(grid.treegrid("getCheckedNodes"), function (row) { |
|
return row[opts.idField]; |
|
}); |
|
} else { |
|
var row = grid.treegrid("getSelected"); |
|
if (row) { |
|
vv.push(row[opts.idField]); |
|
} |
|
} |
|
vv = vv.concat(opts.unselectedValues); |
|
_c1d(_c1b, vv); |
|
}; |
|
function _c1d(_c1e, _c1f) { |
|
var _c20 = $.data(_c1e, "combotreegrid"); |
|
var opts = _c20.options; |
|
var grid = _c20.grid; |
|
var _c21 = grid.datagrid("options"); |
|
var _c22 = _c21.onBeforeCheck; |
|
var _c23 = _c21.onCheck; |
|
var _c24 = _c21.onBeforeSelect; |
|
var _c25 = _c21.onSelect; |
|
_c21.onBeforeCheck = _c21.onCheck = _c21.onBeforeSelect = _c21.onSelect = function () {}; |
|
if (!$.isArray(_c1f)) { |
|
_c1f = _c1f.split(opts.separator); |
|
} |
|
if (!opts.multiple) { |
|
_c1f = _c1f.length ? [_c1f[0]] : [""]; |
|
} |
|
var vv = $.map(_c1f, function (_c26) { |
|
return String(_c26); |
|
}); |
|
vv = $.grep(vv, function (v, _c27) { |
|
return _c27 === $.inArray(v, vv); |
|
}); |
|
var _c28 = grid.treegrid("getSelected"); |
|
if (_c28) { |
|
grid.treegrid("unselect", _c28[opts.idField]); |
|
} |
|
$.map(grid.treegrid("getCheckedNodes"), function (row) { |
|
if ($.inArray(String(row[opts.idField]), vv) == -1) { |
|
grid.treegrid("uncheckNode", row[opts.idField]); |
|
} |
|
}); |
|
var ss = []; |
|
opts.unselectedValues = []; |
|
$.map(vv, function (v) { |
|
var row = grid.treegrid("find", v); |
|
if (row) { |
|
if (opts.multiple) { |
|
grid.treegrid("checkNode", v); |
|
} else { |
|
grid.treegrid("select", v); |
|
} |
|
ss.push(_c29(row)); |
|
} else { |
|
ss.push(_c2a(v, opts.mappingRows) || v); |
|
opts.unselectedValues.push(v); |
|
} |
|
}); |
|
if (opts.multiple) { |
|
$.map(grid.treegrid("getCheckedNodes"), function (row) { |
|
var id = String(row[opts.idField]); |
|
if ($.inArray(id, vv) == -1) { |
|
vv.push(id); |
|
ss.push(_c29(row)); |
|
} |
|
}); |
|
} |
|
_c21.onBeforeCheck = _c22; |
|
_c21.onCheck = _c23; |
|
_c21.onBeforeSelect = _c24; |
|
_c21.onSelect = _c25; |
|
if (!_c20.remainText) { |
|
var s = ss.join(opts.separator); |
|
if ($(_c1e).combo("getText") != s) { |
|
$(_c1e).combo("setText", s); |
|
} |
|
} |
|
$(_c1e).combo("setValues", vv); |
|
function _c2a(_c2b, a) { |
|
var item = $.easyui.getArrayItem(a, opts.idField, _c2b); |
|
return item ? _c29(item) : undefined; |
|
}; |
|
function _c29(row) { |
|
return row[opts.textField || ""] || row[opts.treeField]; |
|
}; |
|
}; |
|
function _c2c(_c2d, q) { |
|
var _c2e = $.data(_c2d, "combotreegrid"); |
|
var opts = _c2e.options; |
|
var grid = _c2e.grid; |
|
_c2e.remainText = true; |
|
var qq = opts.multiple ? q.split(opts.separator) : [q]; |
|
qq = $.grep(qq, function (q) { |
|
return $.trim(q) != ""; |
|
}); |
|
grid.treegrid("clearSelections").treegrid("clearChecked").treegrid("highlightRow", -1); |
|
if (opts.mode == "remote") { |
|
_c2f(qq); |
|
grid.treegrid("load", $.extend({}, opts.queryParams, { |
|
q: q |
|
})); |
|
} else { |
|
if (q) { |
|
var data = grid.treegrid("getData"); |
|
var vv = []; |
|
$.map(qq, function (q) { |
|
q = $.trim(q); |
|
if (q) { |
|
var v = undefined; |
|
$.easyui.forEach(data, true, function (row) { |
|
if (q.toLowerCase() == String(row[opts.treeField]).toLowerCase()) { |
|
v = row[opts.idField]; |
|
return false; |
|
} else { |
|
if (opts.filter.call(_c2d, q, row)) { |
|
grid.treegrid("expandTo", row[opts.idField]); |
|
grid.treegrid("highlightRow", row[opts.idField]); |
|
return false; |
|
} |
|
} |
|
}); |
|
if (v == undefined) { |
|
$.easyui.forEach(opts.mappingRows, false, function (row) { |
|
if (q.toLowerCase() == String(row[opts.treeField])) { |
|
v = row[opts.idField]; |
|
return false; |
|
} |
|
}); |
|
} |
|
if (v != undefined) { |
|
vv.push(v); |
|
} else { |
|
vv.push(q); |
|
} |
|
} |
|
}); |
|
_c2f(vv); |
|
_c2e.remainText = false; |
|
} |
|
} |
|
function _c2f(vv) { |
|
if (!opts.reversed) { |
|
$(_c2d).combotreegrid("setValues", vv); |
|
} |
|
}; |
|
}; |
|
function _c30(_c31) { |
|
var _c32 = $.data(_c31, "combotreegrid"); |
|
var opts = _c32.options; |
|
var grid = _c32.grid; |
|
var tr = opts.finder.getTr(grid[0], null, "highlight"); |
|
_c32.remainText = false; |
|
if (tr.length) { |
|
var id = tr.attr("node-id"); |
|
if (opts.multiple) { |
|
if (tr.hasClass("datagrid-row-selected")) { |
|
grid.treegrid("uncheckNode", id); |
|
} else { |
|
grid.treegrid("checkNode", id); |
|
} |
|
} else { |
|
grid.treegrid("selectRow", id); |
|
} |
|
} |
|
var vv = []; |
|
if (opts.multiple) { |
|
$.map(grid.treegrid("getCheckedNodes"), function (row) { |
|
vv.push(row[opts.idField]); |
|
}); |
|
} else { |
|
var row = grid.treegrid("getSelected"); |
|
if (row) { |
|
vv.push(row[opts.idField]); |
|
} |
|
} |
|
$.map(opts.unselectedValues, function (v) { |
|
if ($.easyui.indexOfArray(opts.mappingRows, opts.idField, v) >= 0) { |
|
$.easyui.addArrayItem(vv, v); |
|
} |
|
}); |
|
$(_c31).combotreegrid("setValues", vv); |
|
if (!opts.multiple) { |
|
$(_c31).combotreegrid("hidePanel"); |
|
} |
|
}; |
|
$.fn.combotreegrid = function (_c33, _c34) { |
|
if (typeof _c33 == "string") { |
|
var _c35 = $.fn.combotreegrid.methods[_c33]; |
|
if (_c35) { |
|
return _c35(this, _c34); |
|
} else { |
|
return this.combo(_c33, _c34); |
|
} |
|
} |
|
_c33 = _c33 || {}; |
|
return this.each(function () { |
|
var _c36 = $.data(this, "combotreegrid"); |
|
if (_c36) { |
|
$.extend(_c36.options, _c33); |
|
} else { |
|
_c36 = $.data(this, "combotreegrid", { |
|
options: $.extend({}, $.fn.combotreegrid.defaults, $.fn.combotreegrid.parseOptions(this), _c33) |
|
}); |
|
} |
|
_c11(this); |
|
}); |
|
}; |
|
$.fn.combotreegrid.methods = { |
|
options: function (jq) { |
|
var _c37 = jq.combo("options"); |
|
return $.extend($.data(jq[0], "combotreegrid").options, { |
|
width: _c37.width, |
|
height: _c37.height, |
|
originalValue: _c37.originalValue, |
|
disabled: _c37.disabled, |
|
readonly: _c37.readonly |
|
}); |
|
}, |
|
grid: function (jq) { |
|
return $.data(jq[0], "combotreegrid").grid; |
|
}, |
|
setValues: function (jq, _c38) { |
|
return jq.each(function () { |
|
var opts = $(this).combotreegrid("options"); |
|
if ($.isArray(_c38)) { |
|
_c38 = $.map(_c38, function (_c39) { |
|
if (_c39 && typeof _c39 == "object") { |
|
$.easyui.addArrayItem(opts.mappingRows, opts.idField, _c39); |
|
return _c39[opts.idField]; |
|
} else { |
|
return _c39; |
|
} |
|
}); |
|
} |
|
_c1d(this, _c38); |
|
}); |
|
}, |
|
setValue: function (jq, _c3a) { |
|
return jq.each(function () { |
|
$(this).combotreegrid("setValues", $.isArray(_c3a) ? _c3a : [_c3a]); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
$(this).combotreegrid("setValues", []); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).combotreegrid("options"); |
|
if (opts.multiple) { |
|
$(this).combotreegrid("setValues", opts.originalValue); |
|
} else { |
|
$(this).combotreegrid("setValue", opts.originalValue); |
|
} |
|
}); |
|
} |
|
}; |
|
$.fn.combotreegrid.parseOptions = function (_c3b) { |
|
var t = $(_c3b); |
|
return $.extend({}, $.fn.combo.parseOptions(_c3b), $.fn.treegrid.parseOptions(_c3b), $.parser.parseOptions(_c3b, ["mode", { |
|
limitToGrid: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.combotreegrid.defaults = $.extend({}, $.fn.combo.defaults, $.fn.treegrid.defaults, { |
|
editable: false, |
|
singleSelect: true, |
|
limitToGrid: false, |
|
unselectedValues: [], |
|
mappingRows: [], |
|
mode: "local", |
|
textField: null, |
|
keyHandler: { |
|
up: function (e) {}, |
|
down: function (e) {}, |
|
left: function (e) {}, |
|
right: function (e) {}, |
|
enter: function (e) { |
|
_c30(this); |
|
}, |
|
query: function (q, e) { |
|
_c2c(this, q); |
|
} |
|
}, |
|
inputEvents: $.extend({}, $.fn.combo.defaults.inputEvents, { |
|
blur: function (e) { |
|
$.fn.combo.defaults.inputEvents.blur(e); |
|
var _c3c = e.data.target; |
|
var opts = $(_c3c).combotreegrid("options"); |
|
if (opts.limitToGrid) { |
|
_c30(_c3c); |
|
} |
|
} |
|
}), |
|
filter: function (q, row) { |
|
var opts = $(this).combotreegrid("options"); |
|
return (row[opts.treeField] || "").toLowerCase().indexOf(q.toLowerCase()) >= 0; |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _c3d(_c3e) { |
|
var _c3f = $.data(_c3e, "tagbox"); |
|
var opts = _c3f.options; |
|
$(_c3e).addClass("tagbox-f").combobox($.extend({}, opts, { |
|
cls: "tagbox", |
|
reversed: true, |
|
onChange: function (_c40, _c41) { |
|
_c42(); |
|
$(this).combobox("hidePanel"); |
|
opts.onChange.call(_c3e, _c40, _c41); |
|
}, |
|
onResizing: function (_c43, _c44) { |
|
var _c45 = $(this).combobox("textbox"); |
|
var tb = $(this).data("textbox").textbox; |
|
var _c46 = tb.outerWidth(); |
|
tb.css({ |
|
height: "", |
|
paddingLeft: _c45.css("marginLeft"), |
|
paddingRight: _c45.css("marginRight") |
|
}); |
|
_c45.css("margin", 0); |
|
tb._outerWidth(_c46); |
|
_c59(_c3e); |
|
_c4b(this); |
|
opts.onResizing.call(_c3e, _c43, _c44); |
|
}, |
|
onLoadSuccess: function (data) { |
|
_c42(); |
|
opts.onLoadSuccess.call(_c3e, data); |
|
} |
|
})); |
|
_c42(); |
|
_c59(_c3e); |
|
function _c42() { |
|
$(_c3e).next().find(".tagbox-label").remove(); |
|
var _c47 = $(_c3e).tagbox("textbox"); |
|
var ss = []; |
|
$.map($(_c3e).tagbox("getValues"), function (_c48, _c49) { |
|
var row = opts.finder.getRow(_c3e, _c48); |
|
var text = opts.tagFormatter.call(_c3e, _c48, row); |
|
var cs = {}; |
|
var css = opts.tagStyler.call(_c3e, _c48, row) || ""; |
|
if (typeof css == "string") { |
|
cs = { |
|
s: css |
|
}; |
|
} else { |
|
cs = { |
|
c: css["class"] || "", |
|
s: css["style"] || "" |
|
}; |
|
} |
|
var _c4a = $("<span class=\"tagbox-label\"></span>").insertBefore(_c47).html(text); |
|
_c4a.attr("tagbox-index", _c49); |
|
_c4a.attr("style", cs.s).addClass(cs.c); |
|
$("<a href=\"javascript:;\" class=\"tagbox-remove\"></a>").appendTo(_c4a); |
|
}); |
|
_c4b(_c3e); |
|
$(_c3e).combobox("setText", ""); |
|
}; |
|
}; |
|
function _c4b(_c4c, _c4d) { |
|
var span = $(_c4c).next(); |
|
var _c4e = _c4d ? $(_c4d) : span.find(".tagbox-label"); |
|
if (_c4e.length) { |
|
var _c4f = $(_c4c).tagbox("textbox"); |
|
var _c50 = $(_c4e[0]); |
|
var _c51 = _c50.outerHeight(true) - _c50.outerHeight(); |
|
var _c52 = _c4f.outerHeight() - _c51 * 2; |
|
_c4e.css({ |
|
height: _c52 + "px", |
|
lineHeight: _c52 + "px" |
|
}); |
|
var _c53 = span.find(".textbox-addon").css("height", "100%"); |
|
_c53.find(".textbox-icon").css("height", "100%"); |
|
span.find(".textbox-button").linkbutton("resize", { |
|
height: "100%" |
|
}); |
|
} |
|
}; |
|
function _c54(_c55) { |
|
var span = $(_c55).next(); |
|
span._unbind(".tagbox")._bind("click.tagbox", function (e) { |
|
var opts = $(_c55).tagbox("options"); |
|
if (opts.disabled || opts.readonly) { |
|
return; |
|
} |
|
if ($(e.target).hasClass("tagbox-remove")) { |
|
var _c56 = parseInt($(e.target).parent().attr("tagbox-index")); |
|
var _c57 = $(_c55).tagbox("getValues"); |
|
if (opts.onBeforeRemoveTag.call(_c55, _c57[_c56]) == false) { |
|
return; |
|
} |
|
opts.onRemoveTag.call(_c55, _c57[_c56]); |
|
_c57.splice(_c56, 1); |
|
$(_c55).tagbox("setValues", _c57); |
|
} else { |
|
var _c58 = $(e.target).closest(".tagbox-label"); |
|
if (_c58.length) { |
|
var _c56 = parseInt(_c58.attr("tagbox-index")); |
|
var _c57 = $(_c55).tagbox("getValues"); |
|
opts.onClickTag.call(_c55, _c57[_c56]); |
|
} |
|
} |
|
$(this).find(".textbox-text").focus(); |
|
})._bind("keyup.tagbox", function (e) { |
|
_c59(_c55); |
|
})._bind("mouseover.tagbox", function (e) { |
|
if ($(e.target).closest(".textbox-button,.textbox-addon,.tagbox-label").length) { |
|
$(this).triggerHandler("mouseleave"); |
|
} else { |
|
$(this).find(".textbox-text").triggerHandler("mouseenter"); |
|
} |
|
})._bind("mouseleave.tagbox", function (e) { |
|
$(this).find(".textbox-text").triggerHandler("mouseleave"); |
|
}); |
|
}; |
|
function _c59(_c5a) { |
|
var opts = $(_c5a).tagbox("options"); |
|
var _c5b = $(_c5a).tagbox("textbox"); |
|
var span = $(_c5a).next(); |
|
var tmp = $("<span></span>").appendTo("body"); |
|
tmp.attr("style", _c5b.attr("style")); |
|
tmp.css({ |
|
position: "absolute", |
|
top: -9999, |
|
left: -9999, |
|
width: "auto", |
|
fontFamily: _c5b.css("fontFamily"), |
|
fontSize: _c5b.css("fontSize"), |
|
fontWeight: _c5b.css("fontWeight"), |
|
whiteSpace: "nowrap" |
|
}); |
|
var _c5c = _c5d(_c5b.val()); |
|
var _c5e = _c5d(opts.prompt || ""); |
|
tmp.remove(); |
|
var _c5f = Math.min(Math.max(_c5c, _c5e) + 20, span.width()); |
|
_c5b._outerWidth(_c5f); |
|
span.find(".textbox-button").linkbutton("resize", { |
|
height: "100%" |
|
}); |
|
function _c5d(val) { |
|
var s = val.replace(/&/g, "&").replace(/\s/g, " ").replace(/</g, "<").replace(/>/g, ">"); |
|
tmp.html(s); |
|
return tmp.outerWidth(); |
|
}; |
|
}; |
|
function _c60(_c61) { |
|
var t = $(_c61); |
|
var opts = t.tagbox("options"); |
|
if (opts.limitToList) { |
|
var _c62 = t.tagbox("panel"); |
|
var item = _c62.children("div.combobox-item-hover"); |
|
if (item.length) { |
|
item.removeClass("combobox-item-hover"); |
|
var row = opts.finder.getRow(_c61, item); |
|
var _c63 = row[opts.valueField]; |
|
$(_c61).tagbox(item.hasClass("combobox-item-selected") ? "unselect" : "select", _c63); |
|
} |
|
$(_c61).tagbox("hidePanel"); |
|
} else { |
|
var v = $.trim($(_c61).tagbox("getText")); |
|
if (v !== "") { |
|
var _c64 = $(_c61).tagbox("getValues"); |
|
_c64.push(v); |
|
$(_c61).tagbox("setValues", _c64); |
|
} |
|
} |
|
}; |
|
function _c65(_c66, _c67) { |
|
$(_c66).combobox("setText", ""); |
|
_c59(_c66); |
|
$(_c66).combobox("setValues", _c67); |
|
$(_c66).combobox("setText", ""); |
|
$(_c66).tagbox("validate"); |
|
}; |
|
$.fn.tagbox = function (_c68, _c69) { |
|
if (typeof _c68 == "string") { |
|
var _c6a = $.fn.tagbox.methods[_c68]; |
|
if (_c6a) { |
|
return _c6a(this, _c69); |
|
} else { |
|
return this.combobox(_c68, _c69); |
|
} |
|
} |
|
_c68 = _c68 || {}; |
|
return this.each(function () { |
|
var _c6b = $.data(this, "tagbox"); |
|
if (_c6b) { |
|
$.extend(_c6b.options, _c68); |
|
} else { |
|
$.data(this, "tagbox", { |
|
options: $.extend({}, $.fn.tagbox.defaults, $.fn.tagbox.parseOptions(this), _c68) |
|
}); |
|
} |
|
_c3d(this); |
|
_c54(this); |
|
}); |
|
}; |
|
$.fn.tagbox.methods = { |
|
options: function (jq) { |
|
var _c6c = jq.combobox("options"); |
|
return $.extend($.data(jq[0], "tagbox").options, { |
|
width: _c6c.width, |
|
height: _c6c.height, |
|
originalValue: _c6c.originalValue, |
|
disabled: _c6c.disabled, |
|
readonly: _c6c.readonly |
|
}); |
|
}, |
|
setValues: function (jq, _c6d) { |
|
return jq.each(function () { |
|
_c65(this, _c6d); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
$(this).combobox("reset").combobox("setText", ""); |
|
}); |
|
} |
|
}; |
|
$.fn.tagbox.parseOptions = function (_c6e) { |
|
return $.extend({}, $.fn.combobox.parseOptions(_c6e), $.parser.parseOptions(_c6e, [])); |
|
}; |
|
$.fn.tagbox.defaults = $.extend({}, $.fn.combobox.defaults, { |
|
hasDownArrow: false, |
|
multiple: true, |
|
reversed: true, |
|
selectOnNavigation: false, |
|
tipOptions: $.extend({}, $.fn.textbox.defaults.tipOptions, { |
|
showDelay: 200 |
|
}), |
|
val: function (_c6f) { |
|
var vv = $(_c6f).parent().prev().tagbox("getValues"); |
|
if ($(_c6f).is(":focus")) { |
|
vv.push($(_c6f).val()); |
|
} |
|
return vv.join(","); |
|
}, |
|
inputEvents: $.extend({}, $.fn.combo.defaults.inputEvents, { |
|
blur: function (e) { |
|
var _c70 = e.data.target; |
|
var opts = $(_c70).tagbox("options"); |
|
if (opts.limitToList) { |
|
_c60(_c70); |
|
} |
|
} |
|
}), |
|
keyHandler: $.extend({}, $.fn.combobox.defaults.keyHandler, { |
|
enter: function (e) { |
|
_c60(this); |
|
}, |
|
query: function (q, e) { |
|
var opts = $(this).tagbox("options"); |
|
if (opts.limitToList) { |
|
$.fn.combobox.defaults.keyHandler.query.call(this, q, e); |
|
} else { |
|
$(this).combobox("hidePanel"); |
|
} |
|
} |
|
}), |
|
tagFormatter: function (_c71, row) { |
|
var opts = $(this).tagbox("options"); |
|
return row ? row[opts.textField] : _c71; |
|
}, |
|
tagStyler: function (_c72, row) { |
|
return ""; |
|
}, |
|
onClickTag: function (_c73) {}, |
|
onBeforeRemoveTag: function (_c74) {}, |
|
onRemoveTag: function (_c75) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _c76(_c77) { |
|
var _c78 = $.data(_c77, "datebox"); |
|
var opts = _c78.options; |
|
$(_c77).addClass("datebox-f").combo($.extend({}, opts, { |
|
onShowPanel: function () { |
|
_c79(this); |
|
_c7a(this); |
|
_c7b(this); |
|
_c89(this, $(this).datebox("getText"), true); |
|
opts.onShowPanel.call(this); |
|
} |
|
})); |
|
if (!_c78.calendar) { |
|
var _c7c = $(_c77).combo("panel").css("overflow", "hidden"); |
|
_c7c.panel("options").onBeforeDestroy = function () { |
|
var c = $(this).find(".calendar-shared"); |
|
if (c.length) { |
|
c.insertBefore(c[0].pholder); |
|
} |
|
}; |
|
var cc = $("<div class=\"datebox-calendar-inner\"></div>").prependTo(_c7c); |
|
if (opts.sharedCalendar) { |
|
var c = $(opts.sharedCalendar); |
|
if (!c[0].pholder) { |
|
c[0].pholder = $("<div class=\"calendar-pholder\" style=\"display:none\"></div>").insertAfter(c); |
|
} |
|
c.addClass("calendar-shared").appendTo(cc); |
|
if (!c.hasClass("calendar")) { |
|
c.calendar(); |
|
} |
|
_c78.calendar = c; |
|
} else { |
|
_c78.calendar = $("<div></div>").appendTo(cc).calendar(); |
|
} |
|
$.extend(_c78.calendar.calendar("options"), { |
|
fit: true, |
|
border: false, |
|
onSelect: function (date) { |
|
var _c7d = this.target; |
|
var opts = $(_c7d).datebox("options"); |
|
opts.onSelect.call(_c7d, date); |
|
_c89(_c7d, opts.formatter.call(_c7d, date)); |
|
$(_c7d).combo("hidePanel"); |
|
} |
|
}); |
|
} |
|
$(_c77).combo("textbox").parent().addClass("datebox"); |
|
$(_c77).datebox("initValue", opts.value); |
|
function _c79(_c7e) { |
|
var opts = $(_c7e).datebox("options"); |
|
var _c7f = $(_c7e).combo("panel"); |
|
_c7f._unbind(".datebox")._bind("click.datebox", function (e) { |
|
if ($(e.target).hasClass("datebox-button-a")) { |
|
var _c80 = parseInt($(e.target).attr("datebox-button-index")); |
|
opts.buttons[_c80].handler.call(e.target, _c7e); |
|
} |
|
}); |
|
}; |
|
function _c7a(_c81) { |
|
var _c82 = $(_c81).combo("panel"); |
|
if (_c82.children("div.datebox-button").length) { |
|
return; |
|
} |
|
var _c83 = $("<div class=\"datebox-button\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%\"><tr></tr></table></div>").appendTo(_c82); |
|
var tr = _c83.find("tr"); |
|
for (var i = 0; i < opts.buttons.length; i++) { |
|
var td = $("<td></td>").appendTo(tr); |
|
var btn = opts.buttons[i]; |
|
var t = $("<a class=\"datebox-button-a\" href=\"javascript:;\"></a>").html($.isFunction(btn.text) ? btn.text(_c81) : btn.text).appendTo(td); |
|
t.attr("datebox-button-index", i); |
|
} |
|
tr.find("td").css("width", (100 / opts.buttons.length) + "%"); |
|
}; |
|
function _c7b(_c84) { |
|
var _c85 = $(_c84).combo("panel"); |
|
var cc = _c85.children("div.datebox-calendar-inner"); |
|
_c85.children()._outerWidth(_c85.width()); |
|
_c78.calendar.appendTo(cc); |
|
_c78.calendar[0].target = _c84; |
|
if (opts.panelHeight != "auto") { |
|
var _c86 = _c85.height(); |
|
_c85.children().not(cc).each(function () { |
|
_c86 -= $(this).outerHeight(); |
|
}); |
|
cc._outerHeight(_c86); |
|
} |
|
_c78.calendar.calendar("resize"); |
|
}; |
|
}; |
|
function _c87(_c88, q) { |
|
_c89(_c88, q, true); |
|
}; |
|
function _c8a(_c8b) { |
|
var _c8c = $.data(_c8b, "datebox"); |
|
var opts = _c8c.options; |
|
var _c8d = _c8c.calendar.calendar("options").current; |
|
if (_c8d) { |
|
_c89(_c8b, opts.formatter.call(_c8b, _c8d)); |
|
$(_c8b).combo("hidePanel"); |
|
} |
|
}; |
|
function _c89(_c8e, _c8f, _c90) { |
|
var _c91 = $.data(_c8e, "datebox"); |
|
var opts = _c91.options; |
|
var _c92 = _c91.calendar; |
|
_c92.calendar("moveTo", opts.parser.call(_c8e, _c8f)); |
|
if (_c90) { |
|
$(_c8e).combo("setValue", _c8f); |
|
} else { |
|
if (_c8f) { |
|
_c8f = opts.formatter.call(_c8e, _c92.calendar("options").current); |
|
} |
|
$(_c8e).combo("setText", _c8f).combo("setValue", _c8f); |
|
} |
|
}; |
|
$.fn.datebox = function (_c93, _c94) { |
|
if (typeof _c93 == "string") { |
|
var _c95 = $.fn.datebox.methods[_c93]; |
|
if (_c95) { |
|
return _c95(this, _c94); |
|
} else { |
|
return this.combo(_c93, _c94); |
|
} |
|
} |
|
_c93 = _c93 || {}; |
|
return this.each(function () { |
|
var _c96 = $.data(this, "datebox"); |
|
if (_c96) { |
|
$.extend(_c96.options, _c93); |
|
} else { |
|
$.data(this, "datebox", { |
|
options: $.extend({}, $.fn.datebox.defaults, $.fn.datebox.parseOptions(this), _c93) |
|
}); |
|
} |
|
_c76(this); |
|
}); |
|
}; |
|
$.fn.datebox.methods = { |
|
options: function (jq) { |
|
var _c97 = jq.combo("options"); |
|
return $.extend($.data(jq[0], "datebox").options, { |
|
width: _c97.width, |
|
height: _c97.height, |
|
originalValue: _c97.originalValue, |
|
disabled: _c97.disabled, |
|
readonly: _c97.readonly |
|
}); |
|
}, |
|
cloneFrom: function (jq, from) { |
|
return jq.each(function () { |
|
$(this).combo("cloneFrom", from); |
|
$.data(this, "datebox", { |
|
options: $.extend(true, {}, $(from).datebox("options")), |
|
calendar: $(from).datebox("calendar") |
|
}); |
|
$(this).addClass("datebox-f"); |
|
}); |
|
}, |
|
calendar: function (jq) { |
|
return $.data(jq[0], "datebox").calendar; |
|
}, |
|
initValue: function (jq, _c98) { |
|
return jq.each(function () { |
|
var opts = $(this).datebox("options"); |
|
var _c99 = opts.value; |
|
if (_c99) { |
|
var date = opts.parser.call(this, _c99); |
|
_c99 = opts.formatter.call(this, date); |
|
$(this).datebox("calendar").calendar("moveTo", date); |
|
} |
|
$(this).combo("initValue", _c99).combo("setText", _c99); |
|
}); |
|
}, |
|
setValue: function (jq, _c9a) { |
|
return jq.each(function () { |
|
_c89(this, _c9a); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).datebox("options"); |
|
$(this).datebox("setValue", opts.originalValue); |
|
}); |
|
}, |
|
setDate: function (jq, date) { |
|
return jq.each(function () { |
|
var opts = $(this).datebox("options"); |
|
$(this).datebox("calendar").calendar("moveTo", date); |
|
_c89(this, date ? opts.formatter.call(this, date) : ""); |
|
}); |
|
}, |
|
getDate: function (jq) { |
|
if (jq.datebox("getValue")) { |
|
return jq.datebox("calendar").calendar("options").current; |
|
} else { |
|
return null; |
|
} |
|
} |
|
}; |
|
$.fn.datebox.parseOptions = function (_c9b) { |
|
return $.extend({}, $.fn.combo.parseOptions(_c9b), $.parser.parseOptions(_c9b, ["sharedCalendar"])); |
|
}; |
|
$.fn.datebox.defaults = $.extend({}, $.fn.combo.defaults, { |
|
panelWidth: 250, |
|
panelHeight: "auto", |
|
sharedCalendar: null, |
|
keyHandler: { |
|
up: function (e) {}, |
|
down: function (e) {}, |
|
left: function (e) {}, |
|
right: function (e) {}, |
|
enter: function (e) { |
|
_c8a(this); |
|
}, |
|
query: function (q, e) { |
|
_c87(this, q); |
|
} |
|
}, |
|
currentText: "Today", |
|
closeText: "Close", |
|
okText: "Ok", |
|
buttons: [{ |
|
text: function (_c9c) { |
|
return $(_c9c).datebox("options").currentText; |
|
}, |
|
handler: function (_c9d) { |
|
var opts = $(_c9d).datebox("options"); |
|
var now = new Date(); |
|
var _c9e = new Date(now.getFullYear(), now.getMonth(), now.getDate()); |
|
$(_c9d).datebox("calendar").calendar({ |
|
year: _c9e.getFullYear(), |
|
month: _c9e.getMonth() + 1, |
|
current: _c9e |
|
}); |
|
opts.onSelect.call(_c9d, _c9e); |
|
_c8a(_c9d); |
|
} |
|
}, { |
|
text: function (_c9f) { |
|
return $(_c9f).datebox("options").closeText; |
|
}, |
|
handler: function (_ca0) { |
|
$(this).closest("div.combo-panel").panel("close"); |
|
} |
|
} |
|
], |
|
formatter: function (date) { |
|
var y = date.getFullYear(); |
|
var m = date.getMonth() + 1; |
|
var d = date.getDate(); |
|
return (m < 10 ? ("0" + m) : m) + "/" + (d < 10 ? ("0" + d) : d) + "/" + y; |
|
}, |
|
parser: function (s) { |
|
var _ca1 = $.fn.calendar.defaults.Date; |
|
if ($(this).data("datebox")) { |
|
_ca1 = $(this).datebox("calendar").calendar("options").Date; |
|
} |
|
if (!s) { |
|
return new _ca1(); |
|
} |
|
var ss = s.split("/"); |
|
var m = parseInt(ss[0], 10); |
|
var d = parseInt(ss[1], 10); |
|
var y = parseInt(ss[2], 10); |
|
if (!isNaN(y) && !isNaN(m) && !isNaN(d)) { |
|
return new _ca1(y, m - 1, d); |
|
} else { |
|
return new _ca1(); |
|
} |
|
}, |
|
onSelect: function (date) {} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _ca2(_ca3) { |
|
var _ca4 = $.data(_ca3, "datetimebox"); |
|
var opts = _ca4.options; |
|
$(_ca3).datebox($.extend({}, opts, { |
|
onShowPanel: function () { |
|
var _ca5 = $(this).datetimebox("getValue"); |
|
_cab(this, _ca5, true); |
|
opts.onShowPanel.call(this); |
|
}, |
|
formatter: $.fn.datebox.defaults.formatter, |
|
parser: $.fn.datebox.defaults.parser |
|
})); |
|
$(_ca3).removeClass("datebox-f").addClass("datetimebox-f"); |
|
$(_ca3).datebox("calendar").calendar({ |
|
onSelect: function (date) { |
|
opts.onSelect.call(this.target, date); |
|
} |
|
}); |
|
if (!_ca4.spinner) { |
|
var _ca6 = $(_ca3).datebox("panel"); |
|
var p = $("<div style=\"padding:2px\"><input></div>").insertAfter(_ca6.children("div.datebox-calendar-inner")); |
|
_ca4.spinner = p.children("input"); |
|
} |
|
_ca4.spinner.timespinner({ |
|
width: opts.spinnerWidth, |
|
showSeconds: opts.showSeconds, |
|
separator: opts.timeSeparator, |
|
hour12: opts.hour12 |
|
}); |
|
$(_ca3).datetimebox("initValue", opts.value); |
|
}; |
|
function _ca7(_ca8) { |
|
var c = $(_ca8).datetimebox("calendar"); |
|
var t = $(_ca8).datetimebox("spinner"); |
|
var date = c.calendar("options").current; |
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), t.timespinner("getHours"), t.timespinner("getMinutes"), t.timespinner("getSeconds")); |
|
}; |
|
function _ca9(_caa, q) { |
|
_cab(_caa, q, true); |
|
}; |
|
function _cac(_cad) { |
|
var opts = $.data(_cad, "datetimebox").options; |
|
var date = _ca7(_cad); |
|
_cab(_cad, opts.formatter.call(_cad, date)); |
|
$(_cad).combo("hidePanel"); |
|
}; |
|
function _cab(_cae, _caf, _cb0) { |
|
var opts = $.data(_cae, "datetimebox").options; |
|
$(_cae).combo("setValue", _caf); |
|
if (!_cb0) { |
|
if (_caf) { |
|
var date = opts.parser.call(_cae, _caf); |
|
$(_cae).combo("setText", opts.formatter.call(_cae, date)); |
|
$(_cae).combo("setValue", opts.formatter.call(_cae, date)); |
|
} else { |
|
$(_cae).combo("setText", _caf); |
|
} |
|
} |
|
var date = opts.parser.call(_cae, _caf); |
|
$(_cae).datetimebox("calendar").calendar("moveTo", date); |
|
$(_cae).datetimebox("spinner").timespinner("setValue", _cb1(date)); |
|
function _cb1(date) { |
|
function _cb2(_cb3) { |
|
return (_cb3 < 10 ? "0" : "") + _cb3; |
|
}; |
|
var tt = [_cb2(date.getHours()), _cb2(date.getMinutes())]; |
|
if (opts.showSeconds) { |
|
tt.push(_cb2(date.getSeconds())); |
|
} |
|
return tt.join($(_cae).datetimebox("spinner").timespinner("options").separator); |
|
}; |
|
}; |
|
$.fn.datetimebox = function (_cb4, _cb5) { |
|
if (typeof _cb4 == "string") { |
|
var _cb6 = $.fn.datetimebox.methods[_cb4]; |
|
if (_cb6) { |
|
return _cb6(this, _cb5); |
|
} else { |
|
return this.datebox(_cb4, _cb5); |
|
} |
|
} |
|
_cb4 = _cb4 || {}; |
|
return this.each(function () { |
|
var _cb7 = $.data(this, "datetimebox"); |
|
if (_cb7) { |
|
$.extend(_cb7.options, _cb4); |
|
} else { |
|
$.data(this, "datetimebox", { |
|
options: $.extend({}, $.fn.datetimebox.defaults, $.fn.datetimebox.parseOptions(this), _cb4) |
|
}); |
|
} |
|
_ca2(this); |
|
}); |
|
}; |
|
$.fn.datetimebox.methods = { |
|
options: function (jq) { |
|
var _cb8 = jq.datebox("options"); |
|
return $.extend($.data(jq[0], "datetimebox").options, { |
|
originalValue: _cb8.originalValue, |
|
disabled: _cb8.disabled, |
|
readonly: _cb8.readonly |
|
}); |
|
}, |
|
cloneFrom: function (jq, from) { |
|
return jq.each(function () { |
|
$(this).datebox("cloneFrom", from); |
|
$.data(this, "datetimebox", { |
|
options: $.extend(true, {}, $(from).datetimebox("options")), |
|
spinner: $(from).datetimebox("spinner") |
|
}); |
|
$(this).removeClass("datebox-f").addClass("datetimebox-f"); |
|
}); |
|
}, |
|
spinner: function (jq) { |
|
return $.data(jq[0], "datetimebox").spinner; |
|
}, |
|
initValue: function (jq, _cb9) { |
|
return jq.each(function () { |
|
var opts = $(this).datetimebox("options"); |
|
var _cba = opts.value; |
|
if (_cba) { |
|
var date = opts.parser.call(this, _cba); |
|
_cba = opts.formatter.call(this, date); |
|
$(this).datetimebox("calendar").calendar("moveTo", date); |
|
} |
|
$(this).combo("initValue", _cba).combo("setText", _cba); |
|
}); |
|
}, |
|
setValue: function (jq, _cbb) { |
|
return jq.each(function () { |
|
_cab(this, _cbb); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).datetimebox("options"); |
|
$(this).datetimebox("setValue", opts.originalValue); |
|
}); |
|
}, |
|
setDate: function (jq, date) { |
|
return jq.each(function () { |
|
var opts = $(this).datetimebox("options"); |
|
$(this).datetimebox("calendar").calendar("moveTo", date); |
|
_cab(this, date ? opts.formatter.call(this, date) : ""); |
|
}); |
|
}, |
|
getDate: function (jq) { |
|
if (jq.datetimebox("getValue")) { |
|
return jq.datetimebox("calendar").calendar("options").current; |
|
} else { |
|
return null; |
|
} |
|
} |
|
}; |
|
$.fn.datetimebox.parseOptions = function (_cbc) { |
|
var t = $(_cbc); |
|
return $.extend({}, $.fn.datebox.parseOptions(_cbc), $.parser.parseOptions(_cbc, ["timeSeparator", "spinnerWidth", { |
|
showSeconds: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.datetimebox.defaults = $.extend({}, $.fn.datebox.defaults, { |
|
spinnerWidth: "100%", |
|
showSeconds: true, |
|
timeSeparator: ":", |
|
hour12: false, |
|
panelEvents: { |
|
mousedown: function (e) {} |
|
}, |
|
keyHandler: { |
|
up: function (e) {}, |
|
down: function (e) {}, |
|
left: function (e) {}, |
|
right: function (e) {}, |
|
enter: function (e) { |
|
_cac(this); |
|
}, |
|
query: function (q, e) { |
|
_ca9(this, q); |
|
} |
|
}, |
|
buttons: [{ |
|
text: function (_cbd) { |
|
return $(_cbd).datetimebox("options").currentText; |
|
}, |
|
handler: function (_cbe) { |
|
var opts = $(_cbe).datetimebox("options"); |
|
|
|
var myDate_current = new Date(); |
|
var current_year = myDate_current.getFullYear(); |
|
var current_month = myDate_current.getMonth() + 1; |
|
current_month = (current_month < 10 ? ('0' + current_month) : current_month); |
|
var current_date = myDate_current.getDate(); |
|
current_date = (current_date < 10 ? ('0' + current_date) : current_date); |
|
var current_hour = myDate_current.getHours(); |
|
current_hour = (current_hour < 10 ? ('0' + current_hour) : current_hour); |
|
var msg_time_2 = current_month.toString() + '/' + current_date.toString() + '/' + current_year.toString() + ' ' + current_hour.toString(); |
|
|
|
var adjust_date = msg_time_2 + ':00:00'; |
|
|
|
_cab(_cbe, opts.formatter.call(_cbe, new Date(adjust_date))); |
|
$(_cbe).datetimebox("hidePanel"); |
|
} |
|
}, { |
|
text: function (_cbf) { |
|
return $(_cbf).datetimebox("options").okText; |
|
}, |
|
handler: function (_cc0) { |
|
_cac(_cc0); |
|
} |
|
}, { |
|
text: function (_cc1) { |
|
return $(_cc1).datetimebox("options").closeText; |
|
}, |
|
handler: function (_cc2) { |
|
$(_cc2).datetimebox("hidePanel"); |
|
} |
|
} |
|
], |
|
formatter: function (date) { |
|
if (!date) { |
|
return ""; |
|
} |
|
return $.fn.datebox.defaults.formatter.call(this, date) + " " + $.fn.timespinner.defaults.formatter.call($(this).datetimebox("spinner")[0], date); |
|
}, |
|
parser: function (s) { |
|
s = $.trim(s); |
|
if (!s) { |
|
return new Date(); |
|
} |
|
var dt = s.split(" "); |
|
var _cc3 = $.fn.datebox.defaults.parser.call(this, dt[0]); |
|
if (dt.length < 2) { |
|
return _cc3; |
|
} |
|
var _cc4 = $.fn.timespinner.defaults.parser.call($(this).datetimebox("spinner")[0], dt[1] + (dt[2] ? " " + dt[2] : "")); |
|
return new Date(_cc3.getFullYear(), _cc3.getMonth(), _cc3.getDate(), _cc4.getHours(), _cc4.getMinutes(), _cc4.getSeconds()); |
|
} |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function _cc5(_cc6) { |
|
var _cc7 = $.data(_cc6, "timepicker"); |
|
var opts = _cc7.options; |
|
$(_cc6).addClass("timepicker-f").combo($.extend({}, opts, { |
|
onShowPanel: function () { |
|
_cc8(this); |
|
_cc9(_cc6); |
|
_cd3(_cc6, $(_cc6).timepicker("getValue")); |
|
} |
|
})); |
|
$(_cc6).timepicker("initValue", opts.value); |
|
function _cc8(_cca) { |
|
var opts = $(_cca).timepicker("options"); |
|
var _ccb = $(_cca).combo("panel"); |
|
_ccb._unbind(".timepicker")._bind("click.timepicker", function (e) { |
|
if ($(e.target).hasClass("datebox-button-a")) { |
|
var _ccc = parseInt($(e.target).attr("datebox-button-index")); |
|
opts.buttons[_ccc].handler.call(e.target, _cca); |
|
} |
|
}); |
|
}; |
|
function _cc9(_ccd) { |
|
var _cce = $(_ccd).combo("panel"); |
|
if (_cce.children("div.datebox-button").length) { |
|
return; |
|
} |
|
var _ccf = $("<div class=\"datebox-button\"><table cellspacing=\"0\" cellpadding=\"0\" style=\"width:100%\"><tr></tr></table></div>").appendTo(_cce); |
|
var tr = _ccf.find("tr"); |
|
for (var i = 0; i < opts.buttons.length; i++) { |
|
var td = $("<td></td>").appendTo(tr); |
|
var btn = opts.buttons[i]; |
|
var t = $("<a class=\"datebox-button-a\" href=\"javascript:;\"></a>").html($.isFunction(btn.text) ? btn.text(_ccd) : btn.text).appendTo(td); |
|
t.attr("datebox-button-index", i); |
|
} |
|
tr.find("td").css("width", (100 / opts.buttons.length) + "%"); |
|
}; |
|
}; |
|
function _cd0(_cd1, _cd2) { |
|
var opts = $(_cd1).data("timepicker").options; |
|
_cd3(_cd1, _cd2); |
|
opts.value = _cd4(_cd1); |
|
$(_cd1).combo("setValue", opts.value).combo("setText", opts.value); |
|
}; |
|
function _cd3(_cd5, _cd6) { |
|
var opts = $(_cd5).data("timepicker").options; |
|
if (_cd6) { |
|
var _cd7 = _cd6.split(" "); |
|
var hm = _cd7[0].split(":"); |
|
opts.selectingHour = parseInt(hm[0], 10); |
|
opts.selectingMinute = parseInt(hm[1], 10); |
|
opts.selectingAmpm = _cd7[1]; |
|
} else { |
|
opts.selectingHour = 12; |
|
opts.selectingMinute = 0; |
|
opts.selectingAmpm = opts.ampm[0]; |
|
} |
|
_cd8(_cd5); |
|
}; |
|
function _cd4(_cd9) { |
|
var opts = $(_cd9).data("timepicker").options; |
|
var h = opts.selectingHour; |
|
var m = opts.selectingMinute; |
|
var ampm = opts.selectingAmpm; |
|
if (!ampm) { |
|
ampm = opts.ampm[0]; |
|
} |
|
var v = (h < 10 ? "0" + h : h) + ":" + (m < 10 ? "0" + m : m); |
|
if (!opts.hour24) { |
|
v += " " + ampm; |
|
} |
|
return v; |
|
}; |
|
function _cd8(_cda) { |
|
var opts = $(_cda).data("timepicker").options; |
|
var _cdb = $(_cda).combo("panel"); |
|
var _cdc = _cdb.children(".timepicker-panel"); |
|
if (!_cdc.length) { |
|
var _cdc = $("<div class=\"timepicker-panel f-column\"></div>").prependTo(_cdb); |
|
} |
|
_cdc.empty(); |
|
if (opts.panelHeight != "auto") { |
|
var _cdd = _cdb.height() - _cdb.find(".datebox-button").outerHeight(); |
|
_cdc._outerHeight(_cdd); |
|
} |
|
_cde(_cda); |
|
_cdf(_cda); |
|
_cdc.off(".timepicker"); |
|
_cdc.on("click.timepicker", ".title-hour", function (e) { |
|
opts.selectingType = "hour"; |
|
_cd8(_cda); |
|
}).on("click.timepicker", ".title-minute", function (e) { |
|
opts.selectingType = "minute"; |
|
_cd8(_cda); |
|
}).on("click.timepicker", ".title-am", function (e) { |
|
opts.selectingAmpm = opts.ampm[0]; |
|
_cd8(_cda); |
|
}).on("click.timepicker", ".title-pm", function (e) { |
|
opts.selectingAmpm = opts.ampm[1]; |
|
_cd8(_cda); |
|
}).on("click.timepicker", ".item", function (e) { |
|
var _ce0 = parseInt($(this).text(), 10); |
|
if (opts.selectingType == "hour") { |
|
opts.selectingHour = _ce0; |
|
} else { |
|
opts.selectingMinute = _ce0; |
|
} |
|
_cd8(_cda); |
|
}); |
|
}; |
|
function _cde(_ce1) { |
|
var opts = $(_ce1).data("timepicker").options; |
|
var _ce2 = $(_ce1).combo("panel"); |
|
var _ce3 = _ce2.find(".timepicker-panel"); |
|
var hour = opts.selectingHour; |
|
var _ce4 = opts.selectingMinute; |
|
$("<div class=\"panel-header f-noshrink f-row f-content-center\">" + "<div class=\"title title-hour\">" + (hour < 10 ? "0" + hour : hour) + "</div>" + "<div class=\"sep\">:</div>" + "<div class=\"title title-minute\">" + (_ce4 < 10 ? "0" + _ce4 : _ce4) + "</div>" + "<div class=\"ampm f-column\">" + "<div class=\"title title-am\">" + opts.ampm[0] + "</div>" + "<div class=\"title title-pm\">" + opts.ampm[1] + "</div>" + "</div>" + "</div>").appendTo(_ce3); |
|
var _ce5 = _ce3.find(".panel-header"); |
|
if (opts.selectingType == "hour") { |
|
_ce5.find(".title-hour").addClass("title-selected"); |
|
} else { |
|
_ce5.find(".title-minute").addClass("title-selected"); |
|
} |
|
if (opts.selectingAmpm == opts.ampm[0]) { |
|
_ce5.find(".title-am").addClass("title-selected"); |
|
} |
|
if (opts.selectingAmpm == opts.ampm[1]) { |
|
_ce5.find(".title-pm").addClass("title-selected"); |
|
} |
|
if (opts.hour24) { |
|
_ce5.find(".ampm").hide(); |
|
} |
|
}; |
|
function _cdf(_ce6) { |
|
var opts = $(_ce6).data("timepicker").options; |
|
var _ce7 = $(_ce6).combo("panel"); |
|
var _ce8 = _ce7.find(".timepicker-panel"); |
|
var _ce9 = $("<div class=\"clock-wrap f-full f-column f-content-center\">" + "</div>").appendTo(_ce8); |
|
var _cea = _ce9.outerWidth(); |
|
var _ceb = _ce9.outerHeight(); |
|
var size = Math.min(_cea, _ceb) - 20; |
|
var _cec = size / 2; |
|
_cea = size; |
|
_ceb = size; |
|
var _ced = opts.selectingType == "hour" ? opts.selectingHour : opts.selectingMinute; |
|
var _cee = _ced / (opts.selectingType == "hour" ? 12 : 60) * 360; |
|
_cee = parseFloat(_cee).toFixed(4); |
|
var _cef = { |
|
transform: "rotate(" + _cee + "deg)", |
|
}; |
|
if (opts.hour24 && opts.selectingType == "hour") { |
|
if (_ced == 0) { |
|
_cef.top = opts.hourDistance[0] + "px"; |
|
} else { |
|
if (_ced <= 12) { |
|
_cef.top = opts.hourDistance[1] + "px"; |
|
} |
|
} |
|
} |
|
var _cf0 = { |
|
width: _cea + "px", |
|
height: _ceb + "px", |
|
marginLeft: -_cea / 2 + "px", |
|
marginTop: -_ceb / 2 + "px" |
|
}; |
|
var _cf1 = []; |
|
_cf1.push("<div class=\"clock\">"); |
|
_cf1.push("<div class=\"center\"></div>"); |
|
_cf1.push("<div class=\"hand\">"); |
|
_cf1.push("<div class=\"drag\"></div>"); |
|
_cf1.push("</div>"); |
|
var data = _cf2(); |
|
if (opts.hour24 && opts.selectingType == "hour") { |
|
for (var i = 0; i < data.length; i++) { |
|
var _cf3 = parseInt(data[i], 10); |
|
_cf3 += 12; |
|
if (_cf3 == 24) { |
|
_cf3 = "00"; |
|
} |
|
var cls = "item f-column f-content-center"; |
|
if (_cf3 == _ced) { |
|
cls += " item-selected"; |
|
} |
|
var _cee = _cf3 / (opts.selectingType == "hour" ? 12 : 60) * 360 * Math.PI / 180; |
|
var x = (_cec - 20) * Math.sin(_cee); |
|
var y = - (_cec - 20) * Math.cos(_cee); |
|
_cee = parseFloat(_cee).toFixed(4); |
|
x = parseFloat(x).toFixed(4); |
|
y = parseFloat(y).toFixed(4); |
|
var _cf4 = { |
|
transform: "translate(" + x + "px," + y + "px)" |
|
}; |
|
var _cf4 = "transform:translate(" + x + "px," + y + "px)"; |
|
_cf1.push("<div class=\"" + cls + "\" style=\"" + _cf4 + "\">" + (_cf3) + "</div>"); |
|
} |
|
_cec -= opts.hourDistance[1] - opts.hourDistance[0]; |
|
} |
|
for (var i = 0; i < data.length; i++) { |
|
var _cf3 = data[i]; |
|
var cls = "item f-column f-content-center"; |
|
if (_cf3 == _ced) { |
|
cls += " item-selected"; |
|
} |
|
var _cee = _cf3 / (opts.selectingType == "hour" ? 12 : 60) * 360 * Math.PI / 180; |
|
var x = (_cec - 20) * Math.sin(_cee); |
|
var y = - (_cec - 20) * Math.cos(_cee); |
|
_cee = parseFloat(_cee).toFixed(4); |
|
x = parseFloat(x).toFixed(4); |
|
y = parseFloat(y).toFixed(4); |
|
var _cf4 = { |
|
transform: "translate(" + x + "px," + y + "px)" |
|
}; |
|
var _cf4 = "transform:translate(" + x + "px," + y + "px)"; |
|
_cf1.push("<div class=\"" + cls + "\" style=\"" + _cf4 + "\">" + _cf3 + "</div>"); |
|
} |
|
_cf1.push("</div>"); |
|
_ce9.html(_cf1.join("")); |
|
_ce9.find(".clock").css(_cf0); |
|
_ce9.find(".hand").css(_cef); |
|
function _cf2() { |
|
var data = []; |
|
if (opts.selectingType == "hour") { |
|
for (var i = 0; i < 12; i++) { |
|
data.push(String(i)); |
|
} |
|
data[0] = "12"; |
|
} else { |
|
for (var i = 0; i < 60; i += 5) { |
|
data.push(i < 10 ? "0" + i : String(i)); |
|
} |
|
data[0] = "00"; |
|
} |
|
return data; |
|
}; |
|
}; |
|
$.fn.timepicker = function (_cf5, _cf6) { |
|
if (typeof _cf5 == "string") { |
|
var _cf7 = $.fn.timepicker.methods[_cf5]; |
|
if (_cf7) { |
|
return _cf7(this, _cf6); |
|
} else { |
|
return this.combo(_cf5, _cf6); |
|
} |
|
} |
|
_cf5 = _cf5 || {}; |
|
return this.each(function () { |
|
var _cf8 = $.data(this, "timepicker"); |
|
if (_cf8) { |
|
$.extend(_cf8.options, _cf5); |
|
} else { |
|
$.data(this, "timepicker", { |
|
options: $.extend({}, $.fn.timepicker.defaults, $.fn.timepicker.parseOptions(this), _cf5) |
|
}); |
|
} |
|
_cc5(this); |
|
}); |
|
}; |
|
$.fn.timepicker.methods = { |
|
options: function (jq) { |
|
var _cf9 = jq.combo("options"); |
|
return $.extend($.data(jq[0], "timepicker").options, { |
|
width: _cf9.width, |
|
height: _cf9.height, |
|
originalValue: _cf9.originalValue, |
|
disabled: _cf9.disabled, |
|
readonly: _cf9.readonly |
|
}); |
|
}, |
|
initValue: function (jq, _cfa) { |
|
return jq.each(function () { |
|
var opts = $(this).timepicker("options"); |
|
opts.value = _cfa; |
|
_cd3(this, _cfa); |
|
if (_cfa) { |
|
opts.value = _cd4(this); |
|
$(this).combo("initValue", opts.value).combo("setText", opts.value); |
|
} |
|
}); |
|
}, |
|
setValue: function (jq, _cfb) { |
|
return jq.each(function () { |
|
_cd0(this, _cfb); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).timepicker("options"); |
|
$(this).timepicker("setValue", opts.originalValue); |
|
}); |
|
} |
|
}; |
|
$.fn.timepicker.parseOptions = function (_cfc) { |
|
return $.extend({}, $.fn.combo.parseOptions(_cfc), $.parser.parseOptions(_cfc, [{ |
|
hour24: "boolean" |
|
} |
|
])); |
|
}; |
|
$.fn.timepicker.defaults = $.extend({}, $.fn.combo.defaults, { |
|
closeText: "Close", |
|
okText: "Ok", |
|
buttons: [{ |
|
text: function (_cfd) { |
|
return $(_cfd).timepicker("options").okText; |
|
}, |
|
handler: function (_cfe) { |
|
$(_cfe).timepicker("setValue", _cd4(_cfe)); |
|
$(this).closest("div.combo-panel").panel("close"); |
|
} |
|
}, { |
|
text: function (_cff) { |
|
return $(_cff).timepicker("options").closeText; |
|
}, |
|
handler: function (_d00) { |
|
$(this).closest("div.combo-panel").panel("close"); |
|
} |
|
} |
|
], |
|
editable: false, |
|
ampm: ["am", "pm"], |
|
value: "", |
|
selectingHour: 12, |
|
selectingMinute: 0, |
|
selectingType: "hour", |
|
hour24: false, |
|
hourDistance: [20, 50] |
|
}); |
|
})(jQuery); |
|
(function ($) { |
|
function init(_d01) { |
|
var _d02 = $("<div class=\"slider\">" + "<div class=\"slider-inner\">" + "<a href=\"javascript:;\" class=\"slider-handle\"></a>" + "<span class=\"slider-tip\"></span>" + "</div>" + "<div class=\"slider-rule\"></div>" + "<div class=\"slider-rulelabel\"></div>" + "<div style=\"clear:both\"></div>" + "<input type=\"hidden\" class=\"slider-value\">" + "</div>").insertAfter(_d01); |
|
var t = $(_d01); |
|
t.addClass("slider-f").hide(); |
|
var name = t.attr("name"); |
|
if (name) { |
|
_d02.find("input.slider-value").attr("name", name); |
|
t.removeAttr("name").attr("sliderName", name); |
|
} |
|
_d02._bind("_resize", function (e, _d03) { |
|
if ($(this).hasClass("easyui-fluid") || _d03) { |
|
_d04(_d01); |
|
} |
|
return false; |
|
}); |
|
return _d02; |
|
}; |
|
function _d04(_d05, _d06) { |
|
var _d07 = $.data(_d05, "slider"); |
|
var opts = _d07.options; |
|
var _d08 = _d07.slider; |
|
if (_d06) { |
|
if (_d06.width) { |
|
opts.width = _d06.width; |
|
} |
|
if (_d06.height) { |
|
opts.height = _d06.height; |
|
} |
|
} |
|
_d08._size(opts); |
|
if (opts.mode == "h") { |
|
_d08.css("height", ""); |
|
_d08.children("div").css("height", ""); |
|
} else { |
|
_d08.css("width", ""); |
|
_d08.children("div").css("width", ""); |
|
_d08.children("div.slider-rule,div.slider-rulelabel,div.slider-inner")._outerHeight(_d08._outerHeight()); |
|
} |
|
_d09(_d05); |
|
}; |
|
function _d0a(_d0b) { |
|
var _d0c = $.data(_d0b, "slider"); |
|
var opts = _d0c.options; |
|
var _d0d = _d0c.slider; |
|
var aa = opts.mode == "h" ? opts.rule : opts.rule.slice(0).reverse(); |
|
if (opts.reversed) { |
|
aa = aa.slice(0).reverse(); |
|
} |
|
_d0e(aa); |
|
function _d0e(aa) { |
|
var rule = _d0d.find("div.slider-rule"); |
|
var _d0f = _d0d.find("div.slider-rulelabel"); |
|
rule.empty(); |
|
_d0f.empty(); |
|
for (var i = 0; i < aa.length; i++) { |
|
var _d10 = i * 100 / (aa.length - 1) + "%"; |
|
var span = $("<span></span>").appendTo(rule); |
|
span.css((opts.mode == "h" ? "left" : "top"), _d10); |
|
if (aa[i] != "|") { |
|
span = $("<span></span>").appendTo(_d0f); |
|
span.html(aa[i]); |
|
if (opts.mode == "h") { |
|
span.css({ |
|
left: _d10, |
|
marginLeft: -Math.round(span.outerWidth() / 2) |
|
}); |
|
} else { |
|
span.css({ |
|
top: _d10, |
|
marginTop: -Math.round(span.outerHeight() / 2) |
|
}); |
|
} |
|
} |
|
} |
|
}; |
|
}; |
|
function _d11(_d12) { |
|
var _d13 = $.data(_d12, "slider"); |
|
var opts = _d13.options; |
|
var _d14 = _d13.slider; |
|
_d14.removeClass("slider-h slider-v slider-disabled"); |
|
_d14.addClass(opts.mode == "h" ? "slider-h" : "slider-v"); |
|
_d14.addClass(opts.disabled ? "slider-disabled" : ""); |
|
var _d15 = _d14.find(".slider-inner"); |
|
_d15.html("<a href=\"javascript:;\" class=\"slider-handle\"></a>" + "<span class=\"slider-tip\"></span>"); |
|
if (opts.range) { |
|
_d15.append("<a href=\"javascript:;\" class=\"slider-handle\"></a>" + "<span class=\"slider-tip\"></span>"); |
|
} |
|
_d14.find("a.slider-handle").draggable({ |
|
axis: opts.mode, |
|
cursor: "pointer", |
|
disabled: opts.disabled, |
|
onDrag: function (e) { |
|
var left = e.data.left; |
|
var _d16 = _d14.width(); |
|
if (opts.mode != "h") { |
|
left = e.data.top; |
|
_d16 = _d14.height(); |
|
} |
|
if (left < 0 || left > _d16) { |
|
return false; |
|
} else { |
|
_d17(left, this); |
|
return false; |
|
} |
|
}, |
|
onStartDrag: function () { |
|
_d13.isDragging = true; |
|
opts.onSlideStart.call(_d12, opts.value); |
|
}, |
|
onStopDrag: function (e) { |
|
_d17(opts.mode == "h" ? e.data.left : e.data.top, this); |
|
opts.onSlideEnd.call(_d12, opts.value); |
|
opts.onComplete.call(_d12, opts.value); |
|
_d13.isDragging = false; |
|
} |
|
}); |
|
_d14.find("div.slider-inner")._unbind(".slider")._bind("mousedown.slider", function (e) { |
|
if (_d13.isDragging || opts.disabled) { |
|
return; |
|
} |
|
var pos = $(this).offset(); |
|
_d17(opts.mode == "h" ? (e.pageX - pos.left) : (e.pageY - pos.top)); |
|
opts.onComplete.call(_d12, opts.value); |
|
}); |
|
function _d18(_d19) { |
|
var dd = String(opts.step).split("."); |
|
var dlen = dd.length > 1 ? dd[1].length : 0; |
|
return parseFloat(_d19.toFixed(dlen)); |
|
}; |
|
function _d17(pos, _d1a) { |
|
var _d1b = _d1c(_d12, pos); |
|
var s = Math.abs(_d1b % opts.step); |
|
if (s < opts.step / 2) { |
|
_d1b -= s; |
|
} else { |
|
_d1b = _d1b - s + opts.step; |
|
} |
|
_d1b = _d18(_d1b); |
|
if (opts.range) { |
|
var v1 = opts.value[0]; |
|
var v2 = opts.value[1]; |
|
var m = parseFloat((v1 + v2) / 2); |
|
if (_d1a) { |
|
var _d1d = $(_d1a).nextAll(".slider-handle").length > 0; |
|
if (_d1b <= v2 && _d1d) { |
|
v1 = _d1b; |
|
} else { |
|
if (_d1b >= v1 && (!_d1d)) { |
|
v2 = _d1b; |
|
} |
|
} |
|
} else { |
|
if (_d1b < v1) { |
|
v1 = _d1b; |
|
} else { |
|
if (_d1b > v2) { |
|
v2 = _d1b; |
|
} else { |
|
_d1b < m ? v1 = _d1b : v2 = _d1b; |
|
} |
|
} |
|
} |
|
$(_d12).slider("setValues", [v1, v2]); |
|
} else { |
|
$(_d12).slider("setValue", _d1b); |
|
} |
|
}; |
|
}; |
|
function _d1e(_d1f, _d20) { |
|
var _d21 = $.data(_d1f, "slider"); |
|
var opts = _d21.options; |
|
var _d22 = _d21.slider; |
|
var _d23 = $.isArray(opts.value) ? opts.value : [opts.value]; |
|
var _d24 = []; |
|
if (!$.isArray(_d20)) { |
|
_d20 = $.map(String(_d20).split(opts.separator), function (v) { |
|
return parseFloat(v); |
|
}); |
|
} |
|
_d22.find(".slider-value").remove(); |
|
var name = $(_d1f).attr("sliderName") || ""; |
|
for (var i = 0; i < _d20.length; i++) { |
|
var _d25 = _d20[i]; |
|
if (_d25 < opts.min) { |
|
_d25 = opts.min; |
|
} |
|
if (_d25 > opts.max) { |
|
_d25 = opts.max; |
|
} |
|
var _d26 = $("<input type=\"hidden\" class=\"slider-value\">").appendTo(_d22); |
|
_d26.attr("name", name); |
|
_d26.val(_d25); |
|
_d24.push(_d25); |
|
var _d27 = _d22.find(".slider-handle:eq(" + i + ")"); |
|
var tip = _d27.next(); |
|
var pos = _d28(_d1f, _d25); |
|
if (opts.showTip) { |
|
tip.show(); |
|
tip.html(opts.tipFormatter.call(_d1f, _d25)); |
|
} else { |
|
tip.hide(); |
|
} |
|
if (opts.mode == "h") { |
|
var _d29 = "left:" + pos + "px;"; |
|
_d27.attr("style", _d29); |
|
tip.attr("style", _d29 + "margin-left:" + (-Math.round(tip.outerWidth() / 2)) + "px"); |
|
} else { |
|
var _d29 = "top:" + pos + "px;"; |
|
_d27.attr("style", _d29); |
|
tip.attr("style", _d29 + "margin-left:" + (-Math.round(tip.outerWidth())) + "px"); |
|
} |
|
} |
|
opts.value = opts.range ? _d24 : _d24[0]; |
|
$(_d1f).val(opts.range ? _d24.join(opts.separator) : _d24[0]); |
|
if (_d23.join(",") != _d24.join(",")) { |
|
opts.onChange.call(_d1f, opts.value, (opts.range ? _d23 : _d23[0])); |
|
} |
|
}; |
|
function _d09(_d2a) { |
|
var opts = $.data(_d2a, "slider").options; |
|
var fn = opts.onChange; |
|
opts.onChange = function () {}; |
|
_d1e(_d2a, opts.value); |
|
opts.onChange = fn; |
|
}; |
|
function _d28(_d2b, _d2c) { |
|
var _d2d = $.data(_d2b, "slider"); |
|
var opts = _d2d.options; |
|
var _d2e = _d2d.slider; |
|
var size = opts.mode == "h" ? _d2e.width() : _d2e.height(); |
|
var pos = opts.converter.toPosition.call(_d2b, _d2c, size); |
|
if (opts.mode == "v") { |
|
pos = _d2e.height() - pos; |
|
} |
|
if (opts.reversed) { |
|
pos = size - pos; |
|
} |
|
return pos; |
|
}; |
|
function _d1c(_d2f, pos) { |
|
var _d30 = $.data(_d2f, "slider"); |
|
var opts = _d30.options; |
|
var _d31 = _d30.slider; |
|
var size = opts.mode == "h" ? _d31.width() : _d31.height(); |
|
var pos = opts.mode == "h" ? (opts.reversed ? (size - pos) : pos) : (opts.reversed ? pos : (size - pos)); |
|
var _d32 = opts.converter.toValue.call(_d2f, pos, size); |
|
return _d32; |
|
}; |
|
$.fn.slider = function (_d33, _d34) { |
|
if (typeof _d33 == "string") { |
|
return $.fn.slider.methods[_d33](this, _d34); |
|
} |
|
_d33 = _d33 || {}; |
|
return this.each(function () { |
|
var _d35 = $.data(this, "slider"); |
|
if (_d35) { |
|
$.extend(_d35.options, _d33); |
|
} else { |
|
_d35 = $.data(this, "slider", { |
|
options: $.extend({}, $.fn.slider.defaults, $.fn.slider.parseOptions(this), _d33), |
|
slider: init(this) |
|
}); |
|
$(this)._propAttr("disabled", false); |
|
} |
|
var opts = _d35.options; |
|
opts.min = parseFloat(opts.min); |
|
opts.max = parseFloat(opts.max); |
|
if (opts.range) { |
|
if (!$.isArray(opts.value)) { |
|
opts.value = $.map(String(opts.value).split(opts.separator), function (v) { |
|
return parseFloat(v); |
|
}); |
|
} |
|
if (opts.value.length < 2) { |
|
opts.value.push(opts.max); |
|
} |
|
} else { |
|
opts.value = parseFloat(opts.value); |
|
} |
|
opts.step = parseFloat(opts.step); |
|
opts.originalValue = opts.value; |
|
_d11(this); |
|
_d0a(this); |
|
_d04(this); |
|
}); |
|
}; |
|
$.fn.slider.methods = { |
|
options: function (jq) { |
|
return $.data(jq[0], "slider").options; |
|
}, |
|
destroy: function (jq) { |
|
return jq.each(function () { |
|
$.data(this, "slider").slider.remove(); |
|
$(this).remove(); |
|
}); |
|
}, |
|
resize: function (jq, _d36) { |
|
return jq.each(function () { |
|
_d04(this, _d36); |
|
}); |
|
}, |
|
getValue: function (jq) { |
|
return jq.slider("options").value; |
|
}, |
|
getValues: function (jq) { |
|
return jq.slider("options").value; |
|
}, |
|
setValue: function (jq, _d37) { |
|
return jq.each(function () { |
|
_d1e(this, [_d37]); |
|
}); |
|
}, |
|
setValues: function (jq, _d38) { |
|
return jq.each(function () { |
|
_d1e(this, _d38); |
|
}); |
|
}, |
|
clear: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).slider("options"); |
|
_d1e(this, opts.range ? [opts.min, opts.max] : [opts.min]); |
|
}); |
|
}, |
|
reset: function (jq) { |
|
return jq.each(function () { |
|
var opts = $(this).slider("options"); |
|
$(this).slider(opts.range ? "setValues" : "setValue", opts.originalValue); |
|
}); |
|
}, |
|
enable: function (jq) { |
|
return jq.each(function () { |
|
$.data(this, "slider").options.disabled = false; |
|
_d11(this); |
|
}); |
|
}, |
|
disable: function (jq) { |
|
return jq.each(function () { |
|
$.data(this, "slider").options.disabled = true; |
|
_d11(this); |
|
}); |
|
} |
|
}; |
|
$.fn.slider.parseOptions = function (_d39) { |
|
var t = $(_d39); |
|
return $.extend({}, $.parser.parseOptions(_d39, ["width", "height", "mode", { |
|
reversed: "boolean", |
|
showTip: "boolean", |
|
range: "boolean", |
|
min: "number", |
|
max: "number", |
|
step: "number" |
|
} |
|
]), { |
|
value: (t.val() || undefined), |
|
disabled: (t.attr("disabled") ? true : undefined), |
|
rule: (t.attr("rule") ? eval(t.attr("rule")) : undefined) |
|
}); |
|
}; |
|
$.fn.slider.defaults = { |
|
width: "auto", |
|
height: "auto", |
|
mode: "h", |
|
reversed: false, |
|
showTip: false, |
|
disabled: false, |
|
range: false, |
|
value: 0, |
|
separator: ",", |
|
min: 0, |
|
max: 100, |
|
step: 1, |
|
rule: [], |
|
tipFormatter: function (_d3a) { |
|
return _d3a; |
|
}, |
|
converter: { |
|
toPosition: function (_d3b, size) { |
|
var opts = $(this).slider("options"); |
|
var p = (_d3b - opts.min) / (opts.max - opts.min) * size; |
|
return p; |
|
}, |
|
toValue: function (pos, size) { |
|
var opts = $(this).slider("options"); |
|
var v = opts.min + (opts.max - opts.min) * (pos / size); |
|
return v; |
|
} |
|
}, |
|
onChange: function (_d3c, _d3d) {}, |
|
onSlideStart: function (_d3e) {}, |
|
onSlideEnd: function (_d3f) {}, |
|
onComplete: function (_d40) {} |
|
}; |
|
})(jQuery);
|
|
|