mirror of https://gitee.com/karson/fastadmin.git
更新JS压缩文件
parent
41682bd850
commit
d7ffc690c2
|
|
@ -10369,10 +10369,13 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
||||||
}
|
}
|
||||||
obj.attr("fieldlist-item", true);
|
obj.attr("fieldlist-item", true);
|
||||||
obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
|
obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
|
||||||
//兼容旧版本事件
|
if ($(".btn-append,.append", container).length > 0) {
|
||||||
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
//兼容旧版本事件
|
||||||
//新版本事件
|
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
||||||
container.trigger("fa.event.appendfieldlist", obj);
|
} else {
|
||||||
|
//新版本事件
|
||||||
|
container.trigger("fa.event.appendfieldlist", obj);
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
var fieldlist = $(".fieldlist", form);
|
var fieldlist = $(".fieldlist", form);
|
||||||
|
|
@ -10502,6 +10505,89 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
||||||
$("[data-role='autocomplete']").autocomplete();
|
$("[data-role='autocomplete']").autocomplete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
favisible: function (form) {
|
||||||
|
if ($("[data-favisible]", form).length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var checkCondition = function (condition) {
|
||||||
|
var conditionArr = condition.split(/&&/);
|
||||||
|
var success = 0;
|
||||||
|
var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
|
||||||
|
<!--@formatter:off-->
|
||||||
|
var operator_result = {
|
||||||
|
'>': function(a, b) { return a > b; },
|
||||||
|
'>=': function(a, b) { return a >= b; },
|
||||||
|
'<': function(a, b) { return a < b; },
|
||||||
|
'<=': function(a, b) { return a <= b; },
|
||||||
|
'==': function(a, b) { return a == b; },
|
||||||
|
'!=': function(a, b) { return a != b; },
|
||||||
|
'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
|
||||||
|
'regex': function(a, b) {
|
||||||
|
var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
|
||||||
|
var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
|
||||||
|
return regexp.test(a);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
<!--@formatter:on-->
|
||||||
|
var dataArr = form.serializeArray(), dataObj = {};
|
||||||
|
$(dataArr).each(function (i, field) {
|
||||||
|
dataObj[field.name] = field.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
$.each(conditionArr, function (i, item) {
|
||||||
|
var basematches = baseregex.exec(item);
|
||||||
|
if (basematches) {
|
||||||
|
var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
|
||||||
|
if (operator === '=') {
|
||||||
|
var strmatches = strregex.exec(value);
|
||||||
|
operator = strmatches ? '==' : 'in';
|
||||||
|
value = strmatches ? strmatches[2] : value;
|
||||||
|
}
|
||||||
|
var regmatches = regregex.exec(value);
|
||||||
|
if (regmatches) {
|
||||||
|
operator = 'regex';
|
||||||
|
value = regmatches[1];
|
||||||
|
}
|
||||||
|
var chkname = "row[" + name + "]";
|
||||||
|
if (typeof dataObj[chkname] === 'undefined') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var objvalue = dataObj[chkname];
|
||||||
|
if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
|
||||||
|
objvalue = parseFloat(objvalue);
|
||||||
|
value = parseFloat(value);
|
||||||
|
}
|
||||||
|
var result = operator_result[operator](objvalue, value);
|
||||||
|
success += (result ? 1 : 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return success === conditionArr.length;
|
||||||
|
};
|
||||||
|
form.on("keyup change click configchange", "input,select", function () {
|
||||||
|
$("[data-favisible][data-favisible!='']", form).each(function () {
|
||||||
|
var visible = $(this).data("favisible");
|
||||||
|
var groupArr = visible.split(/\|\|/);
|
||||||
|
var success = 0;
|
||||||
|
$.each(groupArr, function (i, j) {
|
||||||
|
if (checkCondition(j)) {
|
||||||
|
success++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (success > 0) {
|
||||||
|
$(this).removeClass("hidden");
|
||||||
|
} else {
|
||||||
|
$(this).addClass("hidden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//追加上忽略元素
|
||||||
|
setTimeout(function () {
|
||||||
|
form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
$("input,select", form).trigger("configchange");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
|
|
@ -10608,6 +10694,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
||||||
events.tagsinput(form);
|
events.tagsinput(form);
|
||||||
|
|
||||||
events.autocomplete(form);
|
events.autocomplete(form);
|
||||||
|
|
||||||
|
events.favisible(form);
|
||||||
},
|
},
|
||||||
custom: {}
|
custom: {}
|
||||||
},
|
},
|
||||||
|
|
@ -12147,16 +12235,13 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
var btnGroup = $(this);
|
var btnGroup = $(this);
|
||||||
var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
|
var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
|
||||||
var left, top, position;
|
var left, top, position;
|
||||||
if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
||||||
position = 'fixed';
|
position = 'fixed';
|
||||||
top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
|
top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
|
||||||
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
|
||||||
} else {
|
top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
|
||||||
if (btnGroup.offset().top + btnGroup.outerHeight() + dropdownMenu.outerHeight() > tableBody.offset().top + tableBody.outerHeight() - 30) {
|
|
||||||
position = 'absolute';
|
|
||||||
left = isPullRight ? -(dropdownMenu.outerWidth() - btnGroup.outerWidth()) : 0;
|
|
||||||
top = -(dropdownMenu.outerHeight() + 3);
|
|
||||||
}
|
}
|
||||||
|
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
||||||
}
|
}
|
||||||
if (left || top) {
|
if (left || top) {
|
||||||
dropdownMenu.css({
|
dropdownMenu.css({
|
||||||
|
|
@ -12516,7 +12601,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
dropdown = j.dropdown ? j.dropdown : '';
|
dropdown = j.dropdown ? j.dropdown : '';
|
||||||
url = j.url ? j.url : '';
|
url = j.url ? j.url : '';
|
||||||
url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
|
url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
|
||||||
classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
|
classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
|
||||||
icon = j.icon ? j.icon : '';
|
icon = j.icon ? j.icon : '';
|
||||||
text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
|
text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
|
||||||
title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
|
title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
|
||||||
|
|
|
||||||
|
|
@ -10218,10 +10218,13 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
||||||
}
|
}
|
||||||
obj.attr("fieldlist-item", true);
|
obj.attr("fieldlist-item", true);
|
||||||
obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
|
obj.insertAfter($(tagName + "[fieldlist-item]", container).length > 0 ? $(tagName + "[fieldlist-item]:last", container) : $(tagName + ":first", container));
|
||||||
//兼容旧版本事件
|
if ($(".btn-append,.append", container).length > 0) {
|
||||||
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
//兼容旧版本事件
|
||||||
//新版本事件
|
$(".btn-append,.append", container).trigger("fa.event.appendfieldlist", obj);
|
||||||
container.trigger("fa.event.appendfieldlist", obj);
|
} else {
|
||||||
|
//新版本事件
|
||||||
|
container.trigger("fa.event.appendfieldlist", obj);
|
||||||
|
}
|
||||||
return obj;
|
return obj;
|
||||||
};
|
};
|
||||||
var fieldlist = $(".fieldlist", form);
|
var fieldlist = $(".fieldlist", form);
|
||||||
|
|
@ -10351,6 +10354,89 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
||||||
$("[data-role='autocomplete']").autocomplete();
|
$("[data-role='autocomplete']").autocomplete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
favisible: function (form) {
|
||||||
|
if ($("[data-favisible]", form).length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var checkCondition = function (condition) {
|
||||||
|
var conditionArr = condition.split(/&&/);
|
||||||
|
var success = 0;
|
||||||
|
var baseregex = /^([a-z0-9\_]+)([>|<|=|\!]=?)(.*)$/i, strregex = /^('|")(.*)('|")$/, regregex = /^regex:(.*)$/;
|
||||||
|
<!--@formatter:off-->
|
||||||
|
var operator_result = {
|
||||||
|
'>': function(a, b) { return a > b; },
|
||||||
|
'>=': function(a, b) { return a >= b; },
|
||||||
|
'<': function(a, b) { return a < b; },
|
||||||
|
'<=': function(a, b) { return a <= b; },
|
||||||
|
'==': function(a, b) { return a == b; },
|
||||||
|
'!=': function(a, b) { return a != b; },
|
||||||
|
'in': function(a, b) { return b.split(/\,/).indexOf(a) > -1; },
|
||||||
|
'regex': function(a, b) {
|
||||||
|
var regParts = b.match(/^\/(.*?)\/([gim]*)$/);
|
||||||
|
var regexp = regParts ? new RegExp(regParts[1], regParts[2]) : new RegExp(b);
|
||||||
|
return regexp.test(a);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
<!--@formatter:on-->
|
||||||
|
var dataArr = form.serializeArray(), dataObj = {};
|
||||||
|
$(dataArr).each(function (i, field) {
|
||||||
|
dataObj[field.name] = field.value;
|
||||||
|
});
|
||||||
|
|
||||||
|
$.each(conditionArr, function (i, item) {
|
||||||
|
var basematches = baseregex.exec(item);
|
||||||
|
if (basematches) {
|
||||||
|
var name = basematches[1], operator = basematches[2], value = basematches[3].toString();
|
||||||
|
if (operator === '=') {
|
||||||
|
var strmatches = strregex.exec(value);
|
||||||
|
operator = strmatches ? '==' : 'in';
|
||||||
|
value = strmatches ? strmatches[2] : value;
|
||||||
|
}
|
||||||
|
var regmatches = regregex.exec(value);
|
||||||
|
if (regmatches) {
|
||||||
|
operator = 'regex';
|
||||||
|
value = regmatches[1];
|
||||||
|
}
|
||||||
|
var chkname = "row[" + name + "]";
|
||||||
|
if (typeof dataObj[chkname] === 'undefined') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
var objvalue = dataObj[chkname];
|
||||||
|
if (['>', '>=', '<', '<='].indexOf(operator) > -1) {
|
||||||
|
objvalue = parseFloat(objvalue);
|
||||||
|
value = parseFloat(value);
|
||||||
|
}
|
||||||
|
var result = operator_result[operator](objvalue, value);
|
||||||
|
success += (result ? 1 : 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return success === conditionArr.length;
|
||||||
|
};
|
||||||
|
form.on("keyup change click configchange", "input,select", function () {
|
||||||
|
$("[data-favisible][data-favisible!='']", form).each(function () {
|
||||||
|
var visible = $(this).data("favisible");
|
||||||
|
var groupArr = visible.split(/\|\|/);
|
||||||
|
var success = 0;
|
||||||
|
$.each(groupArr, function (i, j) {
|
||||||
|
if (checkCondition(j)) {
|
||||||
|
success++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (success > 0) {
|
||||||
|
$(this).removeClass("hidden");
|
||||||
|
} else {
|
||||||
|
$(this).addClass("hidden");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
//追加上忽略元素
|
||||||
|
setTimeout(function () {
|
||||||
|
form.data('validator').options.ignore += ((form.data('validator').options.ignore ? ',' : '') + '[data-favisible] :hidden,[data-favisible]:hidden');
|
||||||
|
}, 0);
|
||||||
|
|
||||||
|
$("input,select", form).trigger("configchange");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
|
|
@ -10457,6 +10543,8 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator', 'validator-lang'],
|
||||||
events.tagsinput(form);
|
events.tagsinput(form);
|
||||||
|
|
||||||
events.autocomplete(form);
|
events.autocomplete(form);
|
||||||
|
|
||||||
|
events.favisible(form);
|
||||||
},
|
},
|
||||||
custom: {}
|
custom: {}
|
||||||
},
|
},
|
||||||
|
|
@ -11996,16 +12084,13 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
var btnGroup = $(this);
|
var btnGroup = $(this);
|
||||||
var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
|
var isPullRight = dropdownMenu.hasClass("pull-right") || dropdownMenu.hasClass("dropdown-menu-right");
|
||||||
var left, top, position;
|
var left, top, position;
|
||||||
if (dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
if (true || dropdownMenu.outerHeight() + btnGroup.outerHeight() > tableBody.outerHeight() - 41) {
|
||||||
position = 'fixed';
|
position = 'fixed';
|
||||||
top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
|
top = btnGroup.offset().top - $(window).scrollTop() + btnGroup.outerHeight();
|
||||||
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
if ((top + dropdownMenu.outerHeight()) > $(window).height()) {
|
||||||
} else {
|
top = btnGroup.offset().top - dropdownMenu.outerHeight() - 5;
|
||||||
if (btnGroup.offset().top + btnGroup.outerHeight() + dropdownMenu.outerHeight() > tableBody.offset().top + tableBody.outerHeight() - 30) {
|
|
||||||
position = 'absolute';
|
|
||||||
left = isPullRight ? -(dropdownMenu.outerWidth() - btnGroup.outerWidth()) : 0;
|
|
||||||
top = -(dropdownMenu.outerHeight() + 3);
|
|
||||||
}
|
}
|
||||||
|
left = isPullRight ? btnGroup.offset().left + btnGroup.outerWidth() - dropdownMenu.outerWidth() : btnGroup.offset().left;
|
||||||
}
|
}
|
||||||
if (left || top) {
|
if (left || top) {
|
||||||
dropdownMenu.css({
|
dropdownMenu.css({
|
||||||
|
|
@ -12365,7 +12450,7 @@ define('table',['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstr
|
||||||
dropdown = j.dropdown ? j.dropdown : '';
|
dropdown = j.dropdown ? j.dropdown : '';
|
||||||
url = j.url ? j.url : '';
|
url = j.url ? j.url : '';
|
||||||
url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
|
url = typeof url === 'function' ? url.call(table, row, j) : (url ? Fast.api.fixurl(Table.api.replaceurl(url, row, table)) : 'javascript:;');
|
||||||
classname = j.classname ? j.classname : 'btn-primary btn-' + name + 'one';
|
classname = j.classname ? j.classname : (dropdown ? 'btn-' + name + 'one' : 'btn-primary btn-' + name + 'one');
|
||||||
icon = j.icon ? j.icon : '';
|
icon = j.icon ? j.icon : '';
|
||||||
text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
|
text = typeof j.text === 'function' ? j.text.call(table, row, j) : j.text ? j.text : '';
|
||||||
title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
|
title = typeof j.title === 'function' ? j.title.call(table, row, j) : j.title ? j.title : text;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue