update dependencies: jQuery, jQuery UI, jQuery Validate, jQuery Validate Unobtrusive, SignalR
This commit is contained in:
+20237
-14502
File diff suppressed because it is too large
Load Diff
+462
-27
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
-9190
File diff suppressed because it is too large
Load Diff
+10716
File diff suppressed because it is too large
Load Diff
-15008
File diff suppressed because it is too large
Load Diff
+18809
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+964
-596
File diff suppressed because it is too large
Load Diff
@@ -1,26 +1,26 @@
|
||||
/* NUGET: BEGIN LICENSE TEXT
|
||||
*
|
||||
* Microsoft grants you the right to use these script files for the sole
|
||||
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||
* website or online service, subject to the applicable licensing or use
|
||||
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||
* to that product's license terms. Microsoft reserves all other rights to the
|
||||
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||
* under the terms set out in this paragraph. All notices and licenses
|
||||
* below are for informational purposes only.
|
||||
*
|
||||
* NUGET: END LICENSE TEXT */
|
||||
/*!
|
||||
** Unobtrusive validation support library for jQuery and jQuery Validate
|
||||
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
/**
|
||||
* @license
|
||||
* Unobtrusive validation support library for jQuery and jQuery Validate
|
||||
* Copyright (c) .NET Foundation. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
* @version <placeholder>
|
||||
*/
|
||||
|
||||
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
|
||||
/*global document: false, jQuery: false */
|
||||
|
||||
(function ($) {
|
||||
(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define("jquery.validate.unobtrusive", ['jquery-validation'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// CommonJS-like environments that support module.exports
|
||||
module.exports = factory(require('jquery-validation'));
|
||||
} else {
|
||||
// Browser global
|
||||
jQuery.validator.unobtrusive = factory(jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
var $jQval = $.validator,
|
||||
adapters,
|
||||
data_validation = "unobtrusiveValidation";
|
||||
@@ -55,7 +55,7 @@
|
||||
function onError(error, inputElement) { // 'this' is the form element
|
||||
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
|
||||
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
|
||||
replace = replaceAttrValue ? JSON.parse(replaceAttrValue) !== false : null;
|
||||
|
||||
container.removeClass("field-validation-valid").addClass("field-validation-error");
|
||||
error.data("unobtrusiveContainer", container);
|
||||
@@ -84,11 +84,12 @@
|
||||
}
|
||||
|
||||
function onSuccess(error) { // 'this' is the form element
|
||||
var container = error.data("unobtrusiveContainer"),
|
||||
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
|
||||
var container = error.data("unobtrusiveContainer");
|
||||
|
||||
if (container) {
|
||||
var replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||
replace = replaceAttrValue ? JSON.parse(replaceAttrValue) : null;
|
||||
|
||||
container.addClass("field-validation-valid").removeClass("field-validation-error");
|
||||
error.removeData("unobtrusiveContainer");
|
||||
|
||||
@@ -99,8 +100,19 @@
|
||||
}
|
||||
|
||||
function onReset(event) { // 'this' is the form element
|
||||
var $form = $(this);
|
||||
$form.data("validator").resetForm();
|
||||
var $form = $(this),
|
||||
key = '__jquery_unobtrusive_validation_form_reset';
|
||||
if ($form.data(key)) {
|
||||
return;
|
||||
}
|
||||
// Set a flag that indicates we're currently resetting the form.
|
||||
$form.data(key, true);
|
||||
try {
|
||||
$form.data("validator").resetForm();
|
||||
} finally {
|
||||
$form.removeData(key);
|
||||
}
|
||||
|
||||
$form.find(".validation-summary-errors")
|
||||
.addClass("validation-summary-valid")
|
||||
.removeClass("validation-summary-errors");
|
||||
@@ -109,29 +121,43 @@
|
||||
.removeClass("field-validation-error")
|
||||
.removeData("unobtrusiveContainer")
|
||||
.find(">*") // If we were using valmsg-replace, get the underlying error
|
||||
.removeData("unobtrusiveContainer");
|
||||
.removeData("unobtrusiveContainer");
|
||||
}
|
||||
|
||||
function validationInfo(form) {
|
||||
var $form = $(form),
|
||||
result = $form.data(data_validation),
|
||||
onResetProxy = $.proxy(onReset, form);
|
||||
onResetProxy = $.proxy(onReset, form),
|
||||
defaultOptions = $jQval.unobtrusive.options || {},
|
||||
execInContext = function (name, args) {
|
||||
var func = defaultOptions[name];
|
||||
func && typeof func === "function" && func.apply(form, args);
|
||||
};
|
||||
|
||||
if (!result) {
|
||||
result = {
|
||||
options: { // options structure passed to jQuery Validate's validate() method
|
||||
errorClass: "input-validation-error",
|
||||
errorElement: "span",
|
||||
errorPlacement: $.proxy(onError, form),
|
||||
invalidHandler: $.proxy(onErrors, form),
|
||||
errorClass: defaultOptions.errorClass || "input-validation-error",
|
||||
errorElement: defaultOptions.errorElement || "span",
|
||||
errorPlacement: function () {
|
||||
onError.apply(form, arguments);
|
||||
execInContext("errorPlacement", arguments);
|
||||
},
|
||||
invalidHandler: function () {
|
||||
onErrors.apply(form, arguments);
|
||||
execInContext("invalidHandler", arguments);
|
||||
},
|
||||
messages: {},
|
||||
rules: {},
|
||||
success: $.proxy(onSuccess, form)
|
||||
success: function () {
|
||||
onSuccess.apply(form, arguments);
|
||||
execInContext("success", arguments);
|
||||
}
|
||||
},
|
||||
attachValidation: function () {
|
||||
$form
|
||||
.unbind("reset." + data_validation, onResetProxy)
|
||||
.bind("reset." + data_validation, onResetProxy)
|
||||
.off("reset." + data_validation, onResetProxy)
|
||||
.on("reset." + data_validation, onResetProxy)
|
||||
.validate(this.options);
|
||||
},
|
||||
validate: function () { // a validation function that is called by unobtrusive Ajax
|
||||
@@ -206,15 +232,17 @@
|
||||
/// attribute values.
|
||||
/// </summary>
|
||||
/// <param name="selector" type="String">Any valid jQuery selector.</param>
|
||||
var $forms = $(selector)
|
||||
.parents("form")
|
||||
.andSelf()
|
||||
.add($(selector).find("form"))
|
||||
.filter("form");
|
||||
|
||||
// :input is a psuedoselector provided by jQuery which selects input and input-like elements
|
||||
// combining :input with other selectors significantly decreases performance.
|
||||
$(selector).find(":input").filter("[data-val=true]").each(function () {
|
||||
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
|
||||
// element with data-val=true
|
||||
var $selector = $(selector),
|
||||
$forms = $selector.parents()
|
||||
.addBack()
|
||||
.filter("form")
|
||||
.add($selector.find("form"))
|
||||
.has("[data-val=true]");
|
||||
|
||||
$selector.find("[data-val=true]").each(function () {
|
||||
$jQval.unobtrusive.parseElement(this, true);
|
||||
});
|
||||
|
||||
@@ -370,7 +398,15 @@
|
||||
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
|
||||
var paramName = appendModelPrefix(fieldName, prefix);
|
||||
value.data[paramName] = function () {
|
||||
return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val();
|
||||
var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
|
||||
// For checkboxes and radio buttons, only pick up values from checked fields.
|
||||
if (field.is(":checkbox")) {
|
||||
return field.filter(":checked").val() || field.filter(":hidden").val() || '';
|
||||
}
|
||||
else if (field.is(":radio")) {
|
||||
return field.filter(":checked").val() || '';
|
||||
}
|
||||
return field.val();
|
||||
};
|
||||
});
|
||||
|
||||
@@ -387,8 +423,13 @@
|
||||
setValidationValues(options, "regex", options.params.regex);
|
||||
}
|
||||
});
|
||||
adapters.add("fileextensions", ["extensions"], function (options) {
|
||||
setValidationValues(options, "extension", options.params.extensions);
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$jQval.unobtrusive.parse(document);
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
return $jQval.unobtrusive;
|
||||
}));
|
||||
|
||||
@@ -95,16 +95,23 @@ DiscoExpressionEditor.prototype = {
|
||||
this.expressionHtml = this.parseExpression(this.expression, this.expressionException);
|
||||
this.hostContainer.html(this.expressionHtml);
|
||||
},
|
||||
validateExpression: function () {
|
||||
validateExpression: async function () {
|
||||
var that = this;
|
||||
var e = that.getExpression();
|
||||
$.getJSON(that.validateUrl, { Expression: e }, function (response, result) {
|
||||
that.setException(response);
|
||||
that.renderExpression();
|
||||
|
||||
if (that.expressionValidated)
|
||||
that.expressionValidated(response.ExpressionValid, response);
|
||||
})
|
||||
const body = new FormData();
|
||||
body.append('Expression', e);
|
||||
body.append('__RequestVerificationToken', document.body.dataset.antiforgery);
|
||||
const response = await fetch(that.validateUrl, {
|
||||
method: 'POST',
|
||||
body: body
|
||||
});
|
||||
const result = await response.json();
|
||||
that.setException(result);
|
||||
that.renderExpression();
|
||||
|
||||
if (that.expressionValidated)
|
||||
that.expressionValidated(result.ExpressionValid, result);
|
||||
}
|
||||
}
|
||||
String.prototype.trim = function () {
|
||||
|
||||
@@ -1 +1 @@
|
||||
function DiscoExpressionEditor(n,t,i){this.host=n;this.hostDocument=null;this.hostContainer=null;this.validateUrl=t;this.expression=i?i:"";this.expressionHtml="";this.expressionException=null;this.hostInited=null;this.expressionValidated=null;this.expressionExceptionChanged=null}DiscoExpressionEditor.prototype={hostInit:function(){var n=this,i=function(){n.hostDocument=n.host.contents();n.hostContainer=n.hostDocument.find("body");n.host.focus(function(){n.setException(null);n.renderExpression()});n.hostContainer.bind("paste",function(){setTimeout(function(){n.setExpression(n.hostContainer.text())},50)});n.expression&&n.setExpression(n.expression);n.hostInited&&n.hostInited()},t=function(){n.host.unbind("load",t);n.host.load(i);n.host[0].contentWindow.document.designMode="on"};n.host.load(t)},parseExpression:function(n,t){for(var f,r,u=n.split("\n"),i=0;i<u.length;i++)t&&t.PositionRow==i+1?(f=u[i].trim(),r='<p id="line'+i+'" class="line lineError">',f.length>=t.PositionColumn?(r+=f.substr(0,t.PositionColumn-1),r+='<span class="error">'+f.substr(t.PositionColumn-1,1)+"<\/span>",r+=f.substr(t.PositionColumn)):(r+=f,r+='<span class="error"> <\/span>'),r+="<\/p>",u[i]=r):u[i]='<p id="line'+i+'" class="line">'+u[i].trim()+"<\/p>";return u.join("")},setExpression:function(n){this.expression=n;this.setException(null);this.renderExpression()},getExpression:function(){var n=null;return $("p",this.hostContainer).each(function(){n==null?n=$(this).text():n+="\n"+$(this).text()}),this.expression=n,n},setException:function(n){this.expressionException!==n&&(this.expressionException=n,this.expressionExceptionChanged&&this.expressionExceptionChanged(n))},renderExpression:function(){this.expressionHtml=this.parseExpression(this.expression,this.expressionException);this.hostContainer.html(this.expressionHtml)},validateExpression:function(){var n=this,t=n.getExpression();$.getJSON(n.validateUrl,{Expression:t},function(t){n.setException(t);n.renderExpression();n.expressionValidated&&n.expressionValidated(t.ExpressionValid,t)})}};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};
|
||||
function DiscoExpressionEditor(n,t,i){this.host=n;this.hostDocument=null;this.hostContainer=null;this.validateUrl=t;this.expression=i?i:"";this.expressionHtml="";this.expressionException=null;this.hostInited=null;this.expressionValidated=null;this.expressionExceptionChanged=null}DiscoExpressionEditor.prototype={hostInit:function(){var n=this,i=function(){n.hostDocument=n.host.contents();n.hostContainer=n.hostDocument.find("body");n.host.focus(function(){n.setException(null);n.renderExpression()});n.hostContainer.bind("paste",function(){setTimeout(function(){n.setExpression(n.hostContainer.text())},50)});n.expression&&n.setExpression(n.expression);n.hostInited&&n.hostInited()},t=function(){n.host.unbind("load",t);n.host.load(i);n.host[0].contentWindow.document.designMode="on"};n.host.load(t)},parseExpression:function(n,t){for(var f,r,u=n.split("\n"),i=0;i<u.length;i++)t&&t.PositionRow==i+1?(f=u[i].trim(),r='<p id="line'+i+'" class="line lineError">',f.length>=t.PositionColumn?(r+=f.substr(0,t.PositionColumn-1),r+='<span class="error">'+f.substr(t.PositionColumn-1,1)+"<\/span>",r+=f.substr(t.PositionColumn)):(r+=f,r+='<span class="error"> <\/span>'),r+="<\/p>",u[i]=r):u[i]='<p id="line'+i+'" class="line">'+u[i].trim()+"<\/p>";return u.join("")},setExpression:function(n){this.expression=n;this.setException(null);this.renderExpression()},getExpression:function(){var n=null;return $("p",this.hostContainer).each(function(){n==null?n=$(this).text():n+="\n"+$(this).text()}),this.expression=n,n},setException:function(n){this.expressionException!==n&&(this.expressionException=n,this.expressionExceptionChanged&&this.expressionExceptionChanged(n))},renderExpression:function(){this.expressionHtml=this.parseExpression(this.expression,this.expressionException);this.hostContainer.html(this.expressionHtml)},validateExpression:async function(){var n=this,r=n.getExpression();const t=new FormData;t.append("Expression",r);t.append("__RequestVerificationToken",document.body.dataset.antiforgery);const u=await fetch(n.validateUrl,{method:"POST",body:t}),i=await u.json();n.setException(i);n.renderExpression();n.expressionValidated&&n.expressionValidated(i.ExpressionValid,i)}};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
+708
-352
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user