lixin-web
Version:
vue and bootstrap
65,630 lines • 1.78 MB
JavaScript
lxJsonp([0],[
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.format = format;
exports.isEmptyValue = isEmptyValue;
exports.isEmptyObject = isEmptyObject;
exports.asyncMap = asyncMap;
exports.complementError = complementError;
exports.deepMerge = deepMerge;
var formatRegExp = /%[sdj%]/g;
var warning = exports.warning = function warning() {};
// don't print warning message when in production env or node runtime
if (process.env.NODE_ENV !== 'production' && typeof window !== 'undefined' && typeof document !== 'undefined') {
exports.warning = warning = function warning(type, errors) {
if (typeof console !== 'undefined' && console.warn) {
if (errors.every(function (e) {
return typeof e === 'string';
})) {
console.warn(type, errors);
}
}
};
}
function format() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var i = 1;
var f = args[0];
var len = args.length;
if (typeof f === 'function') {
return f.apply(null, args.slice(1));
}
if (typeof f === 'string') {
var str = String(f).replace(formatRegExp, function (x) {
if (x === '%%') {
return '%';
}
if (i >= len) {
return x;
}
switch (x) {
case '%s':
return String(args[i++]);
case '%d':
return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
break;
default:
return x;
}
});
for (var arg = args[i]; i < len; arg = args[++i]) {
str += ' ' + arg;
}
return str;
}
return f;
}
function isNativeStringType(type) {
return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern';
}
function isEmptyValue(value, type) {
if (value === undefined || value === null) {
return true;
}
if (type === 'array' && Array.isArray(value) && !value.length) {
return true;
}
if (isNativeStringType(type) && typeof value === 'string' && !value) {
return true;
}
return false;
}
function isEmptyObject(obj) {
return Object.keys(obj).length === 0;
}
function asyncParallelArray(arr, func, callback) {
var results = [];
var total = 0;
var arrLength = arr.length;
function count(errors) {
results.push.apply(results, errors);
total++;
if (total === arrLength) {
callback(results);
}
}
arr.forEach(function (a) {
func(a, count);
});
}
function asyncSerialArray(arr, func, callback) {
var index = 0;
var arrLength = arr.length;
function next(errors) {
if (errors && errors.length) {
callback(errors);
return;
}
var original = index;
index = index + 1;
if (original < arrLength) {
func(arr[original], next);
} else {
callback([]);
}
}
next([]);
}
function flattenObjArr(objArr) {
var ret = [];
Object.keys(objArr).forEach(function (k) {
ret.push.apply(ret, objArr[k]);
});
return ret;
}
function asyncMap(objArr, option, func, callback) {
if (option.first) {
var flattenArr = flattenObjArr(objArr);
return asyncSerialArray(flattenArr, func, callback);
}
var firstFields = option.firstFields || [];
if (firstFields === true) {
firstFields = Object.keys(objArr);
}
var objArrKeys = Object.keys(objArr);
var objArrLength = objArrKeys.length;
var total = 0;
var results = [];
var next = function next(errors) {
results.push.apply(results, errors);
total++;
if (total === objArrLength) {
callback(results);
}
};
objArrKeys.forEach(function (key) {
var arr = objArr[key];
if (firstFields.indexOf(key) !== -1) {
asyncSerialArray(arr, func, next);
} else {
asyncParallelArray(arr, func, next);
}
});
}
function complementError(rule) {
return function (oe) {
if (oe && oe.message) {
oe.field = oe.field || rule.fullField;
return oe;
}
return {
message: oe,
field: oe.field || rule.fullField
};
};
}
function deepMerge(target, source) {
if (source) {
for (var s in source) {
if (source.hasOwnProperty(s)) {
var value = source[s];
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && _typeof(target[s]) === 'object') {
target[s] = _extends({}, target[s], value);
} else {
target[s] = value;
}
}
}
}
return target;
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
required: __webpack_require__(26),
whitespace: __webpack_require__(48),
type: __webpack_require__(49),
range: __webpack_require__(50),
"enum": __webpack_require__(51),
pattern: __webpack_require__(52)
};
module.exports = exports['default'];
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* jQuery JavaScript Library v3.2.1
* https://jquery.com/
*
* Includes Sizzle.js
* https://sizzlejs.com/
*
* Copyright JS Foundation and other contributors
* Released under the MIT license
* https://jquery.org/license
*
* Date: 2017-03-20T18:59Z
*/
( function( global, factory ) {
"use strict";
if ( typeof module === "object" && typeof module.exports === "object" ) {
// For CommonJS and CommonJS-like environments where a proper `window`
// is present, execute the factory and get jQuery.
// For environments that do not have a `window` with a `document`
// (such as Node.js), expose a factory as module.exports.
// This accentuates the need for the creation of a real `window`.
// e.g. var jQuery = require("jquery")(window);
// See ticket #14549 for more info.
module.exports = global.document ?
factory( global, true ) :
function( w ) {
if ( !w.document ) {
throw new Error( "jQuery requires a window with a document" );
}
return factory( w );
};
} else {
factory( global );
}
// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.
"use strict";
var arr = [];
var document = window.document;
var getProto = Object.getPrototypeOf;
var slice = arr.slice;
var concat = arr.concat;
var push = arr.push;
var indexOf = arr.indexOf;
var class2type = {};
var toString = class2type.toString;
var hasOwn = class2type.hasOwnProperty;
var fnToString = hasOwn.toString;
var ObjectFunctionString = fnToString.call( Object );
var support = {};
function DOMEval( code, doc ) {
doc = doc || document;
var script = doc.createElement( "script" );
script.text = code;
doc.head.appendChild( script ).parentNode.removeChild( script );
}
/* global Symbol */
// Defining this global in .eslintrc.json would create a danger of using the global
// unguarded in another place, it seems safer to define global only for this module
var
version = "3.2.1",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context );
},
// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = {
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
// Return all the elements in a clean array
if ( num == null ) {
return slice.call( this );
}
// Return just the one element from the set
return num < 0 ? this[ num + this.length ] : this[ num ];
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
each: function( callback ) {
return jQuery.each( this, callback );
},
map: function( callback ) {
return this.pushStack( jQuery.map( this, function( elem, i ) {
return callback.call( elem, i, elem );
} ) );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
},
end: function() {
return this.prevObject || this.constructor();
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: arr.sort,
splice: arr.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[ 0 ] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
// Skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
target = {};
}
// Extend jQuery itself if only one argument is passed
if ( i === length ) {
target = this;
i--;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( ( options = arguments[ i ] ) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
( copyIsArray = Array.isArray( copy ) ) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && Array.isArray( src ) ? src : [];
} else {
clone = src && jQuery.isPlainObject( src ) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend( {
// Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
// Assume jQuery is ready without the ready module
isReady: true,
error: function( msg ) {
throw new Error( msg );
},
noop: function() {},
isFunction: function( obj ) {
return jQuery.type( obj ) === "function";
},
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
isNumeric: function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
},
isPlainObject: function( obj ) {
var proto, Ctor;
// Detect obvious negatives
// Use toString instead of jQuery.type to catch host objects
if ( !obj || toString.call( obj ) !== "[object Object]" ) {
return false;
}
proto = getProto( obj );
// Objects with no prototype (e.g., `Object.create( null )`) are plain
if ( !proto ) {
return true;
}
// Objects with prototype are plain iff they were constructed by a global Object function
Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
},
isEmptyObject: function( obj ) {
/* eslint-disable no-unused-vars */
// See https://github.com/eslint/eslint/issues/6125
var name;
for ( name in obj ) {
return false;
}
return true;
},
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
// Evaluates a script in a global context
globalEval: function( code ) {
DOMEval( code );
},
// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 13
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
each: function( obj, callback ) {
var length, i = 0;
if ( isArrayLike( obj ) ) {
length = obj.length;
for ( ; i < length; i++ ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
} else {
for ( i in obj ) {
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
break;
}
}
}
return obj;
},
// Support: Android <=4.0 only
trim: function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
if ( isArrayLike( Object( arr ) ) ) {
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
return arr == null ? -1 : indexOf.call( arr, elem, i );
},
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
for ( ; j < len; j++ ) {
first[ i++ ] = second[ j ];
}
first.length = i;
return first;
},
grep: function( elems, callback, invert ) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
callbackInverse = !callback( elems[ i ], i );
if ( callbackInverse !== callbackExpect ) {
matches.push( elems[ i ] );
}
}
return matches;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var length, value,
i = 0,
ret = [];
// Go through the array, translating each of the items to their new values
if ( isArrayLike( elems ) ) {
length = elems.length;
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
}
// Flatten any nested arrays
return concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
now: Date.now,
// jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist.
support: support
} );
if ( typeof Symbol === "function" ) {
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
}
// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( i, name ) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );
function isArrayLike( obj ) {
// Support: real iOS 8.2 only (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
var length = !!obj && "length" in obj && obj.length,
type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) {
return false;
}
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
* Sizzle CSS Selector Engine v2.3.3
* https://sizzlejs.com/
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2016-08-08
*/
(function( window ) {
var i,
support,
Expr,
getText,
isXML,
tokenize,
compile,
select,
outermostContext,
sortInput,
hasDuplicate,
// Local document vars
setDocument,
document,
docElem,
documentIsHTML,
rbuggyQSA,
rbuggyMatches,
matches,
contains,
// Instance-specific data
expando = "sizzle" + 1 * new Date(),
preferredDoc = window.document,
dirruns = 0,
done = 0,
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
}
return 0;
},
// Instance methods
hasOwn = ({}).hasOwnProperty,
arr = [],
pop = arr.pop,
push_native = arr.push,
push = arr.push,
slice = arr.slice,
// Use a stripped-down indexOf as it's faster than native
// https://jsperf.com/thor-indexof-vs-for/5
indexOf = function( list, elem ) {
var i = 0,
len = list.length;
for ( ; i < len; i++ ) {
if ( list[i] === elem ) {
return i;
}
}
return -1;
},
booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
// Regular expressions
// http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
// Operator (capture 2)
"*([*^$|!~]?=)" + whitespace +
// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
"*\\]",
pseudos = ":(" + identifier + ")(?:\\((" +
// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
// 1. quoted (capture 3; capture 4 or capture 5)
"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
// 2. simple (capture 6)
"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
// 3. anything else (capture 2)
".*" +
")\\)|)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rwhitespace = new RegExp( whitespace + "+", "g" ),
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
rpseudo = new RegExp( pseudos ),
ridentifier = new RegExp( "^" + identifier + "$" ),
matchExpr = {
"ID": new RegExp( "^#(" + identifier + ")" ),
"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
"TAG": new RegExp( "^(" + identifier + "|[*])" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
// For use in libraries implementing .is()
// We use this for POS matching in `select`
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
},
rinputs = /^(?:input|select|textarea|button)$/i,
rheader = /^h\d$/i,
rnative = /^[^{]+\{\s*\[native \w/,
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
rsibling = /[+~]/,
// CSS escapes
// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
funescape = function( _, escaped, escapedWhitespace ) {
var high = "0x" + escaped - 0x10000;
// NaN means non-codepoint
// Support: Firefox<24
// Workaround erroneous numeric interpretation of +"0x"
return high !== high || escapedWhitespace ?
escaped :
high < 0 ?
// BMP codepoint
String.fromCharCode( high + 0x10000 ) :
// Supplemental Plane codepoint (surrogate pair)
String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
},
// CSS string/identifier serialization
// https://drafts.csswg.org/cssom/#common-serializing-idioms
rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
fcssescape = function( ch, asCodePoint ) {
if ( asCodePoint ) {
// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
if ( ch === "\0" ) {
return "\uFFFD";
}
// Control characters and (dependent upon position) numbers get escaped as code points
return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
}
// Other potentially-special ASCII characters get backslash-escaped
return "\\" + ch;
},
// Used for iframes
// See setDocument()
// Removing the function wrapper causes a "Permission Denied"
// error in IE
unloadHandler = function() {
setDocument();
},
disabledAncestor = addCombinator(
function( elem ) {
return elem.disabled === true && ("form" in elem || "label" in elem);
},
{ dir: "parentNode", next: "legend" }
);
// Optimize for push.apply( _, NodeList )
try {
push.apply(
(arr = slice.call( preferredDoc.childNodes )),
preferredDoc.childNodes
);
// Support: Android<4.0
// Detect silently failing push.apply
arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
push = { apply: arr.length ?
// Leverage slice if possible
function( target, els ) {
push_native.apply( target, slice.call(els) );
} :
// Support: IE<9
// Otherwise append directly
function( target, els ) {
var j = target.length,
i = 0;
// Can't trust NodeList.length
while ( (target[j++] = els[i++]) ) {}
target.length = j - 1;
}
};
}
function Sizzle( selector, context, results, seed ) {
var m, i, elem, nid, match, groups, newSelector,
newContext = context && context.ownerDocument,
// nodeType defaults to 9, since context defaults to document
nodeType = context ? context.nodeType : 9;
results = results || [];
// Return early from calls with invalid selector or context
if ( typeof selector !== "string" || !selector ||
nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
return results;
}
// Try to shortcut find operations (as opposed to filters) in HTML documents
if ( !seed ) {
if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
setDocument( context );
}
context = context || document;
if ( documentIsHTML ) {
// If the selector is sufficiently simple, try using a "get*By*" DOM method
// (excepting DocumentFragment context, where the methods don't exist)
if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
// ID selector
if ( (m = match[1]) ) {
// Document context
if ( nodeType === 9 ) {
if ( (elem = context.getElementById( m )) ) {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
// Element context
} else {
// Support: IE, Opera, Webkit
// TODO: identify versions
// getElementById can match elements by name instead of ID
if ( newContext && (elem = newContext.getElementById( m )) &&
contains( context, elem ) &&
elem.id === m ) {
results.push( elem );
return results;
}
}
// Type selector
} else if ( match[2] ) {
push.apply( results, context.getElementsByTagName( selector ) );
return results;
// Class selector
} else if ( (m = match[3]) && support.getElementsByClassName &&
context.getElementsByClassName ) {
push.apply( results, context.getElementsByClassName( m ) );
return results;
}
}
// Take advantage of querySelectorAll
if ( support.qsa &&
!compilerCache[ selector + " " ] &&
(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
if ( nodeType !== 1 ) {
newContext = context;
newSelector = selector;
// qSA looks outside Element context, which is not what we want
// Thanks to Andrew Dupont for this workaround technique
// Support: IE <=8
// Exclude object elements
} else if ( context.nodeName.toLowerCase() !== "object" ) {
// Capture the context ID, setting it first if necessary
if ( (nid = context.getAttribute( "id" )) ) {
nid = nid.replace( rcssescape, fcssescape );
} else {
context.setAttribute( "id", (nid = expando) );
}
// Prefix every selector in the list
groups = tokenize( selector );
i = groups.length;
while ( i-- ) {
groups[i] = "#" + nid + " " + toSelector( groups[i] );
}
newSelector = groups.join( "," );
// Expand context for sibling selectors
newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
context;
}
if ( newSelector ) {
try {
push.apply( results,
newContext.querySelectorAll( newSelector )
);
return results;
} catch ( qsaError ) {
} finally {
if ( nid === expando ) {
context.removeAttribute( "id" );
}
}
}
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed );
}
/**
* Create key-value caches of limited size
* @returns {function(string, object)} Returns the Object data after storing it on itself with
* property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
* deleting the oldest entry
*/
function createCache() {
var keys = [];
function cache( key, value ) {
// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
if ( keys.push( key + " " ) > Expr.cacheLength ) {
// Only keep the most recent entries
delete cache[ keys.shift() ];
}
return (cache[ key + " " ] = value);
}
return cache;
}
/**
* Mark a function for special use by Sizzle
* @param {Function} fn The function to mark
*/
function markFunction( fn ) {
fn[ expando ] = true;
return fn;
}
/**
* Support testing using an element
* @param {Function} fn Passed the created element and returns a boolean result
*/
function assert( fn ) {
var el = document.createElement("fieldset");
try {
return !!fn( el );
} catch (e) {
return false;
} finally {
// Remove from its parent by default
if ( el.parentNode ) {
el.parentNode.removeChild( el );
}
// release memory in IE
el = null;
}
}
/**
* Adds the same handler for all of the specified attrs
* @param {String} attrs Pipe-separated list of attributes
* @param {Function} handler The method that will be applied
*/
function addHandle( attrs, handler ) {
var arr = attrs.split("|"),
i = arr.length;
while ( i-- ) {
Expr.attrHandle[ arr[i] ] = handler;
}
}
/**
* Checks document order of two siblings
* @param {Element} a
* @param {Element} b
* @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
*/
function siblingCheck( a, b ) {
var cur = b && a,
diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
a.sourceIndex - b.sourceIndex;
// Use IE sourceIndex if available on both nodes
if ( diff ) {
return diff;
}
// Check if b follows a
if ( cur ) {
while ( (cur = cur.nextSibling) ) {
if ( cur === b ) {
return -1;
}
}
}
return a ? 1 : -1;
}
/**
* Returns a function to use in pseudos for input types
* @param {String} type
*/
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for buttons
* @param {String} type
*/
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
/**
* Returns a function to use in pseudos for :enabled/:disabled
* @param {Boolean} disabled true for :disabled; false for :enabled
*/
function createDisabledPseudo( disabled ) {
// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
return function( elem ) {
// Only certain elements can match :enabled or :disabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
if ( "form" in elem ) {
// Check for inherited disabledness on relevant non-disabled elements:
// * listed form-associated elements in a disabled fieldset
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
// * option elements in a disabled optgroup
// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
// All such elements have a "form" property.
if ( elem.parentNode && elem.disabled === false ) {
// Option elements defer to a parent optgroup if present
if ( "label" in elem ) {
if ( "label" in elem.parentNode ) {
return elem.parentNode.disabled === disabled;
} else {
return elem.disabled === disabled;
}
}
// Support: IE 6 - 11
// Use the isDisabled shortcut property to check for disabled fieldset ancestors
return elem.isDisabled === disabled ||
// Where there is no isDisabled, check manually
/* jshint -W018 */
elem.isDisabled !== !disabled &&
disabledAncestor( elem ) === disabled;
}
return elem.disabled === disabled;
// Try to winnow out elements that can't be disabled before trusting the disabled property.
// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
// even exist on them, let alone have a boolean value.
} else if ( "label" in elem ) {
return elem.disabled === disabled;
}
// Remaining elements are neither :enabled nor :disabled
return false;
};
}
/**
* Returns a function to use in pseudos for positionals
* @param {Function} fn
*/
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Checks a node for validity as a Sizzle context
* @param {Element|Object=} context
* @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
*/
function testContext( context ) {
return context && typeof context.getElementsByTagName !== "undefined" && context;
}
// Expose support vars for convenience
support = Sizzle.support = {};
/**
* Detects XML nodes
* @param {Element|Object} elem An element or a document
* @returns {Boolean} True iff elem is a non-HTML XML node
*/
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
/**
* Sets document-related variables once based on the current document
* @param {Element|Object} [doc] An element or document object to use to set the document
* @returns {Object} Returns the current document
*/
setDocument = Sizzle.setDocument = function( node ) {
var hasCompare, subWindow,
doc = node ? node.ownerDocument || node : preferredDoc;
// Return early if doc is invalid or already selected
if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
return document;
}
// Update global variables
document = doc;
docElem = document.documentElement;
documentIsHTML = !isXML( document );
// Support: IE 9-11, Edge
// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
if ( preferredDoc !== document &&
(subWindow = document.defaultView) && subWindow.top !== subWindow ) {
// Support: IE 11, Edge
if ( subWindow.addEventListener ) {
subWindow.addEventListener( "unload", unloadHandler, false );
// Support: IE 9 - 10 only
} else if ( subWindow.attachEvent ) {
subWindow.attachEvent( "onunload", unloadHandler );
}
}
/* Attributes
---------------------------------------------------------------------- */
// Support: IE<8
// Verify that getAttribute really returns attributes and not properties
// (excepting IE8 booleans)
support.attributes = assert(function( el ) {
el.className = "i";
return !el.getAttribute("className");
});
/* getElement(s)By*
---------------------------------------------------------------------- */
// Check if getElementsByTagName("*") returns only elements
support.getElementsByTagName = assert(function( el ) {
el.appendChild( document.createComment("") );
return !el.getElementsByTagName("*").length;
});
// Support: IE<9
support.getElementsByClassName = rnative.test( document.getElementsByClassName );
// Support: IE<10
// Check if getElementById returns elements by name
// The broken getElementById methods don't pick up programmatically-set names,
// so use a roundabout getElementsByName test
support.getById = assert(function( el ) {
docElem.appendChild( el ).id = expando;
return !document.getElementsByName || !document.getElementsByName( expando ).length;
});
// ID filter and find
if ( support.getById ) {
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
return elem.getAttribute("id") === attrId;
};
};
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
var elem = context.getElementById( id );
return elem ? [ elem ] : [];
}
};
} else {
Expr.filter["ID"] = function( id ) {
var attrId = id.replace( runescape, funescape );
return function( elem ) {
var node = typeof elem.getAttributeNode !== "undefined" &&
elem.getAttributeNode("id");
return node && node.value === attrId;
};
};
// Support: IE 6 - 7 only
// getElementById is not reliable as a find shortcut
Expr.find["ID"] = function( id, context ) {
if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
var node, i, elems,
elem = context.getElementById( id );
if ( elem ) {
// Verify the id attribute
node = elem.getAttributeNode("id");
if ( node && node.value === id ) {
return [ elem ];
}
// Fall back on getElementsByName
elems = context.getElementsByName( id );
i = 0;
while ( (elem = elems[i++]) ) {
node = elem.getAttributeNode("id");
if ( node && node.value === id ) {
return [ elem ];
}
}
}
return [];
}
};
}
// Tag
Expr.find["TAG"] = support.getElementsByTagName ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( tag );
// DocumentFragment nodes don't have gEBTN
} else if ( support.qsa ) {
return context.querySelectorAll( tag );
}
} :
function( tag, context ) {
var elem,
tmp = [],
i = 0,
// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
while ( (elem = results[i++]) ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
};
// Class
Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
return context.getElementsByClassName( className );
}
};
/* QSA/matchesSelector
---------------------------------------------------------------------- */
// QSA and matchesSelector support
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
rbuggyMatches = [];
// qSa(:focus) reports false when true (Chrome 21)
// We allow this because of a bug in IE8/9 that throws an error
// whenever `document.activeElement` is accessed on an iframe
// So, we allow :focus to pass through QSA all the time to avoid the IE error
// See https://bugs.jquery.com/ticket/13378
rbuggyQSA = [];
if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( el ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explicitly
// setting a boolean content attribute,
// since its presence should be enough
// https://bugs.jquery.com/ticket/12359
docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
"<select id='" + expando + "-\r\\' msallowcapture=''>" +
"<option selected=''></option></select>";
// Support: IE8, Opera 11-12.16
// Nothing should be selected when empty strings follow ^= or $= or *=
// The test attribute must be unknown in Opera but "safe" for WinRT
// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
if ( el.querySelectorAll("[msallowcapture^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
}
// Support: IE8
// Boolean attributes and "value" are not treated correctly
if ( !el.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
}
// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
rbuggyQSA.push("~=");
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here and will not see later tests
if ( !el.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
// Support: Safari 8+, iOS 8+
// https://bugs.webkit.org/show_bug.cgi?id=136851
// In-page `selector#id sibling-combinator selector` fails
if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
rbuggyQSA.push(".#.+[+~]");
}
});
assert(function( el ) {
el.innerHTML = "<a href='' disabled='disabled'></a>" +
"<select disabled='disabled'><option/></select>";
// Support: Windows 8 Native Apps
// The type and name attributes are restricted during .innerHTML assignment
var input = document.createElement("input");
input.setAttribute( "type", "hidden" );
el.appendChild( input ).setAttribute( "name", "D" );
// Support: IE8
// Enforce case-sensitivity of name attribute
if ( el.querySelectorAll("[name=d]").length ) {
rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here and will not see later tests
if ( el.querySelectorAll(":enabled").length !== 2 ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Support: IE9-11+
// IE's :disabled selector does not pick up the children of disabled fieldsets
docElem.appendChild( el ).disabled = true;
if ( el.querySelectorAll(":disabled").length !== 2 ) {
rbuggyQSA.push( ":enabled", ":disabled" );
}
// Opera 10-11 does not throw on post-comma invalid pseudos
el.querySelectorAll("*,:x");
rbuggyQSA.push(",.*:");
});
}
if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
docElem.webkitMatchesSelector ||
docElem.mozMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector) )) ) {
assert(function( el ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
support.disconnectedMatch = matches.call( el, "*" );
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( el, "[s!='']:x" );
rbuggyMatches.push( "!=", pseudos );
});
}
rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
/* Contains
---------------------------------------------------------------------- */
hasCompare = rnative.test( docElem.compareDocumentPosition );
// Element contains another
// Purposefully self-exclusive
// As in, an element does not contain itself
contains = hasCompare || rnative.test( docElem.contains ) ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && (
adown.contains ?
adown.contains( bup ) :
a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
));
} :
function( a, b ) {
if ( b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
}
return false;
};
/* Sorting
---------------------------------------------------------------------- */
// Document order sorting
sortOrder = hasCompare ?
function( a, b ) {
// Flag for duplicate removal
if ( a === b ) {
hasDuplicate = true;
return 0;
}
// Sort on method existence if only one input has compareDocumentPosition
var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
if ( compare ) {
return compare;
}
// Calculate position if both inputs belong to the same document
compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
a.compareDocumentPosition( b ) :
// Otherwise we know they are disconnected
1;
// Disconnected nodes
if ( compare & 1 ||
(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
// Choose the first element that is related to our preferred document
if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
return -1;
}
if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
return 1;
}
// Maintain original order
return sortInput ?
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0;
}
return compare & 4 ? -1 : 1;
} :
function( a, b ) {
// Exit early if the nodes are identical
if ( a === b ) {
hasDuplicate = true;
return 0;
}
var cur,
i = 0,
aup = a.parentNode,
bup = b.parentNode,
ap = [ a ],
bp = [ b ];
// Parentless nodes are either documents or disconnected
if ( !aup || !bup ) {
return a === document ? -1 :
b === document ? 1 :
aup ? -1 :
bup ? 1 :
sortInput ?
( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
0;
// If the nodes are siblings, we can do a quick check
} else if ( aup === bup ) {
return siblingCheck( a, b );
}
// Otherwise we need full lists of their ancestors for comparison
cur = a;
while ( (cur = cur.parentNode) ) {
ap.unshift( cur );
}
cur = b;
while ( (cur = cur.parentNode) ) {
bp.unshift( cur );
}
// Walk down the tree looking for a discrepancy
while ( ap[i] === bp[i] ) {
i++;
}
return i ?
// Do a sibling check if the nodes have a common ancestor
siblingCheck( ap[i], bp[i] ) :
// Otherwise nodes in our document sort first
ap[i] === preferredDoc ? -1 :
bp[i] === preferredDoc ? 1 :
0;
};
return document;
};
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
if ( support.matchesSelector && documentIsHTML &&
!compilerCache[ expr + " " ] &&
( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || support.disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch (e) {}
}
return Sizzle( expr, document, null, [ elem ] ).length > 0;
};
Sizzle.contains = function( context, elem ) {
// Set document vars if needed
if ( ( context.ownerDocument || context ) !== document ) {
setDocument( context );
}
return contains( context, elem );
};
Sizzle.attr = function( elem, name ) {
// Set document vars if needed
if ( ( elem.ownerDocument || elem ) !== document ) {
setDocument( elem );
}
var fn = Expr.attrHandle[ name.toLowerCase() ],
// Don't get fooled by Object.prototype properties (jQuery #13807)
val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
fn( elem, name, !documentIsHTML ) :
undefined;
return val !== undefined ?
val :
support.attributes || !documentIsHTML ?
elem.getAttribute( name ) :
(val = elem.getAttributeNode(name)) && val.specified ?
val.value :
null;
};
Sizzle.escape = function( sel ) {
return (sel + "").replace( rcssescape, fcssescape );
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Document sorting and removing duplicates
* @param {ArrayLike} results
*/
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
j = 0,
i = 0;
// Unless we *know* we can detect duplicates, assume their presence
hasDuplicate = !support.detectDuplicates;
sortInput = !support.sortStable && results.slice( 0 );
results.sort( sortOrder );
if ( hasDuplicate ) {
while ( (elem = results[i++]) ) {
if ( elem === results[ i ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
// Clear input after sorting to release objects
// See https://github.com/jquery/sizzle/pull/225
sortInput = null;
return results;
};
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( !nodeType ) {
// If no nodeType, this is expected to be an array
while ( (node = elem[i++]) ) {
// Do not traverse comment nodes
ret += getText( node );
}
} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (jQuery #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
return ret;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
attrHandle: {},
find: {},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( runescape, funescape );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 what (child|of-type)
3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
4 xn-component of xn+y argument ([+-]?\d*n|)
5 sign of xn-component
6 x of xn-component
7 sign of y-component
8 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1].slice( 0, 3 ) === "nth" ) {
// nth-* requires argument
if ( !match[3] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
// other types prohibit arguments
} else if ( match[3] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var excess,
unquoted = !match[6] && match[2];
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
// Accept quoted arguments as-is
if ( match[3] ) {
match[2] = match[4] || match[5] || "";
// Strip excess characters from unquoted arguments
} else if ( unquoted && rpseudo.test( unquoted ) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
match[0] = match[0].slice( 0, excess );
match[2] = unquoted.slice( 0, excess );
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"TAG": function( nodeNameSelector ) {
var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
return nodeNameSelector === "*" ?
function() { return true; } :
function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.slice( -check.length ) === check :
operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, what, argument, first, last ) {
var simple = type.slice( 0, 3 ) !== "nth",
forward = type.slice( -4 ) !== "last",
ofType = what === "of-type";
return first === 1 && last === 0 ?
// Shortcut for :nth-*(n)
function( elem ) {
return !!elem.parentNode;
} :
function( elem, context, xml ) {
var cache, uniqueCache, outerCache, node, nodeIndex, start,
dir = simple !== forward ? "nextSibling" : "previousSibling",
parent = elem.parentNode,
name = ofType && elem.nodeName.toLowerCase(),
useCache = !xml && !ofType,
diff = false;
if ( parent ) {
// :(first|last|only)-(child|of-type)
if ( simple ) {
while ( dir ) {
node = elem;
while ( (node = node[ dir ]) ) {
if ( ofType ?
node.nodeName.toLowerCase() === name :
node.nodeType === 1 ) {
return false;
}
}
// Reverse direction for :only-* (if we haven't yet done so)
start = dir = type === "only" && !start && "nextSibling";
}
return true;
}
start = [ forward ? parent.firstChild : parent.lastChild ];
// non-xml :nth-child(...) stores cache data on `parent`
if ( forward && useCache ) {
// Seek `elem` from a previously-cached index
// ...in a gzip-friendly way
node = parent;
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
cache = uniqueCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex && cache[ 2 ];
node = nodeIndex && parent.childNodes[ nodeIndex ];
while ( (node = ++nodeIndex && node && node[ dir ] ||
// Fallback to seeking `elem` from the start
(diff = nodeIndex = 0) || start.pop()) ) {
// When found, cache indexes on `parent` and break
if ( node.nodeType === 1 && ++diff && node === elem ) {
uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
break;
}
}
} else {
// Use previously-cached element index if available
if ( useCache ) {
// ...in a gzip-friendly way
node = elem;
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
cache = uniqueCache[ type ] || [];
nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
diff = nodeIndex;
}
// xml :nth-child(...)
// or :nth-last-child(...) or :nth(-last)?-of-type(...)
if ( diff === false ) {
// Use the same loop as above to seek `elem` from the start
while ( (node = ++nodeIndex && node && node[ dir ] ||
(diff = nodeIndex = 0) || start.pop()) ) {
if ( ( ofType ?
node.nodeName.toLowerCase() === name :
node.nodeType === 1 ) &&
++diff ) {
// Cache the index of each encountered element
if ( useCache ) {
outerCache = node[ expando ] || (node[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ node.uniqueID ] ||
(outerCache[ node.uniqueID ] = {});
uniqueCache[ type ] = [ dirruns, diff ];
}
if ( node === elem ) {
break;
}
}
}
}
}
// Incorporate the offset, then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
// Potentially complex pseudos
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
// Don't keep the element (issue #299)
input[0] = null;
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
text = text.replace( runescape, funescape );
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
// "Whether an element is represented by a :lang() selector
// is based solely on the element's language value
// being equal to the identifier C,
// or beginning with the identifier C immediately followed by "-".
// The matching of C against the element's language value is performed case-insensitively.
// The identifier C does not have to be a valid language name."
// http://www.w3.org/TR/selectors/#lang-pseudo
"lang": markFunction( function( lang ) {
// lang value must be a valid identifier
if ( !ridentifier.test(lang || "") ) {
Sizzle.error( "unsupported lang: " + lang );
}
lang = lang.replace( runescape, funescape ).toLowerCase();
return function( elem ) {
var elemLang;
do {
if ( (elemLang = documentIsHTML ?
elem.lang :
elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
elemLang = elemLang.toLowerCase();
return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
}
} while ( (elem = elem.parentNode) && elem.nodeType === 1 );
return false;
};
}),
// Miscellaneous
"target": function( elem ) {
var hash = window.location && window.location.hash;
return hash && hash.slice( 1 ) === elem.id;
},
"root": function( elem ) {
return elem === docElem;
},
"focus": function( elem ) {
return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
// Boolean properties
"enabled": createDisabledPseudo( false ),
"disabled": createDisabledPseudo( true ),
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
// Contents
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
// but not by others (comment: 8; processing instruction: 7; etc.)
// nodeType < 6 works because attributes (2) do not appear as children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
if ( elem.nodeType < 6 ) {
return false;
}
}
return true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
// Element/input types
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"text": function( elem ) {
var attr;
return elem.nodeName.toLowerCase() === "input" &&
elem.type === "text" &&
// Support: IE<8
// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
},
// Position-in-collection
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
var i = 0;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
var i = 1;
for ( ; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
var i = argument < 0 ? argument + length : argument;
for ( ; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
Expr.pseudos[ i ] = createButtonPseudo( i );
}
// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();
tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( (tokens = []) );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
matched = match.shift();
tokens.push({
value: matched,
// Cast descendant combinators to space
type: match[0].replace( rtrim, " " )
});
soFar = soFar.slice( matched.length );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
matched = match.shift();
tokens.push({
value: matched,
type: type,
matches: match
});
soFar = soFar.slice( matched.length );
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
};
function toSelector( tokens ) {
var i = 0,
len = tokens.length,
selector = "";
for ( ; i < len; i++ ) {
selector += tokens[i].value;
}
return selector;
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
skip = combinator.next,
key = skip || dir,
checkNonElements = base && key === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
return matcher( elem, context, xml );
}
}
return false;
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
var oldCache, uniqueCache, outerCache,
newCache = [ dirruns, doneName ];
// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
if ( xml ) {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
if ( matcher( elem, context, xml ) ) {
return true;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( elem.nodeType === 1 || checkNonElements ) {
outerCache = elem[ expando ] || (elem[ expando ] = {});
// Support: IE <9 only
// Defend against cloned attroperties (jQuery gh-1709)
uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
if ( skip && skip === elem.nodeName.toLowerCase() ) {
elem = elem[ dir ] || elem;
} else if ( (oldCache = uniqueCache[ key ]) &&
oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
// Assign to newCache so results back-propagate to previous elements
return (newCache[ 2 ] = oldCache[ 2 ]);
} else {
// Reuse newcache so results back-propagate to previous elements
uniqueCache[ key ] = newCache;
// A match means we're done; a fail means we have to keep checking
if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
return true;
}
}
}
}
}
return false;
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
// Avoid hanging onto element (issue #299)
checkContext = null;
return ret;
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && toSelector(
// If the preceding token was a descendant combinator, insert an implicit any-element `*`
tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
).replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && toSelector( tokens )
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, outermost ) {
var elem, j, matcher,
matchedCount = 0,
i = "0",
unmatched = seed && [],
setMatched = [],
contextBackup = outermostContext,
// We must always have either seed elements or outermost context
elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
// Use integer dirruns iff this is the outermost matcher
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
len = elems.length;
if ( outermost ) {
outermostContext = context === document || context || outermost;
}
// Add elements passing elementMatchers directly to results
// Support: IE<9, Safari
// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
j = 0;
if ( !context && elem.ownerDocument !== document ) {
setDocument( elem );
xml = !documentIsHTML;
}
while ( (matcher = elementMatchers[j++]) ) {
if ( matcher( elem, context || document, xml) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// `i` is now the count of elements visited above, and adding it to `matchedCount`
// makes the latter nonnegative.
matchedCount += i;
// Apply set filters to unmatched elements
// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
// no element matchers and no seed.
// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
// case, which will result in a "00" `matchedCount` that differs from `i` but is also
// numerically zero.
if ( bySet && i !== matchedCount ) {
j = 0;
while ( (matcher = setMatchers[j++]) ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !match ) {
match = tokenize( selector );
}
i = match.length;
while ( i-- ) {
cached = matcherFromTokens( match[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
// Save selector and tokenization
cached.selector = selector;
}
return cached;
};
/**
* A low-level selection function that works with Sizzle's compiled
* selector functions
* @param {String|Function} selector A selector or a pre-compiled
* selector function built with Sizzle.compile
* @param {Element} context
* @param {Array} [results]
* @param {Array} [seed] A set of elements to match against
*/
select = Sizzle.select = function( selector, context, results, seed ) {
var i, tokens, token, type, find,
compiled = typeof selector === "function" && selector,
match = !seed && tokenize( (selector = compiled.selector || selector) );
results = results || [];
// Try to minimize operations if there is only one selector in the list and no seed
// (the latter of which guarantees us context)
if ( match.length === 1 ) {
// Reduce context if the leading compound selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
if ( !context ) {
return results;
// Precompiled matchers will still verify ancestry, so step up a level
} else if ( compiled ) {
context = context.parentNode;
}
selector = selector.slice( tokens.shift().value.length );
}
// Fetch a seed set for right-to-left matching
i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
while ( i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( runescape, funescape ),
rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && toSelector( tokens );
if ( !selector ) {
push.apply( results, seed );
return results;
}
break;
}
}
}
}
// Compile and execute a filtering function if one is not provided
// Provide `match` to avoid retokenization if we modified the selector above
( compiled || compile( selector, match ) )(
seed,
context,
!documentIsHTML,
results,
!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
);
return results;
};
// One-time assignments
// Sort stability
support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
// Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;
// Initialize against the default document
setDocument();
// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert(function( el ) {
// Should return 1, but returns 4 (following)
return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
});
// Support: IE<8
// Prevent attribute/property "interpolation"
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert(function( el ) {
el.innerHTML = "<a href='#'></a>";
return el.firstChild.getAttribute("href") === "#" ;
}) ) {
addHandle( "type|href|height|width", function( elem, name, isXML ) {
if ( !isXML ) {
return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
}
});
}
// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert(function( el ) {
el.innerHTML = "<input/>";
el.firstChild.setAttribute( "value", "" );
return el.firstChild.getAttribute( "value" ) === "";
}) ) {
addHandle( "value", function( elem, name, isXML ) {
if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
return elem.defaultValue;
}
});
}
// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert(function( el ) {
return el.getAttribute("disabled") == null;
}) ) {
addHandle( booleans, function( elem, name, isXML ) {
var val;
if ( !isXML ) {
return elem[ name ] === true ? name.toLowerCase() :
(val = elem.getAttributeNode( name )) && val.specified ?
val.value :
null;
}
});
}
return Sizzle;
})( window );
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
// Deprecated
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jQuery.escapeSelector = Sizzle.escape;
var dir = function( elem, dir, until ) {
var matched = [],
truncate = until !== undefined;
while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
if ( elem.nodeType === 1 ) {
if ( truncate && jQuery( elem ).is( until ) ) {
break;
}
matched.push( elem );
}
}
return matched;
};
var siblings = function( n, elem ) {
var matched = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
matched.push( n );
}
}
return matched;
};
var rneedsContext = jQuery.expr.match.needsContext;
function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
};
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
var risSimple = /^.[^:#\[\.,]*$/;
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) {
return !!qualifier.call( elem, i, elem ) !== not;
} );
}
// Single element
if ( qualifier.nodeType ) {
return jQuery.grep( elements, function( elem ) {
return ( elem === qualifier ) !== not;
} );
}
// Arraylike of elements (jQuery, arguments, Array)
if ( typeof qualifier !== "string" ) {
return jQuery.grep( elements, function( elem ) {
return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
} );
}
// Simple selector that can be filtered directly, removing non-Elements
if ( risSimple.test( qualifier ) ) {
return jQuery.filter( qualifier, elements, not );
}
// Complex selector, compare the two sets, removing non-Elements
qualifier = jQuery.filter( qualifier, elements );
return jQuery.grep( elements, function( elem ) {
return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
} );
}
jQuery.filter = function( expr, elems, not ) {
var elem = elems[ 0 ];
if ( not ) {
expr = ":not(" + expr + ")";
}
if ( elems.length === 1 && elem.nodeType === 1 ) {
return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
}
return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
return elem.nodeType === 1;
} ) );
};
jQuery.fn.extend( {
find: function( selector ) {
var i, ret,
len = this.length,
self = this;
if ( typeof selector !== "string" ) {
return this.pushStack( jQuery( selector ).filter( function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
} ) );
}
ret = this.pushStack( [] );
for ( i = 0; i < len; i++ ) {
jQuery.find( selector, self[ i ], ret );
}
return len > 1 ? jQuery.uniqueSort( ret ) : ret;
},
filter: function( selector ) {
return this.pushStack( winnow( this, selector || [], false ) );
},
not: function( selector ) {
return this.pushStack( winnow( this, selector || [], true ) );
},
is: function( selector ) {
return !!winnow(
this,
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
typeof selector === "string" && rneedsContext.test( selector ) ?
jQuery( selector ) :
selector || [],
false
).length;
}
} );
// Initialize a jQuery object
// A central reference to the root jQuery(document)
var rootjQuery,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
// Strict HTML recognition (#11290: must start with <)
// Shortcut simple #id case for speed
rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
init = jQuery.fn.init = function( selector, context, root ) {
var match, elem;
// HANDLE: $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Method init() accepts an alternate rootjQuery
// so migrate can support jQuery.sub (gh-2101)
root = root || rootjQuery;
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector[ 0 ] === "<" &&
selector[ selector.length - 1 ] === ">" &&
selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && ( match[ 1 ] || !context ) ) {
// HANDLE: $(html) -> $(array)
if ( match[ 1 ] ) {
context = context instanceof jQuery ? context[ 0 ] : context;
// Option to run scripts is true for back-compat
// Intentionally let the error be thrown if parseHTML is not present
jQuery.merge( this, jQuery.parseHTML(
match[ 1 ],
context && context.nodeType ? context.ownerDocument || context : document,
true
) );
// HANDLE: $(html, props)
if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
for ( match in context ) {
// Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] );
// ...and otherwise set as attributes
} else {
this.attr( match, context[ match ] );
}
}
}
return this;
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[ 2 ] );
if ( elem ) {
// Inject the element directly into the jQuery object
this[ 0 ] = elem;
this.length = 1;
}
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || root ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(DOMElement)
} else if ( selector.nodeType ) {
this[ 0 ] = selector;
this.length = 1;
return this;
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return root.ready !== undefined ?
root.ready( selector ) :
// Execute immediately if ready is not present
selector( jQuery );
}
return jQuery.makeArray( selector, this );
};
// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;
// Initialize central reference
rootjQuery = jQuery( document );
var rparentsprev = /^(?:parents|prev(?:Until|All))/,
// Methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend( {
has: function( target ) {
var targets = jQuery( target, this ),
l = targets.length;
return this.filter( function() {
var i = 0;
for ( ; i < l; i++ ) {
if ( jQuery.contains( this, targets[ i ] ) ) {
return true;
}
}
} );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
matched = [],
targets = typeof selectors !== "string" && jQuery( selectors );
// Positional selectors never match, since there's no _selection_ context
if ( !rneedsContext.test( selectors ) ) {
for ( ; i < l; i++ ) {
for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
// Always skip document fragments
if ( cur.nodeType < 11 && ( targets ?
targets.index( cur ) > -1 :
// Don't pass non-elements to Sizzle
cur.nodeType === 1 &&
jQuery.find.matchesSelector( cur, selectors ) ) ) {
matched.push( cur );
break;
}
}
}
}
return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
},
// Determine the position of an element within the set
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
}
// Index in selector
if ( typeof elem === "string" ) {
return indexOf.call( jQuery( elem ), this[ 0 ] );
}
// Locate the position of the desired element
return indexOf.call( this,
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[ 0 ] : elem
);
},
add: function( selector, context ) {
return this.pushStack(
jQuery.uniqueSort(
jQuery.merge( this.get(), jQuery( selector, context ) )
)
);
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter( selector )
);
}
} );
function sibling( cur, dir ) {
while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
return cur;
}
jQuery.each( {
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return siblings( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return siblings( elem.firstChild );
},
contents: function( elem ) {
if ( nodeName( elem, "iframe" ) ) {
return elem.contentDocument;
}
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
// Treat the template element as a regular one in browsers that
// don't support it.
if ( nodeName( elem, "template" ) ) {
elem = elem.content || elem;
}
return jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var matched = jQuery.map( this, fn, until );
if ( name.slice( -5 ) !== "Until" ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
matched = jQuery.filter( selector, matched );
}
if ( this.length > 1 ) {
// Remove duplicates
if ( !guaranteedUnique[ name ] ) {
jQuery.uniqueSort( matched );
}
// Reverse order for parents* and prev-derivatives
if ( rparentsprev.test( name ) ) {
matched.reverse();
}
}
return this.pushStack( matched );
};
} );
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
var object = {};
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
object[ flag ] = true;
} );
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
createOptions( options ) :
jQuery.extend( {}, options );
var // Flag to know if list is currently firing
firing,
// Last fire value for non-forgettable lists
memory,
// Flag to know if list was already fired
fired,
// Flag to prevent firing
locked,
// Actual callback list
list = [],
// Queue of execution data for repeatable lists
queue = [],
// Index of currently firing callback (modified by add/remove as needed)
firingIndex = -1,
// Fire callbacks
fire = function() {
// Enforce single-firing
locked = locked || options.once;
// Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes
fired = firing = true;
for ( ; queue.length; firingIndex = -1 ) {
memory = queue.shift();
while ( ++firingIndex < list.length ) {
// Run callback and check for early termination
if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
options.stopOnFalse ) {
// Jump to end and forget the data so .add doesn't re-fire
firingIndex = list.length;
memory = false;
}
}
}
// Forget the data if we're done with it
if ( !options.memory ) {
memory = false;
}
firing = false;
// Clean up if we're done firing for good
if ( locked ) {
// Keep an empty list if we have data for future add calls
if ( memory ) {
list = [];
// Otherwise, this object is spent
} else {
list = "";
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// If we have memory from a past run, we should fire after adding
if ( memory && !firing ) {
firingIndex = list.length - 1;
queue.push( memory );
}
( function add( args ) {
jQuery.each( args, function( _, arg ) {
if ( jQuery.isFunction( arg ) ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
// Inspect recursively
add( arg );
}
} );
} )( arguments );
if ( memory && !firing ) {
fire();
}
}
return this;
},
// Remove a callback from the list
remove: function() {
jQuery.each( arguments, function( _, arg ) {
var index;
while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( index <= firingIndex ) {
firingIndex--;
}
}
} );
return this;
},
// Check if a given callback is in the list.
// If no argument is given, return whether or not list has callbacks attached.
has: function( fn ) {
return fn ?
jQuery.inArray( fn, list ) > -1 :
list.length > 0;
},
// Remove all callbacks from the list
empty: function() {
if ( list ) {
list = [];
}
return this;
},
// Disable .fire and .add
// Abort any current/pending executions
// Clear all callbacks and values
disable: function() {
locked = queue = [];
list = memory = "";
return this;
},
disabled: function() {
return !list;
},
// Disable .fire
// Also disable .add unless we have memory (since it would have no effect)
// Abort any pending executions
lock: function() {
locked = queue = [];
if ( !memory && !firing ) {
list = memory = "";
}
return this;
},
locked: function() {
return !!locked;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( !locked ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
queue.push( args );
if ( !firing ) {
fire();
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
function Identity( v ) {
return v;
}
function Thrower( ex ) {
throw ex;
}
function adoptValue( value, resolve, reject, noValue ) {
var method;
try {
// Check for promise aspect first to privilege synchronous behavior
if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
method.call( value ).done( resolve ).fail( reject );
// Other thenables
} else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
method.call( value, resolve, reject );
// Other non-thenables
} else {
// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
// * false: [ value ].slice( 0 ) => resolve( value )
// * true: [ value ].slice( 1 ) => resolve()
resolve.apply( undefined, [ value ].slice( noValue ) );
}
// For Promises/A+, convert exceptions into rejections
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
// Deferred#then to conditionally suppress rejection.
} catch ( value ) {
// Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context
reject.apply( undefined, [ value ] );
}
}
jQuery.extend( {
Deferred: function( func ) {
var tuples = [
// action, add listener, callbacks,
// ... .then handlers, argument index, [final state]
[ "notify", "progress", jQuery.Callbacks( "memory" ),
jQuery.Callbacks( "memory" ), 2 ],
[ "resolve", "done", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), 0, "resolved" ],
[ "reject", "fail", jQuery.Callbacks( "once memory" ),
jQuery.Callbacks( "once memory" ), 1, "rejected" ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
"catch": function( fn ) {
return promise.then( null, fn );
},
// Keep pipe for back-compat
pipe: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred( function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
// Map tuples (progress, done, fail) to arguments (done, fail, progress)
var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
// deferred.progress(function() { bind to newDefer or newDefer.notify })
// deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject })
deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.progress( newDefer.notify )
.done( newDefer.resolve )
.fail( newDefer.reject );
} else {
newDefer[ tuple[ 0 ] + "With" ](
this,
fn ? [ returned ] : arguments
);
}
} );
} );
fns = null;
} ).promise();
},
then: function( onFulfilled, onRejected, onProgress ) {
var maxDepth = 0;
function resolve( depth, deferred, handler, special ) {
return function() {
var that = this,
args = arguments,
mightThrow = function() {
var returned, then;
// Support: Promises/A+ section 2.3.3.3.3
// https://promisesaplus.com/#point-59
// Ignore double-resolution attempts
if ( depth < maxDepth ) {
return;
}
returned = handler.apply( that, args );
// Support: Promises/A+ section 2.3.1
// https://promisesaplus.com/#point-48
if ( returned === deferred.promise() ) {
throw new TypeError( "Thenable self-resolution" );
}
// Support: Promises/A+ sections 2.3.3.1, 3.5
// https://promisesaplus.com/#point-54
// https://promisesaplus.com/#point-75
// Retrieve `then` only once
then = returned &&
// Support: Promises/A+ section 2.3.4
// https://promisesaplus.com/#point-64
// Only check objects and functions for thenability
( typeof returned === "object" ||
typeof returned === "function" ) &&
returned.then;
// Handle a returned thenable
if ( jQuery.isFunction( then ) ) {
// Special processors (notify) just wait for resolution
if ( special ) {
then.call(
returned,
resolve( maxDepth, deferred, Identity, special ),
resolve( maxDepth, deferred, Thrower, special )
);
// Normal processors (resolve) also hook into progress
} else {
// ...and disregard older resolution values
maxDepth++;
then.call(
returned,
resolve( maxDepth, deferred, Identity, special ),
resolve( maxDepth, deferred, Thrower, special ),
resolve( maxDepth, deferred, Identity,
deferred.notifyWith )
);
}
// Handle all other returned values
} else {
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if ( handler !== Identity ) {
that = undefined;
args = [ returned ];
}
// Process the value(s)
// Default process is resolve
( special || deferred.resolveWith )( that, args );
}
},
// Only normal processors (resolve) catch and reject exceptions
process = special ?
mightThrow :
function() {
try {
mightThrow();
} catch ( e ) {
if ( jQuery.Deferred.exceptionHook ) {
jQuery.Deferred.exceptionHook( e,
process.stackTrace );
}
// Support: Promises/A+ section 2.3.3.3.4.1
// https://promisesaplus.com/#point-61
// Ignore post-resolution exceptions
if ( depth + 1 >= maxDepth ) {
// Only substitute handlers pass on context
// and multiple values (non-spec behavior)
if ( handler !== Thrower ) {
that = undefined;
args = [ e ];
}
deferred.rejectWith( that, args );
}
}
};
// Support: Promises/A+ section 2.3.3.3.1
// https://promisesaplus.com/#point-57
// Re-resolve promises immediately to dodge false rejection from
// subsequent errors
if ( depth ) {
process();
} else {
// Call an optional hook to record the stack, in case of exception
// since it's otherwise lost when execution goes async
if ( jQuery.Deferred.getStackHook ) {
process.stackTrace = jQuery.Deferred.getStackHook();
}
window.setTimeout( process );
}
};
}
return jQuery.Deferred( function( newDefer ) {
// progress_handlers.add( ... )
tuples[ 0 ][ 3 ].add(
resolve(
0,
newDefer,
jQuery.isFunction( onProgress ) ?
onProgress :
Identity,
newDefer.notifyWith
)
);
// fulfilled_handlers.add( ... )
tuples[ 1 ][ 3 ].add(
resolve(
0,
newDefer,
jQuery.isFunction( onFulfilled ) ?
onFulfilled :
Identity
)
);
// rejected_handlers.add( ... )
tuples[ 2 ][ 3 ].add(
resolve(
0,
newDefer,
jQuery.isFunction( onRejected ) ?
onRejected :
Thrower
)
);
} ).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 5 ];
// promise.progress = list.add
// promise.done = list.add
// promise.fail = list.add
promise[ tuple[ 1 ] ] = list.add;
// Handle state
if ( stateString ) {
list.add(
function() {
// state = "resolved" (i.e., fulfilled)
// state = "rejected"
state = stateString;
},
// rejected_callbacks.disable
// fulfilled_callbacks.disable
tuples[ 3 - i ][ 2 ].disable,
// progress_callbacks.lock
tuples[ 0 ][ 2 ].lock
);
}
// progress_handlers.fire
// fulfilled_handlers.fire
// rejected_handlers.fire
list.add( tuple[ 3 ].fire );
// deferred.notify = function() { deferred.notifyWith(...) }
// deferred.resolve = function() { deferred.resolveWith(...) }
// deferred.reject = function() { deferred.rejectWith(...) }
deferred[ tuple[ 0 ] ] = function() {
deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
return this;
};
// deferred.notifyWith = list.fireWith
// deferred.resolveWith = list.fireWith
// deferred.rejectWith = list.fireWith
deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
} );
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( singleValue ) {
var
// count of uncompleted subordinates
remaining = arguments.length,
// count of unprocessed arguments
i = remaining,
// subordinate fulfillment data
resolveContexts = Array( i ),
resolveValues = slice.call( arguments ),
// the master Deferred
master = jQuery.Deferred(),
// subordinate callback factory
updateFunc = function( i ) {
return function( value ) {
resolveContexts[ i ] = this;
resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
if ( !( --remaining ) ) {
master.resolveWith( resolveContexts, resolveValues );
}
};
};
// Single- and empty arguments are adopted like Promise.resolve
if ( remaining <= 1 ) {
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
!remaining );
// Use .then() to unwrap secondary thenables (cf. gh-3000)
if ( master.state() === "pending" ||
jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
return master.then();
}
}
// Multiple arguments are aggregated like Promise.all array elements
while ( i-- ) {
adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
}
return master.promise();
}
} );
// These usually indicate a programmer mistake during development,
// warn about them ASAP rather than swallowing them by default.
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
jQuery.Deferred.exceptionHook = function( error, stack ) {
// Support: IE 8 - 9 only
// Console exists when dev tools are open, which can happen at any time
if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
}
};
jQuery.readyException = function( error ) {
window.setTimeout( function() {
throw error;
} );
};
// The deferred used on DOM ready
var readyList = jQuery.Deferred();
jQuery.fn.ready = function( fn ) {
readyList
.then( fn )
// Wrap jQuery.readyException in a function so that the lookup
// happens at the time of error handling instead of callback
// registration.
.catch( function( error ) {
jQuery.readyException( error );
} );
return this;
};
jQuery.extend( {
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
}
} );
jQuery.ready.then = readyList.then;
// The ready event handler and self cleanup method
function completed() {
document.removeEventListener( "DOMContentLoaded", completed );
window.removeEventListener( "load", completed );
jQuery.ready();
}
// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 10 only
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
window.setTimeout( jQuery.ready );
} else {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", completed );
// A fallback to window.onload, that will always work
window.addEventListener( "load", completed );
}
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
var i = 0,
len = elems.length,
bulk = key == null;
// Sets many values
if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
access( elems, fn, i, key[ i ], true, emptyGet, raw );
}
// Sets one value
} else if ( value !== undefined ) {
chainable = true;
if ( !jQuery.isFunction( value ) ) {
raw = true;
}
if ( bulk ) {
// Bulk operations run against the entire set
if ( raw ) {
fn.call( elems, value );
fn = null;
// ...except when executing function values
} else {
bulk = fn;
fn = function( elem, key, value ) {
return bulk.call( jQuery( elem ), value );
};
}
}
if ( fn ) {
for ( ; i < len; i++ ) {
fn(
elems[ i ], key, raw ?
value :
value.call( elems[ i ], i, fn( elems[ i ], key ) )
);
}
}
}
if ( chainable ) {
return elems;
}
// Gets
if ( bulk ) {
return fn.call( elems );
}
return len ? fn( elems[ 0 ], key ) : emptyGet;
};
var acceptData = function( owner ) {
// Accepts only:
// - Node
// - Node.ELEMENT_NODE
// - Node.DOCUMENT_NODE
// - Object
// - Any
return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};
function Data() {
this.expando = jQuery.expando + Data.uid++;
}
Data.uid = 1;
Data.prototype = {
cache: function( owner ) {
// Check if the owner object already has a cache
var value = owner[ this.expando ];
// If not, create one
if ( !value ) {
value = {};
// We can accept data for non-element nodes in modern browsers,
// but we should not, see #8335.
// Always return an empty object.
if ( acceptData( owner ) ) {
// If it is a node unlikely to be stringify-ed or looped over
// use plain assignment
if ( owner.nodeType ) {
owner[ this.expando ] = value;
// Otherwise secure it in a non-enumerable property
// configurable must be true to allow the property to be
// deleted when data is removed
} else {
Object.defineProperty( owner, this.expando, {
value: value,
configurable: true
} );
}
}
}
return value;
},
set: function( owner, data, value ) {
var prop,
cache = this.cache( owner );
// Handle: [ owner, key, value ] args
// Always use camelCase key (gh-2257)
if ( typeof data === "string" ) {
cache[ jQuery.camelCase( data ) ] = value;
// Handle: [ owner, { properties } ] args
} else {
// Copy the properties one-by-one to the cache object
for ( prop in data ) {
cache[ jQuery.camelCase( prop ) ] = data[ prop ];
}
}
return cache;
},
get: function( owner, key ) {
return key === undefined ?
this.cache( owner ) :
// Always use camelCase key (gh-2257)
owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
},
access: function( owner, key, value ) {
// In cases where either:
//
// 1. No key was specified
// 2. A string key was specified, but no value provided
//
// Take the "read" path and allow the get method to determine
// which value to return, respectively either:
//
// 1. The entire cache object
// 2. The data stored at the key
//
if ( key === undefined ||
( ( key && typeof key === "string" ) && value === undefined ) ) {
return this.get( owner, key );
}
// When the key is not a string, or both a key and value
// are specified, set or extend (existing objects) with either:
//
// 1. An object of properties
// 2. A key and value
//
this.set( owner, key, value );
// Since the "set" path can have two possible entry points
// return the expected data based on which path was taken[*]
return value !== undefined ? value : key;
},
remove: function( owner, key ) {
var i,
cache = owner[ this.expando ];
if ( cache === undefined ) {
return;
}
if ( key !== undefined ) {
// Support array or space separated string of keys
if ( Array.isArray( key ) ) {
// If key is an array of keys...
// We always set camelCase keys, so remove that.
key = key.map( jQuery.camelCase );
} else {
key = jQuery.camelCase( key );
// If a key with the spaces exists, use it.
// Otherwise, create an array by matching non-whitespace
key = key in cache ?
[ key ] :
( key.match( rnothtmlwhite ) || [] );
}
i = key.length;
while ( i-- ) {
delete cache[ key[ i ] ];
}
}
// Remove the expando if there's no more data
if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
// Support: Chrome <=35 - 45
// Webkit & Blink performance suffers when deleting properties
// from DOM nodes, so set to undefined instead
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
if ( owner.nodeType ) {
owner[ this.expando ] = undefined;
} else {
delete owner[ this.expando ];
}
}
},
hasData: function( owner ) {
var cache = owner[ this.expando ];
return cache !== undefined && !jQuery.isEmptyObject( cache );
}
};
var dataPriv = new Data();
var dataUser = new Data();
// Implementation Summary
//
// 1. Enforce API surface and semantic compatibility with 1.9.x branch
// 2. Improve the module's maintainability by reducing the storage
// paths to a single mechanism.
// 3. Use the same single mechanism to support "private" and "user" data.
// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
// 5. Avoid exposing implementation details on user objects (eg. expando properties)
// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
rmultiDash = /[A-Z]/g;
function getData( data ) {
if ( data === "true" ) {
return true;
}
if ( data === "false" ) {
return false;
}
if ( data === "null" ) {
return null;
}
// Only convert to a number if it doesn't change the string
if ( data === +data + "" ) {
return +data;
}
if ( rbrace.test( data ) ) {
return JSON.parse( data );
}
return data;
}
function dataAttr( elem, key, data ) {
var name;
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = getData( data );
} catch ( e ) {}
// Make sure we set the data so it isn't changed later
dataUser.set( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
jQuery.extend( {
hasData: function( elem ) {
return dataUser.hasData( elem ) || dataPriv.hasData( elem );
},
data: function( elem, name, data ) {
return dataUser.access( elem, name, data );
},
removeData: function( elem, name ) {
dataUser.remove( elem, name );
},
// TODO: Now that all calls to _data and _removeData have been replaced
// with direct calls to dataPriv methods, these can be deprecated.
_data: function( elem, name, data ) {
return dataPriv.access( elem, name, data );
},
_removeData: function( elem, name ) {
dataPriv.remove( elem, name );
}
} );
jQuery.fn.extend( {
data: function( key, value ) {
var i, name, data,
elem = this[ 0 ],
attrs = elem && elem.attributes;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = dataUser.get( elem );
if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
i = attrs.length;
while ( i-- ) {
// Support: IE 11 only
// The attrs elements can be null (#14894)
if ( attrs[ i ] ) {
name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.slice( 5 ) );
dataAttr( elem, name, data[ name ] );
}
}
}
dataPriv.set( elem, "hasDataAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each( function() {
dataUser.set( this, key );
} );
}
return access( this, function( value ) {
var data;
// The calling jQuery object (element matches) is not empty
// (and therefore has an element appears at this[ 0 ]) and the
// `value` parameter was not undefined. An empty jQuery object
// will result in `undefined` for elem = this[ 0 ] which will
// throw an exception if an attempt to read a data cache is made.
if ( elem && value === undefined ) {
// Attempt to get data from the cache
// The key will always be camelCased in Data
data = dataUser.get( elem, key );
if ( data !== undefined ) {
return data;
}
// Attempt to "discover" the data in
// HTML5 custom data-* attrs
data = dataAttr( elem, key );
if ( data !== undefined ) {
return data;
}
// We tried really hard, but the data doesn't exist.
return;
}
// Set the data...
this.each( function() {
// We always store the camelCased key
dataUser.set( this, key, value );
} );
}, null, value, arguments.length > 1, null, true );
},
removeData: function( key ) {
return this.each( function() {
dataUser.remove( this, key );
} );
}
} );
jQuery.extend( {
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = dataPriv.get( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || Array.isArray( data ) ) {
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// Clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// Not public - generate a queueHooks object, or return the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
empty: jQuery.Callbacks( "once memory" ).add( function() {
dataPriv.remove( elem, [ type + "queue", key ] );
} )
} );
}
} );
jQuery.fn.extend( {
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[ 0 ], type );
}
return data === undefined ?
this :
this.each( function() {
var queue = jQuery.queue( this, type, data );
// Ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
} );
},
dequeue: function( type ) {
return this.each( function() {
jQuery.dequeue( this, type );
} );
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while ( i-- ) {
tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
} );
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
var isHiddenWithinTree = function( elem, el ) {
// isHiddenWithinTree might be called from jQuery#filter function;
// in that case, element will be second argument
elem = el || elem;
// Inline style trumps all
return elem.style.display === "none" ||
elem.style.display === "" &&
// Otherwise, check computed style
// Support: Firefox <=43 - 45
// Disconnected elements can have computed display: none, so first confirm that elem is
// in the document.
jQuery.contains( elem.ownerDocument, elem ) &&
jQuery.css( elem, "display" ) === "none";
};
var swap = function( elem, options, callback, args ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.apply( elem, args || [] );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
};
function adjustCSS( elem, prop, valueParts, tween ) {
var adjusted,
scale = 1,
maxIterations = 20,
currentValue = tween ?
function() {
return tween.cur();
} :
function() {
return jQuery.css( elem, prop, "" );
},
initial = currentValue(),
unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
// Starting value computation is required for potential unit mismatches
initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
rcssNum.exec( jQuery.css( elem, prop ) );
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
// Trust units reported by jQuery.css
unit = unit || initialInUnit[ 3 ];
// Make sure we update the tween properties later on
valueParts = valueParts || [];
// Iteratively approximate from a nonzero starting point
initialInUnit = +initial || 1;
do {
// If previous iteration zeroed out, double until we get *something*.
// Use string for doubling so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
initialInUnit = initialInUnit / scale;
jQuery.style( elem, prop, initialInUnit + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// Break the loop if scale is unchanged or perfect, or if we've just had enough.
} while (
scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
);
}
if ( valueParts ) {
initialInUnit = +initialInUnit || +initial || 0;
// Apply relative offset (+=/-=) if specified
adjusted = valueParts[ 1 ] ?
initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
+valueParts[ 2 ];
if ( tween ) {
tween.unit = unit;
tween.start = initialInUnit;
tween.end = adjusted;
}
}
return adjusted;
}
var defaultDisplayMap = {};
function getDefaultDisplay( elem ) {
var temp,
doc = elem.ownerDocument,
nodeName = elem.nodeName,
display = defaultDisplayMap[ nodeName ];
if ( display ) {
return display;
}
temp = doc.body.appendChild( doc.createElement( nodeName ) );
display = jQuery.css( temp, "display" );
temp.parentNode.removeChild( temp );
if ( display === "none" ) {
display = "block";
}
defaultDisplayMap[ nodeName ] = display;
return display;
}
function showHide( elements, show ) {
var display, elem,
values = [],
index = 0,
length = elements.length;
// Determine new display value for elements that need to change
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
display = elem.style.display;
if ( show ) {
// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
// check is required in this first loop unless we have a nonempty display value (either
// inline or about-to-be-restored)
if ( display === "none" ) {
values[ index ] = dataPriv.get( elem, "display" ) || null;
if ( !values[ index ] ) {
elem.style.display = "";
}
}
if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
values[ index ] = getDefaultDisplay( elem );
}
} else {
if ( display !== "none" ) {
values[ index ] = "none";
// Remember what we're overwriting
dataPriv.set( elem, "display", display );
}
}
}
// Set the display of the elements in a second loop to avoid constant reflow
for ( index = 0; index < length; index++ ) {
if ( values[ index ] != null ) {
elements[ index ].style.display = values[ index ];
}
}
return elements;
}
jQuery.fn.extend( {
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state ) {
if ( typeof state === "boolean" ) {
return state ? this.show() : this.hide();
}
return this.each( function() {
if ( isHiddenWithinTree( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
} );
}
} );
var rcheckableType = ( /^(?:checkbox|radio)$/i );
var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
var rscriptType = ( /^$|\/(?:java|ecma)script/i );
// We have to close these tags to support XHTML (#13200)
var wrapMap = {
// Support: IE <=9 only
option: [ 1, "<select multiple='multiple'>", "</select>" ],
// XHTML parsers do not magically insert elements in the
// same way that tag soup parsers do. So we cannot shorten
// this by omitting <tbody> or other required elements.
thead: [ 1, "<table>", "</table>" ],
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
_default: [ 0, "", "" ]
};
// Support: IE <=9 only
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
function getAll( context, tag ) {
// Support: IE <=9 - 11 only
// Use typeof to avoid zero-argument method invocation on host objects (#15151)
var ret;
if ( typeof context.getElementsByTagName !== "undefined" ) {
ret = context.getElementsByTagName( tag || "*" );
} else if ( typeof context.querySelectorAll !== "undefined" ) {
ret = context.querySelectorAll( tag || "*" );
} else {
ret = [];
}
if ( tag === undefined || tag && nodeName( context, tag ) ) {
return jQuery.merge( [ context ], ret );
}
return ret;
}
// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
var i = 0,
l = elems.length;
for ( ; i < l; i++ ) {
dataPriv.set(
elems[ i ],
"globalEval",
!refElements || dataPriv.get( refElements[ i ], "globalEval" )
);
}
}
var rhtml = /<|&#?\w+;/;
function buildFragment( elems, context, scripts, selection, ignored ) {
var elem, tmp, tag, wrap, contains, j,
fragment = context.createDocumentFragment(),
nodes = [],
i = 0,
l = elems.length;
for ( ; i < l; i++ ) {
elem = elems[ i ];
if ( elem || elem === 0 ) {
// Add nodes directly
if ( jQuery.type( elem ) === "object" ) {
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
// Convert non-html into a text node
} else if ( !rhtml.test( elem ) ) {
nodes.push( context.createTextNode( elem ) );
// Convert html into DOM nodes
} else {
tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
// Deserialize a standard representation
tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
// Descend through wrappers to the right content
j = wrap[ 0 ];
while ( j-- ) {
tmp = tmp.lastChild;
}
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( nodes, tmp.childNodes );
// Remember the top-level container
tmp = fragment.firstChild;
// Ensure the created nodes are orphaned (#12392)
tmp.textContent = "";
}
}
}
// Remove wrapper from fragment
fragment.textContent = "";
i = 0;
while ( ( elem = nodes[ i++ ] ) ) {
// Skip elements already in the context collection (trac-4087)
if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
if ( ignored ) {
ignored.push( elem );
}
continue;
}
contains = jQuery.contains( elem.ownerDocument, elem );
// Append to fragment
tmp = getAll( fragment.appendChild( elem ), "script" );
// Preserve script evaluation history
if ( contains ) {
setGlobalEval( tmp );
}
// Capture executables
if ( scripts ) {
j = 0;
while ( ( elem = tmp[ j++ ] ) ) {
if ( rscriptType.test( elem.type || "" ) ) {
scripts.push( elem );
}
}
}
}
return fragment;
}
( function() {
var fragment = document.createDocumentFragment(),
div = fragment.appendChild( document.createElement( "div" ) ),
input = document.createElement( "input" );
// Support: Android 4.0 - 4.3 only
// Check state lost if the name is set (#11217)
// Support: Windows Web Apps (WWA)
// `name` and `type` must use .setAttribute for WWA (#14901)
input.setAttribute( "type", "radio" );
input.setAttribute( "checked", "checked" );
input.setAttribute( "name", "t" );
div.appendChild( input );
// Support: Android <=4.1 only
// Older WebKit doesn't clone checked state correctly in fragments
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Support: IE <=11 only
// Make sure textarea (and checkbox) defaultValue is properly cloned
div.innerHTML = "<textarea>x</textarea>";
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
} )();
var documentElement = document.documentElement;
var
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
function returnTrue() {
return true;
}
function returnFalse() {
return false;
}
// Support: IE <=9 only
// See #13393 for more info
function safeActiveElement() {
try {
return document.activeElement;
} catch ( err ) { }
}
function on( elem, types, selector, data, fn, one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
on( elem, type, selector, data, types[ type ], one );
}
return elem;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return elem;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return elem.each( function() {
jQuery.event.add( this, types, fn, data, selector );
} );
}
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
global: {},
add: function( elem, types, handler, data, selector ) {
var handleObjIn, eventHandle, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
elemData = dataPriv.get( elem );
// Don't attach events to noData or text/comment nodes (but allow plain objects)
if ( !elemData ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Ensure that invalid selectors throw exceptions at attach time
// Evaluate against documentElement in case elem is a non-element node (e.g., document)
if ( selector ) {
jQuery.find.matchesSelector( documentElement, selector );
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
if ( !( events = elemData.events ) ) {
events = elemData.events = {};
}
if ( !( eventHandle = elemData.handle ) ) {
eventHandle = elemData.handle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
jQuery.event.dispatch.apply( elem, arguments ) : undefined;
};
}
// Handle multiple events separated by a space
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// There *must* be a type, no attaching namespace-only handlers
if ( !type ) {
continue;
}
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend( {
type: type,
origType: origType,
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join( "." )
}, handleObjIn );
// Init the event handler queue if we're the first
if ( !( handlers = events[ type ] ) ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener if the special events handler returns false
if ( !special.setup ||
special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var j, origCount, tmp,
events, t, handleObj,
special, handlers, type, namespaces, origType,
elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
if ( !elemData || !( events = elemData.events ) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[ t ] ) || [];
type = origType = tmp[ 1 ];
namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector ? special.delegateType : special.bindType ) || type;
handlers = events[ type ] || [];
tmp = tmp[ 2 ] &&
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
// Remove matching events
origCount = j = handlers.length;
while ( j-- ) {
handleObj = handlers[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector ||
selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
if ( handleObj.selector ) {
handlers.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) {
if ( !special.teardown ||
special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove data and the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
dataPriv.remove( elem, "handle events" );
}
},
dispatch: function( nativeEvent ) {
// Make a writable jQuery.Event from the native event object
var event = jQuery.event.fix( nativeEvent );
var i, j, ret, matched, handleObj, handlerQueue,
args = new Array( arguments.length ),
handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
special = jQuery.event.special[ event.type ] || {};
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[ 0 ] = event;
for ( i = 1; i < arguments.length; i++ ) {
args[ i ] = arguments[ i ];
}
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers
handlerQueue = jQuery.event.handlers.call( this, event, handlers );
// Run delegates first; they may want to stop propagation beneath us
i = 0;
while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
event.currentTarget = matched.elem;
j = 0;
while ( ( handleObj = matched.handlers[ j++ ] ) &&
!event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or 2) have namespace(s)
// a subset or equal to those in the bound event (both can have no namespace).
if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
event.handleObj = handleObj;
event.data = handleObj.data;
ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
handleObj.handler ).apply( matched.elem, args );
if ( ret !== undefined ) {
if ( ( event.result = ret ) === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
handlers: function( event, handlers ) {
var i, handleObj, sel, matchedHandlers, matchedSelectors,
handlerQueue = [],
delegateCount = handlers.delegateCount,
cur = event.target;
// Find delegate handlers
if ( delegateCount &&
// Support: IE <=9
// Black-hole SVG <use> instance trees (trac-13180)
cur.nodeType &&
// Support: Firefox <=42
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
// Support: IE 11 only
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
!( event.type === "click" && event.button >= 1 ) ) {
for ( ; cur !== this; cur = cur.parentNode || this ) {
// Don't check non-elements (#13208)
// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
matchedHandlers = [];
matchedSelectors = {};
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
// Don't conflict with Object.prototype properties (#13203)
sel = handleObj.selector + " ";
if ( matchedSelectors[ sel ] === undefined ) {
matchedSelectors[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) > -1 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( matchedSelectors[ sel ] ) {
matchedHandlers.push( handleObj );
}
}
if ( matchedHandlers.length ) {
handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
}
}
}
}
// Add the remaining (directly-bound) handlers
cur = this;
if ( delegateCount < handlers.length ) {
handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
}
return handlerQueue;
},
addProp: function( name, hook ) {
Object.defineProperty( jQuery.Event.prototype, name, {
enumerable: true,
configurable: true,
get: jQuery.isFunction( hook ) ?
function() {
if ( this.originalEvent ) {
return hook( this.originalEvent );
}
} :
function() {
if ( this.originalEvent ) {
return this.originalEvent[ name ];
}
},
set: function( value ) {
Object.defineProperty( this, name, {
enumerable: true,
configurable: true,
writable: true,
value: value
} );
}
} );
},
fix: function( originalEvent ) {
return originalEvent[ jQuery.expando ] ?
originalEvent :
new jQuery.Event( originalEvent );
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
// Fire native event if possible so blur/focus sequence is correct
trigger: function() {
if ( this !== safeActiveElement() && this.focus ) {
this.focus();
return false;
}
},
delegateType: "focusin"
},
blur: {
trigger: function() {
if ( this === safeActiveElement() && this.blur ) {
this.blur();
return false;
}
},
delegateType: "focusout"
},
click: {
// For checkbox, fire native event so checked state will be right
trigger: function() {
if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
this.click();
return false;
}
},
// For cross-browser consistency, don't fire native .click() on links
_default: function( event ) {
return nodeName( event.target, "a" );
}
},
beforeunload: {
postDispatch: function( event ) {
// Support: Firefox 20+
// Firefox doesn't alert if the returnValue field is not set.
if ( event.result !== undefined && event.originalEvent ) {
event.originalEvent.returnValue = event.result;
}
}
}
}
};
jQuery.removeEvent = function( elem, type, handle ) {
// This "if" is needed for plain objects
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !( this instanceof jQuery.Event ) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = src.defaultPrevented ||
src.defaultPrevented === undefined &&
// Support: Android <=2.3 only
src.returnValue === false ?
returnTrue :
returnFalse;
// Create target properties
// Support: Safari <=6 - 7 only
// Target should not be a text node (#504, #13143)
this.target = ( src.target && src.target.nodeType === 3 ) ?
src.target.parentNode :
src.target;
this.currentTarget = src.currentTarget;
this.relatedTarget = src.relatedTarget;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
constructor: jQuery.Event,
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
isSimulated: false,
preventDefault: function() {
var e = this.originalEvent;
this.isDefaultPrevented = returnTrue;
if ( e && !this.isSimulated ) {
e.preventDefault();
}
},
stopPropagation: function() {
var e = this.originalEvent;
this.isPropagationStopped = returnTrue;
if ( e && !this.isSimulated ) {
e.stopPropagation();
}
},
stopImmediatePropagation: function() {
var e = this.originalEvent;
this.isImmediatePropagationStopped = returnTrue;
if ( e && !this.isSimulated ) {
e.stopImmediatePropagation();
}
this.stopPropagation();
}
};
// Includes all common event props including KeyEvent and MouseEvent specific props
jQuery.each( {
altKey: true,
bubbles: true,
cancelable: true,
changedTouches: true,
ctrlKey: true,
detail: true,
eventPhase: true,
metaKey: true,
pageX: true,
pageY: true,
shiftKey: true,
view: true,
"char": true,
charCode: true,
key: true,
keyCode: true,
button: true,
buttons: true,
clientX: true,
clientY: true,
offsetX: true,
offsetY: true,
pointerId: true,
pointerType: true,
screenX: true,
screenY: true,
targetTouches: true,
toElement: true,
touches: true,
which: function( event ) {
var button = event.button;
// Add which for key events
if ( event.which == null && rkeyEvent.test( event.type ) ) {
return event.charCode != null ? event.charCode : event.keyCode;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
if ( button & 1 ) {
return 1;
}
if ( button & 2 ) {
return 3;
}
if ( button & 4 ) {
return 2;
}
return 0;
}
return event.which;
}
}, jQuery.event.addProp );
// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
mouseenter: "mouseover",
mouseleave: "mouseout",
pointerenter: "pointerover",
pointerleave: "pointerout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj;
// For mouseenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
} );
jQuery.fn.extend( {
on: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn );
},
one: function( types, selector, data, fn ) {
return on( this, types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ?
handleObj.origType + "." + handleObj.namespace :
handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each( function() {
jQuery.event.remove( this, types, fn, selector );
} );
}
} );
var
/* eslint-disable max-len */
// See https://github.com/eslint/eslint/issues/3229
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
/* eslint-enable */
// Support: IE <=10 - 11, Edge 12 - 13
// In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) {
if ( nodeName( elem, "table" ) &&
nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
return jQuery( ">tbody", elem )[ 0 ] || elem;
}
return elem;
}
// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
return elem;
}
function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type );
if ( match ) {
elem.type = match[ 1 ];
} else {
elem.removeAttribute( "type" );
}
return elem;
}
function cloneCopyEvent( src, dest ) {
var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
if ( dest.nodeType !== 1 ) {
return;
}
// 1. Copy private data: events, handlers, etc.
if ( dataPriv.hasData( src ) ) {
pdataOld = dataPriv.access( src );
pdataCur = dataPriv.set( dest, pdataOld );
events = pdataOld.events;
if ( events ) {
delete pdataCur.handle;
pdataCur.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
}
// 2. Copy user data
if ( dataUser.hasData( src ) ) {
udataOld = dataUser.access( src );
udataCur = jQuery.extend( {}, udataOld );
dataUser.set( dest, udataCur );
}
}
// Fix IE bugs, see support tests
function fixInput( src, dest ) {
var nodeName = dest.nodeName.toLowerCase();
// Fails to persist the checked state of a cloned checkbox or radio button.
if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
dest.checked = src.checked;
// Fails to return the selected option to the default selected state when cloning options
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
}
function domManip( collection, args, callback, ignored ) {
// Flatten any nested arrays
args = concat.apply( [], args );
var fragment, first, scripts, hasScripts, node, doc,
i = 0,
l = collection.length,
iNoClone = l - 1,
value = args[ 0 ],
isFunction = jQuery.isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction ||
( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( value ) ) ) {
return collection.each( function( index ) {
var self = collection.eq( index );
if ( isFunction ) {
args[ 0 ] = value.call( this, index, self.html() );
}
domManip( self, args, callback, ignored );
} );
}
if ( l ) {
fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
// Require either new content or an interest in ignored elements to invoke the callback
if ( first || ignored ) {
scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length;
// Use the original fragment for the last item
// instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) {
node = fragment;
if ( i !== iNoClone ) {
node = jQuery.clone( node, true, true );
// Keep references to cloned scripts for later restoration
if ( hasScripts ) {
// Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit
jQuery.merge( scripts, getAll( node, "script" ) );
}
}
callback.call( collection[ i ], node, i );
}
if ( hasScripts ) {
doc = scripts[ scripts.length - 1 ].ownerDocument;
// Reenable scripts
jQuery.map( scripts, restoreScript );
// Evaluate executable scripts on first document insertion
for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) &&
!dataPriv.access( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) {
if ( node.src ) {
// Optional AJAX dependency, but won't run scripts if not present
if ( jQuery._evalUrl ) {
jQuery._evalUrl( node.src );
}
} else {
DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
}
}
}
}
}
}
return collection;
}
function remove( elem, selector, keepData ) {
var node,
nodes = selector ? jQuery.filter( selector, elem ) : elem,
i = 0;
for ( ; ( node = nodes[ i ] ) != null; i++ ) {
if ( !keepData && node.nodeType === 1 ) {
jQuery.cleanData( getAll( node ) );
}
if ( node.parentNode ) {
if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
setGlobalEval( getAll( node, "script" ) );
}
node.parentNode.removeChild( node );
}
}
return elem;
}
jQuery.extend( {
htmlPrefilter: function( html ) {
return html.replace( rxhtmlTag, "<$1></$2>" );
},
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var i, l, srcElements, destElements,
clone = elem.cloneNode( true ),
inPage = jQuery.contains( elem.ownerDocument, elem );
// Fix IE cloning issues
if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
!jQuery.isXMLDoc( elem ) ) {
// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
destElements = getAll( clone );
srcElements = getAll( elem );
for ( i = 0, l = srcElements.length; i < l; i++ ) {
fixInput( srcElements[ i ], destElements[ i ] );
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
if ( deepDataAndEvents ) {
srcElements = srcElements || getAll( elem );
destElements = destElements || getAll( clone );
for ( i = 0, l = srcElements.length; i < l; i++ ) {
cloneCopyEvent( srcElements[ i ], destElements[ i ] );
}
} else {
cloneCopyEvent( elem, clone );
}
}
// Preserve script evaluation history
destElements = getAll( clone, "script" );
if ( destElements.length > 0 ) {
setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
}
// Return the cloned set
return clone;
},
cleanData: function( elems ) {
var data, elem, type,
special = jQuery.event.special,
i = 0;
for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
if ( acceptData( elem ) ) {
if ( ( data = elem[ dataPriv.expando ] ) ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Support: Chrome <=35 - 45+
// Assign undefined instead of using delete, see Data#remove
elem[ dataPriv.expando ] = undefined;
}
if ( elem[ dataUser.expando ] ) {
// Support: Chrome <=35 - 45+
// Assign undefined instead of using delete, see Data#remove
elem[ dataUser.expando ] = undefined;
}
}
}
}
} );
jQuery.fn.extend( {
detach: function( selector ) {
return remove( this, selector, true );
},
remove: function( selector ) {
return remove( this, selector );
},
text: function( value ) {
return access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().each( function() {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
this.textContent = value;
}
} );
}, null, value, arguments.length );
},
append: function() {
return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.appendChild( elem );
}
} );
},
prepend: function() {
return domManip( this, arguments, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
var target = manipulationTarget( this, elem );
target.insertBefore( elem, target.firstChild );
}
} );
},
before: function() {
return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this );
}
} );
},
after: function() {
return domManip( this, arguments, function( elem ) {
if ( this.parentNode ) {
this.parentNode.insertBefore( elem, this.nextSibling );
}
} );
},
empty: function() {
var elem,
i = 0;
for ( ; ( elem = this[ i ] ) != null; i++ ) {
if ( elem.nodeType === 1 ) {
// Prevent memory leaks
jQuery.cleanData( getAll( elem, false ) );
// Remove any remaining nodes
elem.textContent = "";
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function() {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
} );
},
html: function( value ) {
return access( this, function( value ) {
var elem = this[ 0 ] || {},
i = 0,
l = this.length;
if ( value === undefined && elem.nodeType === 1 ) {
return elem.innerHTML;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
value = jQuery.htmlPrefilter( value );
try {
for ( ; i < l; i++ ) {
elem = this[ i ] || {};
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( getAll( elem, false ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch ( e ) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function() {
var ignored = [];
// Make the changes, replacing each non-ignored context element with the new content
return domManip( this, arguments, function( elem ) {
var parent = this.parentNode;
if ( jQuery.inArray( this, ignored ) < 0 ) {
jQuery.cleanData( getAll( this ) );
if ( parent ) {
parent.replaceChild( elem, this );
}
}
// Force callback invocation
}, ignored );
}
} );
jQuery.each( {
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
ret = [],
insert = jQuery( selector ),
last = insert.length - 1,
i = 0;
for ( ; i <= last; i++ ) {
elems = i === last ? this : this.clone( true );
jQuery( insert[ i ] )[ original ]( elems );
// Support: Android <=4.0 only, PhantomJS 1 only
// .get() because push.apply(_, arraylike) throws on ancient WebKit
push.apply( ret, elems.get() );
}
return this.pushStack( ret );
};
} );
var rmargin = ( /^margin/ );
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
var getStyles = function( elem ) {
// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
// IE throws on elements created in popups
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
var view = elem.ownerDocument.defaultView;
if ( !view || !view.opener ) {
view = window;
}
return view.getComputedStyle( elem );
};
( function() {
// Executing both pixelPosition & boxSizingReliable tests require only one layout
// so they're executed at the same time to save the second computation.
function computeStyleTests() {
// This is a singleton, we need to execute it only once
if ( !div ) {
return;
}
div.style.cssText =
"box-sizing:border-box;" +
"position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%";
div.innerHTML = "";
documentElement.appendChild( container );
var divStyle = window.getComputedStyle( div );
pixelPositionVal = divStyle.top !== "1%";
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
reliableMarginLeftVal = divStyle.marginLeft === "2px";
boxSizingReliableVal = divStyle.width === "4px";
// Support: Android 4.0 - 4.3 only
// Some styles come back with percentage values, even though they shouldn't
div.style.marginRight = "50%";
pixelMarginRightVal = divStyle.marginRight === "4px";
documentElement.removeChild( container );
// Nullify the div so it wouldn't be stored in the memory and
// it will also be a sign that checks already performed
div = null;
}
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
container = document.createElement( "div" ),
div = document.createElement( "div" );
// Finish early in limited (non-browser) environments
if ( !div.style ) {
return;
}
// Support: IE <=9 - 11 only
// Style of cloned element affects source element cloned (#8908)
div.style.backgroundClip = "content-box";
div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box";
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
"padding:0;margin-top:1px;position:absolute";
container.appendChild( div );
jQuery.extend( support, {
pixelPosition: function() {
computeStyleTests();
return pixelPositionVal;
},
boxSizingReliable: function() {
computeStyleTests();
return boxSizingReliableVal;
},
pixelMarginRight: function() {
computeStyleTests();
return pixelMarginRightVal;
},
reliableMarginLeft: function() {
computeStyleTests();
return reliableMarginLeftVal;
}
} );
} )();
function curCSS( elem, name, computed ) {
var width, minWidth, maxWidth, ret,
// Support: Firefox 51+
// Retrieving style before computed somehow
// fixes an issue with getting wrong values
// on detached elements
style = elem.style;
computed = computed || getStyles( elem );
// getPropertyValue is needed for:
// .css('filter') (IE 9 only, #12537)
// .css('--customProperty) (#3144)
if ( computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Android Browser returns percentage for some values,
// but width seems to be reliably pixels.
// This is against the CSSOM draft spec:
// https://drafts.csswg.org/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
// Put in the new values to get a computed value out
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
// Revert the changed values
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret !== undefined ?
// Support: IE <=9 - 11 only
// IE returns zIndex value as an integer.
ret + "" :
ret;
}
function addGetHookIf( conditionFn, hookFn ) {
// Define the hook, we'll check on the first run if it's really needed.
return {
get: function() {
if ( conditionFn() ) {
// Hook not needed (or it's not possible to use it due
// to missing dependency), remove it.
delete this.get;
return;
}
// Hook needed; redefine it so that the support test is not executed again.
return ( this.get = hookFn ).apply( this, arguments );
}
};
}
var
// Swappable if display is none or starts with table
// except "table", "table-cell", or "table-caption"
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rcustomProp = /^--/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: "0",
fontWeight: "400"
},
cssPrefixes = [ "Webkit", "Moz", "ms" ],
emptyStyle = document.createElement( "div" ).style;
// Return a css property mapped to a potentially vendor prefixed property
function vendorPropName( name ) {
// Shortcut for names that are not vendor prefixed
if ( name in emptyStyle ) {
return name;
}
// Check for vendor prefixed names
var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in emptyStyle ) {
return name;
}
}
}
// Return a property mapped along what jQuery.cssProps suggests or to
// a vendor prefixed property.
function finalPropName( name ) {
var ret = jQuery.cssProps[ name ];
if ( !ret ) {
ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
}
return ret;
}
function setPositiveNumber( elem, value, subtract ) {
// Any relative (+/-) values have already been
// normalized at this point
var matches = rcssNum.exec( value );
return matches ?
// Guard against undefined "subtract", e.g., when used as in cssHooks
Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
var i,
val = 0;
// If we already have the right measurement, avoid augmentation
if ( extra === ( isBorderBox ? "border" : "content" ) ) {
i = 4;
// Otherwise initialize for horizontal or vertical properties
} else {
i = name === "width" ? 1 : 0;
}
for ( ; i < 4; i += 2 ) {
// Both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
}
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// At this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
} else {
// At this point, extra isn't content, so add padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
// At this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with computed style
var valueIsBorderBox,
styles = getStyles( elem ),
val = curCSS( elem, name, styles ),
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test( val ) ) {
return val;
}
// Check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] );
// Fall back to offsetWidth/Height when value is "auto"
// This happens for inline elements with no explicit setting (gh-3571)
if ( val === "auto" ) {
val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox,
styles
)
) + "px";
}
jQuery.extend( {
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Don't automatically add "px" to these possibly-unitless properties
cssNumber: {
"animationIterationCount": true,
"columnCount": true,
"fillOpacity": true,
"flexGrow": true,
"flexShrink": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"order": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
"float": "cssFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
isCustomProp = rcustomProp.test( name ),
style = elem.style;
// Make sure that we're working with the right name. We don't
// want to query the value if it is a CSS custom property
// since they are user-defined.
if ( !isCustomProp ) {
name = finalPropName( origName );
}
// Gets hook for the prefixed version, then unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// Convert "+=" or "-=" to relative numbers (#7345)
if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
value = adjustCSS( elem, name, ret );
// Fixes bug #9237
type = "number";
}
// Make sure that null and NaN values aren't set (#7116)
if ( value == null || value !== value ) {
return;
}
// If a number was passed in, add the unit (except for certain CSS properties)
if ( type === "number" ) {
value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
}
// background-* props affect original clone's values
if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
style[ name ] = "inherit";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !( "set" in hooks ) ||
( value = hooks.set( elem, value, extra ) ) !== undefined ) {
if ( isCustomProp ) {
style.setProperty( name, value );
} else {
style[ name ] = value;
}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks &&
( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra, styles ) {
var val, num, hooks,
origName = jQuery.camelCase( name ),
isCustomProp = rcustomProp.test( name );
// Make sure that we're working with the right name. We don't
// want to modify the value if it is a CSS custom property
// since they are user-defined.
if ( !isCustomProp ) {
name = finalPropName( origName );
}
// Try prefixed name followed by the unprefixed name
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name, styles );
}
// Convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Make numeric if forced or a qualifier was provided and val looks numeric
if ( extra === "" || extra ) {
num = parseFloat( val );
return extra === true || isFinite( num ) ? num || 0 : val;
}
return val;
}
} );
jQuery.each( [ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// Certain elements can have dimension info if we invisibly show them
// but it must have a current display style that would benefit
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
// Support: Safari 8+
// Table columns in Safari have non-zero offsetWidth & zero
// getBoundingClientRect().width unless display is changed.
// Support: IE <=11 only
// Running getBoundingClientRect on a disconnected node
// in IE throws an error.
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
} ) :
getWidthOrHeight( elem, name, extra );
}
},
set: function( elem, value, extra ) {
var matches,
styles = extra && getStyles( elem ),
subtract = extra && augmentWidthOrHeight(
elem,
name,
extra,
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles
);
// Convert to pixels if value adjustment is needed
if ( subtract && ( matches = rcssNum.exec( value ) ) &&
( matches[ 3 ] || "px" ) !== "px" ) {
elem.style[ name ] = value;
value = jQuery.css( elem, name );
}
return setPositiveNumber( elem, value, subtract );
}
};
} );
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
function( elem, computed ) {
if ( computed ) {
return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
elem.getBoundingClientRect().left -
swap( elem, { marginLeft: 0 }, function() {
return elem.getBoundingClientRect().left;
} )
) + "px";
}
}
);
// These hooks are used by animate to expand properties
jQuery.each( {
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i = 0,
expanded = {},
// Assumes a single number if not a string
parts = typeof value === "string" ? value.split( " " ) : [ value ];
for ( ; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
} );
jQuery.fn.extend( {
css: function( name, value ) {
return access( this, function( elem, name, value ) {
var styles, len,
map = {},
i = 0;
if ( Array.isArray( name ) ) {
styles = getStyles( elem );
len = name.length;
for ( ; i < len; i++ ) {
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
}
return map;
}
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
}
} );
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || jQuery.easing._default;
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
// Use a property on the element directly when it is not a DOM element,
// or when there is no matching style property that exists.
if ( tween.elem.nodeType !== 1 ||
tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
return tween.elem[ tween.prop ];
}
// Passing an empty string as a 3rd parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails.
// Simple values such as "10px" are parsed to Float;
// complex values such as "rotate(1rad)" are returned as-is.
result = jQuery.css( tween.elem, tween.prop, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// Use step hook for back compat.
// Use cssHook if its there.
// Use .style if available and use plain properties where available.
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.nodeType === 1 &&
( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Support: IE <=9 only
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p * Math.PI ) / 2;
},
_default: "swing"
};
jQuery.fx = Tween.prototype.init;
// Back compat <1.8 extension point
jQuery.fx.step = {};
var
fxNow, inProgress,
rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/;
function schedule() {
if ( inProgress ) {
if ( document.hidden === false && window.requestAnimationFrame ) {
window.requestAnimationFrame( schedule );
} else {
window.setTimeout( schedule, jQuery.fx.interval );
}
jQuery.fx.tick();
}
}
// Animations created synchronously will run synchronously
function createFxNow() {
window.setTimeout( function() {
fxNow = undefined;
} );
return ( fxNow = jQuery.now() );
}
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
i = 0,
attrs = { height: type };
// If we include width, step value is 1 to do all cssExpand values,
// otherwise step value is 2 to skip over Left and Right
includeWidth = includeWidth ? 1 : 0;
for ( ; i < 4; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
function createTween( value, prop, animation ) {
var tween,
collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
// We're done with this property
return tween;
}
}
}
function defaultPrefilter( elem, props, opts ) {
var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
isBox = "width" in props || "height" in props,
anim = this,
orig = {},
style = elem.style,
hidden = elem.nodeType && isHiddenWithinTree( elem ),
dataShow = dataPriv.get( elem, "fxshow" );
// Queue-skipping animations hijack the fx hooks
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always( function() {
// Ensure the complete handler is called before this completes
anim.always( function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
} );
} );
}
// Detect show/hide animations
for ( prop in props ) {
value = props[ prop ];
if ( rfxtypes.test( value ) ) {
delete props[ prop ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
// Pretend to be hidden if this is a "show" and
// there is still data from a stopped show/hide
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
hidden = true;
// Ignore all other no-op show/hide data
} else {
continue;
}
}
orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
}
}
// Bail out if this is a no-op like .hide().hide()
propTween = !jQuery.isEmptyObject( props );
if ( !propTween && jQuery.isEmptyObject( orig ) ) {
return;
}
// Restrict "overflow" and "display" styles during box animations
if ( isBox && elem.nodeType === 1 ) {
// Support: IE <=9 - 11, Edge 12 - 13
// Record all 3 overflow attributes because IE does not infer the shorthand
// from identically-valued overflowX and overflowY
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Identify a display type, preferring old show/hide data over the CSS cascade
restoreDisplay = dataShow && dataShow.display;
if ( restoreDisplay == null ) {
restoreDisplay = dataPriv.get( elem, "display" );
}
display = jQuery.css( elem, "display" );
if ( display === "none" ) {
if ( restoreDisplay ) {
display = restoreDisplay;
} else {
// Get nonempty value(s) by temporarily forcing visibility
showHide( [ elem ], true );
restoreDisplay = elem.style.display || restoreDisplay;
display = jQuery.css( elem, "display" );
showHide( [ elem ] );
}
}
// Animate inline elements as inline-block
if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
if ( jQuery.css( elem, "float" ) === "none" ) {
// Restore the original display value at the end of pure show/hide animations
if ( !propTween ) {
anim.done( function() {
style.display = restoreDisplay;
} );
if ( restoreDisplay == null ) {
display = style.display;
restoreDisplay = display === "none" ? "" : display;
}
}
style.display = "inline-block";
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
anim.always( function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
} );
}
// Implement show/hide animations
propTween = false;
for ( prop in orig ) {
// General show/hide setup for this element animation
if ( !propTween ) {
if ( dataShow ) {
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
} else {
dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
}
// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
if ( toggle ) {
dataShow.hidden = !hidden;
}
// Show elements before animating them
if ( hidden ) {
showHide( [ elem ], true );
}
/* eslint-disable no-loop-func */
anim.done( function() {
/* eslint-enable no-loop-func */
// The final step of a "hide" animation is actually hiding the element
if ( !hidden ) {
showHide( [ elem ] );
}
dataPriv.remove( elem, "fxshow" );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
} );
}
// Per-property setup
propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = propTween.start;
if ( hidden ) {
propTween.end = propTween.start;
propTween.start = 0;
}
}
}
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( Array.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// Not quite $.extend, this won't overwrite existing keys.
// Reusing 'index' because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
function Animation( elem, properties, options ) {
var result,
stopped,
index = 0,
length = Animation.prefilters.length,
deferred = jQuery.Deferred().always( function() {
// Don't match elem in the :animated selector
delete tick.elem;
} ),
tick = function() {
if ( stopped ) {
return false;
}
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// Support: Android 2.3 only
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ] );
// If there's more to do, yield
if ( percent < 1 && length ) {
return remaining;
}
// If this was an empty animation, synthesize a final progress notification
if ( !length ) {
deferred.notifyWith( elem, [ animation, 1, 0 ] );
}
// Resolve the animation and report its conclusion
deferred.resolveWith( elem, [ animation ] );
return false;
},
animation = deferred.promise( {
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, {
specialEasing: {},
easing: jQuery.easing._default
}, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// If we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
if ( stopped ) {
return this;
}
stopped = true;
for ( ; index < length; index++ ) {
animation.tweens[ index ].run( 1 );
}
// Resolve when we played the last frame; otherwise, reject
if ( gotoEnd ) {
deferred.notifyWith( elem, [ animation, 1, 0 ] );
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
} ),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length; index++ ) {
result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
if ( jQuery.isFunction( result.stop ) ) {
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
jQuery.proxy( result.stop, result );
}
return result;
}
}
jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
// Attach callbacks from options
animation
.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
jQuery.fx.timer(
jQuery.extend( tick, {
elem: elem,
anim: animation,
queue: animation.opts.queue
} )
);
return animation;
}
jQuery.Animation = jQuery.extend( Animation, {
tweeners: {
"*": [ function( prop, value ) {
var tween = this.createTween( prop, value );
adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
return tween;
} ]
},
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.match( rnothtmlwhite );
}
var prop,
index = 0,
length = props.length;
for ( ; index < length; index++ ) {
prop = props[ index ];
Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
Animation.tweeners[ prop ].unshift( callback );
}
},
prefilters: [ defaultPrefilter ],
prefilter: function( callback, prepend ) {
if ( prepend ) {
Animation.prefilters.unshift( callback );
} else {
Animation.prefilters.push( callback );
}
}
} );
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
// Go to the end state if fx are off
if ( jQuery.fx.off ) {
opt.duration = 0;
} else {
if ( typeof opt.duration !== "number" ) {
if ( opt.duration in jQuery.fx.speeds ) {
opt.duration = jQuery.fx.speeds[ opt.duration ];
} else {
opt.duration = jQuery.fx.speeds._default;
}
}
}
// Normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.fn.extend( {
fadeTo: function( speed, to, easing, callback ) {
// Show any hidden elements after setting opacity to 0
return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
// Animate to the value specified
.end().animate( { opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations, or finishing resolves immediately
if ( empty || dataPriv.get( this, "finish" ) ) {
anim.stop( true );
}
};
doAnimation.finish = doAnimation;
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each( function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = dataPriv.get( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this &&
( type == null || timers[ index ].queue === type ) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// Start the next in the queue if the last step wasn't forced.
// Timers currently will call their complete callbacks, which
// will dequeue but only if they were gotoEnd.
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
} );
},
finish: function( type ) {
if ( type !== false ) {
type = type || "fx";
}
return this.each( function() {
var index,
data = dataPriv.get( this ),
queue = data[ type + "queue" ],
hooks = data[ type + "queueHooks" ],
timers = jQuery.timers,
length = queue ? queue.length : 0;
// Enable finishing flag on private data
data.finish = true;
// Empty the queue first
jQuery.queue( this, type, [] );
if ( hooks && hooks.stop ) {
hooks.stop.call( this, true );
}
// Look for any active animations, and finish them
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
timers[ index ].anim.stop( true );
timers.splice( index, 1 );
}
}
// Look for any animations in the old queue and finish them
for ( index = 0; index < length; index++ ) {
if ( queue[ index ] && queue[ index ].finish ) {
queue[ index ].finish.call( this );
}
}
// Turn off finishing flag
delete data.finish;
} );
}
} );
jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
} );
// Generate shortcuts for custom animations
jQuery.each( {
slideDown: genFx( "show" ),
slideUp: genFx( "hide" ),
slideToggle: genFx( "toggle" ),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
} );
jQuery.timers = [];
jQuery.fx.tick = function() {
var timer,
i = 0,
timers = jQuery.timers;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Run the timer and safely remove it when done (allowing for external removal)
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
jQuery.timers.push( timer );
jQuery.fx.start();
};
jQuery.fx.interval = 13;
jQuery.fx.start = function() {
if ( inProgress ) {
return;
}
inProgress = true;
schedule();
};
jQuery.fx.stop = function() {
inProgress = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Based off of the plugin by Clint Helfers, with permission.
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = window.setTimeout( next, time );
hooks.stop = function() {
window.clearTimeout( timeout );
};
} );
};
( function() {
var input = document.createElement( "input" ),
select = document.createElement( "select" ),
opt = select.appendChild( document.createElement( "option" ) );
input.type = "checkbox";
// Support: Android <=4.3 only
// Default value for a checkbox should be "on"
support.checkOn = input.value !== "";
// Support: IE <=11 only
// Must access selectedIndex to make default options select
support.optSelected = opt.selected;
// Support: IE <=11 only
// An input loses its value after becoming a radio
input = document.createElement( "input" );
input.value = "t";
input.type = "radio";
support.radioValue = input.value === "t";
} )();
var boolHook,
attrHandle = jQuery.expr.attrHandle;
jQuery.fn.extend( {
attr: function( name, value ) {
return access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each( function() {
jQuery.removeAttr( this, name );
} );
}
} );
jQuery.extend( {
attr: function( elem, name, value ) {
var ret, hooks,
nType = elem.nodeType;
// Don't get/set attributes on text, comment and attribute nodes
if ( nType === 3 || nType === 8 || nType === 2 ) {
return;
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
// Attribute hooks are determined by the lowercase version
// Grab necessary hook if one is defined
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
}
if ( hooks && "set" in hooks &&
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
return ret;
}
elem.setAttribute( name, value + "" );
return value;
}
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
}
ret = jQuery.find.attr( elem, name );
// Non-existent attributes return null, we normalize to undefined
return ret == null ? undefined : ret;
},
attrHooks: {
type: {
set: function( elem, value ) {
if ( !support.radioValue && value === "radio" &&
nodeName( elem, "input" ) ) {
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
}
},
removeAttr: function( elem, value ) {
var name,
i = 0,
// Attribute names can contain non-HTML whitespace characters
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
attrNames = value && value.match( rnothtmlwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( ( name = attrNames[ i++ ] ) ) {
elem.removeAttribute( name );
}
}
}
} );
// Hooks for boolean attributes
boolHook = {
set: function( elem, value, name ) {
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
elem.setAttribute( name, name );
}
return name;
}
};
jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
var getter = attrHandle[ name ] || jQuery.find.attr;
attrHandle[ name ] = function( elem, name, isXML ) {
var ret, handle,
lowercaseName = name.toLowerCase();
if ( !isXML ) {
// Avoid an infinite loop by temporarily removing this function from the getter
handle = attrHandle[ lowercaseName ];
attrHandle[ lowercaseName ] = ret;
ret = getter( elem, name, isXML ) != null ?
lowercaseName :
null;
attrHandle[ lowercaseName ] = handle;
}
return ret;
};
} );
var rfocusable = /^(?:input|select|textarea|button)$/i,
rclickable = /^(?:a|area)$/i;
jQuery.fn.extend( {
prop: function( name, value ) {
return access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
return this.each( function() {
delete this[ jQuery.propFix[ name ] || name ];
} );
}
} );
jQuery.extend( {
prop: function( elem, name, value ) {
var ret, hooks,
nType = elem.nodeType;
// Don't get/set properties on text, comment and attribute nodes
if ( nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks &&
( ret = hooks.set( elem, value, name ) ) !== undefined ) {
return ret;
}
return ( elem[ name ] = value );
}
if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
return ret;
}
return elem[ name ];
},
propHooks: {
tabIndex: {
get: function( elem ) {
// Support: IE <=9 - 11 only
// elem.tabIndex doesn't always return the
// correct value when it hasn't been explicitly set
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" );
if ( tabindex ) {
return parseInt( tabindex, 10 );
}
if (
rfocusable.test( elem.nodeName ) ||
rclickable.test( elem.nodeName ) &&
elem.href
) {
return 0;
}
return -1;
}
}
},
propFix: {
"for": "htmlFor",
"class": "className"
}
} );
// Support: IE <=11 only
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
// eslint rule "no-unused-expressions" is disabled for this code
// since it considers such accessions noop
if ( !support.optSelected ) {
jQuery.propHooks.selected = {
get: function( elem ) {
/* eslint no-unused-expressions: "off" */
var parent = elem.parentNode;
if ( parent && parent.parentNode ) {
parent.parentNode.selectedIndex;
}
return null;
},
set: function( elem ) {
/* eslint no-unused-expressions: "off" */
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
}
};
}
jQuery.each( [
"tabIndex",
"readOnly",
"maxLength",
"cellSpacing",
"cellPadding",
"rowSpan",
"colSpan",
"useMap",
"frameBorder",
"contentEditable"
], function() {
jQuery.propFix[ this.toLowerCase() ] = this;
} );
// Strip and collapse whitespace according to HTML spec
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
function stripAndCollapse( value ) {
var tokens = value.match( rnothtmlwhite ) || [];
return tokens.join( " " );
}
function getClass( elem ) {
return elem.getAttribute && elem.getAttribute( "class" ) || "";
}
jQuery.fn.extend( {
addClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {
return this.each( function( j ) {
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
} );
}
if ( typeof value === "string" && value ) {
classes = value.match( rnothtmlwhite ) || [];
while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem );
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
if ( cur ) {
j = 0;
while ( ( clazz = classes[ j++ ] ) ) {
if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
cur += clazz + " ";
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse( cur );
if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0;
if ( jQuery.isFunction( value ) ) {
return this.each( function( j ) {
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
} );
}
if ( !arguments.length ) {
return this.attr( "class", "" );
}
if ( typeof value === "string" && value ) {
classes = value.match( rnothtmlwhite ) || [];
while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem );
// This expression is here for better compressibility (see addClass)
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
if ( cur ) {
j = 0;
while ( ( clazz = classes[ j++ ] ) ) {
// Remove *all* instances
while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
cur = cur.replace( " " + clazz + " ", " " );
}
}
// Only assign if different to avoid unneeded rendering.
finalValue = stripAndCollapse( cur );
if ( curValue !== finalValue ) {
elem.setAttribute( "class", finalValue );
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value;
if ( typeof stateVal === "boolean" && type === "string" ) {
return stateVal ? this.addClass( value ) : this.removeClass( value );
}
if ( jQuery.isFunction( value ) ) {
return this.each( function( i ) {
jQuery( this ).toggleClass(
value.call( this, i, getClass( this ), stateVal ),
stateVal
);
} );
}
return this.each( function() {
var className, i, self, classNames;
if ( type === "string" ) {
// Toggle individual class names
i = 0;
self = jQuery( this );
classNames = value.match( rnothtmlwhite ) || [];
while ( ( className = classNames[ i++ ] ) ) {
// Check each className given, space separated list
if ( self.hasClass( className ) ) {
self.removeClass( className );
} else {
self.addClass( className );
}
}
// Toggle whole class name
} else if ( value === undefined || type === "boolean" ) {
className = getClass( this );
if ( className ) {
// Store className if set
dataPriv.set( this, "__className__", className );
}
// If the element has a class name or if we're passed `false`,
// then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored.
if ( this.setAttribute ) {
this.setAttribute( "class",
className || value === false ?
"" :
dataPriv.get( this, "__className__" ) || ""
);
}
}
} );
},
hasClass: function( selector ) {
var className, elem,
i = 0;
className = " " + selector + " ";
while ( ( elem = this[ i++ ] ) ) {
if ( elem.nodeType === 1 &&
( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
return true;
}
}
return false;
}
} );
var rreturn = /\r/g;
jQuery.fn.extend( {
val: function( value ) {
var hooks, ret, isFunction,
elem = this[ 0 ];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks &&
"get" in hooks &&
( ret = hooks.get( elem, "value" ) ) !== undefined
) {
return ret;
}
ret = elem.value;
// Handle most common string cases
if ( typeof ret === "string" ) {
return ret.replace( rreturn, "" );
}
// Handle cases where value is null/undef or number
return ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each( function( i ) {
var val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, jQuery( this ).val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( Array.isArray( val ) ) {
val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
} );
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
} );
}
} );
jQuery.extend( {
valHooks: {
option: {
get: function( elem ) {
var val = jQuery.find.attr( elem, "value" );
return val != null ?
val :
// Support: IE <=10 - 11 only
// option.text throws exceptions (#14686, #14858)
// Strip and collapse whitespace
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
stripAndCollapse( jQuery.text( elem ) );
}
},
select: {
get: function( elem ) {
var value, option, i,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one",
values = one ? null : [],
max = one ? index + 1 : options.length;
if ( index < 0 ) {
i = max;
} else {
i = one ? index : 0;
}
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// Support: IE <=9 only
// IE8-9 doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
!option.disabled &&
( !option.parentNode.disabled ||
!nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var optionSet, option,
options = elem.options,
values = jQuery.makeArray( value ),
i = options.length;
while ( i-- ) {
option = options[ i ];
/* eslint-disable no-cond-assign */
if ( option.selected =
jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
) {
optionSet = true;
}
/* eslint-enable no-cond-assign */
}
// Force browsers to behave consistently when non-matching value is set
if ( !optionSet ) {
elem.selectedIndex = -1;
}
return values;
}
}
}
} );
// Radios and checkboxes getter/setter
jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
set: function( elem, value ) {
if ( Array.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
}
}
};
if ( !support.checkOn ) {
jQuery.valHooks[ this ].get = function( elem ) {
return elem.getAttribute( "value" ) === null ? "on" : elem.value;
};
}
} );
// Return jQuery for attributes-only inclusion
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
jQuery.extend( jQuery.event, {
trigger: function( event, data, elem, onlyHandlers ) {
var i, cur, tmp, bubbleType, ontype, handle, special,
eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event,
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
cur = tmp = elem = elem || document;
// Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
return;
}
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "." ) > -1 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split( "." );
type = namespaces.shift();
namespaces.sort();
}
ontype = type.indexOf( ":" ) < 0 && "on" + type;
// Caller can pass in a jQuery.Event object, Object, or just an event type string
event = event[ jQuery.expando ] ?
event :
new jQuery.Event( type, typeof event === "object" && event );
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join( "." );
event.rnamespace = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
null;
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data == null ?
[ event ] :
jQuery.makeArray( data, [ event ] );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) {
cur = cur.parentNode;
}
for ( ; cur; cur = cur.parentNode ) {
eventPath.push( cur );
tmp = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( tmp === ( elem.ownerDocument || document ) ) {
eventPath.push( tmp.defaultView || tmp.parentWindow || window );
}
}
// Fire handlers on the event path
i = 0;
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
event.type = i > 1 ?
bubbleType :
special.bindType || type;
// jQuery handler
handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
dataPriv.get( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Native handler
handle = ontype && cur[ ontype ];
if ( handle && handle.apply && acceptData( cur ) ) {
event.result = handle.apply( cur, data );
if ( event.result === false ) {
event.preventDefault();
}
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( ( !special._default ||
special._default.apply( eventPath.pop(), data ) === false ) &&
acceptData( elem ) ) {
// Call a native DOM method on the target with the same name as the event.
// Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ];
if ( tmp ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( tmp ) {
elem[ ontype ] = tmp;
}
}
}
}
return event.result;
},
// Piggyback on a donor event to simulate a different one
// Used only for `focus(in | out)` events
simulate: function( type, elem, event ) {
var e = jQuery.extend(
new jQuery.Event(),
event,
{
type: type,
isSimulated: true
}
);
jQuery.event.trigger( e, null, elem );
}
} );
jQuery.fn.extend( {
trigger: function( type, data ) {
return this.each( function() {
jQuery.event.trigger( type, data, this );
} );
},
triggerHandler: function( type, data ) {
var elem = this[ 0 ];
if ( elem ) {
return jQuery.event.trigger( type, data, elem, true );
}
}
} );
jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup contextmenu" ).split( " " ),
function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
} );
jQuery.fn.extend( {
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
} );
support.focusin = "onfocusin" in window;
// Support: Firefox <=44
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler on the document while someone wants focusin/focusout
var handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
};
jQuery.event.special[ fix ] = {
setup: function() {
var doc = this.ownerDocument || this,
attaches = dataPriv.access( doc, fix );
if ( !attaches ) {
doc.addEventListener( orig, handler, true );
}
dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
},
teardown: function() {
var doc = this.ownerDocument || this,
attaches = dataPriv.access( doc, fix ) - 1;
if ( !attaches ) {
doc.removeEventListener( orig, handler, true );
dataPriv.remove( doc, fix );
} else {
dataPriv.access( doc, fix, attaches );
}
}
};
} );
}
var location = window.location;
var nonce = jQuery.now();
var rquery = ( /\?/ );
// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
var xml;
if ( !data || typeof data !== "string" ) {
return null;
}
// Support: IE 9 - 11 only
// IE throws on parseFromString with invalid input.
try {
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
} catch ( e ) {
xml = undefined;
}
if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
};
var
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
rsubmittable = /^(?:input|select|textarea|keygen)/i;
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( Array.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// Item is non-scalar (array or object), encode its numeric index.
buildParams(
prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
v,
traditional,
add
);
}
} );
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, valueOrFunction ) {
// If value is a function, invoke it and use its return value
var value = jQuery.isFunction( valueOrFunction ) ?
valueOrFunction() :
valueOrFunction;
s[ s.length ] = encodeURIComponent( key ) + "=" +
encodeURIComponent( value == null ? "" : value );
};
// If an array was passed in, assume that it is an array of form elements.
if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
} );
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" );
};
jQuery.fn.extend( {
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map( function() {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
} )
.filter( function() {
var type = this.type;
// Use .is( ":disabled" ) so that fieldset[disabled] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckableType.test( type ) );
} )
.map( function( i, elem ) {
var val = jQuery( this ).val();
if ( val == null ) {
return null;
}
if ( Array.isArray( val ) ) {
return jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} );
}
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} ).get();
}
} );
var
r20 = /%20/g,
rhash = /#.*$/,
rantiCache = /([?&])_=[^&]*/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = "*/".concat( "*" ),
// Anchor tag for parsing the document origin
originAnchor = document.createElement( "a" );
originAnchor.href = location.href;
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType,
i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
while ( ( dataType = dataTypes[ i++ ] ) ) {
// Prepend if requested
if ( dataType[ 0 ] === "+" ) {
dataType = dataType.slice( 1 ) || "*";
( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
// Otherwise append
} else {
( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
}
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
var inspected = {},
seekingTransport = ( structure === transports );
function inspect( dataType ) {
var selected;
inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if ( typeof dataTypeOrTransport === "string" &&
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport );
return false;
} else if ( seekingTransport ) {
return !( selected = dataTypeOrTransport );
}
} );
return selected;
}
return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
return target;
}
/* Handles responses to an ajax request:
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
while ( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
/* Chain conversions given the request and the original response
* Also sets the responseXXX fields on the jqXHR instance
*/
function ajaxConvert( s, response, jqXHR, isSuccess ) {
var conv2, current, conv, tmp, prev,
converters = {},
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice();
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
current = dataTypes.shift();
// Convert to each sequential dataType
while ( current ) {
if ( s.responseFields[ current ] ) {
jqXHR[ s.responseFields[ current ] ] = response;
}
// Apply the dataFilter if provided
if ( !prev && isSuccess && s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
prev = current;
current = dataTypes.shift();
if ( current ) {
// There's only work to do if current dataType is non-auto
if ( current === "*" ) {
current = prev;
// Convert response if prev dataType is non-auto and differs from current
} else if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split( " " );
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.unshift( tmp[ 1 ] );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s.throws ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
}
}
}
}
}
}
return { state: "success", data: response };
}
jQuery.extend( {
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {},
ajaxSettings: {
url: location.href,
type: "GET",
isLocal: rlocalProtocol.test( location.protocol ),
global: true,
processData: true,
async: true,
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
"*": allTypes,
text: "text/plain",
html: "text/html",
xml: "application/xml, text/xml",
json: "application/json, text/javascript"
},
contents: {
xml: /\bxml\b/,
html: /\bhtml/,
json: /\bjson\b/
},
responseFields: {
xml: "responseXML",
text: "responseText",
json: "responseJSON"
},
// Data converters
// Keys separate source (or catchall "*") and destination types with a single space
converters: {
// Convert anything to text
"* text": String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": JSON.parse,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
url: true,
context: true
}
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
return settings ?
// Building a settings object
ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
// Extending ajaxSettings
ajaxExtend( jQuery.ajaxSettings, target );
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var transport,
// URL without anti-cache param
cacheURL,
// Response headers
responseHeadersString,
responseHeaders,
// timeout handle
timeoutTimer,
// Url cleanup var
urlAnchor,
// Request state (becomes false upon send and true upon completion)
completed,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// uncached part of the url
uncached,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context &&
( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery( callbackContext ) :
jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( completed ) {
if ( !responseHeaders ) {
responseHeaders = {};
while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match == null ? null : match;
},
// Raw string
getAllResponseHeaders: function() {
return completed ? responseHeadersString : null;
},
// Caches the header
setRequestHeader: function( name, value ) {
if ( completed == null ) {
name = requestHeadersNames[ name.toLowerCase() ] =
requestHeadersNames[ name.toLowerCase() ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( completed == null ) {
s.mimeType = type;
}
return this;
},
// Status-dependent callbacks
statusCode: function( map ) {
var code;
if ( map ) {
if ( completed ) {
// Execute the appropriate callbacks
jqXHR.always( map[ jqXHR.status ] );
} else {
// Lazy-add the new callbacks in a way that preserves old ones
for ( code in map ) {
statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
}
}
}
return this;
},
// Cancel the request
abort: function( statusText ) {
var finalText = statusText || strAbort;
if ( transport ) {
transport.abort( finalText );
}
done( 0, finalText );
return this;
}
};
// Attach deferreds
deferred.promise( jqXHR );
// Add protocol if not provided (prefilters might expect it)
// Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available
s.url = ( ( url || s.url || location.href ) + "" )
.replace( rprotocol, location.protocol + "//" );
// Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
// A cross-domain request is in order when the origin doesn't match the current origin.
if ( s.crossDomain == null ) {
urlAnchor = document.createElement( "a" );
// Support: IE <=8 - 11, Edge 12 - 13
// IE throws exception on accessing the href property if url is malformed,
// e.g. http://example.com:80x/
try {
urlAnchor.href = s.url;
// Support: IE <=8 - 11 only
// Anchor's host property isn't correctly set when s.url is relative
urlAnchor.href = urlAnchor.href;
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
urlAnchor.protocol + "//" + urlAnchor.host;
} catch ( e ) {
// If there is an error parsing the URL, assume it is crossDomain,
// it can be rejected by the transport if it is invalid
s.crossDomain = true;
}
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( completed ) {
return jqXHR;
}
// We can fire global events as of now if asked to
// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
fireGlobals = jQuery.event && s.global;
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Save the URL in case we're toying with the If-Modified-Since
// and/or If-None-Match header later on
// Remove hash to simplify url manipulation
cacheURL = s.url.replace( rhash, "" );
// More options handling for requests with no content
if ( !s.hasContent ) {
// Remember the hash so we can put it back
uncached = s.url.slice( cacheURL.length );
// If data is available, append data to url
if ( s.data ) {
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Add or update anti-cache param if needed
if ( s.cache === false ) {
cacheURL = cacheURL.replace( rantiCache, "$1" );
uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
}
// Put hash and anti-cache on the URL that will be requested (gh-1732)
s.url = cacheURL + uncached;
// Change '%20' to '+' if this is encoded form body content (gh-2658)
} else if ( s.data && s.processData &&
( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
s.data = s.data.replace( r20, "+" );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( jQuery.lastModified[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
}
if ( jQuery.etag[ cacheURL ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
s.accepts[ s.dataTypes[ 0 ] ] +
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend &&
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// Aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
completeDeferred.add( s.complete );
jqXHR.done( s.success );
jqXHR.fail( s.error );
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// If request was aborted inside ajaxSend, stop there
if ( completed ) {
return jqXHR;
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = window.setTimeout( function() {
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
completed = false;
transport.send( requestHeaders, done );
} catch ( e ) {
// Rethrow post-completion exceptions
if ( completed ) {
throw e;
}
// Propagate others as results
done( -1, e );
}
}
// Callback for when everything is done
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Ignore repeat invocations
if ( completed ) {
return;
}
completed = true;
// Clear timeout if it exists
if ( timeoutTimer ) {
window.clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Determine if successful
isSuccess = status >= 200 && status < 300 || status === 304;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// Convert no matter what (that way responseXXX fields are always set)
response = ajaxConvert( s, response, jqXHR, isSuccess );
// If successful, handle type chaining
if ( isSuccess ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader( "Last-Modified" );
if ( modified ) {
jQuery.lastModified[ cacheURL ] = modified;
}
modified = jqXHR.getResponseHeader( "etag" );
if ( modified ) {
jQuery.etag[ cacheURL ] = modified;
}
}
// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
// if not modified
} else if ( status === 304 ) {
statusText = "notmodified";
// If we have data, let's convert it
} else {
statusText = response.state;
success = response.data;
error = response.error;
isSuccess = !error;
}
} else {
// Extract error from statusText and normalize for non-aborts
error = statusText;
if ( status || !statusText ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
return jqXHR;
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
}
} );
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// Shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
// The url can be an options object (which then must have .url)
return jQuery.ajax( jQuery.extend( {
url: url,
type: method,
dataType: type,
data: data,
success: callback
}, jQuery.isPlainObject( url ) && url ) );
};
} );
jQuery._evalUrl = function( url ) {
return jQuery.ajax( {
url: url,
// Make this explicit, since user can override this through ajaxSetup (#11264)
type: "GET",
dataType: "script",
cache: true,
async: false,
global: false,
"throws": true
} );
};
jQuery.fn.extend( {
wrapAll: function( html ) {
var wrap;
if ( this[ 0 ] ) {
if ( jQuery.isFunction( html ) ) {
html = html.call( this[ 0 ] );
}
// The elements to wrap the target around
wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
if ( this[ 0 ].parentNode ) {
wrap.insertBefore( this[ 0 ] );
}
wrap.map( function() {
var elem = this;
while ( elem.firstElementChild ) {
elem = elem.firstElementChild;
}
return elem;
} ).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each( function( i ) {
jQuery( this ).wrapInner( html.call( this, i ) );
} );
}
return this.each( function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
} );
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each( function( i ) {
jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
} );
},
unwrap: function( selector ) {
this.parent( selector ).not( "body" ).each( function() {
jQuery( this ).replaceWith( this.childNodes );
} );
return this;
}
} );
jQuery.expr.pseudos.hidden = function( elem ) {
return !jQuery.expr.pseudos.visible( elem );
};
jQuery.expr.pseudos.visible = function( elem ) {
return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};
jQuery.ajaxSettings.xhr = function() {
try {
return new window.XMLHttpRequest();
} catch ( e ) {}
};
var xhrSuccessStatus = {
// File protocol always yields status code 0, assume 200
0: 200,
// Support: IE <=9 only
// #1450: sometimes IE returns 1223 when it should be 204
1223: 204
},
xhrSupported = jQuery.ajaxSettings.xhr();
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;
jQuery.ajaxTransport( function( options ) {
var callback, errorCallback;
// Cross domain only allowed if supported through XMLHttpRequest
if ( support.cors || xhrSupported && !options.crossDomain ) {
return {
send: function( headers, complete ) {
var i,
xhr = options.xhr();
xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
// Apply custom fields if provided
if ( options.xhrFields ) {
for ( i in options.xhrFields ) {
xhr[ i ] = options.xhrFields[ i ];
}
}
// Override mime type if needed
if ( options.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( options.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Set headers
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
// Callback
callback = function( type ) {
return function() {
if ( callback ) {
callback = errorCallback = xhr.onload =
xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
if ( type === "abort" ) {
xhr.abort();
} else if ( type === "error" ) {
// Support: IE <=9 only
// On a manual native abort, IE9 throws
// errors on any property access that is not readyState
if ( typeof xhr.status !== "number" ) {
complete( 0, "error" );
} else {
complete(
// File: protocol always yields status 0; see #8605, #14207
xhr.status,
xhr.statusText
);
}
} else {
complete(
xhrSuccessStatus[ xhr.status ] || xhr.status,
xhr.statusText,
// Support: IE <=9 only
// IE9 has no XHR2 but throws on binary (trac-11426)
// For XHR2 non-text, let the caller handle it (gh-2498)
( xhr.responseType || "text" ) !== "text" ||
typeof xhr.responseText !== "string" ?
{ binary: xhr.response } :
{ text: xhr.responseText },
xhr.getAllResponseHeaders()
);
}
}
};
};
// Listen to events
xhr.onload = callback();
errorCallback = xhr.onerror = callback( "error" );
// Support: IE 9 only
// Use onreadystatechange to replace onabort
// to handle uncaught aborts
if ( xhr.onabort !== undefined ) {
xhr.onabort = errorCallback;
} else {
xhr.onreadystatechange = function() {
// Check readyState before timeout as it changes
if ( xhr.readyState === 4 ) {
// Allow onerror to be called first,
// but that will not handle a native abort
// Also, save errorCallback to a variable
// as xhr.onerror cannot be accessed
window.setTimeout( function() {
if ( callback ) {
errorCallback();
}
} );
}
};
}
// Create the abort callback
callback = callback( "abort" );
try {
// Do send the request (this may raise an exception)
xhr.send( options.hasContent && options.data || null );
} catch ( e ) {
// #14683: Only rethrow if this hasn't been notified as an error yet
if ( callback ) {
throw e;
}
}
},
abort: function() {
if ( callback ) {
callback();
}
}
};
}
} );
// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
if ( s.crossDomain ) {
s.contents.script = false;
}
} );
// Install script dataType
jQuery.ajaxSetup( {
accepts: {
script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript"
},
contents: {
script: /\b(?:java|ecma)script\b/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
} );
// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
}
} );
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script, callback;
return {
send: function( _, complete ) {
script = jQuery( "<script>" ).prop( {
charset: s.scriptCharset,
src: s.url
} ).on(
"load error",
callback = function( evt ) {
script.remove();
callback = null;
if ( evt ) {
complete( evt.type === "error" ? 404 : 200, evt.type );
}
}
);
// Use native DOM manipulation to avoid our domManip AJAX trickery
document.head.appendChild( script[ 0 ] );
},
abort: function() {
if ( callback ) {
callback();
}
}
};
}
} );
var oldCallbacks = [],
rjsonp = /(=)\?(?=&|$)|\?\?/;
// Default jsonp settings
jQuery.ajaxSetup( {
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
this[ callback ] = true;
return callback;
}
} );
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" :
typeof s.data === "string" &&
( s.contentType || "" )
.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
rjsonp.test( s.data ) && "data"
);
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
// Insert callback into url or form data
if ( jsonProp ) {
s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
} else if ( s.jsonp !== false ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters[ "script json" ] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// Force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
overwritten = window[ callbackName ];
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always( function() {
// If previous value didn't exist - remove it
if ( overwritten === undefined ) {
jQuery( window ).removeProp( callbackName );
// Otherwise restore preexisting value
} else {
window[ callbackName ] = overwritten;
}
// Save back as free
if ( s[ callbackName ] ) {
// Make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// Save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
} );
// Delegate to script
return "script";
}
} );
// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
var body = document.implementation.createHTMLDocument( "" ).body;
body.innerHTML = "<form></form><form></form>";
return body.childNodes.length === 2;
} )();
// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
if ( typeof data !== "string" ) {
return [];
}
if ( typeof context === "boolean" ) {
keepScripts = context;
context = false;
}
var base, parsed, scripts;
if ( !context ) {
// Stop scripts or inline event handlers from being executed immediately
// by using document.implementation
if ( support.createHTMLDocument ) {
context = document.implementation.createHTMLDocument( "" );
// Set the base href for the created document
// so any parsed elements with URLs
// are based on the document's URL (gh-2965)
base = context.createElement( "base" );
base.href = document.location.href;
context.head.appendChild( base );
} else {
context = document;
}
}
parsed = rsingleTag.exec( data );
scripts = !keepScripts && [];
// Single tag
if ( parsed ) {
return [ context.createElement( parsed[ 1 ] ) ];
}
parsed = buildFragment( [ data ], context, scripts );
if ( scripts && scripts.length ) {
jQuery( scripts ).remove();
}
return jQuery.merge( [], parsed.childNodes );
};
/**
* Load a url into a page
*/
jQuery.fn.load = function( url, params, callback ) {
var selector, type, response,
self = this,
off = url.indexOf( " " );
if ( off > -1 ) {
selector = stripAndCollapse( url.slice( off ) );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// If we have elements to modify, make the request
if ( self.length > 0 ) {
jQuery.ajax( {
url: url,
// If "type" variable is undefined, then "GET" method will be used.
// Make value of this field explicit since
// user can override it through ajaxSetup method
type: type || "GET",
dataType: "html",
data: params
} ).done( function( responseText ) {
// Save response for use in complete callback
response = arguments;
self.html( selector ?
// If a selector was specified, locate the right elements in a dummy div
// Exclude scripts to avoid IE 'Permission Denied' errors
jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
// Otherwise use the full result
responseText );
// If the request succeeds, this function gets "data", "status", "jqXHR"
// but they are ignored because response was set above.
// If it fails, this function gets "jqXHR", "status", "error"
} ).always( callback && function( jqXHR, status ) {
self.each( function() {
callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
} );
} );
}
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( [
"ajaxStart",
"ajaxStop",
"ajaxComplete",
"ajaxError",
"ajaxSuccess",
"ajaxSend"
], function( i, type ) {
jQuery.fn[ type ] = function( fn ) {
return this.on( type, fn );
};
} );
jQuery.expr.pseudos.animated = function( elem ) {
return jQuery.grep( jQuery.timers, function( fn ) {
return elem === fn.elem;
} ).length;
};
jQuery.offset = {
setOffset: function( elem, options, i ) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
position = jQuery.css( elem, "position" ),
curElem = jQuery( elem ),
props = {};
// Set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
curOffset = curElem.offset();
curCSSTop = jQuery.css( elem, "top" );
curCSSLeft = jQuery.css( elem, "left" );
calculatePosition = ( position === "absolute" || position === "fixed" ) &&
( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
// Need to be able to calculate position if either
// top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend( {
offset: function( options ) {
// Preserve chaining for setter
if ( arguments.length ) {
return options === undefined ?
this :
this.each( function( i ) {
jQuery.offset.setOffset( this, options, i );
} );
}
var doc, docElem, rect, win,
elem = this[ 0 ];
if ( !elem ) {
return;
}
// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
// Support: IE <=11 only
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
if ( !elem.getClientRects().length ) {
return { top: 0, left: 0 };
}
rect = elem.getBoundingClientRect();
doc = elem.ownerDocument;
docElem = doc.documentElement;
win = doc.defaultView;
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
};
},
position: function() {
if ( !this[ 0 ] ) {
return;
}
var offsetParent, offset,
elem = this[ 0 ],
parentOffset = { top: 0, left: 0 };
// Fixed elements are offset from window (parentOffset = {top:0, left: 0},
// because it is its only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) {
// Assume getBoundingClientRect is there when computed position is fixed
offset = elem.getBoundingClientRect();
} else {
// Get *real* offsetParent
offsetParent = this.offsetParent();
// Get correct offsets
offset = this.offset();
if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset();
}
// Add offsetParent borders
parentOffset = {
top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
};
}
// Subtract parent offsets and element margins
return {
top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
};
},
// This method will return documentElement in the following cases:
// 1) For the element inside the iframe without offsetParent, this method will return
// documentElement of the parent window
// 2) For the hidden or detached element
// 3) For body or html element, i.e. in case of the html node - it will return itself
//
// but those exceptions were never presented as a real life use-cases
// and might be considered as more preferable results.
//
// This logic, however, is not guaranteed and can change at any point in the future
offsetParent: function() {
return this.map( function() {
var offsetParent = this.offsetParent;
while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || documentElement;
} );
}
} );
// Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
var top = "pageYOffset" === prop;
jQuery.fn[ method ] = function( val ) {
return access( this, function( elem, method, val ) {
// Coalesce documents and windows
var win;
if ( jQuery.isWindow( elem ) ) {
win = elem;
} else if ( elem.nodeType === 9 ) {
win = elem.defaultView;
}
if ( val === undefined ) {
return win ? win[ prop ] : elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : win.pageXOffset,
top ? val : win.pageYOffset
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length );
};
} );
// Support: Safari <=7 - 9.1, Chrome <=37 - 49
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
// getComputedStyle returns percent when specified for top/left/bottom/right;
// rather than make the css module depend on the offset module, just check for it here
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
function( elem, computed ) {
if ( computed ) {
computed = curCSS( elem, prop );
// If curCSS returns percentage, fallback to offset
return rnumnonpx.test( computed ) ?
jQuery( elem ).position()[ prop ] + "px" :
computed;
}
}
);
} );
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) {
// Margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
return funcName.indexOf( "outer" ) === 0 ?
elem[ "inner" + name ] :
elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// whichever is greatest
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable );
};
} );
} );
jQuery.fn.extend( {
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ?
this.off( selector, "**" ) :
this.off( types, selector || "**", fn );
}
} );
jQuery.holdReady = function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.
// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
if ( true ) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {
return jQuery;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
var
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$;
jQuery.noConflict = function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
};
// Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( !noGlobal ) {
window.jQuery = window.$ = jQuery;
}
return jQuery;
} );
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* WEBPACK VAR INJECTION */(function(process, global) {/*!
* Vue.js v2.4.2
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
/* */
// these helpers produces better vm code in JS engines due to their
// explicitness and function inlining
function isUndef (v) {
return v === undefined || v === null
}
function isDef (v) {
return v !== undefined && v !== null
}
function isTrue (v) {
return v === true
}
function isFalse (v) {
return v === false
}
/**
* Check if value is primitive
*/
function isPrimitive (value) {
return (
typeof value === 'string' ||
typeof value === 'number' ||
typeof value === 'boolean'
)
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
var _toString = Object.prototype.toString;
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*/
function isPlainObject (obj) {
return _toString.call(obj) === '[object Object]'
}
function isRegExp (v) {
return _toString.call(v) === '[object RegExp]'
}
/**
* Check if val is a valid array index.
*/
function isValidArrayIndex (val) {
var n = parseFloat(val);
return n >= 0 && Math.floor(n) === n && isFinite(val)
}
/**
* Convert a value to a string that is actually rendered.
*/
function toString (val) {
return val == null
? ''
: typeof val === 'object'
? JSON.stringify(val, null, 2)
: String(val)
}
/**
* Convert a input value to a number for persistence.
* If the conversion fails, return original string.
*/
function toNumber (val) {
var n = parseFloat(val);
return isNaN(n) ? val : n
}
/**
* Make a map and return a function for checking if a key
* is in that map.
*/
function makeMap (
str,
expectsLowerCase
) {
var map = Object.create(null);
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? function (val) { return map[val.toLowerCase()]; }
: function (val) { return map[val]; }
}
/**
* Check if a tag is a built-in tag.
*/
var isBuiltInTag = makeMap('slot,component', true);
/**
* Check if a attribute is a reserved attribute.
*/
var isReservedAttribute = makeMap('key,ref,slot,is');
/**
* Remove an item from an array
*/
function remove (arr, item) {
if (arr.length) {
var index = arr.indexOf(item);
if (index > -1) {
return arr.splice(index, 1)
}
}
}
/**
* Check whether the object has the property.
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
/**
* Create a cached version of a pure function.
*/
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
}
/**
* Camelize a hyphen-delimited string.
*/
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
});
/**
* Capitalize a string.
*/
var capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
});
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
return str
.replace(hyphenateRE, '$1-$2')
.replace(hyphenateRE, '$1-$2')
.toLowerCase()
});
/**
* Simple bind, faster than native
*/
function bind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
// record original fn length
boundFn._length = fn.length;
return boundFn
}
/**
* Convert an Array-like object to a real Array.
*/
function toArray (list, start) {
start = start || 0;
var i = list.length - start;
var ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
}
/**
* Mix properties into target object.
*/
function extend (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
}
/**
* Merge an Array of Objects into a single Object.
*/
function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
}
/**
* Perform no operation.
* Stubbing args to make Flow happy without leaving useless transpiled code
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
*/
function noop (a, b, c) {}
/**
* Always return false.
*/
var no = function (a, b, c) { return false; };
/**
* Return same value
*/
var identity = function (_) { return _; };
/**
* Generate a static keys string from compiler modules.
*/
/**
* Check if two values are loosely equal - that is,
* if they are plain objects, do they have the same shape?
*/
function looseEqual (a, b) {
if (a === b) { return true }
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
var isArrayA = Array.isArray(a);
var isArrayB = Array.isArray(b);
if (isArrayA && isArrayB) {
return a.length === b.length && a.every(function (e, i) {
return looseEqual(e, b[i])
})
} else if (!isArrayA && !isArrayB) {
var keysA = Object.keys(a);
var keysB = Object.keys(b);
return keysA.length === keysB.length && keysA.every(function (key) {
return looseEqual(a[key], b[key])
})
} else {
/* istanbul ignore next */
return false
}
} catch (e) {
/* istanbul ignore next */
return false
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b)
} else {
return false
}
}
function looseIndexOf (arr, val) {
for (var i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) { return i }
}
return -1
}
/**
* Ensure a function is called only once.
*/
function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn.apply(this, arguments);
}
}
}
var SSR_ATTR = 'data-server-rendered';
var ASSET_TYPES = [
'component',
'directive',
'filter'
];
var LIFECYCLE_HOOKS = [
'beforeCreate',
'created',
'beforeMount',
'mounted',
'beforeUpdate',
'updated',
'beforeDestroy',
'destroyed',
'activated',
'deactivated'
];
/* */
var config = ({
/**
* Option merge strategies (used in core/util/options)
*/
optionMergeStrategies: Object.create(null),
/**
* Whether to suppress warnings.
*/
silent: false,
/**
* Show production mode tip message on boot?
*/
productionTip: process.env.NODE_ENV !== 'production',
/**
* Whether to enable devtools
*/
devtools: process.env.NODE_ENV !== 'production',
/**
* Whether to record perf
*/
performance: false,
/**
* Error handler for watcher errors
*/
errorHandler: null,
/**
* Warn handler for watcher warns
*/
warnHandler: null,
/**
* Ignore certain custom elements
*/
ignoredElements: [],
/**
* Custom user key aliases for v-on
*/
keyCodes: Object.create(null),
/**
* Check if a tag is reserved so that it cannot be registered as a
* component. This is platform-dependent and may be overwritten.
*/
isReservedTag: no,
/**
* Check if an attribute is reserved so that it cannot be used as a component
* prop. This is platform-dependent and may be overwritten.
*/
isReservedAttr: no,
/**
* Check if a tag is an unknown element.
* Platform-dependent.
*/
isUnknownElement: no,
/**
* Get the namespace of an element
*/
getTagNamespace: noop,
/**
* Parse the real tag name for the specific platform.
*/
parsePlatformTagName: identity,
/**
* Check if an attribute must be bound using property, e.g. value
* Platform-dependent.
*/
mustUseProp: no,
/**
* Exposed for legacy reasons
*/
_lifecycleHooks: LIFECYCLE_HOOKS
});
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
function isReserved (str) {
var c = (str + '').charCodeAt(0);
return c === 0x24 || c === 0x5F
}
/**
* Define a property.
*/
function def (obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true
});
}
/**
* Parse simple path.
*/
var bailRE = /[^\w.$]/;
function parsePath (path) {
if (bailRE.test(path)) {
return
}
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
if (!obj) { return }
obj = obj[segments[i]];
}
return obj
}
}
/* */
var warn = noop;
var tip = noop;
var formatComponentName = (null); // work around flow check
if (process.env.NODE_ENV !== 'production') {
var hasConsole = typeof console !== 'undefined';
var classifyRE = /(?:^|[-_])(\w)/g;
var classify = function (str) { return str
.replace(classifyRE, function (c) { return c.toUpperCase(); })
.replace(/[-_]/g, ''); };
warn = function (msg, vm) {
var trace = vm ? generateComponentTrace(vm) : '';
if (config.warnHandler) {
config.warnHandler.call(null, msg, vm, trace);
} else if (hasConsole && (!config.silent)) {
console.error(("[Vue warn]: " + msg + trace));
}
};
tip = function (msg, vm) {
if (hasConsole && (!config.silent)) {
console.warn("[Vue tip]: " + msg + (
vm ? generateComponentTrace(vm) : ''
));
}
};
formatComponentName = function (vm, includeFile) {
if (vm.$root === vm) {
return '<Root>'
}
var name = typeof vm === 'string'
? vm
: typeof vm === 'function' && vm.options
? vm.options.name
: vm._isVue
? vm.$options.name || vm.$options._componentTag
: vm.name;
var file = vm._isVue && vm.$options.__file;
if (!name && file) {
var match = file.match(/([^/\\]+)\.vue$/);
name = match && match[1];
}
return (
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
(file && includeFile !== false ? (" at " + file) : '')
)
};
var repeat = function (str, n) {
var res = '';
while (n) {
if (n % 2 === 1) { res += str; }
if (n > 1) { str += str; }
n >>= 1;
}
return res
};
var generateComponentTrace = function (vm) {
if (vm._isVue && vm.$parent) {
var tree = [];
var currentRecursiveSequence = 0;
while (vm) {
if (tree.length > 0) {
var last = tree[tree.length - 1];
if (last.constructor === vm.constructor) {
currentRecursiveSequence++;
vm = vm.$parent;
continue
} else if (currentRecursiveSequence > 0) {
tree[tree.length - 1] = [last, currentRecursiveSequence];
currentRecursiveSequence = 0;
}
}
tree.push(vm);
vm = vm.$parent;
}
return '\n\nfound in\n\n' + tree
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
: formatComponentName(vm))); })
.join('\n')
} else {
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
}
};
}
/* */
function handleError (err, vm, info) {
if (config.errorHandler) {
config.errorHandler.call(null, err, vm, info);
} else {
if (process.env.NODE_ENV !== 'production') {
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
}
}
}
/* */
/* globals MutationObserver */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// Firefix has a "watch" function on Object.prototype...
var nativeWatch = ({}).watch;
var supportsPassive = false;
if (inBrowser) {
try {
var opts = {};
Object.defineProperty(opts, 'passive', ({
get: function get () {
/* istanbul ignore next */
supportsPassive = true;
}
})); // https://github.com/facebook/flow/issues/285
window.addEventListener('test-passive', null, opts);
} catch (e) {}
}
// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'].env.VUE_ENV === 'server';
} else {
_isServer = false;
}
}
return _isServer
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative (Ctor) {
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
}
var hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
/**
* Defer a task to execute it asynchronously.
*/
var nextTick = (function () {
var callbacks = [];
var pending = false;
var timerFunc;
function nextTickHandler () {
pending = false;
var copies = callbacks.slice(0);
callbacks.length = 0;
for (var i = 0; i < copies.length; i++) {
copies[i]();
}
}
// the nextTick behavior leverages the microtask queue, which can be accessed
// via either native Promise.then or MutationObserver.
// MutationObserver has wider support, however it is seriously bugged in
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
// completely stops working after triggering a few times... so, if native
// Promise is available, we will use it:
/* istanbul ignore if */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
var p = Promise.resolve();
var logError = function (err) { console.error(err); };
timerFunc = function () {
p.then(nextTickHandler).catch(logError);
// in problematic UIWebViews, Promise.then doesn't completely break, but
// it can get stuck in a weird state where callbacks are pushed into the
// microtask queue but the queue isn't being flushed, until the browser
// needs to do some other work, e.g. handle a timer. Therefore we can
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
} else {
// fallback to setTimeout
/* istanbul ignore next */
timerFunc = function () {
setTimeout(nextTickHandler, 0);
};
}
return function queueNextTick (cb, ctx) {
var _resolve;
callbacks.push(function () {
if (cb) {
try {
cb.call(ctx);
} catch (e) {
handleError(e, ctx, 'nextTick');
}
} else if (_resolve) {
_resolve(ctx);
}
});
if (!pending) {
pending = true;
timerFunc();
}
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve, reject) {
_resolve = resolve;
})
}
}
})();
var _Set;
/* istanbul ignore if */
if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set;
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = (function () {
function Set () {
this.set = Object.create(null);
}
Set.prototype.has = function has (key) {
return this.set[key] === true
};
Set.prototype.add = function add (key) {
this.set[key] = true;
};
Set.prototype.clear = function clear () {
this.set = Object.create(null);
};
return Set;
}());
}
/* */
var uid$1 = 0;
/**
* A dep is an observable that can have multiple
* directives subscribing to it.
*/
var Dep = function Dep () {
this.id = uid$1++;
this.subs = [];
};
Dep.prototype.addSub = function addSub (sub) {
this.subs.push(sub);
};
Dep.prototype.removeSub = function removeSub (sub) {
remove(this.subs, sub);
};
Dep.prototype.depend = function depend () {
if (Dep.target) {
Dep.target.addDep(this);
}
};
Dep.prototype.notify = function notify () {
// stabilize the subscriber list first
var subs = this.subs.slice();
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update();
}
};
// the current target watcher being evaluated.
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null;
var targetStack = [];
function pushTarget (_target) {
if (Dep.target) { targetStack.push(Dep.target); }
Dep.target = _target;
}
function popTarget () {
Dep.target = targetStack.pop();
}
/*
* not type checking this file because flow doesn't play well with
* dynamically accessing methods on Array prototype
*/
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
'push',
'pop',
'shift',
'unshift',
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var result = original.apply(this, args);
var ob = this.__ob__;
var inserted;
switch (method) {
case 'push':
case 'unshift':
inserted = args;
break
case 'splice':
inserted = args.slice(2);
break
}
if (inserted) { ob.observeArray(inserted); }
// notify change
ob.dep.notify();
return result
});
});
/* */
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
/**
* By default, when a reactive property is set, the new value is
* also converted to become reactive. However when passing down props,
* we don't want to force conversion because the value may be a nested value
* under a frozen data structure. Converting it would defeat the optimization.
*/
var observerState = {
shouldConvert: true
};
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
*/
var Observer = function Observer (value) {
this.value = value;
this.dep = new Dep();
this.vmCount = 0;
def(value, '__ob__', this);
if (Array.isArray(value)) {
var augment = hasProto
? protoAugment
: copyAugment;
augment(value, arrayMethods, arrayKeys);
this.observeArray(value);
} else {
this.walk(value);
}
};
/**
* Walk through each property and convert them into
* getter/setters. This method should only be called when
* value type is Object.
*/
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive$$1(obj, keys[i], obj[keys[i]]);
}
};
/**
* Observe a list of Array items.
*/
Observer.prototype.observeArray = function observeArray (items) {
for (var i = 0, l = items.length; i < l; i++) {
observe(items[i]);
}
};
// helpers
/**
* Augment an target Object or Array by intercepting
* the prototype chain using __proto__
*/
function protoAugment (target, src, keys) {
/* eslint-disable no-proto */
target.__proto__ = src;
/* eslint-enable no-proto */
}
/**
* Augment an target Object or Array by defining
* hidden properties.
*/
/* istanbul ignore next */
function copyAugment (target, src, keys) {
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
def(target, key, src[key]);
}
}
/**
* Attempt to create an observer instance for a value,
* returns the new observer if successfully observed,
* or the existing observer if the value already has one.
*/
function observe (value, asRootData) {
if (!isObject(value)) {
return
}
var ob;
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
ob = value.__ob__;
} else if (
observerState.shouldConvert &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
!value._isVue
) {
ob = new Observer(value);
}
if (asRootData && ob) {
ob.vmCount++;
}
return ob
}
/**
* Define a reactive property on an Object.
*/
function defineReactive$$1 (
obj,
key,
val,
customSetter,
shallow
) {
var dep = new Dep();
var property = Object.getOwnPropertyDescriptor(obj, key);
if (property && property.configurable === false) {
return
}
// cater for pre-defined getter/setters
var getter = property && property.get;
var setter = property && property.set;
var childOb = !shallow && observe(val);
Object.defineProperty(obj, key, {
enumerable: true,
configurable: true,
get: function reactiveGetter () {
var value = getter ? getter.call(obj) : val;
if (Dep.target) {
dep.depend();
if (childOb) {
childOb.dep.depend();
}
if (Array.isArray(value)) {
dependArray(value);
}
}
return value
},
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
if (process.env.NODE_ENV !== 'production' && customSetter) {
customSetter();
}
if (setter) {
setter.call(obj, newVal);
} else {
val = newVal;
}
childOb = !shallow && observe(newVal);
dep.notify();
}
});
}
/**
* Set a property on an object. Adds the new property and
* triggers change notification if the property doesn't
* already exist.
*/
function set (target, key, val) {
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val
}
if (hasOwn(target, key)) {
target[key] = val;
return val
}
var ob = (target).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.'
);
return val
}
if (!ob) {
target[key] = val;
return val
}
defineReactive$$1(ob.value, key, val);
ob.dep.notify();
return val
}
/**
* Delete a property and trigger change if necessary.
*/
function del (target, key) {
if (Array.isArray(target) && isValidArrayIndex(key)) {
target.splice(key, 1);
return
}
var ob = (target).__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid deleting properties on a Vue instance or its root $data ' +
'- just set it to null.'
);
return
}
if (!hasOwn(target, key)) {
return
}
delete target[key];
if (!ob) {
return
}
ob.dep.notify();
}
/**
* Collect dependencies on array elements when the array is touched, since
* we cannot intercept array element access like property getters.
*/
function dependArray (value) {
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
e = value[i];
e && e.__ob__ && e.__ob__.dep.depend();
if (Array.isArray(e)) {
dependArray(e);
}
}
}
/* */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
* value into the final value.
*/
var strats = config.optionMergeStrategies;
/**
* Options with restrictions
*/
if (process.env.NODE_ENV !== 'production') {
strats.el = strats.propsData = function (parent, child, vm, key) {
if (!vm) {
warn(
"option \"" + key + "\" can only be used during instance " +
'creation with the `new` keyword.'
);
}
return defaultStrat(parent, child)
};
}
/**
* Helper that recursively merges two data objects together.
*/
function mergeData (to, from) {
if (!from) { return to }
var key, toVal, fromVal;
var keys = Object.keys(from);
for (var i = 0; i < keys.length; i++) {
key = keys[i];
toVal = to[key];
fromVal = from[key];
if (!hasOwn(to, key)) {
set(to, key, fromVal);
} else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
mergeData(toVal, fromVal);
}
}
return to
}
/**
* Data
*/
function mergeDataOrFn (
parentVal,
childVal,
vm
) {
if (!vm) {
// in a Vue.extend merge, both should be functions
if (!childVal) {
return parentVal
}
if (!parentVal) {
return childVal
}
// when parentVal & childVal are both present,
// we need to return a function that returns the
// merged result of both functions... no need to
// check if parentVal is a function here because
// it has to be a function to pass previous merges.
return function mergedDataFn () {
return mergeData(
typeof childVal === 'function' ? childVal.call(this) : childVal,
typeof parentVal === 'function' ? parentVal.call(this) : parentVal
)
}
} else if (parentVal || childVal) {
return function mergedInstanceDataFn () {
// instance merge
var instanceData = typeof childVal === 'function'
? childVal.call(vm)
: childVal;
var defaultData = typeof parentVal === 'function'
? parentVal.call(vm)
: undefined;
if (instanceData) {
return mergeData(instanceData, defaultData)
} else {
return defaultData
}
}
}
}
strats.data = function (
parentVal,
childVal,
vm
) {
if (!vm) {
if (childVal && typeof childVal !== 'function') {
process.env.NODE_ENV !== 'production' && warn(
'The "data" option should be a function ' +
'that returns a per-instance value in component ' +
'definitions.',
vm
);
return parentVal
}
return mergeDataOrFn.call(this, parentVal, childVal)
}
return mergeDataOrFn(parentVal, childVal, vm)
};
/**
* Hooks and props are merged as arrays.
*/
function mergeHook (
parentVal,
childVal
) {
return childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal
}
LIFECYCLE_HOOKS.forEach(function (hook) {
strats[hook] = mergeHook;
});
/**
* Assets
*
* When a vm is present (instance creation), we need to do
* a three-way merge between constructor options, instance
* options and parent options.
*/
function mergeAssets (parentVal, childVal) {
var res = Object.create(parentVal || null);
return childVal
? extend(res, childVal)
: res
}
ASSET_TYPES.forEach(function (type) {
strats[type + 's'] = mergeAssets;
});
/**
* Watchers.
*
* Watchers hashes should not overwrite one
* another, so we merge them as arrays.
*/
strats.watch = function (parentVal, childVal) {
// work around Firefox's Object.prototype.watch...
if (parentVal === nativeWatch) { parentVal = undefined; }
if (childVal === nativeWatch) { childVal = undefined; }
/* istanbul ignore if */
if (!childVal) { return Object.create(parentVal || null) }
if (!parentVal) { return childVal }
var ret = {};
extend(ret, parentVal);
for (var key in childVal) {
var parent = ret[key];
var child = childVal[key];
if (parent && !Array.isArray(parent)) {
parent = [parent];
}
ret[key] = parent
? parent.concat(child)
: Array.isArray(child) ? child : [child];
}
return ret
};
/**
* Other object hashes.
*/
strats.props =
strats.methods =
strats.inject =
strats.computed = function (parentVal, childVal) {
if (!parentVal) { return childVal }
var ret = Object.create(null);
extend(ret, parentVal);
if (childVal) { extend(ret, childVal); }
return ret
};
strats.provide = mergeDataOrFn;
/**
* Default strategy.
*/
var defaultStrat = function (parentVal, childVal) {
return childVal === undefined
? parentVal
: childVal
};
/**
* Validate component names
*/
function checkComponents (options) {
for (var key in options.components) {
var lower = key.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + key
);
}
}
}
/**
* Ensure all props option syntax are normalized into the
* Object-based format.
*/
function normalizeProps (options) {
var props = options.props;
if (!props) { return }
var res = {};
var i, val, name;
if (Array.isArray(props)) {
i = props.length;
while (i--) {
val = props[i];
if (typeof val === 'string') {
name = camelize(val);
res[name] = { type: null };
} else if (process.env.NODE_ENV !== 'production') {
warn('props must be strings when using array syntax.');
}
}
} else if (isPlainObject(props)) {
for (var key in props) {
val = props[key];
name = camelize(key);
res[name] = isPlainObject(val)
? val
: { type: val };
}
}
options.props = res;
}
/**
* Normalize all injections into Object-based format
*/
function normalizeInject (options) {
var inject = options.inject;
if (Array.isArray(inject)) {
var normalized = options.inject = {};
for (var i = 0; i < inject.length; i++) {
normalized[inject[i]] = inject[i];
}
}
}
/**
* Normalize raw function directives into object format.
*/
function normalizeDirectives (options) {
var dirs = options.directives;
if (dirs) {
for (var key in dirs) {
var def = dirs[key];
if (typeof def === 'function') {
dirs[key] = { bind: def, update: def };
}
}
}
}
/**
* Merge two option objects into a new one.
* Core utility used in both instantiation and inheritance.
*/
function mergeOptions (
parent,
child,
vm
) {
if (process.env.NODE_ENV !== 'production') {
checkComponents(child);
}
if (typeof child === 'function') {
child = child.options;
}
normalizeProps(child);
normalizeInject(child);
normalizeDirectives(child);
var extendsFrom = child.extends;
if (extendsFrom) {
parent = mergeOptions(parent, extendsFrom, vm);
}
if (child.mixins) {
for (var i = 0, l = child.mixins.length; i < l; i++) {
parent = mergeOptions(parent, child.mixins[i], vm);
}
}
var options = {};
var key;
for (key in parent) {
mergeField(key);
}
for (key in child) {
if (!hasOwn(parent, key)) {
mergeField(key);
}
}
function mergeField (key) {
var strat = strats[key] || defaultStrat;
options[key] = strat(parent[key], child[key], vm, key);
}
return options
}
/**
* Resolve an asset.
* This function is used because child instances need access
* to assets defined in its ancestor chain.
*/
function resolveAsset (
options,
type,
id,
warnMissing
) {
/* istanbul ignore if */
if (typeof id !== 'string') {
return
}
var assets = options[type];
// check local registration variations first
if (hasOwn(assets, id)) { return assets[id] }
var camelizedId = camelize(id);
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
var PascalCaseId = capitalize(camelizedId);
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
// fallback to prototype chain
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
warn(
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
options
);
}
return res
}
/* */
function validateProp (
key,
propOptions,
propsData,
vm
) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
var value = propsData[key];
// handle boolean props
if (isType(Boolean, prop.type)) {
if (absent && !hasOwn(prop, 'default')) {
value = false;
} else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
value = true;
}
}
// check default value
if (value === undefined) {
value = getPropDefaultValue(vm, prop, key);
// since the default value is a fresh copy,
// make sure to observe it.
var prevShouldConvert = observerState.shouldConvert;
observerState.shouldConvert = true;
observe(value);
observerState.shouldConvert = prevShouldConvert;
}
if (process.env.NODE_ENV !== 'production') {
assertProp(prop, key, value, vm, absent);
}
return value
}
/**
* Get the default value of a prop.
*/
function getPropDefaultValue (vm, prop, key) {
// no default, return undefined
if (!hasOwn(prop, 'default')) {
return undefined
}
var def = prop.default;
// warn against non-factory defaults for Object & Array
if (process.env.NODE_ENV !== 'production' && isObject(def)) {
warn(
'Invalid default value for prop "' + key + '": ' +
'Props with type Object/Array must use a factory function ' +
'to return the default value.',
vm
);
}
// the raw prop value was also undefined from previous render,
// return previous default value to avoid unnecessary watcher trigger
if (vm && vm.$options.propsData &&
vm.$options.propsData[key] === undefined &&
vm._props[key] !== undefined
) {
return vm._props[key]
}
// call factory function for non-Function types
// a value is Function if its prototype is function even across different execution context
return typeof def === 'function' && getType(prop.type) !== 'Function'
? def.call(vm)
: def
}
/**
* Assert whether a prop is valid.
*/
function assertProp (
prop,
name,
value,
vm,
absent
) {
if (prop.required && absent) {
warn(
'Missing required prop: "' + name + '"',
vm
);
return
}
if (value == null && !prop.required) {
return
}
var type = prop.type;
var valid = !type || type === true;
var expectedTypes = [];
if (type) {
if (!Array.isArray(type)) {
type = [type];
}
for (var i = 0; i < type.length && !valid; i++) {
var assertedType = assertType(value, type[i]);
expectedTypes.push(assertedType.expectedType || '');
valid = assertedType.valid;
}
}
if (!valid) {
warn(
'Invalid prop: type check failed for prop "' + name + '".' +
' Expected ' + expectedTypes.map(capitalize).join(', ') +
', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
vm
);
return
}
var validator = prop.validator;
if (validator) {
if (!validator(value)) {
warn(
'Invalid prop: custom validator check failed for prop "' + name + '".',
vm
);
}
}
}
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
function assertType (value, type) {
var valid;
var expectedType = getType(type);
if (simpleCheckRE.test(expectedType)) {
valid = typeof value === expectedType.toLowerCase();
} else if (expectedType === 'Object') {
valid = isPlainObject(value);
} else if (expectedType === 'Array') {
valid = Array.isArray(value);
} else {
valid = value instanceof type;
}
return {
valid: valid,
expectedType: expectedType
}
}
/**
* Use function string name to check built-in types,
* because a simple equality check will fail when running
* across different vms / iframes.
*/
function getType (fn) {
var match = fn && fn.toString().match(/^\s*function (\w+)/);
return match ? match[1] : ''
}
function isType (type, fn) {
if (!Array.isArray(fn)) {
return getType(fn) === getType(type)
}
for (var i = 0, len = fn.length; i < len; i++) {
if (getType(fn[i]) === getType(type)) {
return true
}
}
/* istanbul ignore next */
return false
}
/* */
/* not type checking this file because flow doesn't play well with Proxy */
var initProxy;
if (process.env.NODE_ENV !== 'production') {
var allowedGlobals = makeMap(
'Infinity,undefined,NaN,isFinite,isNaN,' +
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
'require' // for Webpack/Browserify
);
var warnNonPresent = function (target, key) {
warn(
"Property or method \"" + key + "\" is not defined on the instance but " +
"referenced during render. Make sure to declare reactive data " +
"properties in the data option.",
target
);
};
var hasProxy =
typeof Proxy !== 'undefined' &&
Proxy.toString().match(/native code/);
if (hasProxy) {
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
config.keyCodes = new Proxy(config.keyCodes, {
set: function set (target, key, value) {
if (isBuiltInModifier(key)) {
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
return false
} else {
target[key] = value;
return true
}
}
});
}
var hasHandler = {
has: function has (target, key) {
var has = key in target;
var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
if (!has && !isAllowed) {
warnNonPresent(target, key);
}
return has || !isAllowed
}
};
var getHandler = {
get: function get (target, key) {
if (typeof key === 'string' && !(key in target)) {
warnNonPresent(target, key);
}
return target[key]
}
};
initProxy = function initProxy (vm) {
if (hasProxy) {
// determine which proxy handler to use
var options = vm.$options;
var handlers = options.render && options.render._withStripped
? getHandler
: hasHandler;
vm._renderProxy = new Proxy(vm, handlers);
} else {
vm._renderProxy = vm;
}
};
}
var mark;
var measure;
if (process.env.NODE_ENV !== 'production') {
var perf = inBrowser && window.performance;
/* istanbul ignore if */
if (
perf &&
perf.mark &&
perf.measure &&
perf.clearMarks &&
perf.clearMeasures
) {
mark = function (tag) { return perf.mark(tag); };
measure = function (name, startTag, endTag) {
perf.measure(name, startTag, endTag);
perf.clearMarks(startTag);
perf.clearMarks(endTag);
perf.clearMeasures(name);
};
}
}
/* */
var VNode = function VNode (
tag,
data,
children,
text,
elm,
context,
componentOptions,
asyncFactory
) {
this.tag = tag;
this.data = data;
this.children = children;
this.text = text;
this.elm = elm;
this.ns = undefined;
this.context = context;
this.functionalContext = undefined;
this.key = data && data.key;
this.componentOptions = componentOptions;
this.componentInstance = undefined;
this.parent = undefined;
this.raw = false;
this.isStatic = false;
this.isRootInsert = true;
this.isComment = false;
this.isCloned = false;
this.isOnce = false;
this.asyncFactory = asyncFactory;
this.asyncMeta = undefined;
this.isAsyncPlaceholder = false;
};
var prototypeAccessors = { child: {} };
// DEPRECATED: alias for componentInstance for backwards compat.
/* istanbul ignore next */
prototypeAccessors.child.get = function () {
return this.componentInstance
};
Object.defineProperties( VNode.prototype, prototypeAccessors );
var createEmptyVNode = function (text) {
if ( text === void 0 ) text = '';
var node = new VNode();
node.text = text;
node.isComment = true;
return node
};
function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}
// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode (vnode) {
var cloned = new VNode(
vnode.tag,
vnode.data,
vnode.children,
vnode.text,
vnode.elm,
vnode.context,
vnode.componentOptions,
vnode.asyncFactory
);
cloned.ns = vnode.ns;
cloned.isStatic = vnode.isStatic;
cloned.key = vnode.key;
cloned.isComment = vnode.isComment;
cloned.isCloned = true;
return cloned
}
function cloneVNodes (vnodes) {
var len = vnodes.length;
var res = new Array(len);
for (var i = 0; i < len; i++) {
res[i] = cloneVNode(vnodes[i]);
}
return res
}
/* */
var normalizeEvent = cached(function (name) {
var passive = name.charAt(0) === '&';
name = passive ? name.slice(1) : name;
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
name = once$$1 ? name.slice(1) : name;
var capture = name.charAt(0) === '!';
name = capture ? name.slice(1) : name;
return {
name: name,
once: once$$1,
capture: capture,
passive: passive
}
});
function createFnInvoker (fns) {
function invoker () {
var arguments$1 = arguments;
var fns = invoker.fns;
if (Array.isArray(fns)) {
var cloned = fns.slice();
for (var i = 0; i < cloned.length; i++) {
cloned[i].apply(null, arguments$1);
}
} else {
// return handler return value for single handlers
return fns.apply(null, arguments)
}
}
invoker.fns = fns;
return invoker
}
function updateListeners (
on,
oldOn,
add,
remove$$1,
vm
) {
var name, cur, old, event;
for (name in on) {
cur = on[name];
old = oldOn[name];
event = normalizeEvent(name);
if (isUndef(cur)) {
process.env.NODE_ENV !== 'production' && warn(
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
vm
);
} else if (isUndef(old)) {
if (isUndef(cur.fns)) {
cur = on[name] = createFnInvoker(cur);
}
add(event.name, cur, event.once, event.capture, event.passive);
} else if (cur !== old) {
old.fns = cur;
on[name] = old;
}
}
for (name in oldOn) {
if (isUndef(on[name])) {
event = normalizeEvent(name);
remove$$1(event.name, oldOn[name], event.capture);
}
}
}
/* */
function mergeVNodeHook (def, hookKey, hook) {
var invoker;
var oldHook = def[hookKey];
function wrappedHook () {
hook.apply(this, arguments);
// important: remove merged hook to ensure it's called only once
// and prevent memory leak
remove(invoker.fns, wrappedHook);
}
if (isUndef(oldHook)) {
// no existing hook
invoker = createFnInvoker([wrappedHook]);
} else {
/* istanbul ignore if */
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
// already a merged invoker
invoker = oldHook;
invoker.fns.push(wrappedHook);
} else {
// existing plain hook
invoker = createFnInvoker([oldHook, wrappedHook]);
}
}
invoker.merged = true;
def[hookKey] = invoker;
}
/* */
function extractPropsFromVNodeData (
data,
Ctor,
tag
) {
// we are only extracting raw values here.
// validation and default values are handled in the child
// component itself.
var propOptions = Ctor.options.props;
if (isUndef(propOptions)) {
return
}
var res = {};
var attrs = data.attrs;
var props = data.props;
if (isDef(attrs) || isDef(props)) {
for (var key in propOptions) {
var altKey = hyphenate(key);
if (process.env.NODE_ENV !== 'production') {
var keyInLowerCase = key.toLowerCase();
if (
key !== keyInLowerCase &&
attrs && hasOwn(attrs, keyInLowerCase)
) {
tip(
"Prop \"" + keyInLowerCase + "\" is passed to component " +
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
" \"" + key + "\". " +
"Note that HTML attributes are case-insensitive and camelCased " +
"props need to use their kebab-case equivalents when using in-DOM " +
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
);
}
}
checkProp(res, props, key, altKey, true) ||
checkProp(res, attrs, key, altKey, false);
}
}
return res
}
function checkProp (
res,
hash,
key,
altKey,
preserve
) {
if (isDef(hash)) {
if (hasOwn(hash, key)) {
res[key] = hash[key];
if (!preserve) {
delete hash[key];
}
return true
} else if (hasOwn(hash, altKey)) {
res[key] = hash[altKey];
if (!preserve) {
delete hash[altKey];
}
return true
}
}
return false
}
/* */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
// For plain HTML markup, normalization can be completely skipped because the
// generated render function is guaranteed to return Array<VNode>. There are
// two cases where extra normalization is needed:
// 1. When the children contains components - because a functional component
// may return an Array instead of a single root. In this case, just a simple
// normalization is needed - if any child is an Array, we flatten the whole
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
// because functional components already normalize their own children.
function simpleNormalizeChildren (children) {
for (var i = 0; i < children.length; i++) {
if (Array.isArray(children[i])) {
return Array.prototype.concat.apply([], children)
}
}
return children
}
// 2. When the children contains constructs that always generated nested Arrays,
// e.g. <template>, <slot>, v-for, or when the children is provided by user
// with hand-written render functions / JSX. In such cases a full normalization
// is needed to cater to all possible types of children values.
function normalizeChildren (children) {
return isPrimitive(children)
? [createTextVNode(children)]
: Array.isArray(children)
? normalizeArrayChildren(children)
: undefined
}
function isTextNode (node) {
return isDef(node) && isDef(node.text) && isFalse(node.isComment)
}
function normalizeArrayChildren (children, nestedIndex) {
var res = [];
var i, c, last;
for (i = 0; i < children.length; i++) {
c = children[i];
if (isUndef(c) || typeof c === 'boolean') { continue }
last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
} else if (isPrimitive(c)) {
if (isTextNode(last)) {
// merge adjacent text nodes
// this is necessary for SSR hydration because text nodes are
// essentially merged when rendered to HTML strings
(last).text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else {
if (isTextNode(c) && isTextNode(last)) {
// merge adjacent text nodes
res[res.length - 1] = createTextVNode(last.text + c.text);
} else {
// default key for nested array children (likely generated by v-for)
if (isTrue(children._isVList) &&
isDef(c.tag) &&
isUndef(c.key) &&
isDef(nestedIndex)) {
c.key = "__vlist" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
/* */
function ensureCtor (comp, base) {
if (comp.__esModule && comp.default) {
comp = comp.default;
}
return isObject(comp)
? base.extend(comp)
: comp
}
function createAsyncPlaceholder (
factory,
data,
context,
children,
tag
) {
var node = createEmptyVNode();
node.asyncFactory = factory;
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
return node
}
function resolveAsyncComponent (
factory,
baseCtor,
context
) {
if (isTrue(factory.error) && isDef(factory.errorComp)) {
return factory.errorComp
}
if (isDef(factory.resolved)) {
return factory.resolved
}
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
return factory.loadingComp
}
if (isDef(factory.contexts)) {
// already pending
factory.contexts.push(context);
} else {
var contexts = factory.contexts = [context];
var sync = true;
var forceRender = function () {
for (var i = 0, l = contexts.length; i < l; i++) {
contexts[i].$forceUpdate();
}
};
var resolve = once(function (res) {
// cache resolved
factory.resolved = ensureCtor(res, baseCtor);
// invoke callbacks only if this is not a synchronous resolve
// (async resolves are shimmed as synchronous during SSR)
if (!sync) {
forceRender();
}
});
var reject = once(function (reason) {
process.env.NODE_ENV !== 'production' && warn(
"Failed to resolve async component: " + (String(factory)) +
(reason ? ("\nReason: " + reason) : '')
);
if (isDef(factory.errorComp)) {
factory.error = true;
forceRender();
}
});
var res = factory(resolve, reject);
if (isObject(res)) {
if (typeof res.then === 'function') {
// () => Promise
if (isUndef(factory.resolved)) {
res.then(resolve, reject);
}
} else if (isDef(res.component) && typeof res.component.then === 'function') {
res.component.then(resolve, reject);
if (isDef(res.error)) {
factory.errorComp = ensureCtor(res.error, baseCtor);
}
if (isDef(res.loading)) {
factory.loadingComp = ensureCtor(res.loading, baseCtor);
if (res.delay === 0) {
factory.loading = true;
} else {
setTimeout(function () {
if (isUndef(factory.resolved) && isUndef(factory.error)) {
factory.loading = true;
forceRender();
}
}, res.delay || 200);
}
}
if (isDef(res.timeout)) {
setTimeout(function () {
if (isUndef(factory.resolved)) {
reject(
process.env.NODE_ENV !== 'production'
? ("timeout (" + (res.timeout) + "ms)")
: null
);
}
}, res.timeout);
}
}
}
sync = false;
// return in case resolved synchronously
return factory.loading
? factory.loadingComp
: factory.resolved
}
}
/* */
function getFirstComponentChild (children) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
var c = children[i];
if (isDef(c) && isDef(c.componentOptions)) {
return c
}
}
}
}
/* */
/* */
function initEvents (vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
// init parent attached events
var listeners = vm.$options._parentListeners;
if (listeners) {
updateComponentListeners(vm, listeners);
}
}
var target;
function add (event, fn, once$$1) {
if (once$$1) {
target.$once(event, fn);
} else {
target.$on(event, fn);
}
}
function remove$1 (event, fn) {
target.$off(event, fn);
}
function updateComponentListeners (
vm,
listeners,
oldListeners
) {
target = vm;
updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
}
function eventsMixin (Vue) {
var hookRE = /^hook:/;
Vue.prototype.$on = function (event, fn) {
var this$1 = this;
var vm = this;
if (Array.isArray(event)) {
for (var i = 0, l = event.length; i < l; i++) {
this$1.$on(event[i], fn);
}
} else {
(vm._events[event] || (vm._events[event] = [])).push(fn);
// optimize hook:event cost by using a boolean flag marked at registration
// instead of a hash lookup
if (hookRE.test(event)) {
vm._hasHookEvent = true;
}
}
return vm
};
Vue.prototype.$once = function (event, fn) {
var vm = this;
function on () {
vm.$off(event, on);
fn.apply(vm, arguments);
}
on.fn = fn;
vm.$on(event, on);
return vm
};
Vue.prototype.$off = function (event, fn) {
var this$1 = this;
var vm = this;
// all
if (!arguments.length) {
vm._events = Object.create(null);
return vm
}
// array of events
if (Array.isArray(event)) {
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
this$1.$off(event[i$1], fn);
}
return vm
}
// specific event
var cbs = vm._events[event];
if (!cbs) {
return vm
}
if (arguments.length === 1) {
vm._events[event] = null;
return vm
}
// specific handler
var cb;
var i = cbs.length;
while (i--) {
cb = cbs[i];
if (cb === fn || cb.fn === fn) {
cbs.splice(i, 1);
break
}
}
return vm
};
Vue.prototype.$emit = function (event) {
var vm = this;
if (process.env.NODE_ENV !== 'production') {
var lowerCaseEvent = event.toLowerCase();
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
tip(
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
"Note that HTML attributes are case-insensitive and you cannot use " +
"v-on to listen to camelCase events when using in-DOM templates. " +
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
);
}
}
var cbs = vm._events[event];
if (cbs) {
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
var args = toArray(arguments, 1);
for (var i = 0, l = cbs.length; i < l; i++) {
try {
cbs[i].apply(vm, args);
} catch (e) {
handleError(e, vm, ("event handler for \"" + event + "\""));
}
}
}
return vm
};
}
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
function resolveSlots (
children,
context
) {
var slots = {};
if (!children) {
return slots
}
var defaultSlot = [];
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i];
// named slots should only be respected if the vnode was rendered in the
// same context.
if ((child.context === context || child.functionalContext === context) &&
child.data && child.data.slot != null
) {
var name = child.data.slot;
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
} else {
slot.push(child);
}
} else {
defaultSlot.push(child);
}
}
// ignore whitespace
if (!defaultSlot.every(isWhitespace)) {
slots.default = defaultSlot;
}
return slots
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
}
function resolveScopedSlots (
fns, // see flow/vnode
res
) {
res = res || {};
for (var i = 0; i < fns.length; i++) {
if (Array.isArray(fns[i])) {
resolveScopedSlots(fns[i], res);
} else {
res[fns[i].key] = fns[i].fn;
}
}
return res
}
/* */
var activeInstance = null;
var isUpdatingChildComponent = false;
function initLifecycle (vm) {
var options = vm.$options;
// locate first non-abstract parent
var parent = options.parent;
if (parent && !options.abstract) {
while (parent.$options.abstract && parent.$parent) {
parent = parent.$parent;
}
parent.$children.push(vm);
}
vm.$parent = parent;
vm.$root = parent ? parent.$root : vm;
vm.$children = [];
vm.$refs = {};
vm._watcher = null;
vm._inactive = null;
vm._directInactive = false;
vm._isMounted = false;
vm._isDestroyed = false;
vm._isBeingDestroyed = false;
}
function lifecycleMixin (Vue) {
Vue.prototype._update = function (vnode, hydrating) {
var vm = this;
if (vm._isMounted) {
callHook(vm, 'beforeUpdate');
}
var prevEl = vm.$el;
var prevVnode = vm._vnode;
var prevActiveInstance = activeInstance;
activeInstance = vm;
vm._vnode = vnode;
// Vue.prototype.__patch__ is injected in entry points
// based on the rendering backend used.
if (!prevVnode) {
// initial render
vm.$el = vm.__patch__(
vm.$el, vnode, hydrating, false /* removeOnly */,
vm.$options._parentElm,
vm.$options._refElm
);
// no need for the ref nodes after initial patch
// this prevents keeping a detached DOM tree in memory (#5851)
vm.$options._parentElm = vm.$options._refElm = null;
} else {
// updates
vm.$el = vm.__patch__(prevVnode, vnode);
}
activeInstance = prevActiveInstance;
// update __vue__ reference
if (prevEl) {
prevEl.__vue__ = null;
}
if (vm.$el) {
vm.$el.__vue__ = vm;
}
// if parent is an HOC, update its $el as well
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
vm.$parent.$el = vm.$el;
}
// updated hook is called by the scheduler to ensure that children are
// updated in a parent's updated hook.
};
Vue.prototype.$forceUpdate = function () {
var vm = this;
if (vm._watcher) {
vm._watcher.update();
}
};
Vue.prototype.$destroy = function () {
var vm = this;
if (vm._isBeingDestroyed) {
return
}
callHook(vm, 'beforeDestroy');
vm._isBeingDestroyed = true;
// remove self from parent
var parent = vm.$parent;
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
remove(parent.$children, vm);
}
// teardown watchers
if (vm._watcher) {
vm._watcher.teardown();
}
var i = vm._watchers.length;
while (i--) {
vm._watchers[i].teardown();
}
// remove reference from data ob
// frozen object may not have observer.
if (vm._data.__ob__) {
vm._data.__ob__.vmCount--;
}
// call the last hook...
vm._isDestroyed = true;
// invoke destroy hooks on current rendered tree
vm.__patch__(vm._vnode, null);
// fire destroyed hook
callHook(vm, 'destroyed');
// turn off all instance listeners.
vm.$off();
// remove __vue__ reference
if (vm.$el) {
vm.$el.__vue__ = null;
}
};
}
function mountComponent (
vm,
el,
hydrating
) {
vm.$el = el;
if (!vm.$options.render) {
vm.$options.render = createEmptyVNode;
if (process.env.NODE_ENV !== 'production') {
/* istanbul ignore if */
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
vm.$options.el || el) {
warn(
'You are using the runtime-only build of Vue where the template ' +
'compiler is not available. Either pre-compile the templates into ' +
'render functions, or use the compiler-included build.',
vm
);
} else {
warn(
'Failed to mount component: template or render function not defined.',
vm
);
}
}
}
callHook(vm, 'beforeMount');
var updateComponent;
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
updateComponent = function () {
var name = vm._name;
var id = vm._uid;
var startTag = "vue-perf-start:" + id;
var endTag = "vue-perf-end:" + id;
mark(startTag);
var vnode = vm._render();
mark(endTag);
measure((name + " render"), startTag, endTag);
mark(startTag);
vm._update(vnode, hydrating);
mark(endTag);
measure((name + " patch"), startTag, endTag);
};
} else {
updateComponent = function () {
vm._update(vm._render(), hydrating);
};
}
vm._watcher = new Watcher(vm, updateComponent, noop);
hydrating = false;
// manually mounted instance, call mounted on self
// mounted is called for render-created child components in its inserted hook
if (vm.$vnode == null) {
vm._isMounted = true;
callHook(vm, 'mounted');
}
return vm
}
function updateChildComponent (
vm,
propsData,
listeners,
parentVnode,
renderChildren
) {
if (process.env.NODE_ENV !== 'production') {
isUpdatingChildComponent = true;
}
// determine whether component has slot children
// we need to do this before overwriting $options._renderChildren
var hasChildren = !!(
renderChildren || // has new static slots
vm.$options._renderChildren || // has old static slots
parentVnode.data.scopedSlots || // has new scoped slots
vm.$scopedSlots !== emptyObject // has old scoped slots
);
vm.$options._parentVnode = parentVnode;
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
if (vm._vnode) { // update child tree's parent
vm._vnode.parent = parentVnode;
}
vm.$options._renderChildren = renderChildren;
// update $attrs and $listensers hash
// these are also reactive so they may trigger child update if the child
// used them during render
vm.$attrs = parentVnode.data && parentVnode.data.attrs;
vm.$listeners = listeners;
// update props
if (propsData && vm.$options.props) {
observerState.shouldConvert = false;
var props = vm._props;
var propKeys = vm.$options._propKeys || [];
for (var i = 0; i < propKeys.length; i++) {
var key = propKeys[i];
props[key] = validateProp(key, vm.$options.props, propsData, vm);
}
observerState.shouldConvert = true;
// keep a copy of raw propsData
vm.$options.propsData = propsData;
}
// update listeners
if (listeners) {
var oldListeners = vm.$options._parentListeners;
vm.$options._parentListeners = listeners;
updateComponentListeners(vm, listeners, oldListeners);
}
// resolve slots + force update if has children
if (hasChildren) {
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
vm.$forceUpdate();
}
if (process.env.NODE_ENV !== 'production') {
isUpdatingChildComponent = false;
}
}
function isInInactiveTree (vm) {
while (vm && (vm = vm.$parent)) {
if (vm._inactive) { return true }
}
return false
}
function activateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = false;
if (isInInactiveTree(vm)) {
return
}
} else if (vm._directInactive) {
return
}
if (vm._inactive || vm._inactive === null) {
vm._inactive = false;
for (var i = 0; i < vm.$children.length; i++) {
activateChildComponent(vm.$children[i]);
}
callHook(vm, 'activated');
}
}
function deactivateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = true;
if (isInInactiveTree(vm)) {
return
}
}
if (!vm._inactive) {
vm._inactive = true;
for (var i = 0; i < vm.$children.length; i++) {
deactivateChildComponent(vm.$children[i]);
}
callHook(vm, 'deactivated');
}
}
function callHook (vm, hook) {
var handlers = vm.$options[hook];
if (handlers) {
for (var i = 0, j = handlers.length; i < j; i++) {
try {
handlers[i].call(vm);
} catch (e) {
handleError(e, vm, (hook + " hook"));
}
}
}
if (vm._hasHookEvent) {
vm.$emit('hook:' + hook);
}
}
/* */
var MAX_UPDATE_COUNT = 100;
var queue = [];
var activatedChildren = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index = 0;
/**
* Reset the scheduler's state.
*/
function resetSchedulerState () {
index = queue.length = activatedChildren.length = 0;
has = {};
if (process.env.NODE_ENV !== 'production') {
circular = {};
}
waiting = flushing = false;
}
/**
* Flush both queues and run the watchers.
*/
function flushSchedulerQueue () {
flushing = true;
var watcher, id;
// Sort queue before flush.
// This ensures that:
// 1. Components are updated from parent to child. (because parent is always
// created before the child)
// 2. A component's user watchers are run before its render watcher (because
// user watchers are created before the render watcher)
// 3. If a component is destroyed during a parent component's watcher run,
// its watchers can be skipped.
queue.sort(function (a, b) { return a.id - b.id; });
// do not cache length because more watchers might be pushed
// as we run existing watchers
for (index = 0; index < queue.length; index++) {
watcher = queue[index];
id = watcher.id;
has[id] = null;
watcher.run();
// in dev build, check and stop circular updates.
if (process.env.NODE_ENV !== 'production' && has[id] != null) {
circular[id] = (circular[id] || 0) + 1;
if (circular[id] > MAX_UPDATE_COUNT) {
warn(
'You may have an infinite update loop ' + (
watcher.user
? ("in watcher with expression \"" + (watcher.expression) + "\"")
: "in a component render function."
),
watcher.vm
);
break
}
}
}
// keep copies of post queues before resetting state
var activatedQueue = activatedChildren.slice();
var updatedQueue = queue.slice();
resetSchedulerState();
// call component updated and activated hooks
callActivatedHooks(activatedQueue);
callUpdatedHooks(updatedQueue);
// devtool hook
/* istanbul ignore if */
if (devtools && config.devtools) {
devtools.emit('flush');
}
}
function callUpdatedHooks (queue) {
var i = queue.length;
while (i--) {
var watcher = queue[i];
var vm = watcher.vm;
if (vm._watcher === watcher && vm._isMounted) {
callHook(vm, 'updated');
}
}
}
/**
* Queue a kept-alive component that was activated during patch.
* The queue will be processed after the entire tree has been patched.
*/
function queueActivatedComponent (vm) {
// setting _inactive to false here so that a render function can
// rely on checking whether it's in an inactive tree (e.g. router-view)
vm._inactive = false;
activatedChildren.push(vm);
}
function callActivatedHooks (queue) {
for (var i = 0; i < queue.length; i++) {
queue[i]._inactive = true;
activateChildComponent(queue[i], true /* true */);
}
}
/**
* Push a watcher into the watcher queue.
* Jobs with duplicate IDs will be skipped unless it's
* pushed when the queue is being flushed.
*/
function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length - 1;
while (i > index && queue[i].id > watcher.id) {
i--;
}
queue.splice(i + 1, 0, watcher);
}
// queue the flush
if (!waiting) {
waiting = true;
nextTick(flushSchedulerQueue);
}
}
}
/* */
var uid$2 = 0;
/**
* A watcher parses an expression, collects dependencies,
* and fires callback when the expression value changes.
* This is used for both the $watch() api and directives.
*/
var Watcher = function Watcher (
vm,
expOrFn,
cb,
options
) {
this.vm = vm;
vm._watchers.push(this);
// options
if (options) {
this.deep = !!options.deep;
this.user = !!options.user;
this.lazy = !!options.lazy;
this.sync = !!options.sync;
} else {
this.deep = this.user = this.lazy = this.sync = false;
}
this.cb = cb;
this.id = ++uid$2; // uid for batching
this.active = true;
this.dirty = this.lazy; // for lazy watchers
this.deps = [];
this.newDeps = [];
this.depIds = new _Set();
this.newDepIds = new _Set();
this.expression = process.env.NODE_ENV !== 'production'
? expOrFn.toString()
: '';
// parse expression for getter
if (typeof expOrFn === 'function') {
this.getter = expOrFn;
} else {
this.getter = parsePath(expOrFn);
if (!this.getter) {
this.getter = function () {};
process.env.NODE_ENV !== 'production' && warn(
"Failed watching path: \"" + expOrFn + "\" " +
'Watcher only accepts simple dot-delimited paths. ' +
'For full control, use a function instead.',
vm
);
}
}
this.value = this.lazy
? undefined
: this.get();
};
/**
* Evaluate the getter, and re-collect dependencies.
*/
Watcher.prototype.get = function get () {
pushTarget(this);
var value;
var vm = this.vm;
try {
value = this.getter.call(vm, vm);
} catch (e) {
if (this.user) {
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
} else {
throw e
}
} finally {
// "touch" every property so they are all tracked as
// dependencies for deep watching
if (this.deep) {
traverse(value);
}
popTarget();
this.cleanupDeps();
}
return value
};
/**
* Add a dependency to this directive.
*/
Watcher.prototype.addDep = function addDep (dep) {
var id = dep.id;
if (!this.newDepIds.has(id)) {
this.newDepIds.add(id);
this.newDeps.push(dep);
if (!this.depIds.has(id)) {
dep.addSub(this);
}
}
};
/**
* Clean up for dependency collection.
*/
Watcher.prototype.cleanupDeps = function cleanupDeps () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
var dep = this$1.deps[i];
if (!this$1.newDepIds.has(dep.id)) {
dep.removeSub(this$1);
}
}
var tmp = this.depIds;
this.depIds = this.newDepIds;
this.newDepIds = tmp;
this.newDepIds.clear();
tmp = this.deps;
this.deps = this.newDeps;
this.newDeps = tmp;
this.newDeps.length = 0;
};
/**
* Subscriber interface.
* Will be called when a dependency changes.
*/
Watcher.prototype.update = function update () {
/* istanbul ignore else */
if (this.lazy) {
this.dirty = true;
} else if (this.sync) {
this.run();
} else {
queueWatcher(this);
}
};
/**
* Scheduler job interface.
* Will be called by the scheduler.
*/
Watcher.prototype.run = function run () {
if (this.active) {
var value = this.get();
if (
value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
isObject(value) ||
this.deep
) {
// set new value
var oldValue = this.value;
this.value = value;
if (this.user) {
try {
this.cb.call(this.vm, value, oldValue);
} catch (e) {
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
}
} else {
this.cb.call(this.vm, value, oldValue);
}
}
}
};
/**
* Evaluate the value of the watcher.
* This only gets called for lazy watchers.
*/
Watcher.prototype.evaluate = function evaluate () {
this.value = this.get();
this.dirty = false;
};
/**
* Depend on all deps collected by this watcher.
*/
Watcher.prototype.depend = function depend () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
this$1.deps[i].depend();
}
};
/**
* Remove self from all dependencies' subscriber list.
*/
Watcher.prototype.teardown = function teardown () {
var this$1 = this;
if (this.active) {
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
if (!this.vm._isBeingDestroyed) {
remove(this.vm._watchers, this);
}
var i = this.deps.length;
while (i--) {
this$1.deps[i].removeSub(this$1);
}
this.active = false;
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
get: noop,
set: noop
};
function proxy (target, sourceKey, key) {
sharedPropertyDefinition.get = function proxyGetter () {
return this[sourceKey][key]
};
sharedPropertyDefinition.set = function proxySetter (val) {
this[sourceKey][key] = val;
};
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function initState (vm) {
vm._watchers = [];
var opts = vm.$options;
if (opts.props) { initProps(vm, opts.props); }
if (opts.methods) { initMethods(vm, opts.methods); }
if (opts.data) {
initData(vm);
} else {
observe(vm._data = {}, true /* asRootData */);
}
if (opts.computed) { initComputed(vm, opts.computed); }
if (opts.watch && opts.watch !== nativeWatch) {
initWatch(vm, opts.watch);
}
}
function checkOptionType (vm, name) {
var option = vm.$options[name];
if (!isPlainObject(option)) {
warn(
("component option \"" + name + "\" should be an object."),
vm
);
}
}
function initProps (vm, propsOptions) {
var propsData = vm.$options.propsData || {};
var props = vm._props = {};
// cache prop keys so that future props updates can iterate using Array
// instead of dynamic object key enumeration.
var keys = vm.$options._propKeys = [];
var isRoot = !vm.$parent;
// root instance props should be converted
observerState.shouldConvert = isRoot;
var loop = function ( key ) {
keys.push(key);
var value = validateProp(key, propsOptions, propsData, vm);
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
if (isReservedAttribute(key) || config.isReservedAttr(key)) {
warn(
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
vm
);
}
defineReactive$$1(props, key, value, function () {
if (vm.$parent && !isUpdatingChildComponent) {
warn(
"Avoid mutating a prop directly since the value will be " +
"overwritten whenever the parent component re-renders. " +
"Instead, use a data or computed property based on the prop's " +
"value. Prop being mutated: \"" + key + "\"",
vm
);
}
});
} else {
defineReactive$$1(props, key, value);
}
// static props are already proxied on the component's prototype
// during Vue.extend(). We only need to proxy props defined at
// instantiation here.
if (!(key in vm)) {
proxy(vm, "_props", key);
}
};
for (var key in propsOptions) loop( key );
observerState.shouldConvert = true;
}
function initData (vm) {
var data = vm.$options.data;
data = vm._data = typeof data === 'function'
? getData(data, vm)
: data || {};
if (!isPlainObject(data)) {
data = {};
process.env.NODE_ENV !== 'production' && warn(
'data functions should return an object:\n' +
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
vm
);
}
// proxy data on instance
var keys = Object.keys(data);
var props = vm.$options.props;
var methods = vm.$options.methods;
var i = keys.length;
while (i--) {
var key = keys[i];
if (process.env.NODE_ENV !== 'production') {
if (methods && hasOwn(methods, key)) {
warn(
("method \"" + key + "\" has already been defined as a data property."),
vm
);
}
}
if (props && hasOwn(props, key)) {
process.env.NODE_ENV !== 'production' && warn(
"The data property \"" + key + "\" is already declared as a prop. " +
"Use prop default value instead.",
vm
);
} else if (!isReserved(key)) {
proxy(vm, "_data", key);
}
}
// observe data
observe(data, true /* asRootData */);
}
function getData (data, vm) {
try {
return data.call(vm)
} catch (e) {
handleError(e, vm, "data()");
return {}
}
}
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'computed');
var watchers = vm._computedWatchers = Object.create(null);
for (var key in computed) {
var userDef = computed[key];
var getter = typeof userDef === 'function' ? userDef : userDef.get;
if (process.env.NODE_ENV !== 'production' && getter == null) {
warn(
("Getter is missing for computed property \"" + key + "\"."),
vm
);
}
// create internal watcher for the computed property.
watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
// component-defined computed properties are already defined on the
// component prototype. We only need to define computed properties defined
// at instantiation here.
if (!(key in vm)) {
defineComputed(vm, key, userDef);
} else if (process.env.NODE_ENV !== 'production') {
if (key in vm.$data) {
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
} else if (vm.$options.props && key in vm.$options.props) {
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
}
}
}
}
function defineComputed (target, key, userDef) {
if (typeof userDef === 'function') {
sharedPropertyDefinition.get = createComputedGetter(key);
sharedPropertyDefinition.set = noop;
} else {
sharedPropertyDefinition.get = userDef.get
? userDef.cache !== false
? createComputedGetter(key)
: userDef.get
: noop;
sharedPropertyDefinition.set = userDef.set
? userDef.set
: noop;
}
if (process.env.NODE_ENV !== 'production' &&
sharedPropertyDefinition.set === noop) {
sharedPropertyDefinition.set = function () {
warn(
("Computed property \"" + key + "\" was assigned to but it has no setter."),
this
);
};
}
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function createComputedGetter (key) {
return function computedGetter () {
var watcher = this._computedWatchers && this._computedWatchers[key];
if (watcher) {
if (watcher.dirty) {
watcher.evaluate();
}
if (Dep.target) {
watcher.depend();
}
return watcher.value
}
}
}
function initMethods (vm, methods) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'methods');
var props = vm.$options.props;
for (var key in methods) {
vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
if (process.env.NODE_ENV !== 'production') {
if (methods[key] == null) {
warn(
"method \"" + key + "\" has an undefined value in the component definition. " +
"Did you reference the function correctly?",
vm
);
}
if (props && hasOwn(props, key)) {
warn(
("method \"" + key + "\" has already been defined as a prop."),
vm
);
}
}
}
}
function initWatch (vm, watch) {
process.env.NODE_ENV !== 'production' && checkOptionType(vm, 'watch');
for (var key in watch) {
var handler = watch[key];
if (Array.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
createWatcher(vm, key, handler[i]);
}
} else {
createWatcher(vm, key, handler);
}
}
}
function createWatcher (
vm,
keyOrFn,
handler,
options
) {
if (isPlainObject(handler)) {
options = handler;
handler = handler.handler;
}
if (typeof handler === 'string') {
handler = vm[handler];
}
return vm.$watch(keyOrFn, handler, options)
}
function stateMixin (Vue) {
// flow somehow has problems with directly declared definition object
// when using Object.defineProperty, so we have to procedurally build up
// the object here.
var dataDef = {};
dataDef.get = function () { return this._data };
var propsDef = {};
propsDef.get = function () { return this._props };
if (process.env.NODE_ENV !== 'production') {
dataDef.set = function (newData) {
warn(
'Avoid replacing instance root $data. ' +
'Use nested data properties instead.',
this
);
};
propsDef.set = function () {
warn("$props is readonly.", this);
};
}
Object.defineProperty(Vue.prototype, '$data', dataDef);
Object.defineProperty(Vue.prototype, '$props', propsDef);
Vue.prototype.$set = set;
Vue.prototype.$delete = del;
Vue.prototype.$watch = function (
expOrFn,
cb,
options
) {
var vm = this;
if (isPlainObject(cb)) {
return createWatcher(vm, expOrFn, cb, options)
}
options = options || {};
options.user = true;
var watcher = new Watcher(vm, expOrFn, cb, options);
if (options.immediate) {
cb.call(vm, watcher.value);
}
return function unwatchFn () {
watcher.teardown();
}
};
}
/* */
function initProvide (vm) {
var provide = vm.$options.provide;
if (provide) {
vm._provided = typeof provide === 'function'
? provide.call(vm)
: provide;
}
}
function initInjections (vm) {
var result = resolveInject(vm.$options.inject, vm);
if (result) {
observerState.shouldConvert = false;
Object.keys(result).forEach(function (key) {
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
defineReactive$$1(vm, key, result[key], function () {
warn(
"Avoid mutating an injected value directly since the changes will be " +
"overwritten whenever the provided component re-renders. " +
"injection being mutated: \"" + key + "\"",
vm
);
});
} else {
defineReactive$$1(vm, key, result[key]);
}
});
observerState.shouldConvert = true;
}
}
function resolveInject (inject, vm) {
if (inject) {
// inject is :any because flow is not smart enough to figure out cached
var result = Object.create(null);
var keys = hasSymbol
? Reflect.ownKeys(inject)
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var provideKey = inject[key];
var source = vm;
while (source) {
if (source._provided && provideKey in source._provided) {
result[key] = source._provided[provideKey];
break
}
source = source.$parent;
}
if (process.env.NODE_ENV !== 'production' && !source) {
warn(("Injection \"" + key + "\" not found"), vm);
}
}
return result
}
}
/* */
function createFunctionalComponent (
Ctor,
propsData,
data,
context,
children
) {
var props = {};
var propOptions = Ctor.options.props;
if (isDef(propOptions)) {
for (var key in propOptions) {
props[key] = validateProp(key, propOptions, propsData || {});
}
} else {
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
if (isDef(data.props)) { mergeProps(props, data.props); }
}
// ensure the createElement function in functional components
// gets a unique context - this is necessary for correct named slot check
var _context = Object.create(context);
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
var vnode = Ctor.options.render.call(null, h, {
data: data,
props: props,
children: children,
parent: context,
listeners: data.on || {},
injections: resolveInject(Ctor.options.inject, context),
slots: function () { return resolveSlots(children, context); }
});
if (vnode instanceof VNode) {
vnode.functionalContext = context;
vnode.functionalOptions = Ctor.options;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
}
function mergeProps (to, from) {
for (var key in from) {
to[camelize(key)] = from[key];
}
}
/* */
// hooks to be invoked on component VNodes during patch
var componentVNodeHooks = {
init: function init (
vnode,
hydrating,
parentElm,
refElm
) {
if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
var child = vnode.componentInstance = createComponentInstanceForVnode(
vnode,
activeInstance,
parentElm,
refElm
);
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
} else if (vnode.data.keepAlive) {
// kept-alive components, treat as a patch
var mountedNode = vnode; // work around flow
componentVNodeHooks.prepatch(mountedNode, mountedNode);
}
},
prepatch: function prepatch (oldVnode, vnode) {
var options = vnode.componentOptions;
var child = vnode.componentInstance = oldVnode.componentInstance;
updateChildComponent(
child,
options.propsData, // updated props
options.listeners, // updated listeners
vnode, // new parent vnode
options.children // new children
);
},
insert: function insert (vnode) {
var context = vnode.context;
var componentInstance = vnode.componentInstance;
if (!componentInstance._isMounted) {
componentInstance._isMounted = true;
callHook(componentInstance, 'mounted');
}
if (vnode.data.keepAlive) {
if (context._isMounted) {
// vue-router#1212
// During updates, a kept-alive component's child components may
// change, so directly walking the tree here may call activated hooks
// on incorrect children. Instead we push them into a queue which will
// be processed after the whole patch process ended.
queueActivatedComponent(componentInstance);
} else {
activateChildComponent(componentInstance, true /* direct */);
}
}
},
destroy: function destroy (vnode) {
var componentInstance = vnode.componentInstance;
if (!componentInstance._isDestroyed) {
if (!vnode.data.keepAlive) {
componentInstance.$destroy();
} else {
deactivateChildComponent(componentInstance, true /* direct */);
}
}
}
};
var hooksToMerge = Object.keys(componentVNodeHooks);
function createComponent (
Ctor,
data,
context,
children,
tag
) {
if (isUndef(Ctor)) {
return
}
var baseCtor = context.$options._base;
// plain options object: turn it into a constructor
if (isObject(Ctor)) {
Ctor = baseCtor.extend(Ctor);
}
// if at this stage it's not a constructor or an async component factory,
// reject.
if (typeof Ctor !== 'function') {
if (process.env.NODE_ENV !== 'production') {
warn(("Invalid Component definition: " + (String(Ctor))), context);
}
return
}
// async component
var asyncFactory;
if (isUndef(Ctor.cid)) {
asyncFactory = Ctor;
Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
if (Ctor === undefined) {
// return a placeholder node for async component, which is rendered
// as a comment node but preserves all the raw information for the node.
// the information will be used for async server-rendering and hydration.
return createAsyncPlaceholder(
asyncFactory,
data,
context,
children,
tag
)
}
}
data = data || {};
// resolve constructor options in case global mixins are applied after
// component constructor creation
resolveConstructorOptions(Ctor);
// transform component v-model data into props & events
if (isDef(data.model)) {
transformModel(Ctor.options, data);
}
// extract props
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
// functional component
if (isTrue(Ctor.options.functional)) {
return createFunctionalComponent(Ctor, propsData, data, context, children)
}
// extract listeners, since these needs to be treated as
// child component listeners instead of DOM listeners
var listeners = data.on;
// replace with listeners with .native modifier
// so it gets processed during parent component patch.
data.on = data.nativeOn;
if (isTrue(Ctor.options.abstract)) {
// abstract components do not keep anything
// other than props & listeners & slot
// work around flow
var slot = data.slot;
data = {};
if (slot) {
data.slot = slot;
}
}
// merge component management hooks onto the placeholder node
mergeHooks(data);
// return a placeholder vnode
var name = Ctor.options.name || tag;
var vnode = new VNode(
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
data, undefined, undefined, undefined, context,
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
asyncFactory
);
return vnode
}
function createComponentInstanceForVnode (
vnode, // we know it's MountedComponentVNode but flow doesn't
parent, // activeInstance in lifecycle state
parentElm,
refElm
) {
var vnodeComponentOptions = vnode.componentOptions;
var options = {
_isComponent: true,
parent: parent,
propsData: vnodeComponentOptions.propsData,
_componentTag: vnodeComponentOptions.tag,
_parentVnode: vnode,
_parentListeners: vnodeComponentOptions.listeners,
_renderChildren: vnodeComponentOptions.children,
_parentElm: parentElm || null,
_refElm: refElm || null
};
// check inline-template render functions
var inlineTemplate = vnode.data.inlineTemplate;
if (isDef(inlineTemplate)) {
options.render = inlineTemplate.render;
options.staticRenderFns = inlineTemplate.staticRenderFns;
}
return new vnodeComponentOptions.Ctor(options)
}
function mergeHooks (data) {
if (!data.hook) {
data.hook = {};
}
for (var i = 0; i < hooksToMerge.length; i++) {
var key = hooksToMerge[i];
var fromParent = data.hook[key];
var ours = componentVNodeHooks[key];
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
}
}
function mergeHook$1 (one, two) {
return function (a, b, c, d) {
one(a, b, c, d);
two(a, b, c, d);
}
}
// transform component v-model info (value and callback) into
// prop and event handler respectively.
function transformModel (options, data) {
var prop = (options.model && options.model.prop) || 'value';
var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
var on = data.on || (data.on = {});
if (isDef(on[event])) {
on[event] = [data.model.callback].concat(on[event]);
} else {
on[event] = data.model.callback;
}
}
/* */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
// without getting yelled at by flow
function createElement (
context,
tag,
data,
children,
normalizationType,
alwaysNormalize
) {
if (Array.isArray(data) || isPrimitive(data)) {
normalizationType = children;
children = data;
data = undefined;
}
if (isTrue(alwaysNormalize)) {
normalizationType = ALWAYS_NORMALIZE;
}
return _createElement(context, tag, data, children, normalizationType)
}
function _createElement (
context,
tag,
data,
children,
normalizationType
) {
if (isDef(data) && isDef((data).__ob__)) {
process.env.NODE_ENV !== 'production' && warn(
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
'Always create fresh vnode data objects in each render!',
context
);
return createEmptyVNode()
}
// object syntax in v-bind
if (isDef(data) && isDef(data.is)) {
tag = data.is;
}
if (!tag) {
// in case of component :is set to falsy value
return createEmptyVNode()
}
// warn against non-primitive key
if (process.env.NODE_ENV !== 'production' &&
isDef(data) && isDef(data.key) && !isPrimitive(data.key)
) {
warn(
'Avoid using non-primitive value as key, ' +
'use string/number value instead.',
context
);
}
// support single function children as default scoped slot
if (Array.isArray(children) &&
typeof children[0] === 'function'
) {
data = data || {};
data.scopedSlots = { default: children[0] };
children.length = 0;
}
if (normalizationType === ALWAYS_NORMALIZE) {
children = normalizeChildren(children);
} else if (normalizationType === SIMPLE_NORMALIZE) {
children = simpleNormalizeChildren(children);
}
var vnode, ns;
if (typeof tag === 'string') {
var Ctor;
ns = config.getTagNamespace(tag);
if (config.isReservedTag(tag)) {
// platform built-in elements
vnode = new VNode(
config.parsePlatformTagName(tag), data, children,
undefined, undefined, context
);
} else if (isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
// component
vnode = createComponent(Ctor, data, context, children, tag);
} else {
// unknown or unlisted namespaced elements
// check at runtime because it may get assigned a namespace when its
// parent normalizes children
vnode = new VNode(
tag, data, children,
undefined, undefined, context
);
}
} else {
// direct component options / constructor
vnode = createComponent(tag, data, context, children);
}
if (isDef(vnode)) {
if (ns) { applyNS(vnode, ns); }
return vnode
} else {
return createEmptyVNode()
}
}
function applyNS (vnode, ns) {
vnode.ns = ns;
if (vnode.tag === 'foreignObject') {
// use default namespace inside foreignObject
return
}
if (isDef(vnode.children)) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
var child = vnode.children[i];
if (isDef(child.tag) && isUndef(child.ns)) {
applyNS(child, ns);
}
}
}
}
/* */
/**
* Runtime helper for rendering v-for lists.
*/
function renderList (
val,
render
) {
var ret, i, l, keys, key;
if (Array.isArray(val) || typeof val === 'string') {
ret = new Array(val.length);
for (i = 0, l = val.length; i < l; i++) {
ret[i] = render(val[i], i);
}
} else if (typeof val === 'number') {
ret = new Array(val);
for (i = 0; i < val; i++) {
ret[i] = render(i + 1, i);
}
} else if (isObject(val)) {
keys = Object.keys(val);
ret = new Array(keys.length);
for (i = 0, l = keys.length; i < l; i++) {
key = keys[i];
ret[i] = render(val[key], key, i);
}
}
if (isDef(ret)) {
(ret)._isVList = true;
}
return ret
}
/* */
/**
* Runtime helper for rendering <slot>
*/
function renderSlot (
name,
fallback,
props,
bindObject
) {
var scopedSlotFn = this.$scopedSlots[name];
if (scopedSlotFn) { // scoped slot
props = props || {};
if (bindObject) {
props = extend(extend({}, bindObject), props);
}
return scopedSlotFn(props) || fallback
} else {
var slotNodes = this.$slots[name];
// warn duplicate slot usage
if (slotNodes && process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
);
slotNodes._rendered = true;
}
return slotNodes || fallback
}
}
/* */
/**
* Runtime helper for resolving filters
*/
function resolveFilter (id) {
return resolveAsset(this.$options, 'filters', id, true) || identity
}
/* */
/**
* Runtime helper for checking keyCodes from config.
*/
function checkKeyCodes (
eventKeyCode,
key,
builtInAlias
) {
var keyCodes = config.keyCodes[key] || builtInAlias;
if (Array.isArray(keyCodes)) {
return keyCodes.indexOf(eventKeyCode) === -1
} else {
return keyCodes !== eventKeyCode
}
}
/* */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
function bindObjectProps (
data,
tag,
value,
asProp,
isSync
) {
if (value) {
if (!isObject(value)) {
process.env.NODE_ENV !== 'production' && warn(
'v-bind without argument expects an Object or Array value',
this
);
} else {
if (Array.isArray(value)) {
value = toObject(value);
}
var hash;
var loop = function ( key ) {
if (
key === 'class' ||
key === 'style' ||
isReservedAttribute(key)
) {
hash = data;
} else {
var type = data.attrs && data.attrs.type;
hash = asProp || config.mustUseProp(tag, type, key)
? data.domProps || (data.domProps = {})
: data.attrs || (data.attrs = {});
}
if (!(key in hash)) {
hash[key] = value[key];
if (isSync) {
var on = data.on || (data.on = {});
on[("update:" + key)] = function ($event) {
value[key] = $event;
};
}
}
};
for (var key in value) loop( key );
}
}
return data
}
/* */
/**
* Runtime helper for rendering static trees.
*/
function renderStatic (
index,
isInFor
) {
var tree = this._staticTrees[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
if (tree && !isInFor) {
return Array.isArray(tree)
? cloneVNodes(tree)
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = this._staticTrees[index] =
this.$options.staticRenderFns[index].call(this._renderProxy);
markStatic(tree, ("__static__" + index), false);
return tree
}
/**
* Runtime helper for v-once.
* Effectively it means marking the node as static with a unique key.
*/
function markOnce (
tree,
index,
key
) {
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
return tree
}
function markStatic (
tree,
key,
isOnce
) {
if (Array.isArray(tree)) {
for (var i = 0; i < tree.length; i++) {
if (tree[i] && typeof tree[i] !== 'string') {
markStaticNode(tree[i], (key + "_" + i), isOnce);
}
}
} else {
markStaticNode(tree, key, isOnce);
}
}
function markStaticNode (node, key, isOnce) {
node.isStatic = true;
node.key = key;
node.isOnce = isOnce;
}
/* */
function bindObjectListeners (data, value) {
if (value) {
if (!isPlainObject(value)) {
process.env.NODE_ENV !== 'production' && warn(
'v-on without argument expects an Object value',
this
);
} else {
var on = data.on = data.on ? extend({}, data.on) : {};
for (var key in value) {
var existing = on[key];
var ours = value[key];
on[key] = existing ? [].concat(ours, existing) : ours;
}
}
}
return data
}
/* */
function initRender (vm) {
vm._vnode = null; // the root of the child tree
vm._staticTrees = null;
var parentVnode = vm.$vnode = vm.$options._parentVnode; // the placeholder node in parent tree
var renderContext = parentVnode && parentVnode.context;
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
vm.$scopedSlots = emptyObject;
// bind the createElement fn to this instance
// so that we get proper render context inside it.
// args order: tag, data, children, normalizationType, alwaysNormalize
// internal version is used by render functions compiled from templates
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
// normalization is always applied for the public version, used in
// user-written render functions.
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
// $attrs & $listeners are exposed for easier HOC creation.
// they need to be reactive so that HOCs using them are always updated
var parentData = parentVnode && parentVnode.data;
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
}, true);
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
}, true);
} else {
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, null, true);
defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, null, true);
}
}
function renderMixin (Vue) {
Vue.prototype.$nextTick = function (fn) {
return nextTick(fn, this)
};
Vue.prototype._render = function () {
var vm = this;
var ref = vm.$options;
var render = ref.render;
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key]);
}
}
vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = [];
}
// set parent vnode. this allows render functions to have access
// to the data on the placeholder node.
vm.$vnode = _parentVnode;
// render self
var vnode;
try {
vnode = render.call(vm._renderProxy, vm.$createElement);
} catch (e) {
handleError(e, vm, "render function");
// return error render result,
// or previous vnode to prevent render error causing blank component
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
vnode = vm.$options.renderError
? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
: vm._vnode;
} else {
vnode = vm._vnode;
}
}
// return empty vnode in case the render function errored out
if (!(vnode instanceof VNode)) {
if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
warn(
'Multiple root nodes returned from render function. Render function ' +
'should return a single root node.',
vm
);
}
vnode = createEmptyVNode();
}
// set parent
vnode.parent = _parentVnode;
return vnode
};
// internal render helpers.
// these are exposed on the instance prototype to reduce generated render
// code size.
Vue.prototype._o = markOnce;
Vue.prototype._n = toNumber;
Vue.prototype._s = toString;
Vue.prototype._l = renderList;
Vue.prototype._t = renderSlot;
Vue.prototype._q = looseEqual;
Vue.prototype._i = looseIndexOf;
Vue.prototype._m = renderStatic;
Vue.prototype._f = resolveFilter;
Vue.prototype._k = checkKeyCodes;
Vue.prototype._b = bindObjectProps;
Vue.prototype._v = createTextVNode;
Vue.prototype._e = createEmptyVNode;
Vue.prototype._u = resolveScopedSlots;
Vue.prototype._g = bindObjectListeners;
}
/* */
var uid = 0;
function initMixin (Vue) {
Vue.prototype._init = function (options) {
var vm = this;
// a uid
vm._uid = uid++;
var startTag, endTag;
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
startTag = "vue-perf-init:" + (vm._uid);
endTag = "vue-perf-end:" + (vm._uid);
mark(startTag);
}
// a flag to avoid this being observed
vm._isVue = true;
// merge options
if (options && options._isComponent) {
// optimize internal component instantiation
// since dynamic options merging is pretty slow, and none of the
// internal component options needs special treatment.
initInternalComponent(vm, options);
} else {
vm.$options = mergeOptions(
resolveConstructorOptions(vm.constructor),
options || {},
vm
);
}
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
initProxy(vm);
} else {
vm._renderProxy = vm;
}
// expose real self
vm._self = vm;
initLifecycle(vm);
initEvents(vm);
initRender(vm);
callHook(vm, 'beforeCreate');
initInjections(vm); // resolve injections before data/props
initState(vm);
initProvide(vm); // resolve provide after data/props
callHook(vm, 'created');
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
vm._name = formatComponentName(vm, false);
mark(endTag);
measure(((vm._name) + " init"), startTag, endTag);
}
if (vm.$options.el) {
vm.$mount(vm.$options.el);
}
};
}
function initInternalComponent (vm, options) {
var opts = vm.$options = Object.create(vm.constructor.options);
// doing this because it's faster than dynamic enumeration.
opts.parent = options.parent;
opts.propsData = options.propsData;
opts._parentVnode = options._parentVnode;
opts._parentListeners = options._parentListeners;
opts._renderChildren = options._renderChildren;
opts._componentTag = options._componentTag;
opts._parentElm = options._parentElm;
opts._refElm = options._refElm;
if (options.render) {
opts.render = options.render;
opts.staticRenderFns = options.staticRenderFns;
}
}
function resolveConstructorOptions (Ctor) {
var options = Ctor.options;
if (Ctor.super) {
var superOptions = resolveConstructorOptions(Ctor.super);
var cachedSuperOptions = Ctor.superOptions;
if (superOptions !== cachedSuperOptions) {
// super option changed,
// need to resolve new options.
Ctor.superOptions = superOptions;
// check if there are any late-modified/attached options (#4976)
var modifiedOptions = resolveModifiedOptions(Ctor);
// update base extend options
if (modifiedOptions) {
extend(Ctor.extendOptions, modifiedOptions);
}
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
if (options.name) {
options.components[options.name] = Ctor;
}
}
}
return options
}
function resolveModifiedOptions (Ctor) {
var modified;
var latest = Ctor.options;
var extended = Ctor.extendOptions;
var sealed = Ctor.sealedOptions;
for (var key in latest) {
if (latest[key] !== sealed[key]) {
if (!modified) { modified = {}; }
modified[key] = dedupe(latest[key], extended[key], sealed[key]);
}
}
return modified
}
function dedupe (latest, extended, sealed) {
// compare latest and sealed to ensure lifecycle hooks won't be duplicated
// between merges
if (Array.isArray(latest)) {
var res = [];
sealed = Array.isArray(sealed) ? sealed : [sealed];
extended = Array.isArray(extended) ? extended : [extended];
for (var i = 0; i < latest.length; i++) {
// push original options and not sealed options to exclude duplicated options
if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) {
res.push(latest[i]);
}
}
return res
} else {
return latest
}
}
function Vue$3 (options) {
if (process.env.NODE_ENV !== 'production' &&
!(this instanceof Vue$3)
) {
warn('Vue is a constructor and should be called with the `new` keyword');
}
this._init(options);
}
initMixin(Vue$3);
stateMixin(Vue$3);
eventsMixin(Vue$3);
lifecycleMixin(Vue$3);
renderMixin(Vue$3);
/* */
function initUse (Vue) {
Vue.use = function (plugin) {
var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
if (installedPlugins.indexOf(plugin) > -1) {
return this
}
// additional parameters
var args = toArray(arguments, 1);
args.unshift(this);
if (typeof plugin.install === 'function') {
plugin.install.apply(plugin, args);
} else if (typeof plugin === 'function') {
plugin.apply(null, args);
}
installedPlugins.push(plugin);
return this
};
}
/* */
function initMixin$1 (Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
return this
};
}
/* */
function initExtend (Vue) {
/**
* Each instance constructor, including Vue, has a unique
* cid. This enables us to create wrapped "child
* constructors" for prototypal inheritance and cache them.
*/
Vue.cid = 0;
var cid = 1;
/**
* Class inheritance
*/
Vue.extend = function (extendOptions) {
extendOptions = extendOptions || {};
var Super = this;
var SuperId = Super.cid;
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
if (cachedCtors[SuperId]) {
return cachedCtors[SuperId]
}
var name = extendOptions.name || Super.options.name;
if (process.env.NODE_ENV !== 'production') {
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
warn(
'Invalid component name: "' + name + '". Component names ' +
'can only contain alphanumeric characters and the hyphen, ' +
'and must start with a letter.'
);
}
}
var Sub = function VueComponent (options) {
this._init(options);
};
Sub.prototype = Object.create(Super.prototype);
Sub.prototype.constructor = Sub;
Sub.cid = cid++;
Sub.options = mergeOptions(
Super.options,
extendOptions
);
Sub['super'] = Super;
// For props and computed properties, we define the proxy getters on
// the Vue instances at extension time, on the extended prototype. This
// avoids Object.defineProperty calls for each instance created.
if (Sub.options.props) {
initProps$1(Sub);
}
if (Sub.options.computed) {
initComputed$1(Sub);
}
// allow further extension/mixin/plugin usage
Sub.extend = Super.extend;
Sub.mixin = Super.mixin;
Sub.use = Super.use;
// create asset registers, so extended classes
// can have their private assets too.
ASSET_TYPES.forEach(function (type) {
Sub[type] = Super[type];
});
// enable recursive self-lookup
if (name) {
Sub.options.components[name] = Sub;
}
// keep a reference to the super options at extension time.
// later at instantiation we can check if Super's options have
// been updated.
Sub.superOptions = Super.options;
Sub.extendOptions = extendOptions;
Sub.sealedOptions = extend({}, Sub.options);
// cache constructor
cachedCtors[SuperId] = Sub;
return Sub
};
}
function initProps$1 (Comp) {
var props = Comp.options.props;
for (var key in props) {
proxy(Comp.prototype, "_props", key);
}
}
function initComputed$1 (Comp) {
var computed = Comp.options.computed;
for (var key in computed) {
defineComputed(Comp.prototype, key, computed[key]);
}
}
/* */
function initAssetRegisters (Vue) {
/**
* Create asset registration methods.
*/
ASSET_TYPES.forEach(function (type) {
Vue[type] = function (
id,
definition
) {
if (!definition) {
return this.options[type + 's'][id]
} else {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') {
if (type === 'component' && config.isReservedTag(id)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + id
);
}
}
if (type === 'component' && isPlainObject(definition)) {
definition.name = definition.name || id;
definition = this.options._base.extend(definition);
}
if (type === 'directive' && typeof definition === 'function') {
definition = { bind: definition, update: definition };
}
this.options[type + 's'][id] = definition;
return definition
}
};
});
}
/* */
var patternTypes = [String, RegExp, Array];
function getComponentName (opts) {
return opts && (opts.Ctor.options.name || opts.tag)
}
function matches (pattern, name) {
if (Array.isArray(pattern)) {
return pattern.indexOf(name) > -1
} else if (typeof pattern === 'string') {
return pattern.split(',').indexOf(name) > -1
} else if (isRegExp(pattern)) {
return pattern.test(name)
}
/* istanbul ignore next */
return false
}
function pruneCache (cache, current, filter) {
for (var key in cache) {
var cachedNode = cache[key];
if (cachedNode) {
var name = getComponentName(cachedNode.componentOptions);
if (name && !filter(name)) {
if (cachedNode !== current) {
pruneCacheEntry(cachedNode);
}
cache[key] = null;
}
}
}
}
function pruneCacheEntry (vnode) {
if (vnode) {
vnode.componentInstance.$destroy();
}
}
var KeepAlive = {
name: 'keep-alive',
abstract: true,
props: {
include: patternTypes,
exclude: patternTypes
},
created: function created () {
this.cache = Object.create(null);
},
destroyed: function destroyed () {
var this$1 = this;
for (var key in this$1.cache) {
pruneCacheEntry(this$1.cache[key]);
}
},
watch: {
include: function include (val) {
pruneCache(this.cache, this._vnode, function (name) { return matches(val, name); });
},
exclude: function exclude (val) {
pruneCache(this.cache, this._vnode, function (name) { return !matches(val, name); });
}
},
render: function render () {
var vnode = getFirstComponentChild(this.$slots.default);
var componentOptions = vnode && vnode.componentOptions;
if (componentOptions) {
// check pattern
var name = getComponentName(componentOptions);
if (name && (
(this.include && !matches(this.include, name)) ||
(this.exclude && matches(this.exclude, name))
)) {
return vnode
}
var key = vnode.key == null
// same constructor may get registered as different local components
// so cid alone is not enough (#3269)
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
: vnode.key;
if (this.cache[key]) {
vnode.componentInstance = this.cache[key].componentInstance;
} else {
this.cache[key] = vnode;
}
vnode.data.keepAlive = true;
}
return vnode
}
};
var builtInComponents = {
KeepAlive: KeepAlive
};
/* */
function initGlobalAPI (Vue) {
// config
var configDef = {};
configDef.get = function () { return config; };
if (process.env.NODE_ENV !== 'production') {
configDef.set = function () {
warn(
'Do not replace the Vue.config object, set individual fields instead.'
);
};
}
Object.defineProperty(Vue, 'config', configDef);
// exposed util methods.
// NOTE: these are not considered part of the public API - avoid relying on
// them unless you are aware of the risk.
Vue.util = {
warn: warn,
extend: extend,
mergeOptions: mergeOptions,
defineReactive: defineReactive$$1
};
Vue.set = set;
Vue.delete = del;
Vue.nextTick = nextTick;
Vue.options = Object.create(null);
ASSET_TYPES.forEach(function (type) {
Vue.options[type + 's'] = Object.create(null);
});
// this is used to identify the "base" constructor to extend all plain-object
// components with in Weex's multi-instance scenarios.
Vue.options._base = Vue;
extend(Vue.options.components, builtInComponents);
initUse(Vue);
initMixin$1(Vue);
initExtend(Vue);
initAssetRegisters(Vue);
}
initGlobalAPI(Vue$3);
Object.defineProperty(Vue$3.prototype, '$isServer', {
get: isServerRendering
});
Object.defineProperty(Vue$3.prototype, '$ssrContext', {
get: function get () {
/* istanbul ignore next */
return this.$vnode && this.$vnode.ssrContext
}
});
Vue$3.version = '2.4.2';
/* */
// these are reserved for web because they are directly compiled away
// during template compilation
var isReservedAttr = makeMap('style,class');
// attributes that should be using props for binding
var acceptValue = makeMap('input,textarea,option,select');
var mustUseProp = function (tag, type, attr) {
return (
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
(attr === 'selected' && tag === 'option') ||
(attr === 'checked' && tag === 'input') ||
(attr === 'muted' && tag === 'video')
)
};
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
'required,reversed,scoped,seamless,selected,sortable,translate,' +
'truespeed,typemustmatch,visible'
);
var xlinkNS = 'http://www.w3.org/1999/xlink';
var isXlink = function (name) {
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
};
var getXlinkProp = function (name) {
return isXlink(name) ? name.slice(6, name.length) : ''
};
var isFalsyAttrValue = function (val) {
return val == null || val === false
};
/* */
function genClassForVnode (vnode) {
var data = vnode.data;
var parentNode = vnode;
var childNode = vnode;
while (isDef(childNode.componentInstance)) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while (isDef(parentNode = parentNode.parent)) {
if (parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
return renderClass(data.staticClass, data.class)
}
function mergeClassData (child, parent) {
return {
staticClass: concat(child.staticClass, parent.staticClass),
class: isDef(child.class)
? [child.class, parent.class]
: parent.class
}
}
function renderClass (
staticClass,
dynamicClass
) {
if (isDef(staticClass) || isDef(dynamicClass)) {
return concat(staticClass, stringifyClass(dynamicClass))
}
/* istanbul ignore next */
return ''
}
function concat (a, b) {
return a ? b ? (a + ' ' + b) : a : (b || '')
}
function stringifyClass (value) {
if (Array.isArray(value)) {
return stringifyArray(value)
}
if (isObject(value)) {
return stringifyObject(value)
}
if (typeof value === 'string') {
return value
}
/* istanbul ignore next */
return ''
}
function stringifyArray (value) {
var res = '';
var stringified;
for (var i = 0, l = value.length; i < l; i++) {
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
if (res) { res += ' '; }
res += stringified;
}
}
return res
}
function stringifyObject (value) {
var res = '';
for (var key in value) {
if (value[key]) {
if (res) { res += ' '; }
res += key;
}
}
return res
}
/* */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML'
};
var isHTMLTag = makeMap(
'html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
'embed,object,param,source,canvas,script,noscript,del,ins,' +
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
'output,progress,select,textarea,' +
'details,dialog,menu,menuitem,summary,' +
'content,element,shadow,template,blockquote,iframe,tfoot'
);
// this map is intentionally selective, only covering SVG elements that may
// contain child elements.
var isSVG = makeMap(
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
true
);
var isReservedTag = function (tag) {
return isHTMLTag(tag) || isSVG(tag)
};
function getTagNamespace (tag) {
if (isSVG(tag)) {
return 'svg'
}
// basic support for MathML
// note it doesn't support other MathML elements being component roots
if (tag === 'math') {
return 'math'
}
}
var unknownElementCache = Object.create(null);
function isUnknownElement (tag) {
/* istanbul ignore if */
if (!inBrowser) {
return true
}
if (isReservedTag(tag)) {
return false
}
tag = tag.toLowerCase();
/* istanbul ignore if */
if (unknownElementCache[tag] != null) {
return unknownElementCache[tag]
}
var el = document.createElement(tag);
if (tag.indexOf('-') > -1) {
// http://stackoverflow.com/a/28210364/1070244
return (unknownElementCache[tag] = (
el.constructor === window.HTMLUnknownElement ||
el.constructor === window.HTMLElement
))
} else {
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
}
}
/* */
/**
* Query an element selector if it's not an element already.
*/
function query (el) {
if (typeof el === 'string') {
var selected = document.querySelector(el);
if (!selected) {
process.env.NODE_ENV !== 'production' && warn(
'Cannot find element: ' + el
);
return document.createElement('div')
}
return selected
} else {
return el
}
}
/* */
function createElement$1 (tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
return elm
}
// false or null will remove the attribute but undefined will not
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
elm.setAttribute('multiple', 'multiple');
}
return elm
}
function createElementNS (namespace, tagName) {
return document.createElementNS(namespaceMap[namespace], tagName)
}
function createTextNode (text) {
return document.createTextNode(text)
}
function createComment (text) {
return document.createComment(text)
}
function insertBefore (parentNode, newNode, referenceNode) {
parentNode.insertBefore(newNode, referenceNode);
}
function removeChild (node, child) {
node.removeChild(child);
}
function appendChild (node, child) {
node.appendChild(child);
}
function parentNode (node) {
return node.parentNode
}
function nextSibling (node) {
return node.nextSibling
}
function tagName (node) {
return node.tagName
}
function setTextContent (node, text) {
node.textContent = text;
}
function setAttribute (node, key, val) {
node.setAttribute(key, val);
}
var nodeOps = Object.freeze({
createElement: createElement$1,
createElementNS: createElementNS,
createTextNode: createTextNode,
createComment: createComment,
insertBefore: insertBefore,
removeChild: removeChild,
appendChild: appendChild,
parentNode: parentNode,
nextSibling: nextSibling,
tagName: tagName,
setTextContent: setTextContent,
setAttribute: setAttribute
});
/* */
var ref = {
create: function create (_, vnode) {
registerRef(vnode);
},
update: function update (oldVnode, vnode) {
if (oldVnode.data.ref !== vnode.data.ref) {
registerRef(oldVnode, true);
registerRef(vnode);
}
},
destroy: function destroy (vnode) {
registerRef(vnode, true);
}
};
function registerRef (vnode, isRemoval) {
var key = vnode.data.ref;
if (!key) { return }
var vm = vnode.context;
var ref = vnode.componentInstance || vnode.elm;
var refs = vm.$refs;
if (isRemoval) {
if (Array.isArray(refs[key])) {
remove(refs[key], ref);
} else if (refs[key] === ref) {
refs[key] = undefined;
}
} else {
if (vnode.data.refInFor) {
if (!Array.isArray(refs[key])) {
refs[key] = [ref];
} else if (refs[key].indexOf(ref) < 0) {
// $flow-disable-line
refs[key].push(ref);
}
} else {
refs[key] = ref;
}
}
}
/**
* Virtual DOM patching algorithm based on Snabbdom by
* Simon Friis Vindum (@paldepind)
* Licensed under the MIT License
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
*
* modified by Evan You (@yyx990803)
*
/*
* Not type-checking this because this file is perf-critical and the cost
* of making flow understand it is not worth it.
*/
var emptyNode = new VNode('', {}, []);
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
function sameVnode (a, b) {
return (
a.key === b.key && (
(
a.tag === b.tag &&
a.isComment === b.isComment &&
isDef(a.data) === isDef(b.data) &&
sameInputType(a, b)
) || (
isTrue(a.isAsyncPlaceholder) &&
a.asyncFactory === b.asyncFactory &&
isUndef(b.asyncFactory.error)
)
)
)
}
// Some browsers do not support dynamically changing type for <input>
// so they need to be treated as different nodes
function sameInputType (a, b) {
if (a.tag !== 'input') { return true }
var i;
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
return typeA === typeB
}
function createKeyToOldIdx (children, beginIdx, endIdx) {
var i, key;
var map = {};
for (i = beginIdx; i <= endIdx; ++i) {
key = children[i].key;
if (isDef(key)) { map[key] = i; }
}
return map
}
function createPatchFunction (backend) {
var i, j;
var cbs = {};
var modules = backend.modules;
var nodeOps = backend.nodeOps;
for (i = 0; i < hooks.length; ++i) {
cbs[hooks[i]] = [];
for (j = 0; j < modules.length; ++j) {
if (isDef(modules[j][hooks[i]])) {
cbs[hooks[i]].push(modules[j][hooks[i]]);
}
}
}
function emptyNodeAt (elm) {
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
}
function createRmCb (childElm, listeners) {
function remove$$1 () {
if (--remove$$1.listeners === 0) {
removeNode(childElm);
}
}
remove$$1.listeners = listeners;
return remove$$1
}
function removeNode (el) {
var parent = nodeOps.parentNode(el);
// element may have already been removed due to v-html / v-text
if (isDef(parent)) {
nodeOps.removeChild(parent, el);
}
}
var inPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
return
}
var data = vnode.data;
var children = vnode.children;
var tag = vnode.tag;
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
}
if (
!inPre &&
!vnode.ns &&
!(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
config.isUnknownElement(tag)
) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
'make sure to provide the "name" option.',
vnode.context
);
}
}
vnode.elm = vnode.ns
? nodeOps.createElementNS(vnode.ns, tag)
: nodeOps.createElement(tag, vnode);
setScope(vnode);
/* istanbul ignore if */
{
createChildren(vnode, children, insertedVnodeQueue);
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
}
insert(parentElm, vnode.elm, refElm);
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
}
} else if (isTrue(vnode.isComment)) {
vnode.elm = nodeOps.createComment(vnode.text);
insert(parentElm, vnode.elm, refElm);
} else {
vnode.elm = nodeOps.createTextNode(vnode.text);
insert(parentElm, vnode.elm, refElm);
}
}
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i = vnode.data;
if (isDef(i)) {
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
if (isDef(i = i.hook) && isDef(i = i.init)) {
i(vnode, false /* hydrating */, parentElm, refElm);
}
// after calling the init hook, if the vnode is a child component
// it should've created a child instance and mounted it. the child
// component also has set the placeholder vnode's elm.
// in that case we can just return the element and be done.
if (isDef(vnode.componentInstance)) {
initComponent(vnode, insertedVnodeQueue);
if (isTrue(isReactivated)) {
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
}
return true
}
}
}
function initComponent (vnode, insertedVnodeQueue) {
if (isDef(vnode.data.pendingInsert)) {
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
vnode.data.pendingInsert = null;
}
vnode.elm = vnode.componentInstance.$el;
if (isPatchable(vnode)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
setScope(vnode);
} else {
// empty component root.
// skip all element-related modules except for ref (#3455)
registerRef(vnode);
// make sure to invoke the insert hook
insertedVnodeQueue.push(vnode);
}
}
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i;
// hack for #4339: a reactivated component with inner transition
// does not trigger because the inner node's created hooks are not called
// again. It's not ideal to involve module-specific logic in here but
// there doesn't seem to be a better way to do it.
var innerNode = vnode;
while (innerNode.componentInstance) {
innerNode = innerNode.componentInstance._vnode;
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
for (i = 0; i < cbs.activate.length; ++i) {
cbs.activate[i](emptyNode, innerNode);
}
insertedVnodeQueue.push(innerNode);
break
}
}
// unlike a newly created component,
// a reactivated keep-alive component doesn't insert itself
insert(parentElm, vnode.elm, refElm);
}
function insert (parent, elm, ref$$1) {
if (isDef(parent)) {
if (isDef(ref$$1)) {
if (ref$$1.parentNode === parent) {
nodeOps.insertBefore(parent, elm, ref$$1);
}
} else {
nodeOps.appendChild(parent, elm);
}
}
}
function createChildren (vnode, children, insertedVnodeQueue) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; ++i) {
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
}
}
function isPatchable (vnode) {
while (vnode.componentInstance) {
vnode = vnode.componentInstance._vnode;
}
return isDef(vnode.tag)
}
function invokeCreateHooks (vnode, insertedVnodeQueue) {
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
cbs.create[i$1](emptyNode, vnode);
}
i = vnode.data.hook; // Reuse variable
if (isDef(i)) {
if (isDef(i.create)) { i.create(emptyNode, vnode); }
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
}
}
// set scope id attribute for scoped CSS.
// this is implemented as a special case to avoid the overhead
// of going through the normal attribute patching process.
function setScope (vnode) {
var i;
var ancestor = vnode;
while (ancestor) {
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
nodeOps.setAttribute(vnode.elm, i, '');
}
ancestor = ancestor.parent;
}
// for slot content they should also get the scopeId from the host instance.
if (isDef(i = activeInstance) &&
i !== vnode.context &&
isDef(i = i.$options._scopeId)
) {
nodeOps.setAttribute(vnode.elm, i, '');
}
}
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
for (; startIdx <= endIdx; ++startIdx) {
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
}
}
function invokeDestroyHook (vnode) {
var i, j;
var data = vnode.data;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
}
if (isDef(i = vnode.children)) {
for (j = 0; j < vnode.children.length; ++j) {
invokeDestroyHook(vnode.children[j]);
}
}
}
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
for (; startIdx <= endIdx; ++startIdx) {
var ch = vnodes[startIdx];
if (isDef(ch)) {
if (isDef(ch.tag)) {
removeAndInvokeRemoveHook(ch);
invokeDestroyHook(ch);
} else { // Text node
removeNode(ch.elm);
}
}
}
}
function removeAndInvokeRemoveHook (vnode, rm) {
if (isDef(rm) || isDef(vnode.data)) {
var i;
var listeners = cbs.remove.length + 1;
if (isDef(rm)) {
// we have a recursively passed down rm callback
// increase the listeners count
rm.listeners += listeners;
} else {
// directly removing
rm = createRmCb(vnode.elm, listeners);
}
// recursively invoke hooks on child component root node
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
removeAndInvokeRemoveHook(i, rm);
}
for (i = 0; i < cbs.remove.length; ++i) {
cbs.remove[i](vnode, rm);
}
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
i(vnode, rm);
} else {
rm();
}
} else {
removeNode(vnode.elm);
}
}
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
var oldStartIdx = 0;
var newStartIdx = 0;
var oldEndIdx = oldCh.length - 1;
var oldStartVnode = oldCh[0];
var oldEndVnode = oldCh[oldEndIdx];
var newEndIdx = newCh.length - 1;
var newStartVnode = newCh[0];
var newEndVnode = newCh[newEndIdx];
var oldKeyToIdx, idxInOld, elmToMove, refElm;
// removeOnly is a special flag used only by <transition-group>
// to ensure removed elements stay in correct relative positions
// during leaving transitions
var canMove = !removeOnly;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (isUndef(oldStartVnode)) {
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
} else if (isUndef(oldEndVnode)) {
oldEndVnode = oldCh[--oldEndIdx];
} else if (sameVnode(oldStartVnode, newStartVnode)) {
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
} else if (sameVnode(oldEndVnode, newEndVnode)) {
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
} else {
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
if (isUndef(idxInOld)) { // New element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
elmToMove = oldCh[idxInOld];
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && !elmToMove) {
warn(
'It seems there are duplicate keys that is causing an update error. ' +
'Make sure each v-for item has a unique key.'
);
}
if (sameVnode(elmToMove, newStartVnode)) {
patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
oldCh[idxInOld] = undefined;
canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
// same key but different element. treat as new element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
}
}
}
}
if (oldStartIdx > oldEndIdx) {
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
} else if (newStartIdx > newEndIdx) {
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
}
}
function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
if (oldVnode === vnode) {
return
}
var elm = vnode.elm = oldVnode.elm;
if (isTrue(oldVnode.isAsyncPlaceholder)) {
if (isDef(vnode.asyncFactory.resolved)) {
hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
} else {
vnode.isAsyncPlaceholder = true;
}
return
}
// reuse element for static trees.
// note we only do this if the vnode is cloned -
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to do a proper re-render.
if (isTrue(vnode.isStatic) &&
isTrue(oldVnode.isStatic) &&
vnode.key === oldVnode.key &&
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
) {
vnode.componentInstance = oldVnode.componentInstance;
return
}
var i;
var data = vnode.data;
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
i(oldVnode, vnode);
}
var oldCh = oldVnode.children;
var ch = vnode.children;
if (isDef(data) && isPatchable(vnode)) {
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
}
if (isUndef(vnode.text)) {
if (isDef(oldCh) && isDef(ch)) {
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
} else if (isDef(ch)) {
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
} else if (isDef(oldCh)) {
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
} else if (isDef(oldVnode.text)) {
nodeOps.setTextContent(elm, '');
}
} else if (oldVnode.text !== vnode.text) {
nodeOps.setTextContent(elm, vnode.text);
}
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
}
}
function invokeInsertHook (vnode, queue, initial) {
// delay insert hooks for component root nodes, invoke them after the
// element is really inserted
if (isTrue(initial) && isDef(vnode.parent)) {
vnode.parent.data.pendingInsert = queue;
} else {
for (var i = 0; i < queue.length; ++i) {
queue[i].data.hook.insert(queue[i]);
}
}
}
var bailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
vnode.elm = elm;
vnode.isAsyncPlaceholder = true;
return true
}
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
// child component. it should have hydrated its own tree.
initComponent(vnode, insertedVnodeQueue);
return true
}
}
if (isDef(tag)) {
if (isDef(children)) {
// empty element, allow client to pick up and populate children
if (!elm.hasChildNodes()) {
createChildren(vnode, children, insertedVnodeQueue);
} else {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
childrenMatch = false;
break
}
childNode = childNode.nextSibling;
}
// if childNode is not null, it means the actual childNodes list is
// longer than the virtual children list.
if (!childrenMatch || childNode) {
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed
) {
bailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
return false
}
}
}
if (isDef(data)) {
for (var key in data) {
if (!isRenderedModule(key)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
}
return true
}
function assertNodeMatch (node, vnode) {
if (isDef(vnode.tag)) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
return node.nodeType === (vnode.isComment ? 8 : 3)
}
}
return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
if (isUndef(vnode)) {
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
return
}
var isInitialPatch = false;
var insertedVnodeQueue = [];
if (isUndef(oldVnode)) {
// empty mount (likely as component), create new root element
isInitialPatch = true;
createElm(vnode, insertedVnodeQueue, parentElm, refElm);
} else {
var isRealElement = isDef(oldVnode.nodeType);
if (!isRealElement && sameVnode(oldVnode, vnode)) {
// patch existing root node
patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
} else {
if (isRealElement) {
// mounting to a real element
// check if this is server-rendered content and if we can perform
// a successful hydration.
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
oldVnode.removeAttribute(SSR_ATTR);
hydrating = true;
}
if (isTrue(hydrating)) {
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
invokeInsertHook(vnode, insertedVnodeQueue, true);
return oldVnode
} else if (process.env.NODE_ENV !== 'production') {
warn(
'The client-side rendered virtual DOM tree is not matching ' +
'server-rendered content. This is likely caused by incorrect ' +
'HTML markup, for example nesting block-level elements inside ' +
'<p>, or missing <tbody>. Bailing hydration and performing ' +
'full client-side render.'
);
}
}
// either not server-rendered, or hydration failed.
// create an empty node and replace it
oldVnode = emptyNodeAt(oldVnode);
}
// replacing existing element
var oldElm = oldVnode.elm;
var parentElm$1 = nodeOps.parentNode(oldElm);
createElm(
vnode,
insertedVnodeQueue,
// extremely rare edge case: do not insert if old element is in a
// leaving transition. Only happens when combining transition +
// keep-alive + HOCs. (#4590)
oldElm._leaveCb ? null : parentElm$1,
nodeOps.nextSibling(oldElm)
);
if (isDef(vnode.parent)) {
// component root element replaced.
// update parent placeholder node element, recursively
var ancestor = vnode.parent;
while (ancestor) {
ancestor.elm = vnode.elm;
ancestor = ancestor.parent;
}
if (isPatchable(vnode)) {
for (var i = 0; i < cbs.create.length; ++i) {
cbs.create[i](emptyNode, vnode.parent);
}
}
}
if (isDef(parentElm$1)) {
removeVnodes(parentElm$1, [oldVnode], 0, 0);
} else if (isDef(oldVnode.tag)) {
invokeDestroyHook(oldVnode);
}
}
}
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
return vnode.elm
}
}
/* */
var directives = {
create: updateDirectives,
update: updateDirectives,
destroy: function unbindDirectives (vnode) {
updateDirectives(vnode, emptyNode);
}
};
function updateDirectives (oldVnode, vnode) {
if (oldVnode.data.directives || vnode.data.directives) {
_update(oldVnode, vnode);
}
}
function _update (oldVnode, vnode) {
var isCreate = oldVnode === emptyNode;
var isDestroy = vnode === emptyNode;
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
var dirsWithInsert = [];
var dirsWithPostpatch = [];
var key, oldDir, dir;
for (key in newDirs) {
oldDir = oldDirs[key];
dir = newDirs[key];
if (!oldDir) {
// new directive, bind
callHook$1(dir, 'bind', vnode, oldVnode);
if (dir.def && dir.def.inserted) {
dirsWithInsert.push(dir);
}
} else {
// existing directive, update
dir.oldValue = oldDir.value;
callHook$1(dir, 'update', vnode, oldVnode);
if (dir.def && dir.def.componentUpdated) {
dirsWithPostpatch.push(dir);
}
}
}
if (dirsWithInsert.length) {
var callInsert = function () {
for (var i = 0; i < dirsWithInsert.length; i++) {
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
}
};
if (isCreate) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
} else {
callInsert();
}
}
if (dirsWithPostpatch.length) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
for (var i = 0; i < dirsWithPostpatch.length; i++) {
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
}
});
}
if (!isCreate) {
for (key in oldDirs) {
if (!newDirs[key]) {
// no longer present, unbind
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
}
}
}
}
var emptyModifiers = Object.create(null);
function normalizeDirectives$1 (
dirs,
vm
) {
var res = Object.create(null);
if (!dirs) {
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
return res
}
function getRawDirName (dir) {
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
}
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
var fn = dir.def && dir.def[hook];
if (fn) {
try {
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
} catch (e) {
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
}
}
}
var baseModules = [
ref,
directives
];
/* */
function updateAttrs (oldVnode, vnode) {
var opts = vnode.componentOptions;
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
return
}
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
return
}
var key, cur, old;
var elm = vnode.elm;
var oldAttrs = oldVnode.data.attrs || {};
var attrs = vnode.data.attrs || {};
// clone observed objects, as the user probably wants to mutate it
if (isDef(attrs.__ob__)) {
attrs = vnode.data.attrs = extend({}, attrs);
}
for (key in attrs) {
cur = attrs[key];
old = oldAttrs[key];
if (old !== cur) {
setAttr(elm, key, cur);
}
}
// #4391: in IE9, setting type can reset value for input[type=radio]
/* istanbul ignore if */
if (isIE9 && attrs.value !== oldAttrs.value) {
setAttr(elm, 'value', attrs.value);
}
for (key in oldAttrs) {
if (isUndef(attrs[key])) {
if (isXlink(key)) {
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else if (!isEnumeratedAttr(key)) {
elm.removeAttribute(key);
}
}
}
}
function setAttr (el, key, value) {
if (isBooleanAttr(key)) {
// set attribute for blank value
// e.g. <option disabled>Select one</option>
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, key);
}
} else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
} else if (isXlink(key)) {
if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else {
el.setAttributeNS(xlinkNS, key, value);
}
} else {
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, value);
}
}
}
var attrs = {
create: updateAttrs,
update: updateAttrs
};
/* */
function updateClass (oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
var oldData = oldVnode.data;
if (
isUndef(data.staticClass) &&
isUndef(data.class) && (
isUndef(oldData) || (
isUndef(oldData.staticClass) &&
isUndef(oldData.class)
)
)
) {
return
}
var cls = genClassForVnode(vnode);
// handle transition classes
var transitionClass = el._transitionClasses;
if (isDef(transitionClass)) {
cls = concat(cls, stringifyClass(transitionClass));
}
// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
el._prevClass = cls;
}
}
var klass = {
create: updateClass,
update: updateClass
};
/* */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function wrapFilter (exp, filter) {
var i = filter.indexOf('(');
if (i < 0) {
// _f: resolveFilter
return ("_f(\"" + filter + "\")(" + exp + ")")
} else {
var name = filter.slice(0, i);
var args = filter.slice(i + 1);
return ("_f(\"" + name + "\")(" + exp + "," + args)
}
}
/* */
/* */
/**
* Cross-platform code generation for component v-model
*/
/**
* Cross-platform codegen helper for generating v-model value assignment code.
*/
/**
* parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
*
* for loop possible cases:
*
* - test
* - test[idx]
* - test[test1[idx]]
* - test["a"][idx]
* - xxx.test[a[a].test1[idx]]
* - test.xxx.a["asa"][test1[idx]]
*
*/
var str;
var index$1;
/* */
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';
/* */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
// user-attached handlers.
function normalizeEvents (on) {
var event;
/* istanbul ignore if */
if (isDef(on[RANGE_TOKEN])) {
// IE input[type=range] only supports `change` event
event = isIE ? 'change' : 'input';
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
delete on[RANGE_TOKEN];
}
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
// Chrome fires microtasks in between click/change, leads to #4521
event = isChrome ? 'click' : 'change';
on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
delete on[CHECKBOX_RADIO_TOKEN];
}
}
var target$1;
function add$1 (
event,
handler,
once$$1,
capture,
passive
) {
if (once$$1) {
var oldHandler = handler;
var _target = target$1; // save current target element in closure
handler = function (ev) {
var res = arguments.length === 1
? oldHandler(ev)
: oldHandler.apply(null, arguments);
if (res !== null) {
remove$2(event, handler, capture, _target);
}
};
}
target$1.addEventListener(
event,
handler,
supportsPassive
? { capture: capture, passive: passive }
: capture
);
}
function remove$2 (
event,
handler,
capture,
_target
) {
(_target || target$1).removeEventListener(event, handler, capture);
}
function updateDOMListeners (oldVnode, vnode) {
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
return
}
var on = vnode.data.on || {};
var oldOn = oldVnode.data.on || {};
target$1 = vnode.elm;
normalizeEvents(on);
updateListeners(on, oldOn, add$1, remove$2, vnode.context);
}
var events = {
create: updateDOMListeners,
update: updateDOMListeners
};
/* */
function updateDOMProps (oldVnode, vnode) {
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
return
}
var key, cur;
var elm = vnode.elm;
var oldProps = oldVnode.data.domProps || {};
var props = vnode.data.domProps || {};
// clone observed objects, as the user probably wants to mutate it
if (isDef(props.__ob__)) {
props = vnode.data.domProps = extend({}, props);
}
for (key in oldProps) {
if (isUndef(props[key])) {
elm[key] = '';
}
}
for (key in props) {
cur = props[key];
// ignore children if the node has textContent or innerHTML,
// as these will throw away existing DOM nodes and cause removal errors
// on subsequent patches (#3360)
if (key === 'textContent' || key === 'innerHTML') {
if (vnode.children) { vnode.children.length = 0; }
if (cur === oldProps[key]) { continue }
}
if (key === 'value') {
// store value as _value as well since
// non-string values will be stringified
elm._value = cur;
// avoid resetting cursor position when value is the same
var strCur = isUndef(cur) ? '' : String(cur);
if (shouldUpdateValue(elm, vnode, strCur)) {
elm.value = strCur;
}
} else {
elm[key] = cur;
}
}
}
// check platforms/web/util/attrs.js acceptValue
function shouldUpdateValue (
elm,
vnode,
checkVal
) {
return (!elm.composing && (
vnode.tag === 'option' ||
isDirty(elm, checkVal) ||
isInputChanged(elm, checkVal)
))
}
function isDirty (elm, checkVal) {
// return true when textbox (.number and .trim) loses focus and its value is
// not equal to the updated value
var notInFocus = true;
// #6157
// work around IE bug when accessing document.activeElement in an iframe
try { notInFocus = document.activeElement !== elm; } catch (e) {}
return notInFocus && elm.value !== checkVal
}
function isInputChanged (elm, newVal) {
var value = elm.value;
var modifiers = elm._vModifiers; // injected by v-model runtime
if (isDef(modifiers) && modifiers.number) {
return toNumber(value) !== toNumber(newVal)
}
if (isDef(modifiers) && modifiers.trim) {
return value.trim() !== newVal.trim()
}
return value !== newVal
}
var domProps = {
create: updateDOMProps,
update: updateDOMProps
};
/* */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
var propertyDelimiter = /:(.+)/;
cssText.split(listDelimiter).forEach(function (item) {
if (item) {
var tmp = item.split(propertyDelimiter);
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
}
});
return res
});
// merge static and dynamic style data on the same vnode
function normalizeStyleData (data) {
var style = normalizeStyleBinding(data.style);
// static style is pre-processed into an object during compilation
// and is always a fresh object, so it's safe to merge into it
return data.staticStyle
? extend(data.staticStyle, style)
: style
}
// normalize possible array / string values into Object
function normalizeStyleBinding (bindingStyle) {
if (Array.isArray(bindingStyle)) {
return toObject(bindingStyle)
}
if (typeof bindingStyle === 'string') {
return parseStyleText(bindingStyle)
}
return bindingStyle
}
/**
* parent component style should be after child's
* so that parent component's style could override it
*/
function getStyle (vnode, checkChild) {
var res = {};
var styleData;
if (checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
extend(res, styleData);
}
}
}
if ((styleData = normalizeStyleData(vnode.data))) {
extend(res, styleData);
}
var parentNode = vnode;
while ((parentNode = parentNode.parent)) {
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
extend(res, styleData);
}
}
return res
}
/* */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
} else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important');
} else {
var normalizedName = normalize(name);
if (Array.isArray(val)) {
// Support values array created by autoprefixer, e.g.
// {display: ["-webkit-box", "-ms-flexbox", "flex"]}
// Set them one by one, and the browser will only set those it can recognize
for (var i = 0, len = val.length; i < len; i++) {
el.style[normalizedName] = val[i];
}
} else {
el.style[normalizedName] = val;
}
}
};
var vendorNames = ['Webkit', 'Moz', 'ms'];
var emptyStyle;
var normalize = cached(function (prop) {
emptyStyle = emptyStyle || document.createElement('div').style;
prop = camelize(prop);
if (prop !== 'filter' && (prop in emptyStyle)) {
return prop
}
var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
for (var i = 0; i < vendorNames.length; i++) {
var name = vendorNames[i] + capName;
if (name in emptyStyle) {
return name
}
}
});
function updateStyle (oldVnode, vnode) {
var data = vnode.data;
var oldData = oldVnode.data;
if (isUndef(data.staticStyle) && isUndef(data.style) &&
isUndef(oldData.staticStyle) && isUndef(oldData.style)
) {
return
}
var cur, name;
var el = vnode.elm;
var oldStaticStyle = oldData.staticStyle;
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
var oldStyle = oldStaticStyle || oldStyleBinding;
var style = normalizeStyleBinding(vnode.data.style) || {};
// store normalized style under a different key for next diff
// make sure to clone it if it's reactive, since the user likley wants
// to mutate it.
vnode.data.normalizedStyle = isDef(style.__ob__)
? extend({}, style)
: style;
var newStyle = getStyle(vnode, true);
for (name in oldStyle) {
if (isUndef(newStyle[name])) {
setProp(el, name, '');
}
}
for (name in newStyle) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
}
}
}
var style = {
create: updateStyle,
update: updateStyle
};
/* */
/**
* Add class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function addClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
} else {
el.classList.add(cls);
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
if (cur.indexOf(' ' + cls + ' ') < 0) {
el.setAttribute('class', (cur + cls).trim());
}
}
}
/**
* Remove class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function removeClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
} else {
el.classList.remove(cls);
}
if (!el.classList.length) {
el.removeAttribute('class');
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
var tar = ' ' + cls + ' ';
while (cur.indexOf(tar) >= 0) {
cur = cur.replace(tar, ' ');
}
cur = cur.trim();
if (cur) {
el.setAttribute('class', cur);
} else {
el.removeAttribute('class');
}
}
}
/* */
function resolveTransition (def$$1) {
if (!def$$1) {
return
}
/* istanbul ignore else */
if (typeof def$$1 === 'object') {
var res = {};
if (def$$1.css !== false) {
extend(res, autoCssTransition(def$$1.name || 'v'));
}
extend(res, def$$1);
return res
} else if (typeof def$$1 === 'string') {
return autoCssTransition(def$$1)
}
}
var autoCssTransition = cached(function (name) {
return {
enterClass: (name + "-enter"),
enterToClass: (name + "-enter-to"),
enterActiveClass: (name + "-enter-active"),
leaveClass: (name + "-leave"),
leaveToClass: (name + "-leave-to"),
leaveActiveClass: (name + "-leave-active")
}
});
var hasTransition = inBrowser && !isIE9;
var TRANSITION = 'transition';
var ANIMATION = 'animation';
// Transition property/event sniffing
var transitionProp = 'transition';
var transitionEndEvent = 'transitionend';
var animationProp = 'animation';
var animationEndEvent = 'animationend';
if (hasTransition) {
/* istanbul ignore if */
if (window.ontransitionend === undefined &&
window.onwebkittransitionend !== undefined
) {
transitionProp = 'WebkitTransition';
transitionEndEvent = 'webkitTransitionEnd';
}
if (window.onanimationend === undefined &&
window.onwebkitanimationend !== undefined
) {
animationProp = 'WebkitAnimation';
animationEndEvent = 'webkitAnimationEnd';
}
}
// binding to window is necessary to make hot reload work in IE in strict mode
var raf = inBrowser && window.requestAnimationFrame
? window.requestAnimationFrame.bind(window)
: setTimeout;
function nextFrame (fn) {
raf(function () {
raf(fn);
});
}
function addTransitionClass (el, cls) {
var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
if (transitionClasses.indexOf(cls) < 0) {
transitionClasses.push(cls);
addClass(el, cls);
}
}
function removeTransitionClass (el, cls) {
if (el._transitionClasses) {
remove(el._transitionClasses, cls);
}
removeClass(el, cls);
}
function whenTransitionEnds (
el,
expectedType,
cb
) {
var ref = getTransitionInfo(el, expectedType);
var type = ref.type;
var timeout = ref.timeout;
var propCount = ref.propCount;
if (!type) { return cb() }
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
var ended = 0;
var end = function () {
el.removeEventListener(event, onEnd);
cb();
};
var onEnd = function (e) {
if (e.target === el) {
if (++ended >= propCount) {
end();
}
}
};
setTimeout(function () {
if (ended < propCount) {
end();
}
}, timeout + 1);
el.addEventListener(event, onEnd);
}
var transformRE = /\b(transform|all)(,|$)/;
function getTransitionInfo (el, expectedType) {
var styles = window.getComputedStyle(el);
var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
var animationDelays = styles[animationProp + 'Delay'].split(', ');
var animationDurations = styles[animationProp + 'Duration'].split(', ');
var animationTimeout = getTimeout(animationDelays, animationDurations);
var type;
var timeout = 0;
var propCount = 0;
/* istanbul ignore if */
if (expectedType === TRANSITION) {
if (transitionTimeout > 0) {
type = TRANSITION;
timeout = transitionTimeout;
propCount = transitionDurations.length;
}
} else if (expectedType === ANIMATION) {
if (animationTimeout > 0) {
type = ANIMATION;
timeout = animationTimeout;
propCount = animationDurations.length;
}
} else {
timeout = Math.max(transitionTimeout, animationTimeout);
type = timeout > 0
? transitionTimeout > animationTimeout
? TRANSITION
: ANIMATION
: null;
propCount = type
? type === TRANSITION
? transitionDurations.length
: animationDurations.length
: 0;
}
var hasTransform =
type === TRANSITION &&
transformRE.test(styles[transitionProp + 'Property']);
return {
type: type,
timeout: timeout,
propCount: propCount,
hasTransform: hasTransform
}
}
function getTimeout (delays, durations) {
/* istanbul ignore next */
while (delays.length < durations.length) {
delays = delays.concat(delays);
}
return Math.max.apply(null, durations.map(function (d, i) {
return toMs(d) + toMs(delays[i])
}))
}
function toMs (s) {
return Number(s.slice(0, -1)) * 1000
}
/* */
function enter (vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
if (isDef(el._leaveCb)) {
el._leaveCb.cancelled = true;
el._leaveCb();
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
return
}
/* istanbul ignore if */
if (isDef(el._enterCb) || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var enterClass = data.enterClass;
var enterToClass = data.enterToClass;
var enterActiveClass = data.enterActiveClass;
var appearClass = data.appearClass;
var appearToClass = data.appearToClass;
var appearActiveClass = data.appearActiveClass;
var beforeEnter = data.beforeEnter;
var enter = data.enter;
var afterEnter = data.afterEnter;
var enterCancelled = data.enterCancelled;
var beforeAppear = data.beforeAppear;
var appear = data.appear;
var afterAppear = data.afterAppear;
var appearCancelled = data.appearCancelled;
var duration = data.duration;
// activeInstance will always be the <transition> component managing this
// transition. One edge case to check is when the <transition> is placed
// as the root node of a child component. In that case we need to check
// <transition>'s parent for appear check.
var context = activeInstance;
var transitionNode = activeInstance.$vnode;
while (transitionNode && transitionNode.parent) {
transitionNode = transitionNode.parent;
context = transitionNode.context;
}
var isAppear = !context._isMounted || !vnode.isRootInsert;
if (isAppear && !appear && appear !== '') {
return
}
var startClass = isAppear && appearClass
? appearClass
: enterClass;
var activeClass = isAppear && appearActiveClass
? appearActiveClass
: enterActiveClass;
var toClass = isAppear && appearToClass
? appearToClass
: enterToClass;
var beforeEnterHook = isAppear
? (beforeAppear || beforeEnter)
: beforeEnter;
var enterHook = isAppear
? (typeof appear === 'function' ? appear : enter)
: enter;
var afterEnterHook = isAppear
? (afterAppear || afterEnter)
: afterEnter;
var enterCancelledHook = isAppear
? (appearCancelled || enterCancelled)
: enterCancelled;
var explicitEnterDuration = toNumber(
isObject(duration)
? duration.enter
: duration
);
if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
checkDuration(explicitEnterDuration, 'enter', vnode);
}
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(enterHook);
var cb = el._enterCb = once(function () {
if (expectsCSS) {
removeTransitionClass(el, toClass);
removeTransitionClass(el, activeClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, startClass);
}
enterCancelledHook && enterCancelledHook(el);
} else {
afterEnterHook && afterEnterHook(el);
}
el._enterCb = null;
});
if (!vnode.data.show) {
// remove pending leave element on enter by injecting an insert hook
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
var parent = el.parentNode;
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
if (pendingNode &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb
) {
pendingNode.elm._leaveCb();
}
enterHook && enterHook(el, cb);
});
}
// start enter transition
beforeEnterHook && beforeEnterHook(el);
if (expectsCSS) {
addTransitionClass(el, startClass);
addTransitionClass(el, activeClass);
nextFrame(function () {
addTransitionClass(el, toClass);
removeTransitionClass(el, startClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitEnterDuration)) {
setTimeout(cb, explicitEnterDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
if (vnode.data.show) {
toggleDisplay && toggleDisplay();
enterHook && enterHook(el, cb);
}
if (!expectsCSS && !userWantsControl) {
cb();
}
}
function leave (vnode, rm) {
var el = vnode.elm;
// call enter callback now
if (isDef(el._enterCb)) {
el._enterCb.cancelled = true;
el._enterCb();
}
var data = resolveTransition(vnode.data.transition);
if (isUndef(data)) {
return rm()
}
/* istanbul ignore if */
if (isDef(el._leaveCb) || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var leaveClass = data.leaveClass;
var leaveToClass = data.leaveToClass;
var leaveActiveClass = data.leaveActiveClass;
var beforeLeave = data.beforeLeave;
var leave = data.leave;
var afterLeave = data.afterLeave;
var leaveCancelled = data.leaveCancelled;
var delayLeave = data.delayLeave;
var duration = data.duration;
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(leave);
var explicitLeaveDuration = toNumber(
isObject(duration)
? duration.leave
: duration
);
if (process.env.NODE_ENV !== 'production' && isDef(explicitLeaveDuration)) {
checkDuration(explicitLeaveDuration, 'leave', vnode);
}
var cb = el._leaveCb = once(function () {
if (el.parentNode && el.parentNode._pending) {
el.parentNode._pending[vnode.key] = null;
}
if (expectsCSS) {
removeTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveActiveClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, leaveClass);
}
leaveCancelled && leaveCancelled(el);
} else {
rm();
afterLeave && afterLeave(el);
}
el._leaveCb = null;
});
if (delayLeave) {
delayLeave(performLeave);
} else {
performLeave();
}
function performLeave () {
// the delayed leave may have already been cancelled
if (cb.cancelled) {
return
}
// record leaving element
if (!vnode.data.show) {
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
}
beforeLeave && beforeLeave(el);
if (expectsCSS) {
addTransitionClass(el, leaveClass);
addTransitionClass(el, leaveActiveClass);
nextFrame(function () {
addTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitLeaveDuration)) {
setTimeout(cb, explicitLeaveDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
leave && leave(el, cb);
if (!expectsCSS && !userWantsControl) {
cb();
}
}
}
// only used in dev mode
function checkDuration (val, name, vnode) {
if (typeof val !== 'number') {
warn(
"<transition> explicit " + name + " duration is not a valid number - " +
"got " + (JSON.stringify(val)) + ".",
vnode.context
);
} else if (isNaN(val)) {
warn(
"<transition> explicit " + name + " duration is NaN - " +
'the duration expression might be incorrect.',
vnode.context
);
}
}
function isValidDuration (val) {
return typeof val === 'number' && !isNaN(val)
}
/**
* Normalize a transition hook's argument length. The hook may be:
* - a merged hook (invoker) with the original in .fns
* - a wrapped component method (check ._length)
* - a plain function (.length)
*/
function getHookArgumentsLength (fn) {
if (isUndef(fn)) {
return false
}
var invokerFns = fn.fns;
if (isDef(invokerFns)) {
// invoker
return getHookArgumentsLength(
Array.isArray(invokerFns)
? invokerFns[0]
: invokerFns
)
} else {
return (fn._length || fn.length) > 1
}
}
function _enter (_, vnode) {
if (vnode.data.show !== true) {
enter(vnode);
}
}
var transition = inBrowser ? {
create: _enter,
activate: _enter,
remove: function remove$$1 (vnode, rm) {
/* istanbul ignore else */
if (vnode.data.show !== true) {
leave(vnode, rm);
} else {
rm();
}
}
} : {};
var platformModules = [
attrs,
klass,
events,
domProps,
style,
transition
];
/* */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
/**
* Not type checking this file because flow doesn't like attaching
* properties to Elements.
*/
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
/* istanbul ignore if */
if (isIE9) {
// http://www.matts411.com/post/internet-explorer-9-oninput/
document.addEventListener('selectionchange', function () {
var el = document.activeElement;
if (el && el.vmodel) {
trigger(el, 'input');
}
});
}
var model$1 = {
inserted: function inserted (el, binding, vnode) {
if (vnode.tag === 'select') {
var cb = function () {
setSelected(el, binding, vnode.context);
};
cb();
/* istanbul ignore if */
if (isIE || isEdge) {
setTimeout(cb, 0);
}
el._vOptions = [].map.call(el.options, getValue);
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
el._vModifiers = binding.modifiers;
if (!binding.modifiers.lazy) {
// Safari < 10.2 & UIWebView doesn't fire compositionend when
// switching focus before confirming composition choice
// this also fixes the issue where some browsers e.g. iOS Chrome
// fires "change" instead of "input" on autocomplete.
el.addEventListener('change', onCompositionEnd);
if (!isAndroid) {
el.addEventListener('compositionstart', onCompositionStart);
el.addEventListener('compositionend', onCompositionEnd);
}
/* istanbul ignore if */
if (isIE9) {
el.vmodel = true;
}
}
}
},
componentUpdated: function componentUpdated (el, binding, vnode) {
if (vnode.tag === 'select') {
setSelected(el, binding, vnode.context);
// in case the options rendered by v-for have changed,
// it's possible that the value is out-of-sync with the rendered options.
// detect such cases and filter out values that no longer has a matching
// option in the DOM.
var prevOptions = el._vOptions;
var curOptions = el._vOptions = [].map.call(el.options, getValue);
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
trigger(el, 'change');
}
}
}
};
function setSelected (el, binding, vm) {
var value = binding.value;
var isMultiple = el.multiple;
if (isMultiple && !Array.isArray(value)) {
process.env.NODE_ENV !== 'production' && warn(
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
vm
);
return
}
var selected, option;
for (var i = 0, l = el.options.length; i < l; i++) {
option = el.options[i];
if (isMultiple) {
selected = looseIndexOf(value, getValue(option)) > -1;
if (option.selected !== selected) {
option.selected = selected;
}
} else {
if (looseEqual(getValue(option), value)) {
if (el.selectedIndex !== i) {
el.selectedIndex = i;
}
return
}
}
}
if (!isMultiple) {
el.selectedIndex = -1;
}
}
function getValue (option) {
return '_value' in option
? option._value
: option.value
}
function onCompositionStart (e) {
e.target.composing = true;
}
function onCompositionEnd (e) {
// prevent triggering an input event for no reason
if (!e.target.composing) { return }
e.target.composing = false;
trigger(e.target, 'input');
}
function trigger (el, type) {
var e = document.createEvent('HTMLEvents');
e.initEvent(type, true, true);
el.dispatchEvent(e);
}
/* */
// recursively search for possible transition defined inside the component root
function locateNode (vnode) {
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
? locateNode(vnode.componentInstance._vnode)
: vnode
}
var show = {
bind: function bind (el, ref, vnode) {
var value = ref.value;
vnode = locateNode(vnode);
var transition$$1 = vnode.data && vnode.data.transition;
var originalDisplay = el.__vOriginalDisplay =
el.style.display === 'none' ? '' : el.style.display;
if (value && transition$$1) {
vnode.data.show = true;
enter(vnode, function () {
el.style.display = originalDisplay;
});
} else {
el.style.display = value ? originalDisplay : 'none';
}
},
update: function update (el, ref, vnode) {
var value = ref.value;
var oldValue = ref.oldValue;
/* istanbul ignore if */
if (value === oldValue) { return }
vnode = locateNode(vnode);
var transition$$1 = vnode.data && vnode.data.transition;
if (transition$$1) {
vnode.data.show = true;
if (value) {
enter(vnode, function () {
el.style.display = el.__vOriginalDisplay;
});
} else {
leave(vnode, function () {
el.style.display = 'none';
});
}
} else {
el.style.display = value ? el.__vOriginalDisplay : 'none';
}
},
unbind: function unbind (
el,
binding,
vnode,
oldVnode,
isDestroy
) {
if (!isDestroy) {
el.style.display = el.__vOriginalDisplay;
}
}
};
var platformDirectives = {
model: model$1,
show: show
};
/* */
// Provides transition support for a single element/component.
// supports transition mode (out-in / in-out)
var transitionProps = {
name: String,
appear: Boolean,
css: Boolean,
mode: String,
type: String,
enterClass: String,
leaveClass: String,
enterToClass: String,
leaveToClass: String,
enterActiveClass: String,
leaveActiveClass: String,
appearClass: String,
appearActiveClass: String,
appearToClass: String,
duration: [Number, String, Object]
};
// in case the child is also an abstract component, e.g. <keep-alive>
// we want to recursively retrieve the real component to be rendered
function getRealChild (vnode) {
var compOptions = vnode && vnode.componentOptions;
if (compOptions && compOptions.Ctor.options.abstract) {
return getRealChild(getFirstComponentChild(compOptions.children))
} else {
return vnode
}
}
function extractTransitionData (comp) {
var data = {};
var options = comp.$options;
// props
for (var key in options.propsData) {
data[key] = comp[key];
}
// events.
// extract listeners and pass them directly to the transition methods
var listeners = options._parentListeners;
for (var key$1 in listeners) {
data[camelize(key$1)] = listeners[key$1];
}
return data
}
function placeholder (h, rawChild) {
if (/\d-keep-alive$/.test(rawChild.tag)) {
return h('keep-alive', {
props: rawChild.componentOptions.propsData
})
}
}
function hasParentTransition (vnode) {
while ((vnode = vnode.parent)) {
if (vnode.data.transition) {
return true
}
}
}
function isSameChild (child, oldChild) {
return oldChild.key === child.key && oldChild.tag === child.tag
}
function isAsyncPlaceholder (node) {
return node.isComment && node.asyncFactory
}
var Transition = {
name: 'transition',
props: transitionProps,
abstract: true,
render: function render (h) {
var this$1 = this;
var children = this.$options._renderChildren;
if (!children) {
return
}
// filter out text nodes (possible whitespaces)
children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
/* istanbul ignore if */
if (!children.length) {
return
}
// warn multiple elements
if (process.env.NODE_ENV !== 'production' && children.length > 1) {
warn(
'<transition> can only be used on a single element. Use ' +
'<transition-group> for lists.',
this.$parent
);
}
var mode = this.mode;
// warn invalid mode
if (process.env.NODE_ENV !== 'production' &&
mode && mode !== 'in-out' && mode !== 'out-in'
) {
warn(
'invalid <transition> mode: ' + mode,
this.$parent
);
}
var rawChild = children[0];
// if this is a component root node and the component's
// parent container node also has transition, skip.
if (hasParentTransition(this.$vnode)) {
return rawChild
}
// apply transition data to child
// use getRealChild() to ignore abstract components e.g. keep-alive
var child = getRealChild(rawChild);
/* istanbul ignore if */
if (!child) {
return rawChild
}
if (this._leaving) {
return placeholder(h, rawChild)
}
// ensure a key that is unique to the vnode type and to this transition
// component instance. This key will be used to remove pending leaving nodes
// during entering.
var id = "__transition-" + (this._uid) + "-";
child.key = child.key == null
? child.isComment
? id + 'comment'
: id + child.tag
: isPrimitive(child.key)
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
: child.key;
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
var oldRawChild = this._vnode;
var oldChild = getRealChild(oldRawChild);
// mark v-show
// so that the transition module can hand over the control to the directive
if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
child.data.show = true;
}
if (
oldChild &&
oldChild.data &&
!isSameChild(child, oldChild) &&
!isAsyncPlaceholder(oldChild)
) {
// replace old child transition data with fresh one
// important for dynamic transitions!
var oldData = oldChild && (oldChild.data.transition = extend({}, data));
// handle transition mode
if (mode === 'out-in') {
// return placeholder node and queue update when leave finishes
this._leaving = true;
mergeVNodeHook(oldData, 'afterLeave', function () {
this$1._leaving = false;
this$1.$forceUpdate();
});
return placeholder(h, rawChild)
} else if (mode === 'in-out') {
if (isAsyncPlaceholder(child)) {
return oldRawChild
}
var delayedLeave;
var performLeave = function () { delayedLeave(); };
mergeVNodeHook(data, 'afterEnter', performLeave);
mergeVNodeHook(data, 'enterCancelled', performLeave);
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
}
}
return rawChild
}
};
/* */
// Provides transition support for list items.
// supports move transitions using the FLIP technique.
// Because the vdom's children update algorithm is "unstable" - i.e.
// it doesn't guarantee the relative positioning of removed elements,
// we force transition-group to update its children into two passes:
// in the first pass, we remove all nodes that need to be removed,
// triggering their leaving transition; in the second pass, we insert/move
// into the final desired state. This way in the second pass removed
// nodes will remain where they should be.
var props = extend({
tag: String,
moveClass: String
}, transitionProps);
delete props.mode;
var TransitionGroup = {
props: props,
render: function render (h) {
var tag = this.tag || this.$vnode.data.tag || 'span';
var map = Object.create(null);
var prevChildren = this.prevChildren = this.children;
var rawChildren = this.$slots.default || [];
var children = this.children = [];
var transitionData = extractTransitionData(this);
for (var i = 0; i < rawChildren.length; i++) {
var c = rawChildren[i];
if (c.tag) {
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
children.push(c);
map[c.key] = c
;(c.data || (c.data = {})).transition = transitionData;
} else if (process.env.NODE_ENV !== 'production') {
var opts = c.componentOptions;
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
warn(("<transition-group> children must be keyed: <" + name + ">"));
}
}
}
if (prevChildren) {
var kept = [];
var removed = [];
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
var c$1 = prevChildren[i$1];
c$1.data.transition = transitionData;
c$1.data.pos = c$1.elm.getBoundingClientRect();
if (map[c$1.key]) {
kept.push(c$1);
} else {
removed.push(c$1);
}
}
this.kept = h(tag, null, kept);
this.removed = removed;
}
return h(tag, null, children)
},
beforeUpdate: function beforeUpdate () {
// force removing pass
this.__patch__(
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
);
this._vnode = this.kept;
},
updated: function updated () {
var children = this.prevChildren;
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
return
}
// we divide the work into three loops to avoid mixing DOM reads and writes
// in each iteration - which helps prevent layout thrashing.
children.forEach(callPendingCbs);
children.forEach(recordPosition);
children.forEach(applyTranslation);
// force reflow to put everything in position
var body = document.body;
var f = body.offsetHeight; // eslint-disable-line
children.forEach(function (c) {
if (c.data.moved) {
var el = c.elm;
var s = el.style;
addTransitionClass(el, moveClass);
s.transform = s.WebkitTransform = s.transitionDuration = '';
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
if (!e || /transform$/.test(e.propertyName)) {
el.removeEventListener(transitionEndEvent, cb);
el._moveCb = null;
removeTransitionClass(el, moveClass);
}
});
}
});
},
methods: {
hasMove: function hasMove (el, moveClass) {
/* istanbul ignore if */
if (!hasTransition) {
return false
}
/* istanbul ignore if */
if (this._hasMove) {
return this._hasMove
}
// Detect whether an element with the move class applied has
// CSS transitions. Since the element may be inside an entering
// transition at this very moment, we make a clone of it and remove
// all other transition classes applied to ensure only the move class
// is applied.
var clone = el.cloneNode();
if (el._transitionClasses) {
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
}
addClass(clone, moveClass);
clone.style.display = 'none';
this.$el.appendChild(clone);
var info = getTransitionInfo(clone);
this.$el.removeChild(clone);
return (this._hasMove = info.hasTransform)
}
}
};
function callPendingCbs (c) {
/* istanbul ignore if */
if (c.elm._moveCb) {
c.elm._moveCb();
}
/* istanbul ignore if */
if (c.elm._enterCb) {
c.elm._enterCb();
}
}
function recordPosition (c) {
c.data.newPos = c.elm.getBoundingClientRect();
}
function applyTranslation (c) {
var oldPos = c.data.pos;
var newPos = c.data.newPos;
var dx = oldPos.left - newPos.left;
var dy = oldPos.top - newPos.top;
if (dx || dy) {
c.data.moved = true;
var s = c.elm.style;
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
s.transitionDuration = '0s';
}
}
var platformComponents = {
Transition: Transition,
TransitionGroup: TransitionGroup
};
/* */
// install platform specific utils
Vue$3.config.mustUseProp = mustUseProp;
Vue$3.config.isReservedTag = isReservedTag;
Vue$3.config.isReservedAttr = isReservedAttr;
Vue$3.config.getTagNamespace = getTagNamespace;
Vue$3.config.isUnknownElement = isUnknownElement;
// install platform runtime directives & components
extend(Vue$3.options.directives, platformDirectives);
extend(Vue$3.options.components, platformComponents);
// install platform patch function
Vue$3.prototype.__patch__ = inBrowser ? patch : noop;
// public mount method
Vue$3.prototype.$mount = function (
el,
hydrating
) {
el = el && inBrowser ? query(el) : undefined;
return mountComponent(this, el, hydrating)
};
// devtools global hook
/* istanbul ignore next */
setTimeout(function () {
if (config.devtools) {
if (devtools) {
devtools.emit('init', Vue$3);
} else if (process.env.NODE_ENV !== 'production' && isChrome) {
console[console.info ? 'info' : 'log'](
'Download the Vue Devtools extension for a better development experience:\n' +
'https://github.com/vuejs/vue-devtools'
);
}
}
if (process.env.NODE_ENV !== 'production' &&
config.productionTip !== false &&
inBrowser && typeof console !== 'undefined'
) {
console[console.info ? 'info' : 'log'](
"You are running Vue in development mode.\n" +
"Make sure to turn on production mode when deploying for production.\n" +
"See more tips at https://vuejs.org/guide/deployment.html"
);
}
}, 0);
/* */
/* harmony default export */ __webpack_exports__["default"] = (Vue$3);
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(8), __webpack_require__(9)))
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.getStyle = exports.once = exports.off = exports.on = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* istanbul ignore next */
exports.hasClass = hasClass;
exports.addClass = addClass;
exports.removeClass = removeClass;
exports.setStyle = setStyle;
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var isServer = _vue2.default.prototype.$isServer;
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
var ieVersion = isServer ? 0 : Number(document.documentMode);
/* istanbul ignore next */
var trim = function trim(string) {
return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
};
/* istanbul ignore next */
var camelCase = function camelCase(name) {
return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
return offset ? letter.toUpperCase() : letter;
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
};
/* istanbul ignore next */
var on = exports.on = function () {
if (!isServer && document.addEventListener) {
return function (element, event, handler) {
if (element && event && handler) {
element.addEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event && handler) {
element.attachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var off = exports.off = function () {
if (!isServer && document.removeEventListener) {
return function (element, event, handler) {
if (element && event) {
element.removeEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event) {
element.detachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var once = exports.once = function once(el, event, fn) {
var listener = function listener() {
if (fn) {
fn.apply(this, arguments);
}
off(el, event, listener);
};
on(el, event, listener);
};
/* istanbul ignore next */
function hasClass(el, cls) {
if (!el || !cls) return false;
if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
if (el.classList) {
return el.classList.contains(cls);
} else {
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
};
/* istanbul ignore next */
function addClass(el, cls) {
if (!el) return;
var curClass = el.className;
var classes = (cls || '').split(' ');
for (var i = 0, j = classes.length; i < j; i++) {
var clsName = classes[i];
if (!clsName) continue;
if (el.classList) {
el.classList.add(clsName);
} else {
if (!hasClass(el, clsName)) {
curClass += ' ' + clsName;
}
}
}
if (!el.classList) {
el.className = curClass;
}
};
/* istanbul ignore next */
function removeClass(el, cls) {
if (!el || !cls) return;
var classes = cls.split(' ');
var curClass = ' ' + el.className + ' ';
for (var i = 0, j = classes.length; i < j; i++) {
var clsName = classes[i];
if (!clsName) continue;
if (el.classList) {
el.classList.remove(clsName);
} else {
if (hasClass(el, clsName)) {
curClass = curClass.replace(' ' + clsName + ' ', ' ');
}
}
}
if (!el.classList) {
el.className = trim(curClass);
}
};
/* istanbul ignore next */
var getStyle = exports.getStyle = ieVersion < 9 ? function (element, styleName) {
if (isServer) return;
if (!element || !styleName) return null;
styleName = camelCase(styleName);
if (styleName === 'float') {
styleName = 'styleFloat';
}
try {
switch (styleName) {
case 'opacity':
try {
return element.filters.item('alpha').opacity / 100;
} catch (e) {
return 1.0;
}
default:
return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
}
} catch (e) {
return element.style[styleName];
}
} : function (element, styleName) {
if (isServer) return;
if (!element || !styleName) return null;
styleName = camelCase(styleName);
if (styleName === 'float') {
styleName = 'cssFloat';
}
try {
var computed = document.defaultView.getComputedStyle(element, '');
return element.style[styleName] || computed ? computed[styleName] : null;
} catch (e) {
return element.style[styleName];
}
};
/* istanbul ignore next */
function setStyle(element, styleName, value) {
if (!element || !styleName) return;
if ((typeof styleName === 'undefined' ? 'undefined' : _typeof(styleName)) === 'object') {
for (var prop in styleName) {
if (styleName.hasOwnProperty(prop)) {
setStyle(element, prop, styleName[prop]);
}
}
} else {
styleName = camelCase(styleName);
if (styleName === 'opacity' && ieVersion < 9) {
element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
} else {
element.style[styleName] = value;
}
}
};
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
function _broadcast(componentName, eventName, params) {
this.$children.forEach(function (child) {
var name = child.$options.componentName;
if (name === componentName) {
child.$emit.apply(child, [eventName].concat(params));
} else {
_broadcast.apply(child, [componentName, eventName].concat([params]));
}
});
}
exports.default = {
methods: {
dispatch: function dispatch(componentName, eventName, params) {
var parent = this.$parent || this.$root;
var name = parent.$options.componentName;
while (parent && (!name || name !== componentName)) {
parent = parent.$parent;
if (parent) {
name = parent.$options.componentName;
}
}
if (parent) {
parent.$emit.apply(parent, [eventName].concat(params));
}
},
broadcast: function broadcast(componentName, eventName, params) {
_broadcast.call(this, componentName, eventName, params);
}
}
};
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.hasOwn = hasOwn;
exports.toObject = toObject;
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn(obj, key) {
return hasOwnProperty.call(obj, key);
};
function extend(to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to;
};
function toObject(arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res;
};
var getValueByPath = exports.getValueByPath = function getValueByPath(object, prop) {
prop = prop || '';
var paths = prop.split('.');
var current = object;
var result = null;
for (var i = 0, j = paths.length; i < j; i++) {
var path = paths[i];
if (!current) break;
if (i === j - 1) {
result = current[path];
break;
}
current = current[path];
}
return result;
};
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
/* eslint-disable no-undefined */
var throttle = __webpack_require__(23);
/**
* Debounce execution of a function. Debouncing, unlike throttling,
* guarantees that a function is only executed a single time, either at the
* very beginning of a series of calls, or at the very end.
*
* @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {Boolean} atBegin Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds
* after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.
* (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).
* @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the debounced-function is executed.
*
* @return {Function} A new, debounced function.
*/
module.exports = function ( delay, atBegin, callback ) {
return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false);
};
/***/ }),
/* 8 */
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/* 9 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(166);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 14:
/***/ function(module, exports) {
module.exports = __webpack_require__(5);
/***/ },
/***/ 166:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _input = __webpack_require__(167);
var _input2 = _interopRequireDefault(_input);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_input2.default.install = function (Vue) {
Vue.component(_input2.default.name, _input2.default);
};
exports.default = _input2.default;
/***/ },
/***/ 167:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(168),
/* template */
__webpack_require__(171),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 168:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(14);
var _emitter2 = _interopRequireDefault(_emitter);
var _calcTextareaHeight = __webpack_require__(169);
var _calcTextareaHeight2 = _interopRequireDefault(_calcTextareaHeight);
var _merge = __webpack_require__(170);
var _merge2 = _interopRequireDefault(_merge);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElInput',
componentName: 'ElInput',
mixins: [_emitter2.default],
data: function data() {
return {
currentValue: this.value,
textareaCalcStyle: {}
};
},
props: {
value: [String, Number],
placeholder: String,
size: String,
resize: String,
readonly: Boolean,
autofocus: Boolean,
icon: String,
disabled: Boolean,
type: {
type: String,
default: 'text'
},
name: String,
autosize: {
type: [Boolean, Object],
default: false
},
rows: {
type: Number,
default: 2
},
autoComplete: {
type: String,
default: 'off'
},
form: String,
maxlength: Number,
minlength: Number,
max: {},
min: {},
step: {},
validateEvent: {
type: Boolean,
default: true
},
onIconClick: Function
},
computed: {
validating: function validating() {
return this.$parent.validateState === 'validating';
},
textareaStyle: function textareaStyle() {
return (0, _merge2.default)({}, this.textareaCalcStyle, { resize: this.resize });
}
},
watch: {
'value': function value(val, oldValue) {
this.setCurrentValue(val);
}
},
methods: {
handleBlur: function handleBlur(event) {
this.$emit('blur', event);
if (this.validateEvent) {
this.dispatch('ElFormItem', 'el.form.blur', [this.currentValue]);
}
},
inputSelect: function inputSelect() {
this.$refs.input.select();
},
resizeTextarea: function resizeTextarea() {
if (this.$isServer) return;
var autosize = this.autosize,
type = this.type;
if (!autosize || type !== 'textarea') return;
var minRows = autosize.minRows;
var maxRows = autosize.maxRows;
this.textareaCalcStyle = (0, _calcTextareaHeight2.default)(this.$refs.textarea, minRows, maxRows);
},
handleFocus: function handleFocus(event) {
this.$emit('focus', event);
},
handleInput: function handleInput(event) {
var value = event.target.value;
this.$emit('input', value);
this.setCurrentValue(value);
this.$emit('change', value);
},
handleIconClick: function handleIconClick(event) {
if (this.onIconClick) {
this.onIconClick(event);
}
this.$emit('click', event);
},
setCurrentValue: function setCurrentValue(value) {
var _this = this;
if (value === this.currentValue) return;
this.$nextTick(function (_) {
_this.resizeTextarea();
});
this.currentValue = value;
if (this.validateEvent) {
this.dispatch('ElFormItem', 'el.form.change', [value]);
}
}
},
created: function created() {
this.$on('inputSelect', this.inputSelect);
},
mounted: function mounted() {
this.resizeTextarea();
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/***/ 169:
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.default = calcTextareaHeight;
var hiddenTextarea = void 0;
var HIDDEN_STYLE = '\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n';
var CONTEXT_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing'];
function calculateNodeStyling(node) {
var style = window.getComputedStyle(node);
var boxSizing = style.getPropertyValue('box-sizing');
var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
var contextStyle = CONTEXT_STYLE.map(function (name) {
return name + ':' + style.getPropertyValue(name);
}).join(';');
return { contextStyle: contextStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing };
}
function calcTextareaHeight(targetNode) {
var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (!hiddenTextarea) {
hiddenTextarea = document.createElement('textarea');
document.body.appendChild(hiddenTextarea);
}
var _calculateNodeStyling = calculateNodeStyling(targetNode),
paddingSize = _calculateNodeStyling.paddingSize,
borderSize = _calculateNodeStyling.borderSize,
boxSizing = _calculateNodeStyling.boxSizing,
contextStyle = _calculateNodeStyling.contextStyle;
hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
hiddenTextarea.value = targetNode.value || targetNode.placeholder || '';
var height = hiddenTextarea.scrollHeight;
if (boxSizing === 'border-box') {
height = height + borderSize;
} else if (boxSizing === 'content-box') {
height = height - paddingSize;
}
hiddenTextarea.value = '';
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (minRows !== null) {
var minHeight = singleRowHeight * minRows;
if (boxSizing === 'border-box') {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
}
if (maxRows !== null) {
var maxHeight = singleRowHeight * maxRows;
if (boxSizing === 'border-box') {
maxHeight = maxHeight + paddingSize + borderSize;
}
height = Math.min(maxHeight, height);
}
return { height: height + 'px' };
};
/***/ },
/***/ 170:
/***/ function(module, exports) {
module.exports = __webpack_require__(11);
/***/ },
/***/ 171:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
class: [
_vm.type === 'textarea' ? 'el-textarea' : 'el-input',
_vm.size ? 'el-input--' + _vm.size : '', {
'is-disabled': _vm.disabled,
'el-input-group': _vm.$slots.prepend || _vm.$slots.append,
'el-input-group--append': _vm.$slots.append,
'el-input-group--prepend': _vm.$slots.prepend
}
]
}, [(_vm.type !== 'textarea') ? [(_vm.$slots.prepend) ? _c('div', {
staticClass: "el-input-group__prepend"
}, [_vm._t("prepend")], 2) : _vm._e(), _vm._t("icon", [(_vm.icon) ? _c('i', {
staticClass: "el-input__icon",
class: [
'el-icon-' + _vm.icon,
_vm.onIconClick ? 'is-clickable' : ''
],
on: {
"click": _vm.handleIconClick
}
}) : _vm._e()]), (_vm.type !== 'textarea') ? _c('input', _vm._b({
ref: "input",
staticClass: "el-input__inner",
attrs: {
"autocomplete": _vm.autoComplete
},
domProps: {
"value": _vm.currentValue
},
on: {
"input": _vm.handleInput,
"focus": _vm.handleFocus,
"blur": _vm.handleBlur
}
}, 'input', _vm.$props)) : _vm._e(), (_vm.validating) ? _c('i', {
staticClass: "el-input__icon el-icon-loading"
}) : _vm._e(), (_vm.$slots.append) ? _c('div', {
staticClass: "el-input-group__append"
}, [_vm._t("append")], 2) : _vm._e()] : _c('textarea', _vm._b({
ref: "textarea",
staticClass: "el-textarea__inner",
style: (_vm.textareaStyle),
domProps: {
"value": _vm.currentValue
},
on: {
"input": _vm.handleInput,
"focus": _vm.handleFocus,
"blur": _vm.handleBlur
}
}, 'textarea', _vm.$props))], 2)
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = function (target) {
for (var i = 1, j = arguments.length; i < j; i++) {
var source = arguments[i] || {};
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
var value = source[prop];
if (value !== undefined) {
target[prop] = value;
}
}
}
}
return target;
};
;
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
var _popup = __webpack_require__(19);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PopperJS = _vue2.default.prototype.$isServer ? function () {} : __webpack_require__(33);
var stop = function stop(e) {
return e.stopPropagation();
};
/**
* @param {HTMLElement} [reference=$refs.reference] - The reference element used to position the popper.
* @param {HTMLElement} [popper=$refs.popper] - The HTML element used as popper, or a configuration used to generate the popper.
* @param {String} [placement=button] - Placement of the popper accepted values: top(-start, -end), right(-start, -end), bottom(-start, -end), left(-start, -end)
* @param {Number} [offset=0] - Amount of pixels the popper will be shifted (can be negative).
* @param {Boolean} [visible=false] Visibility of the popup element.
* @param {Boolean} [visible-arrow=false] Visibility of the arrow, no style.
*/
exports.default = {
props: {
placement: {
type: String,
default: 'bottom'
},
boundariesPadding: {
type: Number,
default: 5
},
reference: {},
popper: {},
offset: {
default: 0
},
value: Boolean,
visibleArrow: Boolean,
transition: String,
appendToBody: {
type: Boolean,
default: true
},
popperOptions: {
type: Object,
default: function _default() {
return {
gpuAcceleration: false
};
}
}
},
data: function data() {
return {
showPopper: false,
currentPlacement: ''
};
},
watch: {
value: {
immediate: true,
handler: function handler(val) {
this.showPopper = val;
this.$emit('input', val);
}
},
showPopper: function showPopper(val) {
val ? this.updatePopper() : this.destroyPopper();
this.$emit('input', val);
}
},
methods: {
createPopper: function createPopper() {
var _this = this;
if (this.$isServer) return;
this.currentPlacement = this.currentPlacement || this.placement;
if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(this.currentPlacement)) {
return;
}
var options = this.popperOptions;
var popper = this.popperElm = this.popperElm || this.popper || this.$refs.popper;
var reference = this.referenceElm = this.referenceElm || this.reference || this.$refs.reference;
if (!reference && this.$slots.reference && this.$slots.reference[0]) {
reference = this.referenceElm = this.$slots.reference[0].elm;
}
if (!popper || !reference) return;
if (this.visibleArrow) this.appendArrow(popper);
if (this.appendToBody) document.body.appendChild(this.popperElm);
if (this.popperJS && this.popperJS.destroy) {
this.popperJS.destroy();
}
options.placement = this.currentPlacement;
options.offset = this.offset;
this.popperJS = new PopperJS(reference, popper, options);
this.popperJS.onCreate(function (_) {
_this.$emit('created', _this);
_this.resetTransformOrigin();
_this.$nextTick(_this.updatePopper);
});
if (typeof options.onUpdate === 'function') {
this.popperJS.onUpdate(options.onUpdate);
}
this.popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
this.popperElm.addEventListener('click', stop);
},
updatePopper: function updatePopper() {
this.popperJS ? this.popperJS.update() : this.createPopper();
},
doDestroy: function doDestroy() {
/* istanbul ignore if */
if (this.showPopper || !this.popperJS) return;
this.popperJS.destroy();
this.popperJS = null;
},
destroyPopper: function destroyPopper() {
if (this.popperJS) {
this.resetTransformOrigin();
}
},
resetTransformOrigin: function resetTransformOrigin() {
var placementMap = {
top: 'bottom',
bottom: 'top',
left: 'right',
right: 'left'
};
var placement = this.popperJS._popper.getAttribute('x-placement').split('-')[0];
var origin = placementMap[placement];
this.popperJS._popper.style.transformOrigin = ['top', 'bottom'].indexOf(placement) > -1 ? 'center ' + origin : origin + ' center';
},
appendArrow: function appendArrow(element) {
var hash = void 0;
if (this.appended) {
return;
}
this.appended = true;
for (var item in element.attributes) {
if (/^_v-/.test(element.attributes[item].name)) {
hash = element.attributes[item].name;
break;
}
}
var arrow = document.createElement('div');
if (hash) {
arrow.setAttribute(hash, '');
}
arrow.setAttribute('x-arrow', '');
arrow.className = 'popper__arrow';
element.appendChild(arrow);
}
},
beforeDestroy: function beforeDestroy() {
this.doDestroy();
if (this.popperElm && this.popperElm.parentNode === document.body) {
this.popperElm.removeEventListener('click', stop);
document.body.removeChild(this.popperElm);
}
},
// call destroy in keep-alive mode
deactivated: function deactivated() {
this.$options.beforeDestroy[0].call(this);
}
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = function () {
if (_vue2.default.prototype.$isServer) return 0;
if (scrollBarWidth !== undefined) return scrollBarWidth;
var outer = document.createElement('div');
outer.className = 'el-scrollbar__wrap';
outer.style.visibility = 'hidden';
outer.style.width = '100px';
outer.style.position = 'absolute';
outer.style.top = '-9999px';
document.body.appendChild(outer);
var widthNoScroll = outer.offsetWidth;
outer.style.overflow = 'scroll';
var inner = document.createElement('div');
inner.style.width = '100%';
outer.appendChild(inner);
var widthWithScroll = inner.offsetWidth;
outer.parentNode.removeChild(outer);
scrollBarWidth = widthNoScroll - widthWithScroll;
return scrollBarWidth;
};
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var scrollBarWidth = void 0;
;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
/* Modified from https://github.com/sdecima/javascript-detect-element-resize
* version: 0.5.3
*
* The MIT License (MIT)
*
* Copyright (c) 2013 Sebastián Décima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
var isServer = typeof window === 'undefined';
/* istanbul ignore next */
var requestFrame = function () {
if (isServer) return;
var raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || function (fn) {
return window.setTimeout(fn, 20);
};
return function (fn) {
return raf(fn);
};
}();
/* istanbul ignore next */
var cancelFrame = function () {
if (isServer) return;
var cancel = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.clearTimeout;
return function (id) {
return cancel(id);
};
}();
/* istanbul ignore next */
var resetTrigger = function resetTrigger(element) {
var trigger = element.__resizeTrigger__;
var expand = trigger.firstElementChild;
var contract = trigger.lastElementChild;
var expandChild = expand.firstElementChild;
contract.scrollLeft = contract.scrollWidth;
contract.scrollTop = contract.scrollHeight;
expandChild.style.width = expand.offsetWidth + 1 + 'px';
expandChild.style.height = expand.offsetHeight + 1 + 'px';
expand.scrollLeft = expand.scrollWidth;
expand.scrollTop = expand.scrollHeight;
};
/* istanbul ignore next */
var checkTriggers = function checkTriggers(element) {
return element.offsetWidth !== element.__resizeLast__.width || element.offsetHeight !== element.__resizeLast__.height;
};
/* istanbul ignore next */
var scrollListener = function scrollListener(event) {
var _this = this;
resetTrigger(this);
if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__);
this.__resizeRAF__ = requestFrame(function () {
if (checkTriggers(_this)) {
_this.__resizeLast__.width = _this.offsetWidth;
_this.__resizeLast__.height = _this.offsetHeight;
_this.__resizeListeners__.forEach(function (fn) {
fn.call(_this, event);
});
}
});
};
/* Detect CSS Animations support to detect element display/re-attach */
var attachEvent = isServer ? {} : document.attachEvent;
var DOM_PREFIXES = 'Webkit Moz O ms'.split(' ');
var START_EVENTS = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' ');
var RESIZE_ANIMATION_NAME = 'resizeanim';
var animation = false;
var keyFramePrefix = '';
var animationStartEvent = 'animationstart';
/* istanbul ignore next */
if (!attachEvent && !isServer) {
var testElement = document.createElement('fakeelement');
if (testElement.style.animationName !== undefined) {
animation = true;
}
if (animation === false) {
var prefix = '';
for (var i = 0; i < DOM_PREFIXES.length; i++) {
if (testElement.style[DOM_PREFIXES[i] + 'AnimationName'] !== undefined) {
prefix = DOM_PREFIXES[i];
keyFramePrefix = '-' + prefix.toLowerCase() + '-';
animationStartEvent = START_EVENTS[i];
animation = true;
break;
}
}
}
}
var stylesCreated = false;
/* istanbul ignore next */
var createStyles = function createStyles() {
if (!stylesCreated && !isServer) {
var animationKeyframes = '@' + keyFramePrefix + 'keyframes ' + RESIZE_ANIMATION_NAME + ' { from { opacity: 0; } to { opacity: 0; } } ';
var animationStyle = keyFramePrefix + 'animation: 1ms ' + RESIZE_ANIMATION_NAME + ';';
// opacity: 0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360
var css = animationKeyframes + '\n .resize-triggers { ' + animationStyle + ' visibility: hidden; opacity: 0; }\n .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1 }\n .resize-triggers > div { background: #eee; overflow: auto; }\n .contract-trigger:before { width: 200%; height: 200%; }';
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
head.appendChild(style);
stylesCreated = true;
}
};
/* istanbul ignore next */
var addResizeListener = exports.addResizeListener = function addResizeListener(element, fn) {
if (isServer) return;
if (attachEvent) {
element.attachEvent('onresize', fn);
} else {
if (!element.__resizeTrigger__) {
if (getComputedStyle(element).position === 'static') {
element.style.position = 'relative';
}
createStyles();
element.__resizeLast__ = {};
element.__resizeListeners__ = [];
var resizeTrigger = element.__resizeTrigger__ = document.createElement('div');
resizeTrigger.className = 'resize-triggers';
resizeTrigger.innerHTML = '<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>';
element.appendChild(resizeTrigger);
resetTrigger(element);
element.addEventListener('scroll', scrollListener, true);
/* Listen for a css animation to detect element display/re-attach */
if (animationStartEvent) {
resizeTrigger.addEventListener(animationStartEvent, function (event) {
if (event.animationName === RESIZE_ANIMATION_NAME) {
resetTrigger(element);
}
});
}
}
element.__resizeListeners__.push(fn);
}
};
/* istanbul ignore next */
var removeResizeListener = exports.removeResizeListener = function removeResizeListener(element, fn) {
if (attachEvent) {
element.detachEvent('onresize', fn);
} else {
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) {
element.removeEventListener('scroll', scrollListener);
element.__resizeTrigger__ = !element.removeChild(element.__resizeTrigger__);
}
}
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.i18n = exports.use = exports.t = undefined;
var _zhCN = __webpack_require__(34);
var _zhCN2 = _interopRequireDefault(_zhCN);
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
var _deepmerge = __webpack_require__(35);
var _deepmerge2 = _interopRequireDefault(_deepmerge);
var _format = __webpack_require__(36);
var _format2 = _interopRequireDefault(_format);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var format = (0, _format2.default)(_vue2.default);
var lang = _zhCN2.default;
var merged = false;
var i18nHandler = function i18nHandler() {
var vuei18n = Object.getPrototypeOf(this || _vue2.default).$t;
if (typeof vuei18n === 'function' && !!_vue2.default.locale) {
if (!merged) {
merged = true;
_vue2.default.locale(_vue2.default.config.lang, (0, _deepmerge2.default)(lang, _vue2.default.locale(_vue2.default.config.lang) || {}, { clone: true }));
}
return vuei18n.apply(this, arguments);
}
};
var t = exports.t = function t(path, options) {
var value = i18nHandler.apply(this, arguments);
if (value !== null && value !== undefined) return value;
var array = path.split('.');
var current = lang;
for (var i = 0, j = array.length; i < j; i++) {
var property = array[i];
value = current[property];
if (i === j - 1) return format(value, options);
if (!value) return '';
current = value;
}
return '';
};
var use = exports.use = function use(l) {
lang = l || lang;
};
var i18n = exports.i18n = function i18n(fn) {
i18nHandler = fn || i18nHandler;
};
exports.default = { use: use, t: t, i18n: i18n };
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function type(rule, value, callback, source, options) {
var ruleType = rule.type;
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value, ruleType) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options, ruleType);
if (!(0, _util.isEmptyValue)(value, ruleType)) {
_rule2["default"].type(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = type;
module.exports = exports['default'];
/***/ }),
/* 17 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if(item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
}
// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
var _dom = __webpack_require__(4);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var nodeList = [];
var ctx = '@@clickoutsideContext';
var startClick = void 0;
!_vue2.default.prototype.$isServer && (0, _dom.on)(document, 'mousedown', function (e) {
return startClick = e;
});
!_vue2.default.prototype.$isServer && (0, _dom.on)(document, 'mouseup', function (e) {
nodeList.forEach(function (node) {
return node[ctx].documentHandler(e, startClick);
});
});
/**
* v-clickoutside
* @desc 点击元素外面才会触发的事件
* @example
* ```vue
* <div v-element-clickoutside="handleClose">
* ```
*/
exports.default = {
bind: function bind(el, binding, vnode) {
var id = nodeList.push(el) - 1;
var documentHandler = function documentHandler() {
var mouseup = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var mousedown = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!vnode.context || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target || vnode.context.popperElm && (vnode.context.popperElm.contains(mouseup.target) || vnode.context.popperElm.contains(mousedown.target))) return;
if (binding.expression && el[ctx].methodName && vnode.context[el[ctx].methodName]) {
vnode.context[el[ctx].methodName]();
} else {
el[ctx].bindingFn && el[ctx].bindingFn();
}
};
el[ctx] = {
id: id,
documentHandler: documentHandler,
methodName: binding.expression,
bindingFn: binding.value
};
},
update: function update(el, binding) {
el[ctx].methodName = binding.expression;
el[ctx].bindingFn = binding.value;
},
unbind: function unbind(el) {
var len = nodeList.length;
for (var i = 0; i < len; i++) {
if (nodeList[i][ctx].id === el[ctx].id) {
nodeList.splice(i, 1);
break;
}
}
}
};
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.PopupManager = undefined;
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
var _merge = __webpack_require__(11);
var _merge2 = _interopRequireDefault(_merge);
var _popupManager = __webpack_require__(32);
var _popupManager2 = _interopRequireDefault(_popupManager);
var _scrollbarWidth = __webpack_require__(13);
var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var idSeed = 1;
var transitions = [];
var hookTransition = function hookTransition(transition) {
if (transitions.indexOf(transition) !== -1) return;
var getVueInstance = function getVueInstance(element) {
var instance = element.__vue__;
if (!instance) {
var textNode = element.previousSibling;
if (textNode.__vue__) {
instance = textNode.__vue__;
}
}
return instance;
};
_vue2.default.transition(transition, {
afterEnter: function afterEnter(el) {
var instance = getVueInstance(el);
if (instance) {
instance.doAfterOpen && instance.doAfterOpen();
}
},
afterLeave: function afterLeave(el) {
var instance = getVueInstance(el);
if (instance) {
instance.doAfterClose && instance.doAfterClose();
}
}
});
};
var scrollBarWidth = void 0;
var getDOM = function getDOM(dom) {
if (dom.nodeType === 3) {
dom = dom.nextElementSibling || dom.nextSibling;
getDOM(dom);
}
return dom;
};
exports.default = {
model: {
prop: 'visible',
event: 'visible-change'
},
props: {
visible: {
type: Boolean,
default: false
},
transition: {
type: String,
default: ''
},
openDelay: {},
closeDelay: {},
zIndex: {},
modal: {
type: Boolean,
default: false
},
modalFade: {
type: Boolean,
default: true
},
modalClass: {},
modalAppendToBody: {
type: Boolean,
default: false
},
lockScroll: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: false
},
closeOnClickModal: {
type: Boolean,
default: false
}
},
created: function created() {
if (this.transition) {
hookTransition(this.transition);
}
},
beforeMount: function beforeMount() {
this._popupId = 'popup-' + idSeed++;
_popupManager2.default.register(this._popupId, this);
},
beforeDestroy: function beforeDestroy() {
_popupManager2.default.deregister(this._popupId);
_popupManager2.default.closeModal(this._popupId);
if (this.modal && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
document.body.style.overflow = this.bodyOverflow;
document.body.style.paddingRight = this.bodyPaddingRight;
}
this.bodyOverflow = null;
this.bodyPaddingRight = null;
},
data: function data() {
return {
opened: false,
bodyOverflow: null,
bodyPaddingRight: null,
rendered: false
};
},
watch: {
visible: function visible(val) {
var _this = this;
if (val) {
if (this._opening) return;
if (!this.rendered) {
this.rendered = true;
_vue2.default.nextTick(function () {
_this.open();
});
} else {
this.open();
}
} else {
this.close();
}
}
},
methods: {
open: function open(options) {
var _this2 = this;
if (!this.rendered) {
this.rendered = true;
this.$emit('visible-change', true);
}
var props = (0, _merge2.default)({}, this.$props || this, options);
if (this._closeTimer) {
clearTimeout(this._closeTimer);
this._closeTimer = null;
}
clearTimeout(this._openTimer);
var openDelay = Number(props.openDelay);
if (openDelay > 0) {
this._openTimer = setTimeout(function () {
_this2._openTimer = null;
_this2.doOpen(props);
}, openDelay);
} else {
this.doOpen(props);
}
},
doOpen: function doOpen(props) {
if (this.$isServer) return;
if (this.willOpen && !this.willOpen()) return;
if (this.opened) return;
this._opening = true;
this.$emit('visible-change', true);
var dom = getDOM(this.$el);
var modal = props.modal;
var zIndex = props.zIndex;
if (zIndex) {
_popupManager2.default.zIndex = zIndex;
}
if (modal) {
if (this._closing) {
_popupManager2.default.closeModal(this._popupId);
this._closing = false;
}
_popupManager2.default.openModal(this._popupId, _popupManager2.default.nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
if (props.lockScroll) {
if (!this.bodyOverflow) {
this.bodyPaddingRight = document.body.style.paddingRight;
this.bodyOverflow = document.body.style.overflow;
}
scrollBarWidth = (0, _scrollbarWidth2.default)();
var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
if (scrollBarWidth > 0 && bodyHasOverflow) {
document.body.style.paddingRight = scrollBarWidth + 'px';
}
document.body.style.overflow = 'hidden';
}
}
if (getComputedStyle(dom).position === 'static') {
dom.style.position = 'absolute';
}
dom.style.zIndex = _popupManager2.default.nextZIndex();
this.opened = true;
this.onOpen && this.onOpen();
if (!this.transition) {
this.doAfterOpen();
}
},
doAfterOpen: function doAfterOpen() {
this._opening = false;
},
close: function close() {
var _this3 = this;
if (this.willClose && !this.willClose()) return;
if (this._openTimer !== null) {
clearTimeout(this._openTimer);
this._openTimer = null;
}
clearTimeout(this._closeTimer);
var closeDelay = Number(this.closeDelay);
if (closeDelay > 0) {
this._closeTimer = setTimeout(function () {
_this3._closeTimer = null;
_this3.doClose();
}, closeDelay);
} else {
this.doClose();
}
},
doClose: function doClose() {
var _this4 = this;
this.$emit('visible-change', false);
this._closing = true;
this.onClose && this.onClose();
if (this.lockScroll) {
setTimeout(function () {
if (_this4.modal && _this4.bodyOverflow !== 'hidden') {
document.body.style.overflow = _this4.bodyOverflow;
document.body.style.paddingRight = _this4.bodyPaddingRight;
}
_this4.bodyOverflow = null;
_this4.bodyPaddingRight = null;
}, 200);
}
this.opened = false;
if (!this.transition) {
this.doAfterClose();
}
},
doAfterClose: function doAfterClose() {
_popupManager2.default.closeModal(this._popupId);
this._closing = false;
}
}
};
exports.PopupManager = _popupManager2.default;
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(259);
/***/ },
/***/ 46:
/***/ function(module, exports) {
module.exports = __webpack_require__(14);
/***/ },
/***/ 123:
/***/ function(module, exports) {
module.exports = __webpack_require__(4);
/***/ },
/***/ 219:
/***/ function(module, exports) {
module.exports = __webpack_require__(6);
/***/ },
/***/ 259:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(260);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/***/ 260:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _resizeEvent = __webpack_require__(46);
var _scrollbarWidth = __webpack_require__(261);
var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
var _util = __webpack_require__(219);
var _bar = __webpack_require__(262);
var _bar2 = _interopRequireDefault(_bar);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
// reference https://github.com/noeldelgado/gemini-scrollbar/blob/master/index.js
exports.default = {
name: 'ElScrollbar',
components: { Bar: _bar2.default },
props: {
native: Boolean,
wrapStyle: {},
wrapClass: {},
viewClass: {},
viewStyle: {},
noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能
tag: {
type: String,
default: 'div'
}
},
data: function data() {
return {
sizeWidth: '0',
sizeHeight: '0',
moveX: 0,
moveY: 0
};
},
computed: {
wrap: function wrap() {
return this.$refs.wrap;
}
},
render: function render(h) {
var gutter = (0, _scrollbarWidth2.default)();
var style = this.wrapStyle;
if (gutter) {
var gutterWith = '-' + gutter + 'px';
var gutterStyle = 'margin-bottom: ' + gutterWith + '; margin-right: ' + gutterWith + ';';
if (Array.isArray(this.wrapStyle)) {
style = (0, _util.toObject)(this.wrapStyle);
style.marginRight = style.marginBottom = gutterWith;
} else if (typeof this.wrapStyle === 'string') {
style += gutterStyle;
} else {
style = gutterStyle;
}
}
var view = h(this.tag, {
class: ['el-scrollbar__view', this.viewClass],
style: this.viewStyle,
ref: 'resize'
}, this.$slots.default);
var wrap = h(
'div',
{
ref: 'wrap',
style: style,
on: {
'scroll': this.handleScroll
},
'class': [this.wrapClass, 'el-scrollbar__wrap', gutter ? '' : 'el-scrollbar__wrap--hidden-default'] },
[[view]]
);
var nodes = void 0;
if (!this.native) {
nodes = [wrap, h(
_bar2.default,
{
attrs: {
move: this.moveX,
size: this.sizeWidth }
},
[]
), h(
_bar2.default,
{
attrs: {
vertical: true,
move: this.moveY,
size: this.sizeHeight }
},
[]
)];
} else {
nodes = [h(
'div',
{
ref: 'wrap',
'class': [this.wrapClass, 'el-scrollbar__wrap'],
style: style },
[[view]]
)];
}
return h('div', { class: 'el-scrollbar' }, nodes);
},
methods: {
handleScroll: function handleScroll() {
var wrap = this.wrap;
this.moveY = wrap.scrollTop * 100 / wrap.clientHeight;
this.moveX = wrap.scrollLeft * 100 / wrap.clientWidth;
},
update: function update() {
var heightPercentage = void 0,
widthPercentage = void 0;
var wrap = this.wrap;
if (!wrap) return;
heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
widthPercentage = wrap.clientWidth * 100 / wrap.scrollWidth;
this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : '';
this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : '';
}
},
mounted: function mounted() {
if (this.native) return;
this.$nextTick(this.update);
!this.noresize && (0, _resizeEvent.addResizeListener)(this.$refs.resize, this.update);
},
beforeDestroy: function beforeDestroy() {
if (this.native) return;
!this.noresize && (0, _resizeEvent.removeResizeListener)(this.$refs.resize, this.update);
}
};
/***/ },
/***/ 261:
/***/ function(module, exports) {
module.exports = __webpack_require__(13);
/***/ },
/***/ 262:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dom = __webpack_require__(123);
var _util = __webpack_require__(263);
/* istanbul ignore next */
exports.default = {
name: 'Bar',
props: {
vertical: Boolean,
size: String,
move: Number
},
computed: {
bar: function bar() {
return _util.BAR_MAP[this.vertical ? 'vertical' : 'horizontal'];
},
wrap: function wrap() {
return this.$parent.wrap;
}
},
render: function render(h) {
var size = this.size,
move = this.move,
bar = this.bar;
return h(
'div',
{
'class': ['el-scrollbar__bar', 'is-' + bar.key],
on: {
'mousedown': this.clickTrackHandler
}
},
[h(
'div',
{
ref: 'thumb',
'class': 'el-scrollbar__thumb',
on: {
'mousedown': this.clickThumbHandler
},
style: (0, _util.renderThumbStyle)({ size: size, move: move, bar: bar }) },
[]
)]
);
},
methods: {
clickThumbHandler: function clickThumbHandler(e) {
this.startDrag(e);
this[this.bar.axis] = e.currentTarget[this.bar.offset] - (e[this.bar.client] - e.currentTarget.getBoundingClientRect()[this.bar.direction]);
},
clickTrackHandler: function clickTrackHandler(e) {
var offset = Math.abs(e.target.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]);
var thumbHalf = this.$refs.thumb[this.bar.offset] / 2;
var thumbPositionPercentage = (offset - thumbHalf) * 100 / this.$el[this.bar.offset];
this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
},
startDrag: function startDrag(e) {
e.stopImmediatePropagation();
this.cursorDown = true;
(0, _dom.on)(document, 'mousemove', this.mouseMoveDocumentHandler);
(0, _dom.on)(document, 'mouseup', this.mouseUpDocumentHandler);
document.onselectstart = function () {
return false;
};
},
mouseMoveDocumentHandler: function mouseMoveDocumentHandler(e) {
if (this.cursorDown === false) return;
var prevPage = this[this.bar.axis];
if (!prevPage) return;
var offset = (this.$el.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]) * -1;
var thumbClickPosition = this.$refs.thumb[this.bar.offset] - prevPage;
var thumbPositionPercentage = (offset - thumbClickPosition) * 100 / this.$el[this.bar.offset];
this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
},
mouseUpDocumentHandler: function mouseUpDocumentHandler(e) {
this.cursorDown = false;
this[this.bar.axis] = 0;
(0, _dom.off)(document, 'mousemove', this.mouseMoveDocumentHandler);
document.onselectstart = null;
}
},
destroyed: function destroyed() {
(0, _dom.off)(document, 'mouseup', this.mouseUpDocumentHandler);
}
};
/***/ },
/***/ 263:
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.renderThumbStyle = renderThumbStyle;
var BAR_MAP = exports.BAR_MAP = {
vertical: {
offset: 'offsetHeight',
scroll: 'scrollTop',
scrollSize: 'scrollHeight',
size: 'height',
key: 'vertical',
axis: 'Y',
client: 'clientY',
direction: 'top'
},
horizontal: {
offset: 'offsetWidth',
scroll: 'scrollLeft',
scrollSize: 'scrollWidth',
size: 'width',
key: 'horizontal',
axis: 'X',
client: 'clientX',
direction: 'left'
}
};
function renderThumbStyle(_ref) {
var move = _ref.move,
size = _ref.size,
bar = _ref.bar;
var style = {};
var translate = 'translate' + bar.axis + '(' + move + '%)';
style[bar.size] = size;
style.transform = translate;
style.msTransform = translate;
style.webkitTransform = translate;
return style;
};
/***/ }
/******/ });
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = scrollIntoView;
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function scrollIntoView(container, selected) {
if (_vue2.default.prototype.$isServer) return;
if (!selected) {
container.scrollTop = 0;
return;
}
var top = selected.offsetTop;
var bottom = selected.offsetTop + selected.offsetHeight;
var viewRectTop = container.scrollTop;
var viewRectBottom = viewRectTop + container.clientHeight;
if (top < viewRectTop) {
container.scrollTop = top;
} else if (bottom > viewRectBottom) {
container.scrollTop = bottom - container.clientHeight;
}
}
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _locale = __webpack_require__(15);
exports.default = {
methods: {
t: function t() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _locale.t.apply(this, args);
}
}
};
/***/ }),
/* 23 */
/***/ (function(module, exports) {
/* eslint-disable no-undefined,no-param-reassign,no-shadow */
/**
* Throttle execution of a function. Especially useful for rate limiting
* execution of handlers on events like resize and scroll.
*
* @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
* @param {Boolean} noTrailing Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the
* throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time
* after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,
* the internal counter is reset)
* @param {Function} callback A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,
* to `callback` when the throttled-function is executed.
* @param {Boolean} debounceMode If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),
* schedule `callback` to execute after `delay` ms.
*
* @return {Function} A new, throttled, function.
*/
module.exports = function ( delay, noTrailing, callback, debounceMode ) {
// After wrapper has stopped being called, this timeout ensures that
// `callback` is executed at the proper times in `throttle` and `end`
// debounce modes.
var timeoutID;
// Keep track of the last time `callback` was executed.
var lastExec = 0;
// `noTrailing` defaults to falsy.
if ( typeof noTrailing !== 'boolean' ) {
debounceMode = callback;
callback = noTrailing;
noTrailing = undefined;
}
// The `wrapper` function encapsulates all of the throttling / debouncing
// functionality and when executed will limit the rate at which `callback`
// is executed.
function wrapper () {
var self = this;
var elapsed = Number(new Date()) - lastExec;
var args = arguments;
// Execute `callback` and update the `lastExec` timestamp.
function exec () {
lastExec = Number(new Date());
callback.apply(self, args);
}
// If `debounceMode` is true (at begin) this is used to clear the flag
// to allow future `callback` executions.
function clear () {
timeoutID = undefined;
}
if ( debounceMode && !timeoutID ) {
// Since `wrapper` is being called for the first time and
// `debounceMode` is true (at begin), execute `callback`.
exec();
}
// Clear any existing timeout.
if ( timeoutID ) {
clearTimeout(timeoutID);
}
if ( debounceMode === undefined && elapsed > delay ) {
// In throttle mode, if `delay` time has been exceeded, execute
// `callback`.
exec();
} else if ( noTrailing !== true ) {
// In trailing throttle mode, since `delay` time has not been
// exceeded, schedule `callback` to execute `delay` ms after most
// recent execution.
//
// If `debounceMode` is true (at begin), schedule `clear` to execute
// after `delay` ms.
//
// If `debounceMode` is false (at end), schedule `callback` to
// execute after `delay` ms.
timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);
}
}
// Return the wrapper function.
return wrapper;
};
/***/ }),
/* 24 */
/***/ (function(module, exports) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(331);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 331:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tag = __webpack_require__(332);
var _tag2 = _interopRequireDefault(_tag);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_tag2.default.install = function (Vue) {
Vue.component(_tag2.default.name, _tag2.default);
};
exports.default = _tag2.default;
/***/ },
/***/ 332:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(333),
/* template */
__webpack_require__(334),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 333:
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElTag',
props: {
text: String,
closable: Boolean,
type: String,
hit: Boolean,
closeTransition: Boolean,
color: String
},
methods: {
handleClose: function handleClose(event) {
this.$emit('close', event);
}
}
};
/***/ },
/***/ 334:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": _vm.closeTransition ? '' : 'el-zoom-in-center'
}
}, [_c('span', {
staticClass: "el-tag",
class: [_vm.type ? 'el-tag--' + _vm.type : '', {
'is-hit': _vm.hit
}],
style: ({
backgroundColor: _vm.color
})
}, [_vm._t("default"), (_vm.closable) ? _c('i', {
staticClass: "el-tag__close el-icon-close",
on: {
"click": _vm.handleClose
}
}) : _vm._e()], 2)])
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.isVNode = isVNode;
exports.getFirstComponentChild = getFirstComponentChild;
var _util = __webpack_require__(6);
function isVNode(node) {
return (typeof node === 'undefined' ? 'undefined' : _typeof(node)) === 'object' && (0, _util.hasOwn)(node, 'componentOptions');
};
function getFirstComponentChild(children) {
return children && children.filter(function (c) {
return c && c.tag;
})[0];
};
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = __webpack_require__(0);
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
/**
* Rule for validating required fields.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param source The source object being validated.
* @param errors An array of errors that this rule may add
* validation errors to.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function required(rule, value, source, errors, options, type) {
if (rule.required && (!source.hasOwnProperty(rule.field) || util.isEmptyValue(value, type || rule.type))) {
errors.push(util.format(options.messages.required, rule.fullField));
}
}
exports["default"] = required;
module.exports = exports['default'];
/***/ }),
/* 27 */
/***/ (function(module, exports) {
throw new Error("Module build failed: SyntaxError: F:/lx_new/webapp/js/util/Will.js: Unexpected token (156:9)\n\n\u001b[0m \u001b[90m 154 | \u001b[39m\n \u001b[90m 155 | \u001b[39m\u001b[36mexport\u001b[39m \u001b[36mconst\u001b[39m async$VM \u001b[33m=\u001b[39m (path\u001b[33m,\u001b[39m selector\u001b[33m,\u001b[39moption \u001b[33m=\u001b[39m {}) \u001b[33m=>\u001b[39m {\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 156 | \u001b[39m \u001b[36mreturn\u001b[39m \u001b[36mimport\u001b[39m(\u001b[32m`../../component/${path}.vue`\u001b[39m)\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 157 | \u001b[39m \u001b[33m.\u001b[39mthen(component \u001b[33m=>\u001b[39m {\n \u001b[90m 158 | \u001b[39m let opt \u001b[33m=\u001b[39m { \u001b[33m...\u001b[39moption\u001b[33m,\u001b[39mrender\u001b[33m:\u001b[39m h \u001b[33m=>\u001b[39m h(component\u001b[33m.\u001b[39m\u001b[36mdefault\u001b[39m) }\n \u001b[90m 159 | \u001b[39m \u001b[36mif\u001b[39m (selector) opt\u001b[33m.\u001b[39mel \u001b[33m=\u001b[39m selector\u001b[33m;\u001b[39m\u001b[0m\n");
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
throw new Error(
'vue-style-loader cannot be used in a non-browser environment. ' +
"Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
) }
}
var listToStyles = __webpack_require__(72)
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
module.exports = function (parentId, list, _isProduction) {
isProduction = _isProduction
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[data-vue-ssr-id~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/* 29 */
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
var functional = options.functional
var existing = functional
? options.render
: options.beforeCreate
if (!functional) {
// inject component registration as beforeCreate hook
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
} else {
// register for functioal component in vue file
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return existing(h, context)
}
}
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _index = __webpack_require__(2);
var _index2 = _interopRequireDefault(_index);
var _index3 = __webpack_require__(11);
var _index4 = _interopRequireDefault(_index3);
var _index5 = __webpack_require__(17);
var _index6 = _interopRequireDefault(_index5);
var _index7 = __webpack_require__(28);
var _index8 = _interopRequireDefault(_index7);
var _index9 = __webpack_require__(33);
var _index10 = _interopRequireDefault(_index9);
var _index11 = __webpack_require__(37);
var _index12 = _interopRequireDefault(_index11);
var _index13 = __webpack_require__(41);
var _index14 = _interopRequireDefault(_index13);
var _index15 = __webpack_require__(47);
var _index16 = _interopRequireDefault(_index15);
var _index17 = __webpack_require__(53);
var _index18 = _interopRequireDefault(_index17);
var _index19 = __webpack_require__(57);
var _index20 = _interopRequireDefault(_index19);
var _index21 = __webpack_require__(61);
var _index22 = _interopRequireDefault(_index21);
var _index23 = __webpack_require__(67);
var _index24 = _interopRequireDefault(_index23);
var _index25 = __webpack_require__(72);
var _index26 = _interopRequireDefault(_index25);
var _index27 = __webpack_require__(76);
var _index28 = _interopRequireDefault(_index27);
var _index29 = __webpack_require__(80);
var _index30 = _interopRequireDefault(_index29);
var _index31 = __webpack_require__(84);
var _index32 = _interopRequireDefault(_index31);
var _index33 = __webpack_require__(88);
var _index34 = _interopRequireDefault(_index33);
var _index35 = __webpack_require__(92);
var _index36 = _interopRequireDefault(_index35);
var _index37 = __webpack_require__(96);
var _index38 = _interopRequireDefault(_index37);
var _index39 = __webpack_require__(100);
var _index40 = _interopRequireDefault(_index39);
var _index41 = __webpack_require__(115);
var _index42 = _interopRequireDefault(_index41);
var _index43 = __webpack_require__(116);
var _index44 = _interopRequireDefault(_index43);
var _index45 = __webpack_require__(120);
var _index46 = _interopRequireDefault(_index45);
var _index47 = __webpack_require__(124);
var _index48 = _interopRequireDefault(_index47);
var _index49 = __webpack_require__(128);
var _index50 = _interopRequireDefault(_index49);
var _index51 = __webpack_require__(147);
var _index52 = _interopRequireDefault(_index51);
var _index53 = __webpack_require__(149);
var _index54 = _interopRequireDefault(_index53);
var _index55 = __webpack_require__(177);
var _index56 = _interopRequireDefault(_index55);
var _index57 = __webpack_require__(182);
var _index58 = _interopRequireDefault(_index57);
var _index59 = __webpack_require__(187);
var _index60 = _interopRequireDefault(_index59);
var _index61 = __webpack_require__(192);
var _index62 = _interopRequireDefault(_index61);
var _index63 = __webpack_require__(195);
var _index64 = _interopRequireDefault(_index63);
var _index65 = __webpack_require__(200);
var _index66 = _interopRequireDefault(_index65);
var _index67 = __webpack_require__(204);
var _index68 = _interopRequireDefault(_index67);
var _index69 = __webpack_require__(208);
var _index70 = _interopRequireDefault(_index69);
var _index71 = __webpack_require__(212);
var _index72 = _interopRequireDefault(_index71);
var _index73 = __webpack_require__(217);
var _index74 = _interopRequireDefault(_index73);
var _index75 = __webpack_require__(225);
var _index76 = _interopRequireDefault(_index75);
var _index77 = __webpack_require__(229);
var _index78 = _interopRequireDefault(_index77);
var _index79 = __webpack_require__(233);
var _index80 = _interopRequireDefault(_index79);
var _index81 = __webpack_require__(243);
var _index82 = _interopRequireDefault(_index81);
var _index83 = __webpack_require__(247);
var _index84 = _interopRequireDefault(_index83);
var _index85 = __webpack_require__(252);
var _index86 = _interopRequireDefault(_index85);
var _index87 = __webpack_require__(260);
var _index88 = _interopRequireDefault(_index87);
var _index89 = __webpack_require__(266);
var _index90 = _interopRequireDefault(_index89);
var _index91 = __webpack_require__(270);
var _index92 = _interopRequireDefault(_index91);
var _index93 = __webpack_require__(272);
var _index94 = _interopRequireDefault(_index93);
var _index95 = __webpack_require__(274);
var _index96 = _interopRequireDefault(_index95);
var _index97 = __webpack_require__(290);
var _index98 = _interopRequireDefault(_index97);
var _index99 = __webpack_require__(294);
var _index100 = _interopRequireDefault(_index99);
var _index101 = __webpack_require__(298);
var _index102 = _interopRequireDefault(_index101);
var _index103 = __webpack_require__(308);
var _index104 = _interopRequireDefault(_index103);
var _index105 = __webpack_require__(312);
var _index106 = _interopRequireDefault(_index105);
var _index107 = __webpack_require__(316);
var _index108 = _interopRequireDefault(_index107);
var _index109 = __webpack_require__(320);
var _index110 = _interopRequireDefault(_index109);
var _index111 = __webpack_require__(324);
var _index112 = _interopRequireDefault(_index111);
var _index113 = __webpack_require__(328);
var _index114 = _interopRequireDefault(_index113);
var _index115 = __webpack_require__(332);
var _index116 = _interopRequireDefault(_index115);
var _index117 = __webpack_require__(336);
var _index118 = _interopRequireDefault(_index117);
var _index119 = __webpack_require__(340);
var _index120 = _interopRequireDefault(_index119);
var _index121 = __webpack_require__(344);
var _index122 = _interopRequireDefault(_index121);
var _index123 = __webpack_require__(348);
var _index124 = _interopRequireDefault(_index123);
var _index125 = __webpack_require__(356);
var _index126 = _interopRequireDefault(_index125);
var _index127 = __webpack_require__(374);
var _index128 = _interopRequireDefault(_index127);
var _locale = __webpack_require__(112);
var _locale2 = _interopRequireDefault(_locale);
var _collapseTransition = __webpack_require__(50);
var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* Automatic generated by './build/bin/build-entry.js' */
var components = [_index2.default, _index4.default, _index6.default, _index8.default, _index10.default, _index12.default, _index14.default, _index16.default, _index18.default, _index20.default, _index22.default, _index24.default, _index26.default, _index28.default, _index30.default, _index32.default, _index34.default, _index36.default, _index38.default, _index40.default, _index42.default, _index44.default, _index46.default, _index48.default, _index50.default, _index52.default, _index54.default, _index56.default, _index58.default, _index60.default, _index62.default, _index66.default, _index68.default, _index70.default, _index72.default, _index74.default, _index76.default, _index78.default, _index80.default, _index82.default, _index86.default, _index90.default, _index92.default, _index94.default, _index96.default, _index98.default, _index100.default, _index104.default, _index106.default, _index108.default, _index110.default, _index112.default, _index114.default, _index116.default, _index118.default, _index120.default, _index122.default, _index124.default, _index126.default, _index128.default, _collapseTransition2.default];
var install = function install(Vue) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
/* istanbul ignore if */
if (install.installed) return;
_locale2.default.use(opts.locale);
_locale2.default.i18n(opts.i18n);
components.map(function (component) {
Vue.component(component.name, component);
});
Vue.use(_index88.default.directive);
Vue.prototype.$loading = _index88.default.service;
Vue.prototype.$msgbox = _index64.default;
Vue.prototype.$alert = _index64.default.alert;
Vue.prototype.$confirm = _index64.default.confirm;
Vue.prototype.$prompt = _index64.default.prompt;
Vue.prototype.$notify = _index84.default;
Vue.prototype.$message = _index102.default;
};
/* istanbul ignore if */
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
};
module.exports = {
version: '1.4.1',
locale: _locale2.default.use,
i18n: _locale2.default.i18n,
install: install,
CollapseTransition: _collapseTransition2.default,
Loading: _index88.default,
Pagination: _index2.default,
Dialog: _index4.default,
Autocomplete: _index6.default,
Dropdown: _index8.default,
DropdownMenu: _index10.default,
DropdownItem: _index12.default,
Menu: _index14.default,
Submenu: _index16.default,
MenuItem: _index18.default,
MenuItemGroup: _index20.default,
Input: _index22.default,
InputNumber: _index24.default,
Radio: _index26.default,
RadioGroup: _index28.default,
RadioButton: _index30.default,
Checkbox: _index32.default,
CheckboxButton: _index34.default,
CheckboxGroup: _index36.default,
Switch: _index38.default,
Select: _index40.default,
Option: _index42.default,
OptionGroup: _index44.default,
Button: _index46.default,
ButtonGroup: _index48.default,
Table: _index50.default,
TableColumn: _index52.default,
DatePicker: _index54.default,
TimeSelect: _index56.default,
TimePicker: _index58.default,
Popover: _index60.default,
Tooltip: _index62.default,
MessageBox: _index64.default,
Breadcrumb: _index66.default,
BreadcrumbItem: _index68.default,
Form: _index70.default,
FormItem: _index72.default,
Tabs: _index74.default,
TabPane: _index76.default,
Tag: _index78.default,
Tree: _index80.default,
Alert: _index82.default,
Notification: _index84.default,
Slider: _index86.default,
Icon: _index90.default,
Row: _index92.default,
Col: _index94.default,
Upload: _index96.default,
Progress: _index98.default,
Spinner: _index100.default,
Message: _index102.default,
Badge: _index104.default,
Card: _index106.default,
Rate: _index108.default,
Steps: _index110.default,
Step: _index112.default,
Carousel: _index114.default,
Scrollbar: _index116.default,
CarouselItem: _index118.default,
Collapse: _index120.default,
CollapseItem: _index122.default,
Cascader: _index124.default,
ColorPicker: _index126.default,
Transfer: _index128.default
};
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _pagination = __webpack_require__(3);
var _pagination2 = _interopRequireDefault(_pagination);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_pagination2.default.install = function (Vue) {
Vue.component(_pagination2.default.name, _pagination2.default);
};
exports.default = _pagination2.default;
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _pager = __webpack_require__(4);
var _pager2 = _interopRequireDefault(_pager);
var _select = __webpack_require__(8);
var _select2 = _interopRequireDefault(_select);
var _option = __webpack_require__(9);
var _option2 = _interopRequireDefault(_option);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElPagination',
props: {
pageSize: {
type: Number,
default: 10
},
small: Boolean,
total: Number,
pageCount: Number,
currentPage: {
type: Number,
default: 1
},
layout: {
default: 'prev, pager, next, jumper, ->, total'
},
pageSizes: {
type: Array,
default: function _default() {
return [10, 20, 30, 40, 50, 100];
}
}
},
data: function data() {
return {
internalCurrentPage: 1,
internalPageSize: 0
};
},
render: function render(h) {
var template = h(
'div',
{ 'class': 'el-pagination' },
[]
);
var layout = this.layout || '';
if (!layout) return;
var TEMPLATE_MAP = {
prev: h(
'prev',
null,
[]
),
jumper: h(
'jumper',
null,
[]
),
pager: h(
'pager',
{
attrs: { currentPage: this.internalCurrentPage, pageCount: this.internalPageCount },
on: {
'change': this.handleCurrentChange
}
},
[]
),
next: h(
'next',
null,
[]
),
sizes: h(
'sizes',
{
attrs: { pageSizes: this.pageSizes }
},
[]
),
slot: h(
'my-slot',
null,
[]
),
total: h(
'total',
null,
[]
)
};
var components = layout.split(',').map(function (item) {
return item.trim();
});
var rightWrapper = h(
'div',
{ 'class': 'el-pagination__rightwrapper' },
[]
);
var haveRightWrapper = false;
if (this.small) {
template.data.class += ' el-pagination--small';
}
components.forEach(function (compo) {
if (compo === '->') {
haveRightWrapper = true;
return;
}
if (!haveRightWrapper) {
template.children.push(TEMPLATE_MAP[compo]);
} else {
rightWrapper.children.push(TEMPLATE_MAP[compo]);
}
});
if (haveRightWrapper) {
template.children.unshift(rightWrapper);
}
return template;
},
components: {
MySlot: {
render: function render(h) {
return this.$parent.$slots.default ? this.$parent.$slots.default[0] : '';
}
},
Prev: {
render: function render(h) {
return h(
'button',
{
attrs: {
type: 'button'
},
'class': ['btn-prev', { disabled: this.$parent.internalCurrentPage <= 1 }],
on: {
'click': this.$parent.prev
}
},
[h(
'i',
{ 'class': 'el-icon el-icon-arrow-left' },
[]
)]
);
}
},
Next: {
render: function render(h) {
return h(
'button',
{
attrs: {
type: 'button'
},
'class': ['btn-next', { disabled: this.$parent.internalCurrentPage === this.$parent.internalPageCount || this.$parent.internalPageCount === 0 }],
on: {
'click': this.$parent.next
}
},
[h(
'i',
{ 'class': 'el-icon el-icon-arrow-right' },
[]
)]
);
}
},
Sizes: {
mixins: [_locale2.default],
props: {
pageSizes: Array
},
watch: {
pageSizes: {
immediate: true,
handler: function handler(value) {
if (Array.isArray(value)) {
this.$parent.internalPageSize = value.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.pageSizes[0];
}
}
}
},
render: function render(h) {
var _this = this;
return h(
'span',
{ 'class': 'el-pagination__sizes' },
[h(
'el-select',
{
attrs: {
value: this.$parent.internalPageSize
},
on: {
'input': this.handleChange
}
},
[this.pageSizes.map(function (item) {
return h(
'el-option',
{
attrs: {
value: item,
label: item + ' ' + _this.t('el.pagination.pagesize') }
},
[]
);
})]
)]
);
},
components: {
ElSelect: _select2.default,
ElOption: _option2.default
},
methods: {
handleChange: function handleChange(val) {
if (val !== this.$parent.internalPageSize) {
this.$parent.internalPageSize = val = parseInt(val, 10);
this.$parent.$emit('size-change', val);
}
}
}
},
Jumper: {
mixins: [_locale2.default],
data: function data() {
return {
oldValue: null
};
},
methods: {
handleFocus: function handleFocus(event) {
this.oldValue = event.target.value;
},
handleChange: function handleChange(_ref) {
var target = _ref.target;
this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(target.value);
this.oldValue = null;
}
},
render: function render(h) {
return h(
'span',
{ 'class': 'el-pagination__jump' },
[this.t('el.pagination.goto'), h(
'input',
{
'class': 'el-pagination__editor',
attrs: { type: 'number',
min: 1,
max: this.internalPageCount,
value: this.$parent.internalCurrentPage,
number: true },
domProps: {
'value': this.$parent.internalCurrentPage
},
on: {
'change': this.handleChange,
'focus': this.handleFocus
}
},
[]
), this.t('el.pagination.pageClassifier')]
);
}
},
Total: {
mixins: [_locale2.default],
render: function render(h) {
return typeof this.$parent.total === 'number' ? h(
'span',
{ 'class': 'el-pagination__total' },
[this.t('el.pagination.total', { total: this.$parent.total })]
) : '';
}
},
Pager: _pager2.default
},
methods: {
handleCurrentChange: function handleCurrentChange(val) {
this.internalCurrentPage = this.getValidCurrentPage(val);
},
prev: function prev() {
var newVal = this.internalCurrentPage - 1;
this.internalCurrentPage = this.getValidCurrentPage(newVal);
},
next: function next() {
var newVal = this.internalCurrentPage + 1;
this.internalCurrentPage = this.getValidCurrentPage(newVal);
},
getValidCurrentPage: function getValidCurrentPage(value) {
value = parseInt(value, 10);
var havePageCount = typeof this.internalPageCount === 'number';
var resetValue = void 0;
if (!havePageCount) {
if (isNaN(value) || value < 1) resetValue = 1;
} else {
if (value < 1) {
resetValue = 1;
} else if (value > this.internalPageCount) {
resetValue = this.internalPageCount;
}
}
if (resetValue === undefined && isNaN(value)) {
resetValue = 1;
} else if (resetValue === 0) {
resetValue = 1;
}
return resetValue === undefined ? value : resetValue;
}
},
computed: {
internalPageCount: function internalPageCount() {
if (typeof this.total === 'number') {
return Math.ceil(this.total / this.internalPageSize);
} else if (typeof this.pageCount === 'number') {
return this.pageCount;
}
return null;
}
},
watch: {
currentPage: {
immediate: true,
handler: function handler(val) {
this.internalCurrentPage = val;
}
},
pageSize: {
immediate: true,
handler: function handler(val) {
this.internalPageSize = val;
}
},
internalCurrentPage: function internalCurrentPage(newVal, oldVal) {
var _this2 = this;
newVal = parseInt(newVal, 10);
/* istanbul ignore if */
if (isNaN(newVal)) {
newVal = oldVal || 1;
} else {
newVal = this.getValidCurrentPage(newVal);
}
if (newVal !== undefined) {
this.$nextTick(function () {
_this2.internalCurrentPage = newVal;
if (oldVal !== newVal) {
_this2.$emit('update:currentPage', newVal);
_this2.$emit('current-change', _this2.internalCurrentPage);
}
});
} else {
this.$emit('update:currentPage', newVal);
this.$emit('current-change', this.internalCurrentPage);
}
},
internalPageCount: function internalPageCount(newVal) {
/* istanbul ignore if */
var oldPage = this.internalCurrentPage;
if (newVal > 0 && oldPage === 0) {
this.internalCurrentPage = 1;
} else if (oldPage > newVal) {
this.internalCurrentPage = newVal === 0 ? 1 : newVal;
}
}
}
};
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(6),
/* template */
__webpack_require__(7),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 5 */
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/* 6 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElPager',
props: {
currentPage: Number,
pageCount: Number
},
watch: {
showPrevMore: function showPrevMore(val) {
if (!val) this.quickprevIconClass = 'el-icon-more';
},
showNextMore: function showNextMore(val) {
if (!val) this.quicknextIconClass = 'el-icon-more';
}
},
methods: {
onPagerClick: function onPagerClick(event) {
var target = event.target;
if (target.tagName === 'UL') {
return;
}
var newPage = Number(event.target.textContent);
var pageCount = this.pageCount;
var currentPage = this.currentPage;
if (target.className.indexOf('more') !== -1) {
if (target.className.indexOf('quickprev') !== -1) {
newPage = currentPage - 5;
} else if (target.className.indexOf('quicknext') !== -1) {
newPage = currentPage + 5;
}
}
/* istanbul ignore if */
if (!isNaN(newPage)) {
if (newPage < 1) {
newPage = 1;
}
if (newPage > pageCount) {
newPage = pageCount;
}
}
if (newPage !== currentPage) {
this.$emit('change', newPage);
}
}
},
computed: {
pagers: function pagers() {
var pagerCount = 7;
var currentPage = Number(this.currentPage);
var pageCount = Number(this.pageCount);
var showPrevMore = false;
var showNextMore = false;
if (pageCount > pagerCount) {
if (currentPage > pagerCount - 3) {
showPrevMore = true;
}
if (currentPage < pageCount - 3) {
showNextMore = true;
}
}
var array = [];
if (showPrevMore && !showNextMore) {
var startPage = pageCount - (pagerCount - 2);
for (var i = startPage; i < pageCount; i++) {
array.push(i);
}
} else if (!showPrevMore && showNextMore) {
for (var _i = 2; _i < pagerCount; _i++) {
array.push(_i);
}
} else if (showPrevMore && showNextMore) {
var offset = Math.floor(pagerCount / 2) - 1;
for (var _i2 = currentPage - offset; _i2 <= currentPage + offset; _i2++) {
array.push(_i2);
}
} else {
for (var _i3 = 2; _i3 < pageCount; _i3++) {
array.push(_i3);
}
}
this.showPrevMore = showPrevMore;
this.showNextMore = showNextMore;
return array;
}
},
data: function data() {
return {
current: null,
showPrevMore: false,
showNextMore: false,
quicknextIconClass: 'el-icon-more',
quickprevIconClass: 'el-icon-more'
};
}
};
/***/ },
/* 7 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('ul', {
staticClass: "el-pager",
on: {
"click": _vm.onPagerClick
}
}, [(_vm.pageCount > 0) ? _c('li', {
staticClass: "number",
class: {
active: _vm.currentPage === 1
}
}, [_vm._v("1")]) : _vm._e(), (_vm.showPrevMore) ? _c('li', {
staticClass: "el-icon more btn-quickprev",
class: [_vm.quickprevIconClass],
on: {
"mouseenter": function($event) {
_vm.quickprevIconClass = 'el-icon-d-arrow-left'
},
"mouseleave": function($event) {
_vm.quickprevIconClass = 'el-icon-more'
}
}
}) : _vm._e(), _vm._l((_vm.pagers), function(pager) {
return _c('li', {
staticClass: "number",
class: {
active: _vm.currentPage === pager
}
}, [_vm._v(_vm._s(pager))])
}), (_vm.showNextMore) ? _c('li', {
staticClass: "el-icon more btn-quicknext",
class: [_vm.quicknextIconClass],
on: {
"mouseenter": function($event) {
_vm.quicknextIconClass = 'el-icon-d-arrow-right'
},
"mouseleave": function($event) {
_vm.quicknextIconClass = 'el-icon-more'
}
}
}) : _vm._e(), (_vm.pageCount > 1) ? _c('li', {
staticClass: "number",
class: {
active: _vm.currentPage === _vm.pageCount
}
}, [_vm._v(_vm._s(_vm.pageCount))]) : _vm._e()], 2)
},staticRenderFns: []}
/***/ },
/* 8 */
/***/ function(module, exports) {
module.exports = __webpack_require__(31);
/***/ },
/* 9 */
/***/ function(module, exports) {
module.exports = __webpack_require__(37);
/***/ },
/* 10 */
/***/ function(module, exports) {
module.exports = __webpack_require__(22);
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _component = __webpack_require__(12);
var _component2 = _interopRequireDefault(_component);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_component2.default.install = function (Vue) {
Vue.component(_component2.default.name, _component2.default);
};
exports.default = _component2.default;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(13),
/* template */
__webpack_require__(16),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _popup = __webpack_require__(14);
var _popup2 = _interopRequireDefault(_popup);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElDialog',
mixins: [_popup2.default, _emitter2.default],
props: {
title: {
type: String,
default: ''
},
modal: {
type: Boolean,
default: true
},
modalAppendToBody: {
type: Boolean,
default: true
},
lockScroll: {
type: Boolean,
default: true
},
closeOnClickModal: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: true
},
showClose: {
type: Boolean,
default: true
},
size: {
type: String,
default: 'small'
},
customClass: {
type: String,
default: ''
},
top: {
type: String,
default: '15%'
},
beforeClose: Function
},
watch: {
visible: function visible(val) {
var _this = this;
this.$emit('update:visible', val);
if (val) {
this.$emit('open');
this.$el.addEventListener('scroll', this.updatePopper);
this.$nextTick(function () {
_this.$refs.dialog.scrollTop = 0;
});
} else {
this.$el.removeEventListener('scroll', this.updatePopper);
this.$emit('close');
}
}
},
computed: {
sizeClass: function sizeClass() {
return 'el-dialog--' + this.size;
},
style: function style() {
return this.size === 'full' ? {} : { 'top': this.top };
}
},
methods: {
handleWrapperClick: function handleWrapperClick() {
if (!this.closeOnClickModal) return;
this.handleClose();
},
handleClose: function handleClose() {
if (typeof this.beforeClose === 'function') {
this.beforeClose(this.hide);
} else {
this.hide();
}
},
hide: function hide(cancel) {
if (cancel !== false) {
this.$emit('update:visible', false);
this.$emit('visible-change', false);
}
},
updatePopper: function updatePopper() {
this.broadcast('ElSelectDropdown', 'updatePopper');
this.broadcast('ElDropdownMenu', 'updatePopper');
}
},
mounted: function mounted() {
if (this.visible) {
this.rendered = true;
this.open();
}
}
};
/***/ },
/* 14 */
/***/ function(module, exports) {
module.exports = __webpack_require__(19);
/***/ },
/* 15 */
/***/ function(module, exports) {
module.exports = __webpack_require__(5);
/***/ },
/* 16 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "dialog-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-dialog__wrapper",
on: {
"click": function($event) {
if ($event.target !== $event.currentTarget) { return null; }
_vm.handleWrapperClick($event)
}
}
}, [_c('div', {
ref: "dialog",
staticClass: "el-dialog",
class: [_vm.sizeClass, _vm.customClass],
style: (_vm.style)
}, [_c('div', {
staticClass: "el-dialog__header"
}, [_vm._t("title", [_c('span', {
staticClass: "el-dialog__title"
}, [_vm._v(_vm._s(_vm.title))])]), (_vm.showClose) ? _c('button', {
staticClass: "el-dialog__headerbtn",
attrs: {
"type": "button",
"aria-label": "Close"
},
on: {
"click": _vm.handleClose
}
}, [_c('i', {
staticClass: "el-dialog__close el-icon el-icon-close"
})]) : _vm._e()], 2), (_vm.rendered) ? _c('div', {
staticClass: "el-dialog__body"
}, [_vm._t("default")], 2) : _vm._e(), (_vm.$slots.footer) ? _c('div', {
staticClass: "el-dialog__footer"
}, [_vm._t("footer")], 2) : _vm._e()])])])
},staticRenderFns: []}
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _autocomplete = __webpack_require__(18);
var _autocomplete2 = _interopRequireDefault(_autocomplete);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_autocomplete2.default.install = function (Vue) {
Vue.component(_autocomplete2.default.name, _autocomplete2.default);
};
exports.default = _autocomplete2.default;
/***/ },
/* 18 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(19),
/* template */
__webpack_require__(27),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
var _clickoutside = __webpack_require__(21);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _autocompleteSuggestions = __webpack_require__(22);
var _autocompleteSuggestions2 = _interopRequireDefault(_autocompleteSuggestions);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElAutocomplete',
mixins: [_emitter2.default],
componentName: 'ElAutocomplete',
components: {
ElInput: _input2.default,
ElAutocompleteSuggestions: _autocompleteSuggestions2.default
},
directives: { Clickoutside: _clickoutside2.default },
props: {
props: {
type: Object,
default: function _default() {
return {
label: 'value',
value: 'value'
};
}
},
popperClass: String,
placeholder: String,
disabled: Boolean,
name: String,
size: String,
value: String,
autofocus: Boolean,
fetchSuggestions: Function,
triggerOnFocus: {
type: Boolean,
default: true
},
customItem: String,
icon: String,
onIconClick: Function
},
data: function data() {
return {
activated: false,
isOnComposition: false,
suggestions: [],
loading: false,
highlightedIndex: -1
};
},
computed: {
suggestionVisible: function suggestionVisible() {
var suggestions = this.suggestions;
var isValidData = Array.isArray(suggestions) && suggestions.length > 0;
return (isValidData || this.loading) && this.activated;
}
},
watch: {
suggestionVisible: function suggestionVisible(val) {
this.broadcast('ElAutocompleteSuggestions', 'visible', [val, this.$refs.input.$refs.input.offsetWidth]);
}
},
methods: {
getData: function getData(queryString) {
var _this = this;
this.loading = true;
this.fetchSuggestions(queryString, function (suggestions) {
_this.loading = false;
if (Array.isArray(suggestions)) {
_this.suggestions = suggestions;
} else {
console.error('autocomplete suggestions must be an array');
}
});
},
handleComposition: function handleComposition(event) {
if (event.type === 'compositionend') {
this.isOnComposition = false;
this.handleChange(this.value);
} else {
this.isOnComposition = true;
}
},
handleChange: function handleChange(value) {
this.$emit('input', value);
if (this.isOnComposition || !this.triggerOnFocus && !value) {
this.suggestions = [];
return;
}
this.getData(value);
},
handleFocus: function handleFocus() {
this.activated = true;
if (this.triggerOnFocus) {
this.getData(this.value);
}
},
close: function close(e) {
this.activated = false;
},
handleKeyEnter: function handleKeyEnter() {
if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
this.select(this.suggestions[this.highlightedIndex]);
}
},
select: function select(item) {
var _this2 = this;
this.$emit('input', item[this.props.value]);
this.$emit('select', item);
this.$nextTick(function (_) {
_this2.suggestions = [];
});
},
highlight: function highlight(index) {
if (!this.suggestionVisible || this.loading) {
return;
}
if (index < 0) index = 0;
if (index >= this.suggestions.length) {
index = this.suggestions.length - 1;
}
var suggestion = this.$refs.suggestions.$el.querySelector('.el-autocomplete-suggestion__wrap');
var suggestionList = suggestion.querySelectorAll('.el-autocomplete-suggestion__list li');
var highlightItem = suggestionList[index];
var scrollTop = suggestion.scrollTop;
var offsetTop = highlightItem.offsetTop;
if (offsetTop + highlightItem.scrollHeight > scrollTop + suggestion.clientHeight) {
suggestion.scrollTop += highlightItem.scrollHeight;
}
if (offsetTop < scrollTop) {
suggestion.scrollTop -= highlightItem.scrollHeight;
}
this.highlightedIndex = index;
}
},
mounted: function mounted() {
var _this3 = this;
this.$on('item-click', function (item) {
_this3.select(item);
});
},
beforeDestroy: function beforeDestroy() {
this.$refs.suggestions.$destroy();
}
};
/***/ },
/* 20 */
/***/ function(module, exports) {
module.exports = __webpack_require__(10);
/***/ },
/* 21 */
/***/ function(module, exports) {
module.exports = __webpack_require__(18);
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(23),
/* template */
__webpack_require__(26),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _scrollbar = __webpack_require__(25);
var _scrollbar2 = _interopRequireDefault(_scrollbar);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
components: { ElScrollbar: _scrollbar2.default },
mixins: [_vuePopper2.default, _emitter2.default],
componentName: 'ElAutocompleteSuggestions',
data: function data() {
return {
parent: this.$parent,
dropdownWidth: ''
};
},
props: {
props: Object,
suggestions: Array,
options: {
default: function _default() {
return {
forceAbsolute: true,
gpuAcceleration: false
};
}
}
},
methods: {
select: function select(item) {
this.dispatch('ElAutocomplete', 'item-click', item);
}
},
updated: function updated() {
var _this = this;
this.$nextTick(function (_) {
_this.updatePopper();
});
},
mounted: function mounted() {
this.$parent.popperElm = this.popperElm = this.$el;
this.referenceElm = this.$parent.$refs.input.$refs.input;
},
created: function created() {
var _this2 = this;
this.$on('visible', function (val, inputWidth) {
_this2.dropdownWidth = inputWidth + 'px';
_this2.showPopper = val;
});
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 24 */
/***/ function(module, exports) {
module.exports = __webpack_require__(12);
/***/ },
/* 25 */
/***/ function(module, exports) {
module.exports = __webpack_require__(20);
/***/ },
/* 26 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"after-leave": _vm.doDestroy
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showPopper),
expression: "showPopper"
}],
staticClass: "el-autocomplete-suggestion",
class: {
'is-loading': _vm.parent.loading
},
style: ({
width: _vm.dropdownWidth
})
}, [_c('el-scrollbar', {
attrs: {
"tag": "ul",
"wrap-class": "el-autocomplete-suggestion__wrap",
"view-class": "el-autocomplete-suggestion__list"
}
}, [(_vm.parent.loading) ? _c('li', [_c('i', {
staticClass: "el-icon-loading"
})]) : _vm._l((_vm.suggestions), function(item, index) {
return [(!_vm.parent.customItem) ? _c('li', {
class: {
'highlighted': _vm.parent.highlightedIndex === index
},
on: {
"click": function($event) {
_vm.select(item)
}
}
}, [_vm._v("\n " + _vm._s(item[_vm.props.label]) + "\n ")]) : _c(_vm.parent.customItem, {
tag: "component",
class: {
'highlighted': _vm.parent.highlightedIndex === index
},
attrs: {
"item": item,
"index": index
},
on: {
"click": function($event) {
_vm.select(item)
}
}
})]
})], 2)], 1)])
},staticRenderFns: []}
/***/ },
/* 27 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "clickoutside",
rawName: "v-clickoutside",
value: (_vm.close),
expression: "close"
}],
staticClass: "el-autocomplete"
}, [_c('el-input', {
ref: "input",
attrs: {
"value": _vm.value,
"disabled": _vm.disabled,
"placeholder": _vm.placeholder,
"name": _vm.name,
"size": _vm.size,
"icon": _vm.icon,
"on-icon-click": _vm.onIconClick
},
on: {
"change": _vm.handleChange,
"focus": _vm.handleFocus
},
nativeOn: {
"compositionstart": function($event) {
_vm.handleComposition($event)
},
"compositionupdate": function($event) {
_vm.handleComposition($event)
},
"compositionend": function($event) {
_vm.handleComposition($event)
},
"keydown": [function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "up", 38)) { return null; }
$event.preventDefault();
_vm.highlight(_vm.highlightedIndex - 1)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "down", 40)) { return null; }
$event.preventDefault();
_vm.highlight(_vm.highlightedIndex + 1)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "enter", 13)) { return null; }
$event.preventDefault();
_vm.handleKeyEnter($event)
}]
}
}, [(_vm.$slots.prepend) ? _c('template', {
slot: "prepend"
}, [_vm._t("prepend")], 2) : _vm._e(), (_vm.$slots.append) ? _c('template', {
slot: "append"
}, [_vm._t("append")], 2) : _vm._e()], 2), _c('el-autocomplete-suggestions', {
ref: "suggestions",
class: [_vm.popperClass ? _vm.popperClass : ''],
attrs: {
"props": _vm.props,
"suggestions": _vm.suggestions
}
})], 1)
},staticRenderFns: []}
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dropdown = __webpack_require__(29);
var _dropdown2 = _interopRequireDefault(_dropdown);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_dropdown2.default.install = function (Vue) {
Vue.component(_dropdown2.default.name, _dropdown2.default);
};
exports.default = _dropdown2.default;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(30),
/* template */
null,
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _clickoutside = __webpack_require__(21);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _button = __webpack_require__(31);
var _button2 = _interopRequireDefault(_button);
var _buttonGroup = __webpack_require__(32);
var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElDropdown',
componentName: 'ElDropdown',
mixins: [_emitter2.default],
directives: { Clickoutside: _clickoutside2.default },
components: {
ElButton: _button2.default,
ElButtonGroup: _buttonGroup2.default
},
props: {
trigger: {
type: String,
default: 'hover'
},
menuAlign: {
type: String,
default: 'end'
},
type: String,
size: String,
splitButton: Boolean,
hideOnClick: {
type: Boolean,
default: true
}
},
data: function data() {
return {
timeout: null,
visible: false
};
},
mounted: function mounted() {
this.$on('menu-item-click', this.handleMenuItemClick);
this.initEvent();
},
watch: {
visible: function visible(val) {
this.broadcast('ElDropdownMenu', 'visible', val);
this.$emit('visible-change', val);
}
},
methods: {
show: function show() {
var _this = this;
clearTimeout(this.timeout);
this.timeout = setTimeout(function () {
_this.visible = true;
}, 250);
},
hide: function hide() {
var _this2 = this;
clearTimeout(this.timeout);
this.timeout = setTimeout(function () {
_this2.visible = false;
}, 150);
},
handleClick: function handleClick() {
this.visible = !this.visible;
},
initEvent: function initEvent() {
var trigger = this.trigger,
show = this.show,
hide = this.hide,
handleClick = this.handleClick,
splitButton = this.splitButton;
var triggerElm = splitButton ? this.$refs.trigger.$el : this.$slots.default[0].elm;
if (trigger === 'hover') {
triggerElm.addEventListener('mouseenter', show);
triggerElm.addEventListener('mouseleave', hide);
var dropdownElm = this.$slots.dropdown[0].elm;
dropdownElm.addEventListener('mouseenter', show);
dropdownElm.addEventListener('mouseleave', hide);
} else if (trigger === 'click') {
triggerElm.addEventListener('click', handleClick);
}
},
handleMenuItemClick: function handleMenuItemClick(command, instance) {
if (this.hideOnClick) {
this.visible = false;
}
this.$emit('command', command, instance);
}
},
render: function render(h) {
var _this3 = this;
var hide = this.hide,
splitButton = this.splitButton,
type = this.type,
size = this.size;
var handleClick = function handleClick(_) {
_this3.$emit('click');
};
var triggerElm = !splitButton ? this.$slots.default : h(
'el-button-group',
null,
[h(
'el-button',
{
attrs: { type: type, size: size },
nativeOn: {
'click': handleClick
}
},
[this.$slots.default]
), h(
'el-button',
{ ref: 'trigger', attrs: { type: type, size: size },
'class': 'el-dropdown__caret-button' },
[h(
'i',
{ 'class': 'el-dropdown__icon el-icon-caret-bottom' },
[]
)]
)]
);
return h(
'div',
{ 'class': 'el-dropdown', directives: [{
name: 'clickoutside',
value: hide
}]
},
[triggerElm, this.$slots.dropdown]
);
}
};
/***/ },
/* 31 */
/***/ function(module, exports) {
module.exports = __webpack_require__(38);
/***/ },
/* 32 */
/***/ function(module, exports) {
module.exports = __webpack_require__(39);
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dropdownMenu = __webpack_require__(34);
var _dropdownMenu2 = _interopRequireDefault(_dropdownMenu);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_dropdownMenu2.default.install = function (Vue) {
Vue.component(_dropdownMenu2.default.name, _dropdownMenu2.default);
};
exports.default = _dropdownMenu2.default;
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(35),
/* template */
__webpack_require__(36),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElDropdownMenu',
componentName: 'ElDropdownMenu',
mixins: [_vuePopper2.default],
created: function created() {
var _this = this;
this.$on('updatePopper', function () {
if (_this.showPopper) _this.updatePopper();
});
this.$on('visible', function (val) {
_this.showPopper = val;
});
},
mounted: function mounted() {
this.$parent.popperElm = this.popperElm = this.$el;
this.referenceElm = this.$parent.$el;
},
watch: {
'$parent.menuAlign': {
immediate: true,
handler: function handler(val) {
this.currentPlacement = 'bottom-' + val;
}
}
}
}; //
//
//
//
//
//
//
/***/ },
/* 36 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"after-leave": _vm.doDestroy
}
}, [_c('ul', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showPopper),
expression: "showPopper"
}],
staticClass: "el-dropdown-menu"
}, [_vm._t("default")], 2)])
},staticRenderFns: []}
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dropdownItem = __webpack_require__(38);
var _dropdownItem2 = _interopRequireDefault(_dropdownItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_dropdownItem2.default.install = function (Vue) {
Vue.component(_dropdownItem2.default.name, _dropdownItem2.default);
};
exports.default = _dropdownItem2.default;
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(39),
/* template */
__webpack_require__(40),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElDropdownItem',
mixins: [_emitter2.default],
props: {
command: null,
disabled: Boolean,
divided: Boolean
},
methods: {
handleClick: function handleClick(e) {
this.dispatch('ElDropdown', 'menu-item-click', [this.command, this]);
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 40 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('li', {
staticClass: "el-dropdown-menu__item",
class: {
'is-disabled': _vm.disabled,
'el-dropdown-menu__item--divided': _vm.divided
},
on: {
"click": _vm.handleClick
}
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _menu = __webpack_require__(42);
var _menu2 = _interopRequireDefault(_menu);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_menu2.default.install = function (Vue) {
Vue.component(_menu2.default.name, _menu2.default);
};
exports.default = _menu2.default;
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(43),
/* template */
__webpack_require__(46),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _dom = __webpack_require__(45);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_vue2.default.component('el-menu-collapse-transition', {
functional: true,
render: function render(createElement, context) {
var data = {
props: {
mode: 'out-in'
},
on: {
beforeEnter: function beforeEnter(el) {
el.style.opacity = 0.2;
},
enter: function enter(el) {
(0, _dom.addClass)(el, 'el-opacity-transition');
el.style.opacity = 1;
},
afterEnter: function afterEnter(el) {
(0, _dom.removeClass)(el, 'el-opacity-transition');
el.style.opacity = '';
},
beforeLeave: function beforeLeave(el) {
if (!el.dataset) el.dataset = {};
if ((0, _dom.hasClass)(el, 'el-menu--collapse')) {
(0, _dom.removeClass)(el, 'el-menu--collapse');
el.dataset.oldOverflow = el.style.overflow;
el.dataset.scrollWidth = el.scrollWidth;
(0, _dom.addClass)(el, 'el-menu--collapse');
}
el.style.width = el.scrollWidth + 'px';
el.style.overflow = 'hidden';
},
leave: function leave(el) {
if (!(0, _dom.hasClass)(el, 'el-menu--collapse')) {
(0, _dom.addClass)(el, 'horizontal-collapse-transition');
el.style.width = '64px';
} else {
(0, _dom.addClass)(el, 'horizontal-collapse-transition');
el.style.width = el.dataset.scrollWidth + 'px';
}
},
afterLeave: function afterLeave(el) {
(0, _dom.removeClass)(el, 'horizontal-collapse-transition');
if ((0, _dom.hasClass)(el, 'el-menu--collapse')) {
el.style.width = el.dataset.scrollWidth + 'px';
} else {
el.style.width = '64px';
}
el.style.overflow = el.dataset.oldOverflow;
}
}
};
return createElement('transition', data, context.children);
}
}); //
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElMenu',
componentName: 'ElMenu',
mixins: [_emitter2.default],
provide: function provide() {
return {
rootMenu: this
};
},
props: {
mode: {
type: String,
default: 'vertical'
},
defaultActive: {
type: String,
default: ''
},
defaultOpeneds: Array,
theme: {
type: String,
default: 'light'
},
uniqueOpened: Boolean,
router: Boolean,
menuTrigger: {
type: String,
default: 'hover'
},
collapse: Boolean
},
data: function data() {
return {
activedIndex: this.defaultActive,
openedMenus: this.defaultOpeneds ? this.defaultOpeneds.slice(0) : [],
items: {},
submenus: {}
};
},
watch: {
defaultActive: function defaultActive(value) {
var item = this.items[value];
if (item) {
this.activedIndex = item.index;
this.initOpenedMenu();
} else {
this.activedIndex = '';
}
},
defaultOpeneds: function defaultOpeneds(value) {
this.openedMenus = value;
}
},
methods: {
addItem: function addItem(item) {
this.$set(this.items, item.index, item);
},
removeItem: function removeItem(item) {
delete this.items[item.index];
},
addSubmenu: function addSubmenu(item) {
this.$set(this.submenus, item.index, item);
},
removeSubmenu: function removeSubmenu(item) {
delete this.submenus[item.index];
},
openMenu: function openMenu(index, indexPath) {
var openedMenus = this.openedMenus;
if (openedMenus.indexOf(index) !== -1) return;
// 将不在该菜单路径下的其余菜单收起
if (this.uniqueOpened) {
this.openedMenus = openedMenus.filter(function (index) {
return indexPath.indexOf(index) !== -1;
});
}
this.openedMenus.push(index);
},
closeMenu: function closeMenu(index, indexPath) {
this.openedMenus.splice(this.openedMenus.indexOf(index), 1);
},
handleSubmenuClick: function handleSubmenuClick(submenu) {
var index = submenu.index,
indexPath = submenu.indexPath;
var isOpened = this.openedMenus.indexOf(index) !== -1;
if (isOpened) {
this.closeMenu(index, indexPath);
this.$emit('close', index, indexPath);
} else {
this.openMenu(index, indexPath);
this.$emit('open', index, indexPath);
}
},
handleItemClick: function handleItemClick(item) {
var index = item.index,
indexPath = item.indexPath;
this.activedIndex = item.index;
this.$emit('select', index, indexPath, item);
if (this.mode === 'horizontal' || this.collapse) {
this.openedMenus = [];
}
if (this.router) {
this.routeToItem(item);
}
},
// 初始化展开菜单
initOpenedMenu: function initOpenedMenu() {
var _this = this;
var index = this.activedIndex;
var activeItem = this.items[index];
if (!activeItem || this.mode === 'horizontal' || this.collapse) return;
var indexPath = activeItem.indexPath;
// 展开该菜单项的路径上所有子菜单
indexPath.forEach(function (index) {
var submenu = _this.submenus[index];
submenu && _this.openMenu(index, submenu.indexPath);
});
},
routeToItem: function routeToItem(item) {
var route = item.route || item.index;
try {
this.$router.push(route);
} catch (e) {
console.error(e);
}
}
},
mounted: function mounted() {
this.initOpenedMenu();
this.$on('item-click', this.handleItemClick);
this.$on('submenu-click', this.handleSubmenuClick);
}
};
/***/ },
/* 44 */
/***/ function(module, exports) {
module.exports = __webpack_require__(3);
/***/ },
/* 45 */
/***/ function(module, exports) {
module.exports = __webpack_require__(4);
/***/ },
/* 46 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('el-menu-collapse-transition', [_c('ul', {
key: +_vm.collapse,
staticClass: "el-menu",
class: {
'el-menu--horizontal': _vm.mode === 'horizontal',
'el-menu--dark': _vm.theme === 'dark',
'el-menu--collapse': _vm.collapse
}
}, [_vm._t("default")], 2)])
},staticRenderFns: []}
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _submenu = __webpack_require__(48);
var _submenu2 = _interopRequireDefault(_submenu);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_submenu2.default.install = function (Vue) {
Vue.component(_submenu2.default.name, _submenu2.default);
};
exports.default = _submenu2.default;
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(49),
/* template */
__webpack_require__(52),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _collapseTransition = __webpack_require__(50);
var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
var _menuMixin = __webpack_require__(51);
var _menuMixin2 = _interopRequireDefault(_menuMixin);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElSubmenu',
componentName: 'ElSubmenu',
mixins: [_menuMixin2.default, _emitter2.default],
components: { ElCollapseTransition: _collapseTransition2.default },
props: {
index: {
type: String,
required: true
}
},
data: function data() {
return {
timeout: null,
items: {},
submenus: {}
};
},
computed: {
menuTransitionName: function menuTransitionName() {
return this.rootMenu.collapse ? 'el-zoom-in-left' : 'el-zoom-in-top';
},
opened: function opened() {
return this.rootMenu.openedMenus.indexOf(this.index) > -1;
},
active: {
cache: false,
get: function get() {
var isActive = false;
var submenus = this.submenus;
var items = this.items;
Object.keys(items).forEach(function (index) {
if (items[index].active) {
isActive = true;
}
});
Object.keys(submenus).forEach(function (index) {
if (submenus[index].active) {
isActive = true;
}
});
return isActive;
}
}
},
methods: {
addItem: function addItem(item) {
this.$set(this.items, item.index, item);
},
removeItem: function removeItem(item) {
delete this.items[item.index];
},
addSubmenu: function addSubmenu(item) {
this.$set(this.submenus, item.index, item);
},
removeSubmenu: function removeSubmenu(item) {
delete this.submenus[item.index];
},
handleClick: function handleClick() {
var rootMenu = this.rootMenu;
if (rootMenu.menuTrigger === 'hover' && rootMenu.mode === 'horizontal' || rootMenu.collapse && rootMenu.mode === 'vertical') {
return;
}
this.dispatch('ElMenu', 'submenu-click', this);
},
handleMouseenter: function handleMouseenter() {
var _this = this;
var rootMenu = this.rootMenu;
if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical') {
return;
}
clearTimeout(this.timeout);
this.timeout = setTimeout(function () {
_this.rootMenu.openMenu(_this.index, _this.indexPath);
}, 300);
},
handleMouseleave: function handleMouseleave() {
var _this2 = this;
var rootMenu = this.rootMenu;
if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical') {
return;
}
clearTimeout(this.timeout);
this.timeout = setTimeout(function () {
_this2.rootMenu.closeMenu(_this2.index, _this2.indexPath);
}, 300);
}
},
created: function created() {
this.parentMenu.addSubmenu(this);
this.rootMenu.addSubmenu(this);
},
beforeDestroy: function beforeDestroy() {
this.parentMenu.removeSubmenu(this);
this.rootMenu.removeSubmenu(this);
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 50 */
/***/ function(module, exports) {
module.exports = __webpack_require__(40);
/***/ },
/* 51 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.default = {
computed: {
indexPath: function indexPath() {
var path = [this.index];
var parent = this.$parent;
while (parent.$options.componentName !== 'ElMenu') {
if (parent.index) {
path.unshift(parent.index);
}
parent = parent.$parent;
}
return path;
},
rootMenu: function rootMenu() {
var parent = this.$parent;
while (parent && parent.$options.componentName !== 'ElMenu') {
parent = parent.$parent;
}
return parent;
},
parentMenu: function parentMenu() {
var parent = this.$parent;
while (parent && ['ElMenu', 'ElSubmenu'].indexOf(parent.$options.componentName) === -1) {
parent = parent.$parent;
}
return parent;
},
paddingStyle: function paddingStyle() {
if (this.rootMenu.mode !== 'vertical') return {};
var padding = 20;
var parent = this.$parent;
if (this.rootMenu.collapse) {
padding = 20;
} else {
while (parent && parent.$options.componentName !== 'ElMenu') {
if (parent.$options.componentName === 'ElSubmenu') {
padding += 20;
}
parent = parent.$parent;
}
}
return { paddingLeft: padding + 'px' };
}
}
};
/***/ },
/* 52 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('li', {
class: {
'el-submenu': true,
'is-active': _vm.active,
'is-opened': _vm.opened
},
on: {
"mouseenter": _vm.handleMouseenter,
"mouseleave": _vm.handleMouseleave
}
}, [_c('div', {
ref: "submenu-title",
staticClass: "el-submenu__title",
style: (_vm.paddingStyle),
on: {
"click": _vm.handleClick
}
}, [_vm._t("title"), _c('i', {
class: {
'el-submenu__icon-arrow': true,
'el-icon-caret-bottom': _vm.rootMenu.mode === 'horizontal',
'el-icon-arrow-down': _vm.rootMenu.mode === 'vertical' && !_vm.rootMenu.collapse,
'el-icon-caret-right': _vm.rootMenu.mode === 'vertical' && _vm.rootMenu.collapse
}
})], 2), (_vm.rootMenu.mode === 'horizontal' || (_vm.rootMenu.mode === 'vertical' && _vm.rootMenu.collapse)) ? [_c('transition', {
attrs: {
"name": _vm.menuTransitionName
}
}, [_c('ul', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.opened),
expression: "opened"
}],
staticClass: "el-menu"
}, [_vm._t("default")], 2)])] : _c('el-collapse-transition', [_c('ul', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.opened),
expression: "opened"
}],
staticClass: "el-menu"
}, [_vm._t("default")], 2)])], 2)
},staticRenderFns: []}
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _menuItem = __webpack_require__(54);
var _menuItem2 = _interopRequireDefault(_menuItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_menuItem2.default.install = function (Vue) {
Vue.component(_menuItem2.default.name, _menuItem2.default);
};
exports.default = _menuItem2.default;
/***/ },
/* 54 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(55),
/* template */
__webpack_require__(56),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _menuMixin = __webpack_require__(51);
var _menuMixin2 = _interopRequireDefault(_menuMixin);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElMenuItem',
componentName: 'ElMenuItem',
mixins: [_menuMixin2.default, _emitter2.default],
props: {
index: {
type: String,
required: true
},
route: {
type: Object,
required: false
},
disabled: {
type: Boolean,
required: false
}
},
computed: {
active: function active() {
return this.index === this.rootMenu.activedIndex;
}
},
methods: {
handleClick: function handleClick() {
this.dispatch('ElMenu', 'item-click', this);
this.$emit('click', this);
}
},
created: function created() {
this.parentMenu.addItem(this);
this.rootMenu.addItem(this);
},
beforeDestroy: function beforeDestroy() {
this.parentMenu.removeItem(this);
this.rootMenu.removeItem(this);
}
};
/***/ },
/* 56 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('li', {
staticClass: "el-menu-item",
class: {
'is-active': _vm.active,
'is-disabled': _vm.disabled
},
style: (_vm.paddingStyle),
on: {
"click": _vm.handleClick
}
}, [(_vm.$parent === _vm.rootMenu && _vm.rootMenu.collapse) ? _c('el-tooltip', {
attrs: {
"effect": "dark",
"placement": "right"
}
}, [_c('div', {
slot: "content"
}, [_vm._t("title")], 2), _c('div', {
staticStyle: {
"position": "absolute",
"left": "0",
"top": "0",
"height": "100%",
"width": "100%",
"display": "inline-block",
"box-sizing": "border-box",
"padding": "0 20px"
}
}, [_vm._t("default")], 2)]) : [_vm._t("default"), _vm._t("title")]], 2)
},staticRenderFns: []}
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _menuItemGroup = __webpack_require__(58);
var _menuItemGroup2 = _interopRequireDefault(_menuItemGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_menuItemGroup2.default.install = function (Vue) {
Vue.component(_menuItemGroup2.default.name, _menuItemGroup2.default);
};
exports.default = _menuItemGroup2.default;
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(59),
/* template */
__webpack_require__(60),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 59 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElMenuItemGroup',
componentName: 'ElMenuItemGroup',
inject: ['rootMenu'],
props: {
title: {
type: String
}
},
data: function data() {
return {
paddingLeft: 20
};
},
computed: {
levelPadding: function levelPadding() {
var padding = 10;
var parent = this.$parent;
if (this.rootMenu.collapse) return 20;
while (parent && parent.$options.componentName !== 'ElMenu') {
if (parent.$options.componentName === 'ElSubmenu') {
padding += 20;
}
parent = parent.$parent;
}
padding === 10 && (padding = 20);
return padding;
}
}
};
/***/ },
/* 60 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('li', {
staticClass: "el-menu-item-group"
}, [_c('div', {
staticClass: "el-menu-item-group__title",
style: ({
paddingLeft: _vm.levelPadding + 'px'
})
}, [(!_vm.$slots.title) ? [_vm._v(_vm._s(_vm.title))] : _vm._t("title")], 2), _c('ul', [_vm._t("default")], 2)])
},staticRenderFns: []}
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _input = __webpack_require__(62);
var _input2 = _interopRequireDefault(_input);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_input2.default.install = function (Vue) {
Vue.component(_input2.default.name, _input2.default);
};
exports.default = _input2.default;
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(63),
/* template */
__webpack_require__(66),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _calcTextareaHeight = __webpack_require__(64);
var _calcTextareaHeight2 = _interopRequireDefault(_calcTextareaHeight);
var _merge = __webpack_require__(65);
var _merge2 = _interopRequireDefault(_merge);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElInput',
componentName: 'ElInput',
mixins: [_emitter2.default],
data: function data() {
return {
currentValue: this.value,
textareaCalcStyle: {}
};
},
props: {
value: [String, Number],
placeholder: String,
size: String,
resize: String,
readonly: Boolean,
autofocus: Boolean,
icon: String,
disabled: Boolean,
type: {
type: String,
default: 'text'
},
name: String,
autosize: {
type: [Boolean, Object],
default: false
},
rows: {
type: Number,
default: 2
},
autoComplete: {
type: String,
default: 'off'
},
form: String,
maxlength: Number,
minlength: Number,
max: {},
min: {},
step: {},
validateEvent: {
type: Boolean,
default: true
},
onIconClick: Function
},
computed: {
validating: function validating() {
return this.$parent.validateState === 'validating';
},
textareaStyle: function textareaStyle() {
return (0, _merge2.default)({}, this.textareaCalcStyle, { resize: this.resize });
}
},
watch: {
'value': function value(val, oldValue) {
this.setCurrentValue(val);
}
},
methods: {
handleBlur: function handleBlur(event) {
this.$emit('blur', event);
if (this.validateEvent) {
this.dispatch('ElFormItem', 'el.form.blur', [this.currentValue]);
}
},
inputSelect: function inputSelect() {
this.$refs.input.select();
},
resizeTextarea: function resizeTextarea() {
if (this.$isServer) return;
var autosize = this.autosize,
type = this.type;
if (!autosize || type !== 'textarea') return;
var minRows = autosize.minRows;
var maxRows = autosize.maxRows;
this.textareaCalcStyle = (0, _calcTextareaHeight2.default)(this.$refs.textarea, minRows, maxRows);
},
handleFocus: function handleFocus(event) {
this.$emit('focus', event);
},
handleInput: function handleInput(event) {
var value = event.target.value;
this.$emit('input', value);
this.setCurrentValue(value);
this.$emit('change', value);
},
handleIconClick: function handleIconClick(event) {
if (this.onIconClick) {
this.onIconClick(event);
}
this.$emit('click', event);
},
setCurrentValue: function setCurrentValue(value) {
var _this = this;
if (value === this.currentValue) return;
this.$nextTick(function (_) {
_this.resizeTextarea();
});
this.currentValue = value;
if (this.validateEvent) {
this.dispatch('ElFormItem', 'el.form.change', [value]);
}
}
},
created: function created() {
this.$on('inputSelect', this.inputSelect);
},
mounted: function mounted() {
this.resizeTextarea();
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 64 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.default = calcTextareaHeight;
var hiddenTextarea = void 0;
var HIDDEN_STYLE = '\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n';
var CONTEXT_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing'];
function calculateNodeStyling(node) {
var style = window.getComputedStyle(node);
var boxSizing = style.getPropertyValue('box-sizing');
var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
var contextStyle = CONTEXT_STYLE.map(function (name) {
return name + ':' + style.getPropertyValue(name);
}).join(';');
return { contextStyle: contextStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing };
}
function calcTextareaHeight(targetNode) {
var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
if (!hiddenTextarea) {
hiddenTextarea = document.createElement('textarea');
document.body.appendChild(hiddenTextarea);
}
var _calculateNodeStyling = calculateNodeStyling(targetNode),
paddingSize = _calculateNodeStyling.paddingSize,
borderSize = _calculateNodeStyling.borderSize,
boxSizing = _calculateNodeStyling.boxSizing,
contextStyle = _calculateNodeStyling.contextStyle;
hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
hiddenTextarea.value = targetNode.value || targetNode.placeholder || '';
var height = hiddenTextarea.scrollHeight;
if (boxSizing === 'border-box') {
height = height + borderSize;
} else if (boxSizing === 'content-box') {
height = height - paddingSize;
}
hiddenTextarea.value = '';
var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
if (minRows !== null) {
var minHeight = singleRowHeight * minRows;
if (boxSizing === 'border-box') {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
}
if (maxRows !== null) {
var maxHeight = singleRowHeight * maxRows;
if (boxSizing === 'border-box') {
maxHeight = maxHeight + paddingSize + borderSize;
}
height = Math.min(maxHeight, height);
}
return { height: height + 'px' };
};
/***/ },
/* 65 */
/***/ function(module, exports) {
module.exports = __webpack_require__(11);
/***/ },
/* 66 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
class: [
_vm.type === 'textarea' ? 'el-textarea' : 'el-input',
_vm.size ? 'el-input--' + _vm.size : '', {
'is-disabled': _vm.disabled,
'el-input-group': _vm.$slots.prepend || _vm.$slots.append,
'el-input-group--append': _vm.$slots.append,
'el-input-group--prepend': _vm.$slots.prepend
}
]
}, [(_vm.type !== 'textarea') ? [(_vm.$slots.prepend) ? _c('div', {
staticClass: "el-input-group__prepend"
}, [_vm._t("prepend")], 2) : _vm._e(), _vm._t("icon", [(_vm.icon) ? _c('i', {
staticClass: "el-input__icon",
class: [
'el-icon-' + _vm.icon,
_vm.onIconClick ? 'is-clickable' : ''
],
on: {
"click": _vm.handleIconClick
}
}) : _vm._e()]), (_vm.type !== 'textarea') ? _c('input', _vm._b({
ref: "input",
staticClass: "el-input__inner",
attrs: {
"autocomplete": _vm.autoComplete
},
domProps: {
"value": _vm.currentValue
},
on: {
"input": _vm.handleInput,
"focus": _vm.handleFocus,
"blur": _vm.handleBlur
}
}, 'input', _vm.$props)) : _vm._e(), (_vm.validating) ? _c('i', {
staticClass: "el-input__icon el-icon-loading"
}) : _vm._e(), (_vm.$slots.append) ? _c('div', {
staticClass: "el-input-group__append"
}, [_vm._t("append")], 2) : _vm._e()] : _c('textarea', _vm._b({
ref: "textarea",
staticClass: "el-textarea__inner",
style: (_vm.textareaStyle),
domProps: {
"value": _vm.currentValue
},
on: {
"input": _vm.handleInput,
"focus": _vm.handleFocus,
"blur": _vm.handleBlur
}
}, 'textarea', _vm.$props))], 2)
},staticRenderFns: []}
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _inputNumber = __webpack_require__(68);
var _inputNumber2 = _interopRequireDefault(_inputNumber);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_inputNumber2.default.install = function (Vue) {
Vue.component(_inputNumber2.default.name, _inputNumber2.default);
};
exports.default = _inputNumber2.default;
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(69),
/* template */
__webpack_require__(71),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
var _dom = __webpack_require__(45);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElInputNumber',
directives: {
repeatClick: {
bind: function bind(el, binding, vnode) {
var interval = null;
var startTime = void 0;
var handler = function handler() {
return vnode.context[binding.expression].apply();
};
var clear = function clear() {
if (new Date() - startTime < 100) {
handler();
}
clearInterval(interval);
interval = null;
};
(0, _dom.on)(el, 'mousedown', function () {
startTime = new Date();
(0, _dom.once)(document, 'mouseup', clear);
clearInterval(interval);
interval = setInterval(handler, 100);
});
}
}
},
components: {
ElInput: _input2.default
},
props: {
step: {
type: Number,
default: 1
},
max: {
type: Number,
default: Infinity
},
min: {
type: Number,
default: -Infinity
},
value: {
default: 0
},
disabled: Boolean,
size: String,
controls: {
type: Boolean,
default: true
},
debounce: {
type: Number,
default: 300
}
},
data: function data() {
return {
currentValue: 0
};
},
watch: {
value: {
immediate: true,
handler: function handler(value) {
var newVal = Number(value);
if (isNaN(newVal)) return;
if (newVal >= this.max) newVal = this.max;
if (newVal <= this.min) newVal = this.min;
this.currentValue = newVal;
this.$emit('input', newVal);
}
}
},
computed: {
minDisabled: function minDisabled() {
return this._decrease(this.value, this.step) < this.min;
},
maxDisabled: function maxDisabled() {
return this._increase(this.value, this.step) > this.max;
},
precision: function precision() {
var value = this.value,
step = this.step,
getPrecision = this.getPrecision;
return Math.max(getPrecision(value), getPrecision(step));
}
},
methods: {
toPrecision: function toPrecision(num, precision) {
if (precision === undefined) precision = this.precision;
return parseFloat(parseFloat(Number(num).toFixed(precision)));
},
getPrecision: function getPrecision(value) {
var valueString = value.toString();
var dotPosition = valueString.indexOf('.');
var precision = 0;
if (dotPosition !== -1) {
precision = valueString.length - dotPosition - 1;
}
return precision;
},
_increase: function _increase(val, step) {
if (typeof val !== 'number') return this.currentValue;
var precisionFactor = Math.pow(10, this.precision);
return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
},
_decrease: function _decrease(val, step) {
if (typeof val !== 'number') return this.currentValue;
var precisionFactor = Math.pow(10, this.precision);
return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
},
increase: function increase() {
if (this.disabled || this.maxDisabled) return;
var value = this.value || 0;
var newVal = this._increase(value, this.step);
if (newVal > this.max) return;
this.setCurrentValue(newVal);
},
decrease: function decrease() {
if (this.disabled || this.minDisabled) return;
var value = this.value || 0;
var newVal = this._decrease(value, this.step);
if (newVal < this.min) return;
this.setCurrentValue(newVal);
},
handleBlur: function handleBlur() {
this.$refs.input.setCurrentValue(this.currentValue);
},
setCurrentValue: function setCurrentValue(newVal) {
var oldVal = this.currentValue;
if (newVal >= this.max) newVal = this.max;
if (newVal <= this.min) newVal = this.min;
if (oldVal === newVal) {
this.$refs.input.setCurrentValue(this.currentValue);
return;
}
this.$emit('change', newVal, oldVal);
this.$emit('input', newVal);
this.currentValue = newVal;
},
handleInput: function handleInput(value) {
if (value === '') {
return;
}
var newVal = Number(value);
if (!isNaN(newVal)) {
this.setCurrentValue(newVal);
} else {
this.$refs.input.setCurrentValue(this.currentValue);
}
}
},
created: function created() {
var _this = this;
this.debounceHandleInput = (0, _debounce2.default)(this.debounce, function (value) {
_this.handleInput(value);
});
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 70 */
/***/ function(module, exports) {
module.exports = __webpack_require__(7);
/***/ },
/* 71 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-input-number",
class: [
_vm.size ? 'el-input-number--' + _vm.size : '', {
'is-disabled': _vm.disabled
}, {
'is-without-controls': !_vm.controls
}
]
}, [(_vm.controls) ? _c('span', {
directives: [{
name: "repeat-click",
rawName: "v-repeat-click",
value: (_vm.decrease),
expression: "decrease"
}],
staticClass: "el-input-number__decrease",
class: {
'is-disabled': _vm.minDisabled
}
}, [_c('i', {
staticClass: "el-icon-minus"
})]) : _vm._e(), (_vm.controls) ? _c('span', {
directives: [{
name: "repeat-click",
rawName: "v-repeat-click",
value: (_vm.increase),
expression: "increase"
}],
staticClass: "el-input-number__increase",
class: {
'is-disabled': _vm.maxDisabled
}
}, [_c('i', {
staticClass: "el-icon-plus"
})]) : _vm._e(), _c('el-input', {
ref: "input",
attrs: {
"value": _vm.currentValue,
"disabled": _vm.disabled,
"size": _vm.size,
"max": _vm.max,
"min": _vm.min
},
on: {
"blur": _vm.handleBlur,
"input": _vm.debounceHandleInput
},
nativeOn: {
"keydown": [function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "up", 38)) { return null; }
$event.preventDefault();
_vm.increase($event)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "down", 40)) { return null; }
$event.preventDefault();
_vm.decrease($event)
}]
}
}, [(_vm.$slots.prepend) ? _c('template', {
slot: "prepend"
}, [_vm._t("prepend")], 2) : _vm._e(), (_vm.$slots.append) ? _c('template', {
slot: "append"
}, [_vm._t("append")], 2) : _vm._e()], 2)], 1)
},staticRenderFns: []}
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _radio = __webpack_require__(73);
var _radio2 = _interopRequireDefault(_radio);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_radio2.default.install = function (Vue) {
Vue.component('el-radio', _radio2.default);
};
exports.default = _radio2.default;
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(74),
/* template */
__webpack_require__(75),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElRadio',
mixins: [_emitter2.default],
componentName: 'ElRadio',
props: {
value: {},
label: {},
disabled: Boolean,
name: String
},
data: function data() {
return {
focus: false
};
},
computed: {
isGroup: function isGroup() {
var parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== 'ElRadioGroup') {
parent = parent.$parent;
} else {
this._radioGroup = parent;
return true;
}
}
return false;
},
model: {
get: function get() {
return this.isGroup ? this._radioGroup.value : this.value;
},
set: function set(val) {
if (this.isGroup) {
this.dispatch('ElRadioGroup', 'input', [val]);
} else {
this.$emit('input', val);
}
}
},
isDisabled: function isDisabled() {
return this.isGroup ? this._radioGroup.disabled || this.disabled : this.disabled;
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 75 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('label', {
staticClass: "el-radio"
}, [_c('span', {
staticClass: "el-radio__input",
class: {
'is-disabled': _vm.isDisabled,
'is-checked': _vm.model === _vm.label,
'is-focus': _vm.focus
}
}, [_c('span', {
staticClass: "el-radio__inner"
}), _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.model),
expression: "model"
}],
staticClass: "el-radio__original",
attrs: {
"type": "radio",
"name": _vm.name,
"disabled": _vm.isDisabled
},
domProps: {
"value": _vm.label,
"checked": _vm._q(_vm.model, _vm.label)
},
on: {
"focus": function($event) {
_vm.focus = true
},
"blur": function($event) {
_vm.focus = false
},
"__c": function($event) {
_vm.model = _vm.label
}
}
})]), _c('span', {
staticClass: "el-radio__label"
}, [_vm._t("default"), (!_vm.$slots.default) ? [_vm._v(_vm._s(_vm.label))] : _vm._e()], 2)])
},staticRenderFns: []}
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _radioGroup = __webpack_require__(77);
var _radioGroup2 = _interopRequireDefault(_radioGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_radioGroup2.default.install = function (Vue) {
Vue.component(_radioGroup2.default.name, _radioGroup2.default);
};
exports.default = _radioGroup2.default;
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(78),
/* template */
__webpack_require__(79),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 78 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElRadioGroup',
componentName: 'ElRadioGroup',
mixins: [_emitter2.default],
props: {
value: {},
size: String,
fill: String,
textColor: String,
disabled: Boolean
},
watch: {
value: function value(_value) {
this.$emit('change', _value);
this.dispatch('ElFormItem', 'el.form.change', [this.value]);
}
}
}; //
//
//
//
//
/***/ },
/* 79 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-radio-group"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _radioButton = __webpack_require__(81);
var _radioButton2 = _interopRequireDefault(_radioButton);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_radioButton2.default.install = function (Vue) {
Vue.component(_radioButton2.default.name, _radioButton2.default);
};
exports.default = _radioButton2.default;
/***/ },
/* 81 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(82),
/* template */
__webpack_require__(83),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 82 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElRadioButton',
props: {
label: {},
disabled: Boolean,
name: String
},
computed: {
value: {
get: function get() {
return this._radioGroup.value;
},
set: function set(value) {
this._radioGroup.$emit('input', value);
}
},
_radioGroup: function _radioGroup() {
var parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== 'ElRadioGroup') {
parent = parent.$parent;
} else {
return parent;
}
}
return false;
},
activeStyle: function activeStyle() {
return {
backgroundColor: this._radioGroup.fill || '',
borderColor: this._radioGroup.fill || '',
boxShadow: this._radioGroup.fill ? '-1px 0 0 0 ' + this._radioGroup.fill : '',
color: this._radioGroup.textColor || ''
};
},
size: function size() {
return this._radioGroup.size;
},
isDisabled: function isDisabled() {
return this.disabled || this._radioGroup.disabled;
}
}
};
/***/ },
/* 83 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('label', {
staticClass: "el-radio-button",
class: [
_vm.size ? 'el-radio-button--' + _vm.size : '', {
'is-active': _vm.value === _vm.label
}, {
'is-disabled': _vm.isDisabled
}
]
}, [_c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.value),
expression: "value"
}],
staticClass: "el-radio-button__orig-radio",
attrs: {
"type": "radio",
"name": _vm.name,
"disabled": _vm.isDisabled
},
domProps: {
"value": _vm.label,
"checked": _vm._q(_vm.value, _vm.label)
},
on: {
"__c": function($event) {
_vm.value = _vm.label
}
}
}), _c('span', {
staticClass: "el-radio-button__inner",
style: (_vm.value === _vm.label ? _vm.activeStyle : null)
}, [_vm._t("default"), (!_vm.$slots.default) ? [_vm._v(_vm._s(_vm.label))] : _vm._e()], 2)])
},staticRenderFns: []}
/***/ },
/* 84 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkbox = __webpack_require__(85);
var _checkbox2 = _interopRequireDefault(_checkbox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_checkbox2.default.install = function (Vue) {
Vue.component(_checkbox2.default.name, _checkbox2.default);
};
exports.default = _checkbox2.default;
/***/ },
/* 85 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(86),
/* template */
__webpack_require__(87),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 86 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElCheckbox',
mixins: [_emitter2.default],
componentName: 'ElCheckbox',
data: function data() {
return {
selfModel: false,
focus: false
};
},
computed: {
model: {
get: function get() {
return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
},
set: function set(val) {
if (this.isGroup) {
var isLimitExceeded = false;
this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (isLimitExceeded = true);
this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (isLimitExceeded = true);
isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
} else {
this.$emit('input', val);
this.selfModel = val;
}
}
},
isChecked: function isChecked() {
if ({}.toString.call(this.model) === '[object Boolean]') {
return this.model;
} else if (Array.isArray(this.model)) {
return this.model.indexOf(this.label) > -1;
} else if (this.model !== null && this.model !== undefined) {
return this.model === this.trueLabel;
}
},
isGroup: function isGroup() {
var parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== 'ElCheckboxGroup') {
parent = parent.$parent;
} else {
this._checkboxGroup = parent;
return true;
}
}
return false;
},
store: function store() {
return this._checkboxGroup ? this._checkboxGroup.value : this.value;
}
},
props: {
value: {},
label: {},
indeterminate: Boolean,
disabled: Boolean,
checked: Boolean,
name: String,
trueLabel: [String, Number],
falseLabel: [String, Number]
},
methods: {
addToStore: function addToStore() {
if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
this.model.push(this.label);
} else {
this.model = this.trueLabel || true;
}
},
handleChange: function handleChange(ev) {
var _this = this;
this.$emit('change', ev);
if (this.isGroup) {
this.$nextTick(function (_) {
_this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
});
}
}
},
created: function created() {
this.checked && this.addToStore();
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 87 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('label', {
staticClass: "el-checkbox"
}, [_c('span', {
staticClass: "el-checkbox__input",
class: {
'is-disabled': _vm.disabled,
'is-checked': _vm.isChecked,
'is-indeterminate': _vm.indeterminate,
'is-focus': _vm.focus
}
}, [_c('span', {
staticClass: "el-checkbox__inner"
}), (_vm.trueLabel || _vm.falseLabel) ? _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.model),
expression: "model"
}],
staticClass: "el-checkbox__original",
attrs: {
"type": "checkbox",
"name": _vm.name,
"disabled": _vm.disabled,
"true-value": _vm.trueLabel,
"false-value": _vm.falseLabel
},
domProps: {
"checked": Array.isArray(_vm.model) ? _vm._i(_vm.model, null) > -1 : _vm._q(_vm.model, _vm.trueLabel)
},
on: {
"change": _vm.handleChange,
"focus": function($event) {
_vm.focus = true
},
"blur": function($event) {
_vm.focus = false
},
"__c": function($event) {
var $$a = _vm.model,
$$el = $event.target,
$$c = $$el.checked ? (_vm.trueLabel) : (_vm.falseLabel);
if (Array.isArray($$a)) {
var $$v = null,
$$i = _vm._i($$a, $$v);
if ($$c) {
$$i < 0 && (_vm.model = $$a.concat($$v))
} else {
$$i > -1 && (_vm.model = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
}
} else {
_vm.model = $$c
}
}
}
}) : _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.model),
expression: "model"
}],
staticClass: "el-checkbox__original",
attrs: {
"type": "checkbox",
"disabled": _vm.disabled,
"name": _vm.name
},
domProps: {
"value": _vm.label,
"checked": Array.isArray(_vm.model) ? _vm._i(_vm.model, _vm.label) > -1 : (_vm.model)
},
on: {
"change": _vm.handleChange,
"focus": function($event) {
_vm.focus = true
},
"blur": function($event) {
_vm.focus = false
},
"__c": function($event) {
var $$a = _vm.model,
$$el = $event.target,
$$c = $$el.checked ? (true) : (false);
if (Array.isArray($$a)) {
var $$v = _vm.label,
$$i = _vm._i($$a, $$v);
if ($$c) {
$$i < 0 && (_vm.model = $$a.concat($$v))
} else {
$$i > -1 && (_vm.model = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
}
} else {
_vm.model = $$c
}
}
}
})]), (_vm.$slots.default || _vm.label) ? _c('span', {
staticClass: "el-checkbox__label"
}, [_vm._t("default"), (!_vm.$slots.default) ? [_vm._v(_vm._s(_vm.label))] : _vm._e()], 2) : _vm._e()])
},staticRenderFns: []}
/***/ },
/* 88 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkboxButton = __webpack_require__(89);
var _checkboxButton2 = _interopRequireDefault(_checkboxButton);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_checkboxButton2.default.install = function (Vue) {
Vue.component(_checkboxButton2.default.name, _checkboxButton2.default);
};
exports.default = _checkboxButton2.default;
/***/ },
/* 89 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(90),
/* template */
__webpack_require__(91),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 90 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElCheckboxButton',
mixins: [_emitter2.default],
data: function data() {
return {
selfModel: false,
focus: false
};
},
props: {
value: {},
label: {},
disabled: Boolean,
checked: Boolean,
name: String,
trueLabel: [String, Number],
falseLabel: [String, Number]
},
computed: {
model: {
get: function get() {
return this._checkboxGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
},
set: function set(val) {
if (this._checkboxGroup) {
var isLimitExceeded = false;
this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (isLimitExceeded = true);
this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (isLimitExceeded = true);
isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
} else if (this.value !== undefined) {
this.$emit('input', val);
} else {
this.selfModel = val;
}
}
},
isChecked: function isChecked() {
if ({}.toString.call(this.model) === '[object Boolean]') {
return this.model;
} else if (Array.isArray(this.model)) {
return this.model.indexOf(this.label) > -1;
} else if (this.model !== null && this.model !== undefined) {
return this.model === this.trueLabel;
}
},
_checkboxGroup: function _checkboxGroup() {
var parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== 'ElCheckboxGroup') {
parent = parent.$parent;
} else {
return parent;
}
}
return false;
},
store: function store() {
return this._checkboxGroup ? this._checkboxGroup.value : this.value;
},
activeStyle: function activeStyle() {
return {
backgroundColor: this._checkboxGroup.fill || '',
borderColor: this._checkboxGroup.fill || '',
color: this._checkboxGroup.textColor || '',
'box-shadow': '-1px 0 0 0 ' + this._checkboxGroup.fill
};
},
size: function size() {
return this._checkboxGroup.size;
}
},
methods: {
addToStore: function addToStore() {
if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
this.model.push(this.label);
} else {
this.model = this.trueLabel || true;
}
},
handleChange: function handleChange(ev) {
var _this = this;
this.$emit('change', ev);
if (this._checkboxGroup) {
this.$nextTick(function (_) {
_this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
});
}
}
},
created: function created() {
this.checked && this.addToStore();
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 91 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('label', {
staticClass: "el-checkbox-button",
class: [
_vm.size ? 'el-checkbox-button--' + _vm.size : '', {
'is-disabled': _vm.disabled
}, {
'is-checked': _vm.isChecked
}, {
'is-focus': _vm.focus
} ]
}, [(_vm.trueLabel || _vm.falseLabel) ? _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.model),
expression: "model"
}],
staticClass: "el-checkbox-button__original",
attrs: {
"type": "checkbox",
"name": _vm.name,
"disabled": _vm.disabled,
"true-value": _vm.trueLabel,
"false-value": _vm.falseLabel
},
domProps: {
"checked": Array.isArray(_vm.model) ? _vm._i(_vm.model, null) > -1 : _vm._q(_vm.model, _vm.trueLabel)
},
on: {
"change": _vm.handleChange,
"focus": function($event) {
_vm.focus = true
},
"blur": function($event) {
_vm.focus = false
},
"__c": function($event) {
var $$a = _vm.model,
$$el = $event.target,
$$c = $$el.checked ? (_vm.trueLabel) : (_vm.falseLabel);
if (Array.isArray($$a)) {
var $$v = null,
$$i = _vm._i($$a, $$v);
if ($$c) {
$$i < 0 && (_vm.model = $$a.concat($$v))
} else {
$$i > -1 && (_vm.model = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
}
} else {
_vm.model = $$c
}
}
}
}) : _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.model),
expression: "model"
}],
staticClass: "el-checkbox-button__original",
attrs: {
"type": "checkbox",
"name": _vm.name,
"disabled": _vm.disabled
},
domProps: {
"value": _vm.label,
"checked": Array.isArray(_vm.model) ? _vm._i(_vm.model, _vm.label) > -1 : (_vm.model)
},
on: {
"change": _vm.handleChange,
"focus": function($event) {
_vm.focus = true
},
"blur": function($event) {
_vm.focus = false
},
"__c": function($event) {
var $$a = _vm.model,
$$el = $event.target,
$$c = $$el.checked ? (true) : (false);
if (Array.isArray($$a)) {
var $$v = _vm.label,
$$i = _vm._i($$a, $$v);
if ($$c) {
$$i < 0 && (_vm.model = $$a.concat($$v))
} else {
$$i > -1 && (_vm.model = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
}
} else {
_vm.model = $$c
}
}
}
}), (_vm.$slots.default || _vm.label) ? _c('span', {
staticClass: "el-checkbox-button__inner",
style: (_vm.isChecked ? _vm.activeStyle : null)
}, [_vm._t("default", [_vm._v(_vm._s(_vm.label))])], 2) : _vm._e()])
},staticRenderFns: []}
/***/ },
/* 92 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkboxGroup = __webpack_require__(93);
var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_checkboxGroup2.default.install = function (Vue) {
Vue.component(_checkboxGroup2.default.name, _checkboxGroup2.default);
};
exports.default = _checkboxGroup2.default;
/***/ },
/* 93 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(94),
/* template */
__webpack_require__(95),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 94 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElCheckboxGroup',
componentName: 'ElCheckboxGroup',
mixins: [_emitter2.default],
props: {
value: {},
min: Number,
max: Number,
size: String,
fill: String,
textColor: String
},
watch: {
value: function value(_value) {
this.dispatch('ElFormItem', 'el.form.change', [_value]);
}
}
};
/***/ },
/* 95 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-checkbox-group"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 96 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _component = __webpack_require__(97);
var _component2 = _interopRequireDefault(_component);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_component2.default.install = function (Vue) {
Vue.component(_component2.default.name, _component2.default);
};
exports.default = _component2.default;
/***/ },
/* 97 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(98),
/* template */
__webpack_require__(99),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 98 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElSwitch',
props: {
value: {
type: [Boolean, String, Number],
default: false
},
disabled: {
type: Boolean,
default: false
},
width: {
type: Number,
default: 0
},
onIconClass: {
type: String,
default: ''
},
offIconClass: {
type: String,
default: ''
},
onText: {
type: String,
default: 'ON'
},
offText: {
type: String,
default: 'OFF'
},
onColor: {
type: String,
default: ''
},
offColor: {
type: String,
default: ''
},
onValue: {
type: [Boolean, String, Number],
default: true
},
offValue: {
type: [Boolean, String, Number],
default: false
},
name: {
type: String,
default: ''
}
},
data: function data() {
return {
coreWidth: this.width
};
},
created: function created() {
if (!~[this.onValue, this.offValue].indexOf(this.value)) {
this.$emit('input', this.offValue);
}
},
computed: {
checked: function checked() {
return this.value === this.onValue;
},
hasText: function hasText() {
/* istanbul ignore next */
return this.onText || this.offText;
},
transform: function transform() {
return this.checked ? 'translate(' + (this.coreWidth - 20) + 'px, 2px)' : 'translate(2px, 2px)';
}
},
watch: {
checked: function checked() {
if (this.onColor || this.offColor) {
this.setBackgroundColor();
}
}
},
methods: {
handleChange: function handleChange(event) {
var _this = this;
this.$emit('change', !this.checked ? this.onValue : this.offValue);
this.$emit('input', !this.checked ? this.onValue : this.offValue);
this.$nextTick(function () {
// set input's checked property
// in case parent refuses to change component's value
_this.$refs.input.checked = _this.checked;
});
},
setBackgroundColor: function setBackgroundColor() {
var newColor = this.checked ? this.onColor : this.offColor;
this.$refs.core.style.borderColor = newColor;
this.$refs.core.style.backgroundColor = newColor;
}
},
mounted: function mounted() {
/* istanbul ignore if */
if (this.width === 0) {
this.coreWidth = this.hasText ? 58 : 46;
}
if (this.onColor || this.offColor) {
this.setBackgroundColor();
}
this.$refs.input.checked = this.checked;
}
};
/***/ },
/* 99 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('label', {
staticClass: "el-switch",
class: {
'is-disabled': _vm.disabled, 'el-switch--wide': _vm.hasText, 'is-checked': _vm.checked
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.disabled),
expression: "disabled"
}],
staticClass: "el-switch__mask"
}), _c('input', {
ref: "input",
staticClass: "el-switch__input",
attrs: {
"type": "checkbox",
"name": _vm.name,
"true-value": _vm.onValue,
"false-value": _vm.offValue,
"disabled": _vm.disabled
},
on: {
"change": _vm.handleChange
}
}), _c('span', {
ref: "core",
staticClass: "el-switch__core",
style: ({
'width': _vm.coreWidth + 'px'
})
}, [_c('span', {
staticClass: "el-switch__button",
style: ({
transform: _vm.transform
})
})]), _c('transition', {
attrs: {
"name": "label-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.checked),
expression: "checked"
}],
staticClass: "el-switch__label el-switch__label--left",
style: ({
'width': _vm.coreWidth + 'px'
})
}, [(_vm.onIconClass) ? _c('i', {
class: [_vm.onIconClass]
}) : _vm._e(), (!_vm.onIconClass && _vm.onText) ? _c('span', [_vm._v(_vm._s(_vm.onText))]) : _vm._e()])]), _c('transition', {
attrs: {
"name": "label-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (!_vm.checked),
expression: "!checked"
}],
staticClass: "el-switch__label el-switch__label--right",
style: ({
'width': _vm.coreWidth + 'px'
})
}, [(_vm.offIconClass) ? _c('i', {
class: [_vm.offIconClass]
}) : _vm._e(), (!_vm.offIconClass && _vm.offText) ? _c('span', [_vm._v(_vm._s(_vm.offText))]) : _vm._e()])])], 1)
},staticRenderFns: []}
/***/ },
/* 100 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _select = __webpack_require__(101);
var _select2 = _interopRequireDefault(_select);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_select2.default.install = function (Vue) {
Vue.component(_select2.default.name, _select2.default);
};
exports.default = _select2.default;
/***/ },
/* 101 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(102),
/* template */
__webpack_require__(114),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 102 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
var _selectDropdown = __webpack_require__(103);
var _selectDropdown2 = _interopRequireDefault(_selectDropdown);
var _option = __webpack_require__(106);
var _option2 = _interopRequireDefault(_option);
var _tag = __webpack_require__(110);
var _tag2 = _interopRequireDefault(_tag);
var _scrollbar = __webpack_require__(25);
var _scrollbar2 = _interopRequireDefault(_scrollbar);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
var _clickoutside = __webpack_require__(21);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _dom = __webpack_require__(45);
var _resizeEvent = __webpack_require__(111);
var _locale3 = __webpack_require__(112);
var _scrollIntoView = __webpack_require__(113);
var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
var _util = __webpack_require__(108);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var sizeMap = {
'large': 42,
'small': 30,
'mini': 22
};
exports.default = {
mixins: [_emitter2.default, _locale2.default],
name: 'ElSelect',
componentName: 'ElSelect',
computed: {
iconClass: function iconClass() {
var criteria = this.clearable && !this.disabled && this.inputHovering && !this.multiple && this.value !== undefined && this.value !== '';
return criteria ? 'circle-close is-show-close' : this.remote && this.filterable ? '' : 'caret-top';
},
debounce: function debounce() {
return this.remote ? 300 : 0;
},
emptyText: function emptyText() {
if (this.loading) {
return this.loadingText || this.t('el.select.loading');
} else {
if (this.remote && this.query === '' && this.options.length === 0) return false;
if (this.filterable && this.options.length > 0 && this.filteredOptionsCount === 0) {
return this.noMatchText || this.t('el.select.noMatch');
}
if (this.options.length === 0) {
return this.noDataText || this.t('el.select.noData');
}
}
return null;
},
showNewOption: function showNewOption() {
var _this = this;
var hasExistingOption = this.options.filter(function (option) {
return !option.created;
}).some(function (option) {
return option.currentLabel === _this.query;
});
return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
}
},
components: {
ElInput: _input2.default,
ElSelectMenu: _selectDropdown2.default,
ElOption: _option2.default,
ElTag: _tag2.default,
ElScrollbar: _scrollbar2.default
},
directives: { Clickoutside: _clickoutside2.default },
props: {
name: String,
value: {
required: true
},
size: String,
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: String,
remote: Boolean,
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: Function,
filterMethod: Function,
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: {
type: String,
default: function _default() {
return (0, _locale3.t)('el.select.placeholder');
}
},
defaultFirstOption: Boolean,
valueKey: {
type: String,
default: 'value'
}
},
data: function data() {
return {
options: [],
cachedOptions: [],
createdLabel: null,
createdSelected: false,
selected: this.multiple ? [] : {},
isSelect: true,
inputLength: 20,
inputWidth: 0,
cachedPlaceHolder: '',
optionsCount: 0,
filteredOptionsCount: 0,
visible: false,
selectedLabel: '',
hoverIndex: -1,
query: '',
optionsAllDisabled: false,
inputHovering: false,
currentPlaceholder: ''
};
},
watch: {
placeholder: function placeholder(val) {
this.cachedPlaceHolder = this.currentPlaceholder = val;
},
value: function value(val) {
if (this.multiple) {
this.resetInputHeight();
if (val.length > 0 || this.$refs.input && this.query !== '') {
this.currentPlaceholder = '';
} else {
this.currentPlaceholder = this.cachedPlaceHolder;
}
}
this.setSelected();
if (this.filterable && !this.multiple) {
this.inputLength = 20;
}
this.$emit('change', val);
this.dispatch('ElFormItem', 'el.form.change', val);
},
query: function query(val) {
var _this2 = this;
this.$nextTick(function () {
if (_this2.visible) _this2.broadcast('ElSelectDropdown', 'updatePopper');
});
this.hoverIndex = -1;
if (this.multiple && this.filterable) {
this.inputLength = this.$refs.input.value.length * 15 + 20;
this.managePlaceholder();
this.resetInputHeight();
}
if (this.remote && typeof this.remoteMethod === 'function') {
this.hoverIndex = -1;
this.remoteMethod(val);
this.broadcast('ElOption', 'resetIndex');
} else if (typeof this.filterMethod === 'function') {
this.filterMethod(val);
this.broadcast('ElOptionGroup', 'queryChange');
} else {
this.filteredOptionsCount = this.optionsCount;
this.broadcast('ElOption', 'queryChange', val);
this.broadcast('ElOptionGroup', 'queryChange');
}
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
this.checkDefaultFirstOption();
}
},
visible: function visible(val) {
var _this3 = this;
if (!val) {
this.$refs.reference.$el.querySelector('input').blur();
this.handleIconHide();
this.broadcast('ElSelectDropdown', 'destroyPopper');
if (this.$refs.input) {
this.$refs.input.blur();
}
this.query = '';
this.selectedLabel = '';
this.inputLength = 20;
this.resetHoverIndex();
this.$nextTick(function () {
if (_this3.$refs.input && _this3.$refs.input.value === '' && _this3.selected.length === 0) {
_this3.currentPlaceholder = _this3.cachedPlaceHolder;
}
});
if (!this.multiple) {
if (this.selected) {
if (this.filterable && this.allowCreate && this.createdSelected && this.createdOption) {
this.selectedLabel = this.createdLabel;
} else {
this.selectedLabel = this.selected.currentLabel;
}
if (this.filterable) this.query = this.selectedLabel;
}
}
} else {
this.handleIconShow();
this.broadcast('ElSelectDropdown', 'updatePopper');
if (this.filterable) {
this.query = this.selectedLabel;
if (this.multiple) {
this.$refs.input.focus();
} else {
if (!this.remote) {
this.broadcast('ElOption', 'queryChange', '');
this.broadcast('ElOptionGroup', 'queryChange');
}
this.broadcast('ElInput', 'inputSelect');
}
}
}
this.$emit('visible-change', val);
},
options: function options(val) {
if (this.$isServer) return;
this.optionsAllDisabled = val.length === val.filter(function (item) {
return item.disabled === true;
}).length;
if (this.multiple) {
this.resetInputHeight();
}
var inputs = this.$el.querySelectorAll('input');
if ([].indexOf.call(inputs, document.activeElement) === -1) {
this.setSelected();
}
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
this.checkDefaultFirstOption();
}
}
},
methods: {
handleIconHide: function handleIconHide() {
var icon = this.$el.querySelector('.el-input__icon');
if (icon) {
(0, _dom.removeClass)(icon, 'is-reverse');
}
},
handleIconShow: function handleIconShow() {
var icon = this.$el.querySelector('.el-input__icon');
if (icon && !(0, _dom.hasClass)(icon, 'el-icon-circle-close')) {
(0, _dom.addClass)(icon, 'is-reverse');
}
},
scrollToOption: function scrollToOption() {
var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'selected';
if (this.$refs.popper) {
var menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
(0, _scrollIntoView2.default)(menu, menu.getElementsByClassName(className)[0]);
}
},
handleMenuEnter: function handleMenuEnter() {
var _this4 = this;
this.$nextTick(function () {
return _this4.scrollToOption();
});
},
getOption: function getOption(value) {
var option = void 0;
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
var isObject = type !== 'string' && type !== 'number' && type !== 'boolean';
for (var i = this.cachedOptions.length - 1; i >= 0; i--) {
var cachedOption = this.cachedOptions[i];
var isEqual = isObject ? (0, _util.getValueByPath)(cachedOption.value, this.valueKey) === (0, _util.getValueByPath)(value, this.valueKey) : cachedOption.value === value;
if (isEqual) {
option = cachedOption;
break;
}
}
if (option) return option;
var label = !isObject ? value : '';
var newOption = {
value: value,
currentLabel: label
};
if (this.multiple) {
newOption.hitState = false;
}
return newOption;
},
setSelected: function setSelected() {
var _this5 = this;
if (!this.multiple) {
var option = this.getOption(this.value);
if (option.created) {
this.createdLabel = option.currentLabel;
this.createdSelected = true;
} else {
this.createdSelected = false;
}
this.selectedLabel = option.currentLabel;
this.selected = option;
if (this.filterable) this.query = this.selectedLabel;
return;
}
var result = [];
if (Array.isArray(this.value)) {
this.value.forEach(function (value) {
result.push(_this5.getOption(value));
});
}
this.selected = result;
this.$nextTick(function () {
_this5.resetInputHeight();
});
},
handleFocus: function handleFocus() {
this.visible = true;
},
handleIconClick: function handleIconClick(event) {
if (this.iconClass.indexOf('circle-close') > -1) {
this.deleteSelected(event);
} else {
this.toggleMenu();
}
},
handleMouseDown: function handleMouseDown(event) {
if (event.target.tagName !== 'INPUT') return;
if (this.visible) {
this.handleClose();
event.preventDefault();
}
},
doDestroy: function doDestroy() {
this.$refs.popper && this.$refs.popper.doDestroy();
this.dropdownUl = null;
},
handleClose: function handleClose() {
this.visible = false;
},
toggleLastOptionHitState: function toggleLastOptionHitState(hit) {
if (!Array.isArray(this.selected)) return;
var option = this.selected[this.selected.length - 1];
if (!option) return;
if (hit === true || hit === false) {
option.hitState = hit;
return hit;
}
option.hitState = !option.hitState;
return option.hitState;
},
deletePrevTag: function deletePrevTag(e) {
if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
var value = this.value.slice();
value.pop();
this.$emit('input', value);
}
},
managePlaceholder: function managePlaceholder() {
if (this.currentPlaceholder !== '') {
this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
}
},
resetInputState: function resetInputState(e) {
if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
this.inputLength = this.$refs.input.value.length * 15 + 20;
this.resetInputHeight();
},
resetInputHeight: function resetInputHeight() {
var _this6 = this;
this.$nextTick(function () {
if (!_this6.$refs.reference) return;
var inputChildNodes = _this6.$refs.reference.$el.childNodes;
var input = [].filter.call(inputChildNodes, function (item) {
return item.tagName === 'INPUT';
})[0];
input.style.height = Math.max(_this6.$refs.tags.clientHeight + 6, sizeMap[_this6.size] || 36) + 'px';
if (_this6.visible && _this6.emptyText !== false) {
_this6.broadcast('ElSelectDropdown', 'updatePopper');
}
});
},
resetHoverIndex: function resetHoverIndex() {
var _this7 = this;
setTimeout(function () {
if (!_this7.multiple) {
_this7.hoverIndex = _this7.options.indexOf(_this7.selected);
} else {
if (_this7.selected.length > 0) {
_this7.hoverIndex = Math.min.apply(null, _this7.selected.map(function (item) {
return _this7.options.indexOf(item);
}));
} else {
_this7.hoverIndex = -1;
}
}
}, 300);
},
handleOptionSelect: function handleOptionSelect(option) {
var _this8 = this;
if (this.multiple) {
var value = this.value.slice();
var optionIndex = this.getValueIndex(value, option.value);
if (optionIndex > -1) {
value.splice(optionIndex, 1);
} else if (this.multipleLimit <= 0 || value.length < this.multipleLimit) {
value.push(option.value);
}
this.$emit('input', value);
if (option.created) {
this.query = '';
this.inputLength = 20;
}
if (this.filterable) this.$refs.input.focus();
} else {
this.$emit('input', option.value);
this.visible = false;
}
this.$nextTick(function () {
return _this8.scrollToOption();
});
},
getValueIndex: function getValueIndex() {
var _this9 = this;
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var value = arguments[1];
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
var isObject = type !== 'string' && type !== 'number' && type !== 'boolean';
if (!isObject) {
return arr.indexOf(value);
} else {
var _ret = function () {
var valueKey = _this9.valueKey;
var index = -1;
arr.some(function (item, i) {
if ((0, _util.getValueByPath)(item, valueKey) === (0, _util.getValueByPath)(value, valueKey)) {
index = i;
return true;
}
return false;
});
return {
v: index
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
},
toggleMenu: function toggleMenu() {
if (this.filterable && this.query === '' && this.visible) {
return;
}
if (!this.disabled) {
this.visible = !this.visible;
}
},
navigateOptions: function navigateOptions(direction) {
var _this10 = this;
if (!this.visible) {
this.visible = true;
return;
}
if (this.options.length === 0 || this.filteredOptionsCount === 0) return;
this.optionsAllDisabled = this.options.length === this.options.filter(function (item) {
return item.disabled === true;
}).length;
if (!this.optionsAllDisabled) {
if (direction === 'next') {
this.hoverIndex++;
if (this.hoverIndex === this.options.length) {
this.hoverIndex = 0;
}
if (this.options[this.hoverIndex].disabled === true || this.options[this.hoverIndex].groupDisabled === true || !this.options[this.hoverIndex].visible) {
this.navigateOptions('next');
}
}
if (direction === 'prev') {
this.hoverIndex--;
if (this.hoverIndex < 0) {
this.hoverIndex = this.options.length - 1;
}
if (this.options[this.hoverIndex].disabled === true || this.options[this.hoverIndex].groupDisabled === true || !this.options[this.hoverIndex].visible) {
this.navigateOptions('prev');
}
}
}
this.$nextTick(function () {
return _this10.scrollToOption('hover');
});
},
selectOption: function selectOption() {
if (this.options[this.hoverIndex]) {
this.handleOptionSelect(this.options[this.hoverIndex]);
}
},
deleteSelected: function deleteSelected(event) {
event.stopPropagation();
this.$emit('input', '');
this.visible = false;
this.$emit('clear');
},
deleteTag: function deleteTag(event, tag) {
var index = this.selected.indexOf(tag);
if (index > -1 && !this.disabled) {
var value = this.value.slice();
value.splice(index, 1);
this.$emit('input', value);
this.$emit('remove-tag', tag);
}
event.stopPropagation();
},
onInputChange: function onInputChange() {
if (this.filterable) {
this.query = this.selectedLabel;
}
},
onOptionDestroy: function onOptionDestroy(option) {
this.optionsCount--;
this.filteredOptionsCount--;
var index = this.options.indexOf(option);
if (index > -1) {
this.options.splice(index, 1);
}
this.broadcast('ElOption', 'resetIndex');
},
resetInputWidth: function resetInputWidth() {
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
},
handleResize: function handleResize() {
this.resetInputWidth();
if (this.multiple) this.resetInputHeight();
},
checkDefaultFirstOption: function checkDefaultFirstOption() {
this.hoverIndex = -1;
for (var i = 0; i !== this.options.length; ++i) {
var option = this.options[i];
if (this.query) {
// pick first options that passes the filter
if (!option.disabled && !option.groupDisabled && option.visible) {
this.hoverIndex = i;
break;
}
} else {
// pick currently selected option
if (option.itemSelected) {
this.hoverIndex = i;
break;
}
}
}
},
getValueKey: function getValueKey(item) {
var type = _typeof(item.value);
if (type === 'number' || type === 'string') {
return item.value;
} else {
return (0, _util.getValueByPath)(item.value, this.valueKey);
}
}
},
created: function created() {
var _this11 = this;
this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder;
if (this.multiple && !Array.isArray(this.value)) {
this.$emit('input', []);
}
if (!this.multiple && Array.isArray(this.value)) {
this.$emit('input', '');
}
this.setSelected();
this.debouncedOnInputChange = (0, _debounce2.default)(this.debounce, function () {
_this11.onInputChange();
});
this.$on('handleOptionClick', this.handleOptionSelect);
this.$on('onOptionDestroy', this.onOptionDestroy);
this.$on('setSelected', this.setSelected);
},
mounted: function mounted() {
var _this12 = this;
if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
this.currentPlaceholder = '';
}
(0, _resizeEvent.addResizeListener)(this.$el, this.handleResize);
if (this.remote && this.multiple) {
this.resetInputHeight();
}
this.$nextTick(function () {
if (_this12.$refs.reference && _this12.$refs.reference.$el) {
_this12.inputWidth = _this12.$refs.reference.$el.getBoundingClientRect().width;
}
});
},
beforeDestroy: function beforeDestroy() {
if (this.$el && this.handleResize) (0, _resizeEvent.removeResizeListener)(this.$el, this.handleResize);
}
};
/***/ },
/* 103 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(104),
/* template */
__webpack_require__(105),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 104 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElSelectDropdown',
componentName: 'ElSelectDropdown',
mixins: [_vuePopper2.default],
props: {
placement: {
default: 'bottom-start'
},
boundariesPadding: {
default: 0
},
popperOptions: {
default: function _default() {
return {
forceAbsolute: true,
gpuAcceleration: false
};
}
}
},
data: function data() {
return {
minWidth: ''
};
},
computed: {
popperClass: function popperClass() {
return this.$parent.popperClass;
}
},
watch: {
'$parent.inputWidth': function $parentInputWidth() {
this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
}
},
mounted: function mounted() {
var _this = this;
this.referenceElm = this.$parent.$refs.reference.$el;
this.$parent.popperElm = this.popperElm = this.$el;
this.$on('updatePopper', function () {
if (_this.$parent.visible) _this.updatePopper();
});
this.$on('destroyPopper', this.destroyPopper);
}
}; //
//
//
//
//
//
//
//
//
/***/ },
/* 105 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-select-dropdown",
class: [{
'is-multiple': _vm.$parent.multiple
}, _vm.popperClass],
style: ({
minWidth: _vm.minWidth
})
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 106 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(107),
/* template */
__webpack_require__(109),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 107 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _util = __webpack_require__(108);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_emitter2.default],
name: 'ElOption',
componentName: 'ElOption',
props: {
value: {
required: true
},
label: [String, Number],
created: Boolean,
disabled: {
type: Boolean,
default: false
}
},
data: function data() {
return {
index: -1,
groupDisabled: false,
visible: true,
hitState: false
};
},
computed: {
isObject: function isObject() {
var type = _typeof(this.value);
return type !== 'string' && type !== 'number' && type !== 'boolean';
},
currentLabel: function currentLabel() {
return this.label || (this.isObject ? '' : this.value);
},
currentValue: function currentValue() {
return this.value || this.label || '';
},
parent: function parent() {
var result = this.$parent;
while (!result.isSelect) {
result = result.$parent;
}
return result;
},
itemSelected: function itemSelected() {
if (!this.parent.multiple) {
return this.isEqual(this.value, this.parent.value);
} else {
return this.contains(this.parent.value, this.value);
}
},
limitReached: function limitReached() {
if (this.parent.multiple) {
return !this.itemSelected && this.parent.value.length >= this.parent.multipleLimit && this.parent.multipleLimit > 0;
} else {
return false;
}
}
},
watch: {
currentLabel: function currentLabel() {
if (!this.created && !this.parent.remote) this.dispatch('ElSelect', 'setSelected');
},
value: function value() {
if (!this.created && !this.parent.remote) this.dispatch('ElSelect', 'setSelected');
}
},
methods: {
isEqual: function isEqual(a, b) {
if (!this.isObject) {
return a === b;
} else {
var valueKey = this.parent.valueKey;
return (0, _util.getValueByPath)(a, valueKey) === (0, _util.getValueByPath)(b, valueKey);
}
},
contains: function contains() {
var _this = this;
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var target = arguments[1];
if (!this.isObject) {
return arr.indexOf(target) > -1;
} else {
var _ret = function () {
var valueKey = _this.parent.valueKey;
return {
v: arr.some(function (item) {
return (0, _util.getValueByPath)(item, valueKey) === (0, _util.getValueByPath)(target, valueKey);
})
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
},
handleGroupDisabled: function handleGroupDisabled(val) {
this.groupDisabled = val;
},
hoverItem: function hoverItem() {
if (!this.disabled && !this.groupDisabled) {
this.parent.hoverIndex = this.parent.options.indexOf(this);
}
},
selectOptionClick: function selectOptionClick() {
if (this.disabled !== true && this.groupDisabled !== true) {
this.dispatch('ElSelect', 'handleOptionClick', this);
}
},
queryChange: function queryChange(query) {
// query 里如果有正则中的特殊字符,需要先将这些字符转义
var parsedQuery = String(query).replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1');
this.visible = new RegExp(parsedQuery, 'i').test(this.currentLabel) || this.created;
if (!this.visible) {
this.parent.filteredOptionsCount--;
}
},
resetIndex: function resetIndex() {
var _this2 = this;
this.$nextTick(function () {
_this2.index = _this2.parent.options.indexOf(_this2);
});
}
},
created: function created() {
this.parent.options.push(this);
this.parent.cachedOptions.push(this);
this.parent.optionsCount++;
this.parent.filteredOptionsCount++;
this.index = this.parent.options.indexOf(this);
this.$on('queryChange', this.queryChange);
this.$on('handleGroupDisabled', this.handleGroupDisabled);
this.$on('resetIndex', this.resetIndex);
},
beforeDestroy: function beforeDestroy() {
this.dispatch('ElSelect', 'onOptionDestroy', this);
}
};
/***/ },
/* 108 */
/***/ function(module, exports) {
module.exports = __webpack_require__(6);
/***/ },
/* 109 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('li', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-select-dropdown__item",
class: {
'selected': _vm.itemSelected,
'is-disabled': _vm.disabled || _vm.groupDisabled || _vm.limitReached,
'hover': _vm.parent.hoverIndex === _vm.index
},
on: {
"mouseenter": _vm.hoverItem,
"click": function($event) {
$event.stopPropagation();
_vm.selectOptionClick($event)
}
}
}, [_vm._t("default", [_c('span', [_vm._v(_vm._s(_vm.currentLabel))])])], 2)
},staticRenderFns: []}
/***/ },
/* 110 */
/***/ function(module, exports) {
module.exports = __webpack_require__(24);
/***/ },
/* 111 */
/***/ function(module, exports) {
module.exports = __webpack_require__(14);
/***/ },
/* 112 */
/***/ function(module, exports) {
module.exports = __webpack_require__(15);
/***/ },
/* 113 */
/***/ function(module, exports) {
module.exports = __webpack_require__(21);
/***/ },
/* 114 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "clickoutside",
rawName: "v-clickoutside",
value: (_vm.handleClose),
expression: "handleClose"
}],
staticClass: "el-select"
}, [(_vm.multiple) ? _c('div', {
ref: "tags",
staticClass: "el-select__tags",
style: ({
'max-width': _vm.inputWidth - 32 + 'px'
}),
on: {
"click": function($event) {
$event.stopPropagation();
_vm.toggleMenu($event)
}
}
}, [_c('transition-group', {
on: {
"after-leave": _vm.resetInputHeight
}
}, _vm._l((_vm.selected), function(item) {
return _c('el-tag', {
key: _vm.getValueKey(item),
attrs: {
"closable": "",
"hit": item.hitState,
"type": "primary",
"close-transition": ""
},
on: {
"close": function($event) {
_vm.deleteTag($event, item)
}
}
}, [_c('span', {
staticClass: "el-select__tags-text"
}, [_vm._v(_vm._s(item.currentLabel))])])
})), (_vm.filterable) ? _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.query),
expression: "query"
}],
ref: "input",
staticClass: "el-select__input",
class: ("is-" + _vm.size),
style: ({
width: _vm.inputLength + 'px',
'max-width': _vm.inputWidth - 42 + 'px'
}),
attrs: {
"type": "text",
"disabled": _vm.disabled,
"debounce": _vm.remote ? 300 : 0
},
domProps: {
"value": (_vm.query)
},
on: {
"focus": function($event) {
_vm.visible = true
},
"keyup": _vm.managePlaceholder,
"keydown": [_vm.resetInputState, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "down", 40)) { return null; }
$event.preventDefault();
_vm.navigateOptions('next')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "up", 38)) { return null; }
$event.preventDefault();
_vm.navigateOptions('prev')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "enter", 13)) { return null; }
$event.preventDefault();
_vm.selectOption($event)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "esc", 27)) { return null; }
$event.stopPropagation();
$event.preventDefault();
_vm.visible = false
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "delete", [8, 46])) { return null; }
_vm.deletePrevTag($event)
}],
"input": function($event) {
if ($event.target.composing) { return; }
_vm.query = $event.target.value
}
}
}) : _vm._e()], 1) : _vm._e(), _c('el-input', {
ref: "reference",
attrs: {
"type": "text",
"placeholder": _vm.currentPlaceholder,
"name": _vm.name,
"size": _vm.size,
"disabled": _vm.disabled,
"readonly": !_vm.filterable || _vm.multiple,
"validate-event": false,
"icon": _vm.iconClass
},
on: {
"focus": _vm.handleFocus,
"click": _vm.handleIconClick
},
nativeOn: {
"mousedown": function($event) {
_vm.handleMouseDown($event)
},
"keyup": function($event) {
_vm.debouncedOnInputChange($event)
},
"keydown": [function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "down", 40)) { return null; }
$event.preventDefault();
_vm.navigateOptions('next')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "up", 38)) { return null; }
$event.preventDefault();
_vm.navigateOptions('prev')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "enter", 13)) { return null; }
$event.preventDefault();
_vm.selectOption($event)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "esc", 27)) { return null; }
$event.stopPropagation();
$event.preventDefault();
_vm.visible = false
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "tab", 9)) { return null; }
_vm.visible = false
}],
"paste": function($event) {
_vm.debouncedOnInputChange($event)
},
"mouseenter": function($event) {
_vm.inputHovering = true
},
"mouseleave": function($event) {
_vm.inputHovering = false
}
},
model: {
value: (_vm.selectedLabel),
callback: function($$v) {
_vm.selectedLabel = $$v
},
expression: "selectedLabel"
}
}), _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"before-enter": _vm.handleMenuEnter,
"after-leave": _vm.doDestroy
}
}, [_c('el-select-menu', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible && _vm.emptyText !== false),
expression: "visible && emptyText !== false"
}],
ref: "popper"
}, [_c('el-scrollbar', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.options.length > 0 && !_vm.loading),
expression: "options.length > 0 && !loading"
}],
class: {
'is-empty': !_vm.allowCreate && _vm.filteredOptionsCount === 0
},
attrs: {
"tag": "ul",
"wrap-class": "el-select-dropdown__wrap",
"view-class": "el-select-dropdown__list"
}
}, [(_vm.showNewOption) ? _c('el-option', {
attrs: {
"value": _vm.query,
"created": ""
}
}) : _vm._e(), _vm._t("default")], 2), (_vm.emptyText && (_vm.allowCreate && _vm.options.length === 0 || !_vm.allowCreate)) ? _c('p', {
staticClass: "el-select-dropdown__empty"
}, [_vm._v(_vm._s(_vm.emptyText))]) : _vm._e()], 1)], 1)], 1)
},staticRenderFns: []}
/***/ },
/* 115 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _option = __webpack_require__(106);
var _option2 = _interopRequireDefault(_option);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_option2.default.install = function (Vue) {
Vue.component(_option2.default.name, _option2.default);
};
exports.default = _option2.default;
/***/ },
/* 116 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _optionGroup = __webpack_require__(117);
var _optionGroup2 = _interopRequireDefault(_optionGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_optionGroup2.default.install = function (Vue) {
Vue.component(_optionGroup2.default.name, _optionGroup2.default);
};
exports.default = _optionGroup2.default;
/***/ },
/* 117 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(118),
/* template */
__webpack_require__(119),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 118 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_emitter2.default],
name: 'ElOptionGroup',
componentName: 'ElOptionGroup',
props: {
label: String,
disabled: {
type: Boolean,
default: false
}
},
data: function data() {
return {
visible: true
};
},
watch: {
disabled: function disabled(val) {
this.broadcast('ElOption', 'handleGroupDisabled', val);
}
},
methods: {
queryChange: function queryChange() {
this.visible = this.$children && Array.isArray(this.$children) && this.$children.some(function (option) {
return option.visible === true;
});
}
},
created: function created() {
this.$on('queryChange', this.queryChange);
},
mounted: function mounted() {
if (this.disabled) {
this.broadcast('ElOption', 'handleGroupDisabled', this.disabled);
}
}
}; //
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 119 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('ul', {
staticClass: "el-select-group__wrap"
}, [_c('li', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-select-group__title"
}, [_vm._v(_vm._s(_vm.label))]), _c('li', [_c('ul', {
staticClass: "el-select-group"
}, [_vm._t("default")], 2)])])
},staticRenderFns: []}
/***/ },
/* 120 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _button = __webpack_require__(121);
var _button2 = _interopRequireDefault(_button);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_button2.default.install = function (Vue) {
Vue.component(_button2.default.name, _button2.default);
};
exports.default = _button2.default;
/***/ },
/* 121 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(122),
/* template */
__webpack_require__(123),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 122 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElButton',
props: {
type: {
type: String,
default: 'default'
},
size: String,
icon: {
type: String,
default: ''
},
nativeType: {
type: String,
default: 'button'
},
loading: Boolean,
disabled: Boolean,
plain: Boolean,
autofocus: Boolean
},
methods: {
handleClick: function handleClick(evt) {
this.$emit('click', evt);
}
}
};
/***/ },
/* 123 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('button', {
staticClass: "el-button",
class: [
_vm.type ? 'el-button--' + _vm.type : '',
_vm.size ? 'el-button--' + _vm.size : '', {
'is-disabled': _vm.disabled,
'is-loading': _vm.loading,
'is-plain': _vm.plain
}
],
attrs: {
"disabled": _vm.disabled,
"autofocus": _vm.autofocus,
"type": _vm.nativeType
},
on: {
"click": _vm.handleClick
}
}, [(_vm.loading) ? _c('i', {
staticClass: "el-icon-loading"
}) : _vm._e(), (_vm.icon && !_vm.loading) ? _c('i', {
class: 'el-icon-' + _vm.icon
}) : _vm._e(), (_vm.$slots.default) ? _c('span', [_vm._t("default")], 2) : _vm._e()])
},staticRenderFns: []}
/***/ },
/* 124 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _buttonGroup = __webpack_require__(125);
var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_buttonGroup2.default.install = function (Vue) {
Vue.component(_buttonGroup2.default.name, _buttonGroup2.default);
};
exports.default = _buttonGroup2.default;
/***/ },
/* 125 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(126),
/* template */
__webpack_require__(127),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 126 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
/**
* button
* @module components/basic/menu
* @desc 用于按钮组
* @param {string} label - 名称
*/
exports.default = {
name: 'ElButtonGroup'
};
/***/ },
/* 127 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-button-group"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 128 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _table = __webpack_require__(129);
var _table2 = _interopRequireDefault(_table);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_table2.default.install = function (Vue) {
Vue.component(_table2.default.name, _table2.default);
};
exports.default = _table2.default;
/***/ },
/* 129 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(130),
/* template */
__webpack_require__(146),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 130 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkbox = __webpack_require__(131);
var _checkbox2 = _interopRequireDefault(_checkbox);
var _throttle = __webpack_require__(132);
var _throttle2 = _interopRequireDefault(_throttle);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
var _resizeEvent = __webpack_require__(111);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _tableStore = __webpack_require__(133);
var _tableStore2 = _interopRequireDefault(_tableStore);
var _tableLayout = __webpack_require__(135);
var _tableLayout2 = _interopRequireDefault(_tableLayout);
var _tableBody = __webpack_require__(137);
var _tableBody2 = _interopRequireDefault(_tableBody);
var _tableHeader = __webpack_require__(139);
var _tableHeader2 = _interopRequireDefault(_tableHeader);
var _tableFooter = __webpack_require__(145);
var _tableFooter2 = _interopRequireDefault(_tableFooter);
var _util = __webpack_require__(134);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var tableIdSeed = 1; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElTable',
mixins: [_locale2.default],
props: {
data: {
type: Array,
default: function _default() {
return [];
}
},
width: [String, Number],
height: [String, Number],
maxHeight: [String, Number],
fit: {
type: Boolean,
default: true
},
stripe: Boolean,
border: Boolean,
rowKey: [String, Function],
context: {},
showHeader: {
type: Boolean,
default: true
},
showSummary: Boolean,
sumText: String,
summaryMethod: Function,
rowClassName: [String, Function],
rowStyle: [Object, Function],
highlightCurrentRow: Boolean,
currentRowKey: [String, Number],
emptyText: String,
expandRowKeys: Array,
defaultExpandAll: Boolean,
defaultSort: Object,
tooltipEffect: String
},
components: {
TableHeader: _tableHeader2.default,
TableFooter: _tableFooter2.default,
TableBody: _tableBody2.default,
ElCheckbox: _checkbox2.default
},
methods: {
setCurrentRow: function setCurrentRow(row) {
this.store.commit('setCurrentRow', row);
},
toggleRowSelection: function toggleRowSelection(row, selected) {
this.store.toggleRowSelection(row, selected);
this.store.updateAllSelected();
},
clearSelection: function clearSelection() {
this.store.clearSelection();
},
handleMouseLeave: function handleMouseLeave() {
this.store.commit('setHoverRow', null);
if (this.hoverState) this.hoverState = null;
},
updateScrollY: function updateScrollY() {
this.layout.updateScrollY();
},
bindEvents: function bindEvents() {
var _this = this;
var _$refs = this.$refs,
headerWrapper = _$refs.headerWrapper,
footerWrapper = _$refs.footerWrapper;
var refs = this.$refs;
this.bodyWrapper.addEventListener('scroll', function () {
if (headerWrapper) headerWrapper.scrollLeft = this.scrollLeft;
if (footerWrapper) footerWrapper.scrollLeft = this.scrollLeft;
if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
});
var scrollBodyWrapper = function scrollBodyWrapper(event) {
var deltaX = event.deltaX;
if (deltaX > 0) {
_this.bodyWrapper.scrollLeft += 10;
} else {
_this.bodyWrapper.scrollLeft -= 10;
}
};
if (headerWrapper) {
(0, _util.mousewheel)(headerWrapper, (0, _throttle2.default)(16, scrollBodyWrapper));
}
if (footerWrapper) {
(0, _util.mousewheel)(footerWrapper, (0, _throttle2.default)(16, scrollBodyWrapper));
}
if (this.fit) {
this.windowResizeListener = (0, _throttle2.default)(50, function () {
if (_this.$ready) _this.doLayout();
});
(0, _resizeEvent.addResizeListener)(this.$el, this.windowResizeListener);
}
},
doLayout: function doLayout() {
var _this2 = this;
this.store.updateColumns();
this.layout.update();
this.updateScrollY();
this.$nextTick(function () {
if (_this2.height) {
_this2.layout.setHeight(_this2.height);
} else if (_this2.maxHeight) {
_this2.layout.setMaxHeight(_this2.maxHeight);
} else if (_this2.shouldUpdateHeight) {
_this2.layout.updateHeight();
}
});
}
},
created: function created() {
var _this3 = this;
this.tableId = 'el-table_' + tableIdSeed + '_';
this.debouncedLayout = (0, _debounce2.default)(50, function () {
return _this3.doLayout();
});
},
computed: {
bodyWrapper: function bodyWrapper() {
return this.$refs.bodyWrapper;
},
shouldUpdateHeight: function shouldUpdateHeight() {
return typeof this.height === 'number' || this.fixedColumns.length > 0 || this.rightFixedColumns.length > 0;
},
selection: function selection() {
return this.store.states.selection;
},
columns: function columns() {
return this.store.states.columns;
},
tableData: function tableData() {
return this.store.states.data;
},
fixedColumns: function fixedColumns() {
return this.store.states.fixedColumns;
},
rightFixedColumns: function rightFixedColumns() {
return this.store.states.rightFixedColumns;
},
bodyHeight: function bodyHeight() {
var style = {};
if (this.height) {
style = {
height: this.layout.bodyHeight ? this.layout.bodyHeight + 'px' : ''
};
} else if (this.maxHeight) {
style = {
'max-height': (this.showHeader ? this.maxHeight - this.layout.headerHeight - this.layout.footerHeight : this.maxHeight - this.layout.footerHeight) + 'px'
};
}
return style;
},
bodyWidth: function bodyWidth() {
var _layout = this.layout,
bodyWidth = _layout.bodyWidth,
scrollY = _layout.scrollY,
gutterWidth = _layout.gutterWidth;
return bodyWidth ? bodyWidth - (scrollY ? gutterWidth : 0) + 'px' : '';
},
fixedBodyHeight: function fixedBodyHeight() {
var style = {};
if (this.height) {
style = {
height: this.layout.fixedBodyHeight ? this.layout.fixedBodyHeight + 'px' : ''
};
} else if (this.maxHeight) {
var maxHeight = this.layout.scrollX ? this.maxHeight - this.layout.gutterWidth : this.maxHeight;
if (this.showHeader) {
maxHeight -= this.layout.headerHeight;
}
style = {
'max-height': maxHeight + 'px'
};
}
return style;
},
fixedHeight: function fixedHeight() {
var style = {};
if (this.maxHeight) {
style = {
bottom: this.layout.scrollX && this.data.length ? this.layout.gutterWidth + 'px' : ''
};
} else {
style = {
height: this.layout.viewportHeight ? this.layout.viewportHeight + 'px' : ''
};
}
return style;
}
},
watch: {
height: function height(value) {
this.layout.setHeight(value);
},
currentRowKey: function currentRowKey(newVal) {
this.store.setCurrentRowKey(newVal);
},
data: {
immediate: true,
handler: function handler(val) {
this.store.commit('setData', val);
if (this.$ready) this.doLayout();
}
},
expandRowKeys: function expandRowKeys(newVal) {
this.store.setExpandRowKeys(newVal);
}
},
destroyed: function destroyed() {
if (this.windowResizeListener) (0, _resizeEvent.removeResizeListener)(this.$el, this.windowResizeListener);
},
mounted: function mounted() {
var _this4 = this;
this.bindEvents();
this.doLayout();
// init filters
this.store.states.columns.forEach(function (column) {
if (column.filteredValue && column.filteredValue.length) {
_this4.store.commit('filterChange', {
column: column,
values: column.filteredValue,
silent: true
});
}
});
this.$ready = true;
},
data: function data() {
var store = new _tableStore2.default(this, {
rowKey: this.rowKey,
defaultExpandAll: this.defaultExpandAll
});
var layout = new _tableLayout2.default({
store: store,
table: this,
fit: this.fit,
showHeader: this.showHeader
});
return {
store: store,
layout: layout,
renderExpanded: null,
resizeProxyVisible: false
};
}
};
/***/ },
/* 131 */
/***/ function(module, exports) {
module.exports = __webpack_require__(41);
/***/ },
/* 132 */
/***/ function(module, exports) {
module.exports = __webpack_require__(23);
/***/ },
/* 133 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
var _util = __webpack_require__(134);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var sortData = function sortData(data, states) {
var sortingColumn = states.sortingColumn;
if (!sortingColumn || typeof sortingColumn.sortable === 'string') {
return data;
}
return (0, _util.orderBy)(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod);
};
var getKeysMap = function getKeysMap(array, rowKey) {
var arrayMap = {};
(array || []).forEach(function (row, index) {
arrayMap[(0, _util.getRowIdentity)(row, rowKey)] = { row: row, index: index };
});
return arrayMap;
};
var toggleRowSelection = function toggleRowSelection(states, row, selected) {
var changed = false;
var selection = states.selection;
var index = selection.indexOf(row);
if (typeof selected === 'undefined') {
if (index === -1) {
selection.push(row);
changed = true;
} else {
selection.splice(index, 1);
changed = true;
}
} else {
if (selected && index === -1) {
selection.push(row);
changed = true;
} else if (!selected && index > -1) {
selection.splice(index, 1);
changed = true;
}
}
return changed;
};
var TableStore = function TableStore(table) {
var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (!table) {
throw new Error('Table is required.');
}
this.table = table;
this.states = {
rowKey: null,
_columns: [],
originColumns: [],
columns: [],
fixedColumns: [],
rightFixedColumns: [],
isComplex: false,
_data: null,
filteredData: null,
data: null,
sortingColumn: null,
sortProp: null,
sortOrder: null,
isAllSelected: false,
selection: [],
reserveSelection: false,
selectable: null,
currentRow: null,
hoverRow: null,
filters: {},
expandRows: [],
defaultExpandAll: false
};
for (var prop in initialState) {
if (initialState.hasOwnProperty(prop) && this.states.hasOwnProperty(prop)) {
this.states[prop] = initialState[prop];
}
}
};
TableStore.prototype.mutations = {
setData: function setData(states, data) {
var _this = this;
var dataInstanceChanged = states._data !== data;
states._data = data;
states.data = sortData(data || [], states);
// states.data.forEach((item) => {
// if (!item.$extra) {
// Object.defineProperty(item, '$extra', {
// value: {},
// enumerable: false
// });
// }
// });
this.updateCurrentRow();
if (!states.reserveSelection) {
if (dataInstanceChanged) {
this.clearSelection();
} else {
this.cleanSelection();
}
this.updateAllSelected();
} else {
(function () {
var rowKey = states.rowKey;
if (rowKey) {
(function () {
var selection = states.selection;
var selectedMap = getKeysMap(selection, rowKey);
states.data.forEach(function (row) {
var rowId = (0, _util.getRowIdentity)(row, rowKey);
var rowInfo = selectedMap[rowId];
if (rowInfo) {
selection[rowInfo.index] = row;
}
});
_this.updateAllSelected();
})();
} else {
console.warn('WARN: rowKey is required when reserve-selection is enabled.');
}
})();
}
var defaultExpandAll = states.defaultExpandAll;
if (defaultExpandAll) {
this.states.expandRows = (states.data || []).slice(0);
}
_vue2.default.nextTick(function () {
return _this.table.updateScrollY();
});
},
changeSortCondition: function changeSortCondition(states) {
var _this2 = this;
states.data = sortData(states.filteredData || states._data || [], states);
this.table.$emit('sort-change', {
column: this.states.sortingColumn,
prop: this.states.sortProp,
order: this.states.sortOrder
});
_vue2.default.nextTick(function () {
return _this2.table.updateScrollY();
});
},
filterChange: function filterChange(states, options) {
var _this3 = this;
var column = options.column,
values = options.values,
silent = options.silent;
if (values && !Array.isArray(values)) {
values = [values];
}
var prop = column.property;
var filters = {};
if (prop) {
states.filters[column.id] = values;
filters[column.columnKey || column.id] = values;
}
var data = states._data;
Object.keys(states.filters).forEach(function (columnId) {
var values = states.filters[columnId];
if (!values || values.length === 0) return;
var column = (0, _util.getColumnById)(_this3.states, columnId);
if (column && column.filterMethod) {
data = data.filter(function (row) {
return values.some(function (value) {
return column.filterMethod.call(null, value, row);
});
});
}
});
states.filteredData = data;
states.data = sortData(data, states);
if (!silent) {
this.table.$emit('filter-change', filters);
}
_vue2.default.nextTick(function () {
return _this3.table.updateScrollY();
});
},
insertColumn: function insertColumn(states, column, index, parent) {
var array = states._columns;
if (parent) {
array = parent.children;
if (!array) array = parent.children = [];
}
if (typeof index !== 'undefined') {
array.splice(index, 0, column);
} else {
array.push(column);
}
if (column.type === 'selection') {
states.selectable = column.selectable;
states.reserveSelection = column.reserveSelection;
}
this.updateColumns(); // hack for dynamics insert column
this.scheduleLayout();
},
removeColumn: function removeColumn(states, column) {
var _columns = states._columns;
if (_columns) {
_columns.splice(_columns.indexOf(column), 1);
}
this.updateColumns(); // hack for dynamics remove column
this.scheduleLayout();
},
setHoverRow: function setHoverRow(states, row) {
states.hoverRow = row;
},
setCurrentRow: function setCurrentRow(states, row) {
var oldCurrentRow = states.currentRow;
states.currentRow = row;
if (oldCurrentRow !== row) {
this.table.$emit('current-change', row, oldCurrentRow);
}
},
rowSelectedChanged: function rowSelectedChanged(states, row) {
var changed = toggleRowSelection(states, row);
var selection = states.selection;
if (changed) {
var table = this.table;
table.$emit('selection-change', selection);
table.$emit('select', selection, row);
}
this.updateAllSelected();
},
toggleRowExpanded: function toggleRowExpanded(states, row, expanded) {
var expandRows = states.expandRows;
if (typeof expanded !== 'undefined') {
var index = expandRows.indexOf(row);
if (expanded) {
if (index === -1) expandRows.push(row);
} else {
if (index !== -1) expandRows.splice(index, 1);
}
} else {
var _index = expandRows.indexOf(row);
if (_index === -1) {
expandRows.push(row);
} else {
expandRows.splice(_index, 1);
}
}
this.table.$emit('expand', row, expandRows.indexOf(row) !== -1);
},
toggleAllSelection: (0, _debounce2.default)(10, function (states) {
var data = states.data || [];
var value = !states.isAllSelected;
var selection = this.states.selection;
var selectionChanged = false;
data.forEach(function (item, index) {
if (states.selectable) {
if (states.selectable.call(null, item, index) && toggleRowSelection(states, item, value)) {
selectionChanged = true;
}
} else {
if (toggleRowSelection(states, item, value)) {
selectionChanged = true;
}
}
});
var table = this.table;
if (selectionChanged) {
table.$emit('selection-change', selection);
}
table.$emit('select-all', selection);
states.isAllSelected = value;
})
};
var doFlattenColumns = function doFlattenColumns(columns) {
var result = [];
columns.forEach(function (column) {
if (column.children) {
result.push.apply(result, doFlattenColumns(column.children));
} else {
result.push(column);
}
});
return result;
};
TableStore.prototype.updateColumns = function () {
var states = this.states;
var _columns = states._columns || [];
states.fixedColumns = _columns.filter(function (column) {
return column.fixed === true || column.fixed === 'left';
});
states.rightFixedColumns = _columns.filter(function (column) {
return column.fixed === 'right';
});
if (states.fixedColumns.length > 0 && _columns[0] && _columns[0].type === 'selection' && !_columns[0].fixed) {
_columns[0].fixed = true;
states.fixedColumns.unshift(_columns[0]);
}
states.originColumns = [].concat(states.fixedColumns).concat(_columns.filter(function (column) {
return !column.fixed;
})).concat(states.rightFixedColumns);
states.columns = doFlattenColumns(states.originColumns);
states.isComplex = states.fixedColumns.length > 0 || states.rightFixedColumns.length > 0;
};
TableStore.prototype.isSelected = function (row) {
return (this.states.selection || []).indexOf(row) > -1;
};
TableStore.prototype.clearSelection = function () {
var states = this.states;
states.isAllSelected = false;
var oldSelection = states.selection;
states.selection = [];
if (oldSelection.length > 0) {
this.table.$emit('selection-change', states.selection);
}
};
TableStore.prototype.setExpandRowKeys = function (rowKeys) {
var expandRows = [];
var data = this.states.data;
var rowKey = this.states.rowKey;
if (!rowKey) throw new Error('[Table] prop row-key should not be empty.');
var keysMap = getKeysMap(data, rowKey);
rowKeys.forEach(function (key) {
var info = keysMap[key];
if (info) {
expandRows.push(info.row);
}
});
this.states.expandRows = expandRows;
};
TableStore.prototype.toggleRowSelection = function (row, selected) {
var changed = toggleRowSelection(this.states, row, selected);
if (changed) {
this.table.$emit('selection-change', this.states.selection);
}
};
TableStore.prototype.cleanSelection = function () {
var selection = this.states.selection || [];
var data = this.states.data;
var rowKey = this.states.rowKey;
var deleted = void 0;
if (rowKey) {
deleted = [];
var selectedMap = getKeysMap(selection, rowKey);
var dataMap = getKeysMap(data, rowKey);
for (var key in selectedMap) {
if (selectedMap.hasOwnProperty(key) && !dataMap[key]) {
deleted.push(selectedMap[key].row);
}
}
} else {
deleted = selection.filter(function (item) {
return data.indexOf(item) === -1;
});
}
deleted.forEach(function (deletedItem) {
selection.splice(selection.indexOf(deletedItem), 1);
});
if (deleted.length) {
this.table.$emit('selection-change', selection);
}
};
TableStore.prototype.updateAllSelected = function () {
var states = this.states;
var selection = states.selection,
rowKey = states.rowKey,
selectable = states.selectable,
data = states.data;
if (!data || data.length === 0) {
states.isAllSelected = false;
return;
}
var selectedMap = void 0;
if (rowKey) {
selectedMap = getKeysMap(states.selection, rowKey);
}
var isSelected = function isSelected(row) {
if (selectedMap) {
return !!selectedMap[(0, _util.getRowIdentity)(row, rowKey)];
} else {
return selection.indexOf(row) !== -1;
}
};
var isAllSelected = true;
var selectedCount = 0;
for (var i = 0, j = data.length; i < j; i++) {
var item = data[i];
if (selectable) {
var isRowSelectable = selectable.call(null, item, i);
if (isRowSelectable) {
if (!isSelected(item)) {
isAllSelected = false;
break;
} else {
selectedCount++;
}
}
} else {
if (!isSelected(item)) {
isAllSelected = false;
break;
} else {
selectedCount++;
}
}
}
if (selectedCount === 0) isAllSelected = false;
states.isAllSelected = isAllSelected;
};
TableStore.prototype.scheduleLayout = function () {
this.table.debouncedLayout();
};
TableStore.prototype.setCurrentRowKey = function (key) {
var states = this.states;
var rowKey = states.rowKey;
if (!rowKey) throw new Error('[Table] row-key should not be empty.');
var data = states.data || [];
var keysMap = getKeysMap(data, rowKey);
var info = keysMap[key];
if (info) {
states.currentRow = info.row;
}
};
TableStore.prototype.updateCurrentRow = function () {
var states = this.states;
var table = this.table;
var data = states.data || [];
var oldCurrentRow = states.currentRow;
if (data.indexOf(oldCurrentRow) === -1) {
states.currentRow = null;
if (states.currentRow !== oldCurrentRow) {
table.$emit('current-change', null, oldCurrentRow);
}
}
};
TableStore.prototype.commit = function (name) {
var mutations = this.mutations;
if (mutations[name]) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
mutations[name].apply(this, [this.states].concat(args));
} else {
throw new Error('Action not found: ' + name);
}
};
exports.default = TableStore;
/***/ },
/* 134 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.getRowIdentity = exports.mousewheel = exports.getColumnByCell = exports.getColumnById = exports.orderBy = exports.getCell = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _util = __webpack_require__(108);
var getCell = exports.getCell = function getCell(event) {
var cell = event.target;
while (cell && cell.tagName.toUpperCase() !== 'HTML') {
if (cell.tagName.toUpperCase() === 'TD') {
return cell;
}
cell = cell.parentNode;
}
return null;
};
var isObject = function isObject(obj) {
return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
};
var orderBy = exports.orderBy = function orderBy(array, sortKey, reverse, sortMethod) {
if (typeof reverse === 'string') {
reverse = reverse === 'descending' ? -1 : 1;
}
if (!sortKey) {
return array;
}
var order = reverse && reverse < 0 ? -1 : 1;
// sort on a copy to avoid mutating original array
return array.slice().sort(sortMethod ? function (a, b) {
return sortMethod(a, b) ? order : -order;
} : function (a, b) {
if (sortKey !== '$key') {
if (isObject(a) && '$value' in a) a = a.$value;
if (isObject(b) && '$value' in b) b = b.$value;
}
a = isObject(a) ? (0, _util.getValueByPath)(a, sortKey) : a;
b = isObject(b) ? (0, _util.getValueByPath)(b, sortKey) : b;
return a === b ? 0 : a > b ? order : -order;
});
};
var getColumnById = exports.getColumnById = function getColumnById(table, columnId) {
var column = null;
table.columns.forEach(function (item) {
if (item.id === columnId) {
column = item;
}
});
return column;
};
var getColumnByCell = exports.getColumnByCell = function getColumnByCell(table, cell) {
var matches = (cell.className || '').match(/el-table_[^\s]+/gm);
if (matches) {
return getColumnById(table, matches[0]);
}
return null;
};
var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
var mousewheel = exports.mousewheel = function mousewheel(element, callback) {
if (element && element.addEventListener) {
element.addEventListener(isFirefox ? 'DOMMouseScroll' : 'mousewheel', callback);
}
};
var getRowIdentity = exports.getRowIdentity = function getRowIdentity(row, rowKey) {
if (!row) throw new Error('row is required when get row identity');
if (typeof rowKey === 'string') {
if (rowKey.indexOf('.') < 0) {
return row[rowKey];
}
var key = rowKey.split('.');
var current = row;
for (var i = 0; i < key.length; i++) {
current = current[key[i]];
}
return current;
} else if (typeof rowKey === 'function') {
return rowKey.call(null, row);
}
};
/***/ },
/* 135 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _scrollbarWidth = __webpack_require__(136);
var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var TableLayout = function () {
function TableLayout(options) {
_classCallCheck(this, TableLayout);
this.table = null;
this.store = null;
this.columns = null;
this.fit = true;
this.showHeader = true;
this.height = null;
this.scrollX = false;
this.scrollY = false;
this.bodyWidth = null;
this.fixedWidth = null;
this.rightFixedWidth = null;
this.tableHeight = null;
this.headerHeight = 44; // Table Header Height
this.footerHeight = 44; // Table Footer Height
this.viewportHeight = null; // Table Height - Scroll Bar Height
this.bodyHeight = null; // Table Height - Table Header Height
this.fixedBodyHeight = null; // Table Height - Table Header Height - Scroll Bar Height
this.gutterWidth = (0, _scrollbarWidth2.default)();
for (var name in options) {
if (options.hasOwnProperty(name)) {
this[name] = options[name];
}
}
if (!this.table) {
throw new Error('table is required for Table Layout');
}
if (!this.store) {
throw new Error('store is required for Table Layout');
}
}
TableLayout.prototype.updateScrollY = function updateScrollY() {
var height = this.height;
if (typeof height !== 'string' && typeof height !== 'number') return;
var bodyWrapper = this.table.bodyWrapper;
if (this.table.$el && bodyWrapper) {
var body = bodyWrapper.querySelector('.el-table__body');
this.scrollY = body.offsetHeight > bodyWrapper.offsetHeight;
}
};
TableLayout.prototype.setHeight = function setHeight(value) {
var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'height';
var el = this.table.$el;
if (typeof value === 'string' && /^\d+$/.test(value)) {
value = Number(value);
}
this.height = value;
if (!el) return;
if (typeof value === 'number') {
el.style[prop] = value + 'px';
this.updateHeight();
} else if (typeof value === 'string') {
if (value === '') {
el.style[prop] = '';
}
this.updateHeight();
}
};
TableLayout.prototype.setMaxHeight = function setMaxHeight(value) {
return this.setHeight(value, 'max-height');
};
TableLayout.prototype.updateHeight = function updateHeight() {
var height = this.tableHeight = this.table.$el.clientHeight;
var noData = !this.table.data || this.table.data.length === 0;
var _table$$refs = this.table.$refs,
headerWrapper = _table$$refs.headerWrapper,
footerWrapper = _table$$refs.footerWrapper;
var footerHeight = this.footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
if (this.showHeader && !headerWrapper) return;
if (!this.showHeader) {
this.headerHeight = 0;
if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) {
this.bodyHeight = height - footerHeight + (footerWrapper ? 1 : 0);
}
this.fixedBodyHeight = this.scrollX ? height - this.gutterWidth : height;
} else {
var headerHeight = this.headerHeight = headerWrapper.offsetHeight;
var bodyHeight = height - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
if (this.height !== null && (!isNaN(this.height) || typeof this.height === 'string')) {
this.bodyHeight = bodyHeight;
}
this.fixedBodyHeight = this.scrollX ? bodyHeight - this.gutterWidth : bodyHeight;
}
this.viewportHeight = this.scrollX ? height - (noData ? 0 : this.gutterWidth) : height;
};
TableLayout.prototype.update = function update() {
var fit = this.fit;
var columns = this.table.columns;
var bodyWidth = this.table.$el.clientWidth;
var bodyMinWidth = 0;
var flattenColumns = [];
columns.forEach(function (column) {
if (column.isColumnGroup) {
flattenColumns.push.apply(flattenColumns, column.columns);
} else {
flattenColumns.push(column);
}
});
var flexColumns = flattenColumns.filter(function (column) {
return typeof column.width !== 'number';
});
if (flexColumns.length > 0 && fit) {
flattenColumns.forEach(function (column) {
bodyMinWidth += column.width || column.minWidth || 80;
});
if (bodyMinWidth < bodyWidth - this.gutterWidth) {
// DON'T HAVE SCROLL BAR
this.scrollX = false;
var totalFlexWidth = bodyWidth - this.gutterWidth - bodyMinWidth;
if (flexColumns.length === 1) {
flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth;
} else {
(function () {
var allColumnsWidth = flexColumns.reduce(function (prev, column) {
return prev + (column.minWidth || 80);
}, 0);
var flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
var noneFirstWidth = 0;
flexColumns.forEach(function (column, index) {
if (index === 0) return;
var flexWidth = Math.floor((column.minWidth || 80) * flexWidthPerPixel);
noneFirstWidth += flexWidth;
column.realWidth = (column.minWidth || 80) + flexWidth;
});
flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
})();
}
} else {
// HAVE HORIZONTAL SCROLL BAR
this.scrollX = true;
flexColumns.forEach(function (column) {
column.realWidth = column.minWidth;
});
}
this.bodyWidth = Math.max(bodyMinWidth, bodyWidth);
} else {
flattenColumns.forEach(function (column) {
if (!column.width && !column.minWidth) {
column.realWidth = 80;
} else {
column.realWidth = column.width || column.minWidth;
}
bodyMinWidth += column.realWidth;
});
this.scrollX = bodyMinWidth > bodyWidth;
this.bodyWidth = bodyMinWidth;
}
var fixedColumns = this.store.states.fixedColumns;
if (fixedColumns.length > 0) {
var fixedWidth = 0;
fixedColumns.forEach(function (column) {
fixedWidth += column.realWidth;
});
this.fixedWidth = fixedWidth;
}
var rightFixedColumns = this.store.states.rightFixedColumns;
if (rightFixedColumns.length > 0) {
var rightFixedWidth = 0;
rightFixedColumns.forEach(function (column) {
rightFixedWidth += column.realWidth;
});
this.rightFixedWidth = rightFixedWidth;
}
};
return TableLayout;
}();
exports.default = TableLayout;
/***/ },
/* 136 */
/***/ function(module, exports) {
module.exports = __webpack_require__(13);
/***/ },
/* 137 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _util = __webpack_require__(134);
var _dom = __webpack_require__(45);
var _checkbox = __webpack_require__(131);
var _checkbox2 = _interopRequireDefault(_checkbox);
var _tooltip = __webpack_require__(138);
var _tooltip2 = _interopRequireDefault(_tooltip);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
components: {
ElCheckbox: _checkbox2.default,
ElTooltip: _tooltip2.default
},
props: {
store: {
required: true
},
stripe: Boolean,
context: {},
layout: {
required: true
},
rowClassName: [String, Function],
rowStyle: [Object, Function],
fixed: String,
highlight: Boolean
},
render: function render(h) {
var _this = this;
var columnsHidden = this.columns.map(function (column, index) {
return _this.isColumnHidden(index);
});
return h(
'table',
{
'class': 'el-table__body',
attrs: { cellspacing: '0',
cellpadding: '0',
border: '0' }
},
[h(
'colgroup',
null,
[this._l(this.columns, function (column) {
return h(
'col',
{
attrs: {
name: column.id,
width: column.realWidth || column.width
}
},
[]
);
})]
), h(
'tbody',
null,
[this._l(this.data, function (row, $index) {
return [h(
'tr',
{
style: _this.rowStyle ? _this.getRowStyle(row, $index) : null,
key: _this.table.rowKey ? _this.getKeyOfRow(row, $index) : $index,
on: {
'dblclick': function dblclick($event) {
return _this.handleDoubleClick($event, row);
},
'click': function click($event) {
return _this.handleClick($event, row);
},
'contextmenu': function contextmenu($event) {
return _this.handleContextMenu($event, row);
},
'mouseenter': function mouseenter(_) {
return _this.handleMouseEnter($index);
},
'mouseleave': function mouseleave(_) {
return _this.handleMouseLeave();
}
},
'class': [_this.getRowClass(row, $index)] },
[_this._l(_this.columns, function (column, cellIndex) {
return h(
'td',
{
'class': [column.id, column.align, column.className || '', columnsHidden[cellIndex] ? 'is-hidden' : ''],
on: {
'mouseenter': function mouseenter($event) {
return _this.handleCellMouseEnter($event, row);
},
'mouseleave': _this.handleCellMouseLeave
}
},
[column.renderCell.call(_this._renderProxy, h, { row: row, column: column, $index: $index, store: _this.store, _self: _this.context || _this.table.$vnode.context }, columnsHidden[cellIndex])]
);
}), !_this.fixed && _this.layout.scrollY && _this.layout.gutterWidth ? h(
'td',
{ 'class': 'gutter' },
[]
) : '']
), _this.store.states.expandRows.indexOf(row) > -1 ? h(
'tr',
null,
[h(
'td',
{
attrs: { colspan: _this.columns.length },
'class': 'el-table__expanded-cell' },
[_this.table.renderExpanded ? _this.table.renderExpanded(h, { row: row, $index: $index, store: _this.store }) : '']
)]
) : ''];
}).concat(this._self.$parent.$slots.append).concat(h(
'el-tooltip',
{
attrs: { effect: this.table.tooltipEffect, placement: 'top', content: this.tooltipContent },
ref: 'tooltip' },
[]
))]
)]
);
},
watch: {
'store.states.hoverRow': function storeStatesHoverRow(newVal, oldVal) {
if (!this.store.states.isComplex) return;
var el = this.$el;
if (!el) return;
var rows = el.querySelectorAll('tbody > tr.el-table__row');
var oldRow = rows[oldVal];
var newRow = rows[newVal];
if (oldRow) {
(0, _dom.removeClass)(oldRow, 'hover-row');
}
if (newRow) {
(0, _dom.addClass)(newRow, 'hover-row');
}
},
'store.states.currentRow': function storeStatesCurrentRow(newVal, oldVal) {
if (!this.highlight) return;
var el = this.$el;
if (!el) return;
var data = this.store.states.data;
var rows = el.querySelectorAll('tbody > tr.el-table__row');
var oldRow = rows[data.indexOf(oldVal)];
var newRow = rows[data.indexOf(newVal)];
if (oldRow) {
(0, _dom.removeClass)(oldRow, 'current-row');
} else if (rows) {
[].forEach.call(rows, function (row) {
return (0, _dom.removeClass)(row, 'current-row');
});
}
if (newRow) {
(0, _dom.addClass)(newRow, 'current-row');
}
}
},
computed: {
table: function table() {
return this.$parent;
},
data: function data() {
return this.store.states.data;
},
columnsCount: function columnsCount() {
return this.store.states.columns.length;
},
leftFixedCount: function leftFixedCount() {
return this.store.states.fixedColumns.length;
},
rightFixedCount: function rightFixedCount() {
return this.store.states.rightFixedColumns.length;
},
columns: function columns() {
return this.store.states.columns;
}
},
data: function data() {
return {
tooltipContent: ''
};
},
created: function created() {
this.activateTooltip = (0, _debounce2.default)(50, function (tooltip) {
return tooltip.handleShowPopper();
});
},
methods: {
getKeyOfRow: function getKeyOfRow(row, index) {
var rowKey = this.table.rowKey;
if (rowKey) {
return (0, _util.getRowIdentity)(row, rowKey);
}
return index;
},
isColumnHidden: function isColumnHidden(index) {
if (this.fixed === true || this.fixed === 'left') {
return index >= this.leftFixedCount;
} else if (this.fixed === 'right') {
return index < this.columnsCount - this.rightFixedCount;
} else {
return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
}
},
getRowStyle: function getRowStyle(row, index) {
var rowStyle = this.rowStyle;
if (typeof rowStyle === 'function') {
return rowStyle.call(null, row, index);
}
return rowStyle;
},
getRowClass: function getRowClass(row, index) {
var classes = ['el-table__row'];
if (this.stripe && index % 2 === 1) {
classes.push('el-table__row--striped');
}
var rowClassName = this.rowClassName;
if (typeof rowClassName === 'string') {
classes.push(rowClassName);
} else if (typeof rowClassName === 'function') {
classes.push(rowClassName.call(null, row, index) || '');
}
return classes.join(' ');
},
handleCellMouseEnter: function handleCellMouseEnter(event, row) {
var table = this.table;
var cell = (0, _util.getCell)(event);
if (cell) {
var column = (0, _util.getColumnByCell)(table, cell);
var hoverState = table.hoverState = { cell: cell, column: column, row: row };
table.$emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, event);
}
// 判断是否text-overflow, 如果是就显示tooltip
var cellChild = event.target.querySelector('.cell');
if ((0, _dom.hasClass)(cellChild, 'el-tooltip') && cellChild.scrollWidth > cellChild.offsetWidth) {
var tooltip = this.$refs.tooltip;
this.tooltipContent = cell.innerText;
tooltip.referenceElm = cell;
tooltip.$refs.popper.style.display = 'none';
tooltip.doDestroy();
tooltip.setExpectedState(true);
this.activateTooltip(tooltip);
}
},
handleCellMouseLeave: function handleCellMouseLeave(event) {
var tooltip = this.$refs.tooltip;
if (tooltip) {
tooltip.setExpectedState(false);
tooltip.handleClosePopper();
}
var cell = (0, _util.getCell)(event);
if (!cell) return;
var oldHoverState = this.table.hoverState;
this.table.$emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
},
handleMouseEnter: function handleMouseEnter(index) {
this.store.commit('setHoverRow', index);
},
handleMouseLeave: function handleMouseLeave() {
this.store.commit('setHoverRow', null);
},
handleContextMenu: function handleContextMenu(event, row) {
this.handleEvent(event, row, 'contextmenu');
},
handleDoubleClick: function handleDoubleClick(event, row) {
this.handleEvent(event, row, 'dblclick');
},
handleClick: function handleClick(event, row) {
this.store.commit('setCurrentRow', row);
this.handleEvent(event, row, 'click');
},
handleEvent: function handleEvent(event, row, name) {
var table = this.table;
var cell = (0, _util.getCell)(event);
var column = void 0;
if (cell) {
column = (0, _util.getColumnByCell)(table, cell);
if (column) {
table.$emit('cell-' + name, row, column, cell, event);
}
}
table.$emit('row-' + name, row, event, column);
},
handleExpandClick: function handleExpandClick(row) {
this.store.commit('toggleRowExpanded', row);
}
}
};
/***/ },
/* 138 */
/***/ function(module, exports) {
module.exports = __webpack_require__(42);
/***/ },
/* 139 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dom = __webpack_require__(45);
var _checkbox = __webpack_require__(131);
var _checkbox2 = _interopRequireDefault(_checkbox);
var _tag = __webpack_require__(110);
var _tag2 = _interopRequireDefault(_tag);
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _filterPanel = __webpack_require__(140);
var _filterPanel2 = _interopRequireDefault(_filterPanel);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getAllColumns = function getAllColumns(columns) {
var result = [];
columns.forEach(function (column) {
if (column.children) {
result.push(column);
result.push.apply(result, getAllColumns(column.children));
} else {
result.push(column);
}
});
return result;
};
var convertToRows = function convertToRows(originColumns) {
var maxLevel = 1;
var traverse = function traverse(column, parent) {
if (parent) {
column.level = parent.level + 1;
if (maxLevel < column.level) {
maxLevel = column.level;
}
}
if (column.children) {
var colSpan = 0;
column.children.forEach(function (subColumn) {
traverse(subColumn, column);
colSpan += subColumn.colSpan;
});
column.colSpan = colSpan;
} else {
column.colSpan = 1;
}
};
originColumns.forEach(function (column) {
column.level = 1;
traverse(column);
});
var rows = [];
for (var i = 0; i < maxLevel; i++) {
rows.push([]);
}
var allColumns = getAllColumns(originColumns);
allColumns.forEach(function (column) {
if (!column.children) {
column.rowSpan = maxLevel - column.level + 1;
} else {
column.rowSpan = 1;
}
rows[column.level - 1].push(column);
});
return rows;
};
exports.default = {
name: 'ElTableHeader',
render: function render(h) {
var _this = this;
var originColumns = this.store.states.originColumns;
var columnRows = convertToRows(originColumns, this.columns);
return h(
'table',
{
'class': 'el-table__header',
attrs: { cellspacing: '0',
cellpadding: '0',
border: '0' }
},
[h(
'colgroup',
null,
[this._l(this.columns, function (column) {
return h(
'col',
{
attrs: {
name: column.id,
width: column.realWidth || column.width
}
},
[]
);
}), !this.fixed && this.layout.gutterWidth ? h(
'col',
{
attrs: { name: 'gutter', width: this.layout.scrollY ? this.layout.gutterWidth : '' }
},
[]
) : '']
), h(
'thead',
null,
[this._l(columnRows, function (columns, rowIndex) {
return h(
'tr',
null,
[_this._l(columns, function (column, cellIndex) {
return h(
'th',
{
attrs: {
colspan: column.colSpan,
rowspan: column.rowSpan
},
on: {
'mousemove': function mousemove($event) {
return _this.handleMouseMove($event, column);
},
'mouseout': _this.handleMouseOut,
'mousedown': function mousedown($event) {
return _this.handleMouseDown($event, column);
},
'click': function click($event) {
return _this.handleHeaderClick($event, column);
}
},
'class': [column.id, column.order, column.headerAlign, column.className || '', rowIndex === 0 && _this.isCellHidden(cellIndex, columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] },
[h(
'div',
{ 'class': ['cell', column.filteredValue && column.filteredValue.length > 0 ? 'highlight' : '', column.labelClassName] },
[column.renderHeader ? column.renderHeader.call(_this._renderProxy, h, { column: column, $index: cellIndex, store: _this.store, _self: _this.$parent.$vnode.context }) : column.label, column.sortable ? h(
'span',
{ 'class': 'caret-wrapper', on: {
'click': function click($event) {
return _this.handleSortClick($event, column);
}
}
},
[h(
'i',
{ 'class': 'sort-caret ascending', on: {
'click': function click($event) {
return _this.handleSortClick($event, column, 'ascending');
}
}
},
[]
), h(
'i',
{ 'class': 'sort-caret descending', on: {
'click': function click($event) {
return _this.handleSortClick($event, column, 'descending');
}
}
},
[]
)]
) : '', column.filterable ? h(
'span',
{ 'class': 'el-table__column-filter-trigger', on: {
'click': function click($event) {
return _this.handleFilterClick($event, column);
}
}
},
[h(
'i',
{ 'class': ['el-icon-arrow-down', column.filterOpened ? 'el-icon-arrow-up' : ''] },
[]
)]
) : '']
)]
);
}), !_this.fixed && _this.layout.gutterWidth ? h(
'th',
{ 'class': 'gutter', style: { width: _this.layout.scrollY ? _this.layout.gutterWidth + 'px' : '0' } },
[]
) : '']
);
})]
)]
);
},
props: {
fixed: String,
store: {
required: true
},
layout: {
required: true
},
border: Boolean,
defaultSort: {
type: Object,
default: function _default() {
return {
prop: '',
order: ''
};
}
}
},
components: {
ElCheckbox: _checkbox2.default,
ElTag: _tag2.default
},
computed: {
isAllSelected: function isAllSelected() {
return this.store.states.isAllSelected;
},
columnsCount: function columnsCount() {
return this.store.states.columns.length;
},
leftFixedCount: function leftFixedCount() {
return this.store.states.fixedColumns.length;
},
rightFixedCount: function rightFixedCount() {
return this.store.states.rightFixedColumns.length;
},
columns: function columns() {
return this.store.states.columns;
}
},
created: function created() {
this.filterPanels = {};
},
mounted: function mounted() {
var _this2 = this;
if (this.defaultSort.prop) {
(function () {
var states = _this2.store.states;
states.sortProp = _this2.defaultSort.prop;
states.sortOrder = _this2.defaultSort.order || 'ascending';
_this2.$nextTick(function (_) {
for (var i = 0, length = _this2.columns.length; i < length; i++) {
var column = _this2.columns[i];
if (column.property === states.sortProp) {
column.order = states.sortOrder;
states.sortingColumn = column;
break;
}
}
if (states.sortingColumn) {
_this2.store.commit('changeSortCondition');
}
});
})();
}
},
beforeDestroy: function beforeDestroy() {
var panels = this.filterPanels;
for (var prop in panels) {
if (panels.hasOwnProperty(prop) && panels[prop]) {
panels[prop].$destroy(true);
}
}
},
methods: {
isCellHidden: function isCellHidden(index, columns) {
if (this.fixed === true || this.fixed === 'left') {
return index >= this.leftFixedCount;
} else if (this.fixed === 'right') {
var before = 0;
for (var i = 0; i < index; i++) {
before += columns[i].colSpan;
}
return before < this.columnsCount - this.rightFixedCount;
} else {
return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
}
},
toggleAllSelection: function toggleAllSelection() {
this.store.commit('toggleAllSelection');
},
handleFilterClick: function handleFilterClick(event, column) {
event.stopPropagation();
var target = event.target;
var cell = target.parentNode;
var table = this.$parent;
var filterPanel = this.filterPanels[column.id];
if (filterPanel && column.filterOpened) {
filterPanel.showPopper = false;
return;
}
if (!filterPanel) {
filterPanel = new _vue2.default(_filterPanel2.default);
this.filterPanels[column.id] = filterPanel;
if (column.filterPlacement) {
filterPanel.placement = column.filterPlacement;
}
filterPanel.table = table;
filterPanel.cell = cell;
filterPanel.column = column;
!this.$isServer && filterPanel.$mount(document.createElement('div'));
}
setTimeout(function () {
filterPanel.showPopper = true;
}, 16);
},
handleHeaderClick: function handleHeaderClick(event, column) {
if (!column.filters && column.sortable) {
this.handleSortClick(event, column);
} else if (column.filters && !column.sortable) {
this.handleFilterClick(event, column);
}
this.$parent.$emit('header-click', column, event);
},
handleMouseDown: function handleMouseDown(event, column) {
var _this3 = this;
if (this.$isServer) return;
if (column.children && column.children.length > 0) return;
/* istanbul ignore if */
if (this.draggingColumn && this.border) {
(function () {
_this3.dragging = true;
_this3.$parent.resizeProxyVisible = true;
var table = _this3.$parent;
var tableEl = table.$el;
var tableLeft = tableEl.getBoundingClientRect().left;
var columnEl = _this3.$el.querySelector('th.' + column.id);
var columnRect = columnEl.getBoundingClientRect();
var minLeft = columnRect.left - tableLeft + 30;
(0, _dom.addClass)(columnEl, 'noclick');
_this3.dragState = {
startMouseLeft: event.clientX,
startLeft: columnRect.right - tableLeft,
startColumnLeft: columnRect.left - tableLeft,
tableLeft: tableLeft
};
var resizeProxy = table.$refs.resizeProxy;
resizeProxy.style.left = _this3.dragState.startLeft + 'px';
document.onselectstart = function () {
return false;
};
document.ondragstart = function () {
return false;
};
var handleMouseMove = function handleMouseMove(event) {
var deltaLeft = event.clientX - _this3.dragState.startMouseLeft;
var proxyLeft = _this3.dragState.startLeft + deltaLeft;
resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
};
var handleMouseUp = function handleMouseUp() {
if (_this3.dragging) {
var _dragState = _this3.dragState,
startColumnLeft = _dragState.startColumnLeft,
startLeft = _dragState.startLeft;
var finalLeft = parseInt(resizeProxy.style.left, 10);
var columnWidth = finalLeft - startColumnLeft;
column.width = column.realWidth = columnWidth;
table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
_this3.store.scheduleLayout();
document.body.style.cursor = '';
_this3.dragging = false;
_this3.draggingColumn = null;
_this3.dragState = {};
table.resizeProxyVisible = false;
}
document.removeEventListener('mousemove', handleMouseMove);
document.removeEventListener('mouseup', handleMouseUp);
document.onselectstart = null;
document.ondragstart = null;
setTimeout(function () {
(0, _dom.removeClass)(columnEl, 'noclick');
}, 0);
};
document.addEventListener('mousemove', handleMouseMove);
document.addEventListener('mouseup', handleMouseUp);
})();
}
},
handleMouseMove: function handleMouseMove(event, column) {
if (column.children && column.children.length > 0) return;
var target = event.target;
while (target && target.tagName !== 'TH') {
target = target.parentNode;
}
if (!column || !column.resizable) return;
if (!this.dragging && this.border) {
var rect = target.getBoundingClientRect();
var bodyStyle = document.body.style;
if (rect.width > 12 && rect.right - event.pageX < 8) {
bodyStyle.cursor = 'col-resize';
this.draggingColumn = column;
} else if (!this.dragging) {
bodyStyle.cursor = '';
this.draggingColumn = null;
}
}
},
handleMouseOut: function handleMouseOut() {
if (this.$isServer) return;
document.body.style.cursor = '';
},
toggleOrder: function toggleOrder(order) {
return !order ? 'ascending' : order === 'ascending' ? 'descending' : null;
},
handleSortClick: function handleSortClick(event, column, givenOrder) {
event.stopPropagation();
var order = givenOrder || this.toggleOrder(column.order);
var target = event.target;
while (target && target.tagName !== 'TH') {
target = target.parentNode;
}
if (target && target.tagName === 'TH') {
if ((0, _dom.hasClass)(target, 'noclick')) {
(0, _dom.removeClass)(target, 'noclick');
return;
}
}
if (!column.sortable) return;
var states = this.store.states;
var sortProp = states.sortProp;
var sortOrder = void 0;
var sortingColumn = states.sortingColumn;
if (sortingColumn !== column) {
if (sortingColumn) {
sortingColumn.order = null;
}
states.sortingColumn = column;
sortProp = column.property;
}
if (!order) {
sortOrder = column.order = null;
states.sortingColumn = null;
sortProp = null;
} else {
sortOrder = column.order = order;
}
states.sortProp = sortProp;
states.sortOrder = sortOrder;
this.store.commit('changeSortCondition');
}
},
data: function data() {
return {
draggingColumn: null,
dragging: false,
dragState: {}
};
}
};
/***/ },
/* 140 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(141),
/* template */
__webpack_require__(144),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 141 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _popup = __webpack_require__(14);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _clickoutside = __webpack_require__(21);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _dropdown = __webpack_require__(142);
var _dropdown2 = _interopRequireDefault(_dropdown);
var _checkbox = __webpack_require__(131);
var _checkbox2 = _interopRequireDefault(_checkbox);
var _checkboxGroup = __webpack_require__(143);
var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElTableFilterPanel',
mixins: [_vuePopper2.default, _locale2.default],
directives: {
Clickoutside: _clickoutside2.default
},
components: {
ElCheckbox: _checkbox2.default,
ElCheckboxGroup: _checkboxGroup2.default
},
props: {
placement: {
type: String,
default: 'bottom-end'
}
},
customRender: function customRender(h) {
return h(
'div',
{ 'class': 'el-table-filter' },
[h(
'div',
{ 'class': 'el-table-filter__content' },
[]
), h(
'div',
{ 'class': 'el-table-filter__bottom' },
[h(
'button',
{
on: {
'click': this.handleConfirm
}
},
[this.t('el.table.confirmFilter')]
), h(
'button',
{
on: {
'click': this.handleReset
}
},
[this.t('el.table.resetFilter')]
)]
)]
);
},
methods: {
isActive: function isActive(filter) {
return filter.value === this.filterValue;
},
handleOutsideClick: function handleOutsideClick() {
this.showPopper = false;
},
handleConfirm: function handleConfirm() {
this.confirmFilter(this.filteredValue);
this.handleOutsideClick();
},
handleReset: function handleReset() {
this.filteredValue = [];
this.confirmFilter(this.filteredValue);
this.handleOutsideClick();
},
handleSelect: function handleSelect(filterValue) {
this.filterValue = filterValue;
if (typeof filterValue !== 'undefined' && filterValue !== null) {
this.confirmFilter(this.filteredValue);
} else {
this.confirmFilter([]);
}
this.handleOutsideClick();
},
confirmFilter: function confirmFilter(filteredValue) {
this.table.store.commit('filterChange', {
column: this.column,
values: filteredValue
});
}
},
data: function data() {
return {
table: null,
cell: null,
column: null
};
},
computed: {
filters: function filters() {
return this.column && this.column.filters;
},
filterValue: {
get: function get() {
return (this.column.filteredValue || [])[0];
},
set: function set(value) {
if (this.filteredValue) {
if (typeof value !== 'undefined' && value !== null) {
this.filteredValue.splice(0, 1, value);
} else {
this.filteredValue.splice(0, 1);
}
}
}
},
filteredValue: {
get: function get() {
if (this.column) {
return this.column.filteredValue || [];
}
return [];
},
set: function set(value) {
if (this.column) {
this.column.filteredValue = value;
}
}
},
multiple: function multiple() {
if (this.column) {
return this.column.filterMultiple;
}
return true;
}
},
mounted: function mounted() {
var _this = this;
this.popperElm = this.$el;
this.referenceElm = this.cell;
this.table.bodyWrapper.addEventListener('scroll', function () {
_this.updatePopper();
});
this.$watch('showPopper', function (value) {
if (_this.column) _this.column.filterOpened = value;
if (value) {
_dropdown2.default.open(_this);
} else {
_dropdown2.default.close(_this);
}
});
},
watch: {
showPopper: function showPopper(val) {
if (val === true && parseInt(this.popperJS._popper.style.zIndex, 10) < _popup.PopupManager.zIndex) {
this.popperJS._popper.style.zIndex = _popup.PopupManager.nextZIndex();
}
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 142 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var dropdowns = [];
!_vue2.default.prototype.$isServer && document.addEventListener('click', function (event) {
dropdowns.forEach(function (dropdown) {
var target = event.target;
if (!dropdown || !dropdown.$el) return;
if (target === dropdown.$el || dropdown.$el.contains(target)) {
return;
}
dropdown.handleOutsideClick && dropdown.handleOutsideClick(event);
});
});
exports.default = {
open: function open(instance) {
if (instance) {
dropdowns.push(instance);
}
},
close: function close(instance) {
var index = dropdowns.indexOf(instance);
if (index !== -1) {
dropdowns.splice(instance, 1);
}
}
};
/***/ },
/* 143 */
/***/ function(module, exports) {
module.exports = __webpack_require__(43);
/***/ },
/* 144 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
}
}, [(_vm.multiple) ? _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showPopper),
expression: "showPopper"
}],
staticClass: "el-table-filter"
}, [_c('div', {
staticClass: "el-table-filter__content"
}, [_c('el-checkbox-group', {
staticClass: "el-table-filter__checkbox-group",
model: {
value: (_vm.filteredValue),
callback: function($$v) {
_vm.filteredValue = $$v
},
expression: "filteredValue"
}
}, _vm._l((_vm.filters), function(filter) {
return _c('el-checkbox', {
key: filter.value,
attrs: {
"label": filter.value
}
}, [_vm._v(_vm._s(filter.text))])
}))], 1), _c('div', {
staticClass: "el-table-filter__bottom"
}, [_c('button', {
class: {
'is-disabled': _vm.filteredValue.length === 0
},
attrs: {
"disabled": _vm.filteredValue.length === 0
},
on: {
"click": _vm.handleConfirm
}
}, [_vm._v(_vm._s(_vm.t('el.table.confirmFilter')))]), _c('button', {
on: {
"click": _vm.handleReset
}
}, [_vm._v(_vm._s(_vm.t('el.table.resetFilter')))])])]) : _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showPopper),
expression: "showPopper"
}],
staticClass: "el-table-filter"
}, [_c('ul', {
staticClass: "el-table-filter__list"
}, [_c('li', {
staticClass: "el-table-filter__list-item",
class: {
'is-active': !_vm.filterValue
},
on: {
"click": function($event) {
_vm.handleSelect(null)
}
}
}, [_vm._v(_vm._s(_vm.t('el.table.clearFilter')))]), _vm._l((_vm.filters), function(filter) {
return _c('li', {
key: filter.value,
staticClass: "el-table-filter__list-item",
class: {
'is-active': _vm.isActive(filter)
},
attrs: {
"label": filter.value
},
on: {
"click": function($event) {
_vm.handleSelect(filter.value)
}
}
}, [_vm._v(_vm._s(filter.text))])
})], 2)])])
},staticRenderFns: []}
/***/ },
/* 145 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.default = {
name: 'ElTableFooter',
render: function render(h) {
var _this = this;
var sums = [];
this.columns.forEach(function (column, index) {
if (index === 0) {
sums[index] = _this.sumText;
return;
}
var values = _this.store.states.data.map(function (item) {
return Number(item[column.property]);
});
var precisions = [];
var notNumber = true;
values.forEach(function (value) {
if (!isNaN(value)) {
notNumber = false;
var decimal = ('' + value).split('.')[1];
precisions.push(decimal ? decimal.length : 0);
}
});
var precision = Math.max.apply(null, precisions);
if (!notNumber) {
sums[index] = values.reduce(function (prev, curr) {
var value = Number(curr);
if (!isNaN(value)) {
return parseFloat((prev + curr).toFixed(precision));
} else {
return prev;
}
}, 0);
} else {
sums[index] = '';
}
});
return h(
'table',
{
'class': 'el-table__footer',
attrs: { cellspacing: '0',
cellpadding: '0',
border: '0' }
},
[h(
'colgroup',
null,
[this._l(this.columns, function (column) {
return h(
'col',
{
attrs: {
name: column.id,
width: column.realWidth || column.width
}
},
[]
);
}), !this.fixed && this.layout.gutterWidth ? h(
'col',
{
attrs: { name: 'gutter', width: this.layout.scrollY ? this.layout.gutterWidth : '' }
},
[]
) : '']
), h(
'tbody',
null,
[h(
'tr',
null,
[this._l(this.columns, function (column, cellIndex) {
return h(
'td',
{
attrs: {
colspan: column.colSpan,
rowspan: column.rowSpan
},
'class': [column.id, column.headerAlign, column.className || '', _this.isCellHidden(cellIndex, _this.columns) ? 'is-hidden' : '', !column.children ? 'is-leaf' : '', column.labelClassName] },
[h(
'div',
{ 'class': ['cell', column.labelClassName] },
[_this.summaryMethod ? _this.summaryMethod({ columns: _this.columns, data: _this.store.states.data })[cellIndex] : sums[cellIndex]]
)]
);
}), !this.fixed && this.layout.gutterWidth ? h(
'td',
{ 'class': 'gutter', style: { width: this.layout.scrollY ? this.layout.gutterWidth + 'px' : '0' } },
[]
) : '']
)]
)]
);
},
props: {
fixed: String,
store: {
required: true
},
layout: {
required: true
},
summaryMethod: Function,
sumText: String,
border: Boolean,
defaultSort: {
type: Object,
default: function _default() {
return {
prop: '',
order: ''
};
}
}
},
computed: {
isAllSelected: function isAllSelected() {
return this.store.states.isAllSelected;
},
columnsCount: function columnsCount() {
return this.store.states.columns.length;
},
leftFixedCount: function leftFixedCount() {
return this.store.states.fixedColumns.length;
},
rightFixedCount: function rightFixedCount() {
return this.store.states.rightFixedColumns.length;
},
columns: function columns() {
return this.store.states.columns;
}
},
methods: {
isCellHidden: function isCellHidden(index, columns) {
if (this.fixed === true || this.fixed === 'left') {
return index >= this.leftFixedCount;
} else if (this.fixed === 'right') {
var before = 0;
for (var i = 0; i < index; i++) {
before += columns[i].colSpan;
}
return before < this.columnsCount - this.rightFixedCount;
} else {
return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
}
}
}
};
/***/ },
/* 146 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-table",
class: {
'el-table--fit': _vm.fit,
'el-table--striped': _vm.stripe,
'el-table--border': _vm.border,
'el-table--fluid-height': _vm.maxHeight,
'el-table--enable-row-hover': !_vm.store.states.isComplex,
'el-table--enable-row-transition': (_vm.store.states.data || []).length !== 0 && (_vm.store.states.data || []).length < 100
},
on: {
"mouseleave": function($event) {
_vm.handleMouseLeave($event)
}
}
}, [_c('div', {
ref: "hiddenColumns",
staticClass: "hidden-columns"
}, [_vm._t("default")], 2), (_vm.showHeader) ? _c('div', {
ref: "headerWrapper",
staticClass: "el-table__header-wrapper"
}, [_c('table-header', {
style: ({
width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + 'px' : ''
}),
attrs: {
"store": _vm.store,
"layout": _vm.layout,
"border": _vm.border,
"default-sort": _vm.defaultSort
}
})], 1) : _vm._e(), _c('div', {
ref: "bodyWrapper",
staticClass: "el-table__body-wrapper",
style: ([_vm.bodyHeight])
}, [_c('table-body', {
style: ({
width: _vm.bodyWidth
}),
attrs: {
"context": _vm.context,
"store": _vm.store,
"stripe": _vm.stripe,
"layout": _vm.layout,
"row-class-name": _vm.rowClassName,
"row-style": _vm.rowStyle,
"highlight": _vm.highlightCurrentRow
}
}), (!_vm.data || _vm.data.length === 0) ? _c('div', {
staticClass: "el-table__empty-block",
style: ({
width: _vm.bodyWidth
})
}, [_c('span', {
staticClass: "el-table__empty-text"
}, [_vm._t("empty", [_vm._v(_vm._s(_vm.emptyText || _vm.t('el.table.emptyText')))])], 2)]) : _vm._e()], 1), (_vm.showSummary) ? _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.data && _vm.data.length > 0),
expression: "data && data.length > 0"
}],
ref: "footerWrapper",
staticClass: "el-table__footer-wrapper"
}, [_c('table-footer', {
style: ({
width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + 'px' : ''
}),
attrs: {
"store": _vm.store,
"layout": _vm.layout,
"border": _vm.border,
"sum-text": _vm.sumText || _vm.t('el.table.sumText'),
"summary-method": _vm.summaryMethod,
"default-sort": _vm.defaultSort
}
})], 1) : _vm._e(), (_vm.fixedColumns.length > 0) ? _c('div', {
ref: "fixedWrapper",
staticClass: "el-table__fixed",
style: ([{
width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : ''
},
_vm.fixedHeight
])
}, [(_vm.showHeader) ? _c('div', {
ref: "fixedHeaderWrapper",
staticClass: "el-table__fixed-header-wrapper"
}, [_c('table-header', {
style: ({
width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : ''
}),
attrs: {
"fixed": "left",
"border": _vm.border,
"store": _vm.store,
"layout": _vm.layout
}
})], 1) : _vm._e(), _c('div', {
ref: "fixedBodyWrapper",
staticClass: "el-table__fixed-body-wrapper",
style: ([{
top: _vm.layout.headerHeight + 'px'
},
_vm.fixedBodyHeight
])
}, [_c('table-body', {
style: ({
width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : ''
}),
attrs: {
"fixed": "left",
"store": _vm.store,
"stripe": _vm.stripe,
"layout": _vm.layout,
"highlight": _vm.highlightCurrentRow,
"row-class-name": _vm.rowClassName,
"row-style": _vm.rowStyle
}
})], 1), (_vm.showSummary) ? _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.data && _vm.data.length > 0),
expression: "data && data.length > 0"
}],
ref: "fixedFooterWrapper",
staticClass: "el-table__fixed-footer-wrapper"
}, [_c('table-footer', {
style: ({
width: _vm.layout.fixedWidth ? _vm.layout.fixedWidth + 'px' : ''
}),
attrs: {
"fixed": "left",
"border": _vm.border,
"sum-text": _vm.sumText || _vm.t('el.table.sumText'),
"summary-method": _vm.summaryMethod,
"store": _vm.store,
"layout": _vm.layout
}
})], 1) : _vm._e()]) : _vm._e(), (_vm.rightFixedColumns.length > 0) ? _c('div', {
ref: "rightFixedWrapper",
staticClass: "el-table__fixed-right",
style: ([{
width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : ''
}, {
right: _vm.layout.scrollY ? (_vm.border ? _vm.layout.gutterWidth : (_vm.layout.gutterWidth || 1)) + 'px' : ''
},
_vm.fixedHeight
])
}, [(_vm.showHeader) ? _c('div', {
ref: "rightFixedHeaderWrapper",
staticClass: "el-table__fixed-header-wrapper"
}, [_c('table-header', {
style: ({
width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : ''
}),
attrs: {
"fixed": "right",
"border": _vm.border,
"store": _vm.store,
"layout": _vm.layout
}
})], 1) : _vm._e(), _c('div', {
ref: "rightFixedBodyWrapper",
staticClass: "el-table__fixed-body-wrapper",
style: ([{
top: _vm.layout.headerHeight + 'px'
},
_vm.fixedBodyHeight
])
}, [_c('table-body', {
style: ({
width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : ''
}),
attrs: {
"fixed": "right",
"store": _vm.store,
"stripe": _vm.stripe,
"layout": _vm.layout,
"row-class-name": _vm.rowClassName,
"row-style": _vm.rowStyle,
"highlight": _vm.highlightCurrentRow
}
})], 1), (_vm.showSummary) ? _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.data && _vm.data.length > 0),
expression: "data && data.length > 0"
}],
ref: "rightFixedFooterWrapper",
staticClass: "el-table__fixed-footer-wrapper"
}, [_c('table-footer', {
style: ({
width: _vm.layout.rightFixedWidth ? _vm.layout.rightFixedWidth + 'px' : ''
}),
attrs: {
"fixed": "right",
"border": _vm.border,
"sum-text": _vm.sumText || _vm.t('el.table.sumText'),
"summary-method": _vm.summaryMethod,
"store": _vm.store,
"layout": _vm.layout
}
})], 1) : _vm._e()]) : _vm._e(), (_vm.rightFixedColumns.length > 0) ? _c('div', {
staticClass: "el-table__fixed-right-patch",
style: ({
width: _vm.layout.scrollY ? _vm.layout.gutterWidth + 'px' : '0',
height: _vm.layout.headerHeight + 'px'
})
}) : _vm._e(), _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.resizeProxyVisible),
expression: "resizeProxyVisible"
}],
ref: "resizeProxy",
staticClass: "el-table__column-resize-proxy"
})])
},staticRenderFns: []}
/***/ },
/* 147 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tableColumn = __webpack_require__(148);
var _tableColumn2 = _interopRequireDefault(_tableColumn);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_tableColumn2.default.install = function (Vue) {
Vue.component(_tableColumn2.default.name, _tableColumn2.default);
};
exports.default = _tableColumn2.default;
/***/ },
/* 148 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkbox = __webpack_require__(131);
var _checkbox2 = _interopRequireDefault(_checkbox);
var _tag = __webpack_require__(110);
var _tag2 = _interopRequireDefault(_tag);
var _merge = __webpack_require__(65);
var _merge2 = _interopRequireDefault(_merge);
var _util = __webpack_require__(108);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }
var columnIdSeed = 1;
var defaults = {
default: {
order: ''
},
selection: {
width: 48,
minWidth: 48,
realWidth: 48,
order: '',
className: 'el-table-column--selection'
},
expand: {
width: 48,
minWidth: 48,
realWidth: 48,
order: ''
},
index: {
width: 48,
minWidth: 48,
realWidth: 48,
order: ''
}
};
var forced = {
selection: {
renderHeader: function renderHeader(h) {
return h(
'el-checkbox',
{
nativeOn: {
'click': this.toggleAllSelection
},
attrs: {
value: this.isAllSelected }
},
[]
);
},
renderCell: function renderCell(h, _ref) {
var row = _ref.row,
column = _ref.column,
store = _ref.store,
$index = _ref.$index;
return h(
'el-checkbox',
{
attrs: {
value: store.isSelected(row),
disabled: column.selectable ? !column.selectable.call(null, row, $index) : false
},
on: {
'input': function input() {
store.commit('rowSelectedChanged', row);
}
}
},
[]
);
},
sortable: false,
resizable: false
},
index: {
renderHeader: function renderHeader(h, _ref2) {
var column = _ref2.column;
return column.label || '#';
},
renderCell: function renderCell(h, _ref3) {
var $index = _ref3.$index;
return h(
'div',
null,
[$index + 1]
);
},
sortable: false
},
expand: {
renderHeader: function renderHeader(h, _ref4) {
_objectDestructuringEmpty(_ref4);
return '';
},
renderCell: function renderCell(h, _ref5, proxy) {
var row = _ref5.row,
store = _ref5.store;
var expanded = store.states.expandRows.indexOf(row) > -1;
return h(
'div',
{ 'class': 'el-table__expand-icon ' + (expanded ? 'el-table__expand-icon--expanded' : ''),
on: {
'click': function click() {
return proxy.handleExpandClick(row);
}
}
},
[h(
'i',
{ 'class': 'el-icon el-icon-arrow-right' },
[]
)]
);
},
sortable: false,
resizable: false,
className: 'el-table__expand-column'
}
};
var getDefaultColumn = function getDefaultColumn(type, options) {
var column = {};
(0, _merge2.default)(column, defaults[type || 'default']);
for (var name in options) {
if (options.hasOwnProperty(name)) {
var value = options[name];
if (typeof value !== 'undefined') {
column[name] = value;
}
}
}
if (!column.minWidth) {
column.minWidth = 80;
}
column.realWidth = column.width || column.minWidth;
return column;
};
var DEFAULT_RENDER_CELL = function DEFAULT_RENDER_CELL(h, _ref6) {
var row = _ref6.row,
column = _ref6.column;
var property = column.property;
var value = property && property.indexOf('.') === -1 ? row[property] : (0, _util.getValueByPath)(row, property);
if (column && column.formatter) {
return column.formatter(row, column, value);
}
return value;
};
exports.default = {
name: 'ElTableColumn',
props: {
type: {
type: String,
default: 'default'
},
label: String,
className: String,
labelClassName: String,
property: String,
prop: String,
width: {},
minWidth: {},
renderHeader: Function,
sortable: {
type: [String, Boolean],
default: false
},
sortMethod: Function,
resizable: {
type: Boolean,
default: true
},
context: {},
columnKey: String,
align: String,
headerAlign: String,
showTooltipWhenOverflow: Boolean,
showOverflowTooltip: Boolean,
fixed: [Boolean, String],
formatter: Function,
selectable: Function,
reserveSelection: Boolean,
filterMethod: Function,
filteredValue: Array,
filters: Array,
filterPlacement: String,
filterMultiple: {
type: Boolean,
default: true
}
},
data: function data() {
return {
isSubColumn: false,
columns: []
};
},
beforeCreate: function beforeCreate() {
this.row = {};
this.column = {};
this.$index = 0;
},
components: {
ElCheckbox: _checkbox2.default,
ElTag: _tag2.default
},
computed: {
owner: function owner() {
var parent = this.$parent;
while (parent && !parent.tableId) {
parent = parent.$parent;
}
return parent;
}
},
created: function created() {
var _this = this;
this.customRender = this.$options.render;
this.$options.render = function (h) {
return h('div', _this.$slots.default);
};
this.columnId = (this.$parent.tableId || this.$parent.columnId + '_') + 'column_' + columnIdSeed++;
var parent = this.$parent;
var owner = this.owner;
this.isSubColumn = owner !== parent;
var type = this.type;
var width = this.width;
if (width !== undefined) {
width = parseInt(width, 10);
if (isNaN(width)) {
width = null;
}
}
var minWidth = this.minWidth;
if (minWidth !== undefined) {
minWidth = parseInt(minWidth, 10);
if (isNaN(minWidth)) {
minWidth = 80;
}
}
var isColumnGroup = false;
var column = getDefaultColumn(type, {
id: this.columnId,
columnKey: this.columnKey,
label: this.label,
className: this.className,
labelClassName: this.labelClassName,
property: this.prop || this.property,
type: type,
renderCell: null,
renderHeader: this.renderHeader,
minWidth: minWidth,
width: width,
isColumnGroup: isColumnGroup,
context: this.context,
align: this.align ? 'is-' + this.align : null,
headerAlign: this.headerAlign ? 'is-' + this.headerAlign : this.align ? 'is-' + this.align : null,
sortable: this.sortable === '' ? true : this.sortable,
sortMethod: this.sortMethod,
resizable: this.resizable,
showOverflowTooltip: this.showOverflowTooltip || this.showTooltipWhenOverflow,
formatter: this.formatter,
selectable: this.selectable,
reserveSelection: this.reserveSelection,
fixed: this.fixed === '' ? true : this.fixed,
filterMethod: this.filterMethod,
filters: this.filters,
filterable: this.filters || this.filterMethod,
filterMultiple: this.filterMultiple,
filterOpened: false,
filteredValue: this.filteredValue || [],
filterPlacement: this.filterPlacement || ''
});
(0, _merge2.default)(column, forced[type] || {});
this.columnConfig = column;
var renderCell = column.renderCell;
var _self = this;
if (type === 'expand') {
owner.renderExpanded = function (h, data) {
return _self.$scopedSlots.default ? _self.$scopedSlots.default(data) : _self.$slots.default;
};
column.renderCell = function (h, data) {
return h(
'div',
{ 'class': 'cell' },
[renderCell(h, data, this._renderProxy)]
);
};
return;
}
column.renderCell = function (h, data) {
// 未来版本移除
if (_self.$vnode.data.inlineTemplate) {
renderCell = function renderCell() {
data._self = _self.context || data._self;
if (Object.prototype.toString.call(data._self) === '[object Object]') {
for (var prop in data._self) {
if (!data.hasOwnProperty(prop)) {
data[prop] = data._self[prop];
}
}
}
// 静态内容会缓存到 _staticTrees 内,不改的话获取的静态数据就不是内部 context
data._staticTrees = _self._staticTrees;
data.$options.staticRenderFns = _self.$options.staticRenderFns;
return _self.customRender.call(data);
};
} else if (_self.$scopedSlots.default) {
renderCell = function renderCell() {
return _self.$scopedSlots.default(data);
};
}
if (!renderCell) {
renderCell = DEFAULT_RENDER_CELL;
}
return _self.showOverflowTooltip || _self.showTooltipWhenOverflow ? h(
'div',
{ 'class': 'cell el-tooltip', style: 'width:' + (data.column.realWidth || data.column.width) + 'px' },
[renderCell(h, data)]
) : h(
'div',
{ 'class': 'cell' },
[renderCell(h, data)]
);
};
},
destroyed: function destroyed() {
if (!this.$parent) return;
this.owner.store.commit('removeColumn', this.columnConfig);
},
watch: {
label: function label(newVal) {
if (this.columnConfig) {
this.columnConfig.label = newVal;
}
},
prop: function prop(newVal) {
if (this.columnConfig) {
this.columnConfig.property = newVal;
}
},
property: function property(newVal) {
if (this.columnConfig) {
this.columnConfig.property = newVal;
}
},
filters: function filters(newVal) {
if (this.columnConfig) {
this.columnConfig.filters = newVal;
}
},
filterMultiple: function filterMultiple(newVal) {
if (this.columnConfig) {
this.columnConfig.filterMultiple = newVal;
}
},
align: function align(newVal) {
if (this.columnConfig) {
this.columnConfig.align = newVal ? 'is-' + newVal : null;
if (!this.headerAlign) {
this.columnConfig.headerAlign = newVal ? 'is-' + newVal : null;
}
}
},
headerAlign: function headerAlign(newVal) {
if (this.columnConfig) {
this.columnConfig.headerAlign = 'is-' + (newVal ? newVal : this.align);
}
},
width: function width(newVal) {
if (this.columnConfig) {
this.columnConfig.width = newVal;
this.owner.store.scheduleLayout();
}
},
minWidth: function minWidth(newVal) {
if (this.columnConfig) {
this.columnConfig.minWidth = newVal;
this.owner.store.scheduleLayout();
}
},
fixed: function fixed(newVal) {
if (this.columnConfig) {
this.columnConfig.fixed = newVal;
this.owner.store.scheduleLayout();
}
},
sortable: function sortable(newVal) {
if (this.columnConfig) {
this.columnConfig.sortable = newVal;
}
}
},
mounted: function mounted() {
var owner = this.owner;
var parent = this.$parent;
var columnIndex = void 0;
if (!this.isSubColumn) {
columnIndex = [].indexOf.call(parent.$refs.hiddenColumns.children, this.$el);
} else {
columnIndex = [].indexOf.call(parent.$el.children, this.$el);
}
owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null);
}
};
/***/ },
/* 149 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _datePicker = __webpack_require__(150);
var _datePicker2 = _interopRequireDefault(_datePicker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_datePicker2.default.install = function install(Vue) {
Vue.component(_datePicker2.default.name, _datePicker2.default);
};
exports.default = _datePicker2.default;
/***/ },
/* 150 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _picker = __webpack_require__(151);
var _picker2 = _interopRequireDefault(_picker);
var _date = __webpack_require__(156);
var _date2 = _interopRequireDefault(_date);
var _dateRange = __webpack_require__(174);
var _dateRange2 = _interopRequireDefault(_dateRange);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getPanel = function getPanel(type) {
if (type === 'daterange' || type === 'datetimerange') {
return _dateRange2.default;
}
return _date2.default;
};
exports.default = {
mixins: [_picker2.default],
name: 'ElDatePicker',
props: {
type: {
type: String,
default: 'date'
}
},
watch: {
type: function type(_type) {
if (this.picker) {
this.unmountPicker();
this.panel = getPanel(_type);
this.mountPicker();
} else {
this.panel = getPanel(_type);
}
}
},
created: function created() {
this.panel = getPanel(this.type);
}
};
/***/ },
/* 151 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(152),
/* template */
__webpack_require__(155),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 152 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _clickoutside = __webpack_require__(21);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _util = __webpack_require__(153);
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var NewPopper = {
props: {
appendToBody: _vuePopper2.default.props.appendToBody,
offset: _vuePopper2.default.props.offset,
boundariesPadding: _vuePopper2.default.props.boundariesPadding
},
methods: _vuePopper2.default.methods,
data: _vuePopper2.default.data,
beforeDestroy: _vuePopper2.default.beforeDestroy
};
var DEFAULT_FORMATS = {
date: 'yyyy-MM-dd',
month: 'yyyy-MM',
datetime: 'yyyy-MM-dd HH:mm:ss',
time: 'HH:mm:ss',
week: 'yyyywWW',
timerange: 'HH:mm:ss',
daterange: 'yyyy-MM-dd',
datetimerange: 'yyyy-MM-dd HH:mm:ss',
year: 'yyyy'
};
var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'timerange', 'datetimerange'];
var DATE_FORMATTER = function DATE_FORMATTER(value, format) {
return (0, _util.formatDate)(value, format);
};
var DATE_PARSER = function DATE_PARSER(text, format) {
return (0, _util.parseDate)(text, format);
};
var RANGE_FORMATTER = function RANGE_FORMATTER(value, format, separator) {
if (Array.isArray(value) && value.length === 2) {
var start = value[0];
var end = value[1];
if (start && end) {
return (0, _util.formatDate)(start, format) + separator + (0, _util.formatDate)(end, format);
}
}
return '';
};
var RANGE_PARSER = function RANGE_PARSER(text, format, separator) {
var array = text.split(separator);
if (array.length === 2) {
var range1 = array[0];
var range2 = array[1];
return [(0, _util.parseDate)(range1, format), (0, _util.parseDate)(range2, format)];
}
return [];
};
var TYPE_VALUE_RESOLVER_MAP = {
default: {
formatter: function formatter(value) {
if (!value) return '';
return '' + value;
},
parser: function parser(text) {
if (text === undefined || text === '') return null;
return text;
}
},
week: {
formatter: function formatter(value, format) {
var date = (0, _util.formatDate)(value, format);
var week = (0, _util.getWeekNumber)(value);
date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
return date;
},
parser: function parser(text) {
var array = (text || '').split('w');
if (array.length === 2) {
var year = Number(array[0]);
var month = Number(array[1]);
if (!isNaN(year) && !isNaN(month) && month < 54) {
return text;
}
}
return null;
}
},
date: {
formatter: DATE_FORMATTER,
parser: DATE_PARSER
},
datetime: {
formatter: DATE_FORMATTER,
parser: DATE_PARSER
},
daterange: {
formatter: RANGE_FORMATTER,
parser: RANGE_PARSER
},
datetimerange: {
formatter: RANGE_FORMATTER,
parser: RANGE_PARSER
},
timerange: {
formatter: RANGE_FORMATTER,
parser: RANGE_PARSER
},
time: {
formatter: DATE_FORMATTER,
parser: DATE_PARSER
},
month: {
formatter: DATE_FORMATTER,
parser: DATE_PARSER
},
year: {
formatter: DATE_FORMATTER,
parser: DATE_PARSER
},
number: {
formatter: function formatter(value) {
if (!value) return '';
return '' + value;
},
parser: function parser(text) {
var result = Number(text);
if (!isNaN(text)) {
return result;
} else {
return null;
}
}
}
};
var PLACEMENT_MAP = {
left: 'bottom-start',
center: 'bottom',
right: 'bottom-end'
};
// only considers date-picker's value: Date or [Date, Date]
var valueEquals = function valueEquals(a, b) {
var aIsArray = a instanceof Array;
var bIsArray = b instanceof Array;
if (aIsArray && bIsArray) {
return new Date(a[0]).getTime() === new Date(b[0]).getTime() && new Date(a[1]).getTime() === new Date(b[1]).getTime();
}
if (!aIsArray && !bIsArray) {
return new Date(a).getTime() === new Date(b).getTime();
}
return false;
};
exports.default = {
mixins: [_emitter2.default, NewPopper],
props: {
size: String,
format: String,
readonly: Boolean,
placeholder: String,
disabled: Boolean,
clearable: {
type: Boolean,
default: true
},
popperClass: String,
editable: {
type: Boolean,
default: true
},
align: {
type: String,
default: 'left'
},
value: {},
defaultValue: {},
rangeSeparator: {
default: ' - '
},
pickerOptions: {}
},
components: { ElInput: _input2.default },
directives: { Clickoutside: _clickoutside2.default },
data: function data() {
return {
pickerVisible: false,
showClose: false,
currentValue: '',
unwatchPickerOptions: null
};
},
watch: {
pickerVisible: function pickerVisible(val) {
if (!val) this.dispatch('ElFormItem', 'el.form.blur');
if (this.readonly || this.disabled) return;
val ? this.showPicker() : this.hidePicker();
},
currentValue: function currentValue(val) {
if (val) return;
if (this.picker && typeof this.picker.handleClear === 'function') {
this.picker.handleClear();
} else {
this.$emit('input');
}
},
value: {
immediate: true,
handler: function handler(val) {
this.currentValue = (0, _util.isDate)(val) ? new Date(val) : val;
}
},
displayValue: function displayValue(val) {
this.$emit('change', val);
this.dispatch('ElFormItem', 'el.form.change');
}
},
computed: {
reference: function reference() {
return this.$refs.reference.$el;
},
refInput: function refInput() {
if (this.reference) return this.reference.querySelector('input');
return {};
},
valueIsEmpty: function valueIsEmpty() {
var val = this.currentValue;
if (Array.isArray(val)) {
for (var i = 0, len = val.length; i < len; i++) {
if (val[i]) {
return false;
}
}
} else {
if (val) {
return false;
}
}
return true;
},
triggerClass: function triggerClass() {
return this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date';
},
selectionMode: function selectionMode() {
if (this.type === 'week') {
return 'week';
} else if (this.type === 'month') {
return 'month';
} else if (this.type === 'year') {
return 'year';
}
return 'day';
},
haveTrigger: function haveTrigger() {
if (typeof this.showTrigger !== 'undefined') {
return this.showTrigger;
}
return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
},
displayValue: {
get: function get() {
var value = this.currentValue;
if (!value) return;
var formatter = (TYPE_VALUE_RESOLVER_MAP[this.type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
var format = DEFAULT_FORMATS[this.type];
return formatter(value, this.format || format, this.rangeSeparator);
},
set: function set(value) {
if (value) {
var type = this.type;
var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
var parsedValue = parser(value, this.format || DEFAULT_FORMATS[type], this.rangeSeparator);
if (parsedValue && this.picker) {
this.picker.value = parsedValue;
}
} else {
this.$emit('input', value);
this.picker.value = value;
}
this.$forceUpdate();
}
}
},
created: function created() {
// vue-popper
this.popperOptions = {
boundariesPadding: 0,
gpuAcceleration: false
};
this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
},
methods: {
handleMouseEnterIcon: function handleMouseEnterIcon() {
if (this.readonly || this.disabled) return;
if (!this.valueIsEmpty && this.clearable) {
this.showClose = true;
}
},
handleClickIcon: function handleClickIcon() {
if (this.readonly || this.disabled) return;
if (this.showClose) {
this.currentValue = this.$options.defaultValue || '';
this.showClose = false;
} else {
this.pickerVisible = !this.pickerVisible;
}
},
dateChanged: function dateChanged(dateA, dateB) {
if (Array.isArray(dateA)) {
var len = dateA.length;
if (!dateB) return true;
while (len--) {
if (!(0, _util.equalDate)(dateA[len], dateB[len])) return true;
}
} else {
if (!(0, _util.equalDate)(dateA, dateB)) return true;
}
return false;
},
handleClose: function handleClose() {
this.pickerVisible = false;
},
handleFocus: function handleFocus() {
var type = this.type;
if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
this.pickerVisible = true;
}
this.$emit('focus', this);
},
handleBlur: function handleBlur() {
this.$emit('blur', this);
},
handleKeydown: function handleKeydown(event) {
var keyCode = event.keyCode;
// TAB or ESC
if (keyCode === 9 || keyCode === 27) {
this.pickerVisible = false;
event.stopPropagation();
}
},
hidePicker: function hidePicker() {
if (this.picker) {
this.picker.resetView && this.picker.resetView();
this.pickerVisible = this.picker.visible = false;
this.destroyPopper();
}
},
showPicker: function showPicker() {
var _this = this;
if (this.$isServer) return;
if (!this.picker) {
this.mountPicker();
}
this.pickerVisible = this.picker.visible = true;
this.updatePopper();
if (this.currentValue instanceof Date) {
this.picker.date = new Date(this.currentValue.getTime());
} else {
this.picker.value = this.currentValue;
}
this.picker.resetView && this.picker.resetView();
this.$nextTick(function () {
_this.picker.ajustScrollTop && _this.picker.ajustScrollTop();
});
},
mountPicker: function mountPicker() {
var _this2 = this;
this.panel.defaultValue = this.defaultValue || this.currentValue;
this.picker = new _vue2.default(this.panel).$mount();
this.picker.popperClass = this.popperClass;
this.popperElm = this.picker.$el;
this.picker.width = this.reference.getBoundingClientRect().width;
this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
this.picker.selectionMode = this.selectionMode;
if (this.format) {
this.picker.format = this.format;
}
var updateOptions = function updateOptions() {
var options = _this2.pickerOptions;
if (options && options.selectableRange) {
(function () {
var ranges = options.selectableRange;
var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
var format = DEFAULT_FORMATS.timerange;
ranges = Array.isArray(ranges) ? ranges : [ranges];
_this2.picker.selectableRange = ranges.map(function (range) {
return parser(range, format, _this2.rangeSeparator);
});
})();
}
for (var option in options) {
if (options.hasOwnProperty(option) &&
// 忽略 time-picker 的该配置项
option !== 'selectableRange') {
_this2.picker[option] = options[option];
}
}
};
updateOptions();
this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
return updateOptions();
}, { deep: true });
this.$el.appendChild(this.picker.$el);
this.picker.resetView && this.picker.resetView();
this.picker.$on('dodestroy', this.doDestroy);
this.picker.$on('pick', function () {
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
// do not emit if values are same
if (!valueEquals(_this2.value, date)) {
_this2.$emit('input', date);
}
_this2.pickerVisible = _this2.picker.visible = visible;
_this2.picker.resetView && _this2.picker.resetView();
});
this.picker.$on('select-range', function (start, end) {
_this2.refInput.setSelectionRange(start, end);
_this2.refInput.focus();
});
},
unmountPicker: function unmountPicker() {
if (this.picker) {
this.picker.$destroy();
this.picker.$off();
if (typeof this.unwatchPickerOptions === 'function') {
this.unwatchPickerOptions();
}
this.picker.$el.parentNode.removeChild(this.picker.$el);
}
}
}
};
/***/ },
/* 153 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.limitRange = exports.getRangeHours = exports.nextMonth = exports.prevMonth = exports.getWeekNumber = exports.getStartDateOfMonth = exports.DAY_DURATION = exports.getFirstDayOfMonth = exports.getDayCountOfMonth = exports.parseDate = exports.formatDate = exports.isDate = exports.toDate = exports.equalDate = undefined;
var _date = __webpack_require__(154);
var _date2 = _interopRequireDefault(_date);
var _locale = __webpack_require__(112);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
_date2.default.i18n = {
dayNamesShort: weeks.map(function (week) {
return (0, _locale.t)('el.datepicker.weeks.' + week);
}),
dayNames: weeks.map(function (week) {
return (0, _locale.t)('el.datepicker.weeks.' + week);
}),
monthNamesShort: months.map(function (month) {
return (0, _locale.t)('el.datepicker.months.' + month);
}),
monthNames: months.map(function (month, index) {
return (0, _locale.t)('el.datepicker.month' + (index + 1));
})
};
var newArray = function newArray(start, end) {
var result = [];
for (var i = start; i <= end; i++) {
result.push(i);
}
return result;
};
var equalDate = exports.equalDate = function equalDate(dateA, dateB) {
return dateA === dateB || new Date(dateA).getTime() === new Date(dateB).getTime();
};
var toDate = exports.toDate = function toDate(date) {
return isDate(date) ? new Date(date) : null;
};
var isDate = exports.isDate = function isDate(date) {
if (date === null || date === undefined) return false;
if (isNaN(new Date(date).getTime())) return false;
return true;
};
var formatDate = exports.formatDate = function formatDate(date, format) {
date = toDate(date);
if (!date) return '';
return _date2.default.format(date, format || 'yyyy-MM-dd');
};
var parseDate = exports.parseDate = function parseDate(string, format) {
return _date2.default.parse(string, format || 'yyyy-MM-dd');
};
var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
if (month === 3 || month === 5 || month === 8 || month === 10) {
return 30;
}
if (month === 1) {
if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
return 29;
} else {
return 28;
}
}
return 31;
};
var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
var temp = new Date(date.getTime());
temp.setDate(1);
return temp.getDay();
};
var DAY_DURATION = exports.DAY_DURATION = 86400000;
var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
var result = new Date(year, month, 1);
var day = result.getDay();
if (day === 0) {
result.setTime(result.getTime() - DAY_DURATION * 7);
} else {
result.setTime(result.getTime() - DAY_DURATION * day);
}
return result;
};
var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) {
var date = new Date(src.getTime());
date.setHours(0, 0, 0, 0);
// Thursday in current week decides the year.
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
// January 4 is always in week 1.
var week1 = new Date(date.getFullYear(), 0, 4);
// Adjust to Thursday in week 1 and count number of weeks from date to week 1.
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7);
};
var prevMonth = exports.prevMonth = function prevMonth(src) {
var year = src.getFullYear();
var month = src.getMonth();
var date = src.getDate();
var newYear = month === 0 ? year - 1 : year;
var newMonth = month === 0 ? 11 : month - 1;
var newMonthDayCount = getDayCountOfMonth(newYear, newMonth);
if (newMonthDayCount < date) {
src.setDate(newMonthDayCount);
}
src.setMonth(newMonth);
src.setFullYear(newYear);
return new Date(src.getTime());
};
var nextMonth = exports.nextMonth = function nextMonth(src) {
var year = src.getFullYear();
var month = src.getMonth();
var date = src.getDate();
var newYear = month === 11 ? year + 1 : year;
var newMonth = month === 11 ? 0 : month + 1;
var newMonthDayCount = getDayCountOfMonth(newYear, newMonth);
if (newMonthDayCount < date) {
src.setDate(newMonthDayCount);
}
src.setMonth(newMonth);
src.setFullYear(newYear);
return new Date(src.getTime());
};
var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
var hours = [];
var disabledHours = [];
(ranges || []).forEach(function (range) {
var value = range.map(function (date) {
return date.getHours();
});
disabledHours = disabledHours.concat(newArray(value[0], value[1]));
});
if (disabledHours.length) {
for (var i = 0; i < 24; i++) {
hours[i] = disabledHours.indexOf(i) === -1;
}
} else {
for (var _i = 0; _i < 24; _i++) {
hours[_i] = false;
}
}
return hours;
};
var limitRange = exports.limitRange = function limitRange(date, ranges) {
var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'yyyy-MM-dd HH:mm:ss';
if (!ranges || !ranges.length) return date;
var len = ranges.length;
date = _date2.default.parse(_date2.default.format(date, format), format);
for (var i = 0; i < len; i++) {
var range = ranges[i];
if (date >= range[0] && date <= range[1]) {
return date;
}
}
var maxDate = ranges[0][0];
var minDate = ranges[0][0];
ranges.forEach(function (range) {
minDate = new Date(Math.min(range[0], minDate));
maxDate = new Date(Math.max(range[1], maxDate));
});
return date < minDate ? minDate : maxDate;
};
/***/ },
/* 154 */
/***/ function(module, exports) {
module.exports = __webpack_require__(44);
/***/ },
/* 155 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('el-input', {
directives: [{
name: "clickoutside",
rawName: "v-clickoutside",
value: (_vm.handleClose),
expression: "handleClose"
}],
ref: "reference",
staticClass: "el-date-editor",
class: 'el-date-editor--' + _vm.type,
attrs: {
"readonly": !_vm.editable || _vm.readonly,
"disabled": _vm.disabled,
"size": _vm.size,
"placeholder": _vm.placeholder,
"value": _vm.displayValue,
"validateEvent": false
},
on: {
"focus": _vm.handleFocus,
"blur": _vm.handleBlur
},
nativeOn: {
"keydown": function($event) {
_vm.handleKeydown($event)
},
"change": function($event) {
_vm.displayValue = $event.target.value
}
}
}, [(_vm.haveTrigger) ? _c('i', {
staticClass: "el-input__icon",
class: [_vm.showClose ? 'el-icon-close' : _vm.triggerClass],
on: {
"click": _vm.handleClickIcon,
"mouseenter": _vm.handleMouseEnterIcon,
"mouseleave": function($event) {
_vm.showClose = false
}
},
slot: "icon"
}) : _vm._e()])
},staticRenderFns: []}
/***/ },
/* 156 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(157),
/* template */
__webpack_require__(173),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 157 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _util = __webpack_require__(153);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
var _time = __webpack_require__(158);
var _time2 = _interopRequireDefault(_time);
var _yearTable = __webpack_require__(164);
var _yearTable2 = _interopRequireDefault(_yearTable);
var _monthTable = __webpack_require__(167);
var _monthTable2 = _interopRequireDefault(_monthTable);
var _dateTable = __webpack_require__(170);
var _dateTable2 = _interopRequireDefault(_dateTable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_locale2.default],
watch: {
showTime: function showTime(val) {
var _this = this;
/* istanbul ignore if */
if (!val) return;
this.$nextTick(function (_) {
var inputElm = _this.$refs.input.$el;
if (inputElm) {
_this.pickerWidth = inputElm.getBoundingClientRect().width + 10;
}
});
},
value: function value(newVal) {
if (!newVal) return;
newVal = new Date(newVal);
if (!isNaN(newVal)) {
if (typeof this.disabledDate === 'function' && this.disabledDate(new Date(newVal))) {
return;
}
this.date = newVal;
this.year = newVal.getFullYear();
this.month = newVal.getMonth();
this.$emit('pick', newVal, false);
}
},
timePickerVisible: function timePickerVisible(val) {
var _this2 = this;
if (val) this.$nextTick(function () {
return _this2.$refs.timepicker.ajustScrollTop();
});
},
selectionMode: function selectionMode(newVal) {
if (newVal === 'month') {
/* istanbul ignore next */
if (this.currentView !== 'year' || this.currentView !== 'month') {
this.currentView = 'month';
}
} else if (newVal === 'week') {
this.week = (0, _util.getWeekNumber)(this.date);
}
},
date: function date(newVal) {
this.year = newVal.getFullYear();
this.month = newVal.getMonth();
if (this.selectionMode === 'week') this.week = (0, _util.getWeekNumber)(newVal);
}
},
methods: {
handleClear: function handleClear() {
this.date = this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date();
this.$emit('pick');
},
resetDate: function resetDate() {
this.date = new Date(this.date);
},
showMonthPicker: function showMonthPicker() {
this.currentView = 'month';
},
showYearPicker: function showYearPicker() {
this.currentView = 'year';
},
// XXX: 没用到
// handleLabelClick() {
// if (this.currentView === 'date') {
// this.showMonthPicker();
// } else if (this.currentView === 'month') {
// this.showYearPicker();
// }
// },
prevMonth: function prevMonth() {
this.month--;
if (this.month < 0) {
this.month = 11;
this.year--;
}
},
nextMonth: function nextMonth() {
this.month++;
if (this.month > 11) {
this.month = 0;
this.year++;
}
},
nextYear: function nextYear() {
if (this.currentView === 'year') {
this.$refs.yearTable.nextTenYear();
} else {
this.year++;
this.date.setFullYear(this.year);
this.resetDate();
}
},
prevYear: function prevYear() {
if (this.currentView === 'year') {
this.$refs.yearTable.prevTenYear();
} else {
this.year--;
this.date.setFullYear(this.year);
this.resetDate();
}
},
handleShortcutClick: function handleShortcutClick(shortcut) {
if (shortcut.onClick) {
shortcut.onClick(this);
}
},
handleTimePick: function handleTimePick(picker, visible, first) {
if (picker) {
var oldDate = new Date(this.date.getTime());
var hour = picker.getHours();
var minute = picker.getMinutes();
var second = picker.getSeconds();
oldDate.setHours(hour);
oldDate.setMinutes(minute);
oldDate.setSeconds(second);
this.date = new Date(oldDate.getTime());
}
if (!first) {
this.timePickerVisible = visible;
}
},
handleMonthPick: function handleMonthPick(month) {
this.month = month;
var selectionMode = this.selectionMode;
if (selectionMode !== 'month') {
this.date.setMonth(month);
this.currentView = 'date';
this.resetDate();
} else {
this.date.setMonth(month);
this.year && this.date.setFullYear(this.year);
this.resetDate();
var value = new Date(this.date.getFullYear(), month, 1);
this.$emit('pick', value);
}
},
handleDatePick: function handleDatePick(value) {
if (this.selectionMode === 'day') {
if (!this.showTime) {
this.$emit('pick', new Date(value.getTime()));
}
this.date.setFullYear(value.getFullYear());
this.date.setMonth(value.getMonth(), value.getDate());
} else if (this.selectionMode === 'week') {
this.week = value.week;
this.$emit('pick', value.date);
}
this.resetDate();
},
handleYearPick: function handleYearPick(year) {
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.year = year;
if (!close) return;
this.date.setFullYear(year);
if (this.selectionMode === 'year') {
this.$emit('pick', new Date(year, 0, 1));
} else {
this.currentView = 'month';
}
this.resetDate();
},
changeToNow: function changeToNow() {
this.date.setTime(+new Date());
this.$emit('pick', new Date(this.date.getTime()));
this.resetDate();
},
confirm: function confirm() {
this.date.setMilliseconds(0);
this.$emit('pick', this.date);
},
resetView: function resetView() {
if (this.selectionMode === 'month') {
this.currentView = 'month';
} else if (this.selectionMode === 'year') {
this.currentView = 'year';
} else {
this.currentView = 'date';
}
if (this.selectionMode !== 'week') {
this.year = this.date.getFullYear();
this.month = this.date.getMonth();
}
}
},
components: {
TimePicker: _time2.default, YearTable: _yearTable2.default, MonthTable: _monthTable2.default, DateTable: _dateTable2.default, ElInput: _input2.default
},
mounted: function mounted() {
if (this.date && !this.year) {
this.year = this.date.getFullYear();
this.month = this.date.getMonth();
}
},
data: function data() {
return {
popperClass: '',
pickerWidth: 0,
date: this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date(),
value: '',
showTime: false,
selectionMode: 'day',
shortcuts: '',
visible: false,
currentView: 'date',
disabledDate: '',
firstDayOfWeek: 7,
year: null,
month: null,
week: null,
showWeekNumber: false,
timePickerVisible: false,
width: 0,
format: ''
};
},
computed: {
footerVisible: function footerVisible() {
return this.showTime;
},
visibleTime: {
get: function get() {
return (0, _util.formatDate)(this.date, this.timeFormat);
},
set: function set(val) {
if (val) {
var date = (0, _util.parseDate)(val, this.timeFormat);
if (date) {
date.setFullYear(this.date.getFullYear());
date.setMonth(this.date.getMonth());
date.setDate(this.date.getDate());
this.date = date;
this.$refs.timepicker.value = date;
this.timePickerVisible = false;
}
}
}
},
visibleDate: {
get: function get() {
return (0, _util.formatDate)(this.date, this.dateFormat);
},
set: function set(val) {
var date = (0, _util.parseDate)(val, this.dateFormat);
if (!date) {
return;
}
if (typeof this.disabledDate === 'function' && this.disabledDate(date)) {
return;
}
date.setHours(this.date.getHours());
date.setMinutes(this.date.getMinutes());
date.setSeconds(this.date.getSeconds());
this.date = date;
this.resetView();
}
},
yearLabel: function yearLabel() {
var year = this.year;
if (!year) return '';
var yearTranslation = this.t('el.datepicker.year');
if (this.currentView === 'year') {
var startYear = Math.floor(year / 10) * 10;
if (yearTranslation) {
return startYear + ' ' + yearTranslation + ' - ' + (startYear + 9) + ' ' + yearTranslation;
}
return startYear + ' - ' + (startYear + 9);
}
return this.year + ' ' + yearTranslation;
},
timeFormat: function timeFormat() {
if (this.format && this.format.indexOf('ss') === -1) {
return 'HH:mm';
} else {
return 'HH:mm:ss';
}
},
dateFormat: function dateFormat() {
if (this.format) {
return this.format.replace('HH:mm', '').replace(':ss', '').trim();
} else {
return 'yyyy-MM-dd';
}
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 158 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(159),
/* template */
__webpack_require__(163),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 159 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _util = __webpack_require__(153);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
mixins: [_locale2.default],
components: {
TimeSpinner: __webpack_require__(160)
},
props: {
pickerWidth: {},
date: {
default: function _default() {
return new Date();
}
},
visible: Boolean
},
watch: {
visible: function visible(val) {
this.currentVisible = val;
},
pickerWidth: function pickerWidth(val) {
this.width = val;
},
value: function value(newVal) {
var _this = this;
var date = void 0;
if (newVal instanceof Date) {
date = (0, _util.limitRange)(newVal, this.selectableRange);
} else if (!newVal) {
date = new Date();
}
this.handleChange({
hours: date.getHours(),
minutes: date.getMinutes(),
seconds: date.getSeconds()
});
this.$nextTick(function (_) {
return _this.ajustScrollTop();
});
},
selectableRange: function selectableRange(val) {
this.$refs.spinner.selectableRange = val;
}
},
data: function data() {
return {
popperClass: '',
format: 'HH:mm:ss',
value: '',
hours: 0,
minutes: 0,
seconds: 0,
selectableRange: [],
currentDate: this.$options.defaultValue || this.date || new Date(),
currentVisible: this.visible || false,
width: this.pickerWidth || 0
};
},
computed: {
showSeconds: function showSeconds() {
return (this.format || '').indexOf('ss') !== -1;
}
},
methods: {
handleClear: function handleClear() {
this.$emit('pick');
},
handleCancel: function handleCancel() {
this.$emit('pick');
},
handleChange: function handleChange(date) {
if (date.hours !== undefined) {
this.currentDate.setHours(date.hours);
this.hours = this.currentDate.getHours();
}
if (date.minutes !== undefined) {
this.currentDate.setMinutes(date.minutes);
this.minutes = this.currentDate.getMinutes();
}
if (date.seconds !== undefined) {
this.currentDate.setSeconds(date.seconds);
this.seconds = this.currentDate.getSeconds();
}
this.handleConfirm(true);
},
setSelectionRange: function setSelectionRange(start, end) {
this.$emit('select-range', start, end);
},
handleConfirm: function handleConfirm() {
var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var first = arguments[1];
if (first) return;
var date = new Date((0, _util.limitRange)(this.currentDate, this.selectableRange, 'HH:mm:ss'));
this.$emit('pick', date, visible, first);
},
ajustScrollTop: function ajustScrollTop() {
return this.$refs.spinner.ajustScrollTop();
}
},
created: function created() {
this.hours = this.currentDate.getHours();
this.minutes = this.currentDate.getMinutes();
this.seconds = this.currentDate.getSeconds();
},
mounted: function mounted() {
var _this2 = this;
this.$nextTick(function () {
return _this2.handleConfirm(true, true);
});
this.$emit('mounted');
}
};
/***/ },
/* 160 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(161),
/* template */
__webpack_require__(162),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 161 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _util = __webpack_require__(153);
var _scrollbar = __webpack_require__(25);
var _scrollbar2 = _interopRequireDefault(_scrollbar);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
components: { ElScrollbar: _scrollbar2.default },
props: {
hours: {
type: Number,
default: 0
},
minutes: {
type: Number,
default: 0
},
seconds: {
type: Number,
default: 0
},
showSeconds: {
type: Boolean,
default: true
}
},
watch: {
hoursPrivate: function hoursPrivate(newVal, oldVal) {
if (!(newVal >= 0 && newVal <= 23)) {
this.hoursPrivate = oldVal;
}
this.ajustElTop('hour', newVal);
this.$emit('change', { hours: newVal });
},
minutesPrivate: function minutesPrivate(newVal, oldVal) {
if (!(newVal >= 0 && newVal <= 59)) {
this.minutesPrivate = oldVal;
}
this.ajustElTop('minute', newVal);
this.$emit('change', { minutes: newVal });
},
secondsPrivate: function secondsPrivate(newVal, oldVal) {
if (!(newVal >= 0 && newVal <= 59)) {
this.secondsPrivate = oldVal;
}
this.ajustElTop('second', newVal);
this.$emit('change', { seconds: newVal });
}
},
computed: {
hoursList: function hoursList() {
return (0, _util.getRangeHours)(this.selectableRange);
},
hourEl: function hourEl() {
return this.$refs.hour.wrap;
},
minuteEl: function minuteEl() {
return this.$refs.minute.wrap;
},
secondEl: function secondEl() {
return this.$refs.second.wrap;
}
},
data: function data() {
return {
hoursPrivate: 0,
minutesPrivate: 0,
secondsPrivate: 0,
selectableRange: []
};
},
created: function created() {
var _this = this;
this.debounceAjustElTop = (0, _debounce2.default)(100, function (type) {
return _this.ajustElTop(type, _this[type + 's']);
});
},
mounted: function mounted() {
var _this2 = this;
this.$nextTick(function () {
_this2.bindScrollEvent();
});
},
methods: {
handleClick: function handleClick(type, value, disabled) {
if (value.disabled) {
return;
}
this[type + 'Private'] = value.value >= 0 ? value.value : value;
this.emitSelectRange(type);
},
emitSelectRange: function emitSelectRange(type) {
if (type === 'hours') {
this.$emit('select-range', 0, 2);
} else if (type === 'minutes') {
this.$emit('select-range', 3, 5);
} else if (type === 'seconds') {
this.$emit('select-range', 6, 8);
}
},
bindScrollEvent: function bindScrollEvent() {
var _this3 = this;
var bindFuntion = function bindFuntion(type) {
_this3[type + 'El'].onscroll = function (e) {
return _this3.handleScroll(type, e);
};
};
bindFuntion('hour');
bindFuntion('minute');
bindFuntion('second');
},
handleScroll: function handleScroll(type) {
var ajust = {};
ajust[type + 's'] = Math.min(Math.floor((this[type + 'El'].scrollTop - 80) / 32 + 3), 59);
this.debounceAjustElTop(type);
this.$emit('change', ajust);
},
ajustScrollTop: function ajustScrollTop() {
this.ajustElTop('hour', this.hours);
this.ajustElTop('minute', this.minutes);
this.ajustElTop('second', this.seconds);
},
ajustElTop: function ajustElTop(type, value) {
this[type + 'El'].scrollTop = Math.max(0, (value - 2.5) * 32 + 80);
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 162 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-time-spinner",
class: {
'has-seconds': _vm.showSeconds
}
}, [_c('el-scrollbar', {
ref: "hour",
staticClass: "el-time-spinner__wrapper",
attrs: {
"wrap-style": "max-height: inherit;",
"view-class": "el-time-spinner__list",
"noresize": "",
"tag": "ul"
},
nativeOn: {
"mouseenter": function($event) {
_vm.emitSelectRange('hours')
}
}
}, _vm._l((_vm.hoursList), function(disabled, hour) {
return _c('li', {
staticClass: "el-time-spinner__item",
class: {
'active': hour === _vm.hours, 'disabled': disabled
},
attrs: {
"track-by": "hour"
},
domProps: {
"textContent": _vm._s(hour)
},
on: {
"click": function($event) {
_vm.handleClick('hours', {
value: hour,
disabled: disabled
}, true)
}
}
})
})), _c('el-scrollbar', {
ref: "minute",
staticClass: "el-time-spinner__wrapper",
attrs: {
"wrap-style": "max-height: inherit;",
"view-class": "el-time-spinner__list",
"noresize": "",
"tag": "ul"
},
nativeOn: {
"mouseenter": function($event) {
_vm.emitSelectRange('minutes')
}
}
}, _vm._l((60), function(minute, key) {
return _c('li', {
staticClass: "el-time-spinner__item",
class: {
'active': key === _vm.minutes
},
domProps: {
"textContent": _vm._s(key)
},
on: {
"click": function($event) {
_vm.handleClick('minutes', key, true)
}
}
})
})), _c('el-scrollbar', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showSeconds),
expression: "showSeconds"
}],
ref: "second",
staticClass: "el-time-spinner__wrapper",
attrs: {
"wrap-style": "max-height: inherit;",
"view-class": "el-time-spinner__list",
"noresize": "",
"tag": "ul"
},
nativeOn: {
"mouseenter": function($event) {
_vm.emitSelectRange('seconds')
}
}
}, _vm._l((60), function(second, key) {
return _c('li', {
staticClass: "el-time-spinner__item",
class: {
'active': key === _vm.seconds
},
domProps: {
"textContent": _vm._s(key)
},
on: {
"click": function($event) {
_vm.handleClick('seconds', key, true)
}
}
})
}))], 1)
},staticRenderFns: []}
/***/ },
/* 163 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"after-leave": function($event) {
_vm.$emit('dodestroy')
}
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentVisible),
expression: "currentVisible"
}],
staticClass: "el-time-panel",
class: _vm.popperClass,
style: ({
width: _vm.width + 'px'
})
}, [_c('div', {
staticClass: "el-time-panel__content",
class: {
'has-seconds': _vm.showSeconds
}
}, [_c('time-spinner', {
ref: "spinner",
attrs: {
"show-seconds": _vm.showSeconds,
"hours": _vm.hours,
"minutes": _vm.minutes,
"seconds": _vm.seconds
},
on: {
"change": _vm.handleChange,
"select-range": _vm.setSelectionRange
}
})], 1), _c('div', {
staticClass: "el-time-panel__footer"
}, [_c('button', {
staticClass: "el-time-panel__btn cancel",
attrs: {
"type": "button"
},
on: {
"click": _vm.handleCancel
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.cancel')))]), _c('button', {
staticClass: "el-time-panel__btn confirm",
attrs: {
"type": "button"
},
on: {
"click": function($event) {
_vm.handleConfirm()
}
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])
},staticRenderFns: []}
/***/ },
/* 164 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(165),
/* template */
__webpack_require__(166),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 165 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dom = __webpack_require__(45);
exports.default = {
props: {
disabledDate: {},
date: {},
year: {}
},
computed: {
startYear: function startYear() {
return Math.floor(this.year / 10) * 10;
}
},
methods: {
getCellStyle: function getCellStyle(year) {
var style = {};
var date = new Date(0);
date.setFullYear(year);
date.setHours(0);
var nextYear = new Date(date);
nextYear.setFullYear(year + 1);
var flag = false;
if (typeof this.disabledDate === 'function') {
while (date < nextYear) {
if (this.disabledDate(date)) {
date = new Date(date.getTime() + 8.64e7);
} else {
break;
}
}
if (date - nextYear === 0) flag = true;
}
style.disabled = flag;
style.current = Number(this.year) === year;
return style;
},
nextTenYear: function nextTenYear() {
this.$emit('pick', Number(this.year) + 10, false);
},
prevTenYear: function prevTenYear() {
this.$emit('pick', Number(this.year) - 10, false);
},
handleYearTableClick: function handleYearTableClick(event) {
var target = event.target;
if (target.tagName === 'A') {
if ((0, _dom.hasClass)(target.parentNode, 'disabled')) return;
var year = target.textContent || target.innerText;
this.$emit('pick', Number(year));
}
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 166 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('table', {
staticClass: "el-year-table",
on: {
"click": _vm.handleYearTableClick
}
}, [_c('tbody', [_c('tr', [_c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 0)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear))])]), _c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 1)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 1))])]), _c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 2)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 2))])]), _c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 3)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 3))])])]), _c('tr', [_c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 4)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 4))])]), _c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 5)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 5))])]), _c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 6)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 6))])]), _c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 7)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 7))])])]), _c('tr', [_c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 8)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 8))])]), _c('td', {
staticClass: "available",
class: _vm.getCellStyle(_vm.startYear + 9)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.startYear + 9))])]), _c('td'), _c('td')])])])
},staticRenderFns: []}
/***/ },
/* 167 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(168),
/* template */
__webpack_require__(169),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 168 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _dom = __webpack_require__(45);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
props: {
disabledDate: {},
date: {},
month: {
type: Number
}
},
mixins: [_locale2.default],
methods: {
getCellStyle: function getCellStyle(month) {
var style = {};
var year = this.date.getFullYear();
var date = new Date(0);
date.setFullYear(year);
date.setMonth(month);
date.setHours(0);
var nextMonth = new Date(date);
nextMonth.setMonth(month + 1);
var flag = false;
if (typeof this.disabledDate === 'function') {
while (date < nextMonth) {
if (this.disabledDate(date)) {
date = new Date(date.getTime() + 8.64e7);
} else {
break;
}
}
if (date - nextMonth === 0) flag = true;
}
style.disabled = flag;
style.current = this.month === month;
return style;
},
handleMonthTableClick: function handleMonthTableClick(event) {
var target = event.target;
if (target.tagName !== 'A') return;
if ((0, _dom.hasClass)(target.parentNode, 'disabled')) return;
var column = target.parentNode.cellIndex;
var row = target.parentNode.parentNode.rowIndex;
var month = row * 4 + column;
this.$emit('pick', month);
}
}
};
/***/ },
/* 169 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('table', {
staticClass: "el-month-table",
on: {
"click": _vm.handleMonthTableClick
}
}, [_c('tbody', [_c('tr', [_c('td', {
class: _vm.getCellStyle(0)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.jan')))])]), _c('td', {
class: _vm.getCellStyle(1)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.feb')))])]), _c('td', {
class: _vm.getCellStyle(2)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.mar')))])]), _c('td', {
class: _vm.getCellStyle(3)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.apr')))])])]), _c('tr', [_c('td', {
class: _vm.getCellStyle(4)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.may')))])]), _c('td', {
class: _vm.getCellStyle(5)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.jun')))])]), _c('td', {
class: _vm.getCellStyle(6)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.jul')))])]), _c('td', {
class: _vm.getCellStyle(7)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.aug')))])])]), _c('tr', [_c('td', {
class: _vm.getCellStyle(8)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.sep')))])]), _c('td', {
class: _vm.getCellStyle(9)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.oct')))])]), _c('td', {
class: _vm.getCellStyle(10)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.nov')))])]), _c('td', {
class: _vm.getCellStyle(11)
}, [_c('a', {
staticClass: "cell"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.months.dec')))])])])])])
},staticRenderFns: []}
/***/ },
/* 170 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(171),
/* template */
__webpack_require__(172),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 171 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _util = __webpack_require__(153);
var _dom = __webpack_require__(45);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _WEEKS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var clearHours = function clearHours(time) {
var cloneDate = new Date(time);
cloneDate.setHours(0, 0, 0, 0);
return cloneDate.getTime();
};
exports.default = {
mixins: [_locale2.default],
props: {
firstDayOfWeek: {
default: 7,
type: Number,
validator: function validator(val) {
return val >= 1 && val <= 7;
}
},
date: {},
year: {},
month: {},
week: {},
selectionMode: {
default: 'day'
},
showWeekNumber: {
type: Boolean,
default: false
},
disabledDate: {},
minDate: {},
maxDate: {},
rangeState: {
default: function _default() {
return {
endDate: null,
selecting: false,
row: null,
column: null
};
}
}
},
computed: {
offsetDay: function offsetDay() {
var week = this.firstDayOfWeek;
// 周日为界限,左右偏移的天数,3217654 例如周一就是 -1,目的是调整前两行日期的位置
return week > 3 ? 7 - week : -week;
},
WEEKS: function WEEKS() {
var week = this.firstDayOfWeek;
return _WEEKS.concat(_WEEKS).slice(week, week + 7);
},
monthDate: function monthDate() {
return this.date.getDate();
},
startDate: function startDate() {
return (0, _util.getStartDateOfMonth)(this.year, this.month);
},
rows: function rows() {
var date = new Date(this.year, this.month, 1);
var day = (0, _util.getFirstDayOfMonth)(date); // day of first day
var dateCountOfMonth = (0, _util.getDayCountOfMonth)(date.getFullYear(), date.getMonth());
var dateCountOfLastMonth = (0, _util.getDayCountOfMonth)(date.getFullYear(), date.getMonth() === 0 ? 11 : date.getMonth() - 1);
day = day === 0 ? 7 : day;
var offset = this.offsetDay;
var rows = this.tableRows;
var count = 1;
var firstDayPosition = void 0;
var startDate = this.startDate;
var disabledDate = this.disabledDate;
var now = clearHours(new Date());
for (var i = 0; i < 6; i++) {
var row = rows[i];
if (this.showWeekNumber) {
if (!row[0]) {
row[0] = { type: 'week', text: (0, _util.getWeekNumber)(new Date(startDate.getTime() + _util.DAY_DURATION * (i * 7 + 1))) };
}
}
for (var j = 0; j < 7; j++) {
var cell = row[this.showWeekNumber ? j + 1 : j];
if (!cell) {
cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
}
cell.type = 'normal';
var index = i * 7 + j;
var time = startDate.getTime() + _util.DAY_DURATION * (index - offset);
cell.inRange = time >= clearHours(this.minDate) && time <= clearHours(this.maxDate);
cell.start = this.minDate && time === clearHours(this.minDate);
cell.end = this.maxDate && time === clearHours(this.maxDate);
var isToday = time === now;
if (isToday) {
cell.type = 'today';
}
if (i >= 0 && i <= 1) {
if (j + i * 7 >= day + offset) {
cell.text = count++;
if (count === 2) {
firstDayPosition = i * 7 + j;
}
} else {
cell.text = dateCountOfLastMonth - (day + offset - j % 7) + 1 + i * 7;
cell.type = 'prev-month';
}
} else {
if (count <= dateCountOfMonth) {
cell.text = count++;
if (count === 2) {
firstDayPosition = i * 7 + j;
}
} else {
cell.text = count++ - dateCountOfMonth;
cell.type = 'next-month';
}
}
cell.disabled = typeof disabledDate === 'function' && disabledDate(new Date(time));
this.$set(row, this.showWeekNumber ? j + 1 : j, cell);
}
if (this.selectionMode === 'week') {
var start = this.showWeekNumber ? 1 : 0;
var end = this.showWeekNumber ? 7 : 6;
var isWeekActive = this.isWeekActive(row[start + 1]);
row[start].inRange = isWeekActive;
row[start].start = isWeekActive;
row[end].inRange = isWeekActive;
row[end].end = isWeekActive;
}
}
rows.firstDayPosition = firstDayPosition;
return rows;
}
},
watch: {
'rangeState.endDate': function rangeStateEndDate(newVal) {
this.markRange(newVal);
},
minDate: function minDate(newVal, oldVal) {
if (newVal && !oldVal) {
this.rangeState.selecting = true;
this.markRange(newVal);
} else if (!newVal) {
this.rangeState.selecting = false;
this.markRange(newVal);
} else {
this.markRange();
}
},
maxDate: function maxDate(newVal, oldVal) {
if (newVal && !oldVal) {
this.rangeState.selecting = false;
this.markRange(newVal);
this.$emit('pick', {
minDate: this.minDate,
maxDate: this.maxDate
});
}
}
},
data: function data() {
return {
tableRows: [[], [], [], [], [], []]
};
},
methods: {
getCellClasses: function getCellClasses(cell) {
var selectionMode = this.selectionMode;
var monthDate = this.monthDate;
var classes = [];
if ((cell.type === 'normal' || cell.type === 'today') && !cell.disabled) {
classes.push('available');
if (cell.type === 'today') {
classes.push('today');
}
} else {
classes.push(cell.type);
}
if (selectionMode === 'day' && (cell.type === 'normal' || cell.type === 'today') && Number(this.year) === this.date.getFullYear() && this.month === this.date.getMonth() && monthDate === Number(cell.text)) {
classes.push('current');
}
if (cell.inRange && (cell.type === 'normal' || cell.type === 'today' || this.selectionMode === 'week')) {
classes.push('in-range');
if (cell.start) {
classes.push('start-date');
}
if (cell.end) {
classes.push('end-date');
}
}
if (cell.disabled) {
classes.push('disabled');
}
return classes.join(' ');
},
getDateOfCell: function getDateOfCell(row, column) {
var startDate = this.startDate;
return new Date(startDate.getTime() + (row * 7 + (column - (this.showWeekNumber ? 1 : 0)) - this.offsetDay) * _util.DAY_DURATION);
},
getCellByDate: function getCellByDate(date) {
var startDate = this.startDate;
var rows = this.rows;
var index = (date - startDate) / _util.DAY_DURATION;
var row = rows[Math.floor(index / 7)];
if (this.showWeekNumber) {
return row[index % 7 + 1];
} else {
return row[index % 7];
}
},
isWeekActive: function isWeekActive(cell) {
if (this.selectionMode !== 'week') return false;
var newDate = new Date(this.year, this.month, 1);
var year = newDate.getFullYear();
var month = newDate.getMonth();
if (cell.type === 'prev-month') {
newDate.setMonth(month === 0 ? 11 : month - 1);
newDate.setFullYear(month === 0 ? year - 1 : year);
}
if (cell.type === 'next-month') {
newDate.setMonth(month === 11 ? 0 : month + 1);
newDate.setFullYear(month === 11 ? year + 1 : year);
}
newDate.setDate(parseInt(cell.text, 10));
return (0, _util.getWeekNumber)(newDate) === this.week;
},
markRange: function markRange(maxDate) {
var startDate = this.startDate;
if (!maxDate) {
maxDate = this.maxDate;
}
var rows = this.rows;
var minDate = this.minDate;
for (var i = 0, k = rows.length; i < k; i++) {
var row = rows[i];
for (var j = 0, l = row.length; j < l; j++) {
if (this.showWeekNumber && j === 0) continue;
var cell = row[j];
var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
var time = startDate.getTime() + _util.DAY_DURATION * (index - this.offsetDay);
cell.inRange = minDate && time >= clearHours(minDate) && time <= clearHours(maxDate);
cell.start = minDate && time === clearHours(minDate.getTime());
cell.end = maxDate && time === clearHours(maxDate.getTime());
}
}
},
handleMouseMove: function handleMouseMove(event) {
if (!this.rangeState.selecting) return;
this.$emit('changerange', {
minDate: this.minDate,
maxDate: this.maxDate,
rangeState: this.rangeState
});
var target = event.target;
if (target.tagName !== 'TD') return;
var column = target.cellIndex;
var row = target.parentNode.rowIndex - 1;
var _rangeState = this.rangeState,
oldRow = _rangeState.row,
oldColumn = _rangeState.column;
if (oldRow !== row || oldColumn !== column) {
this.rangeState.row = row;
this.rangeState.column = column;
this.rangeState.endDate = this.getDateOfCell(row, column);
}
},
handleClick: function handleClick(event) {
var target = event.target;
if (target.tagName !== 'TD') return;
if ((0, _dom.hasClass)(target, 'disabled') || (0, _dom.hasClass)(target, 'week')) return;
var selectionMode = this.selectionMode;
if (selectionMode === 'week') {
target = target.parentNode.cells[1];
}
var year = Number(this.year);
var month = Number(this.month);
var cellIndex = target.cellIndex;
var rowIndex = target.parentNode.rowIndex;
var cell = this.rows[rowIndex - 1][cellIndex];
var text = cell.text;
var className = target.className;
var newDate = new Date(year, month, 1);
if (className.indexOf('prev') !== -1) {
if (month === 0) {
year = year - 1;
month = 11;
} else {
month = month - 1;
}
newDate.setFullYear(year);
newDate.setMonth(month);
} else if (className.indexOf('next') !== -1) {
if (month === 11) {
year = year + 1;
month = 0;
} else {
month = month + 1;
}
newDate.setFullYear(year);
newDate.setMonth(month);
}
newDate.setDate(parseInt(text, 10));
if (this.selectionMode === 'range') {
if (this.minDate && this.maxDate) {
var minDate = new Date(newDate.getTime());
var maxDate = null;
this.$emit('pick', { minDate: minDate, maxDate: maxDate }, false);
this.rangeState.selecting = true;
this.markRange(this.minDate);
} else if (this.minDate && !this.maxDate) {
if (newDate >= this.minDate) {
var _maxDate = new Date(newDate.getTime());
this.rangeState.selecting = false;
this.$emit('pick', {
minDate: this.minDate,
maxDate: _maxDate
});
} else {
var _minDate = new Date(newDate.getTime());
this.$emit('pick', { minDate: _minDate, maxDate: this.maxDate }, false);
}
} else if (!this.minDate) {
var _minDate2 = new Date(newDate.getTime());
this.$emit('pick', { minDate: _minDate2, maxDate: this.maxDate }, false);
this.rangeState.selecting = true;
this.markRange(this.minDate);
}
} else if (selectionMode === 'day') {
this.$emit('pick', newDate);
} else if (selectionMode === 'week') {
var weekNumber = (0, _util.getWeekNumber)(newDate);
var value = newDate.getFullYear() + 'w' + weekNumber;
this.$emit('pick', {
year: newDate.getFullYear(),
week: weekNumber,
value: value,
date: newDate
});
}
}
}
};
/***/ },
/* 172 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('table', {
staticClass: "el-date-table",
class: {
'is-week-mode': _vm.selectionMode === 'week'
},
attrs: {
"cellspacing": "0",
"cellpadding": "0"
},
on: {
"click": _vm.handleClick,
"mousemove": _vm.handleMouseMove
}
}, [_c('tbody', [_c('tr', [(_vm.showWeekNumber) ? _c('th', [_vm._v(_vm._s(_vm.t('el.datepicker.week')))]) : _vm._e(), _vm._l((_vm.WEEKS), function(week) {
return _c('th', [_vm._v(_vm._s(_vm.t('el.datepicker.weeks.' + week)))])
})], 2), _vm._l((_vm.rows), function(row) {
return _c('tr', {
staticClass: "el-date-table__row",
class: {
current: _vm.isWeekActive(row[1])
}
}, _vm._l((row), function(cell) {
return _c('td', {
class: _vm.getCellClasses(cell),
domProps: {
"textContent": _vm._s(cell.type === 'today' ? _vm.t('el.datepicker.today') : cell.text)
}
})
}))
})], 2)])
},staticRenderFns: []}
/***/ },
/* 173 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"after-leave": function($event) {
_vm.$emit('dodestroy')
}
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-picker-panel el-date-picker",
class: [{
'has-sidebar': _vm.$slots.sidebar || _vm.shortcuts,
'has-time': _vm.showTime
}, _vm.popperClass],
style: ({
width: _vm.width + 'px'
})
}, [_c('div', {
staticClass: "el-picker-panel__body-wrapper"
}, [_vm._t("sidebar"), (_vm.shortcuts) ? _c('div', {
staticClass: "el-picker-panel__sidebar"
}, _vm._l((_vm.shortcuts), function(shortcut) {
return _c('button', {
staticClass: "el-picker-panel__shortcut",
attrs: {
"type": "button"
},
on: {
"click": function($event) {
_vm.handleShortcutClick(shortcut)
}
}
}, [_vm._v(_vm._s(shortcut.text))])
})) : _vm._e(), _c('div', {
staticClass: "el-picker-panel__body"
}, [(_vm.showTime) ? _c('div', {
staticClass: "el-date-picker__time-header"
}, [_c('span', {
staticClass: "el-date-picker__editor-wrap"
}, [_c('el-input', {
attrs: {
"placeholder": _vm.t('el.datepicker.selectDate'),
"value": _vm.visibleDate,
"size": "small"
},
nativeOn: {
"change": function($event) {
_vm.visibleDate = $event.target.value
}
}
})], 1), _c('span', {
staticClass: "el-date-picker__editor-wrap"
}, [_c('el-input', {
ref: "input",
attrs: {
"placeholder": _vm.t('el.datepicker.selectTime'),
"value": _vm.visibleTime,
"size": "small"
},
on: {
"focus": function($event) {
_vm.timePickerVisible = !_vm.timePickerVisible
}
},
nativeOn: {
"change": function($event) {
_vm.visibleTime = $event.target.value
}
}
}), _c('time-picker', {
ref: "timepicker",
attrs: {
"date": _vm.date,
"picker-width": _vm.pickerWidth,
"visible": _vm.timePickerVisible
},
on: {
"pick": _vm.handleTimePick,
"mounted": function($event) {
_vm.$refs.timepicker.format = _vm.timeFormat
}
}
})], 1)]) : _vm._e(), _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentView !== 'time'),
expression: "currentView !== 'time'"
}],
staticClass: "el-date-picker__header"
}, [_c('button', {
staticClass: "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left",
attrs: {
"type": "button"
},
on: {
"click": _vm.prevYear
}
}), _c('button', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentView === 'date'),
expression: "currentView === 'date'"
}],
staticClass: "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-arrow-left",
attrs: {
"type": "button"
},
on: {
"click": _vm.prevMonth
}
}), _c('span', {
staticClass: "el-date-picker__header-label",
on: {
"click": _vm.showYearPicker
}
}, [_vm._v(_vm._s(_vm.yearLabel))]), _c('span', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentView === 'date'),
expression: "currentView === 'date'"
}],
staticClass: "el-date-picker__header-label",
class: {
active: _vm.currentView === 'month'
},
on: {
"click": _vm.showMonthPicker
}
}, [_vm._v(_vm._s(_vm.t(("el.datepicker.month" + (_vm.month + 1)))))]), _c('button', {
staticClass: "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right",
attrs: {
"type": "button"
},
on: {
"click": _vm.nextYear
}
}), _c('button', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentView === 'date'),
expression: "currentView === 'date'"
}],
staticClass: "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-arrow-right",
attrs: {
"type": "button"
},
on: {
"click": _vm.nextMonth
}
})]), _c('div', {
staticClass: "el-picker-panel__content"
}, [_c('date-table', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentView === 'date'),
expression: "currentView === 'date'"
}],
attrs: {
"year": _vm.year,
"month": _vm.month,
"date": _vm.date,
"week": _vm.week,
"selection-mode": _vm.selectionMode,
"first-day-of-week": _vm.firstDayOfWeek,
"disabled-date": _vm.disabledDate
},
on: {
"pick": _vm.handleDatePick
}
}), _c('year-table', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentView === 'year'),
expression: "currentView === 'year'"
}],
ref: "yearTable",
attrs: {
"year": _vm.year,
"date": _vm.date,
"disabled-date": _vm.disabledDate
},
on: {
"pick": _vm.handleYearPick
}
}), _c('month-table', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.currentView === 'month'),
expression: "currentView === 'month'"
}],
attrs: {
"month": _vm.month,
"date": _vm.date,
"disabled-date": _vm.disabledDate
},
on: {
"pick": _vm.handleMonthPick
}
})], 1)])], 2), _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.footerVisible && _vm.currentView === 'date'),
expression: "footerVisible && currentView === 'date'"
}],
staticClass: "el-picker-panel__footer"
}, [_c('a', {
staticClass: "el-picker-panel__link-btn",
attrs: {
"href": "JavaScript:"
},
on: {
"click": _vm.changeToNow
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.now')))]), _c('button', {
staticClass: "el-picker-panel__btn",
attrs: {
"type": "button"
},
on: {
"click": _vm.confirm
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])
},staticRenderFns: []}
/***/ },
/* 174 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(175),
/* template */
__webpack_require__(176),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 175 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _util = __webpack_require__(153);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _time = __webpack_require__(158);
var _time2 = _interopRequireDefault(_time);
var _dateTable = __webpack_require__(170);
var _dateTable2 = _interopRequireDefault(_dateTable);
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_locale2.default],
computed: {
btnDisabled: function btnDisabled() {
return !(this.minDate && this.maxDate && !this.selecting);
},
leftLabel: function leftLabel() {
return this.date.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.date.getMonth() + 1));
},
rightLabel: function rightLabel() {
return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.rightDate.getMonth() + 1));
},
leftYear: function leftYear() {
return this.date.getFullYear();
},
leftMonth: function leftMonth() {
return this.date.getMonth();
},
rightYear: function rightYear() {
return this.rightDate.getFullYear();
},
rightMonth: function rightMonth() {
return this.rightDate.getMonth();
},
minVisibleDate: function minVisibleDate() {
return this.minDate ? (0, _util.formatDate)(this.minDate) : '';
},
maxVisibleDate: function maxVisibleDate() {
return this.maxDate || this.minDate ? (0, _util.formatDate)(this.maxDate || this.minDate) : '';
},
minVisibleTime: function minVisibleTime() {
return this.minDate ? (0, _util.formatDate)(this.minDate, 'HH:mm:ss') : '';
},
maxVisibleTime: function maxVisibleTime() {
return this.maxDate || this.minDate ? (0, _util.formatDate)(this.maxDate || this.minDate, 'HH:mm:ss') : '';
},
rightDate: function rightDate() {
var newDate = new Date(this.date);
var month = newDate.getMonth();
newDate.setDate(1);
if (month === 11) {
newDate.setFullYear(newDate.getFullYear() + 1);
newDate.setMonth(0);
} else {
newDate.setMonth(month + 1);
}
return newDate;
}
},
data: function data() {
return {
popperClass: '',
minPickerWidth: 0,
maxPickerWidth: 0,
date: new Date(),
minDate: '',
maxDate: '',
rangeState: {
endDate: null,
selecting: false,
row: null,
column: null
},
showTime: false,
shortcuts: '',
value: '',
visible: '',
disabledDate: '',
firstDayOfWeek: 7,
minTimePickerVisible: false,
maxTimePickerVisible: false,
width: 0
};
},
watch: {
showTime: function showTime(val) {
var _this = this;
if (!val) return;
this.$nextTick(function (_) {
var minInputElm = _this.$refs.minInput.$el;
var maxInputElm = _this.$refs.maxInput.$el;
if (minInputElm) {
_this.minPickerWidth = minInputElm.getBoundingClientRect().width + 10;
}
if (maxInputElm) {
_this.maxPickerWidth = maxInputElm.getBoundingClientRect().width + 10;
}
});
},
minDate: function minDate() {
var _this2 = this;
this.$nextTick(function () {
if (_this2.maxDate && _this2.maxDate < _this2.minDate) {
var format = 'HH:mm:ss';
_this2.$refs.maxTimePicker.selectableRange = [[(0, _util.parseDate)((0, _util.formatDate)(_this2.minDate, format), format), (0, _util.parseDate)('23:59:59', format)]];
}
});
},
minTimePickerVisible: function minTimePickerVisible(val) {
var _this3 = this;
if (val) this.$nextTick(function () {
return _this3.$refs.minTimePicker.ajustScrollTop();
});
},
maxTimePickerVisible: function maxTimePickerVisible(val) {
var _this4 = this;
if (val) this.$nextTick(function () {
return _this4.$refs.maxTimePicker.ajustScrollTop();
});
},
value: function value(newVal) {
if (!newVal) {
this.minDate = null;
this.maxDate = null;
} else if (Array.isArray(newVal)) {
this.minDate = newVal[0] ? (0, _util.toDate)(newVal[0]) : null;
this.maxDate = newVal[1] ? (0, _util.toDate)(newVal[1]) : null;
if (this.minDate) this.date = new Date(this.minDate);
this.handleConfirm(true);
}
}
},
methods: {
handleClear: function handleClear() {
this.minDate = null;
this.maxDate = null;
this.handleConfirm(false);
},
handleDateInput: function handleDateInput(event, type) {
var value = event.target.value;
var parsedValue = (0, _util.parseDate)(value, 'yyyy-MM-dd');
if (parsedValue) {
if (typeof this.disabledDate === 'function' && this.disabledDate(new Date(parsedValue))) {
return;
}
var target = new Date(type === 'min' ? this.minDate : this.maxDate);
if (target) {
target.setFullYear(parsedValue.getFullYear());
target.setMonth(parsedValue.getMonth(), parsedValue.getDate());
}
}
},
handleChangeRange: function handleChangeRange(val) {
this.minDate = val.minDate;
this.maxDate = val.maxDate;
this.rangeState = val.rangeState;
},
handleDateChange: function handleDateChange(event, type) {
var value = event.target.value;
var parsedValue = (0, _util.parseDate)(value, 'yyyy-MM-dd');
if (parsedValue) {
var target = new Date(type === 'min' ? this.minDate : this.maxDate);
if (target) {
target.setFullYear(parsedValue.getFullYear());
target.setMonth(parsedValue.getMonth(), parsedValue.getDate());
}
if (type === 'min') {
if (target < this.maxDate) {
this.minDate = new Date(target.getTime());
}
} else {
if (target > this.minDate) {
this.maxDate = new Date(target.getTime());
if (this.minDate && this.minDate > this.maxDate) {
this.minDate = null;
}
}
}
}
},
handleTimeChange: function handleTimeChange(event, type) {
var value = event.target.value;
var parsedValue = (0, _util.parseDate)(value, 'HH:mm:ss');
if (parsedValue) {
var target = new Date(type === 'min' ? this.minDate : this.maxDate);
if (target) {
target.setHours(parsedValue.getHours());
target.setMinutes(parsedValue.getMinutes());
target.setSeconds(parsedValue.getSeconds());
}
if (type === 'min') {
if (target < this.maxDate) {
this.minDate = new Date(target.getTime());
}
} else {
if (target > this.minDate) {
this.maxDate = new Date(target.getTime());
}
}
this.$refs[type + 'TimePicker'].value = target;
this[type + 'TimePickerVisible'] = false;
}
},
handleRangePick: function handleRangePick(val) {
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
if (this.maxDate === val.maxDate && this.minDate === val.minDate) {
return;
}
this.onPick && this.onPick(val);
this.maxDate = val.maxDate;
this.minDate = val.minDate;
if (!close || this.showTime) return;
this.handleConfirm();
},
changeToToday: function changeToToday() {
this.date = new Date();
},
handleShortcutClick: function handleShortcutClick(shortcut) {
if (shortcut.onClick) {
shortcut.onClick(this);
}
},
resetView: function resetView() {
this.minTimePickerVisible = false;
this.maxTimePickerVisible = false;
},
setTime: function setTime(date, value) {
var oldDate = new Date(date.getTime());
var hour = value.getHours();
var minute = value.getMinutes();
var second = value.getSeconds();
oldDate.setHours(hour);
oldDate.setMinutes(minute);
oldDate.setSeconds(second);
return new Date(oldDate.getTime());
},
handleMinTimePick: function handleMinTimePick(value, visible, first) {
this.minDate = this.minDate || new Date();
if (value) {
this.minDate = this.setTime(this.minDate, value);
}
if (!first) {
this.minTimePickerVisible = visible;
}
},
handleMaxTimePick: function handleMaxTimePick(value, visible, first) {
if (!this.maxDate) {
var now = new Date();
if (now >= this.minDate) {
this.maxDate = new Date();
}
}
if (this.maxDate && value) {
this.maxDate = this.setTime(this.maxDate, value);
}
if (!first) {
this.maxTimePickerVisible = visible;
}
},
prevMonth: function prevMonth() {
this.date = (0, _util.prevMonth)(this.date);
},
nextMonth: function nextMonth() {
this.date = (0, _util.nextMonth)(this.date);
},
nextYear: function nextYear() {
var date = this.date;
date.setFullYear(date.getFullYear() + 1);
this.resetDate();
},
prevYear: function prevYear() {
var date = this.date;
date.setFullYear(date.getFullYear() - 1);
this.resetDate();
},
handleConfirm: function handleConfirm() {
var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
this.$emit('pick', [this.minDate, this.maxDate], visible);
},
resetDate: function resetDate() {
this.date = new Date(this.date);
}
},
components: { TimePicker: _time2.default, DateTable: _dateTable2.default, ElInput: _input2.default }
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 176 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"after-leave": function($event) {
_vm.$emit('dodestroy')
}
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-picker-panel el-date-range-picker",
class: [{
'has-sidebar': _vm.$slots.sidebar || _vm.shortcuts,
'has-time': _vm.showTime
}, _vm.popperClass],
style: ({
width: _vm.width + 'px'
})
}, [_c('div', {
staticClass: "el-picker-panel__body-wrapper"
}, [_vm._t("sidebar"), (_vm.shortcuts) ? _c('div', {
staticClass: "el-picker-panel__sidebar"
}, _vm._l((_vm.shortcuts), function(shortcut) {
return _c('button', {
staticClass: "el-picker-panel__shortcut",
attrs: {
"type": "button"
},
on: {
"click": function($event) {
_vm.handleShortcutClick(shortcut)
}
}
}, [_vm._v(_vm._s(shortcut.text))])
})) : _vm._e(), _c('div', {
staticClass: "el-picker-panel__body"
}, [(_vm.showTime) ? _c('div', {
staticClass: "el-date-range-picker__time-header"
}, [_c('span', {
staticClass: "el-date-range-picker__editors-wrap"
}, [_c('span', {
staticClass: "el-date-range-picker__time-picker-wrap"
}, [_c('el-input', {
ref: "minInput",
staticClass: "el-date-range-picker__editor",
attrs: {
"size": "small",
"placeholder": _vm.t('el.datepicker.startDate'),
"value": _vm.minVisibleDate
},
nativeOn: {
"input": function($event) {
_vm.handleDateInput($event, 'min')
},
"change": function($event) {
_vm.handleDateChange($event, 'min')
}
}
})], 1), _c('span', {
staticClass: "el-date-range-picker__time-picker-wrap"
}, [_c('el-input', {
staticClass: "el-date-range-picker__editor",
attrs: {
"size": "small",
"placeholder": _vm.t('el.datepicker.startTime'),
"value": _vm.minVisibleTime
},
on: {
"focus": function($event) {
_vm.minTimePickerVisible = !_vm.minTimePickerVisible
}
},
nativeOn: {
"change": function($event) {
_vm.handleTimeChange($event, 'min')
}
}
}), _c('time-picker', {
ref: "minTimePicker",
attrs: {
"picker-width": _vm.minPickerWidth,
"date": _vm.minDate,
"visible": _vm.minTimePickerVisible
},
on: {
"pick": _vm.handleMinTimePick
}
})], 1)]), _c('span', {
staticClass: "el-icon-arrow-right"
}), _c('span', {
staticClass: "el-date-range-picker__editors-wrap is-right"
}, [_c('span', {
staticClass: "el-date-range-picker__time-picker-wrap"
}, [_c('el-input', {
staticClass: "el-date-range-picker__editor",
attrs: {
"size": "small",
"placeholder": _vm.t('el.datepicker.endDate'),
"value": _vm.maxVisibleDate,
"readonly": !_vm.minDate
},
nativeOn: {
"input": function($event) {
_vm.handleDateInput($event, 'max')
},
"change": function($event) {
_vm.handleDateChange($event, 'max')
}
}
})], 1), _c('span', {
staticClass: "el-date-range-picker__time-picker-wrap"
}, [_c('el-input', {
ref: "maxInput",
staticClass: "el-date-range-picker__editor",
attrs: {
"size": "small",
"placeholder": _vm.t('el.datepicker.endTime'),
"value": _vm.maxVisibleTime,
"readonly": !_vm.minDate
},
on: {
"focus": function($event) {
_vm.minDate && (_vm.maxTimePickerVisible = !_vm.maxTimePickerVisible)
}
},
nativeOn: {
"change": function($event) {
_vm.handleTimeChange($event, 'max')
}
}
}), _c('time-picker', {
ref: "maxTimePicker",
attrs: {
"picker-width": _vm.maxPickerWidth,
"date": _vm.maxDate,
"visible": _vm.maxTimePickerVisible
},
on: {
"pick": _vm.handleMaxTimePick
}
})], 1)])]) : _vm._e(), _c('div', {
staticClass: "el-picker-panel__content el-date-range-picker__content is-left"
}, [_c('div', {
staticClass: "el-date-range-picker__header"
}, [_c('button', {
staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-left",
attrs: {
"type": "button"
},
on: {
"click": _vm.prevYear
}
}), _c('button', {
staticClass: "el-picker-panel__icon-btn el-icon-arrow-left",
attrs: {
"type": "button"
},
on: {
"click": _vm.prevMonth
}
}), _c('div', [_vm._v(_vm._s(_vm.leftLabel))])]), _c('date-table', {
attrs: {
"selection-mode": "range",
"date": _vm.date,
"year": _vm.leftYear,
"month": _vm.leftMonth,
"min-date": _vm.minDate,
"max-date": _vm.maxDate,
"range-state": _vm.rangeState,
"disabled-date": _vm.disabledDate,
"first-day-of-week": _vm.firstDayOfWeek
},
on: {
"changerange": _vm.handleChangeRange,
"pick": _vm.handleRangePick
}
})], 1), _c('div', {
staticClass: "el-picker-panel__content el-date-range-picker__content is-right"
}, [_c('div', {
staticClass: "el-date-range-picker__header"
}, [_c('button', {
staticClass: "el-picker-panel__icon-btn el-icon-d-arrow-right",
attrs: {
"type": "button"
},
on: {
"click": _vm.nextYear
}
}), _c('button', {
staticClass: "el-picker-panel__icon-btn el-icon-arrow-right",
attrs: {
"type": "button"
},
on: {
"click": _vm.nextMonth
}
}), _c('div', [_vm._v(_vm._s(_vm.rightLabel))])]), _c('date-table', {
attrs: {
"selection-mode": "range",
"date": _vm.rightDate,
"year": _vm.rightYear,
"month": _vm.rightMonth,
"min-date": _vm.minDate,
"max-date": _vm.maxDate,
"range-state": _vm.rangeState,
"disabled-date": _vm.disabledDate,
"first-day-of-week": _vm.firstDayOfWeek
},
on: {
"changerange": _vm.handleChangeRange,
"pick": _vm.handleRangePick
}
})], 1)])], 2), (_vm.showTime) ? _c('div', {
staticClass: "el-picker-panel__footer"
}, [_c('a', {
staticClass: "el-picker-panel__link-btn",
on: {
"click": _vm.handleClear
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.clear')))]), _c('button', {
staticClass: "el-picker-panel__btn",
attrs: {
"type": "button",
"disabled": _vm.btnDisabled
},
on: {
"click": function($event) {
_vm.handleConfirm()
}
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])]) : _vm._e()])])
},staticRenderFns: []}
/***/ },
/* 177 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _timeSelect = __webpack_require__(178);
var _timeSelect2 = _interopRequireDefault(_timeSelect);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_timeSelect2.default.install = function (Vue) {
Vue.component(_timeSelect2.default.name, _timeSelect2.default);
};
exports.default = _timeSelect2.default;
/***/ },
/* 178 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _picker = __webpack_require__(151);
var _picker2 = _interopRequireDefault(_picker);
var _timeSelect = __webpack_require__(179);
var _timeSelect2 = _interopRequireDefault(_timeSelect);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_picker2.default],
name: 'ElTimeSelect',
beforeCreate: function beforeCreate() {
this.type = 'time-select';
this.panel = _timeSelect2.default;
}
};
/***/ },
/* 179 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(180),
/* template */
__webpack_require__(181),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 180 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _scrollbar = __webpack_require__(25);
var _scrollbar2 = _interopRequireDefault(_scrollbar);
var _scrollIntoView = __webpack_require__(113);
var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var parseTime = function parseTime(time) {
var values = (time || '').split(':');
if (values.length >= 2) {
var hours = parseInt(values[0], 10);
var minutes = parseInt(values[1], 10);
return {
hours: hours,
minutes: minutes
};
}
/* istanbul ignore next */
return null;
};
var compareTime = function compareTime(time1, time2) {
var value1 = parseTime(time1);
var value2 = parseTime(time2);
var minutes1 = value1.minutes + value1.hours * 60;
var minutes2 = value2.minutes + value2.hours * 60;
if (minutes1 === minutes2) {
return 0;
}
return minutes1 > minutes2 ? 1 : -1;
};
var formatTime = function formatTime(time) {
return (time.hours < 10 ? '0' + time.hours : time.hours) + ':' + (time.minutes < 10 ? '0' + time.minutes : time.minutes);
};
var nextTime = function nextTime(time, step) {
var timeValue = parseTime(time);
var stepValue = parseTime(step);
var next = {
hours: timeValue.hours,
minutes: timeValue.minutes
};
next.minutes += stepValue.minutes;
next.hours += stepValue.hours;
next.hours += Math.floor(next.minutes / 60);
next.minutes = next.minutes % 60;
return formatTime(next);
};
exports.default = {
components: { ElScrollbar: _scrollbar2.default },
watch: {
value: function value(val) {
var _this = this;
if (!val) return;
if (this.minTime && compareTime(val, this.minTime) < 0) {
this.$emit('pick');
} else if (this.maxTime && compareTime(val, this.maxTime) > 0) {
this.$emit('pick');
}
this.$nextTick(function () {
return _this.scrollToOption();
});
}
},
methods: {
handleClick: function handleClick(item) {
if (!item.disabled) {
this.$emit('pick', item.value);
}
},
handleClear: function handleClear() {
this.$emit('pick');
},
scrollToOption: function scrollToOption() {
var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'selected';
var menu = this.$refs.popper.querySelector('.el-picker-panel__content');
(0, _scrollIntoView2.default)(menu, menu.getElementsByClassName(className)[0]);
},
handleMenuEnter: function handleMenuEnter() {
var _this2 = this;
this.$nextTick(function () {
return _this2.scrollToOption();
});
}
},
data: function data() {
return {
popperClass: '',
start: '09:00',
end: '18:00',
step: '00:30',
value: '',
visible: false,
minTime: '',
maxTime: '',
width: 0
};
},
computed: {
items: function items() {
var start = this.start;
var end = this.end;
var step = this.step;
var result = [];
if (start && end && step) {
var current = start;
while (compareTime(current, end) <= 0) {
result.push({
value: current,
disabled: compareTime(current, this.minTime || '-1:-1') <= 0 || compareTime(current, this.maxTime || '100:100') >= 0
});
current = nextTime(current, step);
}
}
return result;
}
}
};
/***/ },
/* 181 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"before-enter": _vm.handleMenuEnter,
"after-leave": function($event) {
_vm.$emit('dodestroy')
}
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
ref: "popper",
staticClass: "el-picker-panel time-select",
class: _vm.popperClass,
style: ({
width: _vm.width + 'px'
})
}, [_c('el-scrollbar', {
attrs: {
"noresize": "",
"wrap-class": "el-picker-panel__content"
}
}, _vm._l((_vm.items), function(item) {
return _c('div', {
staticClass: "time-select-item",
class: {
selected: _vm.value === item.value, disabled: item.disabled
},
attrs: {
"disabled": item.disabled
},
on: {
"click": function($event) {
_vm.handleClick(item)
}
}
}, [_vm._v(_vm._s(item.value))])
}))], 1)])
},staticRenderFns: []}
/***/ },
/* 182 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _timePicker = __webpack_require__(183);
var _timePicker2 = _interopRequireDefault(_timePicker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_timePicker2.default.install = function (Vue) {
Vue.component(_timePicker2.default.name, _timePicker2.default);
};
exports.default = _timePicker2.default;
/***/ },
/* 183 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _picker = __webpack_require__(151);
var _picker2 = _interopRequireDefault(_picker);
var _time = __webpack_require__(158);
var _time2 = _interopRequireDefault(_time);
var _timeRange = __webpack_require__(184);
var _timeRange2 = _interopRequireDefault(_timeRange);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_picker2.default],
name: 'ElTimePicker',
props: {
isRange: Boolean
},
data: function data() {
return {
type: ''
};
},
watch: {
isRange: function isRange(_isRange) {
if (this.picker) {
this.unmountPicker();
this.type = _isRange ? 'timerange' : 'time';
this.panel = _isRange ? _timeRange2.default : _time2.default;
this.mountPicker();
} else {
this.type = _isRange ? 'timerange' : 'time';
this.panel = _isRange ? _timeRange2.default : _time2.default;
}
}
},
created: function created() {
this.type = this.isRange ? 'timerange' : 'time';
this.panel = this.isRange ? _timeRange2.default : _time2.default;
}
};
/***/ },
/* 184 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(185),
/* template */
__webpack_require__(186),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 185 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _util = __webpack_require__(153);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _timeSpinner = __webpack_require__(160);
var _timeSpinner2 = _interopRequireDefault(_timeSpinner);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MIN_TIME = (0, _util.parseDate)('00:00:00', 'HH:mm:ss'); //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var MAX_TIME = (0, _util.parseDate)('23:59:59', 'HH:mm:ss');
var isDisabled = function isDisabled(minTime, maxTime) {
var minValue = minTime.getHours() * 3600 + minTime.getMinutes() * 60 + minTime.getSeconds();
var maxValue = maxTime.getHours() * 3600 + maxTime.getMinutes() * 60 + maxTime.getSeconds();
return minValue > maxValue;
};
var clacTime = function clacTime(time) {
time = Array.isArray(time) ? time : [time];
var minTime = time[0] || new Date();
var date = new Date();
date.setHours(date.getHours() + 1);
var maxTime = time[1] || date;
if (minTime > maxTime) return clacTime();
return { minTime: minTime, maxTime: maxTime };
};
exports.default = {
mixins: [_locale2.default],
components: { TimeSpinner: _timeSpinner2.default },
computed: {
showSeconds: function showSeconds() {
return (this.format || '').indexOf('ss') !== -1;
}
},
props: ['value'],
data: function data() {
var time = clacTime(this.$options.defaultValue);
return {
popperClass: '',
minTime: time.minTime,
maxTime: time.maxTime,
btnDisabled: isDisabled(time.minTime, time.maxTime),
maxHours: time.maxTime.getHours(),
maxMinutes: time.maxTime.getMinutes(),
maxSeconds: time.maxTime.getSeconds(),
minHours: time.minTime.getHours(),
minMinutes: time.minTime.getMinutes(),
minSeconds: time.minTime.getSeconds(),
format: 'HH:mm:ss',
visible: false,
width: 0
};
},
watch: {
value: function value(newVal) {
var _this = this;
this.panelCreated();
this.$nextTick(function (_) {
return _this.ajustScrollTop();
});
}
},
methods: {
panelCreated: function panelCreated() {
var time = clacTime(this.value);
if (time.minTime === this.minTime && time.maxTime === this.maxTime) {
return;
}
this.handleMinChange({
hours: time.minTime.getHours(),
minutes: time.minTime.getMinutes(),
seconds: time.minTime.getSeconds()
});
this.handleMaxChange({
hours: time.maxTime.getHours(),
minutes: time.maxTime.getMinutes(),
seconds: time.maxTime.getSeconds()
});
},
handleClear: function handleClear() {
this.handleCancel();
},
handleCancel: function handleCancel() {
this.$emit('pick');
},
handleChange: function handleChange() {
if (this.minTime > this.maxTime) return;
MIN_TIME.setFullYear(this.minTime.getFullYear());
MIN_TIME.setMonth(this.minTime.getMonth(), this.minTime.getDate());
MAX_TIME.setFullYear(this.maxTime.getFullYear());
MAX_TIME.setMonth(this.maxTime.getMonth(), this.maxTime.getDate());
this.$refs.minSpinner.selectableRange = [[MIN_TIME, this.maxTime]];
this.$refs.maxSpinner.selectableRange = [[this.minTime, MAX_TIME]];
this.handleConfirm(true);
},
handleMaxChange: function handleMaxChange(date) {
if (date.hours !== undefined) {
this.maxTime.setHours(date.hours);
this.maxHours = this.maxTime.getHours();
}
if (date.minutes !== undefined) {
this.maxTime.setMinutes(date.minutes);
this.maxMinutes = this.maxTime.getMinutes();
}
if (date.seconds !== undefined) {
this.maxTime.setSeconds(date.seconds);
this.maxSeconds = this.maxTime.getSeconds();
}
this.handleChange();
},
handleMinChange: function handleMinChange(date) {
if (date.hours !== undefined) {
this.minTime.setHours(date.hours);
this.minHours = this.minTime.getHours();
}
if (date.minutes !== undefined) {
this.minTime.setMinutes(date.minutes);
this.minMinutes = this.minTime.getMinutes();
}
if (date.seconds !== undefined) {
this.minTime.setSeconds(date.seconds);
this.minSeconds = this.minTime.getSeconds();
}
this.handleChange();
},
setMinSelectionRange: function setMinSelectionRange(start, end) {
this.$emit('select-range', start, end);
},
setMaxSelectionRange: function setMaxSelectionRange(start, end) {
this.$emit('select-range', start + 11, end + 11);
},
handleConfirm: function handleConfirm() {
var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var first = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var minSelectableRange = this.$refs.minSpinner.selectableRange;
var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
this.minTime = (0, _util.limitRange)(this.minTime, minSelectableRange);
this.maxTime = (0, _util.limitRange)(this.maxTime, maxSelectableRange);
if (first) return;
this.$emit('pick', [this.minTime, this.maxTime], visible, first);
},
ajustScrollTop: function ajustScrollTop() {
this.$refs.minSpinner.ajustScrollTop();
this.$refs.maxSpinner.ajustScrollTop();
}
},
mounted: function mounted() {
var _this2 = this;
this.$nextTick(function () {
return _this2.handleConfirm(true, true);
});
}
};
/***/ },
/* 186 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"before-enter": _vm.panelCreated,
"after-leave": function($event) {
_vm.$emit('dodestroy')
}
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-time-range-picker el-picker-panel",
class: _vm.popperClass,
style: ({
width: _vm.width + 'px'
})
}, [_c('div', {
staticClass: "el-time-range-picker__content"
}, [_c('div', {
staticClass: "el-time-range-picker__cell"
}, [_c('div', {
staticClass: "el-time-range-picker__header"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.startTime')))]), _c('div', {
staticClass: "el-time-range-picker__body el-time-panel__content",
class: {
'has-seconds': _vm.showSeconds
}
}, [_c('time-spinner', {
ref: "minSpinner",
attrs: {
"show-seconds": _vm.showSeconds,
"hours": _vm.minHours,
"minutes": _vm.minMinutes,
"seconds": _vm.minSeconds
},
on: {
"change": _vm.handleMinChange,
"select-range": _vm.setMinSelectionRange
}
})], 1)]), _c('div', {
staticClass: "el-time-range-picker__cell"
}, [_c('div', {
staticClass: "el-time-range-picker__header"
}, [_vm._v(_vm._s(_vm.t('el.datepicker.endTime')))]), _c('div', {
staticClass: "el-time-range-picker__body el-time-panel__content",
class: {
'has-seconds': _vm.showSeconds
}
}, [_c('time-spinner', {
ref: "maxSpinner",
attrs: {
"show-seconds": _vm.showSeconds,
"hours": _vm.maxHours,
"minutes": _vm.maxMinutes,
"seconds": _vm.maxSeconds
},
on: {
"change": _vm.handleMaxChange,
"select-range": _vm.setMaxSelectionRange
}
})], 1)])]), _c('div', {
staticClass: "el-time-panel__footer"
}, [_c('button', {
staticClass: "el-time-panel__btn cancel",
attrs: {
"type": "button"
},
on: {
"click": function($event) {
_vm.handleCancel()
}
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.cancel')))]), _c('button', {
staticClass: "el-time-panel__btn confirm",
attrs: {
"type": "button",
"disabled": _vm.btnDisabled
},
on: {
"click": function($event) {
_vm.handleConfirm()
}
}
}, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])
},staticRenderFns: []}
/***/ },
/* 187 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(188);
var _main2 = _interopRequireDefault(_main);
var _directive = __webpack_require__(191);
var _directive2 = _interopRequireDefault(_directive);
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_vue2.default.directive('popover', _directive2.default);
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.directive('popover', _directive2.default);
Vue.component(_main2.default.name, _main2.default);
};
_main2.default.directive = _directive2.default;
exports.default = _main2.default;
/***/ },
/* 188 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(189),
/* template */
__webpack_require__(190),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 189 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _dom = __webpack_require__(45);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElPopover',
mixins: [_vuePopper2.default],
props: {
trigger: {
type: String,
default: 'click',
validator: function validator(value) {
return ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1;
}
},
openDelay: {
type: Number,
default: 0
},
title: String,
disabled: Boolean,
content: String,
reference: {},
popperClass: String,
width: {},
visibleArrow: {
default: true
},
transition: {
type: String,
default: 'fade-in-linear'
}
},
watch: {
showPopper: function showPopper(newVal, oldVal) {
newVal ? this.$emit('show') : this.$emit('hide');
}
},
mounted: function mounted() {
var reference = this.reference || this.$refs.reference;
var popper = this.popper || this.$refs.popper;
if (!reference && this.$slots.reference && this.$slots.reference[0]) {
reference = this.referenceElm = this.$slots.reference[0].elm;
}
if (this.trigger === 'click') {
(0, _dom.on)(reference, 'click', this.doToggle);
(0, _dom.on)(document, 'click', this.handleDocumentClick);
} else if (this.trigger === 'hover') {
(0, _dom.on)(reference, 'mouseenter', this.handleMouseEnter);
(0, _dom.on)(popper, 'mouseenter', this.handleMouseEnter);
(0, _dom.on)(reference, 'mouseleave', this.handleMouseLeave);
(0, _dom.on)(popper, 'mouseleave', this.handleMouseLeave);
} else if (this.trigger === 'focus') {
var found = false;
if ([].slice.call(reference.children).length) {
var children = reference.childNodes;
var len = children.length;
for (var i = 0; i < len; i++) {
if (children[i].nodeName === 'INPUT' || children[i].nodeName === 'TEXTAREA') {
(0, _dom.on)(children[i], 'focus', this.doShow);
(0, _dom.on)(children[i], 'blur', this.doClose);
found = true;
break;
}
}
}
if (found) return;
if (reference.nodeName === 'INPUT' || reference.nodeName === 'TEXTAREA') {
(0, _dom.on)(reference, 'focus', this.doShow);
(0, _dom.on)(reference, 'blur', this.doClose);
} else {
(0, _dom.on)(reference, 'mousedown', this.doShow);
(0, _dom.on)(reference, 'mouseup', this.doClose);
}
}
},
methods: {
doToggle: function doToggle() {
this.showPopper = !this.showPopper;
},
doShow: function doShow() {
this.showPopper = true;
},
doClose: function doClose() {
this.showPopper = false;
},
handleMouseEnter: function handleMouseEnter() {
var _this = this;
clearTimeout(this._timer);
if (this.openDelay) {
this._timer = setTimeout(function () {
_this.showPopper = true;
}, this.openDelay);
} else {
this.showPopper = true;
}
},
handleMouseLeave: function handleMouseLeave() {
var _this2 = this;
clearTimeout(this._timer);
this._timer = setTimeout(function () {
_this2.showPopper = false;
}, 200);
},
handleDocumentClick: function handleDocumentClick(e) {
var reference = this.reference || this.$refs.reference;
var popper = this.popper || this.$refs.popper;
if (!reference && this.$slots.reference && this.$slots.reference[0]) {
reference = this.referenceElm = this.$slots.reference[0].elm;
}
if (!this.$el || !reference || this.$el.contains(e.target) || reference.contains(e.target) || !popper || popper.contains(e.target)) return;
this.showPopper = false;
}
},
destroyed: function destroyed() {
var reference = this.reference;
(0, _dom.off)(reference, 'click', this.doToggle);
(0, _dom.off)(reference, 'mouseup', this.doClose);
(0, _dom.off)(reference, 'mousedown', this.doShow);
(0, _dom.off)(reference, 'focus', this.doShow);
(0, _dom.off)(reference, 'blur', this.doClose);
(0, _dom.off)(reference, 'mouseleave', this.handleMouseLeave);
(0, _dom.off)(reference, 'mouseenter', this.handleMouseEnter);
(0, _dom.off)(document, 'click', this.handleDocumentClick);
}
};
/***/ },
/* 190 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('span', [_c('transition', {
attrs: {
"name": _vm.transition
},
on: {
"after-leave": _vm.doDestroy
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (!_vm.disabled && _vm.showPopper),
expression: "!disabled && showPopper"
}],
ref: "popper",
staticClass: "el-popover",
class: [_vm.popperClass],
style: ({
width: _vm.width + 'px'
})
}, [(_vm.title) ? _c('div', {
staticClass: "el-popover__title",
domProps: {
"textContent": _vm._s(_vm.title)
}
}) : _vm._e(), _vm._t("default", [_vm._v(_vm._s(_vm.content))])], 2)]), _vm._t("reference")], 2)
},staticRenderFns: []}
/***/ },
/* 191 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports.default = {
bind: function bind(el, binding, vnode) {
vnode.context.$refs[binding.arg].$refs.reference = el;
}
};
/***/ },
/* 192 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(193);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 193 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
var _vdom = __webpack_require__(194);
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElTooltip',
mixins: [_vuePopper2.default],
props: {
openDelay: {
type: Number,
default: 0
},
disabled: Boolean,
manual: Boolean,
effect: {
type: String,
default: 'dark'
},
popperClass: String,
content: String,
visibleArrow: {
default: true
},
transition: {
type: String,
default: 'el-fade-in-linear'
},
popperOptions: {
default: function _default() {
return {
boundariesPadding: 10,
gpuAcceleration: false
};
}
},
enterable: {
type: Boolean,
default: true
}
},
beforeCreate: function beforeCreate() {
var _this = this;
if (this.$isServer) return;
this.popperVM = new _vue2.default({
data: { node: '' },
render: function render(h) {
return this.node;
}
}).$mount();
this.debounceClose = (0, _debounce2.default)(200, function () {
return _this.handleClosePopper();
});
},
render: function render(h) {
var _this2 = this;
if (this.popperVM) {
this.popperVM.node = h(
'transition',
{
attrs: {
name: this.transition
},
on: {
'afterLeave': this.doDestroy
}
},
[h(
'div',
{
on: {
'mouseleave': function mouseleave() {
_this2.setExpectedState(false);_this2.debounceClose();
},
'mouseenter': function mouseenter() {
_this2.setExpectedState(true);
}
},
ref: 'popper',
directives: [{
name: 'show',
value: !this.disabled && this.showPopper
}],
'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
[this.$slots.content || this.content]
)]
);
}
if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
var vnode = (0, _vdom.getFirstComponentChild)(this.$slots.default);
if (!vnode) return vnode;
var data = vnode.data = vnode.data || {};
var on = vnode.data.on = vnode.data.on || {};
var nativeOn = vnode.data.nativeOn = vnode.data.nativeOn || {};
on.mouseenter = this.addEventHandle(on.mouseenter, function () {
_this2.setExpectedState(true);_this2.handleShowPopper();
});
on.mouseleave = this.addEventHandle(on.mouseleave, function () {
_this2.setExpectedState(false);_this2.debounceClose();
});
nativeOn.mouseenter = this.addEventHandle(nativeOn.mouseenter, function () {
_this2.setExpectedState(true);_this2.handleShowPopper();
});
nativeOn.mouseleave = this.addEventHandle(nativeOn.mouseleave, function () {
_this2.setExpectedState(false);_this2.debounceClose();
});
data.staticClass = this.concatClass(data.staticClass, 'el-tooltip');
return vnode;
},
mounted: function mounted() {
this.referenceElm = this.$el;
},
methods: {
addEventHandle: function addEventHandle(old, fn) {
return old ? Array.isArray(old) ? old.concat(fn) : [old, fn] : fn;
},
concatClass: function concatClass(a, b) {
if (a && a.indexOf(b) > -1) return a;
return a ? b ? a + ' ' + b : a : b || '';
},
handleShowPopper: function handleShowPopper() {
var _this3 = this;
if (!this.expectedState || this.manual) return;
clearTimeout(this.timeout);
this.timeout = setTimeout(function () {
_this3.showPopper = true;
}, this.openDelay);
},
handleClosePopper: function handleClosePopper() {
if (this.enterable && this.expectedState || this.manual) return;
clearTimeout(this.timeout);
this.showPopper = false;
},
setExpectedState: function setExpectedState(expectedState) {
this.expectedState = expectedState;
}
}
};
/***/ },
/* 194 */
/***/ function(module, exports) {
module.exports = __webpack_require__(25);
/***/ },
/* 195 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(196);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _main2.default;
/***/ },
/* 196 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.MessageBox = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _main = __webpack_require__(197);
var _main2 = _interopRequireDefault(_main);
var _merge = __webpack_require__(65);
var _merge2 = _interopRequireDefault(_merge);
var _vdom = __webpack_require__(194);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var defaults = {
title: undefined,
message: '',
type: '',
showInput: false,
showClose: true,
modalFade: true,
lockScroll: true,
closeOnClickModal: true,
closeOnPressEscape: true,
inputValue: null,
inputPlaceholder: '',
inputPattern: null,
inputValidator: null,
inputErrorMessage: '',
showConfirmButton: true,
showCancelButton: false,
confirmButtonPosition: 'right',
confirmButtonHighlight: false,
cancelButtonHighlight: false,
confirmButtonText: '',
cancelButtonText: '',
confirmButtonClass: '',
cancelButtonClass: '',
customClass: '',
beforeClose: null
};
var MessageBoxConstructor = _vue2.default.extend(_main2.default);
var currentMsg = void 0,
instance = void 0;
var msgQueue = [];
var defaultCallback = function defaultCallback(action) {
if (currentMsg) {
var callback = currentMsg.callback;
if (typeof callback === 'function') {
if (instance.showInput) {
callback(instance.inputValue, action);
} else {
callback(action);
}
}
if (currentMsg.resolve) {
if (action === 'confirm') {
if (instance.showInput) {
currentMsg.resolve({ value: instance.inputValue, action: action });
} else {
currentMsg.resolve(action);
}
} else if (action === 'cancel' && currentMsg.reject) {
currentMsg.reject(action);
}
}
}
};
var initInstance = function initInstance() {
instance = new MessageBoxConstructor({
el: document.createElement('div')
});
instance.callback = defaultCallback;
};
var showNextMsg = function showNextMsg() {
if (!instance) {
initInstance();
}
instance.action = '';
if (!instance.visible || instance.closeTimer) {
if (msgQueue.length > 0) {
(function () {
currentMsg = msgQueue.shift();
var options = currentMsg.options;
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
instance[prop] = options[prop];
}
}
if (options.callback === undefined) {
instance.callback = defaultCallback;
}
var oldCb = instance.callback;
instance.callback = function (action, instance) {
oldCb(action, instance);
showNextMsg();
};
if ((0, _vdom.isVNode)(instance.message)) {
instance.$slots.default = [instance.message];
instance.message = null;
} else {
delete instance.$slots.default;
}
['modal', 'showClose', 'closeOnClickModal', 'closeOnPressEscape'].forEach(function (prop) {
if (instance[prop] === undefined) {
instance[prop] = true;
}
});
document.body.appendChild(instance.$el);
_vue2.default.nextTick(function () {
instance.visible = true;
});
})();
}
}
};
var MessageBox = function MessageBox(options, callback) {
if (_vue2.default.prototype.$isServer) return;
if (typeof options === 'string') {
options = {
message: options
};
if (arguments[1]) {
options.title = arguments[1];
}
if (arguments[2]) {
options.type = arguments[2];
}
} else if (options.callback && !callback) {
callback = options.callback;
}
if (typeof Promise !== 'undefined') {
return new Promise(function (resolve, reject) {
// eslint-disable-line
msgQueue.push({
options: (0, _merge2.default)({}, defaults, MessageBox.defaults, options),
callback: callback,
resolve: resolve,
reject: reject
});
showNextMsg();
});
} else {
msgQueue.push({
options: (0, _merge2.default)({}, defaults, MessageBox.defaults, options),
callback: callback
});
showNextMsg();
}
};
MessageBox.setDefaults = function (defaults) {
MessageBox.defaults = defaults;
};
MessageBox.alert = function (message, title, options) {
if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
options = title;
title = '';
}
return MessageBox((0, _merge2.default)({
title: title,
message: message,
$type: 'alert',
closeOnPressEscape: false,
closeOnClickModal: false
}, options));
};
MessageBox.confirm = function (message, title, options) {
if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
options = title;
title = '';
}
return MessageBox((0, _merge2.default)({
title: title,
message: message,
$type: 'confirm',
showCancelButton: true
}, options));
};
MessageBox.prompt = function (message, title, options) {
if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
options = title;
title = '';
}
return MessageBox((0, _merge2.default)({
title: title,
message: message,
showCancelButton: true,
showInput: true,
$type: 'prompt'
}, options));
};
MessageBox.close = function () {
instance.visible = false;
msgQueue = [];
currentMsg = null;
};
exports.default = MessageBox;
exports.MessageBox = MessageBox;
/***/ },
/* 197 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(198),
/* template */
__webpack_require__(199),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 198 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _popup = __webpack_require__(14);
var _popup2 = _interopRequireDefault(_popup);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
var _button = __webpack_require__(31);
var _button2 = _interopRequireDefault(_button);
var _dom = __webpack_require__(45);
var _locale3 = __webpack_require__(112);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var typeMap = {
success: 'circle-check',
info: 'information',
warning: 'warning',
error: 'circle-cross'
};
exports.default = {
mixins: [_popup2.default, _locale2.default],
props: {
modal: {
default: true
},
lockScroll: {
default: true
},
showClose: {
type: Boolean,
default: true
},
closeOnClickModal: {
default: true
},
closeOnPressEscape: {
default: true
}
},
components: {
ElInput: _input2.default,
ElButton: _button2.default
},
computed: {
typeClass: function typeClass() {
return this.type && typeMap[this.type] ? 'el-icon-' + typeMap[this.type] : '';
},
confirmButtonClasses: function confirmButtonClasses() {
return 'el-button--primary ' + this.confirmButtonClass;
},
cancelButtonClasses: function cancelButtonClasses() {
return '' + this.cancelButtonClass;
}
},
methods: {
getSafeClose: function getSafeClose() {
var _this = this;
var currentId = this.uid;
return function () {
_this.$nextTick(function () {
if (currentId === _this.uid) _this.doClose();
});
};
},
doClose: function doClose() {
var _this2 = this;
if (!this.visible) return;
this.visible = false;
this._closing = true;
this.onClose && this.onClose();
if (this.lockScroll) {
setTimeout(function () {
if (_this2.modal && _this2.bodyOverflow !== 'hidden') {
document.body.style.overflow = _this2.bodyOverflow;
document.body.style.paddingRight = _this2.bodyPaddingRight;
}
_this2.bodyOverflow = null;
_this2.bodyPaddingRight = null;
}, 200);
}
this.opened = false;
if (!this.transition) {
this.doAfterClose();
}
if (this.action) this.callback(this.action, this);
},
handleWrapperClick: function handleWrapperClick() {
if (this.closeOnClickModal) {
this.handleAction('cancel');
}
},
handleAction: function handleAction(action) {
if (this.$type === 'prompt' && action === 'confirm' && !this.validate()) {
return;
}
this.action = action;
if (typeof this.beforeClose === 'function') {
this.close = this.getSafeClose();
this.beforeClose(action, this, this.close);
} else {
this.doClose();
}
},
validate: function validate() {
if (this.$type === 'prompt') {
var inputPattern = this.inputPattern;
if (inputPattern && !inputPattern.test(this.inputValue || '')) {
this.editorErrorMessage = this.inputErrorMessage || (0, _locale3.t)('el.messagebox.error');
(0, _dom.addClass)(this.$refs.input.$el.querySelector('input'), 'invalid');
return false;
}
var inputValidator = this.inputValidator;
if (typeof inputValidator === 'function') {
var validateResult = inputValidator(this.inputValue);
if (validateResult === false) {
this.editorErrorMessage = this.inputErrorMessage || (0, _locale3.t)('el.messagebox.error');
(0, _dom.addClass)(this.$refs.input.$el.querySelector('input'), 'invalid');
return false;
}
if (typeof validateResult === 'string') {
this.editorErrorMessage = validateResult;
return false;
}
}
}
this.editorErrorMessage = '';
(0, _dom.removeClass)(this.$refs.input.$el.querySelector('input'), 'invalid');
return true;
}
},
watch: {
inputValue: {
immediate: true,
handler: function handler(val) {
var _this3 = this;
this.$nextTick(function (_) {
if (_this3.$type === 'prompt' && val !== null) {
_this3.validate();
}
});
}
},
visible: function visible(val) {
var _this4 = this;
if (val) this.uid++;
if (this.$type === 'alert' || this.$type === 'confirm') {
this.$nextTick(function () {
_this4.$refs.confirm.$el.focus();
});
}
if (this.$type !== 'prompt') return;
if (val) {
setTimeout(function () {
if (_this4.$refs.input && _this4.$refs.input.$el) {
_this4.$refs.input.$el.querySelector('input').focus();
}
}, 500);
} else {
this.editorErrorMessage = '';
(0, _dom.removeClass)(this.$refs.input.$el.querySelector('input'), 'invalid');
}
}
},
data: function data() {
return {
uid: 1,
title: undefined,
message: '',
type: '',
customClass: '',
showInput: false,
inputValue: null,
inputPlaceholder: '',
inputPattern: null,
inputValidator: null,
inputErrorMessage: '',
showConfirmButton: true,
showCancelButton: false,
action: '',
confirmButtonText: '',
cancelButtonText: '',
confirmButtonLoading: false,
cancelButtonLoading: false,
confirmButtonClass: '',
confirmButtonDisabled: false,
cancelButtonClass: '',
editorErrorMessage: null,
callback: null
};
}
};
/***/ },
/* 199 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "msgbox-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-message-box__wrapper",
attrs: {
"tabindex": "-1"
},
on: {
"click": function($event) {
if ($event.target !== $event.currentTarget) { return null; }
_vm.handleWrapperClick($event)
}
}
}, [_c('div', {
staticClass: "el-message-box",
class: _vm.customClass
}, [(_vm.title !== undefined) ? _c('div', {
staticClass: "el-message-box__header"
}, [_c('div', {
staticClass: "el-message-box__title"
}, [_vm._v(_vm._s(_vm.title || _vm.t('el.messagebox.title')))]), (_vm.showClose) ? _c('button', {
staticClass: "el-message-box__headerbtn",
attrs: {
"type": "button",
"aria-label": "Close"
},
on: {
"click": function($event) {
_vm.handleAction('cancel')
}
}
}, [_c('i', {
staticClass: "el-message-box__close el-icon-close"
})]) : _vm._e()]) : _vm._e(), (_vm.message !== '') ? _c('div', {
staticClass: "el-message-box__content"
}, [_c('div', {
staticClass: "el-message-box__status",
class: [_vm.typeClass]
}), _c('div', {
staticClass: "el-message-box__message",
style: ({
'margin-left': _vm.typeClass ? '50px' : '0'
})
}, [_vm._t("default", [_c('p', [_vm._v(_vm._s(_vm.message))])])], 2), _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showInput),
expression: "showInput"
}],
staticClass: "el-message-box__input"
}, [_c('el-input', {
ref: "input",
attrs: {
"placeholder": _vm.inputPlaceholder
},
nativeOn: {
"keyup": function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "enter", 13)) { return null; }
_vm.handleAction('confirm')
}
},
model: {
value: (_vm.inputValue),
callback: function($$v) {
_vm.inputValue = $$v
},
expression: "inputValue"
}
}), _c('div', {
staticClass: "el-message-box__errormsg",
style: ({
visibility: !!_vm.editorErrorMessage ? 'visible' : 'hidden'
})
}, [_vm._v(_vm._s(_vm.editorErrorMessage))])], 1)]) : _vm._e(), _c('div', {
staticClass: "el-message-box__btns"
}, [_c('el-button', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showCancelButton),
expression: "showCancelButton"
}],
class: [_vm.cancelButtonClasses],
attrs: {
"loading": _vm.cancelButtonLoading
},
nativeOn: {
"click": function($event) {
_vm.handleAction('cancel')
}
}
}, [_vm._v("\n " + _vm._s(_vm.cancelButtonText || _vm.t('el.messagebox.cancel')) + "\n ")]), _c('el-button', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showConfirmButton),
expression: "showConfirmButton"
}],
ref: "confirm",
class: [_vm.confirmButtonClasses],
attrs: {
"loading": _vm.confirmButtonLoading
},
nativeOn: {
"click": function($event) {
_vm.handleAction('confirm')
}
}
}, [_vm._v("\n " + _vm._s(_vm.confirmButtonText || _vm.t('el.messagebox.confirm')) + "\n ")])], 1)])])])
},staticRenderFns: []}
/***/ },
/* 200 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _breadcrumb = __webpack_require__(201);
var _breadcrumb2 = _interopRequireDefault(_breadcrumb);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_breadcrumb2.default.install = function (Vue) {
Vue.component(_breadcrumb2.default.name, _breadcrumb2.default);
};
exports.default = _breadcrumb2.default;
/***/ },
/* 201 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(202),
/* template */
__webpack_require__(203),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 202 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
exports.default = {
name: 'ElBreadcrumb',
props: {
separator: {
type: String,
default: '/'
}
}
};
/***/ },
/* 203 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-breadcrumb"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 204 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _breadcrumbItem = __webpack_require__(205);
var _breadcrumbItem2 = _interopRequireDefault(_breadcrumbItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_breadcrumbItem2.default.install = function (Vue) {
Vue.component(_breadcrumbItem2.default.name, _breadcrumbItem2.default);
};
exports.default = _breadcrumbItem2.default;
/***/ },
/* 205 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(206),
/* template */
__webpack_require__(207),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 206 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
exports.default = {
name: 'ElBreadcrumbItem',
props: {
to: {},
replace: Boolean
},
data: function data() {
return {
separator: ''
};
},
mounted: function mounted() {
var _this = this;
this.separator = this.$parent.separator;
var self = this;
if (this.to) {
var link = this.$refs.link;
link.addEventListener('click', function (_) {
var to = _this.to;
self.replace ? self.$router.replace(to) : self.$router.push(to);
});
}
}
};
/***/ },
/* 207 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('span', {
staticClass: "el-breadcrumb__item"
}, [_c('span', {
ref: "link",
staticClass: "el-breadcrumb__item__inner"
}, [_vm._t("default")], 2), _c('span', {
staticClass: "el-breadcrumb__separator"
}, [_vm._v(_vm._s(_vm.separator))])])
},staticRenderFns: []}
/***/ },
/* 208 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _form = __webpack_require__(209);
var _form2 = _interopRequireDefault(_form);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_form2.default.install = function (Vue) {
Vue.component(_form2.default.name, _form2.default);
};
exports.default = _form2.default;
/***/ },
/* 209 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(210),
/* template */
__webpack_require__(211),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 210 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElForm',
componentName: 'ElForm',
props: {
model: Object,
rules: Object,
labelPosition: String,
labelWidth: String,
labelSuffix: {
type: String,
default: ''
},
inline: Boolean,
showMessage: {
type: Boolean,
default: true
}
},
watch: {
rules: function rules() {
this.validate();
}
},
data: function data() {
return {
fields: []
};
},
created: function created() {
var _this = this;
this.$on('el.form.addField', function (field) {
if (field) {
_this.fields.push(field);
}
});
/* istanbul ignore next */
this.$on('el.form.removeField', function (field) {
if (field.prop) {
_this.fields.splice(_this.fields.indexOf(field), 1);
}
});
},
methods: {
resetFields: function resetFields() {
if (!this.model) {
("production") !== 'production' && console.warn('[Element Warn][Form]model is required for resetFields to work.');
return;
}
this.fields.forEach(function (field) {
field.resetField();
});
},
validate: function validate(callback) {
var _this2 = this;
if (!this.model) {
console.warn('[Element Warn][Form]model is required for validate to work!');
return;
};
var valid = true;
var count = 0;
// 如果需要验证的fields为空,调用验证时立刻返回callback
if (this.fields.length === 0 && callback) {
callback(true);
}
this.fields.forEach(function (field, index) {
field.validate('', function (errors) {
if (errors) {
valid = false;
}
if (typeof callback === 'function' && ++count === _this2.fields.length) {
callback(valid);
}
});
});
},
validateField: function validateField(prop, cb) {
var field = this.fields.filter(function (field) {
return field.prop === prop;
})[0];
if (!field) {
throw new Error('must call validateField with valid prop string!');
}
field.validate('', cb);
}
}
};
/***/ },
/* 211 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('form', {
staticClass: "el-form",
class: [
_vm.labelPosition ? 'el-form--label-' + _vm.labelPosition : '', {
'el-form--inline': _vm.inline
}
]
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 212 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _formItem = __webpack_require__(213);
var _formItem2 = _interopRequireDefault(_formItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_formItem2.default.install = function (Vue) {
Vue.component(_formItem2.default.name, _formItem2.default);
};
exports.default = _formItem2.default;
/***/ },
/* 213 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(214),
/* template */
__webpack_require__(216),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 214 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _asyncValidator = __webpack_require__(215);
var _asyncValidator2 = _interopRequireDefault(_asyncValidator);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
function noop() {}
function getPropByPath(obj, path) {
var tempObj = obj;
path = path.replace(/\[(\w+)\]/g, '.$1');
path = path.replace(/^\./, '');
var keyArr = path.split('.');
var i = 0;
for (var len = keyArr.length; i < len - 1; ++i) {
var key = keyArr[i];
if (key in tempObj) {
tempObj = tempObj[key];
} else {
throw new Error('please transfer a valid prop path to form item!');
}
}
return {
o: tempObj,
k: keyArr[i],
v: tempObj[keyArr[i]]
};
}
exports.default = {
name: 'ElFormItem',
componentName: 'ElFormItem',
mixins: [_emitter2.default],
props: {
label: String,
labelWidth: String,
prop: String,
required: Boolean,
rules: [Object, Array],
error: String,
validateStatus: String,
showMessage: {
type: Boolean,
default: true
}
},
watch: {
error: function error(value) {
this.validateMessage = value;
this.validateState = value ? 'error' : '';
},
validateStatus: function validateStatus(value) {
this.validateState = value;
}
},
computed: {
labelStyle: function labelStyle() {
var ret = {};
if (this.form.labelPosition === 'top') return ret;
var labelWidth = this.labelWidth || this.form.labelWidth;
if (labelWidth) {
ret.width = labelWidth;
}
return ret;
},
contentStyle: function contentStyle() {
var ret = {};
var label = this.label;
if (this.form.labelPosition === 'top' || this.form.inline) return ret;
if (!label && !this.labelWidth && this.isNested) return ret;
var labelWidth = this.labelWidth || this.form.labelWidth;
if (labelWidth) {
ret.marginLeft = labelWidth;
}
return ret;
},
form: function form() {
var parent = this.$parent;
var parentName = parent.$options.componentName;
while (parentName !== 'ElForm') {
if (parentName === 'ElFormItem') {
this.isNested = true;
}
parent = parent.$parent;
parentName = parent.$options.componentName;
}
return parent;
},
fieldValue: {
cache: false,
get: function get() {
var model = this.form.model;
if (!model || !this.prop) {
return;
}
var path = this.prop;
if (path.indexOf(':') !== -1) {
path = path.replace(/:/, '.');
}
return getPropByPath(model, path).v;
}
},
isRequired: function isRequired() {
var rules = this.getRules();
var isRequired = false;
if (rules && rules.length) {
rules.every(function (rule) {
if (rule.required) {
isRequired = true;
return false;
}
return true;
});
}
return isRequired;
}
},
data: function data() {
return {
validateState: '',
validateMessage: '',
validateDisabled: false,
validator: {},
isNested: false
};
},
methods: {
validate: function validate(trigger) {
var _this = this;
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
var rules = this.getFilteredRule(trigger);
if (!rules || rules.length === 0) {
callback();
return true;
}
this.validateState = 'validating';
var descriptor = {};
descriptor[this.prop] = rules;
var validator = new _asyncValidator2.default(descriptor);
var model = {};
model[this.prop] = this.fieldValue;
validator.validate(model, { firstFields: true }, function (errors, fields) {
_this.validateState = !errors ? 'success' : 'error';
_this.validateMessage = errors ? errors[0].message : '';
callback(_this.validateMessage);
});
},
resetField: function resetField() {
this.validateState = '';
this.validateMessage = '';
var model = this.form.model;
var value = this.fieldValue;
var path = this.prop;
if (path.indexOf(':') !== -1) {
path = path.replace(/:/, '.');
}
var prop = getPropByPath(model, path);
if (Array.isArray(value)) {
this.validateDisabled = true;
prop.o[prop.k] = [].concat(this.initialValue);
} else {
this.validateDisabled = true;
prop.o[prop.k] = this.initialValue;
}
},
getRules: function getRules() {
var formRules = this.form.rules;
var selfRuels = this.rules;
formRules = formRules ? formRules[this.prop] : [];
return [].concat(selfRuels || formRules || []);
},
getFilteredRule: function getFilteredRule(trigger) {
var rules = this.getRules();
return rules.filter(function (rule) {
return !rule.trigger || rule.trigger.indexOf(trigger) !== -1;
});
},
onFieldBlur: function onFieldBlur() {
this.validate('blur');
},
onFieldChange: function onFieldChange() {
if (this.validateDisabled) {
this.validateDisabled = false;
return;
}
this.validate('change');
}
},
mounted: function mounted() {
if (this.prop) {
this.dispatch('ElForm', 'el.form.addField', [this]);
var initialValue = this.fieldValue;
if (Array.isArray(initialValue)) {
initialValue = [].concat(initialValue);
}
Object.defineProperty(this, 'initialValue', {
value: initialValue
});
var rules = this.getRules();
if (rules.length) {
this.$on('el.form.blur', this.onFieldBlur);
this.$on('el.form.change', this.onFieldChange);
}
}
},
beforeDestroy: function beforeDestroy() {
this.dispatch('ElForm', 'el.form.removeField', [this]);
}
};
/***/ },
/* 215 */
/***/ function(module, exports) {
module.exports = __webpack_require__(45);
/***/ },
/* 216 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-form-item",
class: {
'is-error': _vm.validateState === 'error',
'is-validating': _vm.validateState === 'validating',
'is-required': _vm.isRequired || _vm.required
}
}, [(_vm.label || _vm.$slots.label) ? _c('label', {
staticClass: "el-form-item__label",
style: (_vm.labelStyle),
attrs: {
"for": _vm.prop
}
}, [_vm._t("label", [_vm._v(_vm._s(_vm.label + _vm.form.labelSuffix))])], 2) : _vm._e(), _c('div', {
staticClass: "el-form-item__content",
style: (_vm.contentStyle)
}, [_vm._t("default"), _c('transition', {
attrs: {
"name": "el-zoom-in-top"
}
}, [(_vm.validateState === 'error' && _vm.showMessage && _vm.form.showMessage) ? _c('div', {
staticClass: "el-form-item__error"
}, [_vm._v(_vm._s(_vm.validateMessage))]) : _vm._e()])], 2)])
},staticRenderFns: []}
/***/ },
/* 217 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tabs = __webpack_require__(218);
var _tabs2 = _interopRequireDefault(_tabs);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_tabs2.default.install = function (Vue) {
Vue.component(_tabs2.default.name, _tabs2.default);
};
exports.default = _tabs2.default;
/***/ },
/* 218 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(219),
/* template */
null,
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 219 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tabNav = __webpack_require__(220);
var _tabNav2 = _interopRequireDefault(_tabNav);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElTabs',
components: {
TabNav: _tabNav2.default
},
props: {
type: String,
activeName: String,
closable: Boolean,
addable: Boolean,
value: {},
editable: Boolean
},
data: function data() {
return {
currentName: this.value || this.activeName,
panes: []
};
},
watch: {
activeName: function activeName(value) {
this.setCurrentName(value);
},
value: function value(_value) {
this.setCurrentName(_value);
},
currentName: function currentName(value) {
var _this = this;
if (this.$refs.nav) {
this.$nextTick(function (_) {
_this.$refs.nav.scrollToActiveTab();
});
}
}
},
methods: {
handleTabClick: function handleTabClick(tab, tabName, event) {
if (tab.disabled) return;
this.setCurrentName(tabName);
this.$emit('tab-click', tab, event);
},
handleTabRemove: function handleTabRemove(pane, ev) {
if (pane.disabled) return;
ev.stopPropagation();
this.$emit('edit', pane.name, 'remove');
this.$emit('tab-remove', pane.name);
},
handleTabAdd: function handleTabAdd() {
this.$emit('edit', null, 'add');
this.$emit('tab-add');
},
setCurrentName: function setCurrentName(value) {
this.currentName = value;
this.$emit('input', value);
},
addPanes: function addPanes(item) {
var index = this.$slots.default.filter(function (item) {
return item.elm.nodeType === 1 && /\bel-tab-pane\b/.test(item.elm.className);
}).indexOf(item.$vnode);
this.panes.splice(index, 0, item);
},
removePanes: function removePanes(item) {
var panes = this.panes;
var index = panes.indexOf(item);
if (index > -1) {
panes.splice(index, 1);
}
}
},
render: function render(h) {
var type = this.type,
handleTabClick = this.handleTabClick,
handleTabRemove = this.handleTabRemove,
handleTabAdd = this.handleTabAdd,
currentName = this.currentName,
panes = this.panes,
editable = this.editable,
addable = this.addable;
var newButton = editable || addable ? h(
'span',
{
'class': 'el-tabs__new-tab',
on: {
'click': handleTabAdd
}
},
[h(
'i',
{ 'class': 'el-icon-plus' },
[]
)]
) : null;
var navData = {
props: {
currentName: currentName,
onTabClick: handleTabClick,
onTabRemove: handleTabRemove,
editable: editable,
type: type,
panes: panes
},
ref: 'nav'
};
return h(
'div',
{ 'class': {
'el-tabs': true,
'el-tabs--card': type === 'card',
'el-tabs--border-card': type === 'border-card'
} },
[h(
'div',
{ 'class': 'el-tabs__header' },
[newButton, h(
'tab-nav',
navData,
[]
)]
), h(
'div',
{ 'class': 'el-tabs__content' },
[this.$slots.default]
)]
);
},
created: function created() {
if (!this.currentName) {
this.setCurrentName('0');
}
}
};
/***/ },
/* 220 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(221),
/* template */
null,
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 221 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tabBar = __webpack_require__(222);
var _tabBar2 = _interopRequireDefault(_tabBar);
var _resizeEvent = __webpack_require__(111);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function noop() {}
exports.default = {
name: 'TabNav',
components: {
TabBar: _tabBar2.default
},
props: {
panes: Array,
currentName: String,
editable: Boolean,
onTabClick: {
type: Function,
default: noop
},
onTabRemove: {
type: Function,
default: noop
},
type: String
},
data: function data() {
return {
scrollable: false,
navStyle: {
transform: ''
}
};
},
methods: {
scrollPrev: function scrollPrev() {
var containerWidth = this.$refs.navScroll.offsetWidth;
var currentOffset = this.getCurrentScrollOffset();
if (!currentOffset) return;
var newOffset = currentOffset > containerWidth ? currentOffset - containerWidth : 0;
this.setOffset(newOffset);
},
scrollNext: function scrollNext() {
var navWidth = this.$refs.nav.offsetWidth;
var containerWidth = this.$refs.navScroll.offsetWidth;
var currentOffset = this.getCurrentScrollOffset();
if (navWidth - currentOffset <= containerWidth) return;
var newOffset = navWidth - currentOffset > containerWidth * 2 ? currentOffset + containerWidth : navWidth - containerWidth;
this.setOffset(newOffset);
},
scrollToActiveTab: function scrollToActiveTab() {
if (!this.scrollable) return;
var nav = this.$refs.nav;
var activeTab = this.$el.querySelector('.is-active');
var navScroll = this.$refs.navScroll;
var activeTabBounding = activeTab.getBoundingClientRect();
var navScrollBounding = navScroll.getBoundingClientRect();
var navBounding = nav.getBoundingClientRect();
var currentOffset = this.getCurrentScrollOffset();
var newOffset = currentOffset;
if (activeTabBounding.left < navScrollBounding.left) {
newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
}
if (activeTabBounding.right > navScrollBounding.right) {
newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
}
if (navBounding.right < navScrollBounding.right) {
newOffset = nav.offsetWidth - navScrollBounding.width;
}
this.setOffset(Math.max(newOffset, 0));
},
getCurrentScrollOffset: function getCurrentScrollOffset() {
var navStyle = this.navStyle;
return navStyle.transform ? Number(navStyle.transform.match(/translateX\(-(\d+(\.\d+)*)px\)/)[1]) : 0;
},
setOffset: function setOffset(value) {
this.navStyle.transform = 'translateX(-' + value + 'px)';
},
update: function update() {
var navWidth = this.$refs.nav.offsetWidth;
var containerWidth = this.$refs.navScroll.offsetWidth;
var currentOffset = this.getCurrentScrollOffset();
if (containerWidth < navWidth) {
var _currentOffset = this.getCurrentScrollOffset();
this.scrollable = this.scrollable || {};
this.scrollable.prev = _currentOffset;
this.scrollable.next = _currentOffset + containerWidth < navWidth;
if (navWidth - _currentOffset < containerWidth) {
this.setOffset(navWidth - containerWidth);
}
} else {
this.scrollable = false;
if (currentOffset > 0) {
this.setOffset(0);
}
}
}
},
updated: function updated() {
this.update();
},
render: function render(h) {
var type = this.type,
panes = this.panes,
editable = this.editable,
onTabClick = this.onTabClick,
onTabRemove = this.onTabRemove,
navStyle = this.navStyle,
scrollable = this.scrollable,
scrollNext = this.scrollNext,
scrollPrev = this.scrollPrev;
var scrollBtn = scrollable ? [h(
'span',
{ 'class': ['el-tabs__nav-prev', scrollable.prev ? '' : 'is-disabled'], on: {
'click': scrollPrev
}
},
[h(
'i',
{ 'class': 'el-icon-arrow-left' },
[]
)]
), h(
'span',
{ 'class': ['el-tabs__nav-next', scrollable.next ? '' : 'is-disabled'], on: {
'click': scrollNext
}
},
[h(
'i',
{ 'class': 'el-icon-arrow-right' },
[]
)]
)] : null;
var tabs = this._l(panes, function (pane, index) {
var tabName = pane.name || pane.index || index;
var closable = pane.isClosable || editable;
pane.index = '' + index;
var btnClose = closable ? h(
'span',
{ 'class': 'el-icon-close', on: {
'click': function click(ev) {
onTabRemove(pane, ev);
}
}
},
[]
) : null;
var tabLabelContent = pane.$slots.label || pane.label;
return h(
'div',
{
'class': {
'el-tabs__item': true,
'is-active': pane.active,
'is-disabled': pane.disabled,
'is-closable': closable
},
ref: 'tabs',
refInFor: true,
on: {
'click': function click(ev) {
onTabClick(pane, tabName, ev);
}
}
},
[tabLabelContent, btnClose]
);
});
return h(
'div',
{ 'class': ['el-tabs__nav-wrap', scrollable ? 'is-scrollable' : ''] },
[scrollBtn, h(
'div',
{ 'class': ['el-tabs__nav-scroll'], ref: 'navScroll' },
[h(
'div',
{ 'class': 'el-tabs__nav', ref: 'nav', style: navStyle },
[!type ? h(
'tab-bar',
{
attrs: { tabs: panes }
},
[]
) : null, tabs]
)]
)]
);
},
mounted: function mounted() {
(0, _resizeEvent.addResizeListener)(this.$el, this.update);
},
beforeDestroy: function beforeDestroy() {
if (this.$el && this.update) (0, _resizeEvent.removeResizeListener)(this.$el, this.update);
}
};
/***/ },
/* 222 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(223),
/* template */
__webpack_require__(224),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 223 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
exports.default = {
name: 'TabBar',
props: {
tabs: Array
},
computed: {
barStyle: {
cache: false,
get: function get() {
var _this = this;
if (!this.$parent.$refs.tabs) return {};
var style = {};
var offset = 0;
var tabWidth = 0;
this.tabs.every(function (tab, index) {
var $el = _this.$parent.$refs.tabs[index];
if (!$el) {
return false;
}
if (!tab.active) {
offset += $el.clientWidth;
return true;
} else {
tabWidth = $el.clientWidth;
return false;
}
});
var transform = 'translateX(' + offset + 'px)';
style.width = tabWidth + 'px';
style.transform = transform;
style.msTransform = transform;
style.webkitTransform = transform;
return style;
}
}
}
};
/***/ },
/* 224 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-tabs__active-bar",
style: (_vm.barStyle)
})
},staticRenderFns: []}
/***/ },
/* 225 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tabPane = __webpack_require__(226);
var _tabPane2 = _interopRequireDefault(_tabPane);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_tabPane2.default.install = function (Vue) {
Vue.component(_tabPane2.default.name, _tabPane2.default);
};
exports.default = _tabPane2.default;
/***/ },
/* 226 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(227),
/* template */
__webpack_require__(228),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 227 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
exports.default = {
name: 'ElTabPane',
componentName: 'ElTabPane',
props: {
label: String,
labelContent: Function,
name: String,
closable: Boolean,
disabled: Boolean
},
data: function data() {
return {
index: null
};
},
computed: {
isClosable: function isClosable() {
return this.closable || this.$parent.closable;
},
active: function active() {
return this.$parent.currentName === (this.name || this.index);
}
},
mounted: function mounted() {
this.$parent.addPanes(this);
},
destroyed: function destroyed() {
if (this.$el && this.$el.parentNode) {
this.$el.parentNode.removeChild(this.$el);
}
this.$parent.removePanes(this);
},
watch: {
label: function label() {
this.$parent.$forceUpdate();
}
}
};
/***/ },
/* 228 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.active),
expression: "active"
}],
staticClass: "el-tab-pane"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 229 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tag = __webpack_require__(230);
var _tag2 = _interopRequireDefault(_tag);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_tag2.default.install = function (Vue) {
Vue.component(_tag2.default.name, _tag2.default);
};
exports.default = _tag2.default;
/***/ },
/* 230 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(231),
/* template */
__webpack_require__(232),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 231 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElTag',
props: {
text: String,
closable: Boolean,
type: String,
hit: Boolean,
closeTransition: Boolean,
color: String
},
methods: {
handleClose: function handleClose(event) {
this.$emit('close', event);
}
}
};
/***/ },
/* 232 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": _vm.closeTransition ? '' : 'el-zoom-in-center'
}
}, [_c('span', {
staticClass: "el-tag",
class: [_vm.type ? 'el-tag--' + _vm.type : '', {
'is-hit': _vm.hit
}],
style: ({
backgroundColor: _vm.color
})
}, [_vm._t("default"), (_vm.closable) ? _c('i', {
staticClass: "el-tag__close el-icon-close",
on: {
"click": _vm.handleClose
}
}) : _vm._e()], 2)])
},staticRenderFns: []}
/***/ },
/* 233 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tree = __webpack_require__(234);
var _tree2 = _interopRequireDefault(_tree);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_tree2.default.install = function (Vue) {
Vue.component(_tree2.default.name, _tree2.default);
};
exports.default = _tree2.default;
/***/ },
/* 234 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(235),
/* template */
__webpack_require__(242),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 235 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _treeStore = __webpack_require__(236);
var _treeStore2 = _interopRequireDefault(_treeStore);
var _locale = __webpack_require__(112);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElTree',
mixins: [_emitter2.default],
components: {
ElTreeNode: __webpack_require__(239)
},
data: function data() {
return {
store: null,
root: null,
currentNode: null
};
},
props: {
data: {
type: Array
},
emptyText: {
type: String,
default: function _default() {
return (0, _locale.t)('el.tree.emptyText');
}
},
nodeKey: String,
checkStrictly: Boolean,
defaultExpandAll: Boolean,
expandOnClickNode: {
type: Boolean,
default: true
},
autoExpandParent: {
type: Boolean,
default: true
},
defaultCheckedKeys: Array,
defaultExpandedKeys: Array,
renderContent: Function,
showCheckbox: {
type: Boolean,
default: false
},
props: {
default: function _default() {
return {
children: 'children',
label: 'label',
icon: 'icon',
disabled: 'disabled'
};
}
},
lazy: {
type: Boolean,
default: false
},
highlightCurrent: Boolean,
currentNodeKey: [String, Number],
load: Function,
filterNodeMethod: Function,
accordion: Boolean,
indent: {
type: Number,
default: 16
}
},
computed: {
children: {
set: function set(value) {
this.data = value;
},
get: function get() {
return this.data;
}
}
},
watch: {
defaultCheckedKeys: function defaultCheckedKeys(newVal) {
this.store.defaultCheckedKeys = newVal;
this.store.setDefaultCheckedKey(newVal);
},
defaultExpandedKeys: function defaultExpandedKeys(newVal) {
this.store.defaultExpandedKeys = newVal;
this.store.setDefaultExpandedKeys(newVal);
},
currentNodeKey: function currentNodeKey(newVal) {
this.store.setCurrentNodeKey(newVal);
this.store.currentNodeKey = newVal;
},
data: function data(newVal) {
this.store.setData(newVal);
}
},
methods: {
filter: function filter(value) {
if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
this.store.filter(value);
},
getNodeKey: function getNodeKey(node, index) {
var nodeKey = this.nodeKey;
if (nodeKey && node) {
return node.data[nodeKey];
}
return index;
},
getCheckedNodes: function getCheckedNodes(leafOnly) {
return this.store.getCheckedNodes(leafOnly);
},
getCheckedKeys: function getCheckedKeys(leafOnly) {
return this.store.getCheckedKeys(leafOnly);
},
setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
this.store.setCheckedNodes(nodes, leafOnly);
},
setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
this.store.setCheckedKeys(keys, leafOnly);
},
setChecked: function setChecked(data, checked, deep) {
this.store.setChecked(data, checked, deep);
},
handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
this.broadcast('ElTreeNode', 'tree-node-expand', node);
this.$emit('node-expand', nodeData, node, instance);
}
},
created: function created() {
this.isTree = true;
this.store = new _treeStore2.default({
key: this.nodeKey,
data: this.data,
lazy: this.lazy,
props: this.props,
load: this.load,
currentNodeKey: this.currentNodeKey,
checkStrictly: this.checkStrictly,
defaultCheckedKeys: this.defaultCheckedKeys,
defaultExpandedKeys: this.defaultExpandedKeys,
autoExpandParent: this.autoExpandParent,
defaultExpandAll: this.defaultExpandAll,
filterNodeMethod: this.filterNodeMethod
});
this.root = this.store.root;
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 236 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _node = __webpack_require__(237);
var _node2 = _interopRequireDefault(_node);
var _util = __webpack_require__(238);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var TreeStore = function () {
function TreeStore(options) {
var _this = this;
_classCallCheck(this, TreeStore);
this.currentNode = null;
this.currentNodeKey = null;
for (var option in options) {
if (options.hasOwnProperty(option)) {
this[option] = options[option];
}
}
this.nodesMap = {};
this.root = new _node2.default({
data: this.data,
store: this
});
if (this.lazy && this.load) {
var loadFn = this.load;
loadFn(this.root, function (data) {
_this.root.doCreateChildren(data);
_this._initDefaultCheckedNodes();
});
} else {
this._initDefaultCheckedNodes();
}
}
TreeStore.prototype.filter = function filter(value) {
var filterNodeMethod = this.filterNodeMethod;
var traverse = function traverse(node) {
var childNodes = node.root ? node.root.childNodes : node.childNodes;
childNodes.forEach(function (child) {
child.visible = filterNodeMethod.call(child, value, child.data, child);
traverse(child);
});
if (!node.visible && childNodes.length) {
var allHidden = true;
childNodes.forEach(function (child) {
if (child.visible) allHidden = false;
});
if (node.root) {
node.root.visible = allHidden === false;
} else {
node.visible = allHidden === false;
}
}
if (node.visible && !node.isLeaf) node.expand();
};
traverse(this);
};
TreeStore.prototype.setData = function setData(newVal) {
var instanceChanged = newVal !== this.root.data;
this.root.setData(newVal);
if (instanceChanged) {
this._initDefaultCheckedNodes();
}
};
TreeStore.prototype.getNode = function getNode(data) {
var key = (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object' ? data : (0, _util.getNodeKey)(this.key, data);
return this.nodesMap[key];
};
TreeStore.prototype.insertBefore = function insertBefore(data, refData) {
var refNode = this.getNode(refData);
refNode.parent.insertBefore({ data: data }, refNode);
};
TreeStore.prototype.insertAfter = function insertAfter(data, refData) {
var refNode = this.getNode(refData);
refNode.parent.insertAfter({ data: data }, refNode);
};
TreeStore.prototype.remove = function remove(data) {
var node = this.getNode(data);
if (node) {
node.parent.removeChild(node);
}
};
TreeStore.prototype.append = function append(data, parentData) {
var parentNode = parentData ? this.getNode(parentData) : this.root;
if (parentNode) {
parentNode.insertChild({ data: data });
}
};
TreeStore.prototype._initDefaultCheckedNodes = function _initDefaultCheckedNodes() {
var _this2 = this;
var defaultCheckedKeys = this.defaultCheckedKeys || [];
var nodesMap = this.nodesMap;
defaultCheckedKeys.forEach(function (checkedKey) {
var node = nodesMap[checkedKey];
if (node) {
node.setChecked(true, !_this2.checkStrictly);
}
});
};
TreeStore.prototype._initDefaultCheckedNode = function _initDefaultCheckedNode(node) {
var defaultCheckedKeys = this.defaultCheckedKeys || [];
if (defaultCheckedKeys.indexOf(node.key) !== -1) {
node.setChecked(true, !this.checkStrictly);
}
};
TreeStore.prototype.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
if (newVal !== this.defaultCheckedKeys) {
this.defaultCheckedKeys = newVal;
this._initDefaultCheckedNodes();
}
};
TreeStore.prototype.registerNode = function registerNode(node) {
var key = this.key;
if (!key || !node || !node.data) return;
var nodeKey = node.key;
if (nodeKey !== undefined) this.nodesMap[node.key] = node;
};
TreeStore.prototype.deregisterNode = function deregisterNode(node) {
var key = this.key;
if (!key || !node || !node.data) return;
delete this.nodesMap[node.key];
};
TreeStore.prototype.getCheckedNodes = function getCheckedNodes() {
var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var checkedNodes = [];
var traverse = function traverse(node) {
var childNodes = node.root ? node.root.childNodes : node.childNodes;
childNodes.forEach(function (child) {
if (!leafOnly && child.checked || leafOnly && child.isLeaf && child.checked) {
checkedNodes.push(child.data);
}
traverse(child);
});
};
traverse(this);
return checkedNodes;
};
TreeStore.prototype.getCheckedKeys = function getCheckedKeys() {
var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
var key = this.key;
var allNodes = this._getAllNodes();
var keys = [];
allNodes.forEach(function (node) {
if (!leafOnly || leafOnly && node.isLeaf) {
if (node.checked) {
keys.push((node.data || {})[key]);
}
}
});
return keys;
};
TreeStore.prototype._getAllNodes = function _getAllNodes() {
var allNodes = [];
var nodesMap = this.nodesMap;
for (var nodeKey in nodesMap) {
if (nodesMap.hasOwnProperty(nodeKey)) {
allNodes.push(nodesMap[nodeKey]);
}
}
return allNodes;
};
TreeStore.prototype._setCheckedKeys = function _setCheckedKeys(key) {
var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var checkedKeys = arguments[2];
var allNodes = this._getAllNodes().sort(function (a, b) {
return b.level - a.level;
});
var cache = Object.create(null);
var keys = Object.keys(checkedKeys);
allNodes.forEach(function (node) {
return node.setChecked(false, false);
});
for (var i = 0, j = allNodes.length; i < j; i++) {
var node = allNodes[i];
var nodeKey = node.data[key].toString();
var checked = keys.indexOf(nodeKey) > -1;
if (!checked) {
if (node.checked && !cache[nodeKey]) {
node.setChecked(false, false);
}
continue;
}
var parent = node.parent;
while (parent && parent.level > 0) {
cache[parent.data[key]] = true;
parent = parent.parent;
}
if (node.isLeaf || this.checkStrictly) {
node.setChecked(true, false);
continue;
}
node.setChecked(true, true);
if (leafOnly) {
(function () {
node.setChecked(false, false);
var traverse = function traverse(node) {
var childNodes = node.childNodes;
childNodes.forEach(function (child) {
if (!child.isLeaf) {
child.setChecked(false, false);
}
traverse(child);
});
};
traverse(node);
})();
}
}
};
TreeStore.prototype.setCheckedNodes = function setCheckedNodes(array) {
var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var key = this.key;
var checkedKeys = {};
array.forEach(function (item) {
checkedKeys[(item || {})[key]] = true;
});
this._setCheckedKeys(key, leafOnly, checkedKeys);
};
TreeStore.prototype.setCheckedKeys = function setCheckedKeys(keys) {
var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
this.defaultCheckedKeys = keys;
var key = this.key;
var checkedKeys = {};
keys.forEach(function (key) {
checkedKeys[key] = true;
});
this._setCheckedKeys(key, leafOnly, checkedKeys);
};
TreeStore.prototype.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
var _this3 = this;
keys = keys || [];
this.defaultExpandedKeys = keys;
keys.forEach(function (key) {
var node = _this3.getNode(key);
if (node) node.expand(null, _this3.autoExpandParent);
});
};
TreeStore.prototype.setChecked = function setChecked(data, checked, deep) {
var node = this.getNode(data);
if (node) {
node.setChecked(!!checked, deep);
}
};
TreeStore.prototype.getCurrentNode = function getCurrentNode() {
return this.currentNode;
};
TreeStore.prototype.setCurrentNode = function setCurrentNode(node) {
this.currentNode = node;
};
TreeStore.prototype.setCurrentNodeKey = function setCurrentNodeKey(key) {
var node = this.getNode(key);
if (node) {
this.currentNode = node;
}
};
return TreeStore;
}();
exports.default = TreeStore;
;
/***/ },
/* 237 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.getChildState = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _merge = __webpack_require__(65);
var _merge2 = _interopRequireDefault(_merge);
var _util = __webpack_require__(238);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var getChildState = exports.getChildState = function getChildState(node) {
var all = true;
var none = true;
var allWithoutDisable = true;
for (var i = 0, j = node.length; i < j; i++) {
var n = node[i];
if (n.checked !== true || n.indeterminate) {
all = false;
if (!n.disabled) {
allWithoutDisable = false;
}
}
if (n.checked !== false || n.indeterminate) {
none = false;
}
}
return { all: all, none: none, allWithoutDisable: allWithoutDisable, half: !all && !none };
};
var reInitChecked = function reInitChecked(node) {
var _getChildState = getChildState(node.childNodes),
all = _getChildState.all,
none = _getChildState.none,
half = _getChildState.half;
if (all) {
node.checked = true;
node.indeterminate = false;
} else if (half) {
node.checked = false;
node.indeterminate = true;
} else if (none) {
node.checked = false;
node.indeterminate = false;
}
var parent = node.parent;
if (!parent || parent.level === 0) return;
if (!node.store.checkStrictly) {
reInitChecked(parent);
}
};
var initLazyLoadChild = function initLazyLoadChild(node) {
var childNodes = node.childNodes;
if (node.checked) {
for (var i = 0, j = childNodes.length; i < j; i++) {
var child = childNodes[i];
if (!child.disabled) {
child.checked = true;
}
}
}
var parent = node.parent;
if (!parent || parent.level === 0) return;
reInitChecked(parent);
};
var getPropertyFromData = function getPropertyFromData(node, prop) {
var props = node.store.props;
var data = node.data || {};
var config = props[prop];
if (typeof config === 'function') {
return config(data, node);
} else if (typeof config === 'string') {
return data[config];
} else if (typeof config === 'undefined') {
return '';
}
};
var nodeIdSeed = 0;
var Node = function () {
function Node(options) {
_classCallCheck(this, Node);
this.id = nodeIdSeed++;
this.text = null;
this.checked = false;
this.indeterminate = false;
this.data = null;
this.expanded = false;
this.parent = null;
this.visible = true;
for (var name in options) {
if (options.hasOwnProperty(name)) {
this[name] = options[name];
}
}
// internal
this.level = 0;
this.loaded = false;
this.childNodes = [];
this.loading = false;
if (this.parent) {
this.level = this.parent.level + 1;
}
var store = this.store;
if (!store) {
throw new Error('[Node]store is required!');
}
store.registerNode(this);
var props = store.props;
if (props && typeof props.isLeaf !== 'undefined') {
var isLeaf = getPropertyFromData(this, 'isLeaf');
if (typeof isLeaf === 'boolean') {
this.isLeafByUser = isLeaf;
}
}
if (store.lazy !== true && this.data) {
this.setData(this.data);
if (store.defaultExpandAll) {
this.expanded = true;
}
} else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
this.expand();
}
if (!this.data) return;
var defaultExpandedKeys = store.defaultExpandedKeys;
var key = store.key;
if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) {
this.expand(null, store.autoExpandParent);
}
if (key && store.currentNodeKey && this.key === store.currentNodeKey) {
store.currentNode = this;
}
if (store.lazy) {
store._initDefaultCheckedNode(this);
}
this.updateLeafState();
}
Node.prototype.setData = function setData(data) {
if (!Array.isArray(data)) {
(0, _util.markNodeData)(this, data);
}
this.data = data;
this.childNodes = [];
var children = void 0;
if (this.level === 0 && this.data instanceof Array) {
children = this.data;
} else {
children = getPropertyFromData(this, 'children') || [];
}
for (var i = 0, j = children.length; i < j; i++) {
this.insertChild({ data: children[i] });
}
};
Node.prototype.insertChild = function insertChild(child, index) {
if (!child) throw new Error('insertChild error: child is required.');
if (!(child instanceof Node)) {
(0, _merge2.default)(child, {
parent: this,
store: this.store
});
child = new Node(child);
}
child.level = this.level + 1;
if (typeof index === 'undefined' || index < 0) {
this.childNodes.push(child);
} else {
this.childNodes.splice(index, 0, child);
}
this.updateLeafState();
};
Node.prototype.insertBefore = function insertBefore(child, ref) {
var index = void 0;
if (ref) {
index = this.childNodes.indexOf(ref);
}
this.insertChild(child, index);
};
Node.prototype.insertAfter = function insertAfter(child, ref) {
var index = void 0;
if (ref) {
index = this.childNodes.indexOf(ref);
if (index !== -1) index += 1;
}
this.insertChild(child, index);
};
Node.prototype.removeChild = function removeChild(child) {
var index = this.childNodes.indexOf(child);
if (index > -1) {
this.store && this.store.deregisterNode(child);
child.parent = null;
this.childNodes.splice(index, 1);
}
this.updateLeafState();
};
Node.prototype.removeChildByData = function removeChildByData(data) {
var targetNode = null;
this.childNodes.forEach(function (node) {
if (node.data === data) {
targetNode = node;
}
});
if (targetNode) {
this.removeChild(targetNode);
}
};
Node.prototype.expand = function expand(callback, expandParent) {
var _this = this;
var done = function done() {
if (expandParent) {
var parent = _this.parent;
while (parent.level > 0) {
parent.expanded = true;
parent = parent.parent;
}
}
_this.expanded = true;
if (callback) callback();
};
if (this.shouldLoadData()) {
this.loadData(function (data) {
if (data instanceof Array) {
initLazyLoadChild(_this);
done();
}
});
} else {
done();
}
};
Node.prototype.doCreateChildren = function doCreateChildren(array) {
var _this2 = this;
var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
array.forEach(function (item) {
_this2.insertChild((0, _merge2.default)({ data: item }, defaultProps));
});
};
Node.prototype.collapse = function collapse() {
this.expanded = false;
};
Node.prototype.shouldLoadData = function shouldLoadData() {
return this.store.lazy === true && this.store.load && !this.loaded;
};
Node.prototype.updateLeafState = function updateLeafState() {
if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') {
this.isLeaf = this.isLeafByUser;
return;
}
var childNodes = this.childNodes;
if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
this.isLeaf = !childNodes || childNodes.length === 0;
return;
}
this.isLeaf = false;
};
Node.prototype.setChecked = function setChecked(value, deep, recursion, passValue) {
var _this3 = this;
this.indeterminate = value === 'half';
this.checked = value === true;
var _getChildState2 = getChildState(this.childNodes),
all = _getChildState2.all,
allWithoutDisable = _getChildState2.allWithoutDisable;
if (this.childNodes.length && !all && allWithoutDisable) {
this.checked = false;
value = false;
}
var handleDescendants = function handleDescendants(lazy) {
if (deep && !lazy) {
var childNodes = _this3.childNodes;
for (var i = 0, j = childNodes.length; i < j; i++) {
var child = childNodes[i];
passValue = passValue || value !== false;
var isCheck = child.disabled ? child.checked : passValue;
child.setChecked(isCheck, deep, true, passValue);
}
var _getChildState3 = getChildState(childNodes),
half = _getChildState3.half,
_all = _getChildState3.all;
if (!_all) {
_this3.checked = _all;
_this3.indeterminate = half;
}
}
};
if (!this.store.checkStrictly && this.shouldLoadData()) {
// Only work on lazy load data.
this.loadData(function () {
handleDescendants(true);
}, {
checked: value !== false
});
} else {
handleDescendants();
}
var parent = this.parent;
if (!parent || parent.level === 0) return;
if (!this.store.checkStrictly && !recursion) {
reInitChecked(parent);
}
};
Node.prototype.getChildren = function getChildren() {
// this is data
var data = this.data;
if (!data) return null;
var props = this.store.props;
var children = 'children';
if (props) {
children = props.children || 'children';
}
if (data[children] === undefined) {
data[children] = null;
}
return data[children];
};
Node.prototype.updateChildren = function updateChildren() {
var _this4 = this;
var newData = this.getChildren() || [];
var oldData = this.childNodes.map(function (node) {
return node.data;
});
var newDataMap = {};
var newNodes = [];
newData.forEach(function (item, index) {
if (item[_util.NODE_KEY]) {
newDataMap[item[_util.NODE_KEY]] = { index: index, data: item };
} else {
newNodes.push({ index: index, data: item });
}
});
oldData.forEach(function (item) {
if (!newDataMap[item[_util.NODE_KEY]]) _this4.removeChildByData(item);
});
newNodes.forEach(function (_ref) {
var index = _ref.index,
data = _ref.data;
_this4.insertChild({ data: data }, index);
});
this.updateLeafState();
};
Node.prototype.loadData = function loadData(callback) {
var _this5 = this;
var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
this.loading = true;
var resolve = function resolve(children) {
_this5.loaded = true;
_this5.loading = false;
_this5.childNodes = [];
_this5.doCreateChildren(children, defaultProps);
_this5.updateLeafState();
if (callback) {
callback.call(_this5, children);
}
};
this.store.load(this, resolve);
} else {
if (callback) {
callback.call(this);
}
}
};
_createClass(Node, [{
key: 'label',
get: function get() {
return getPropertyFromData(this, 'label');
}
}, {
key: 'icon',
get: function get() {
return getPropertyFromData(this, 'icon');
}
}, {
key: 'key',
get: function get() {
var nodeKey = this.store.key;
if (this.data) return this.data[nodeKey];
return null;
}
}, {
key: 'disabled',
get: function get() {
return getPropertyFromData(this, 'disabled');
}
}]);
return Node;
}();
exports.default = Node;
/***/ },
/* 238 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var NODE_KEY = exports.NODE_KEY = '$treeNodeId';
var markNodeData = exports.markNodeData = function markNodeData(node, data) {
if (data[NODE_KEY]) return;
Object.defineProperty(data, NODE_KEY, {
value: node.id,
enumerable: false,
configurable: false,
writable: false
});
};
var getNodeKey = exports.getNodeKey = function getNodeKey(key, data) {
if (!key) return data[NODE_KEY];
return data[key];
};
/***/ },
/* 239 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(240),
/* template */
__webpack_require__(241),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 240 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _collapseTransition = __webpack_require__(50);
var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
var _checkbox = __webpack_require__(131);
var _checkbox2 = _interopRequireDefault(_checkbox);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElTreeNode',
componentName: 'ElTreeNode',
mixins: [_emitter2.default],
props: {
node: {
default: function _default() {
return {};
}
},
props: {},
renderContent: Function
},
components: {
ElCollapseTransition: _collapseTransition2.default,
ElCheckbox: _checkbox2.default,
NodeContent: {
props: {
node: {
required: true
}
},
render: function render(h) {
var parent = this.$parent;
var node = this.node;
var data = node.data;
var store = node.store;
return parent.renderContent ? parent.renderContent.call(parent._renderProxy, h, { _self: parent.tree.$vnode.context, node: node, data: data, store: store }) : h(
'span',
{ 'class': 'el-tree-node__label' },
[this.node.label]
);
}
}
},
data: function data() {
return {
tree: null,
expanded: false,
childNodeRendered: false,
showCheckbox: false,
oldChecked: null,
oldIndeterminate: null
};
},
watch: {
'node.indeterminate': function nodeIndeterminate(val) {
this.handleSelectChange(this.node.checked, val);
},
'node.checked': function nodeChecked(val) {
this.handleSelectChange(val, this.node.indeterminate);
},
'node.expanded': function nodeExpanded(val) {
this.expanded = val;
if (val) {
this.childNodeRendered = true;
}
}
},
methods: {
getNodeKey: function getNodeKey(node, index) {
var nodeKey = this.tree.nodeKey;
if (nodeKey && node) {
return node.data[nodeKey];
}
return index;
},
handleSelectChange: function handleSelectChange(checked, indeterminate) {
if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
this.tree.$emit('check-change', this.node.data, checked, indeterminate);
}
this.oldChecked = checked;
this.indeterminate = indeterminate;
},
handleClick: function handleClick() {
var store = this.tree.store;
store.setCurrentNode(this.node);
this.tree.$emit('current-change', store.currentNode ? store.currentNode.data : null, store.currentNode);
this.tree.currentNode = this;
if (this.tree.expandOnClickNode) {
this.handleExpandIconClick();
}
this.tree.$emit('node-click', this.node.data, this.node, this);
},
handleExpandIconClick: function handleExpandIconClick() {
if (this.node.isLeaf) return;
if (this.expanded) {
this.tree.$emit('node-collapse', this.node.data, this.node, this);
this.node.collapse();
} else {
this.node.expand();
this.$emit('node-expand', this.node.data, this.node, this);
}
},
handleCheckChange: function handleCheckChange(ev) {
this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
},
handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
this.broadcast('ElTreeNode', 'tree-node-expand', node);
this.tree.$emit('node-expand', nodeData, node, instance);
}
},
created: function created() {
var _this = this;
var parent = this.$parent;
if (parent.isTree) {
this.tree = parent;
} else {
this.tree = parent.tree;
}
var tree = this.tree;
if (!tree) {
console.warn('Can not find node\'s tree.');
}
var props = tree.props || {};
var childrenKey = props['children'] || 'children';
this.$watch('node.data.' + childrenKey, function () {
_this.node.updateChildren();
});
this.showCheckbox = tree.showCheckbox;
if (this.node.expanded) {
this.expanded = true;
this.childNodeRendered = true;
}
if (this.tree.accordion) {
this.$on('tree-node-expand', function (node) {
if (_this.node !== node) {
_this.node.collapse();
}
});
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 241 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.node.visible),
expression: "node.visible"
}],
staticClass: "el-tree-node",
class: {
'is-expanded': _vm.childNodeRendered && _vm.expanded,
'is-current': _vm.tree.store.currentNode === _vm.node,
'is-hidden': !_vm.node.visible
},
on: {
"click": function($event) {
$event.stopPropagation();
_vm.handleClick($event)
}
}
}, [_c('div', {
staticClass: "el-tree-node__content",
style: ({
'padding-left': (_vm.node.level - 1) * _vm.tree.indent + 'px'
})
}, [_c('span', {
staticClass: "el-tree-node__expand-icon",
class: {
'is-leaf': _vm.node.isLeaf, expanded: !_vm.node.isLeaf && _vm.expanded
},
on: {
"click": function($event) {
$event.stopPropagation();
_vm.handleExpandIconClick($event)
}
}
}), (_vm.showCheckbox) ? _c('el-checkbox', {
attrs: {
"indeterminate": _vm.node.indeterminate,
"disabled": !!_vm.node.disabled
},
on: {
"change": _vm.handleCheckChange
},
nativeOn: {
"click": function($event) {
$event.stopPropagation();
}
},
model: {
value: (_vm.node.checked),
callback: function($$v) {
_vm.node.checked = $$v
},
expression: "node.checked"
}
}) : _vm._e(), (_vm.node.loading) ? _c('span', {
staticClass: "el-tree-node__loading-icon el-icon-loading"
}) : _vm._e(), _c('node-content', {
attrs: {
"node": _vm.node
}
})], 1), _c('el-collapse-transition', [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.expanded),
expression: "expanded"
}],
staticClass: "el-tree-node__children"
}, _vm._l((_vm.node.childNodes), function(child) {
return _c('el-tree-node', {
key: _vm.getNodeKey(child),
attrs: {
"render-content": _vm.renderContent,
"node": child
},
on: {
"node-expand": _vm.handleChildNodeExpand
}
})
}))])], 1)
},staticRenderFns: []}
/***/ },
/* 242 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-tree",
class: {
'el-tree--highlight-current': _vm.highlightCurrent
}
}, [_vm._l((_vm.root.childNodes), function(child) {
return _c('el-tree-node', {
key: _vm.getNodeKey(child),
attrs: {
"node": child,
"props": _vm.props,
"render-content": _vm.renderContent
},
on: {
"node-expand": _vm.handleNodeExpand
}
})
}), (!_vm.root.childNodes || _vm.root.childNodes.length === 0) ? _c('div', {
staticClass: "el-tree__empty-block"
}, [_c('span', {
staticClass: "el-tree__empty-text"
}, [_vm._v(_vm._s(_vm.emptyText))])]) : _vm._e()], 2)
},staticRenderFns: []}
/***/ },
/* 243 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(244);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 244 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(245),
/* template */
__webpack_require__(246),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 245 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var TYPE_CLASSES_MAP = {
'success': 'el-icon-circle-check',
'warning': 'el-icon-warning',
'error': 'el-icon-circle-cross'
};
exports.default = {
name: 'ElAlert',
props: {
title: {
type: String,
default: '',
required: true
},
description: {
type: String,
default: ''
},
type: {
type: String,
default: 'info'
},
closable: {
type: Boolean,
default: true
},
closeText: {
type: String,
default: ''
},
showIcon: {
type: Boolean,
default: false
}
},
data: function data() {
return {
visible: true
};
},
methods: {
close: function close() {
this.visible = false;
this.$emit('close');
}
},
computed: {
typeClass: function typeClass() {
return 'el-alert--' + this.type;
},
iconClass: function iconClass() {
return TYPE_CLASSES_MAP[this.type] || 'el-icon-information';
},
isBigIcon: function isBigIcon() {
return this.description ? 'is-big' : '';
},
isBoldTitle: function isBoldTitle() {
return this.description ? 'is-bold' : '';
}
}
};
/***/ },
/* 246 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-alert-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-alert",
class: [_vm.typeClass]
}, [(_vm.showIcon) ? _c('i', {
staticClass: "el-alert__icon",
class: [_vm.iconClass, _vm.isBigIcon]
}) : _vm._e(), _c('div', {
staticClass: "el-alert__content"
}, [(_vm.title) ? _c('span', {
staticClass: "el-alert__title",
class: [_vm.isBoldTitle]
}, [_vm._v(_vm._s(_vm.title))]) : _vm._e(), _vm._t("default", [(_vm.description) ? _c('p', {
staticClass: "el-alert__description"
}, [_vm._v(_vm._s(_vm.description))]) : _vm._e()]), _c('i', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.closable),
expression: "closable"
}],
staticClass: "el-alert__closebtn",
class: {
'is-customed': _vm.closeText !== '', 'el-icon-close': _vm.closeText === ''
},
on: {
"click": function($event) {
_vm.close()
}
}
}, [_vm._v(_vm._s(_vm.closeText))])], 2)])])
},staticRenderFns: []}
/***/ },
/* 247 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(248);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _main2.default;
/***/ },
/* 248 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _popup = __webpack_require__(14);
var _vdom = __webpack_require__(194);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var NotificationConstructor = _vue2.default.extend(__webpack_require__(249));
var instance = void 0;
var instances = [];
var seed = 1;
var Notification = function Notification(options) {
if (_vue2.default.prototype.$isServer) return;
options = options || {};
var userOnClose = options.onClose;
var id = 'notification_' + seed++;
options.onClose = function () {
Notification.close(id, userOnClose);
};
instance = new NotificationConstructor({
data: options
});
if ((0, _vdom.isVNode)(options.message)) {
instance.$slots.default = [options.message];
options.message = '';
}
instance.id = id;
instance.vm = instance.$mount();
document.body.appendChild(instance.vm.$el);
instance.vm.visible = true;
instance.dom = instance.vm.$el;
instance.dom.style.zIndex = _popup.PopupManager.nextZIndex();
var offset = options.offset || 0;
var topDist = offset;
for (var i = 0, len = instances.length; i < len; i++) {
topDist += instances[i].$el.offsetHeight + 16;
}
topDist += 16;
instance.top = topDist;
instances.push(instance);
return instance.vm;
};
['success', 'warning', 'info', 'error'].forEach(function (type) {
Notification[type] = function (options) {
if (typeof options === 'string' || (0, _vdom.isVNode)(options)) {
options = {
message: options
};
}
options.type = type;
return Notification(options);
};
});
Notification.close = function (id, userOnClose) {
var index = void 0;
var removedHeight = void 0;
for (var i = 0, len = instances.length; i < len; i++) {
if (id === instances[i].id) {
if (typeof userOnClose === 'function') {
userOnClose(instances[i]);
}
index = i;
removedHeight = instances[i].dom.offsetHeight;
instances.splice(i, 1);
break;
}
}
if (len > 1) {
for (i = index; i < len - 1; i++) {
instances[i].dom.style.top = parseInt(instances[i].dom.style.top, 10) - removedHeight - 16 + 'px';
}
}
};
exports.default = Notification;
/***/ },
/* 249 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(250),
/* template */
__webpack_require__(251),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 250 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var typeMap = {
success: 'circle-check',
info: 'information',
warning: 'warning',
error: 'circle-cross'
};
exports.default = {
data: function data() {
return {
visible: false,
title: '',
message: '',
duration: 4500,
type: '',
customClass: '',
iconClass: '',
onClose: null,
onClick: null,
closed: false,
top: null,
timer: null
};
},
computed: {
typeClass: function typeClass() {
return this.type && typeMap[this.type] ? 'el-icon-' + typeMap[this.type] : '';
}
},
watch: {
closed: function closed(newVal) {
if (newVal) {
this.visible = false;
this.$el.addEventListener('transitionend', this.destroyElement);
}
}
},
methods: {
destroyElement: function destroyElement() {
this.$el.removeEventListener('transitionend', this.destroyElement);
this.$destroy(true);
this.$el.parentNode.removeChild(this.$el);
},
click: function click() {
if (typeof this.onClick === 'function') {
this.onClick();
}
},
close: function close() {
this.closed = true;
if (typeof this.onClose === 'function') {
this.onClose();
}
},
clearTimer: function clearTimer() {
clearTimeout(this.timer);
},
startTimer: function startTimer() {
var _this = this;
if (this.duration > 0) {
this.timer = setTimeout(function () {
if (!_this.closed) {
_this.close();
}
}, this.duration);
}
}
},
mounted: function mounted() {
var _this2 = this;
if (this.duration > 0) {
this.timer = setTimeout(function () {
if (!_this2.closed) {
_this2.close();
}
}, this.duration);
}
}
};
/***/ },
/* 251 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-notification-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-notification",
class: _vm.customClass,
style: ({
top: _vm.top ? _vm.top + 'px' : 'auto'
}),
on: {
"mouseenter": function($event) {
_vm.clearTimer()
},
"mouseleave": function($event) {
_vm.startTimer()
},
"click": _vm.click
}
}, [(_vm.type || _vm.iconClass) ? _c('i', {
staticClass: "el-notification__icon",
class: [_vm.typeClass, _vm.iconClass]
}) : _vm._e(), _c('div', {
staticClass: "el-notification__group",
class: {
'is-with-icon': _vm.typeClass || _vm.iconClass
}
}, [_c('h2', {
staticClass: "el-notification__title",
domProps: {
"textContent": _vm._s(_vm.title)
}
}), _c('div', {
staticClass: "el-notification__content"
}, [_vm._t("default", [_vm._v(_vm._s(_vm.message))])], 2), _c('div', {
staticClass: "el-notification__closeBtn el-icon-close",
on: {
"click": function($event) {
$event.stopPropagation();
_vm.close($event)
}
}
})])])])
},staticRenderFns: []}
/***/ },
/* 252 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(253);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 253 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(254),
/* template */
__webpack_require__(259),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 254 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _inputNumber = __webpack_require__(255);
var _inputNumber2 = _interopRequireDefault(_inputNumber);
var _button = __webpack_require__(256);
var _button2 = _interopRequireDefault(_button);
var _dom = __webpack_require__(45);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElSlider',
mixins: [_emitter2.default],
props: {
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
step: {
type: Number,
default: 1
},
value: {
type: [Number, Array],
default: 0
},
showInput: {
type: Boolean,
default: false
},
showInputControls: {
type: Boolean,
default: true
},
showStops: {
type: Boolean,
default: false
},
showTooltip: {
type: Boolean,
default: true
},
formatTooltip: Function,
disabled: {
type: Boolean,
default: false
},
range: {
type: Boolean,
default: false
},
vertical: {
type: Boolean,
default: false
},
height: {
type: String
}
},
components: {
ElInputNumber: _inputNumber2.default,
SliderButton: _button2.default
},
data: function data() {
return {
firstValue: null,
secondValue: null,
oldValue: null,
dragging: false
};
},
watch: {
value: function value(val, oldVal) {
if (this.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every(function (item, index) {
return item === oldVal[index];
})) {
return;
}
this.setValues();
},
dragging: function dragging(val) {
if (!val) {
this.setValues();
}
},
firstValue: function firstValue(val) {
if (this.range) {
this.$emit('input', [this.minValue, this.maxValue]);
} else {
this.$emit('input', val);
}
},
secondValue: function secondValue() {
if (this.range) {
this.$emit('input', [this.minValue, this.maxValue]);
}
},
min: function min() {
this.setValues();
},
max: function max() {
this.setValues();
}
},
methods: {
valueChanged: function valueChanged() {
var _this = this;
if (this.range) {
return ![this.minValue, this.maxValue].every(function (item, index) {
return item === _this.oldValue[index];
});
} else {
return this.value !== this.oldValue;
}
},
setValues: function setValues() {
var val = this.value;
if (this.range && Array.isArray(val)) {
if (val[1] < this.min) {
this.$emit('input', [this.min, this.min]);
} else if (val[0] > this.max) {
this.$emit('input', [this.max, this.max]);
} else if (val[0] < this.min) {
this.$emit('input', [this.min, val[1]]);
} else if (val[1] > this.max) {
this.$emit('input', [val[0], this.max]);
} else {
this.firstValue = val[0];
this.secondValue = val[1];
if (this.valueChanged()) {
this.$emit('change', [this.minValue, this.maxValue]);
this.dispatch('ElFormItem', 'el.form.change', [this.minValue, this.maxValue]);
this.oldValue = val.slice();
}
}
} else if (!this.range && typeof val === 'number' && !isNaN(val)) {
if (val < this.min) {
this.$emit('input', this.min);
} else if (val > this.max) {
this.$emit('input', this.max);
} else {
this.firstValue = val;
if (this.valueChanged()) {
this.$emit('change', val);
this.dispatch('ElFormItem', 'el.form.change', val);
this.oldValue = val;
}
}
}
},
setPosition: function setPosition(percent) {
var targetValue = this.min + percent * (this.max - this.min) / 100;
if (!this.range) {
this.$refs.button1.setPosition(percent);
return;
}
var button = void 0;
if (Math.abs(this.minValue - targetValue) < Math.abs(this.maxValue - targetValue)) {
button = this.firstValue < this.secondValue ? 'button1' : 'button2';
} else {
button = this.firstValue > this.secondValue ? 'button1' : 'button2';
}
this.$refs[button].setPosition(percent);
},
onSliderClick: function onSliderClick(event) {
if (this.disabled || this.dragging) return;
if (this.vertical) {
var sliderOffsetBottom = this.$refs.slider.getBoundingClientRect().bottom;
this.setPosition((sliderOffsetBottom - event.clientY) / this.$sliderSize * 100);
} else {
var sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
this.setPosition((event.clientX - sliderOffsetLeft) / this.$sliderSize * 100);
}
}
},
computed: {
$sliderSize: function $sliderSize() {
return parseInt((0, _dom.getStyle)(this.$refs.slider, this.vertical ? 'height' : 'width'), 10);
},
stops: function stops() {
var _this2 = this;
if (this.step === 0) {
("production") !== 'production' && console.warn('[Element Warn][Slider]step should not be 0.');
return [];
}
var stopCount = (this.max - this.min) / this.step;
var stepWidth = 100 * this.step / (this.max - this.min);
var result = [];
for (var i = 1; i < stopCount; i++) {
result.push(i * stepWidth);
}
if (this.range) {
return result.filter(function (step) {
return step < 100 * (_this2.minValue - _this2.min) / (_this2.max - _this2.min) || step > 100 * (_this2.maxValue - _this2.min) / (_this2.max - _this2.min);
});
} else {
return result.filter(function (step) {
return step > 100 * (_this2.firstValue - _this2.min) / (_this2.max - _this2.min);
});
}
},
minValue: function minValue() {
return Math.min(this.firstValue, this.secondValue);
},
maxValue: function maxValue() {
return Math.max(this.firstValue, this.secondValue);
},
barSize: function barSize() {
return this.range ? 100 * (this.maxValue - this.minValue) / (this.max - this.min) + '%' : 100 * (this.firstValue - this.min) / (this.max - this.min) + '%';
},
barStart: function barStart() {
return this.range ? 100 * (this.minValue - this.min) / (this.max - this.min) + '%' : '0%';
},
precision: function precision() {
var precisions = [this.min, this.max, this.step].map(function (item) {
var decimal = ('' + item).split('.')[1];
return decimal ? decimal.length : 0;
});
return Math.max.apply(null, precisions);
},
runwayStyle: function runwayStyle() {
return this.vertical ? { height: this.height } : {};
},
barStyle: function barStyle() {
return this.vertical ? {
height: this.barSize,
bottom: this.barStart
} : {
width: this.barSize,
left: this.barStart
};
}
},
mounted: function mounted() {
if (this.range) {
if (Array.isArray(this.value)) {
this.firstValue = Math.max(this.min, this.value[0]);
this.secondValue = Math.min(this.max, this.value[1]);
} else {
this.firstValue = this.min;
this.secondValue = this.max;
}
this.oldValue = [this.firstValue, this.secondValue];
} else {
if (typeof this.value !== 'number' || isNaN(this.value)) {
this.firstValue = this.min;
} else {
this.firstValue = Math.min(this.max, Math.max(this.min, this.value));
}
this.oldValue = this.firstValue;
}
}
};
/***/ },
/* 255 */
/***/ function(module, exports) {
module.exports = __webpack_require__(66);
/***/ },
/* 256 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(257),
/* template */
__webpack_require__(258),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 257 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _tooltip = __webpack_require__(138);
var _tooltip2 = _interopRequireDefault(_tooltip);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElSliderButton',
components: {
ElTooltip: _tooltip2.default
},
props: {
value: {
type: Number,
default: 0
},
vertical: {
type: Boolean,
default: false
}
},
data: function data() {
return {
hovering: false,
dragging: false,
startX: 0,
currentX: 0,
startY: 0,
currentY: 0,
startPosition: 0,
newPosition: null,
oldValue: this.value
};
},
computed: {
disabled: function disabled() {
return this.$parent.disabled;
},
max: function max() {
return this.$parent.max;
},
min: function min() {
return this.$parent.min;
},
step: function step() {
return this.$parent.step;
},
showTooltip: function showTooltip() {
return this.$parent.showTooltip;
},
precision: function precision() {
return this.$parent.precision;
},
currentPosition: function currentPosition() {
return (this.value - this.min) / (this.max - this.min) * 100 + '%';
},
enableFormat: function enableFormat() {
return this.$parent.formatTooltip instanceof Function;
},
formatValue: function formatValue() {
return this.enableFormat && this.$parent.formatTooltip(this.value) || this.value;
},
wrapperStyle: function wrapperStyle() {
return this.vertical ? { bottom: this.currentPosition } : { left: this.currentPosition };
}
},
watch: {
dragging: function dragging(val) {
this.$parent.dragging = val;
}
},
methods: {
displayTooltip: function displayTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = true);
},
hideTooltip: function hideTooltip() {
this.$refs.tooltip && (this.$refs.tooltip.showPopper = false);
},
handleMouseEnter: function handleMouseEnter() {
this.hovering = true;
this.displayTooltip();
},
handleMouseLeave: function handleMouseLeave() {
this.hovering = false;
this.hideTooltip();
},
onButtonDown: function onButtonDown(event) {
if (this.disabled) return;
event.preventDefault();
this.onDragStart(event);
window.addEventListener('mousemove', this.onDragging);
window.addEventListener('mouseup', this.onDragEnd);
window.addEventListener('contextmenu', this.onDragEnd);
},
onDragStart: function onDragStart(event) {
this.dragging = true;
if (this.vertical) {
this.startY = event.clientY;
} else {
this.startX = event.clientX;
}
this.startPosition = parseFloat(this.currentPosition);
},
onDragging: function onDragging(event) {
if (this.dragging) {
this.displayTooltip();
var diff = 0;
if (this.vertical) {
this.currentY = event.clientY;
diff = (this.startY - this.currentY) / this.$parent.$sliderSize * 100;
} else {
this.currentX = event.clientX;
diff = (this.currentX - this.startX) / this.$parent.$sliderSize * 100;
}
this.newPosition = this.startPosition + diff;
this.setPosition(this.newPosition);
}
},
onDragEnd: function onDragEnd() {
var _this = this;
if (this.dragging) {
/*
* 防止在 mouseup 后立即触发 click,导致滑块有几率产生一小段位移
* 不使用 preventDefault 是因为 mouseup 和 click 没有注册在同一个 DOM 上
*/
setTimeout(function () {
_this.dragging = false;
_this.hideTooltip();
_this.setPosition(_this.newPosition);
}, 0);
window.removeEventListener('mousemove', this.onDragging);
window.removeEventListener('mouseup', this.onDragEnd);
window.removeEventListener('contextmenu', this.onDragEnd);
}
},
setPosition: function setPosition(newPosition) {
if (newPosition < 0) {
newPosition = 0;
} else if (newPosition > 100) {
newPosition = 100;
}
var lengthPerStep = 100 / ((this.max - this.min) / this.step);
var steps = Math.round(newPosition / lengthPerStep);
var value = steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min;
value = parseFloat(value.toFixed(this.precision));
this.$emit('input', value);
this.$refs.tooltip && this.$refs.tooltip.updatePopper();
if (!this.dragging && this.value !== this.oldValue) {
this.oldValue = this.value;
}
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 258 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
ref: "button",
staticClass: "el-slider__button-wrapper",
class: {
'hover': _vm.hovering, 'dragging': _vm.dragging
},
style: (_vm.wrapperStyle),
on: {
"mouseenter": _vm.handleMouseEnter,
"mouseleave": _vm.handleMouseLeave,
"mousedown": _vm.onButtonDown
}
}, [_c('el-tooltip', {
ref: "tooltip",
attrs: {
"placement": "top",
"disabled": !_vm.showTooltip
}
}, [_c('span', {
slot: "content"
}, [_vm._v(_vm._s(_vm.formatValue))]), _c('div', {
staticClass: "el-slider__button",
class: {
'hover': _vm.hovering, 'dragging': _vm.dragging
}
})])], 1)
},staticRenderFns: []}
/***/ },
/* 259 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-slider",
class: {
'is-vertical': _vm.vertical, 'el-slider--with-input': _vm.showInput
}
}, [(_vm.showInput && !_vm.range) ? _c('el-input-number', {
ref: "input",
staticClass: "el-slider__input",
attrs: {
"step": _vm.step,
"disabled": _vm.disabled,
"controls": _vm.showInputControls,
"min": _vm.min,
"max": _vm.max,
"size": "small"
},
model: {
value: (_vm.firstValue),
callback: function($$v) {
_vm.firstValue = $$v
},
expression: "firstValue"
}
}) : _vm._e(), _c('div', {
ref: "slider",
staticClass: "el-slider__runway",
class: {
'show-input': _vm.showInput, 'disabled': _vm.disabled
},
style: (_vm.runwayStyle),
on: {
"click": _vm.onSliderClick
}
}, [_c('div', {
staticClass: "el-slider__bar",
style: (_vm.barStyle)
}), _c('slider-button', {
ref: "button1",
attrs: {
"vertical": _vm.vertical
},
model: {
value: (_vm.firstValue),
callback: function($$v) {
_vm.firstValue = $$v
},
expression: "firstValue"
}
}), (_vm.range) ? _c('slider-button', {
ref: "button2",
attrs: {
"vertical": _vm.vertical
},
model: {
value: (_vm.secondValue),
callback: function($$v) {
_vm.secondValue = $$v
},
expression: "secondValue"
}
}) : _vm._e(), _vm._l((_vm.stops), function(item) {
return (_vm.showStops) ? _c('div', {
staticClass: "el-slider__stop",
style: (_vm.vertical ? {
'bottom': item + '%'
} : {
'left': item + '%'
})
}) : _vm._e()
})], 2)], 1)
},staticRenderFns: []}
/***/ },
/* 260 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _directive = __webpack_require__(261);
var _directive2 = _interopRequireDefault(_directive);
var _index = __webpack_require__(265);
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
install: function install(Vue) {
Vue.use(_directive2.default);
Vue.prototype.$loading = _index2.default;
},
directive: _directive2.default,
service: _index2.default
};
/***/ },
/* 261 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _dom = __webpack_require__(45);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Mask = _vue2.default.extend(__webpack_require__(262));
exports.install = function (Vue) {
if (Vue.prototype.$isServer) return;
var toggleLoading = function toggleLoading(el, binding) {
if (binding.value) {
Vue.nextTick(function () {
if (binding.modifiers.fullscreen) {
el.originalPosition = document.body.style.position;
el.originalOverflow = document.body.style.overflow;
(0, _dom.addClass)(el.mask, 'is-fullscreen');
insertDom(document.body, el, binding);
} else {
(0, _dom.removeClass)(el.mask, 'is-fullscreen');
if (binding.modifiers.body) {
el.originalPosition = document.body.style.position;
['top', 'left'].forEach(function (property) {
var scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
el.maskStyle[property] = el.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] + 'px';
});
['height', 'width'].forEach(function (property) {
el.maskStyle[property] = el.getBoundingClientRect()[property] + 'px';
});
insertDom(document.body, el, binding);
} else {
el.originalPosition = el.style.position;
insertDom(el, el, binding);
}
}
});
} else {
if (el.domVisible) {
el.instance.$on('after-leave', function (_) {
el.domVisible = false;
if (binding.modifiers.fullscreen && el.originalOverflow !== 'hidden') {
document.body.style.overflow = el.originalOverflow;
}
if (binding.modifiers.fullscreen || binding.modifiers.body) {
document.body.style.position = el.originalPosition;
} else {
el.style.position = el.originalPosition;
}
});
el.instance.visible = false;
}
}
};
var insertDom = function insertDom(parent, el, binding) {
if (!el.domVisible && (0, _dom.getStyle)(el, 'display') !== 'none' && (0, _dom.getStyle)(el, 'visibility') !== 'hidden') {
Object.keys(el.maskStyle).forEach(function (property) {
el.mask.style[property] = el.maskStyle[property];
});
if (el.originalPosition !== 'absolute') {
parent.style.position = 'relative';
}
if (binding.modifiers.fullscreen && binding.modifiers.lock) {
parent.style.overflow = 'hidden';
}
el.domVisible = true;
parent.appendChild(el.mask);
Vue.nextTick(function () {
el.instance.visible = true;
});
el.domInserted = true;
}
};
Vue.directive('loading', {
bind: function bind(el, binding) {
var mask = new Mask({
el: document.createElement('div'),
data: {
text: el.getAttribute('element-loading-text'),
fullscreen: !!binding.modifiers.fullscreen
}
});
el.instance = mask;
el.mask = mask.$el;
el.maskStyle = {};
toggleLoading(el, binding);
},
update: function update(el, binding) {
el.instance.setText(el.getAttribute('element-loading-text'));
if (binding.oldValue !== binding.value) {
toggleLoading(el, binding);
}
},
unbind: function unbind(el, binding) {
if (el.domInserted) {
if (binding.modifiers.fullscreen || binding.modifiers.body) {
document.body.removeChild(el.mask);
} else {
el.mask && el.mask.parentNode && el.mask.parentNode.removeChild(el.mask);
}
}
}
});
};
/***/ },
/* 262 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(263),
/* template */
__webpack_require__(264),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 263 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
data: function data() {
return {
text: null,
fullscreen: true,
visible: false,
customClass: ''
};
},
methods: {
handleAfterLeave: function handleAfterLeave() {
this.$emit('after-leave');
},
setText: function setText(text) {
this.text = text;
}
}
};
/***/ },
/* 264 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-loading-fade"
},
on: {
"after-leave": _vm.handleAfterLeave
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-loading-mask",
class: [_vm.customClass, {
'is-fullscreen': _vm.fullscreen
}]
}, [_c('div', {
staticClass: "el-loading-spinner"
}, [_c('svg', {
staticClass: "circular",
attrs: {
"viewBox": "25 25 50 50"
}
}, [_c('circle', {
staticClass: "path",
attrs: {
"cx": "50",
"cy": "50",
"r": "20",
"fill": "none"
}
})]), (_vm.text) ? _c('p', {
staticClass: "el-loading-text"
}, [_vm._v(_vm._s(_vm.text))]) : _vm._e()])])])
},staticRenderFns: []}
/***/ },
/* 265 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _loading = __webpack_require__(262);
var _loading2 = _interopRequireDefault(_loading);
var _merge = __webpack_require__(65);
var _merge2 = _interopRequireDefault(_merge);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var LoadingConstructor = _vue2.default.extend(_loading2.default);
var defaults = {
text: null,
fullscreen: true,
body: false,
lock: false,
customClass: ''
};
var fullscreenLoading = void 0;
LoadingConstructor.prototype.originalPosition = '';
LoadingConstructor.prototype.originalOverflow = '';
LoadingConstructor.prototype.close = function () {
var _this = this;
if (this.fullscreen && this.originalOverflow !== 'hidden') {
document.body.style.overflow = this.originalOverflow;
}
if (this.fullscreen || this.body) {
document.body.style.position = this.originalPosition;
} else {
this.target.style.position = this.originalPosition;
}
if (this.fullscreen) {
fullscreenLoading = undefined;
}
this.$on('after-leave', function (_) {
_this.$el && _this.$el.parentNode && _this.$el.parentNode.removeChild(_this.$el);
_this.$destroy();
});
this.visible = false;
};
var addStyle = function addStyle(options, parent, instance) {
var maskStyle = {};
if (options.fullscreen) {
instance.originalPosition = document.body.style.position;
instance.originalOverflow = document.body.style.overflow;
} else if (options.body) {
instance.originalPosition = document.body.style.position;
['top', 'left'].forEach(function (property) {
var scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
maskStyle[property] = options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] + 'px';
});
['height', 'width'].forEach(function (property) {
maskStyle[property] = options.target.getBoundingClientRect()[property] + 'px';
});
} else {
instance.originalPosition = parent.style.position;
}
Object.keys(maskStyle).forEach(function (property) {
instance.$el.style[property] = maskStyle[property];
});
};
var Loading = function Loading() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (_vue2.default.prototype.$isServer) return;
options = (0, _merge2.default)({}, defaults, options);
if (typeof options.target === 'string') {
options.target = document.querySelector(options.target);
}
options.target = options.target || document.body;
if (options.target !== document.body) {
options.fullscreen = false;
} else {
options.body = true;
}
if (options.fullscreen && fullscreenLoading) {
return fullscreenLoading;
}
var parent = options.body ? document.body : options.target;
var instance = new LoadingConstructor({
el: document.createElement('div'),
data: options
});
addStyle(options, parent, instance);
if (instance.originalPosition !== 'absolute') {
parent.style.position = 'relative';
}
if (options.fullscreen && options.lock) {
parent.style.overflow = 'hidden';
}
parent.appendChild(instance.$el);
_vue2.default.nextTick(function () {
instance.visible = true;
});
if (options.fullscreen) {
fullscreenLoading = instance;
}
return instance;
};
exports.default = Loading;
/***/ },
/* 266 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _icon = __webpack_require__(267);
var _icon2 = _interopRequireDefault(_icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_icon2.default.install = function (Vue) {
Vue.component(_icon2.default.name, _icon2.default);
};
exports.default = _icon2.default;
/***/ },
/* 267 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(268),
/* template */
__webpack_require__(269),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 268 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
exports.default = {
name: 'ElIcon',
props: {
name: String
}
};
/***/ },
/* 269 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('i', {
class: 'el-icon-' + _vm.name
})
},staticRenderFns: []}
/***/ },
/* 270 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _row = __webpack_require__(271);
var _row2 = _interopRequireDefault(_row);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_row2.default.install = function (Vue) {
Vue.component(_row2.default.name, _row2.default);
};
exports.default = _row2.default;
/***/ },
/* 271 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.default = {
name: 'ElRow',
componentName: 'ElRow',
props: {
tag: {
type: String,
default: 'div'
},
gutter: Number,
type: String,
justify: {
type: String,
default: 'start'
},
align: {
type: String,
default: 'top'
}
},
computed: {
style: function style() {
var ret = {};
if (this.gutter) {
ret.marginLeft = '-' + this.gutter / 2 + 'px';
ret.marginRight = ret.marginLeft;
}
return ret;
}
},
render: function render(h) {
return h(this.tag, {
class: ['el-row', this.justify !== 'start' ? 'is-justify-' + this.justify : '', this.align !== 'top' ? 'is-align-' + this.align : '', { 'el-row--flex': this.type === 'flex' }],
style: this.style
}, this.$slots.default);
}
};
/***/ },
/* 272 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _col = __webpack_require__(273);
var _col2 = _interopRequireDefault(_col);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_col2.default.install = function (Vue) {
Vue.component(_col2.default.name, _col2.default);
};
exports.default = _col2.default;
/***/ },
/* 273 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = {
name: 'ElCol',
props: {
span: {
type: Number,
default: 24
},
tag: {
type: String,
default: 'div'
},
offset: Number,
pull: Number,
push: Number,
xs: [Number, Object],
sm: [Number, Object],
md: [Number, Object],
lg: [Number, Object]
},
computed: {
gutter: function gutter() {
var parent = this.$parent;
while (parent && parent.$options.componentName !== 'ElRow') {
parent = parent.$parent;
}
return parent ? parent.gutter : 0;
}
},
render: function render(h) {
var _this = this;
var classList = [];
var style = {};
if (this.gutter) {
style.paddingLeft = this.gutter / 2 + 'px';
style.paddingRight = style.paddingLeft;
}
['span', 'offset', 'pull', 'push'].forEach(function (prop) {
if (_this[prop]) {
classList.push(prop !== 'span' ? 'el-col-' + prop + '-' + _this[prop] : 'el-col-' + _this[prop]);
}
});
['xs', 'sm', 'md', 'lg'].forEach(function (size) {
if (typeof _this[size] === 'number') {
classList.push('el-col-' + size + '-' + _this[size]);
} else if (_typeof(_this[size]) === 'object') {
(function () {
var props = _this[size];
Object.keys(props).forEach(function (prop) {
classList.push(prop !== 'span' ? 'el-col-' + size + '-' + prop + '-' + props[prop] : 'el-col-' + size + '-' + props[prop]);
});
})();
}
});
return h(this.tag, {
class: ['el-col', classList],
style: style
}, this.$slots.default);
}
};
/***/ },
/* 274 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _src = __webpack_require__(275);
var _src2 = _interopRequireDefault(_src);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_src2.default.install = function (Vue) {
Vue.component(_src2.default.name, _src2.default);
};
exports.default = _src2.default;
/***/ },
/* 275 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(276),
/* template */
null,
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 276 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _uploadList = __webpack_require__(277);
var _uploadList2 = _interopRequireDefault(_uploadList);
var _upload = __webpack_require__(281);
var _upload2 = _interopRequireDefault(_upload);
var _iframeUpload = __webpack_require__(287);
var _iframeUpload2 = _interopRequireDefault(_iframeUpload);
var _progress = __webpack_require__(279);
var _progress2 = _interopRequireDefault(_progress);
var _migrating = __webpack_require__(289);
var _migrating2 = _interopRequireDefault(_migrating);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function noop() {}
exports.default = {
name: 'ElUpload',
mixins: [_migrating2.default],
components: {
ElProgress: _progress2.default,
UploadList: _uploadList2.default,
Upload: _upload2.default,
IframeUpload: _iframeUpload2.default
},
provide: {
uploader: undefined
},
props: {
action: {
type: String,
required: true
},
headers: {
type: Object,
default: function _default() {
return {};
}
},
data: Object,
multiple: Boolean,
name: {
type: String,
default: 'file'
},
drag: Boolean,
dragger: Boolean,
withCredentials: Boolean,
showFileList: {
type: Boolean,
default: true
},
accept: String,
type: {
type: String,
default: 'select'
},
beforeUpload: Function,
onRemove: {
type: Function,
default: noop
},
onChange: {
type: Function,
default: noop
},
onPreview: {
type: Function
},
onSuccess: {
type: Function,
default: noop
},
onProgress: {
type: Function,
default: noop
},
onError: {
type: Function,
default: noop
},
fileList: {
type: Array,
default: function _default() {
return [];
}
},
autoUpload: {
type: Boolean,
default: true
},
listType: {
type: String,
default: 'text' // text,picture,picture-card
},
httpRequest: Function,
disabled: Boolean
},
data: function data() {
return {
uploadFiles: [],
dragOver: false,
draging: false,
tempIndex: 1
};
},
watch: {
fileList: {
immediate: true,
handler: function handler(fileList) {
var _this = this;
this.uploadFiles = fileList.map(function (item) {
item.uid = item.uid || Date.now() + _this.tempIndex++;
item.status = 'success';
return item;
});
}
}
},
methods: {
handleStart: function handleStart(rawFile) {
rawFile.uid = Date.now() + this.tempIndex++;
var file = {
status: 'ready',
name: rawFile.name,
size: rawFile.size,
percentage: 0,
uid: rawFile.uid,
raw: rawFile
};
try {
file.url = URL.createObjectURL(rawFile);
} catch (err) {
console.error(err);
return;
}
this.uploadFiles.push(file);
this.onChange(file, this.uploadFiles);
},
handleProgress: function handleProgress(ev, rawFile) {
var file = this.getFile(rawFile);
this.onProgress(ev, file, this.uploadFiles);
file.status = 'uploading';
file.percentage = ev.percent || 0;
},
handleSuccess: function handleSuccess(res, rawFile) {
var file = this.getFile(rawFile);
if (file) {
file.status = 'success';
file.response = res;
this.onSuccess(res, file, this.uploadFiles);
this.onChange(file, this.uploadFiles);
}
},
handleError: function handleError(err, rawFile) {
var file = this.getFile(rawFile);
var fileList = this.uploadFiles;
file.status = 'fail';
fileList.splice(fileList.indexOf(file), 1);
this.onError(err, file, this.uploadFiles);
this.onChange(file, this.uploadFiles);
},
handleRemove: function handleRemove(file, raw) {
if (raw) {
file = this.getFile(raw);
}
this.abort(file);
var fileList = this.uploadFiles;
fileList.splice(fileList.indexOf(file), 1);
this.onRemove(file, fileList);
},
getFile: function getFile(rawFile) {
var fileList = this.uploadFiles;
var target;
fileList.every(function (item) {
target = rawFile.uid === item.uid ? item : null;
return !target;
});
return target;
},
abort: function abort(file) {
this.$refs['upload-inner'].abort(file);
},
clearFiles: function clearFiles() {
this.uploadFiles = [];
},
submit: function submit() {
var _this2 = this;
this.uploadFiles.filter(function (file) {
return file.status === 'ready';
}).forEach(function (file) {
_this2.$refs['upload-inner'].upload(file.raw);
});
},
getMigratingConfig: function getMigratingConfig() {
return {
props: {
'default-file-list': 'default-file-list is renamed to file-list.',
'show-upload-list': 'show-upload-list is renamed to show-file-list.',
'thumbnail-mode': 'thumbnail-mode has been deprecated, you can implement the same effect according to this case: http://element.eleme.io/#/zh-CN/component/upload#yong-hu-tou-xiang-shang-chuan'
}
};
}
},
render: function render(h) {
var uploadList;
if (this.showFileList) {
uploadList = h(
_uploadList2.default,
{
attrs: {
disabled: this.disabled,
listType: this.listType,
files: this.uploadFiles,
handlePreview: this.onPreview },
on: {
'remove': this.handleRemove
}
},
[]
);
}
var uploadData = {
props: {
type: this.type,
drag: this.drag,
action: this.action,
multiple: this.multiple,
'before-upload': this.beforeUpload,
'with-credentials': this.withCredentials,
headers: this.headers,
name: this.name,
data: this.data,
accept: this.accept,
fileList: this.uploadFiles,
autoUpload: this.autoUpload,
listType: this.listType,
disabled: this.disabled,
'on-start': this.handleStart,
'on-progress': this.handleProgress,
'on-success': this.handleSuccess,
'on-error': this.handleError,
'on-preview': this.onPreview,
'on-remove': this.handleRemove,
'http-request': this.httpRequest
},
ref: 'upload-inner'
};
var trigger = this.$slots.trigger || this.$slots.default;
var uploadComponent = typeof FormData !== 'undefined' || this.$isServer ? h(
'upload',
uploadData,
[trigger]
) : h(
'iframeUpload',
uploadData,
[trigger]
);
return h(
'div',
null,
[this.listType === 'picture-card' ? uploadList : '', this.$slots.trigger ? [uploadComponent, this.$slots.default] : uploadComponent, this.$slots.tip, this.listType !== 'picture-card' ? uploadList : '']
);
}
};
/***/ },
/* 277 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(278),
/* template */
__webpack_require__(280),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 278 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _progress = __webpack_require__(279);
var _progress2 = _interopRequireDefault(_progress);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
mixins: [_locale2.default],
components: { ElProgress: _progress2.default },
props: {
files: {
type: Array,
default: function _default() {
return [];
}
},
disabled: {
type: Boolean,
default: false
},
handlePreview: Function,
listType: String
},
methods: {
parsePercentage: function parsePercentage(val) {
return parseInt(val, 10);
},
handleClick: function handleClick(file) {
this.handlePreview && this.handlePreview(file);
}
}
};
/***/ },
/* 279 */
/***/ function(module, exports) {
module.exports = __webpack_require__(67);
/***/ },
/* 280 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition-group', {
class: [
'el-upload-list',
'el-upload-list--' + _vm.listType, {
'is-disabled': _vm.disabled
}
],
attrs: {
"tag": "ul",
"name": "el-list"
}
}, _vm._l((_vm.files), function(file, index) {
return _c('li', {
key: index,
class: ['el-upload-list__item', 'is-' + file.status]
}, [(file.status !== 'uploading' && ['picture-card', 'picture'].indexOf(_vm.listType) > -1) ? _c('img', {
staticClass: "el-upload-list__item-thumbnail",
attrs: {
"src": file.url,
"alt": ""
}
}) : _vm._e(), _c('a', {
staticClass: "el-upload-list__item-name",
on: {
"click": function($event) {
_vm.handleClick(file)
}
}
}, [_c('i', {
staticClass: "el-icon-document"
}), _vm._v(_vm._s(file.name) + "\n ")]), _c('label', {
staticClass: "el-upload-list__item-status-label"
}, [_c('i', {
class: {
'el-icon-upload-success': true,
'el-icon-circle-check': _vm.listType === 'text',
'el-icon-check': ['picture-card', 'picture'].indexOf(_vm.listType) > -1
}
})]), (!_vm.disabled) ? _c('i', {
staticClass: "el-icon-close",
on: {
"click": function($event) {
_vm.$emit('remove', file)
}
}
}) : _vm._e(), (file.status === 'uploading') ? _c('el-progress', {
attrs: {
"type": _vm.listType === 'picture-card' ? 'circle' : 'line',
"stroke-width": _vm.listType === 'picture-card' ? 6 : 2,
"percentage": _vm.parsePercentage(file.percentage)
}
}) : _vm._e(), (_vm.listType === 'picture-card') ? _c('span', {
staticClass: "el-upload-list__item-actions"
}, [(_vm.handlePreview && _vm.listType === 'picture-card') ? _c('span', {
staticClass: "el-upload-list__item-preview",
on: {
"click": function($event) {
_vm.handlePreview(file)
}
}
}, [_c('i', {
staticClass: "el-icon-view"
})]) : _vm._e(), (!_vm.disabled) ? _c('span', {
staticClass: "el-upload-list__item-delete",
on: {
"click": function($event) {
_vm.$emit('remove', file)
}
}
}, [_c('i', {
staticClass: "el-icon-delete2"
})]) : _vm._e()]) : _vm._e()], 1)
}))
},staticRenderFns: []}
/***/ },
/* 281 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(282),
/* template */
null,
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 282 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _ajax = __webpack_require__(283);
var _ajax2 = _interopRequireDefault(_ajax);
var _uploadDragger = __webpack_require__(284);
var _uploadDragger2 = _interopRequireDefault(_uploadDragger);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
inject: ['uploader'],
components: {
UploadDragger: _uploadDragger2.default
},
props: {
type: String,
action: {
type: String,
required: true
},
name: {
type: String,
default: 'file'
},
data: Object,
headers: Object,
withCredentials: Boolean,
multiple: Boolean,
accept: String,
onStart: Function,
onProgress: Function,
onSuccess: Function,
onError: Function,
beforeUpload: Function,
drag: Boolean,
onPreview: {
type: Function,
default: function _default() {}
},
onRemove: {
type: Function,
default: function _default() {}
},
fileList: Array,
autoUpload: Boolean,
listType: String,
httpRequest: {
type: Function,
default: _ajax2.default
},
disabled: Boolean
},
data: function data() {
return {
mouseover: false,
reqs: {}
};
},
methods: {
isImage: function isImage(str) {
return str.indexOf('image') !== -1;
},
handleChange: function handleChange(ev) {
var files = ev.target.files;
if (!files) return;
this.uploadFiles(files);
},
uploadFiles: function uploadFiles(files) {
var _this = this;
var postFiles = Array.prototype.slice.call(files);
if (!this.multiple) {
postFiles = postFiles.slice(0, 1);
}
if (postFiles.length === 0) {
return;
}
postFiles.forEach(function (rawFile) {
_this.onStart(rawFile);
if (_this.autoUpload) _this.upload(rawFile);
});
},
upload: function upload(rawFile, file) {
var _this2 = this;
this.$refs.input.value = null;
if (!this.beforeUpload) {
return this.post(rawFile);
}
var before = this.beforeUpload(rawFile);
if (before && before.then) {
before.then(function (processedFile) {
if (Object.prototype.toString.call(processedFile) === '[object File]') {
_this2.post(processedFile);
} else {
_this2.post(rawFile);
}
}, function () {
_this2.onRemove(rawFile, true);
});
} else if (before !== false) {
this.post(rawFile);
} else {
this.onRemove(rawFile, true);
}
},
abort: function abort(file) {
var reqs = this.reqs;
if (file) {
var uid = file;
if (file.uid) uid = file.uid;
if (reqs[uid]) {
reqs[uid].abort();
}
} else {
Object.keys(reqs).forEach(function (uid) {
if (reqs[uid]) reqs[uid].abort();
delete reqs[uid];
});
}
},
post: function post(rawFile) {
var _this3 = this;
var uid = rawFile.uid;
var options = {
headers: this.headers,
withCredentials: this.withCredentials,
file: rawFile,
data: this.data,
filename: this.name,
action: this.action,
onProgress: function onProgress(e) {
_this3.onProgress(e, rawFile);
},
onSuccess: function onSuccess(res) {
_this3.onSuccess(res, rawFile);
delete _this3.reqs[uid];
},
onError: function onError(err) {
_this3.onError(err, rawFile);
delete _this3.reqs[uid];
}
};
var req = this.httpRequest(options);
this.reqs[uid] = req;
if (req && req.then) {
req.then(options.onSuccess, options.onError);
}
},
handleClick: function handleClick() {
if (!this.disabled) {
this.$refs.input.value = null;
this.$refs.input.click();
}
}
},
render: function render(h) {
var handleClick = this.handleClick,
drag = this.drag,
name = this.name,
handleChange = this.handleChange,
multiple = this.multiple,
accept = this.accept,
listType = this.listType,
uploadFiles = this.uploadFiles,
disabled = this.disabled;
var data = {
class: {
'el-upload': true
},
on: {
click: handleClick
}
};
data.class['el-upload--' + listType] = true;
return h(
'div',
data,
[drag ? h(
'upload-dragger',
{
attrs: { disabled: disabled },
on: {
'file': uploadFiles
}
},
[this.$slots.default]
) : this.$slots.default, h(
'input',
{ 'class': 'el-upload__input', attrs: { type: 'file', name: name, multiple: multiple, accept: accept },
ref: 'input', on: {
'change': handleChange
}
},
[]
)]
);
}
};
/***/ },
/* 283 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.default = upload;
function getError(action, option, xhr) {
var msg = void 0;
if (xhr.response) {
msg = xhr.status + ' ' + (xhr.response.error || xhr.response);
} else if (xhr.responseText) {
msg = xhr.status + ' ' + xhr.responseText;
} else {
msg = 'fail to post ' + action + ' ' + xhr.status;
}
var err = new Error(msg);
err.status = xhr.status;
err.method = 'post';
err.url = action;
return err;
}
function getBody(xhr) {
var text = xhr.responseText || xhr.response;
if (!text) {
return text;
}
try {
return JSON.parse(text);
} catch (e) {
return text;
}
}
function upload(option) {
if (typeof XMLHttpRequest === 'undefined') {
return;
}
var xhr = new XMLHttpRequest();
var action = option.action;
if (xhr.upload) {
xhr.upload.onprogress = function progress(e) {
if (e.total > 0) {
e.percent = e.loaded / e.total * 100;
}
option.onProgress(e);
};
}
var formData = new FormData();
if (option.data) {
Object.keys(option.data).map(function (key) {
formData.append(key, option.data[key]);
});
}
formData.append(option.filename, option.file);
xhr.onerror = function error(e) {
option.onError(e);
};
xhr.onload = function onload() {
if (xhr.status < 200 || xhr.status >= 300) {
return option.onError(getError(action, option, xhr));
}
option.onSuccess(getBody(xhr));
};
xhr.open('post', action, true);
if (option.withCredentials && 'withCredentials' in xhr) {
xhr.withCredentials = true;
}
var headers = option.headers || {};
for (var item in headers) {
if (headers.hasOwnProperty(item) && headers[item] !== null) {
xhr.setRequestHeader(item, headers[item]);
}
}
xhr.send(formData);
return xhr;
}
/***/ },
/* 284 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(285),
/* template */
__webpack_require__(286),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 285 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElUploadDrag',
props: {
disabled: Boolean
},
data: function data() {
return {
dragover: false
};
},
methods: {
onDragover: function onDragover() {
if (!this.disabled) {
this.dragover = true;
}
},
onDrop: function onDrop(e) {
if (!this.disabled) {
this.dragover = false;
this.$emit('file', e.dataTransfer.files);
}
}
}
};
/***/ },
/* 286 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-upload-dragger",
class: {
'is-dragover': _vm.dragover
},
on: {
"drop": function($event) {
$event.preventDefault();
_vm.onDrop($event)
},
"dragover": function($event) {
$event.preventDefault();
_vm.onDragover($event)
},
"dragleave": function($event) {
$event.preventDefault();
_vm.dragover = false
}
}
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 287 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(288),
/* template */
null,
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 288 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _uploadDragger = __webpack_require__(284);
var _uploadDragger2 = _interopRequireDefault(_uploadDragger);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
components: {
UploadDragger: _uploadDragger2.default
},
props: {
type: String,
data: {},
action: {
type: String,
required: true
},
name: {
type: String,
default: 'file'
},
withCredentials: Boolean,
accept: String,
onStart: Function,
onProgress: Function,
onSuccess: Function,
onError: Function,
beforeUpload: Function,
onPreview: {
type: Function,
default: function _default() {}
},
onRemove: {
type: Function,
default: function _default() {}
},
drag: Boolean,
listType: String,
disabled: Boolean
},
data: function data() {
return {
mouseover: false,
domain: '',
file: null,
submitting: false
};
},
methods: {
isImage: function isImage(str) {
return str.indexOf('image') !== -1;
},
handleClick: function handleClick() {
if (!this.disabled) {
this.$refs.input.click();
}
},
handleChange: function handleChange(ev) {
var file = ev.target.value;
if (file) {
this.uploadFiles(file);
}
},
uploadFiles: function uploadFiles(file) {
if (this.submitting) return;
this.submitting = true;
this.file = file;
this.onStart(file);
var formNode = this.getFormNode();
var dataSpan = this.getFormDataNode();
var data = this.data;
if (typeof data === 'function') {
data = data(file);
}
var inputs = [];
for (var key in data) {
if (data.hasOwnProperty(key)) {
inputs.push('<input name="' + key + '" value="' + data[key] + '"/>');
}
}
dataSpan.innerHTML = inputs.join('');
formNode.submit();
dataSpan.innerHTML = '';
},
getFormNode: function getFormNode() {
return this.$refs.form;
},
getFormDataNode: function getFormDataNode() {
return this.$refs.data;
}
},
created: function created() {
this.frameName = 'frame-' + Date.now();
},
mounted: function mounted() {
var self = this;
!this.$isServer && window.addEventListener('message', function (event) {
if (!self.file) return;
var targetOrigin = new URL(self.action).origin;
if (event.origin !== targetOrigin) return;
var response = event.data;
if (response.result === 'success') {
self.onSuccess(response, self.file);
} else if (response.result === 'failed') {
self.onError(response, self.file);
}
self.submitting = false;
self.file = null;
}, false);
},
render: function render(h) {
var drag = this.drag,
uploadFiles = this.uploadFiles,
listType = this.listType,
frameName = this.frameName,
disabled = this.disabled;
var oClass = { 'el-upload': true };
oClass['el-upload--' + listType] = true;
return h(
'div',
{
'class': oClass,
on: {
'click': this.handleClick
},
nativeOn: {
'drop': this.onDrop,
'dragover': this.handleDragover,
'dragleave': this.handleDragleave
}
},
[h(
'iframe',
{
on: {
'load': this.onload
},
ref: 'iframe',
attrs: { name: frameName
}
},
[]
), h(
'form',
{ ref: 'form', attrs: { action: this.action, target: frameName, enctype: 'multipart/form-data', method: 'POST' }
},
[h(
'input',
{
'class': 'el-upload__input',
attrs: { type: 'file',
name: 'file',
accept: this.accept },
ref: 'input', on: {
'change': this.handleChange
}
},
[]
), h(
'input',
{
attrs: { type: 'hidden', name: 'documentDomain', value: this.$isServer ? '' : document.domain }
},
[]
), h(
'span',
{ ref: 'data' },
[]
)]
), drag ? h(
'upload-dragger',
{
on: {
'file': uploadFiles
},
attrs: { disabled: disabled }
},
[this.$slots.default]
) : this.$slots.default]
);
}
};
/***/ },
/* 289 */
/***/ function(module, exports) {
module.exports = __webpack_require__(68);
/***/ },
/* 290 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _progress = __webpack_require__(291);
var _progress2 = _interopRequireDefault(_progress);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_progress2.default.install = function (Vue) {
Vue.component(_progress2.default.name, _progress2.default);
};
exports.default = _progress2.default;
/***/ },
/* 291 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(292),
/* template */
__webpack_require__(293),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 292 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElProgress',
props: {
type: {
type: String,
default: 'line',
validator: function validator(val) {
return ['line', 'circle'].indexOf(val) > -1;
}
},
percentage: {
type: Number,
default: 0,
required: true,
validator: function validator(val) {
return val >= 0 && val <= 100;
}
},
status: {
type: String
},
strokeWidth: {
type: Number,
default: 6
},
textInside: {
type: Boolean,
default: false
},
width: {
type: Number,
default: 126
},
showText: {
type: Boolean,
default: true
}
},
computed: {
barStyle: function barStyle() {
var style = {};
style.width = this.percentage + '%';
return style;
},
relativeStrokeWidth: function relativeStrokeWidth() {
return (this.strokeWidth / this.width * 100).toFixed(1);
},
trackPath: function trackPath() {
var radius = parseInt(50 - parseFloat(this.relativeStrokeWidth) / 2, 10);
return 'M 50 50 m 0 -' + radius + ' a ' + radius + ' ' + radius + ' 0 1 1 0 ' + radius * 2 + ' a ' + radius + ' ' + radius + ' 0 1 1 0 -' + radius * 2;
},
perimeter: function perimeter() {
var radius = 50 - parseFloat(this.relativeStrokeWidth) / 2;
return 2 * Math.PI * radius;
},
circlePathStyle: function circlePathStyle() {
var perimeter = this.perimeter;
return {
strokeDasharray: perimeter + 'px,' + perimeter + 'px',
strokeDashoffset: (1 - this.percentage / 100) * perimeter + 'px',
transition: 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease'
};
},
stroke: function stroke() {
var ret;
switch (this.status) {
case 'success':
ret = '#13ce66';
break;
case 'exception':
ret = '#ff4949';
break;
default:
ret = '#20a0ff';
}
return ret;
},
iconClass: function iconClass() {
if (this.type === 'line') {
return this.status === 'success' ? 'el-icon-circle-check' : 'el-icon-circle-cross';
} else {
return this.status === 'success' ? 'el-icon-check' : 'el-icon-close';
}
},
progressTextSize: function progressTextSize() {
return this.type === 'line' ? 12 + this.strokeWidth * 0.4 : this.width * 0.111111 + 2;
}
}
};
/***/ },
/* 293 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-progress",
class: [
'el-progress--' + _vm.type,
_vm.status ? 'is-' + _vm.status : '', {
'el-progress--without-text': !_vm.showText,
'el-progress--text-inside': _vm.textInside,
}
]
}, [(_vm.type === 'line') ? _c('div', {
staticClass: "el-progress-bar"
}, [_c('div', {
staticClass: "el-progress-bar__outer",
style: ({
height: _vm.strokeWidth + 'px'
})
}, [_c('div', {
staticClass: "el-progress-bar__inner",
style: (_vm.barStyle)
}, [(_vm.showText && _vm.textInside) ? _c('div', {
staticClass: "el-progress-bar__innerText"
}, [_vm._v(_vm._s(_vm.percentage) + "%")]) : _vm._e()])])]) : _c('div', {
staticClass: "el-progress-circle",
style: ({
height: _vm.width + 'px',
width: _vm.width + 'px'
})
}, [_c('svg', {
attrs: {
"viewBox": "0 0 100 100"
}
}, [_c('path', {
staticClass: "el-progress-circle__track",
attrs: {
"d": _vm.trackPath,
"stroke": "#e5e9f2",
"stroke-width": _vm.relativeStrokeWidth,
"fill": "none"
}
}), _c('path', {
staticClass: "el-progress-circle__path",
style: (_vm.circlePathStyle),
attrs: {
"d": _vm.trackPath,
"stroke-linecap": "round",
"stroke": _vm.stroke,
"stroke-width": _vm.relativeStrokeWidth,
"fill": "none"
}
})])]), (_vm.showText && !_vm.textInside) ? _c('div', {
staticClass: "el-progress__text",
style: ({
fontSize: _vm.progressTextSize + 'px'
})
}, [(!_vm.status) ? [_vm._v(_vm._s(_vm.percentage) + "%")] : _c('i', {
class: _vm.iconClass
})], 2) : _vm._e()])
},staticRenderFns: []}
/***/ },
/* 294 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _spinner = __webpack_require__(295);
var _spinner2 = _interopRequireDefault(_spinner);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_spinner2.default.install = function (Vue) {
Vue.component(_spinner2.default.name, _spinner2.default);
};
exports.default = _spinner2.default;
/***/ },
/* 295 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(296),
/* template */
__webpack_require__(297),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 296 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
exports.default = {
name: 'ElSpinner',
props: {
type: String,
radius: {
type: Number,
default: 100
},
strokeWidth: {
type: Number,
default: 5
},
strokeColor: {
type: String,
default: '#efefef'
}
}
};
/***/ },
/* 297 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('span', {
staticClass: "el-spinner"
}, [_c('svg', {
staticClass: "el-spinner-inner",
style: ({
width: _vm.radius / 2 + 'px',
height: _vm.radius / 2 + 'px'
}),
attrs: {
"viewBox": "0 0 50 50"
}
}, [_c('circle', {
staticClass: "path",
attrs: {
"cx": "25",
"cy": "25",
"r": "20",
"fill": "none",
"stroke": _vm.strokeColor,
"stroke-width": _vm.strokeWidth
}
})])])
},staticRenderFns: []}
/***/ },
/* 298 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(299);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _main2.default;
/***/ },
/* 299 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _popup = __webpack_require__(14);
var _vdom = __webpack_require__(194);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var MessageConstructor = _vue2.default.extend(__webpack_require__(300));
var instance = void 0;
var instances = [];
var seed = 1;
var Message = function Message(options) {
if (_vue2.default.prototype.$isServer) return;
options = options || {};
if (typeof options === 'string') {
options = {
message: options
};
}
var userOnClose = options.onClose;
var id = 'message_' + seed++;
options.onClose = function () {
Message.close(id, userOnClose);
};
instance = new MessageConstructor({
data: options
});
instance.id = id;
if ((0, _vdom.isVNode)(instance.message)) {
instance.$slots.default = [instance.message];
instance.message = null;
}
instance.vm = instance.$mount();
document.body.appendChild(instance.vm.$el);
instance.vm.visible = true;
instance.dom = instance.vm.$el;
instance.dom.style.zIndex = _popup.PopupManager.nextZIndex();
instances.push(instance);
return instance.vm;
};
['success', 'warning', 'info', 'error'].forEach(function (type) {
Message[type] = function (options) {
if (typeof options === 'string') {
options = {
message: options
};
}
options.type = type;
return Message(options);
};
});
Message.close = function (id, userOnClose) {
for (var i = 0, len = instances.length; i < len; i++) {
if (id === instances[i].id) {
if (typeof userOnClose === 'function') {
userOnClose(instances[i]);
}
instances.splice(i, 1);
break;
}
}
};
Message.closeAll = function () {
for (var i = instances.length - 1; i >= 0; i--) {
instances[i].close();
}
};
exports.default = Message;
/***/ },
/* 300 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(301),
/* template */
__webpack_require__(307),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 301 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
data: function data() {
return {
visible: false,
message: '',
duration: 3000,
type: 'info',
iconClass: '',
customClass: '',
onClose: null,
showClose: false,
closed: false,
timer: null
};
},
computed: {
typeImg: function typeImg() {
return __webpack_require__(302)("./" + this.type + '.svg');
}
},
watch: {
closed: function closed(newVal) {
if (newVal) {
this.visible = false;
this.$el.addEventListener('transitionend', this.destroyElement);
}
}
},
methods: {
destroyElement: function destroyElement() {
this.$el.removeEventListener('transitionend', this.destroyElement);
this.$destroy(true);
this.$el.parentNode.removeChild(this.$el);
},
close: function close() {
this.closed = true;
if (typeof this.onClose === 'function') {
this.onClose(this);
}
},
clearTimer: function clearTimer() {
clearTimeout(this.timer);
},
startTimer: function startTimer() {
var _this = this;
if (this.duration > 0) {
this.timer = setTimeout(function () {
if (!_this.closed) {
_this.close();
}
}, this.duration);
}
}
},
mounted: function mounted() {
this.startTimer();
}
};
/***/ },
/* 302 */
/***/ function(module, exports, __webpack_require__) {
var map = {
"./error.svg": 303,
"./info.svg": 304,
"./success.svg": 305,
"./warning.svg": 306
};
function webpackContext(req) {
return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 302;
/***/ },
/* 303 */
/***/ function(module, exports) {
module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjQwcHgiIGhlaWdodD0iNDBweCIgdmlld0JveD0iMCAwIDQwIDQwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCAzOS4xICgzMTcyMCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+aWNvbl9kYW5nZXI8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZGVmcz48L2RlZnM+CiAgICA8ZyBpZD0iRWxlbWVudC1ndWlkZWxpbmUtdjAuMi40IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0iTWVzc2FnZSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTYwLjAwMDAwMCwgLTMzMi4wMDAwMDApIj4KICAgICAgICAgICAgPGcgaWQ9IuW4puWAvuWQkV/kv6Hmga8iIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYwLjAwMDAwMCwgMzMyLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPGcgaWQ9IlJlY3RhbmdsZS0yIj4KICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iaWNvbl9kYW5nZXIiPgogICAgICAgICAgICAgICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLTIiIGZpbGw9IiNGRjQ5NDkiIHg9IjAiIHk9IjAiIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCI+PC9yZWN0PgogICAgICAgICAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMjUuODE3MjYyNywxNi4zNDUxNzk2IEMyNS45MzkwOTAyLDE2LjIyMzM0ODMgMjYsMTYuMDc2MTQxOCAyNiwxNS45MDM1NTIzIEMyNiwxNS43MzA5NjI4IDI1LjkzOTA5MDIsMTUuNTgzNzU2MyAyNS44MTcyNjI3LDE1LjQ2MTkyODkgTDI0LjUwNzYxNTcsMTQuMTgyNzQxMSBDMjQuMzg1Nzg4MiwxNC4wNjA5MTM3IDI0LjI0MzY1NzUsMTQgMjQuMDgxMjE5NiwxNCBDMjMuOTE4NzgxNywxNCAyMy43NzY2NTEsMTQuMDYwOTEzNyAyMy42NTQ4MjM1LDE0LjE4Mjc0MTEgTDIwLDE3LjgzNzU2MzUgTDE2LjMxNDcyMTYsMTQuMTgyNzQxMSBDMTYuMTkyODkwMiwxNC4wNjA5MTM3IDE2LjA1MDc1OTUsMTQgMTUuODg4MzIxNiwxNCBDMTUuNzI1ODg3NiwxNCAxNS41ODM3NTY5LDE0LjA2MDkxMzcgMTUuNDYxOTI5NCwxNC4xODI3NDExIEwxNC4xNTIyODI0LDE1LjQ2MTkyODkgQzE0LjA1MDc1ODIsMTUuNTgzNzU2MyAxNCwxNS43MzA5NjI4IDE0LDE1LjkwMzU1MjMgQzE0LDE2LjA3NjE0MTggMTQuMDUwNzU4MiwxNi4yMjMzNDgzIDE0LjE1MjI4MjQsMTYuMzQ1MTc5NiBMMTcuODM3NTYwOCwyMC4wMDAwMDE5IEwxNC4xNTIyODI0LDIzLjY1NDgyNDMgQzE0LjA1MDc1ODIsMjMuNzc2NjUxNyAxNCwyMy45MjM4NTgyIDE0LDI0LjA5NjQ0NzcgQzE0LDI0LjI2OTAzNzIgMTQuMDUwNzU4MiwyNC40MTYyNDM3IDE0LjE1MjI4MjQsMjQuNTM4MDcxMSBMMTUuNDYxOTI5NCwyNS44MTcyNTg5IEMxNS41ODM3NTY5LDI1LjkzOTA4NjMgMTUuNzI1ODg3NiwyNiAxNS44ODgzMjE2LDI2IEMxNi4wNTA3NTk1LDI2IDE2LjE5Mjg5MDIsMjUuOTM5MDg2MyAxNi4zMTQ3MjE2LDI1LjgxNzI1ODkgTDIwLDIyLjE2MjQzNjUgTDIzLjY1NDgyMzUsMjUuODE3MjU4OSBDMjMuNzc2NjUxLDI1LjkzOTA4NjMgMjMuOTE4NzgxNywyNiAyNC4wODEyMTk2LDI2IEMyNC4yNDM2NTc1LDI2IDI0LjM4NTc4ODIsMjUuOTM5MDg2MyAyNC41MDc2MTU3LDI1LjgxNzI1ODkgTDI1LjgxNzI2MjcsMjQuNTM4MDcxMSBDMjUuOTM5MDkwMiwyNC40MTYyNDM3IDI2LDI0LjI2OTAzNzIgMjYsMjQuMDk2NDQ3NyBDMjYsMjMuOTIzODU4MiAyNS45MzkwOTAyLDIzLjc3NjY1MTcgMjUuODE3MjYyNywyMy42NTQ4MjQzIEwyMi4xMzE5ODA0LDIwLjAwMDAwMTkgTDI1LjgxNzI2MjcsMTYuMzQ1MTc5NiBaIiBpZD0iUGF0aCIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"
/***/ },
/* 304 */
/***/ function(module, exports) {
module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjQwcHgiIGhlaWdodD0iNDBweCIgdmlld0JveD0iMCAwIDQwIDQwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCAzOS4xICgzMTcyMCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+aWNvbl9pbmZvPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IkVsZW1lbnQtZ3VpZGVsaW5lLXYwLjIuNCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Ik1lc3NhZ2UiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02MC4wMDAwMDAsIC0xNTIuMDAwMDAwKSI+CiAgICAgICAgICAgIDxnIGlkPSLluKblgL7lkJFf5L+h5oGvIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg2MC4wMDAwMDAsIDE1Mi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSJSZWN0YW5nbGUtMiI+CiAgICAgICAgICAgICAgICAgICAgPGcgaWQ9Imljb25faW5mbyI+CiAgICAgICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMiIgZmlsbD0iIzUwQkZGRiIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIj48L3JlY3Q+CiAgICAgICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0yMS42MTUzODQ2LDI2LjU0MzIwOTkgQzIxLjYxNTM4NDYsMjYuOTQ3ODc1MSAyMS40NTgzMzQ4LDI3LjI5MTgzNjggMjEuMTQ0MjMwOCwyNy41NzUxMDI5IEMyMC44MzAxMjY4LDI3Ljg1ODM2ODkgMjAuNDQ4NzE5NCwyOCAyMCwyOCBDMTkuNTUxMjgwNiwyOCAxOS4xNjk4NzMyLDI3Ljg1ODM2ODkgMTguODU1NzY5MiwyNy41NzUxMDI5IEMxOC41NDE2NjUyLDI3LjI5MTgzNjggMTguMzg0NjE1NCwyNi45NDc4NzUxIDE4LjM4NDYxNTQsMjYuNTQzMjA5OSBMMTguMzg0NjE1NCwxOS43NDQ4NTYgQzE4LjM4NDYxNTQsMTkuMzQwMTkwNyAxOC41NDE2NjUyLDE4Ljk5NjIyOSAxOC44NTU3NjkyLDE4LjcxMjk2MyBDMTkuMTY5ODczMiwxOC40Mjk2OTY5IDE5LjU1MTI4MDYsMTguMjg4MDY1OCAyMCwxOC4yODgwNjU4IEMyMC40NDg3MTk0LDE4LjI4ODA2NTggMjAuODMwMTI2OCwxOC40Mjk2OTY5IDIxLjE0NDIzMDgsMTguNzEyOTYzIEMyMS40NTgzMzQ4LDE4Ljk5NjIyOSAyMS42MTUzODQ2LDE5LjM0MDE5MDcgMjEuNjE1Mzg0NiwxOS43NDQ4NTYgTDIxLjYxNTM4NDYsMjYuNTQzMjA5OSBaIE0yMCwxNS44MDQyOTgxIEMxOS40NDQ0NDI3LDE1LjgwNDI5ODEgMTguOTcyMjI0LDE1LjYxOTM2ODcgMTguNTgzMzMzMywxNS4yNDk1MDQ2IEMxOC4xOTQ0NDI3LDE0Ljg3OTY0MDYgMTgsMTQuNDMwNTI1NSAxOCwxMy45MDIxNDkxIEMxOCwxMy4zNzM3NzI2IDE4LjE5NDQ0MjcsMTIuOTI0NjU3NSAxOC41ODMzMzMzLDEyLjU1NDc5MzUgQzE4Ljk3MjIyNCwxMi4xODQ5Mjk1IDE5LjQ0NDQ0MjcsMTIgMjAsMTIgQzIwLjU1NTU1NzMsMTIgMjEuMDI3Nzc2LDEyLjE4NDkyOTUgMjEuNDE2NjY2NywxMi41NTQ3OTM1IEMyMS44MDU1NTczLDEyLjkyNDY1NzUgMjIsMTMuMzczNzcyNiAyMiwxMy45MDIxNDkxIEMyMiwxNC40MzA1MjU1IDIxLjgwNTU1NzMsMTQuODc5NjQwNiAyMS40MTY2NjY3LDE1LjI0OTUwNDYgQzIxLjAyNzc3NiwxNS42MTkzNjg3IDIwLjU1NTU1NzMsMTUuODA0Mjk4MSAyMCwxNS44MDQyOTgxIFoiIGlkPSJDb21iaW5lZC1TaGFwZSIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"
/***/ },
/* 305 */
/***/ function(module, exports) {
module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjQwcHgiIGhlaWdodD0iNDBweCIgdmlld0JveD0iMCAwIDQwIDQwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCAzOS4xICgzMTcyMCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+aWNvbl9zdWNjZXNzPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IkVsZW1lbnQtZ3VpZGVsaW5lLXYwLjIuNCIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Ik1lc3NhZ2UiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02MC4wMDAwMDAsIC0yMTIuMDAwMDAwKSI+CiAgICAgICAgICAgIDxnIGlkPSLluKblgL7lkJFf5L+h5oGvIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSg2MC4wMDAwMDAsIDIxMi4wMDAwMDApIj4KICAgICAgICAgICAgICAgIDxnIGlkPSJSZWN0YW5nbGUtMiI+CiAgICAgICAgICAgICAgICAgICAgPGcgaWQ9Imljb25fc3VjY2VzcyI+CiAgICAgICAgICAgICAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtMiIgZmlsbD0iIzEzQ0U2NiIgeD0iMCIgeT0iMCIgd2lkdGg9IjQwIiBoZWlnaHQ9IjQwIj48L3JlY3Q+CiAgICAgICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9Ik0yNy44MjU1ODE0LDE3LjE0ODQzNTcgTDE5LjAxNzQ0LDI1LjgyODEyMTMgQzE4LjkwMTE2MDksMjUuOTQyNzA4MyAxOC43NjU1MDMzLDI2IDE4LjYxMDQ2NywyNiBDMTguNDU1NDI3LDI2IDE4LjMxOTc2OTMsMjUuOTQyNzA4MyAxOC4yMDM0ODY1LDI1LjgyODEyMTMgTDE4LjAyOTA3MTYsMjUuNjU2MjUgTDEzLjE3NDQxODYsMjAuODQzNzUgQzEzLjA1ODEzOTUsMjAuNzI5MTYzIDEzLDIwLjU5NTQ4MzcgMTMsMjAuNDQyNzA0NyBDMTMsMjAuMjg5OTI5MyAxMy4wNTgxMzk1LDIwLjE1NjI1IDEzLjE3NDQxODYsMjAuMDQxNjY2NyBMMTQuMzY2Mjc3MiwxOC44NjcxODU3IEMxNC40ODI1NiwxOC43NTI2MDIzIDE0LjYxODIxNzcsMTguNjk1MzEwNyAxNC43NzMyNTc3LDE4LjY5NTMxMDcgQzE0LjkyODI5NCwxOC42OTUzMTA3IDE1LjA2Mzk1MTYsMTguNzUyNjAyMyAxNS4xODAyMzA3LDE4Ljg2NzE4NTcgTDE4LjYxMDQ2NywyMi4yNzYwMzggTDI1LjgxOTc2OTMsMTUuMTcxODcxMyBDMjUuOTM2MDQ4NCwxNS4wNTcyODggMjYuMDcxNzA2LDE1IDI2LjIyNjc0MjMsMTUgQzI2LjM4MTc4MjMsMTUgMjYuNTE3NDQsMTUuMDU3Mjg4IDI2LjYzMzcyMjgsMTUuMTcxODcxMyBMMjcuODI1NTgxNCwxNi4zNDYzNTIzIEMyNy45NDE4NjA1LDE2LjQ2MDkzNTcgMjgsMTYuNTk0NjE1IDI4LDE2Ljc0NzM5NCBDMjgsMTYuOTAwMTczIDI3Ljk0MTg2MDUsMTcuMDMzODUyMyAyNy44MjU1ODE0LDE3LjE0ODQzNTcgTDI3LjgyNTU4MTQsMTcuMTQ4NDM1NyBaIiBpZD0iUGF0aCIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+"
/***/ },
/* 306 */
/***/ function(module, exports) {
module.exports = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxzdmcgd2lkdGg9IjQwcHgiIGhlaWdodD0iNDBweCIgdmlld0JveD0iMCAwIDQwIDQwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPCEtLSBHZW5lcmF0b3I6IFNrZXRjaCAzOS4xICgzMTcyMCkgLSBodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2ggLS0+CiAgICA8dGl0bGU+aWNvbl93YXJuaW5nPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGRlZnM+PC9kZWZzPgogICAgPGcgaWQ9IlBhZ2UtMSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9Ik1lc3NhZ2UiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC02MC4wMDAwMDAsIC0yNzIuMDAwMDAwKSI+CiAgICAgICAgICAgIDxnIGlkPSLluKblgL7lkJFf5L+h5oGvLWNvcHkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDYwLjAwMDAwMCwgMjcyLjAwMDAwMCkiPgogICAgICAgICAgICAgICAgPGcgaWQ9IlJlY3RhbmdsZS0yIj4KICAgICAgICAgICAgICAgICAgICA8ZyBpZD0iaWNvbl93YXJuaW5nIj4KICAgICAgICAgICAgICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS0yIiBmaWxsPSIjRjdCQTJBIiB4PSIwIiB5PSIwIiB3aWR0aD0iNDAiIGhlaWdodD0iNDAiPjwvcmVjdD4KICAgICAgICAgICAgICAgICAgICAgICAgPHBhdGggZD0iTTIxLjYxNTM4NDYsMjYuNTQzMjA5OSBDMjEuNjE1Mzg0NiwyNi45NDc4NzUxIDIxLjQ1ODMzNDgsMjcuMjkxODM2OCAyMS4xNDQyMzA4LDI3LjU3NTEwMjkgQzIwLjgzMDEyNjgsMjcuODU4MzY4OSAyMC40NDg3MTk0LDI4IDIwLDI4IEMxOS41NTEyODA2LDI4IDE5LjE2OTg3MzIsMjcuODU4MzY4OSAxOC44NTU3NjkyLDI3LjU3NTEwMjkgQzE4LjU0MTY2NTIsMjcuMjkxODM2OCAxOC4zODQ2MTU0LDI2Ljk0Nzg3NTEgMTguMzg0NjE1NCwyNi41NDMyMDk5IEwxOC4zODQ2MTU0LDE5Ljc0NDg1NiBDMTguMzg0NjE1NCwxOS4zNDAxOTA3IDE4LjU0MTY2NTIsMTguOTk2MjI5IDE4Ljg1NTc2OTIsMTguNzEyOTYzIEMxOS4xNjk4NzMyLDE4LjQyOTY5NjkgMTkuNTUxMjgwNiwxOC4yODgwNjU4IDIwLDE4LjI4ODA2NTggQzIwLjQ0ODcxOTQsMTguMjg4MDY1OCAyMC44MzAxMjY4LDE4LjQyOTY5NjkgMjEuMTQ0MjMwOCwxOC43MTI5NjMgQzIxLjQ1ODMzNDgsMTguOTk2MjI5IDIxLjYxNTM4NDYsMTkuMzQwMTkwNyAyMS42MTUzODQ2LDE5Ljc0NDg1NiBMMjEuNjE1Mzg0NiwyNi41NDMyMDk5IFogTTIwLDE1LjgwNDI5ODEgQzE5LjQ0NDQ0MjcsMTUuODA0Mjk4MSAxOC45NzIyMjQsMTUuNjE5MzY4NyAxOC41ODMzMzMzLDE1LjI0OTUwNDYgQzE4LjE5NDQ0MjcsMTQuODc5NjQwNiAxOCwxNC40MzA1MjU1IDE4LDEzLjkwMjE0OTEgQzE4LDEzLjM3Mzc3MjYgMTguMTk0NDQyNywxMi45MjQ2NTc1IDE4LjU4MzMzMzMsMTIuNTU0NzkzNSBDMTguOTcyMjI0LDEyLjE4NDkyOTUgMTkuNDQ0NDQyNywxMiAyMCwxMiBDMjAuNTU1NTU3MywxMiAyMS4wMjc3NzYsMTIuMTg0OTI5NSAyMS40MTY2NjY3LDEyLjU1NDc5MzUgQzIxLjgwNTU1NzMsMTIuOTI0NjU3NSAyMiwxMy4zNzM3NzI2IDIyLDEzLjkwMjE0OTEgQzIyLDE0LjQzMDUyNTUgMjEuODA1NTU3MywxNC44Nzk2NDA2IDIxLjQxNjY2NjcsMTUuMjQ5NTA0NiBDMjEuMDI3Nzc2LDE1LjYxOTM2ODcgMjAuNTU1NTU3MywxNS44MDQyOTgxIDIwLDE1LjgwNDI5ODEgWiIgaWQ9IkNvbWJpbmVkLVNoYXBlIiBmaWxsPSIjRkZGRkZGIiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyMC4wMDAwMDAsIDIwLjAwMDAwMCkgc2NhbGUoMSwgLTEpIHRyYW5zbGF0ZSgtMjAuMDAwMDAwLCAtMjAuMDAwMDAwKSAiPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgICAgICA8L2c+CiAgICAgICAgICAgIDwvZz4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg=="
/***/ },
/* 307 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-message-fade"
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-message",
class: _vm.customClass,
on: {
"mouseenter": _vm.clearTimer,
"mouseleave": _vm.startTimer
}
}, [(!_vm.iconClass) ? _c('img', {
staticClass: "el-message__img",
attrs: {
"src": _vm.typeImg,
"alt": ""
}
}) : _vm._e(), _c('div', {
staticClass: "el-message__group",
class: {
'is-with-icon': _vm.iconClass
}
}, [_vm._t("default", [_c('p', [(_vm.iconClass) ? _c('i', {
staticClass: "el-message__icon",
class: _vm.iconClass
}) : _vm._e(), _vm._v(_vm._s(_vm.message))])]), (_vm.showClose) ? _c('div', {
staticClass: "el-message__closeBtn el-icon-close",
on: {
"click": _vm.close
}
}) : _vm._e()], 2)])])
},staticRenderFns: []}
/***/ },
/* 308 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(309);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 309 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(310),
/* template */
__webpack_require__(311),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 310 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElBadge',
props: {
value: {},
max: Number,
isDot: Boolean,
hidden: Boolean
},
computed: {
content: function content() {
if (this.isDot) return;
var value = this.value;
var max = this.max;
if (typeof value === 'number' && typeof max === 'number') {
return max < value ? max + '+' : value;
}
return value;
}
}
};
/***/ },
/* 311 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-badge"
}, [_vm._t("default"), _c('transition', {
attrs: {
"name": "el-zoom-in-center"
}
}, [_c('sup', {
directives: [{
name: "show",
rawName: "v-show",
value: (!_vm.hidden && (_vm.content || _vm.isDot)),
expression: "!hidden && ( content || isDot )"
}],
staticClass: "el-badge__content",
class: {
'is-fixed': _vm.$slots.default, 'is-dot': _vm.isDot
},
domProps: {
"textContent": _vm._s(_vm.content)
}
})])], 2)
},staticRenderFns: []}
/***/ },
/* 312 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(313);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 313 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(314),
/* template */
__webpack_require__(315),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 314 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElCard',
props: ['header', 'bodyStyle']
};
/***/ },
/* 315 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-card"
}, [(_vm.$slots.header || _vm.header) ? _c('div', {
staticClass: "el-card__header"
}, [_vm._t("header", [_vm._v(_vm._s(_vm.header))])], 2) : _vm._e(), _c('div', {
staticClass: "el-card__body",
style: (_vm.bodyStyle)
}, [_vm._t("default")], 2)])
},staticRenderFns: []}
/***/ },
/* 316 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(317);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 317 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(318),
/* template */
__webpack_require__(319),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 318 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dom = __webpack_require__(45);
exports.default = {
name: 'ElRate',
data: function data() {
return {
classMap: {},
colorMap: {},
pointerAtLeftHalf: true,
currentValue: this.value,
hoverIndex: -1
};
},
props: {
value: {
type: Number,
default: 0
},
lowThreshold: {
type: Number,
default: 2
},
highThreshold: {
type: Number,
default: 4
},
max: {
type: Number,
default: 5
},
colors: {
type: Array,
default: function _default() {
return ['#F7BA2A', '#F7BA2A', '#F7BA2A'];
}
},
voidColor: {
type: String,
default: '#C6D1DE'
},
disabledVoidColor: {
type: String,
default: '#EFF2F7'
},
iconClasses: {
type: Array,
default: function _default() {
return ['el-icon-star-on', 'el-icon-star-on', 'el-icon-star-on'];
}
},
voidIconClass: {
type: String,
default: 'el-icon-star-off'
},
disabledVoidIconClass: {
type: String,
default: 'el-icon-star-on'
},
disabled: {
type: Boolean,
default: false
},
allowHalf: {
type: Boolean,
default: false
},
showText: {
type: Boolean,
default: false
},
textColor: {
type: String,
default: '#1f2d3d'
},
texts: {
type: Array,
default: function _default() {
return ['极差', '失望', '一般', '满意', '惊喜'];
}
},
textTemplate: {
type: String,
default: '{value}'
}
},
computed: {
text: function text() {
var result = '';
if (this.disabled) {
result = this.textTemplate.replace(/\{\s*value\s*\}/, this.value);
} else {
result = this.texts[Math.ceil(this.currentValue) - 1];
}
return result;
},
decimalStyle: function decimalStyle() {
var width = '';
if (this.disabled) {
width = (this.valueDecimal < 50 ? 0 : 50) + '%';
}
if (this.allowHalf) {
width = '50%';
}
return {
color: this.activeColor,
width: width
};
},
valueDecimal: function valueDecimal() {
return this.value * 100 - Math.floor(this.value) * 100;
},
decimalIconClass: function decimalIconClass() {
return this.getValueFromMap(this.value, this.classMap);
},
voidClass: function voidClass() {
return this.disabled ? this.classMap.disabledVoidClass : this.classMap.voidClass;
},
activeClass: function activeClass() {
return this.getValueFromMap(this.currentValue, this.classMap);
},
activeColor: function activeColor() {
return this.getValueFromMap(this.currentValue, this.colorMap);
},
classes: function classes() {
var result = [];
var i = 0;
var threshold = this.currentValue;
if (this.allowHalf && this.currentValue !== Math.floor(this.currentValue)) {
threshold--;
}
for (; i < threshold; i++) {
result.push(this.activeClass);
}
for (; i < this.max; i++) {
result.push(this.voidClass);
}
return result;
}
},
watch: {
value: function value(val) {
this.$emit('change', val);
this.currentValue = val;
this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
}
},
methods: {
getValueFromMap: function getValueFromMap(value, map) {
var result = '';
if (value <= this.lowThreshold) {
result = map.lowColor || map.lowClass;
} else if (value >= this.highThreshold) {
result = map.highColor || map.highClass;
} else {
result = map.mediumColor || map.mediumClass;
}
return result;
},
showDecimalIcon: function showDecimalIcon(item) {
var showWhenDisabled = this.disabled && this.valueDecimal > 0 && item - 1 < this.value && item > this.value;
/* istanbul ignore next */
var showWhenAllowHalf = this.allowHalf && this.pointerAtLeftHalf && item - 0.5 <= this.currentValue && item > this.currentValue;
return showWhenDisabled || showWhenAllowHalf;
},
getIconStyle: function getIconStyle(item) {
var voidColor = this.disabled ? this.colorMap.disabledVoidColor : this.colorMap.voidColor;
return {
color: item <= this.currentValue ? this.activeColor : voidColor
};
},
selectValue: function selectValue(value) {
if (this.disabled) {
return;
}
if (this.allowHalf && this.pointerAtLeftHalf) {
this.$emit('input', this.currentValue);
} else {
this.$emit('input', value);
}
},
setCurrentValue: function setCurrentValue(value, event) {
if (this.disabled) {
return;
}
/* istanbul ignore if */
if (this.allowHalf) {
var target = event.target;
if ((0, _dom.hasClass)(target, 'el-rate__item')) {
target = target.querySelector('.el-rate__icon');
}
if ((0, _dom.hasClass)(target, 'el-rate__decimal')) {
target = target.parentNode;
}
this.pointerAtLeftHalf = event.offsetX * 2 <= target.clientWidth;
this.currentValue = this.pointerAtLeftHalf ? value - 0.5 : value;
} else {
this.currentValue = value;
}
this.hoverIndex = value;
},
resetCurrentValue: function resetCurrentValue() {
if (this.disabled) {
return;
}
if (this.allowHalf) {
this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
}
this.currentValue = this.value;
this.hoverIndex = -1;
}
},
created: function created() {
if (!this.value) {
this.$emit('input', 0);
}
this.classMap = {
lowClass: this.iconClasses[0],
mediumClass: this.iconClasses[1],
highClass: this.iconClasses[2],
voidClass: this.voidIconClass,
disabledVoidClass: this.disabledVoidIconClass
};
this.colorMap = {
lowColor: this.colors[0],
mediumColor: this.colors[1],
highColor: this.colors[2],
voidColor: this.voidColor,
disabledVoidColor: this.disabledVoidColor
};
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 319 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-rate"
}, [_vm._l((_vm.max), function(item) {
return _c('span', {
staticClass: "el-rate__item",
style: ({
cursor: _vm.disabled ? 'auto' : 'pointer'
}),
on: {
"mousemove": function($event) {
_vm.setCurrentValue(item, $event)
},
"mouseleave": _vm.resetCurrentValue,
"click": function($event) {
_vm.selectValue(item)
}
}
}, [_c('i', {
staticClass: "el-rate__icon",
class: [_vm.classes[item - 1], {
'hover': _vm.hoverIndex === item
}],
style: (_vm.getIconStyle(item))
}, [(_vm.showDecimalIcon(item)) ? _c('i', {
staticClass: "el-rate__decimal",
class: _vm.decimalIconClass,
style: (_vm.decimalStyle)
}) : _vm._e()])])
}), (_vm.showText) ? _c('span', {
staticClass: "el-rate__text",
style: ({
color: _vm.textColor
})
}, [_vm._v(_vm._s(_vm.text))]) : _vm._e()], 2)
},staticRenderFns: []}
/***/ },
/* 320 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _steps = __webpack_require__(321);
var _steps2 = _interopRequireDefault(_steps);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_steps2.default.install = function (Vue) {
Vue.component(_steps2.default.name, _steps2.default);
};
exports.default = _steps2.default;
/***/ },
/* 321 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(322),
/* template */
__webpack_require__(323),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 322 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElSteps',
props: {
space: [Number, String],
active: Number,
direction: {
type: String,
default: 'horizontal'
},
alignCenter: Boolean,
center: Boolean,
finishStatus: {
type: String,
default: 'finish'
},
processStatus: {
type: String,
default: 'process'
}
},
data: function data() {
return {
steps: [],
stepOffset: 0
};
},
watch: {
active: function active(newVal, oldVal) {
this.$emit('change', newVal, oldVal);
},
steps: function steps(_steps) {
var _this = this;
_steps.forEach(function (child, index) {
child.index = index;
});
if (this.center) {
(function () {
var len = _steps.length;
_this.$nextTick(function () {
_this.stepOffset = _steps[len - 1].$el.getBoundingClientRect().width / (len - 1);
});
})();
}
}
}
};
/***/ },
/* 323 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-steps",
class: ['is-' + _vm.direction, _vm.center ? 'is-center' : '']
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 324 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _step = __webpack_require__(325);
var _step2 = _interopRequireDefault(_step);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_step2.default.install = function (Vue) {
Vue.component(_step2.default.name, _step2.default);
};
exports.default = _step2.default;
/***/ },
/* 325 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(326),
/* template */
__webpack_require__(327),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 326 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElStep',
props: {
title: String,
icon: String,
description: String,
status: String
},
data: function data() {
return {
index: -1,
lineStyle: {},
mainOffset: 0,
internalStatus: ''
};
},
beforeCreate: function beforeCreate() {
this.$parent.steps.push(this);
},
beforeDestroy: function beforeDestroy() {
var steps = this.$parent.steps;
var index = steps.indexOf(this);
if (index >= 0) {
steps.splice(index, 1);
}
},
computed: {
currentStatus: function currentStatus() {
return this.status || this.internalStatus;
},
isLast: function isLast() {
var parent = this.$parent;
return parent.steps[parent.steps.length - 1] === this;
},
style: function style() {
var parent = this.$parent;
var isCenter = parent.center;
var len = parent.steps.length;
if (isCenter && this.isLast) {
return {};
}
var space = typeof parent.space === 'number' ? parent.space + 'px' : parent.space ? parent.space : 100 / (isCenter ? len - 1 : len) + '%';
if (parent.direction === 'horizontal') {
return { width: space };
} else {
if (!this.isLast) {
return { height: space };
}
}
}
},
methods: {
updateStatus: function updateStatus(val) {
var prevChild = this.$parent.$children[this.index - 1];
if (val > this.index) {
this.internalStatus = this.$parent.finishStatus;
} else if (val === this.index) {
this.internalStatus = this.$parent.processStatus;
} else {
this.internalStatus = 'wait';
}
if (prevChild) prevChild.calcProgress(this.internalStatus);
},
calcProgress: function calcProgress(status) {
var step = 100;
var style = {};
style.transitionDelay = 150 * this.index + 'ms';
if (status === this.$parent.processStatus) {
step = 50;
} else if (status === 'wait') {
step = 0;
style.transitionDelay = -150 * this.index + 'ms';
}
style.borderWidth = step ? '1px' : 0;
this.$parent.direction === 'vertical' ? style.height = step + '%' : style.width = step + '%';
this.lineStyle = style;
}
},
mounted: function mounted() {
var _this = this;
var parent = this.$parent;
if (parent.direction === 'horizontal') {
if (parent.alignCenter) {
this.mainOffset = -this.$refs.title.getBoundingClientRect().width / 2 + 16 + 'px';
}
}
var unwatch = this.$watch('index', function (val) {
_this.$watch('$parent.active', _this.updateStatus, { immediate: true });
unwatch();
});
}
};
/***/ },
/* 327 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-step",
class: ['is-' + _vm.$parent.direction],
style: ([_vm.style, _vm.isLast ? '' : {
marginRight: -_vm.$parent.stepOffset + 'px'
}])
}, [_c('div', {
staticClass: "el-step__head",
class: ['is-' + _vm.currentStatus, {
'is-text': !_vm.icon
}]
}, [_c('div', {
staticClass: "el-step__line",
class: ['is-' + _vm.$parent.direction, {
'is-icon': _vm.icon
}],
style: (_vm.isLast ? '' : {
marginRight: _vm.$parent.stepOffset + 'px'
})
}, [_c('i', {
staticClass: "el-step__line-inner",
style: (_vm.lineStyle)
})]), _c('span', {
staticClass: "el-step__icon"
}, [(_vm.currentStatus !== 'success' && _vm.currentStatus !== 'error') ? _vm._t("icon", [(_vm.icon) ? _c('i', {
class: ['el-icon-' + _vm.icon]
}) : _c('div', [_vm._v(_vm._s(_vm.index + 1))])]) : _c('i', {
class: ['el-icon-' + (_vm.currentStatus === 'success' ? 'check' : 'close')]
})], 2)]), _c('div', {
staticClass: "el-step__main",
style: ({
marginLeft: _vm.mainOffset
})
}, [_c('div', {
ref: "title",
staticClass: "el-step__title",
class: ['is-' + _vm.currentStatus]
}, [_vm._t("title", [_vm._v(_vm._s(_vm.title))])], 2), _c('div', {
staticClass: "el-step__description",
class: ['is-' + _vm.currentStatus]
}, [_vm._t("description", [_vm._v(_vm._s(_vm.description))])], 2)])])
},staticRenderFns: []}
/***/ },
/* 328 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(329);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 329 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(330),
/* template */
__webpack_require__(331),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 330 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _throttle = __webpack_require__(132);
var _throttle2 = _interopRequireDefault(_throttle);
var _resizeEvent = __webpack_require__(111);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElCarousel',
props: {
initialIndex: {
type: Number,
default: 0
},
height: String,
trigger: {
type: String,
default: 'hover'
},
autoplay: {
type: Boolean,
default: true
},
interval: {
type: Number,
default: 3000
},
indicatorPosition: String,
indicator: {
type: Boolean,
default: true
},
arrow: {
type: String,
default: 'hover'
},
type: String
},
data: function data() {
return {
items: [],
activeIndex: -1,
containerWidth: 0,
timer: null,
hover: false
};
},
computed: {
hasLabel: function hasLabel() {
return this.items.some(function (item) {
return item.label.toString().length > 0;
});
}
},
watch: {
items: function items(val) {
if (val.length > 0) this.setActiveItem(this.initialIndex);
},
activeIndex: function activeIndex(val, oldVal) {
this.resetItemPosition();
this.$emit('change', val, oldVal);
},
autoplay: function autoplay(val) {
val ? this.startTimer() : this.pauseTimer();
}
},
methods: {
handleMouseEnter: function handleMouseEnter() {
this.hover = true;
this.pauseTimer();
},
handleMouseLeave: function handleMouseLeave() {
this.hover = false;
this.startTimer();
},
itemInStage: function itemInStage(item, index) {
var length = this.items.length;
if (index === length - 1 && item.inStage && this.items[0].active || item.inStage && this.items[index + 1] && this.items[index + 1].active) {
return 'left';
} else if (index === 0 && item.inStage && this.items[length - 1].active || item.inStage && this.items[index - 1] && this.items[index - 1].active) {
return 'right';
}
return false;
},
handleButtonEnter: function handleButtonEnter(arrow) {
var _this = this;
this.items.forEach(function (item, index) {
if (arrow === _this.itemInStage(item, index)) {
item.hover = true;
}
});
},
handleButtonLeave: function handleButtonLeave() {
this.items.forEach(function (item) {
item.hover = false;
});
},
updateItems: function updateItems() {
this.items = this.$children.filter(function (child) {
return child.$options.name === 'ElCarouselItem';
});
},
resetItemPosition: function resetItemPosition() {
var _this2 = this;
this.items.forEach(function (item, index) {
item.translateItem(index, _this2.activeIndex);
});
},
playSlides: function playSlides() {
if (this.activeIndex < this.items.length - 1) {
this.activeIndex++;
} else {
this.activeIndex = 0;
}
},
pauseTimer: function pauseTimer() {
clearInterval(this.timer);
},
startTimer: function startTimer() {
if (this.interval <= 0 || !this.autoplay) return;
this.timer = setInterval(this.playSlides, this.interval);
},
setActiveItem: function setActiveItem(index) {
if (typeof index === 'string') {
var filteredItems = this.items.filter(function (item) {
return item.name === index;
});
if (filteredItems.length > 0) {
index = this.items.indexOf(filteredItems[0]);
}
}
index = Number(index);
if (isNaN(index) || index !== Math.floor(index)) {
("production") !== 'production' && console.warn('[Element Warn][Carousel]index must be an integer.');
return;
}
var length = this.items.length;
if (index < 0) {
this.activeIndex = length - 1;
} else if (index >= length) {
this.activeIndex = 0;
} else {
this.activeIndex = index;
}
},
prev: function prev() {
this.setActiveItem(this.activeIndex - 1);
},
next: function next() {
this.setActiveItem(this.activeIndex + 1);
},
handleIndicatorClick: function handleIndicatorClick(index) {
this.activeIndex = index;
},
handleIndicatorHover: function handleIndicatorHover(index) {
if (this.trigger === 'hover' && index !== this.activeIndex) {
this.activeIndex = index;
}
}
},
created: function created() {
var _this3 = this;
this.throttledArrowClick = (0, _throttle2.default)(300, true, function (index) {
_this3.setActiveItem(index);
});
this.throttledIndicatorHover = (0, _throttle2.default)(300, function (index) {
_this3.handleIndicatorHover(index);
});
},
mounted: function mounted() {
var _this4 = this;
this.updateItems();
this.$nextTick(function () {
(0, _resizeEvent.addResizeListener)(_this4.$el, _this4.resetItemPosition);
if (_this4.initialIndex < _this4.items.length && _this4.initialIndex >= 0) {
_this4.activeIndex = _this4.initialIndex;
}
_this4.startTimer();
});
},
beforeDestroy: function beforeDestroy() {
if (this.$el) (0, _resizeEvent.removeResizeListener)(this.$el, this.resetItemPosition);
}
};
/***/ },
/* 331 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-carousel",
class: {
'el-carousel--card': _vm.type === 'card'
},
on: {
"mouseenter": function($event) {
$event.stopPropagation();
_vm.handleMouseEnter($event)
},
"mouseleave": function($event) {
$event.stopPropagation();
_vm.handleMouseLeave($event)
}
}
}, [_c('div', {
staticClass: "el-carousel__container",
style: ({
height: _vm.height
})
}, [_c('transition', {
attrs: {
"name": "carousel-arrow-left"
}
}, [(_vm.arrow !== 'never') ? _c('button', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.arrow === 'always' || _vm.hover),
expression: "arrow === 'always' || hover"
}],
staticClass: "el-carousel__arrow el-carousel__arrow--left",
on: {
"mouseenter": function($event) {
_vm.handleButtonEnter('left')
},
"mouseleave": _vm.handleButtonLeave,
"click": function($event) {
$event.stopPropagation();
_vm.throttledArrowClick(_vm.activeIndex - 1)
}
}
}, [_c('i', {
staticClass: "el-icon-arrow-left"
})]) : _vm._e()]), _c('transition', {
attrs: {
"name": "carousel-arrow-right"
}
}, [(_vm.arrow !== 'never') ? _c('button', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.arrow === 'always' || _vm.hover),
expression: "arrow === 'always' || hover"
}],
staticClass: "el-carousel__arrow el-carousel__arrow--right",
on: {
"mouseenter": function($event) {
_vm.handleButtonEnter('right')
},
"mouseleave": _vm.handleButtonLeave,
"click": function($event) {
$event.stopPropagation();
_vm.throttledArrowClick(_vm.activeIndex + 1)
}
}
}, [_c('i', {
staticClass: "el-icon-arrow-right"
})]) : _vm._e()]), _vm._t("default")], 2), (_vm.indicatorPosition !== 'none') ? _c('ul', {
staticClass: "el-carousel__indicators",
class: {
'el-carousel__indicators--labels': _vm.hasLabel, 'el-carousel__indicators--outside': _vm.indicatorPosition === 'outside' || _vm.type === 'card'
}
}, _vm._l((_vm.items), function(item, index) {
return _c('li', {
staticClass: "el-carousel__indicator",
class: {
'is-active': index === _vm.activeIndex
},
on: {
"mouseenter": function($event) {
_vm.throttledIndicatorHover(index)
},
"click": function($event) {
$event.stopPropagation();
_vm.handleIndicatorClick(index)
}
}
}, [_c('button', {
staticClass: "el-carousel__button"
}, [(_vm.hasLabel) ? _c('span', [_vm._v(_vm._s(item.label))]) : _vm._e()])])
})) : _vm._e()])
},staticRenderFns: []}
/***/ },
/* 332 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(333);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 333 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _resizeEvent = __webpack_require__(111);
var _scrollbarWidth = __webpack_require__(136);
var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
var _util = __webpack_require__(108);
var _bar = __webpack_require__(334);
var _bar2 = _interopRequireDefault(_bar);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
// reference https://github.com/noeldelgado/gemini-scrollbar/blob/master/index.js
exports.default = {
name: 'ElScrollbar',
components: { Bar: _bar2.default },
props: {
native: Boolean,
wrapStyle: {},
wrapClass: {},
viewClass: {},
viewStyle: {},
noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能
tag: {
type: String,
default: 'div'
}
},
data: function data() {
return {
sizeWidth: '0',
sizeHeight: '0',
moveX: 0,
moveY: 0
};
},
computed: {
wrap: function wrap() {
return this.$refs.wrap;
}
},
render: function render(h) {
var gutter = (0, _scrollbarWidth2.default)();
var style = this.wrapStyle;
if (gutter) {
var gutterWith = '-' + gutter + 'px';
var gutterStyle = 'margin-bottom: ' + gutterWith + '; margin-right: ' + gutterWith + ';';
if (Array.isArray(this.wrapStyle)) {
style = (0, _util.toObject)(this.wrapStyle);
style.marginRight = style.marginBottom = gutterWith;
} else if (typeof this.wrapStyle === 'string') {
style += gutterStyle;
} else {
style = gutterStyle;
}
}
var view = h(this.tag, {
class: ['el-scrollbar__view', this.viewClass],
style: this.viewStyle,
ref: 'resize'
}, this.$slots.default);
var wrap = h(
'div',
{
ref: 'wrap',
style: style,
on: {
'scroll': this.handleScroll
},
'class': [this.wrapClass, 'el-scrollbar__wrap', gutter ? '' : 'el-scrollbar__wrap--hidden-default'] },
[[view]]
);
var nodes = void 0;
if (!this.native) {
nodes = [wrap, h(
_bar2.default,
{
attrs: {
move: this.moveX,
size: this.sizeWidth }
},
[]
), h(
_bar2.default,
{
attrs: {
vertical: true,
move: this.moveY,
size: this.sizeHeight }
},
[]
)];
} else {
nodes = [h(
'div',
{
ref: 'wrap',
'class': [this.wrapClass, 'el-scrollbar__wrap'],
style: style },
[[view]]
)];
}
return h('div', { class: 'el-scrollbar' }, nodes);
},
methods: {
handleScroll: function handleScroll() {
var wrap = this.wrap;
this.moveY = wrap.scrollTop * 100 / wrap.clientHeight;
this.moveX = wrap.scrollLeft * 100 / wrap.clientWidth;
},
update: function update() {
var heightPercentage = void 0,
widthPercentage = void 0;
var wrap = this.wrap;
if (!wrap) return;
heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
widthPercentage = wrap.clientWidth * 100 / wrap.scrollWidth;
this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : '';
this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : '';
}
},
mounted: function mounted() {
if (this.native) return;
this.$nextTick(this.update);
!this.noresize && (0, _resizeEvent.addResizeListener)(this.$refs.resize, this.update);
},
beforeDestroy: function beforeDestroy() {
if (this.native) return;
!this.noresize && (0, _resizeEvent.removeResizeListener)(this.$refs.resize, this.update);
}
};
/***/ },
/* 334 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _dom = __webpack_require__(45);
var _util = __webpack_require__(335);
/* istanbul ignore next */
exports.default = {
name: 'Bar',
props: {
vertical: Boolean,
size: String,
move: Number
},
computed: {
bar: function bar() {
return _util.BAR_MAP[this.vertical ? 'vertical' : 'horizontal'];
},
wrap: function wrap() {
return this.$parent.wrap;
}
},
render: function render(h) {
var size = this.size,
move = this.move,
bar = this.bar;
return h(
'div',
{
'class': ['el-scrollbar__bar', 'is-' + bar.key],
on: {
'mousedown': this.clickTrackHandler
}
},
[h(
'div',
{
ref: 'thumb',
'class': 'el-scrollbar__thumb',
on: {
'mousedown': this.clickThumbHandler
},
style: (0, _util.renderThumbStyle)({ size: size, move: move, bar: bar }) },
[]
)]
);
},
methods: {
clickThumbHandler: function clickThumbHandler(e) {
this.startDrag(e);
this[this.bar.axis] = e.currentTarget[this.bar.offset] - (e[this.bar.client] - e.currentTarget.getBoundingClientRect()[this.bar.direction]);
},
clickTrackHandler: function clickTrackHandler(e) {
var offset = Math.abs(e.target.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]);
var thumbHalf = this.$refs.thumb[this.bar.offset] / 2;
var thumbPositionPercentage = (offset - thumbHalf) * 100 / this.$el[this.bar.offset];
this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
},
startDrag: function startDrag(e) {
e.stopImmediatePropagation();
this.cursorDown = true;
(0, _dom.on)(document, 'mousemove', this.mouseMoveDocumentHandler);
(0, _dom.on)(document, 'mouseup', this.mouseUpDocumentHandler);
document.onselectstart = function () {
return false;
};
},
mouseMoveDocumentHandler: function mouseMoveDocumentHandler(e) {
if (this.cursorDown === false) return;
var prevPage = this[this.bar.axis];
if (!prevPage) return;
var offset = (this.$el.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]) * -1;
var thumbClickPosition = this.$refs.thumb[this.bar.offset] - prevPage;
var thumbPositionPercentage = (offset - thumbClickPosition) * 100 / this.$el[this.bar.offset];
this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
},
mouseUpDocumentHandler: function mouseUpDocumentHandler(e) {
this.cursorDown = false;
this[this.bar.axis] = 0;
(0, _dom.off)(document, 'mousemove', this.mouseMoveDocumentHandler);
document.onselectstart = null;
}
},
destroyed: function destroyed() {
(0, _dom.off)(document, 'mouseup', this.mouseUpDocumentHandler);
}
};
/***/ },
/* 335 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
exports.renderThumbStyle = renderThumbStyle;
var BAR_MAP = exports.BAR_MAP = {
vertical: {
offset: 'offsetHeight',
scroll: 'scrollTop',
scrollSize: 'scrollHeight',
size: 'height',
key: 'vertical',
axis: 'Y',
client: 'clientY',
direction: 'top'
},
horizontal: {
offset: 'offsetWidth',
scroll: 'scrollLeft',
scrollSize: 'scrollWidth',
size: 'width',
key: 'horizontal',
axis: 'X',
client: 'clientX',
direction: 'left'
}
};
function renderThumbStyle(_ref) {
var move = _ref.move,
size = _ref.size,
bar = _ref.bar;
var style = {};
var translate = 'translate' + bar.axis + '(' + move + '%)';
style[bar.size] = size;
style.transform = translate;
style.msTransform = translate;
style.webkitTransform = translate;
return style;
};
/***/ },
/* 336 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _item = __webpack_require__(337);
var _item2 = _interopRequireDefault(_item);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_item2.default.install = function (Vue) {
Vue.component(_item2.default.name, _item2.default);
};
exports.default = _item2.default;
/***/ },
/* 337 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(338),
/* template */
__webpack_require__(339),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 338 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var CARD_SCALE = 0.83;
exports.default = {
name: 'ElCarouselItem',
props: {
name: String,
label: {
type: [String, Number],
default: ''
}
},
data: function data() {
return {
hover: false,
translate: 0,
scale: 1,
active: false,
ready: false,
inStage: false
};
},
methods: {
processIndex: function processIndex(index, activeIndex, length) {
if (activeIndex === 0 && index === length - 1) {
return -1;
} else if (activeIndex === length - 1 && index === 0) {
return length;
} else if (index < activeIndex - 1 && activeIndex - index >= length / 2) {
return length + 1;
} else if (index > activeIndex + 1 && index - activeIndex >= length / 2) {
return -2;
}
return index;
},
calculateTranslate: function calculateTranslate(index, activeIndex, parentWidth) {
if (this.inStage) {
return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
} else if (index < activeIndex) {
return -(1 + CARD_SCALE) * parentWidth / 4;
} else {
return (3 + CARD_SCALE) * parentWidth / 4;
}
},
translateItem: function translateItem(index, activeIndex) {
var parentWidth = this.$parent.$el.offsetWidth;
var length = this.$parent.items.length;
if (index !== activeIndex && length > 2) {
index = this.processIndex(index, activeIndex, length);
}
if (this.$parent.type === 'card') {
this.inStage = Math.round(Math.abs(index - activeIndex)) <= 1;
this.active = index === activeIndex;
this.translate = this.calculateTranslate(index, activeIndex, parentWidth);
this.scale = this.active ? 1 : CARD_SCALE;
} else {
this.active = index === activeIndex;
this.translate = parentWidth * (index - activeIndex);
}
this.ready = true;
},
handleItemClick: function handleItemClick() {
var parent = this.$parent;
if (parent && parent.type === 'card') {
var index = parent.items.indexOf(this);
parent.setActiveItem(index);
}
}
},
created: function created() {
this.$parent && this.$parent.updateItems();
},
destroyed: function destroyed() {
this.$parent && this.$parent.updateItems();
}
};
/***/ },
/* 339 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.ready),
expression: "ready"
}],
staticClass: "el-carousel__item",
class: {
'is-active': _vm.active,
'el-carousel__item--card': _vm.$parent.type === 'card',
'is-in-stage': _vm.inStage,
'is-hover': _vm.hover
},
style: ({
msTransform: ("translateX(" + _vm.translate + "px) scale(" + _vm.scale + ")"),
webkitTransform: ("translateX(" + _vm.translate + "px) scale(" + _vm.scale + ")"),
transform: ("translateX(" + _vm.translate + "px) scale(" + _vm.scale + ")")
}),
on: {
"click": _vm.handleItemClick
}
}, [(_vm.$parent.type === 'card') ? _c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (!_vm.active),
expression: "!active"
}],
staticClass: "el-carousel__mask"
}) : _vm._e(), _vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 340 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _collapse = __webpack_require__(341);
var _collapse2 = _interopRequireDefault(_collapse);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_collapse2.default.install = function (Vue) {
Vue.component(_collapse2.default.name, _collapse2.default);
};
exports.default = _collapse2.default;
/***/ },
/* 341 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(342),
/* template */
__webpack_require__(343),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 342 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
exports.default = {
name: 'ElCollapse',
componentName: 'ElCollapse',
props: {
accordion: Boolean,
value: {
type: [Array, String, Number],
default: function _default() {
return [];
}
}
},
data: function data() {
return {
activeNames: [].concat(this.value)
};
},
watch: {
value: function value(_value) {
this.activeNames = [].concat(_value);
}
},
methods: {
setActiveNames: function setActiveNames(activeNames) {
activeNames = [].concat(activeNames);
var value = this.accordion ? activeNames[0] : activeNames;
this.activeNames = activeNames;
this.$emit('input', value);
this.$emit('change', value);
},
handleItemClick: function handleItemClick(item) {
if (this.accordion) {
this.setActiveNames((this.activeNames[0] || this.activeNames[0] === 0) && this.activeNames[0] === item.name ? '' : item.name);
} else {
var activeNames = this.activeNames.slice(0);
var index = activeNames.indexOf(item.name);
if (index > -1) {
activeNames.splice(index, 1);
} else {
activeNames.push(item.name);
}
this.setActiveNames(activeNames);
}
}
},
created: function created() {
this.$on('item-click', this.handleItemClick);
}
};
/***/ },
/* 343 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-collapse"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/* 344 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _collapseItem = __webpack_require__(345);
var _collapseItem2 = _interopRequireDefault(_collapseItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_collapseItem2.default.install = function (Vue) {
Vue.component(_collapseItem2.default.name, _collapseItem2.default);
};
exports.default = _collapseItem2.default;
/***/ },
/* 345 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(346),
/* template */
__webpack_require__(347),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 346 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _collapseTransition = __webpack_require__(50);
var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElCollapseItem',
componentName: 'ElCollapseItem',
mixins: [_emitter2.default],
components: { ElCollapseTransition: _collapseTransition2.default },
data: function data() {
return {
contentWrapStyle: {
height: 'auto',
display: 'block'
},
contentHeight: 0
};
},
props: {
title: String,
name: {
type: [String, Number],
default: function _default() {
return this._uid;
}
}
},
computed: {
isActive: function isActive() {
return this.$parent.activeNames.indexOf(this.name) > -1;
}
},
watch: {
'isActive': function isActive(value) {}
},
methods: {
handleHeaderClick: function handleHeaderClick() {
this.dispatch('ElCollapse', 'item-click', this);
}
},
mounted: function mounted() {}
};
/***/ },
/* 347 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-collapse-item",
class: {
'is-active': _vm.isActive
}
}, [_c('div', {
staticClass: "el-collapse-item__header",
on: {
"click": _vm.handleHeaderClick
}
}, [_c('i', {
staticClass: "el-collapse-item__header__arrow el-icon-arrow-right"
}), _vm._t("title", [_vm._v(_vm._s(_vm.title))])], 2), _c('el-collapse-transition', [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.isActive),
expression: "isActive"
}],
staticClass: "el-collapse-item__wrap"
}, [_c('div', {
staticClass: "el-collapse-item__content"
}, [_vm._t("default")], 2)])])], 1)
},staticRenderFns: []}
/***/ },
/* 348 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(349);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 349 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(350),
/* template */
__webpack_require__(355),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 350 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
var _menu = __webpack_require__(351);
var _menu2 = _interopRequireDefault(_menu);
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _clickoutside = __webpack_require__(21);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _locale3 = __webpack_require__(112);
var _debounce = __webpack_require__(70);
var _debounce2 = _interopRequireDefault(_debounce);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var popperMixin = {
props: {
placement: {
type: String,
default: 'bottom-start'
},
appendToBody: _vuePopper2.default.props.appendToBody,
offset: _vuePopper2.default.props.offset,
boundariesPadding: _vuePopper2.default.props.boundariesPadding,
popperOptions: _vuePopper2.default.props.popperOptions
},
methods: _vuePopper2.default.methods,
data: _vuePopper2.default.data,
beforeDestroy: _vuePopper2.default.beforeDestroy
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElCascader',
directives: { Clickoutside: _clickoutside2.default },
mixins: [popperMixin, _emitter2.default, _locale2.default],
components: {
ElInput: _input2.default
},
props: {
options: {
type: Array,
required: true
},
props: {
type: Object,
default: function _default() {
return {
children: 'children',
label: 'label',
value: 'value',
disabled: 'disabled'
};
}
},
value: {
type: Array,
default: function _default() {
return [];
}
},
placeholder: {
type: String,
default: function _default() {
return (0, _locale3.t)('el.cascader.placeholder');
}
},
disabled: Boolean,
clearable: {
type: Boolean,
default: false
},
changeOnSelect: Boolean,
popperClass: String,
expandTrigger: {
type: String,
default: 'click'
},
filterable: Boolean,
size: String,
showAllLevels: {
type: Boolean,
default: true
},
debounce: {
type: Number,
default: 300
},
beforeFilter: {
type: Function,
default: function _default() {
return function () {};
}
}
},
data: function data() {
return {
currentValue: this.value || [],
menu: null,
debouncedInputChange: function debouncedInputChange() {},
menuVisible: false,
inputHover: false,
inputValue: '',
flatOptions: null
};
},
computed: {
labelKey: function labelKey() {
return this.props.label || 'label';
},
valueKey: function valueKey() {
return this.props.value || 'value';
},
childrenKey: function childrenKey() {
return this.props.children || 'children';
},
currentLabels: function currentLabels() {
var _this = this;
var options = this.options;
var labels = [];
this.currentValue.forEach(function (value) {
var targetOption = options && options.filter(function (option) {
return option[_this.valueKey] === value;
})[0];
if (targetOption) {
labels.push(targetOption[_this.labelKey]);
options = targetOption[_this.childrenKey];
}
});
return labels;
}
},
watch: {
menuVisible: function menuVisible(value) {
value ? this.showMenu() : this.hideMenu();
},
value: function value(_value) {
this.currentValue = _value;
},
currentValue: function currentValue(value) {
this.dispatch('ElFormItem', 'el.form.change', [value]);
},
options: {
deep: true,
handler: function handler(value) {
if (!this.menu) {
this.initMenu();
}
this.flatOptions = this.flattenOptions(this.options);
this.menu.options = value;
}
}
},
methods: {
initMenu: function initMenu() {
this.menu = new _vue2.default(_menu2.default).$mount();
this.menu.options = this.options;
this.menu.props = this.props;
this.menu.expandTrigger = this.expandTrigger;
this.menu.changeOnSelect = this.changeOnSelect;
this.menu.popperClass = this.popperClass;
this.popperElm = this.menu.$el;
this.menu.$on('pick', this.handlePick);
this.menu.$on('activeItemChange', this.handleActiveItemChange);
this.menu.$on('menuLeave', this.doDestroy);
},
showMenu: function showMenu() {
var _this2 = this;
if (!this.menu) {
this.initMenu();
}
this.menu.value = this.currentValue.slice(0);
this.menu.visible = true;
this.menu.options = this.options;
this.$nextTick(function (_) {
_this2.updatePopper();
_this2.menu.inputWidth = _this2.$refs.input.$el.offsetWidth - 2;
});
},
hideMenu: function hideMenu() {
this.inputValue = '';
this.menu.visible = false;
},
handleActiveItemChange: function handleActiveItemChange(value) {
var _this3 = this;
this.$nextTick(function (_) {
_this3.updatePopper();
});
this.$emit('active-item-change', value);
},
handlePick: function handlePick(value) {
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
this.currentValue = value;
this.$emit('input', value);
this.$emit('change', value);
if (close) {
this.menuVisible = false;
} else {
this.$nextTick(this.updatePopper);
}
},
handleInputChange: function handleInputChange(value) {
var _this4 = this;
if (!this.menuVisible) return;
var flatOptions = this.flatOptions;
if (!value) {
this.menu.options = this.options;
this.$nextTick(this.updatePopper);
return;
}
var filteredFlatOptions = flatOptions.filter(function (optionsStack) {
return optionsStack.some(function (option) {
return new RegExp(value, 'i').test(option[_this4.labelKey]);
});
});
if (filteredFlatOptions.length > 0) {
filteredFlatOptions = filteredFlatOptions.map(function (optionStack) {
return {
__IS__FLAT__OPTIONS: true,
value: optionStack.map(function (item) {
return item[_this4.valueKey];
}),
label: _this4.renderFilteredOptionLabel(value, optionStack)
};
});
} else {
filteredFlatOptions = [{
__IS__FLAT__OPTIONS: true,
label: this.t('el.cascader.noMatch'),
value: '',
disabled: true
}];
}
this.menu.options = filteredFlatOptions;
this.$nextTick(this.updatePopper);
},
renderFilteredOptionLabel: function renderFilteredOptionLabel(inputValue, optionsStack) {
var _this5 = this;
return optionsStack.map(function (option, index) {
var label = option[_this5.labelKey];
var keywordIndex = label.toLowerCase().indexOf(inputValue.toLowerCase());
var labelPart = label.slice(keywordIndex, inputValue.length + keywordIndex);
var node = keywordIndex > -1 ? _this5.highlightKeyword(label, labelPart) : label;
return index === 0 ? node : [' / ', node];
});
},
highlightKeyword: function highlightKeyword(label, keyword) {
var _this6 = this;
var h = this._c;
return label.split(keyword).map(function (node, index) {
return index === 0 ? node : [h('span', { class: { 'el-cascader-menu__item__keyword': true } }, [_this6._v(keyword)]), node];
});
},
flattenOptions: function flattenOptions(options) {
var _this7 = this;
var ancestor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var flatOptions = [];
options.forEach(function (option) {
var optionsStack = ancestor.concat(option);
if (!option[_this7.childrenKey]) {
flatOptions.push(optionsStack);
} else {
if (_this7.changeOnSelect) {
flatOptions.push(optionsStack);
}
flatOptions = flatOptions.concat(_this7.flattenOptions(option[_this7.childrenKey], optionsStack));
}
});
return flatOptions;
},
clearValue: function clearValue(ev) {
ev.stopPropagation();
this.handlePick([], true);
},
handleClickoutside: function handleClickoutside() {
this.menuVisible = false;
},
handleClick: function handleClick() {
if (this.disabled) return;
if (this.filterable) {
this.menuVisible = true;
this.$refs.input.$refs.input.focus();
return;
}
this.menuVisible = !this.menuVisible;
}
},
created: function created() {
var _this8 = this;
this.debouncedInputChange = (0, _debounce2.default)(this.debounce, function (value) {
var before = _this8.beforeFilter(value);
if (before && before.then) {
_this8.menu.options = [{
__IS__FLAT__OPTIONS: true,
label: _this8.t('el.cascader.loading'),
value: '',
disabled: true
}];
before.then(function () {
_this8.$nextTick(function () {
_this8.handleInputChange(value);
});
});
} else if (before !== false) {
_this8.$nextTick(function () {
_this8.handleInputChange(value);
});
}
});
},
mounted: function mounted() {
this.flatOptions = this.flattenOptions(this.options);
}
};
/***/ },
/* 351 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(352),
/* template */
null,
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 352 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _babelHelperVueJsxMergeProps = __webpack_require__(353);
var _babelHelperVueJsxMergeProps2 = _interopRequireDefault(_babelHelperVueJsxMergeProps);
var _shared = __webpack_require__(354);
var _scrollIntoView = __webpack_require__(113);
var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElCascaderMenu',
data: function data() {
return {
inputWidth: 0,
options: [],
props: {},
visible: false,
activeValue: [],
value: [],
expandTrigger: 'click',
changeOnSelect: false,
popperClass: ''
};
},
watch: {
visible: function visible(value) {
if (value) {
this.activeValue = this.value;
}
},
value: {
immediate: true,
handler: function handler(value) {
this.activeValue = value;
}
}
},
computed: {
activeOptions: {
cache: false,
get: function get() {
var _this = this;
var activeValue = this.activeValue;
var configurableProps = ['label', 'value', 'children', 'disabled'];
var formatOptions = function formatOptions(options) {
options.forEach(function (option) {
if (option.__IS__FLAT__OPTIONS) return;
configurableProps.forEach(function (prop) {
var value = option[_this.props[prop] || prop];
if (value) option[prop] = value;
});
if (Array.isArray(option.children)) {
formatOptions(option.children);
}
});
};
var loadActiveOptions = function loadActiveOptions(options) {
var activeOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var level = activeOptions.length;
activeOptions[level] = options;
var active = activeValue[level];
if ((0, _shared.isDef)(active)) {
options = options.filter(function (option) {
return option.value === active;
})[0];
if (options && options.children) {
loadActiveOptions(options.children, activeOptions);
}
}
return activeOptions;
};
formatOptions(this.options);
return loadActiveOptions(this.options);
}
}
},
methods: {
select: function select(item, menuIndex) {
if (item.__IS__FLAT__OPTIONS) {
this.activeValue = item.value;
} else if (menuIndex) {
this.activeValue.splice(menuIndex, this.activeValue.length - 1, item.value);
} else {
this.activeValue = [item.value];
}
this.$emit('pick', this.activeValue);
},
handleMenuLeave: function handleMenuLeave() {
this.$emit('menuLeave');
},
activeItem: function activeItem(item, menuIndex) {
var len = this.activeOptions.length;
this.activeValue.splice(menuIndex, len, item.value);
this.activeOptions.splice(menuIndex + 1, len, item.children);
if (this.changeOnSelect) {
this.$emit('pick', this.activeValue, false);
} else {
this.$emit('activeItemChange', this.activeValue);
}
},
scrollMenu: function scrollMenu(menu) {
(0, _scrollIntoView2.default)(menu, menu.getElementsByClassName('is-active')[0]);
},
handleMenuEnter: function handleMenuEnter() {
var _this2 = this;
this.$nextTick(function () {
return _this2.$refs.menus.forEach(function (menu) {
return _this2.scrollMenu(menu);
});
});
}
},
render: function render(h) {
var _this3 = this;
var activeValue = this.activeValue,
activeOptions = this.activeOptions,
visible = this.visible,
expandTrigger = this.expandTrigger,
popperClass = this.popperClass;
var menus = this._l(activeOptions, function (menu, menuIndex) {
var isFlat = false;
var items = _this3._l(menu, function (item) {
var events = {
on: {}
};
if (item.__IS__FLAT__OPTIONS) isFlat = true;
if (!item.disabled) {
if (item.children) {
var triggerEvent = {
click: 'click',
hover: 'mouseenter'
}[expandTrigger];
events.on[triggerEvent] = function () {
_this3.activeItem(item, menuIndex);
_this3.$nextTick(function () {
// adjust self and next level
_this3.scrollMenu(_this3.$refs.menus[menuIndex]);
_this3.scrollMenu(_this3.$refs.menus[menuIndex + 1]);
});
};
} else {
events.on.click = function () {
_this3.select(item, menuIndex);
_this3.$nextTick(function () {
return _this3.scrollMenu(_this3.$refs.menus[menuIndex]);
});
};
}
}
return h(
'li',
(0, _babelHelperVueJsxMergeProps2.default)([{
'class': {
'el-cascader-menu__item': true,
'el-cascader-menu__item--extensible': item.children,
'is-active': item.value === activeValue[menuIndex],
'is-disabled': item.disabled
}
}, events]),
[item.label]
);
});
var menuStyle = {};
if (isFlat) {
menuStyle.minWidth = _this3.inputWidth + 'px';
}
return h(
'ul',
{
'class': {
'el-cascader-menu': true,
'el-cascader-menu--flexible': isFlat
},
style: menuStyle,
refInFor: true,
ref: 'menus' },
[items]
);
});
return h(
'transition',
{
attrs: { name: 'el-zoom-in-top' },
on: {
'before-enter': this.handleMenuEnter,
'after-leave': this.handleMenuLeave
}
},
[h(
'div',
{
directives: [{
name: 'show',
value: visible
}],
'class': ['el-cascader-menus', popperClass],
ref: 'wrapper'
},
[menus]
)]
);
}
};
/***/ },
/* 353 */
/***/ function(module, exports) {
module.exports = __webpack_require__(69);
/***/ },
/* 354 */
/***/ function(module, exports) {
module.exports = __webpack_require__(70);
/***/ },
/* 355 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('span', {
directives: [{
name: "clickoutside",
rawName: "v-clickoutside",
value: (_vm.handleClickoutside),
expression: "handleClickoutside"
}],
ref: "reference",
staticClass: "el-cascader",
class: [{
'is-opened': _vm.menuVisible,
'is-disabled': _vm.disabled
},
_vm.size ? 'el-cascader--' + _vm.size : ''
],
on: {
"click": _vm.handleClick,
"mouseenter": function($event) {
_vm.inputHover = true
},
"mouseleave": function($event) {
_vm.inputHover = false
}
}
}, [_c('el-input', {
ref: "input",
attrs: {
"readonly": !_vm.filterable,
"placeholder": _vm.currentLabels.length ? undefined : _vm.placeholder,
"validate-event": false,
"size": _vm.size,
"disabled": _vm.disabled
},
on: {
"change": _vm.debouncedInputChange
},
model: {
value: (_vm.inputValue),
callback: function($$v) {
_vm.inputValue = $$v
},
expression: "inputValue"
}
}, [_c('template', {
slot: "icon"
}, [(_vm.clearable && _vm.inputHover && _vm.currentLabels.length) ? _c('i', {
key: "1",
staticClass: "el-input__icon el-icon-circle-close el-cascader__clearIcon",
on: {
"click": _vm.clearValue
}
}) : _c('i', {
key: "2",
staticClass: "el-input__icon el-icon-caret-bottom",
class: {
'is-reverse': _vm.menuVisible
}
})])], 2), _c('span', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.inputValue === ''),
expression: "inputValue === ''"
}],
staticClass: "el-cascader__label"
}, [(_vm.showAllLevels) ? [_vm._l((_vm.currentLabels), function(label, index) {
return [_vm._v("\n " + _vm._s(label) + "\n "), (index < _vm.currentLabels.length - 1) ? _c('span', [_vm._v(" / ")]) : _vm._e()]
})] : [_vm._v("\n " + _vm._s(_vm.currentLabels[_vm.currentLabels.length - 1]) + "\n ")]], 2)], 1)
},staticRenderFns: []}
/***/ },
/* 356 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(357);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 357 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(358),
/* template */
__webpack_require__(373),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 358 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _color = __webpack_require__(359);
var _color2 = _interopRequireDefault(_color);
var _pickerDropdown = __webpack_require__(360);
var _pickerDropdown2 = _interopRequireDefault(_pickerDropdown);
var _clickoutside = __webpack_require__(21);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElColorPicker',
props: {
value: {
type: String
},
showAlpha: {
type: Boolean
},
colorFormat: {
type: String
}
},
directives: { Clickoutside: _clickoutside2.default },
computed: {
displayedColor: function displayedColor() {
if (!this.value && !this.showPanelColor) {
return 'transparent';
} else {
var _color$toRgb = this.color.toRgb(),
r = _color$toRgb.r,
g = _color$toRgb.g,
b = _color$toRgb.b;
return this.showAlpha ? 'rgba(' + r + ', ' + g + ', ' + b + ', ' + this.color.get('alpha') / 100 + ')' : 'rgb(' + r + ', ' + g + ', ' + b + ')';
}
}
},
watch: {
value: function value(val) {
if (!val) {
this.showPanelColor = false;
} else if (val && val !== this.color.value) {
this.color.fromString(val);
}
},
color: {
deep: true,
handler: function handler() {
this.showPanelColor = true;
}
},
displayedColor: function displayedColor(val) {
this.$emit('active-change', val);
}
},
methods: {
confirmValue: function confirmValue(value) {
this.$emit('input', this.color.value);
this.$emit('change', this.color.value);
this.showPicker = false;
},
clearValue: function clearValue() {
this.$emit('input', null);
this.$emit('change', null);
this.showPanelColor = false;
this.showPicker = false;
this.resetColor();
},
hide: function hide() {
this.showPicker = false;
this.resetColor();
},
resetColor: function resetColor() {
var _this = this;
this.$nextTick(function (_) {
if (_this.value) {
_this.color.fromString(_this.value);
} else {
_this.showPanelColor = false;
}
});
}
},
mounted: function mounted() {
var value = this.value;
if (value) {
this.color.fromString(value);
}
this.popperElm = this.$refs.dropdown.$el;
},
data: function data() {
var color = new _color2.default({
enableAlpha: this.showAlpha,
format: this.colorFormat
});
return {
color: color,
showPicker: false,
showPanelColor: false
};
},
components: {
PickerDropdown: _pickerDropdown2.default
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 359 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var hsv2hsl = function hsv2hsl(hue, sat, val) {
return [hue, sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0, hue / 2];
};
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
var isOnePointZero = function isOnePointZero(n) {
return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
};
var isPercentage = function isPercentage(n) {
return typeof n === 'string' && n.indexOf('%') !== -1;
};
// Take input from [0, n] and return it as [0, 1]
var bound01 = function bound01(value, max) {
if (isOnePointZero(value)) value = '100%';
var processPercent = isPercentage(value);
value = Math.min(max, Math.max(0, parseFloat(value)));
// Automatically convert percentage into number
if (processPercent) {
value = parseInt(value * max, 10) / 100;
}
// Handle floating point rounding errors
if (Math.abs(value - max) < 0.000001) {
return 1;
}
// Convert into [0, 1] range if it isn't already
return value % max / parseFloat(max);
};
var INT_HEX_MAP = { 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F' };
var toHex = function toHex(_ref) {
var r = _ref.r,
g = _ref.g,
b = _ref.b;
var hexOne = function hexOne(value) {
value = Math.min(Math.round(value), 255);
var high = Math.floor(value / 16);
var low = value % 16;
return '' + (INT_HEX_MAP[high] || high) + (INT_HEX_MAP[low] || low);
};
if (isNaN(r) || isNaN(g) || isNaN(b)) return '';
return '#' + hexOne(r) + hexOne(g) + hexOne(b);
};
var HEX_INT_MAP = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
var parseHexChannel = function parseHexChannel(hex) {
if (hex.length === 2) {
return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
}
return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
};
var hsl2hsv = function hsl2hsv(hue, sat, light) {
sat = sat / 100;
light = light / 100;
var smin = sat;
var lmin = Math.max(light, 0.01);
var sv = void 0;
var v = void 0;
light *= 2;
sat *= light <= 1 ? light : 2 - light;
smin *= lmin <= 1 ? lmin : 2 - lmin;
v = (light + sat) / 2;
sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
return {
h: hue,
s: sv * 100,
v: v * 100
};
};
// `rgbToHsv`
// Converts an RGB color value to HSV
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
// *Returns:* { h, s, v } in [0,1]
var rgb2hsv = function rgb2hsv(r, g, b) {
r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);
var max = Math.max(r, g, b);
var min = Math.min(r, g, b);
var h = void 0,
s = void 0;
var v = max;
var d = max - min;
s = max === 0 ? 0 : d / max;
if (max === min) {
h = 0; // achromatic
} else {
switch (max) {
case r:
h = (g - b) / d + (g < b ? 6 : 0);
break;
case g:
h = (b - r) / d + 2;
break;
case b:
h = (r - g) / d + 4;
break;
}
h /= 6;
}
return { h: h * 360, s: s * 100, v: v * 100 };
};
// `hsvToRgb`
// Converts an HSV color value to RGB.
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
// *Returns:* { r, g, b } in the set [0, 255]
var hsv2rgb = function hsv2rgb(h, s, v) {
h = bound01(h, 360) * 6;
s = bound01(s, 100);
v = bound01(v, 100);
var i = Math.floor(h);
var f = h - i;
var p = v * (1 - s);
var q = v * (1 - f * s);
var t = v * (1 - (1 - f) * s);
var mod = i % 6;
var r = [v, q, p, p, t, v][mod];
var g = [t, v, v, q, p, p][mod];
var b = [p, p, t, v, v, q][mod];
return {
r: Math.round(r * 255),
g: Math.round(g * 255),
b: Math.round(b * 255)
};
};
var Color = function () {
function Color(options) {
_classCallCheck(this, Color);
this._hue = 0;
this._saturation = 100;
this._value = 100;
this._alpha = 100;
this.enableAlpha = false;
this.format = 'hex';
this.value = '';
options = options || {};
for (var option in options) {
if (options.hasOwnProperty(option)) {
this[option] = options[option];
}
}
this.doOnChange();
}
Color.prototype.set = function set(prop, value) {
if (arguments.length === 1 && (typeof prop === 'undefined' ? 'undefined' : _typeof(prop)) === 'object') {
for (var p in prop) {
if (prop.hasOwnProperty(p)) {
this.set(p, prop[p]);
}
}
return;
}
this['_' + prop] = value;
this.doOnChange();
};
Color.prototype.get = function get(prop) {
return this['_' + prop];
};
Color.prototype.toRgb = function toRgb() {
return hsv2rgb(this._hue, this._saturation, this._value);
};
Color.prototype.fromString = function fromString(value) {
var _this = this;
if (!value) {
this._hue = 0;
this._saturation = 100;
this._value = 100;
this.doOnChange();
return;
}
var fromHSV = function fromHSV(h, s, v) {
_this._hue = h;
_this._saturation = s;
_this._value = v;
_this.doOnChange();
};
if (value.indexOf('hsl') !== -1) {
var parts = value.replace(/hsla|hsl|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
return val !== '';
}).map(function (val, index) {
return index > 2 ? parseFloat(val) : parseInt(val, 10);
});
if (parts.length === 4) {
this._alpha = Math.floor(parseFloat(parts[3]) * 100);
}
if (parts.length >= 3) {
var _hsl2hsv = hsl2hsv(parts[0], parts[1], parts[2]),
h = _hsl2hsv.h,
s = _hsl2hsv.s,
v = _hsl2hsv.v;
fromHSV(h, s, v);
}
} else if (value.indexOf('hsv') !== -1) {
var _parts = value.replace(/hsva|hsv|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
return val !== '';
}).map(function (val, index) {
return index > 2 ? parseFloat(val) : parseInt(val, 10);
});
if (_parts.length === 4) {
this._alpha = Math.floor(parseFloat(_parts[3]) * 100);
}
if (_parts.length >= 3) {
fromHSV(_parts[0], _parts[1], _parts[2]);
}
} else if (value.indexOf('rgb') !== -1) {
var _parts2 = value.replace(/rgba|rgb|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
return val !== '';
}).map(function (val, index) {
return index > 2 ? parseFloat(val) : parseInt(val, 10);
});
if (_parts2.length === 4) {
this._alpha = Math.floor(parseFloat(_parts2[3]) * 100);
}
if (_parts2.length >= 3) {
var _rgb2hsv = rgb2hsv(_parts2[0], _parts2[1], _parts2[2]),
_h = _rgb2hsv.h,
_s = _rgb2hsv.s,
_v = _rgb2hsv.v;
fromHSV(_h, _s, _v);
}
} else if (value.indexOf('#') !== -1) {
var hex = value.replace('#', '').trim();
var r = void 0,
g = void 0,
b = void 0;
if (hex.length === 3) {
r = parseHexChannel(hex[0] + hex[0]);
g = parseHexChannel(hex[1] + hex[1]);
b = parseHexChannel(hex[2] + hex[2]);
} else if (hex.length === 6) {
r = parseHexChannel(hex.substring(0, 2));
g = parseHexChannel(hex.substring(2, 4));
b = parseHexChannel(hex.substring(4));
}
var _rgb2hsv2 = rgb2hsv(r, g, b),
_h2 = _rgb2hsv2.h,
_s2 = _rgb2hsv2.s,
_v2 = _rgb2hsv2.v;
fromHSV(_h2, _s2, _v2);
}
};
Color.prototype.doOnChange = function doOnChange() {
var _hue = this._hue,
_saturation = this._saturation,
_value = this._value,
_alpha = this._alpha,
format = this.format;
if (this.enableAlpha) {
switch (format) {
case 'hsl':
var hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
this.value = 'hsla(' + _hue + ', ' + Math.round(hsl[1] * 100) + '%, ' + Math.round(hsl[2] * 100) + '%, ' + _alpha / 100 + ')';
break;
case 'hsv':
this.value = 'hsva(' + _hue + ', ' + Math.round(_saturation) + '%, ' + Math.round(_value) + '%, ' + _alpha / 100 + ')';
break;
default:
var _hsv2rgb = hsv2rgb(_hue, _saturation, _value),
r = _hsv2rgb.r,
g = _hsv2rgb.g,
b = _hsv2rgb.b;
this.value = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + _alpha / 100 + ')';
}
} else {
switch (format) {
case 'hsl':
var _hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
this.value = 'hsl(' + _hue + ', ' + Math.round(_hsl[1] * 100) + '%, ' + Math.round(_hsl[2] * 100) + '%)';
break;
case 'hsv':
this.value = 'hsv(' + _hue + ', ' + Math.round(_saturation) + '%, ' + Math.round(_value) + '%)';
break;
case 'rgb':
var _hsv2rgb2 = hsv2rgb(_hue, _saturation, _value),
_r = _hsv2rgb2.r,
_g = _hsv2rgb2.g,
_b = _hsv2rgb2.b;
this.value = 'rgb(' + _r + ', ' + _g + ', ' + _b + ')';
break;
default:
this.value = toHex(hsv2rgb(_hue, _saturation, _value));
}
}
};
return Color;
}();
exports.default = Color;
;
/***/ },
/* 360 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(361),
/* template */
__webpack_require__(372),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 361 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _svPanel = __webpack_require__(362);
var _svPanel2 = _interopRequireDefault(_svPanel);
var _hueSlider = __webpack_require__(366);
var _hueSlider2 = _interopRequireDefault(_hueSlider);
var _alphaSlider = __webpack_require__(369);
var _alphaSlider2 = _interopRequireDefault(_alphaSlider);
var _vuePopper = __webpack_require__(24);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'el-color-picker-dropdown',
mixins: [_vuePopper2.default, _locale2.default],
components: {
SvPanel: _svPanel2.default,
HueSlider: _hueSlider2.default,
AlphaSlider: _alphaSlider2.default
},
props: {
color: {
required: true
},
showAlpha: Boolean
},
computed: {
currentColor: function currentColor() {
var parent = this.$parent;
return !parent.value && !parent.showPanelColor ? '' : parent.color.value;
}
},
methods: {
confirmValue: function confirmValue() {
this.$emit('pick');
}
},
mounted: function mounted() {
this.$parent.popperElm = this.popperElm = this.$el;
this.referenceElm = this.$parent.$el;
},
watch: {
showPopper: function showPopper(val) {
var _this = this;
if (val === true) {
this.$nextTick(function () {
var _$refs = _this.$refs,
sl = _$refs.sl,
hue = _$refs.hue,
alpha = _$refs.alpha;
sl && sl.update();
hue && hue.update();
alpha && alpha.update();
});
}
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 362 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(363),
/* template */
__webpack_require__(365),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 363 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _draggable = __webpack_require__(364);
var _draggable2 = _interopRequireDefault(_draggable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'el-sl-panel',
props: {
color: {
required: true
}
},
computed: {
colorValue: function colorValue() {
var hue = this.color.get('hue');
var value = this.color.get('value');
return { hue: hue, value: value };
}
},
watch: {
colorValue: function colorValue() {
this.update();
}
},
methods: {
update: function update() {
var saturation = this.color.get('saturation');
var value = this.color.get('value');
var el = this.$el;
var _el$getBoundingClient = el.getBoundingClientRect(),
width = _el$getBoundingClient.width,
height = _el$getBoundingClient.height;
if (!height) height = width * 3 / 4;
this.cursorLeft = saturation * width / 100;
this.cursorTop = (100 - value) * height / 100;
this.background = 'hsl(' + this.color.get('hue') + ', 100%, 50%)';
},
handleDrag: function handleDrag(event) {
var el = this.$el;
var rect = el.getBoundingClientRect();
var left = event.clientX - rect.left;
var top = event.clientY - rect.top;
left = Math.max(0, left);
left = Math.min(left, rect.width);
top = Math.max(0, top);
top = Math.min(top, rect.height);
this.cursorLeft = left;
this.cursorTop = top;
this.color.set({
saturation: left / rect.width * 100,
value: 100 - top / rect.height * 100
});
}
},
mounted: function mounted() {
var _this = this;
(0, _draggable2.default)(this.$el, {
drag: function drag(event) {
_this.handleDrag(event);
},
end: function end(event) {
_this.handleDrag(event);
}
});
this.update();
},
data: function data() {
return {
cursorTop: 0,
cursorLeft: 0,
background: 'hsl(0, 100%, 50%)'
};
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 364 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
exports.default = function (element, options) {
if (_vue2.default.prototype.$isServer) return;
var moveFn = function moveFn(event) {
if (options.drag) {
options.drag(event);
}
};
var upFn = function upFn(event) {
document.removeEventListener('mousemove', moveFn);
document.removeEventListener('mouseup', upFn);
document.onselectstart = null;
document.ondragstart = null;
isDragging = false;
if (options.end) {
options.end(event);
}
};
element.addEventListener('mousedown', function (event) {
if (isDragging) return;
document.onselectstart = function () {
return false;
};
document.ondragstart = function () {
return false;
};
document.addEventListener('mousemove', moveFn);
document.addEventListener('mouseup', upFn);
isDragging = true;
if (options.start) {
options.start(event);
}
});
};
var _vue = __webpack_require__(44);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var isDragging = false;
/***/ },
/* 365 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-color-svpanel",
style: ({
backgroundColor: _vm.background
})
}, [_c('div', {
staticClass: "el-color-svpanel__white"
}), _c('div', {
staticClass: "el-color-svpanel__black"
}), _c('div', {
staticClass: "el-color-svpanel__cursor",
style: ({
top: _vm.cursorTop + 'px',
left: _vm.cursorLeft + 'px'
})
}, [_c('div')])])
},staticRenderFns: []}
/***/ },
/* 366 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(367),
/* template */
__webpack_require__(368),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 367 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _draggable = __webpack_require__(364);
var _draggable2 = _interopRequireDefault(_draggable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'el-color-hue-slider',
props: {
color: {
required: true
},
vertical: Boolean
},
data: function data() {
return {
thumbLeft: 0,
thumbTop: 0
};
},
computed: {
hueValue: function hueValue() {
var hue = this.color.get('hue');
return hue;
}
},
watch: {
hueValue: function hueValue() {
this.update();
}
},
methods: {
handleClick: function handleClick(event) {
var thumb = this.$refs.thumb;
var target = event.target;
if (target !== thumb) {
this.handleDrag(event);
}
},
handleDrag: function handleDrag(event) {
var rect = this.$el.getBoundingClientRect();
var thumb = this.$refs.thumb;
var hue = void 0;
if (!this.vertical) {
var left = event.clientX - rect.left;
left = Math.min(left, rect.width - thumb.offsetWidth / 2);
left = Math.max(thumb.offsetWidth / 2, left);
hue = Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 360);
} else {
var top = event.clientY - rect.top;
top = Math.min(top, rect.height - thumb.offsetHeight / 2);
top = Math.max(thumb.offsetHeight / 2, top);
hue = Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 360);
}
this.color.set('hue', hue);
},
getThumbLeft: function getThumbLeft() {
if (this.vertical) return 0;
var el = this.$el;
var hue = this.color.get('hue');
if (!el) return 0;
var thumb = this.$refs.thumb;
return Math.round(hue * (el.offsetWidth - thumb.offsetWidth / 2) / 360);
},
getThumbTop: function getThumbTop() {
if (!this.vertical) return 0;
var el = this.$el;
var hue = this.color.get('hue');
if (!el) return 0;
var thumb = this.$refs.thumb;
return Math.round(hue * (el.offsetHeight - thumb.offsetHeight / 2) / 360);
},
update: function update() {
this.thumbLeft = this.getThumbLeft();
this.thumbTop = this.getThumbTop();
}
},
mounted: function mounted() {
var _this = this;
var _$refs = this.$refs,
bar = _$refs.bar,
thumb = _$refs.thumb;
var dragConfig = {
drag: function drag(event) {
_this.handleDrag(event);
},
end: function end(event) {
_this.handleDrag(event);
}
};
(0, _draggable2.default)(bar, dragConfig);
(0, _draggable2.default)(thumb, dragConfig);
this.update();
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 368 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-color-hue-slider",
class: {
'is-vertical': _vm.vertical
}
}, [_c('div', {
ref: "bar",
staticClass: "el-color-hue-slider__bar",
on: {
"click": _vm.handleClick
}
}), _c('div', {
ref: "thumb",
staticClass: "el-color-hue-slider__thumb",
style: ({
left: _vm.thumbLeft + 'px',
top: _vm.thumbTop + 'px'
})
})])
},staticRenderFns: []}
/***/ },
/* 369 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(370),
/* template */
__webpack_require__(371),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 370 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _draggable = __webpack_require__(364);
var _draggable2 = _interopRequireDefault(_draggable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'el-color-alpha-slider',
props: {
color: {
required: true
},
vertical: Boolean
},
watch: {
'color._alpha': function color_alpha() {
this.update();
},
'color.value': function colorValue() {
this.update();
}
},
methods: {
handleClick: function handleClick(event) {
var thumb = this.$refs.thumb;
var target = event.target;
if (target !== thumb) {
this.handleDrag(event);
}
},
handleDrag: function handleDrag(event) {
var rect = this.$el.getBoundingClientRect();
var thumb = this.$refs.thumb;
if (!this.vertical) {
var left = event.clientX - rect.left;
left = Math.max(thumb.offsetWidth / 2, left);
left = Math.min(left, rect.width - thumb.offsetWidth / 2);
this.color.set('alpha', Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 100));
} else {
var top = event.clientY - rect.top;
top = Math.max(thumb.offsetHeight / 2, top);
top = Math.min(top, rect.height - thumb.offsetHeight / 2);
this.color.set('alpha', Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 100));
}
},
getThumbLeft: function getThumbLeft() {
if (this.vertical) return 0;
var el = this.$el;
var alpha = this.color._alpha;
if (!el) return 0;
var thumb = this.$refs.thumb;
return Math.round(alpha * (el.offsetWidth - thumb.offsetWidth / 2) / 100);
},
getThumbTop: function getThumbTop() {
if (!this.vertical) return 0;
var el = this.$el;
var alpha = this.color._alpha;
if (!el) return 0;
var thumb = this.$refs.thumb;
return Math.round(alpha * (el.offsetHeight - thumb.offsetHeight / 2) / 100);
},
getBackground: function getBackground() {
if (this.color && this.color.value) {
var _color$toRgb = this.color.toRgb(),
r = _color$toRgb.r,
g = _color$toRgb.g,
b = _color$toRgb.b;
return 'linear-gradient(to right, rgba(' + r + ', ' + g + ', ' + b + ', 0) 0%, rgba(' + r + ', ' + g + ', ' + b + ', 1) 100%)';
}
return null;
},
update: function update() {
this.thumbLeft = this.getThumbLeft();
this.thumbTop = this.getThumbTop();
this.background = this.getBackground();
}
},
data: function data() {
return {
thumbLeft: 0,
thumbTop: 0,
background: null
};
},
mounted: function mounted() {
var _this = this;
var _$refs = this.$refs,
bar = _$refs.bar,
thumb = _$refs.thumb;
var dragConfig = {
drag: function drag(event) {
_this.handleDrag(event);
},
end: function end(event) {
_this.handleDrag(event);
}
};
(0, _draggable2.default)(bar, dragConfig);
(0, _draggable2.default)(thumb, dragConfig);
this.update();
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/* 371 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-color-alpha-slider",
class: {
'is-vertical': _vm.vertical
}
}, [_c('div', {
ref: "bar",
staticClass: "el-color-alpha-slider__bar",
style: ({
background: _vm.background
}),
on: {
"click": _vm.handleClick
}
}), _c('div', {
ref: "thumb",
staticClass: "el-color-alpha-slider__thumb",
style: ({
left: _vm.thumbLeft + 'px',
top: _vm.thumbTop + 'px'
})
})])
},staticRenderFns: []}
/***/ },
/* 372 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"after-leave": _vm.doDestroy
}
}, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.showPopper),
expression: "showPopper"
}],
staticClass: "el-color-dropdown"
}, [_c('div', {
staticClass: "el-color-dropdown__main-wrapper"
}, [_c('hue-slider', {
ref: "hue",
staticStyle: {
"float": "right"
},
attrs: {
"color": _vm.color,
"vertical": ""
}
}), _c('sv-panel', {
ref: "sl",
attrs: {
"color": _vm.color
}
})], 1), (_vm.showAlpha) ? _c('alpha-slider', {
ref: "alpha",
attrs: {
"color": _vm.color
}
}) : _vm._e(), _c('div', {
staticClass: "el-color-dropdown__btns"
}, [_c('span', {
staticClass: "el-color-dropdown__value"
}, [_vm._v(_vm._s(_vm.currentColor))]), _c('a', {
staticClass: "el-color-dropdown__link-btn",
attrs: {
"href": "JavaScript:"
},
on: {
"click": function($event) {
_vm.$emit('clear')
}
}
}, [_vm._v(_vm._s(_vm.t('el.colorpicker.clear')))]), _c('button', {
staticClass: "el-color-dropdown__btn",
on: {
"click": _vm.confirmValue
}
}, [_vm._v(_vm._s(_vm.t('el.colorpicker.confirm')))])])], 1)])
},staticRenderFns: []}
/***/ },
/* 373 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "clickoutside",
rawName: "v-clickoutside",
value: (_vm.hide),
expression: "hide"
}],
staticClass: "el-color-picker"
}, [_c('div', {
staticClass: "el-color-picker__trigger",
on: {
"click": function($event) {
_vm.showPicker = !_vm.showPicker
}
}
}, [_c('span', {
staticClass: "el-color-picker__color",
class: {
'is-alpha': _vm.showAlpha
}
}, [_c('span', {
staticClass: "el-color-picker__color-inner",
style: ({
backgroundColor: _vm.displayedColor
})
}), (!_vm.value && !_vm.showPanelColor) ? _c('span', {
staticClass: "el-color-picker__empty el-icon-close"
}) : _vm._e()]), _c('span', {
staticClass: "el-color-picker__icon el-icon-caret-bottom"
})]), _c('picker-dropdown', {
ref: "dropdown",
staticClass: "el-color-picker__panel",
attrs: {
"color": _vm.color,
"show-alpha": _vm.showAlpha
},
on: {
"pick": _vm.confirmValue,
"clear": _vm.clearValue
},
model: {
value: (_vm.showPicker),
callback: function($$v) {
_vm.showPicker = $$v
},
expression: "showPicker"
}
})], 1)
},staticRenderFns: []}
/***/ },
/* 374 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(375);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/* 375 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(376),
/* template */
__webpack_require__(380),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 376 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _button = __webpack_require__(31);
var _button2 = _interopRequireDefault(_button);
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
var _transferPanel = __webpack_require__(377);
var _transferPanel2 = _interopRequireDefault(_transferPanel);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElTransfer',
mixins: [_emitter2.default, _locale2.default],
components: {
TransferPanel: _transferPanel2.default,
ElButton: _button2.default
},
props: {
data: {
type: Array,
default: function _default() {
return [];
}
},
titles: {
type: Array,
default: function _default() {
return [];
}
},
buttonTexts: {
type: Array,
default: function _default() {
return [];
}
},
filterPlaceholder: {
type: String,
default: ''
},
filterMethod: Function,
leftDefaultChecked: {
type: Array,
default: function _default() {
return [];
}
},
rightDefaultChecked: {
type: Array,
default: function _default() {
return [];
}
},
renderContent: Function,
value: {
type: Array,
default: function _default() {
return [];
}
},
footerFormat: {
type: Object,
default: function _default() {
return {};
}
},
filterable: Boolean,
props: {
type: Object,
default: function _default() {
return {
label: 'label',
key: 'key',
disabled: 'disabled'
};
}
}
},
data: function data() {
return {
leftChecked: [],
rightChecked: []
};
},
computed: {
sourceData: function sourceData() {
var _this = this;
return this.data.filter(function (item) {
return _this.value.indexOf(item[_this.props.key]) === -1;
});
},
targetData: function targetData() {
var _this2 = this;
return this.data.filter(function (item) {
return _this2.value.indexOf(item[_this2.props.key]) > -1;
});
}
},
watch: {
value: function value(val) {
this.dispatch('ElFormItem', 'el.form.change', val);
}
},
methods: {
onSourceCheckedChange: function onSourceCheckedChange(val) {
this.leftChecked = val;
},
onTargetCheckedChange: function onTargetCheckedChange(val) {
this.rightChecked = val;
},
addToLeft: function addToLeft() {
var currentValue = this.value.slice();
this.rightChecked.forEach(function (item) {
var index = currentValue.indexOf(item);
if (index > -1) {
currentValue.splice(index, 1);
}
});
this.$emit('input', currentValue);
this.$emit('change', currentValue, 'left', this.rightChecked);
},
addToRight: function addToRight() {
var _this3 = this;
var currentValue = this.value.slice();
this.leftChecked.forEach(function (item) {
if (_this3.value.indexOf(item) === -1) {
currentValue = currentValue.concat(item);
}
});
this.$emit('input', currentValue);
this.$emit('change', currentValue, 'right', this.leftChecked);
}
}
};
/***/ },
/* 377 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
__webpack_require__(378),
/* template */
__webpack_require__(379),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/* 378 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkboxGroup = __webpack_require__(143);
var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
var _checkbox = __webpack_require__(131);
var _checkbox2 = _interopRequireDefault(_checkbox);
var _input = __webpack_require__(20);
var _input2 = _interopRequireDefault(_input);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
mixins: [_locale2.default],
name: 'ElTransferPanel',
componentName: 'ElTransferPanel',
components: {
ElCheckboxGroup: _checkboxGroup2.default,
ElCheckbox: _checkbox2.default,
ElInput: _input2.default,
OptionContent: {
props: {
option: Object
},
render: function render(h) {
var getParent = function getParent(vm) {
if (vm.$options.componentName === 'ElTransferPanel') {
return vm;
} else if (vm.$parent) {
return getParent(vm.$parent);
} else {
return vm;
}
};
var parent = getParent(this);
return parent.renderContent ? parent.renderContent(h, this.option) : h(
'span',
null,
[this.option[parent.labelProp] || this.option[parent.keyProp]]
);
}
}
},
props: {
data: {
type: Array,
default: function _default() {
return [];
}
},
renderContent: Function,
placeholder: String,
title: String,
filterable: Boolean,
footerFormat: Object,
filterMethod: Function,
defaultChecked: Array,
props: Object
},
data: function data() {
return {
checked: [],
allChecked: false,
query: '',
inputHover: false
};
},
watch: {
checked: function checked(val) {
this.updateAllChecked();
this.$emit('checked-change', val);
},
data: function data() {
var _this = this;
var checked = [];
var filteredDataKeys = this.filteredData.map(function (item) {
return item[_this.keyProp];
});
this.checked.forEach(function (item) {
if (filteredDataKeys.indexOf(item) > -1) {
checked.push(item);
}
});
this.checked = checked;
},
checkableData: function checkableData() {
this.updateAllChecked();
},
defaultChecked: {
immediate: true,
handler: function handler(val, oldVal) {
var _this2 = this;
if (oldVal && val.length === oldVal.length && val.every(function (item) {
return oldVal.indexOf(item) > -1;
})) return;
var checked = [];
var checkableDataKeys = this.checkableData.map(function (item) {
return item[_this2.keyProp];
});
val.forEach(function (item) {
if (checkableDataKeys.indexOf(item) > -1) {
checked.push(item);
}
});
this.checked = checked;
}
}
},
computed: {
filteredData: function filteredData() {
var _this3 = this;
return this.data.filter(function (item) {
if (typeof _this3.filterMethod === 'function') {
return _this3.filterMethod(_this3.query, item);
} else {
var label = item[_this3.labelProp] || item[_this3.keyProp].toString();
return label.toLowerCase().indexOf(_this3.query.toLowerCase()) > -1;
}
});
},
checkableData: function checkableData() {
var _this4 = this;
return this.filteredData.filter(function (item) {
return !item[_this4.disabledProp];
});
},
checkedSummary: function checkedSummary() {
var checkedLength = this.checked.length;
var dataLength = this.data.length;
var _footerFormat = this.footerFormat,
noChecked = _footerFormat.noChecked,
hasChecked = _footerFormat.hasChecked;
if (noChecked && hasChecked) {
return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength).replace(/\${total}/g, dataLength) : noChecked.replace(/\${total}/g, dataLength);
} else {
return checkedLength > 0 ? this.t('el.transfer.hasCheckedFormat', { total: dataLength, checked: checkedLength }) : this.t('el.transfer.noCheckedFormat', { total: dataLength });
}
},
isIndeterminate: function isIndeterminate() {
var checkedLength = this.checked.length;
return checkedLength > 0 && checkedLength < this.checkableData.length;
},
hasNoMatch: function hasNoMatch() {
return this.query.length > 0 && this.filteredData.length === 0;
},
inputIcon: function inputIcon() {
return this.query.length > 0 && this.inputHover ? 'circle-close' : 'search';
},
labelProp: function labelProp() {
return this.props.label || 'label';
},
keyProp: function keyProp() {
return this.props.key || 'key';
},
disabledProp: function disabledProp() {
return this.props.disabled || 'disabled';
}
},
methods: {
updateAllChecked: function updateAllChecked() {
var _this5 = this;
var checkableDataKeys = this.checkableData.map(function (item) {
return item[_this5.keyProp];
});
this.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every(function (item) {
return _this5.checked.indexOf(item) > -1;
});
},
handleAllCheckedChange: function handleAllCheckedChange(value) {
var _this6 = this;
this.checked = value.target.checked ? this.checkableData.map(function (item) {
return item[_this6.keyProp];
}) : [];
},
clearQuery: function clearQuery() {
if (this.inputIcon === 'circle-close') {
this.query = '';
}
}
}
};
/***/ },
/* 379 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-transfer-panel"
}, [_c('p', {
staticClass: "el-transfer-panel__header"
}, [_vm._v(_vm._s(_vm.title))]), _c('div', {
staticClass: "el-transfer-panel__body"
}, [(_vm.filterable) ? _c('el-input', {
staticClass: "el-transfer-panel__filter",
attrs: {
"size": "small",
"placeholder": _vm.placeholder,
"icon": _vm.inputIcon
},
on: {
"click": _vm.clearQuery
},
nativeOn: {
"mouseenter": function($event) {
_vm.inputHover = true
},
"mouseleave": function($event) {
_vm.inputHover = false
}
},
model: {
value: (_vm.query),
callback: function($$v) {
_vm.query = $$v
},
expression: "query"
}
}) : _vm._e(), _c('el-checkbox-group', {
directives: [{
name: "show",
rawName: "v-show",
value: (!_vm.hasNoMatch && _vm.data.length > 0),
expression: "!hasNoMatch && data.length > 0"
}],
staticClass: "el-transfer-panel__list",
class: {
'is-filterable': _vm.filterable
},
model: {
value: (_vm.checked),
callback: function($$v) {
_vm.checked = $$v
},
expression: "checked"
}
}, _vm._l((_vm.filteredData), function(item) {
return _c('el-checkbox', {
key: item[_vm.keyProp],
staticClass: "el-transfer-panel__item",
attrs: {
"label": item[_vm.keyProp],
"disabled": item[_vm.disabledProp]
}
}, [_c('option-content', {
attrs: {
"option": item
}
})], 1)
})), _c('p', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.hasNoMatch),
expression: "hasNoMatch"
}],
staticClass: "el-transfer-panel__empty"
}, [_vm._v(_vm._s(_vm.t('el.transfer.noMatch')))]), _c('p', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.data.length === 0 && !_vm.hasNoMatch),
expression: "data.length === 0 && !hasNoMatch"
}],
staticClass: "el-transfer-panel__empty"
}, [_vm._v(_vm._s(_vm.t('el.transfer.noData')))])], 1), _c('p', {
staticClass: "el-transfer-panel__footer"
}, [_c('el-checkbox', {
attrs: {
"indeterminate": _vm.isIndeterminate
},
on: {
"change": _vm.handleAllCheckedChange
},
model: {
value: (_vm.allChecked),
callback: function($$v) {
_vm.allChecked = $$v
},
expression: "allChecked"
}
}, [_vm._v(_vm._s(_vm.checkedSummary))]), _vm._t("default")], 2)])
},staticRenderFns: []}
/***/ },
/* 380 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-transfer"
}, [_c('transfer-panel', _vm._b({
attrs: {
"data": _vm.sourceData,
"title": _vm.titles[0] || _vm.t('el.transfer.titles.0'),
"default-checked": _vm.leftDefaultChecked,
"placeholder": _vm.filterPlaceholder || _vm.t('el.transfer.filterPlaceholder')
},
on: {
"checked-change": _vm.onSourceCheckedChange
}
}, 'transfer-panel', _vm.$props), [_vm._t("left-footer")], 2), _c('div', {
staticClass: "el-transfer__buttons"
}, [_c('el-button', {
attrs: {
"type": "primary",
"size": "small",
"disabled": _vm.rightChecked.length === 0
},
nativeOn: {
"click": function($event) {
_vm.addToLeft($event)
}
}
}, [_c('i', {
staticClass: "el-icon-arrow-left"
}), (_vm.buttonTexts[0] !== undefined) ? _c('span', [_vm._v(_vm._s(_vm.buttonTexts[0]))]) : _vm._e()]), _c('el-button', {
attrs: {
"type": "primary",
"size": "small",
"disabled": _vm.leftChecked.length === 0
},
nativeOn: {
"click": function($event) {
_vm.addToRight($event)
}
}
}, [(_vm.buttonTexts[1] !== undefined) ? _c('span', [_vm._v(_vm._s(_vm.buttonTexts[1]))]) : _vm._e(), _c('i', {
staticClass: "el-icon-arrow-right"
})])], 1), _c('transfer-panel', _vm._b({
attrs: {
"data": _vm.targetData,
"title": _vm.titles[1] || _vm.t('el.transfer.titles.1'),
"default-checked": _vm.rightDefaultChecked,
"placeholder": _vm.filterPlaceholder || _vm.t('el.transfer.filterPlaceholder')
},
on: {
"checked-change": _vm.onTargetCheckedChange
}
}, 'transfer-panel', _vm.$props), [_vm._t("right-footer")], 2)], 1)
},staticRenderFns: []}
/***/ }
/******/ ]);
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(264);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 9:
/***/ function(module, exports) {
module.exports = __webpack_require__(10);
/***/ },
/***/ 10:
/***/ function(module, exports) {
module.exports = __webpack_require__(18);
/***/ },
/***/ 13:
/***/ function(module, exports) {
module.exports = __webpack_require__(12);
/***/ },
/***/ 14:
/***/ function(module, exports) {
module.exports = __webpack_require__(5);
/***/ },
/***/ 15:
/***/ function(module, exports) {
module.exports = __webpack_require__(20);
/***/ },
/***/ 46:
/***/ function(module, exports) {
module.exports = __webpack_require__(14);
/***/ },
/***/ 60:
/***/ function(module, exports) {
module.exports = __webpack_require__(21);
/***/ },
/***/ 61:
/***/ function(module, exports) {
module.exports = __webpack_require__(22);
/***/ },
/***/ 62:
/***/ function(module, exports) {
module.exports = __webpack_require__(15);
/***/ },
/***/ 63:
/***/ function(module, exports) {
module.exports = __webpack_require__(7);
/***/ },
/***/ 123:
/***/ function(module, exports) {
module.exports = __webpack_require__(4);
/***/ },
/***/ 217:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(218),
/* template */
__webpack_require__(220),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 218:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _emitter = __webpack_require__(14);
var _emitter2 = _interopRequireDefault(_emitter);
var _util = __webpack_require__(219);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_emitter2.default],
name: 'ElOption',
componentName: 'ElOption',
props: {
value: {
required: true
},
label: [String, Number],
created: Boolean,
disabled: {
type: Boolean,
default: false
}
},
data: function data() {
return {
index: -1,
groupDisabled: false,
visible: true,
hitState: false
};
},
computed: {
isObject: function isObject() {
var type = _typeof(this.value);
return type !== 'string' && type !== 'number' && type !== 'boolean';
},
currentLabel: function currentLabel() {
return this.label || (this.isObject ? '' : this.value);
},
currentValue: function currentValue() {
return this.value || this.label || '';
},
parent: function parent() {
var result = this.$parent;
while (!result.isSelect) {
result = result.$parent;
}
return result;
},
itemSelected: function itemSelected() {
if (!this.parent.multiple) {
return this.isEqual(this.value, this.parent.value);
} else {
return this.contains(this.parent.value, this.value);
}
},
limitReached: function limitReached() {
if (this.parent.multiple) {
return !this.itemSelected && this.parent.value.length >= this.parent.multipleLimit && this.parent.multipleLimit > 0;
} else {
return false;
}
}
},
watch: {
currentLabel: function currentLabel() {
if (!this.created && !this.parent.remote) this.dispatch('ElSelect', 'setSelected');
},
value: function value() {
if (!this.created && !this.parent.remote) this.dispatch('ElSelect', 'setSelected');
}
},
methods: {
isEqual: function isEqual(a, b) {
if (!this.isObject) {
return a === b;
} else {
var valueKey = this.parent.valueKey;
return (0, _util.getValueByPath)(a, valueKey) === (0, _util.getValueByPath)(b, valueKey);
}
},
contains: function contains() {
var _this = this;
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var target = arguments[1];
if (!this.isObject) {
return arr.indexOf(target) > -1;
} else {
var _ret = function () {
var valueKey = _this.parent.valueKey;
return {
v: arr.some(function (item) {
return (0, _util.getValueByPath)(item, valueKey) === (0, _util.getValueByPath)(target, valueKey);
})
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
},
handleGroupDisabled: function handleGroupDisabled(val) {
this.groupDisabled = val;
},
hoverItem: function hoverItem() {
if (!this.disabled && !this.groupDisabled) {
this.parent.hoverIndex = this.parent.options.indexOf(this);
}
},
selectOptionClick: function selectOptionClick() {
if (this.disabled !== true && this.groupDisabled !== true) {
this.dispatch('ElSelect', 'handleOptionClick', this);
}
},
queryChange: function queryChange(query) {
// query 里如果有正则中的特殊字符,需要先将这些字符转义
var parsedQuery = String(query).replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1');
this.visible = new RegExp(parsedQuery, 'i').test(this.currentLabel) || this.created;
if (!this.visible) {
this.parent.filteredOptionsCount--;
}
},
resetIndex: function resetIndex() {
var _this2 = this;
this.$nextTick(function () {
_this2.index = _this2.parent.options.indexOf(_this2);
});
}
},
created: function created() {
this.parent.options.push(this);
this.parent.cachedOptions.push(this);
this.parent.optionsCount++;
this.parent.filteredOptionsCount++;
this.index = this.parent.options.indexOf(this);
this.$on('queryChange', this.queryChange);
this.$on('handleGroupDisabled', this.handleGroupDisabled);
this.$on('resetIndex', this.resetIndex);
},
beforeDestroy: function beforeDestroy() {
this.dispatch('ElSelect', 'onOptionDestroy', this);
}
};
/***/ },
/***/ 219:
/***/ function(module, exports) {
module.exports = __webpack_require__(6);
/***/ },
/***/ 220:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('li', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-select-dropdown__item",
class: {
'selected': _vm.itemSelected,
'is-disabled': _vm.disabled || _vm.groupDisabled || _vm.limitReached,
'hover': _vm.parent.hoverIndex === _vm.index
},
on: {
"mouseenter": _vm.hoverItem,
"click": function($event) {
$event.stopPropagation();
_vm.selectOptionClick($event)
}
}
}, [_vm._t("default", [_c('span', [_vm._v(_vm._s(_vm.currentLabel))])])], 2)
},staticRenderFns: []}
/***/ },
/***/ 264:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _select = __webpack_require__(265);
var _select2 = _interopRequireDefault(_select);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_select2.default.install = function (Vue) {
Vue.component(_select2.default.name, _select2.default);
};
exports.default = _select2.default;
/***/ },
/***/ 265:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(266),
/* template */
__webpack_require__(271),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 266:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _emitter = __webpack_require__(14);
var _emitter2 = _interopRequireDefault(_emitter);
var _locale = __webpack_require__(61);
var _locale2 = _interopRequireDefault(_locale);
var _input = __webpack_require__(9);
var _input2 = _interopRequireDefault(_input);
var _selectDropdown = __webpack_require__(267);
var _selectDropdown2 = _interopRequireDefault(_selectDropdown);
var _option = __webpack_require__(217);
var _option2 = _interopRequireDefault(_option);
var _tag = __webpack_require__(270);
var _tag2 = _interopRequireDefault(_tag);
var _scrollbar = __webpack_require__(15);
var _scrollbar2 = _interopRequireDefault(_scrollbar);
var _debounce = __webpack_require__(63);
var _debounce2 = _interopRequireDefault(_debounce);
var _clickoutside = __webpack_require__(10);
var _clickoutside2 = _interopRequireDefault(_clickoutside);
var _dom = __webpack_require__(123);
var _resizeEvent = __webpack_require__(46);
var _locale3 = __webpack_require__(62);
var _scrollIntoView = __webpack_require__(60);
var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
var _util = __webpack_require__(219);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var sizeMap = {
'large': 42,
'small': 30,
'mini': 22
};
exports.default = {
mixins: [_emitter2.default, _locale2.default],
name: 'ElSelect',
componentName: 'ElSelect',
computed: {
iconClass: function iconClass() {
var criteria = this.clearable && !this.disabled && this.inputHovering && !this.multiple && this.value !== undefined && this.value !== '';
return criteria ? 'circle-close is-show-close' : this.remote && this.filterable ? '' : 'caret-top';
},
debounce: function debounce() {
return this.remote ? 300 : 0;
},
emptyText: function emptyText() {
if (this.loading) {
return this.loadingText || this.t('el.select.loading');
} else {
if (this.remote && this.query === '' && this.options.length === 0) return false;
if (this.filterable && this.options.length > 0 && this.filteredOptionsCount === 0) {
return this.noMatchText || this.t('el.select.noMatch');
}
if (this.options.length === 0) {
return this.noDataText || this.t('el.select.noData');
}
}
return null;
},
showNewOption: function showNewOption() {
var _this = this;
var hasExistingOption = this.options.filter(function (option) {
return !option.created;
}).some(function (option) {
return option.currentLabel === _this.query;
});
return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
}
},
components: {
ElInput: _input2.default,
ElSelectMenu: _selectDropdown2.default,
ElOption: _option2.default,
ElTag: _tag2.default,
ElScrollbar: _scrollbar2.default
},
directives: { Clickoutside: _clickoutside2.default },
props: {
name: String,
value: {
required: true
},
size: String,
disabled: Boolean,
clearable: Boolean,
filterable: Boolean,
allowCreate: Boolean,
loading: Boolean,
popperClass: String,
remote: Boolean,
loadingText: String,
noMatchText: String,
noDataText: String,
remoteMethod: Function,
filterMethod: Function,
multiple: Boolean,
multipleLimit: {
type: Number,
default: 0
},
placeholder: {
type: String,
default: function _default() {
return (0, _locale3.t)('el.select.placeholder');
}
},
defaultFirstOption: Boolean,
valueKey: {
type: String,
default: 'value'
}
},
data: function data() {
return {
options: [],
cachedOptions: [],
createdLabel: null,
createdSelected: false,
selected: this.multiple ? [] : {},
isSelect: true,
inputLength: 20,
inputWidth: 0,
cachedPlaceHolder: '',
optionsCount: 0,
filteredOptionsCount: 0,
visible: false,
selectedLabel: '',
hoverIndex: -1,
query: '',
optionsAllDisabled: false,
inputHovering: false,
currentPlaceholder: ''
};
},
watch: {
placeholder: function placeholder(val) {
this.cachedPlaceHolder = this.currentPlaceholder = val;
},
value: function value(val) {
if (this.multiple) {
this.resetInputHeight();
if (val.length > 0 || this.$refs.input && this.query !== '') {
this.currentPlaceholder = '';
} else {
this.currentPlaceholder = this.cachedPlaceHolder;
}
}
this.setSelected();
if (this.filterable && !this.multiple) {
this.inputLength = 20;
}
this.$emit('change', val);
this.dispatch('ElFormItem', 'el.form.change', val);
},
query: function query(val) {
var _this2 = this;
this.$nextTick(function () {
if (_this2.visible) _this2.broadcast('ElSelectDropdown', 'updatePopper');
});
this.hoverIndex = -1;
if (this.multiple && this.filterable) {
this.inputLength = this.$refs.input.value.length * 15 + 20;
this.managePlaceholder();
this.resetInputHeight();
}
if (this.remote && typeof this.remoteMethod === 'function') {
this.hoverIndex = -1;
this.remoteMethod(val);
this.broadcast('ElOption', 'resetIndex');
} else if (typeof this.filterMethod === 'function') {
this.filterMethod(val);
this.broadcast('ElOptionGroup', 'queryChange');
} else {
this.filteredOptionsCount = this.optionsCount;
this.broadcast('ElOption', 'queryChange', val);
this.broadcast('ElOptionGroup', 'queryChange');
}
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
this.checkDefaultFirstOption();
}
},
visible: function visible(val) {
var _this3 = this;
if (!val) {
this.$refs.reference.$el.querySelector('input').blur();
this.handleIconHide();
this.broadcast('ElSelectDropdown', 'destroyPopper');
if (this.$refs.input) {
this.$refs.input.blur();
}
this.query = '';
this.selectedLabel = '';
this.inputLength = 20;
this.resetHoverIndex();
this.$nextTick(function () {
if (_this3.$refs.input && _this3.$refs.input.value === '' && _this3.selected.length === 0) {
_this3.currentPlaceholder = _this3.cachedPlaceHolder;
}
});
if (!this.multiple) {
if (this.selected) {
if (this.filterable && this.allowCreate && this.createdSelected && this.createdOption) {
this.selectedLabel = this.createdLabel;
} else {
this.selectedLabel = this.selected.currentLabel;
}
if (this.filterable) this.query = this.selectedLabel;
}
}
} else {
this.handleIconShow();
this.broadcast('ElSelectDropdown', 'updatePopper');
if (this.filterable) {
this.query = this.selectedLabel;
if (this.multiple) {
this.$refs.input.focus();
} else {
if (!this.remote) {
this.broadcast('ElOption', 'queryChange', '');
this.broadcast('ElOptionGroup', 'queryChange');
}
this.broadcast('ElInput', 'inputSelect');
}
}
}
this.$emit('visible-change', val);
},
options: function options(val) {
if (this.$isServer) return;
this.optionsAllDisabled = val.length === val.filter(function (item) {
return item.disabled === true;
}).length;
if (this.multiple) {
this.resetInputHeight();
}
var inputs = this.$el.querySelectorAll('input');
if ([].indexOf.call(inputs, document.activeElement) === -1) {
this.setSelected();
}
if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
this.checkDefaultFirstOption();
}
}
},
methods: {
handleIconHide: function handleIconHide() {
var icon = this.$el.querySelector('.el-input__icon');
if (icon) {
(0, _dom.removeClass)(icon, 'is-reverse');
}
},
handleIconShow: function handleIconShow() {
var icon = this.$el.querySelector('.el-input__icon');
if (icon && !(0, _dom.hasClass)(icon, 'el-icon-circle-close')) {
(0, _dom.addClass)(icon, 'is-reverse');
}
},
scrollToOption: function scrollToOption() {
var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'selected';
if (this.$refs.popper) {
var menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
(0, _scrollIntoView2.default)(menu, menu.getElementsByClassName(className)[0]);
}
},
handleMenuEnter: function handleMenuEnter() {
var _this4 = this;
this.$nextTick(function () {
return _this4.scrollToOption();
});
},
getOption: function getOption(value) {
var option = void 0;
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
var isObject = type !== 'string' && type !== 'number' && type !== 'boolean';
for (var i = this.cachedOptions.length - 1; i >= 0; i--) {
var cachedOption = this.cachedOptions[i];
var isEqual = isObject ? (0, _util.getValueByPath)(cachedOption.value, this.valueKey) === (0, _util.getValueByPath)(value, this.valueKey) : cachedOption.value === value;
if (isEqual) {
option = cachedOption;
break;
}
}
if (option) return option;
var label = !isObject ? value : '';
var newOption = {
value: value,
currentLabel: label
};
if (this.multiple) {
newOption.hitState = false;
}
return newOption;
},
setSelected: function setSelected() {
var _this5 = this;
if (!this.multiple) {
var option = this.getOption(this.value);
if (option.created) {
this.createdLabel = option.currentLabel;
this.createdSelected = true;
} else {
this.createdSelected = false;
}
this.selectedLabel = option.currentLabel;
this.selected = option;
if (this.filterable) this.query = this.selectedLabel;
return;
}
var result = [];
if (Array.isArray(this.value)) {
this.value.forEach(function (value) {
result.push(_this5.getOption(value));
});
}
this.selected = result;
this.$nextTick(function () {
_this5.resetInputHeight();
});
},
handleFocus: function handleFocus() {
this.visible = true;
},
handleIconClick: function handleIconClick(event) {
if (this.iconClass.indexOf('circle-close') > -1) {
this.deleteSelected(event);
} else {
this.toggleMenu();
}
},
handleMouseDown: function handleMouseDown(event) {
if (event.target.tagName !== 'INPUT') return;
if (this.visible) {
this.handleClose();
event.preventDefault();
}
},
doDestroy: function doDestroy() {
this.$refs.popper && this.$refs.popper.doDestroy();
this.dropdownUl = null;
},
handleClose: function handleClose() {
this.visible = false;
},
toggleLastOptionHitState: function toggleLastOptionHitState(hit) {
if (!Array.isArray(this.selected)) return;
var option = this.selected[this.selected.length - 1];
if (!option) return;
if (hit === true || hit === false) {
option.hitState = hit;
return hit;
}
option.hitState = !option.hitState;
return option.hitState;
},
deletePrevTag: function deletePrevTag(e) {
if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
var value = this.value.slice();
value.pop();
this.$emit('input', value);
}
},
managePlaceholder: function managePlaceholder() {
if (this.currentPlaceholder !== '') {
this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
}
},
resetInputState: function resetInputState(e) {
if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
this.inputLength = this.$refs.input.value.length * 15 + 20;
this.resetInputHeight();
},
resetInputHeight: function resetInputHeight() {
var _this6 = this;
this.$nextTick(function () {
if (!_this6.$refs.reference) return;
var inputChildNodes = _this6.$refs.reference.$el.childNodes;
var input = [].filter.call(inputChildNodes, function (item) {
return item.tagName === 'INPUT';
})[0];
input.style.height = Math.max(_this6.$refs.tags.clientHeight + 6, sizeMap[_this6.size] || 36) + 'px';
if (_this6.visible && _this6.emptyText !== false) {
_this6.broadcast('ElSelectDropdown', 'updatePopper');
}
});
},
resetHoverIndex: function resetHoverIndex() {
var _this7 = this;
setTimeout(function () {
if (!_this7.multiple) {
_this7.hoverIndex = _this7.options.indexOf(_this7.selected);
} else {
if (_this7.selected.length > 0) {
_this7.hoverIndex = Math.min.apply(null, _this7.selected.map(function (item) {
return _this7.options.indexOf(item);
}));
} else {
_this7.hoverIndex = -1;
}
}
}, 300);
},
handleOptionSelect: function handleOptionSelect(option) {
var _this8 = this;
if (this.multiple) {
var value = this.value.slice();
var optionIndex = this.getValueIndex(value, option.value);
if (optionIndex > -1) {
value.splice(optionIndex, 1);
} else if (this.multipleLimit <= 0 || value.length < this.multipleLimit) {
value.push(option.value);
}
this.$emit('input', value);
if (option.created) {
this.query = '';
this.inputLength = 20;
}
if (this.filterable) this.$refs.input.focus();
} else {
this.$emit('input', option.value);
this.visible = false;
}
this.$nextTick(function () {
return _this8.scrollToOption();
});
},
getValueIndex: function getValueIndex() {
var _this9 = this;
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var value = arguments[1];
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
var isObject = type !== 'string' && type !== 'number' && type !== 'boolean';
if (!isObject) {
return arr.indexOf(value);
} else {
var _ret = function () {
var valueKey = _this9.valueKey;
var index = -1;
arr.some(function (item, i) {
if ((0, _util.getValueByPath)(item, valueKey) === (0, _util.getValueByPath)(value, valueKey)) {
index = i;
return true;
}
return false;
});
return {
v: index
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
},
toggleMenu: function toggleMenu() {
if (this.filterable && this.query === '' && this.visible) {
return;
}
if (!this.disabled) {
this.visible = !this.visible;
}
},
navigateOptions: function navigateOptions(direction) {
var _this10 = this;
if (!this.visible) {
this.visible = true;
return;
}
if (this.options.length === 0 || this.filteredOptionsCount === 0) return;
this.optionsAllDisabled = this.options.length === this.options.filter(function (item) {
return item.disabled === true;
}).length;
if (!this.optionsAllDisabled) {
if (direction === 'next') {
this.hoverIndex++;
if (this.hoverIndex === this.options.length) {
this.hoverIndex = 0;
}
if (this.options[this.hoverIndex].disabled === true || this.options[this.hoverIndex].groupDisabled === true || !this.options[this.hoverIndex].visible) {
this.navigateOptions('next');
}
}
if (direction === 'prev') {
this.hoverIndex--;
if (this.hoverIndex < 0) {
this.hoverIndex = this.options.length - 1;
}
if (this.options[this.hoverIndex].disabled === true || this.options[this.hoverIndex].groupDisabled === true || !this.options[this.hoverIndex].visible) {
this.navigateOptions('prev');
}
}
}
this.$nextTick(function () {
return _this10.scrollToOption('hover');
});
},
selectOption: function selectOption() {
if (this.options[this.hoverIndex]) {
this.handleOptionSelect(this.options[this.hoverIndex]);
}
},
deleteSelected: function deleteSelected(event) {
event.stopPropagation();
this.$emit('input', '');
this.visible = false;
this.$emit('clear');
},
deleteTag: function deleteTag(event, tag) {
var index = this.selected.indexOf(tag);
if (index > -1 && !this.disabled) {
var value = this.value.slice();
value.splice(index, 1);
this.$emit('input', value);
this.$emit('remove-tag', tag);
}
event.stopPropagation();
},
onInputChange: function onInputChange() {
if (this.filterable) {
this.query = this.selectedLabel;
}
},
onOptionDestroy: function onOptionDestroy(option) {
this.optionsCount--;
this.filteredOptionsCount--;
var index = this.options.indexOf(option);
if (index > -1) {
this.options.splice(index, 1);
}
this.broadcast('ElOption', 'resetIndex');
},
resetInputWidth: function resetInputWidth() {
this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
},
handleResize: function handleResize() {
this.resetInputWidth();
if (this.multiple) this.resetInputHeight();
},
checkDefaultFirstOption: function checkDefaultFirstOption() {
this.hoverIndex = -1;
for (var i = 0; i !== this.options.length; ++i) {
var option = this.options[i];
if (this.query) {
// pick first options that passes the filter
if (!option.disabled && !option.groupDisabled && option.visible) {
this.hoverIndex = i;
break;
}
} else {
// pick currently selected option
if (option.itemSelected) {
this.hoverIndex = i;
break;
}
}
}
},
getValueKey: function getValueKey(item) {
var type = _typeof(item.value);
if (type === 'number' || type === 'string') {
return item.value;
} else {
return (0, _util.getValueByPath)(item.value, this.valueKey);
}
}
},
created: function created() {
var _this11 = this;
this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder;
if (this.multiple && !Array.isArray(this.value)) {
this.$emit('input', []);
}
if (!this.multiple && Array.isArray(this.value)) {
this.$emit('input', '');
}
this.setSelected();
this.debouncedOnInputChange = (0, _debounce2.default)(this.debounce, function () {
_this11.onInputChange();
});
this.$on('handleOptionClick', this.handleOptionSelect);
this.$on('onOptionDestroy', this.onOptionDestroy);
this.$on('setSelected', this.setSelected);
},
mounted: function mounted() {
var _this12 = this;
if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
this.currentPlaceholder = '';
}
(0, _resizeEvent.addResizeListener)(this.$el, this.handleResize);
if (this.remote && this.multiple) {
this.resetInputHeight();
}
this.$nextTick(function () {
if (_this12.$refs.reference && _this12.$refs.reference.$el) {
_this12.inputWidth = _this12.$refs.reference.$el.getBoundingClientRect().width;
}
});
},
beforeDestroy: function beforeDestroy() {
if (this.$el && this.handleResize) (0, _resizeEvent.removeResizeListener)(this.$el, this.handleResize);
}
};
/***/ },
/***/ 267:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(268),
/* template */
__webpack_require__(269),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 268:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(13);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElSelectDropdown',
componentName: 'ElSelectDropdown',
mixins: [_vuePopper2.default],
props: {
placement: {
default: 'bottom-start'
},
boundariesPadding: {
default: 0
},
popperOptions: {
default: function _default() {
return {
forceAbsolute: true,
gpuAcceleration: false
};
}
}
},
data: function data() {
return {
minWidth: ''
};
},
computed: {
popperClass: function popperClass() {
return this.$parent.popperClass;
}
},
watch: {
'$parent.inputWidth': function $parentInputWidth() {
this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
}
},
mounted: function mounted() {
var _this = this;
this.referenceElm = this.$parent.$refs.reference.$el;
this.$parent.popperElm = this.popperElm = this.$el;
this.$on('updatePopper', function () {
if (_this.$parent.visible) _this.updatePopper();
});
this.$on('destroyPopper', this.destroyPopper);
}
}; //
//
//
//
//
//
//
//
//
/***/ },
/***/ 269:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-select-dropdown",
class: [{
'is-multiple': _vm.$parent.multiple
}, _vm.popperClass],
style: ({
minWidth: _vm.minWidth
})
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
/***/ 270:
/***/ function(module, exports) {
module.exports = __webpack_require__(24);
/***/ },
/***/ 271:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
directives: [{
name: "clickoutside",
rawName: "v-clickoutside",
value: (_vm.handleClose),
expression: "handleClose"
}],
staticClass: "el-select"
}, [(_vm.multiple) ? _c('div', {
ref: "tags",
staticClass: "el-select__tags",
style: ({
'max-width': _vm.inputWidth - 32 + 'px'
}),
on: {
"click": function($event) {
$event.stopPropagation();
_vm.toggleMenu($event)
}
}
}, [_c('transition-group', {
on: {
"after-leave": _vm.resetInputHeight
}
}, _vm._l((_vm.selected), function(item) {
return _c('el-tag', {
key: _vm.getValueKey(item),
attrs: {
"closable": "",
"hit": item.hitState,
"type": "primary",
"close-transition": ""
},
on: {
"close": function($event) {
_vm.deleteTag($event, item)
}
}
}, [_c('span', {
staticClass: "el-select__tags-text"
}, [_vm._v(_vm._s(item.currentLabel))])])
})), (_vm.filterable) ? _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.query),
expression: "query"
}],
ref: "input",
staticClass: "el-select__input",
class: ("is-" + _vm.size),
style: ({
width: _vm.inputLength + 'px',
'max-width': _vm.inputWidth - 42 + 'px'
}),
attrs: {
"type": "text",
"disabled": _vm.disabled,
"debounce": _vm.remote ? 300 : 0
},
domProps: {
"value": (_vm.query)
},
on: {
"focus": function($event) {
_vm.visible = true
},
"keyup": _vm.managePlaceholder,
"keydown": [_vm.resetInputState, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "down", 40)) { return null; }
$event.preventDefault();
_vm.navigateOptions('next')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "up", 38)) { return null; }
$event.preventDefault();
_vm.navigateOptions('prev')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "enter", 13)) { return null; }
$event.preventDefault();
_vm.selectOption($event)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "esc", 27)) { return null; }
$event.stopPropagation();
$event.preventDefault();
_vm.visible = false
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "delete", [8, 46])) { return null; }
_vm.deletePrevTag($event)
}],
"input": function($event) {
if ($event.target.composing) { return; }
_vm.query = $event.target.value
}
}
}) : _vm._e()], 1) : _vm._e(), _c('el-input', {
ref: "reference",
attrs: {
"type": "text",
"placeholder": _vm.currentPlaceholder,
"name": _vm.name,
"size": _vm.size,
"disabled": _vm.disabled,
"readonly": !_vm.filterable || _vm.multiple,
"validate-event": false,
"icon": _vm.iconClass
},
on: {
"focus": _vm.handleFocus,
"click": _vm.handleIconClick
},
nativeOn: {
"mousedown": function($event) {
_vm.handleMouseDown($event)
},
"keyup": function($event) {
_vm.debouncedOnInputChange($event)
},
"keydown": [function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "down", 40)) { return null; }
$event.preventDefault();
_vm.navigateOptions('next')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "up", 38)) { return null; }
$event.preventDefault();
_vm.navigateOptions('prev')
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "enter", 13)) { return null; }
$event.preventDefault();
_vm.selectOption($event)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "esc", 27)) { return null; }
$event.stopPropagation();
$event.preventDefault();
_vm.visible = false
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "tab", 9)) { return null; }
_vm.visible = false
}],
"paste": function($event) {
_vm.debouncedOnInputChange($event)
},
"mouseenter": function($event) {
_vm.inputHovering = true
},
"mouseleave": function($event) {
_vm.inputHovering = false
}
},
model: {
value: (_vm.selectedLabel),
callback: function($$v) {
_vm.selectedLabel = $$v
},
expression: "selectedLabel"
}
}), _c('transition', {
attrs: {
"name": "el-zoom-in-top"
},
on: {
"before-enter": _vm.handleMenuEnter,
"after-leave": _vm.doDestroy
}
}, [_c('el-select-menu', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible && _vm.emptyText !== false),
expression: "visible && emptyText !== false"
}],
ref: "popper"
}, [_c('el-scrollbar', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.options.length > 0 && !_vm.loading),
expression: "options.length > 0 && !loading"
}],
class: {
'is-empty': !_vm.allowCreate && _vm.filteredOptionsCount === 0
},
attrs: {
"tag": "ul",
"wrap-class": "el-select-dropdown__wrap",
"view-class": "el-select-dropdown__list"
}
}, [(_vm.showNewOption) ? _c('el-option', {
attrs: {
"value": _vm.query,
"created": ""
}
}) : _vm._e(), _vm._t("default")], 2), (_vm.emptyText && (_vm.allowCreate && _vm.options.length === 0 || !_vm.allowCreate)) ? _c('p', {
staticClass: "el-select-dropdown__empty"
}, [_vm._v(_vm._s(_vm.emptyText))]) : _vm._e()], 1)], 1)], 1)
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
var _dom = __webpack_require__(4);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var hasModal = false;
var getModal = function getModal() {
if (_vue2.default.prototype.$isServer) return;
var modalDom = PopupManager.modalDom;
if (modalDom) {
hasModal = true;
} else {
hasModal = false;
modalDom = document.createElement('div');
PopupManager.modalDom = modalDom;
modalDom.addEventListener('touchmove', function (event) {
event.preventDefault();
event.stopPropagation();
});
modalDom.addEventListener('click', function () {
PopupManager.doOnModalClick && PopupManager.doOnModalClick();
});
}
return modalDom;
};
var instances = {};
var PopupManager = {
zIndex: 2000,
modalFade: true,
getInstance: function getInstance(id) {
return instances[id];
},
register: function register(id, instance) {
if (id && instance) {
instances[id] = instance;
}
},
deregister: function deregister(id) {
if (id) {
instances[id] = null;
delete instances[id];
}
},
nextZIndex: function nextZIndex() {
return PopupManager.zIndex++;
},
modalStack: [],
doOnModalClick: function doOnModalClick() {
var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
if (!topItem) return;
var instance = PopupManager.getInstance(topItem.id);
if (instance && instance.closeOnClickModal) {
instance.close();
}
},
openModal: function openModal(id, zIndex, dom, modalClass, modalFade) {
if (_vue2.default.prototype.$isServer) return;
if (!id || zIndex === undefined) return;
this.modalFade = modalFade;
var modalStack = this.modalStack;
for (var i = 0, j = modalStack.length; i < j; i++) {
var item = modalStack[i];
if (item.id === id) {
return;
}
}
var modalDom = getModal();
(0, _dom.addClass)(modalDom, 'v-modal');
if (this.modalFade && !hasModal) {
(0, _dom.addClass)(modalDom, 'v-modal-enter');
}
if (modalClass) {
var classArr = modalClass.trim().split(/\s+/);
classArr.forEach(function (item) {
return (0, _dom.addClass)(modalDom, item);
});
}
setTimeout(function () {
(0, _dom.removeClass)(modalDom, 'v-modal-enter');
}, 200);
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
dom.parentNode.appendChild(modalDom);
} else {
document.body.appendChild(modalDom);
}
if (zIndex) {
modalDom.style.zIndex = zIndex;
}
modalDom.style.display = '';
this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
},
closeModal: function closeModal(id) {
var modalStack = this.modalStack;
var modalDom = getModal();
if (modalStack.length > 0) {
var topItem = modalStack[modalStack.length - 1];
if (topItem.id === id) {
if (topItem.modalClass) {
var classArr = topItem.modalClass.trim().split(/\s+/);
classArr.forEach(function (item) {
return (0, _dom.removeClass)(modalDom, item);
});
}
modalStack.pop();
if (modalStack.length > 0) {
modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex;
}
} else {
for (var i = modalStack.length - 1; i >= 0; i--) {
if (modalStack[i].id === id) {
modalStack.splice(i, 1);
break;
}
}
}
}
if (modalStack.length === 0) {
if (this.modalFade) {
(0, _dom.addClass)(modalDom, 'v-modal-leave');
}
setTimeout(function () {
if (modalStack.length === 0) {
if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom);
modalDom.style.display = 'none';
PopupManager.modalDom = undefined;
}
(0, _dom.removeClass)(modalDom, 'v-modal-leave');
}, 200);
}
}
};
var getTopPopup = function getTopPopup() {
if (_vue2.default.prototype.$isServer) return;
if (PopupManager.modalStack.length > 0) {
var topPopup = PopupManager.modalStack[PopupManager.modalStack.length - 1];
if (!topPopup) return;
var instance = PopupManager.getInstance(topPopup.id);
return instance;
}
};
if (!_vue2.default.prototype.$isServer) {
// handle `esc` key when the popup is shown
window.addEventListener('keydown', function (event) {
if (event.keyCode === 27) {
var topPopup = getTopPopup();
if (topPopup && topPopup.closeOnPressEscape) {
topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
}
}
});
}
exports.default = PopupManager;
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/**
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version {{version}}
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
//
// Cross module loader
// Supported: Node, AMD, Browser globals
//
;(function (root, factory) {
if (true) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
__WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if ((typeof module === 'undefined' ? 'undefined' : _typeof(module)) === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.Popper = factory();
}
})(undefined, function () {
'use strict';
var root = window;
// default options
var DEFAULTS = {
// placement of the popper
placement: 'bottom',
gpuAcceleration: true,
// shift popper from its origin by the given amount of pixels (can be negative)
offset: 0,
// the element which will act as boundary of the popper
boundariesElement: 'viewport',
// amount of pixel used to define a minimum distance between the boundaries and the popper
boundariesPadding: 5,
// popper will try to prevent overflow following this order,
// by default, then, it could overflow on the left and on top of the boundariesElement
preventOverflowOrder: ['left', 'right', 'top', 'bottom'],
// the behavior used by flip to change the placement of the popper
flipBehavior: 'flip',
arrowElement: '[x-arrow]',
// list of functions used to modify the offsets before they are applied to the popper
modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle'],
modifiersIgnored: [],
forceAbsolute: false
};
/**
* Create a new Popper.js instance
* @constructor Popper
* @param {HTMLElement} reference - The reference element used to position the popper
* @param {HTMLElement|Object} popper
* The HTML element used as popper, or a configuration used to generate the popper.
* @param {String} [popper.tagName='div'] The tag name of the generated popper.
* @param {Array} [popper.classNames=['popper']] Array of classes to apply to the generated popper.
* @param {Array} [popper.attributes] Array of attributes to apply, specify `attr:value` to assign a value to it.
* @param {HTMLElement|String} [popper.parent=window.document.body] The parent element, given as HTMLElement or as query string.
* @param {String} [popper.content=''] The content of the popper, it can be text, html, or node; if it is not text, set `contentType` to `html` or `node`.
* @param {String} [popper.contentType='text'] If `html`, the `content` will be parsed as HTML. If `node`, it will be appended as-is.
* @param {String} [popper.arrowTagName='div'] Same as `popper.tagName` but for the arrow element.
* @param {Array} [popper.arrowClassNames='popper__arrow'] Same as `popper.classNames` but for the arrow element.
* @param {String} [popper.arrowAttributes=['x-arrow']] Same as `popper.attributes` but for the arrow element.
* @param {Object} options
* @param {String} [options.placement=bottom]
* Placement of the popper accepted values: `top(-start, -end), right(-start, -end), bottom(-start, -right),
* left(-start, -end)`
*
* @param {HTMLElement|String} [options.arrowElement='[x-arrow]']
* The DOM Node used as arrow for the popper, or a CSS selector used to get the DOM node. It must be child of
* its parent Popper. Popper.js will apply to the given element the style required to align the arrow with its
* reference element.
* By default, it will look for a child node of the popper with the `x-arrow` attribute.
*
* @param {Boolean} [options.gpuAcceleration=true]
* When this property is set to true, the popper position will be applied using CSS3 translate3d, allowing the
* browser to use the GPU to accelerate the rendering.
* If set to false, the popper will be placed using `top` and `left` properties, not using the GPU.
*
* @param {Number} [options.offset=0]
* Amount of pixels the popper will be shifted (can be negative).
*
* @param {String|Element} [options.boundariesElement='viewport']
* The element which will define the boundaries of the popper position, the popper will never be placed outside
* of the defined boundaries (except if `keepTogether` is enabled)
*
* @param {Number} [options.boundariesPadding=5]
* Additional padding for the boundaries
*
* @param {Array} [options.preventOverflowOrder=['left', 'right', 'top', 'bottom']]
* Order used when Popper.js tries to avoid overflows from the boundaries, they will be checked in order,
* this means that the last ones will never overflow
*
* @param {String|Array} [options.flipBehavior='flip']
* The behavior used by the `flip` modifier to change the placement of the popper when the latter is trying to
* overlap its reference element. Defining `flip` as value, the placement will be flipped on
* its axis (`right - left`, `top - bottom`).
* You can even pass an array of placements (eg: `['right', 'left', 'top']` ) to manually specify
* how alter the placement when a flip is needed. (eg. in the above example, it would first flip from right to left,
* then, if even in its new placement, the popper is overlapping its reference element, it will be moved to top)
*
* @param {Array} [options.modifiers=[ 'shift', 'offset', 'preventOverflow', 'keepTogether', 'arrow', 'flip', 'applyStyle']]
* List of functions used to modify the data before they are applied to the popper, add your custom functions
* to this array to edit the offsets and placement.
* The function should reflect the @params and @returns of preventOverflow
*
* @param {Array} [options.modifiersIgnored=[]]
* Put here any built-in modifier name you want to exclude from the modifiers list
* The function should reflect the @params and @returns of preventOverflow
*
* @param {Boolean} [options.removeOnDestroy=false]
* Set to true if you want to automatically remove the popper when you call the `destroy` method.
*/
function Popper(reference, popper, options) {
this._reference = reference.jquery ? reference[0] : reference;
this.state = {};
// if the popper variable is a configuration object, parse it to generate an HTMLElement
// generate a default popper if is not defined
var isNotDefined = typeof popper === 'undefined' || popper === null;
var isConfig = popper && Object.prototype.toString.call(popper) === '[object Object]';
if (isNotDefined || isConfig) {
this._popper = this.parse(isConfig ? popper : {});
}
// otherwise, use the given HTMLElement as popper
else {
this._popper = popper.jquery ? popper[0] : popper;
}
// with {} we create a new object with the options inside it
this._options = Object.assign({}, DEFAULTS, options);
// refactoring modifiers' list
this._options.modifiers = this._options.modifiers.map(function (modifier) {
// remove ignored modifiers
if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
// set the x-placement attribute before everything else because it could be used to add margins to the popper
// margins needs to be calculated to get the correct popper offsets
if (modifier === 'applyStyle') {
this._popper.setAttribute('x-placement', this._options.placement);
}
// return predefined modifier identified by string or keep the custom one
return this.modifiers[modifier] || modifier;
}.bind(this));
// make sure to apply the popper position before any computation
this.state.position = this._getPosition(this._popper, this._reference);
setStyle(this._popper, { position: this.state.position, top: 0 });
// fire the first update to position the popper in the right place
this.update();
// setup event listeners, they will take care of update the position in specific situations
this._setupEventListeners();
return this;
}
//
// Methods
//
/**
* Destroy the popper
* @method
* @memberof Popper
*/
Popper.prototype.destroy = function () {
this._popper.removeAttribute('x-placement');
this._popper.style.left = '';
this._popper.style.position = '';
this._popper.style.top = '';
this._popper.style[getSupportedPropertyName('transform')] = '';
this._removeEventListeners();
// remove the popper if user explicity asked for the deletion on destroy
if (this._options.removeOnDestroy) {
this._popper.remove();
}
return this;
};
/**
* Updates the position of the popper, computing the new offsets and applying the new style
* @method
* @memberof Popper
*/
Popper.prototype.update = function () {
var data = { instance: this, styles: {} };
// store placement inside the data object, modifiers will be able to edit `placement` if needed
// and refer to _originalPlacement to know the original value
data.placement = this._options.placement;
data._originalPlacement = this._options.placement;
// compute the popper and reference offsets and put them inside data.offsets
data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
// get boundaries
data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
data = this.runModifiers(data, this._options.modifiers);
if (typeof this.state.updateCallback === 'function') {
this.state.updateCallback(data);
}
};
/**
* If a function is passed, it will be executed after the initialization of popper with as first argument the Popper instance.
* @method
* @memberof Popper
* @param {Function} callback
*/
Popper.prototype.onCreate = function (callback) {
// the createCallbacks return as first argument the popper instance
callback(this);
return this;
};
/**
* If a function is passed, it will be executed after each update of popper with as first argument the set of coordinates and informations
* used to style popper and its arrow.
* NOTE: it doesn't get fired on the first call of the `Popper.update()` method inside the `Popper` constructor!
* @method
* @memberof Popper
* @param {Function} callback
*/
Popper.prototype.onUpdate = function (callback) {
this.state.updateCallback = callback;
return this;
};
/**
* Helper used to generate poppers from a configuration file
* @method
* @memberof Popper
* @param config {Object} configuration
* @returns {HTMLElement} popper
*/
Popper.prototype.parse = function (config) {
var defaultConfig = {
tagName: 'div',
classNames: ['popper'],
attributes: [],
parent: root.document.body,
content: '',
contentType: 'text',
arrowTagName: 'div',
arrowClassNames: ['popper__arrow'],
arrowAttributes: ['x-arrow']
};
config = Object.assign({}, defaultConfig, config);
var d = root.document;
var popper = d.createElement(config.tagName);
addClassNames(popper, config.classNames);
addAttributes(popper, config.attributes);
if (config.contentType === 'node') {
popper.appendChild(config.content.jquery ? config.content[0] : config.content);
} else if (config.contentType === 'html') {
popper.innerHTML = config.content;
} else {
popper.textContent = config.content;
}
if (config.arrowTagName) {
var arrow = d.createElement(config.arrowTagName);
addClassNames(arrow, config.arrowClassNames);
addAttributes(arrow, config.arrowAttributes);
popper.appendChild(arrow);
}
var parent = config.parent.jquery ? config.parent[0] : config.parent;
// if the given parent is a string, use it to match an element
// if more than one element is matched, the first one will be used as parent
// if no elements are matched, the script will throw an error
if (typeof parent === 'string') {
parent = d.querySelectorAll(config.parent);
if (parent.length > 1) {
console.warn('WARNING: the given `parent` query(' + config.parent + ') matched more than one element, the first one will be used');
}
if (parent.length === 0) {
throw 'ERROR: the given `parent` doesn\'t exists!';
}
parent = parent[0];
}
// if the given parent is a DOM nodes list or an array of nodes with more than one element,
// the first one will be used as parent
if (parent.length > 1 && parent instanceof Element === false) {
console.warn('WARNING: you have passed as parent a list of elements, the first one will be used');
parent = parent[0];
}
// append the generated popper to its parent
parent.appendChild(popper);
return popper;
/**
* Adds class names to the given element
* @function
* @ignore
* @param {HTMLElement} target
* @param {Array} classes
*/
function addClassNames(element, classNames) {
classNames.forEach(function (className) {
element.classList.add(className);
});
}
/**
* Adds attributes to the given element
* @function
* @ignore
* @param {HTMLElement} target
* @param {Array} attributes
* @example
* addAttributes(element, [ 'data-info:foobar' ]);
*/
function addAttributes(element, attributes) {
attributes.forEach(function (attribute) {
element.setAttribute(attribute.split(':')[0], attribute.split(':')[1] || '');
});
}
};
/**
* Helper used to get the position which will be applied to the popper
* @method
* @memberof Popper
* @param config {HTMLElement} popper element
* @param reference {HTMLElement} reference element
* @returns {String} position
*/
Popper.prototype._getPosition = function (popper, reference) {
var container = getOffsetParent(reference);
if (this._options.forceAbsolute) {
return 'absolute';
}
// Decide if the popper will be fixed
// If the reference element is inside a fixed context, the popper will be fixed as well to allow them to scroll together
var isParentFixed = isFixed(reference, container);
return isParentFixed ? 'fixed' : 'absolute';
};
/**
* Get offsets to the popper
* @method
* @memberof Popper
* @access private
* @param {Element} popper - the popper element
* @param {Element} reference - the reference element (the popper will be relative to this)
* @returns {Object} An object containing the offsets which will be applied to the popper
*/
Popper.prototype._getOffsets = function (popper, reference, placement) {
placement = placement.split('-')[0];
var popperOffsets = {};
popperOffsets.position = this.state.position;
var isParentFixed = popperOffsets.position === 'fixed';
//
// Get reference element position
//
var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
//
// Get popper sizes
//
var popperRect = getOuterSizes(popper);
//
// Compute offsets of popper
//
// depending by the popper placement we have to compute its offsets slightly differently
if (['right', 'left'].indexOf(placement) !== -1) {
popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - popperRect.height / 2;
if (placement === 'left') {
popperOffsets.left = referenceOffsets.left - popperRect.width;
} else {
popperOffsets.left = referenceOffsets.right;
}
} else {
popperOffsets.left = referenceOffsets.left + referenceOffsets.width / 2 - popperRect.width / 2;
if (placement === 'top') {
popperOffsets.top = referenceOffsets.top - popperRect.height;
} else {
popperOffsets.top = referenceOffsets.bottom;
}
}
// Add width and height to our offsets object
popperOffsets.width = popperRect.width;
popperOffsets.height = popperRect.height;
return {
popper: popperOffsets,
reference: referenceOffsets
};
};
/**
* Setup needed event listeners used to update the popper position
* @method
* @memberof Popper
* @access private
*/
Popper.prototype._setupEventListeners = function () {
// NOTE: 1 DOM access here
this.state.updateBound = this.update.bind(this);
root.addEventListener('resize', this.state.updateBound);
// if the boundariesElement is window we don't need to listen for the scroll event
if (this._options.boundariesElement !== 'window') {
var target = getScrollParent(this._reference);
// here it could be both `body` or `documentElement` thanks to Firefox, we then check both
if (target === root.document.body || target === root.document.documentElement) {
target = root;
}
target.addEventListener('scroll', this.state.updateBound);
}
};
/**
* Remove event listeners used to update the popper position
* @method
* @memberof Popper
* @access private
*/
Popper.prototype._removeEventListeners = function () {
// NOTE: 1 DOM access here
root.removeEventListener('resize', this.state.updateBound);
if (this._options.boundariesElement !== 'window') {
var target = getScrollParent(this._reference);
// here it could be both `body` or `documentElement` thanks to Firefox, we then check both
if (target === root.document.body || target === root.document.documentElement) {
target = root;
}
target.removeEventListener('scroll', this.state.updateBound);
}
this.state.updateBound = null;
};
/**
* Computed the boundaries limits and return them
* @method
* @memberof Popper
* @access private
* @param {Object} data - Object containing the property "offsets" generated by `_getOffsets`
* @param {Number} padding - Boundaries padding
* @param {Element} boundariesElement - Element used to define the boundaries
* @returns {Object} Coordinates of the boundaries
*/
Popper.prototype._getBoundaries = function (data, padding, boundariesElement) {
// NOTE: 1 DOM access here
var boundaries = {};
var width, height;
if (boundariesElement === 'window') {
var body = root.document.body,
html = root.document.documentElement;
height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
boundaries = {
top: 0,
right: width,
bottom: height,
left: 0
};
} else if (boundariesElement === 'viewport') {
var offsetParent = getOffsetParent(this._popper);
var scrollParent = getScrollParent(this._popper);
var offsetParentRect = getOffsetRect(offsetParent);
// Thanks the fucking native API, `document.body.scrollTop` & `document.documentElement.scrollTop`
var getScrollTopValue = function getScrollTopValue(element) {
return element == document.body ? Math.max(document.documentElement.scrollTop, document.body.scrollTop) : element.scrollTop;
};
var getScrollLeftValue = function getScrollLeftValue(element) {
return element == document.body ? Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) : element.scrollLeft;
};
// if the popper is fixed we don't have to substract scrolling from the boundaries
var scrollTop = data.offsets.popper.position === 'fixed' ? 0 : getScrollTopValue(scrollParent);
var scrollLeft = data.offsets.popper.position === 'fixed' ? 0 : getScrollLeftValue(scrollParent);
boundaries = {
top: 0 - (offsetParentRect.top - scrollTop),
right: root.document.documentElement.clientWidth - (offsetParentRect.left - scrollLeft),
bottom: root.document.documentElement.clientHeight - (offsetParentRect.top - scrollTop),
left: 0 - (offsetParentRect.left - scrollLeft)
};
} else {
if (getOffsetParent(this._popper) === boundariesElement) {
boundaries = {
top: 0,
left: 0,
right: boundariesElement.clientWidth,
bottom: boundariesElement.clientHeight
};
} else {
boundaries = getOffsetRect(boundariesElement);
}
}
boundaries.left += padding;
boundaries.right -= padding;
boundaries.top = boundaries.top + padding;
boundaries.bottom = boundaries.bottom - padding;
return boundaries;
};
/**
* Loop trough the list of modifiers and run them in order, each of them will then edit the data object
* @method
* @memberof Popper
* @access public
* @param {Object} data
* @param {Array} modifiers
* @param {Function} ends
*/
Popper.prototype.runModifiers = function (data, modifiers, ends) {
var modifiersToRun = modifiers.slice();
if (ends !== undefined) {
modifiersToRun = this._options.modifiers.slice(0, getArrayKeyIndex(this._options.modifiers, ends));
}
modifiersToRun.forEach(function (modifier) {
if (isFunction(modifier)) {
data = modifier.call(this, data);
}
}.bind(this));
return data;
};
/**
* Helper used to know if the given modifier depends from another one.
* @method
* @memberof Popper
* @param {String} requesting - name of requesting modifier
* @param {String} requested - name of requested modifier
* @returns {Boolean}
*/
Popper.prototype.isModifierRequired = function (requesting, requested) {
var index = getArrayKeyIndex(this._options.modifiers, requesting);
return !!this._options.modifiers.slice(0, index).filter(function (modifier) {
return modifier === requested;
}).length;
};
//
// Modifiers
//
/**
* Modifiers list
* @namespace Popper.modifiers
* @memberof Popper
* @type {Object}
*/
Popper.prototype.modifiers = {};
/**
* Apply the computed styles to the popper element
* @method
* @memberof Popper.modifiers
* @argument {Object} data - The data object generated by `update` method
* @returns {Object} The same data object
*/
Popper.prototype.modifiers.applyStyle = function (data) {
// apply the final offsets to the popper
// NOTE: 1 DOM access here
var styles = {
position: data.offsets.popper.position
};
// round top and left to avoid blurry text
var left = Math.round(data.offsets.popper.left);
var top = Math.round(data.offsets.popper.top);
// if gpuAcceleration is set to true and transform is supported, we use `translate3d` to apply the position to the popper
// we automatically use the supported prefixed version if needed
var prefixedProperty;
if (this._options.gpuAcceleration && (prefixedProperty = getSupportedPropertyName('transform'))) {
styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
styles.top = 0;
styles.left = 0;
}
// othwerise, we use the standard `left` and `top` properties
else {
styles.left = left;
styles.top = top;
}
// any property present in `data.styles` will be applied to the popper,
// in this way we can make the 3rd party modifiers add custom styles to it
// Be aware, modifiers could override the properties defined in the previous
// lines of this modifier!
Object.assign(styles, data.styles);
setStyle(this._popper, styles);
// set an attribute which will be useful to style the tooltip (use it to properly position its arrow)
// NOTE: 1 DOM access here
this._popper.setAttribute('x-placement', data.placement);
// if the arrow modifier is required and the arrow style has been computed, apply the arrow style
if (this.isModifierRequired(this.modifiers.applyStyle, this.modifiers.arrow) && data.offsets.arrow) {
setStyle(data.arrowElement, data.offsets.arrow);
}
return data;
};
/**
* Modifier used to shift the popper on the start or end of its reference element side
* @method
* @memberof Popper.modifiers
* @argument {Object} data - The data object generated by `update` method
* @returns {Object} The data object, properly modified
*/
Popper.prototype.modifiers.shift = function (data) {
var placement = data.placement;
var basePlacement = placement.split('-')[0];
var shiftVariation = placement.split('-')[1];
// if shift shiftVariation is specified, run the modifier
if (shiftVariation) {
var reference = data.offsets.reference;
var popper = getPopperClientRect(data.offsets.popper);
var shiftOffsets = {
y: {
start: { top: reference.top },
end: { top: reference.top + reference.height - popper.height }
},
x: {
start: { left: reference.left },
end: { left: reference.left + reference.width - popper.width }
}
};
var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
}
return data;
};
/**
* Modifier used to make sure the popper does not overflows from it's boundaries
* @method
* @memberof Popper.modifiers
* @argument {Object} data - The data object generated by `update` method
* @returns {Object} The data object, properly modified
*/
Popper.prototype.modifiers.preventOverflow = function (data) {
var order = this._options.preventOverflowOrder;
var popper = getPopperClientRect(data.offsets.popper);
var check = {
left: function left() {
var left = popper.left;
if (popper.left < data.boundaries.left) {
left = Math.max(popper.left, data.boundaries.left);
}
return { left: left };
},
right: function right() {
var left = popper.left;
if (popper.right > data.boundaries.right) {
left = Math.min(popper.left, data.boundaries.right - popper.width);
}
return { left: left };
},
top: function top() {
var top = popper.top;
if (popper.top < data.boundaries.top) {
top = Math.max(popper.top, data.boundaries.top);
}
return { top: top };
},
bottom: function bottom() {
var top = popper.top;
if (popper.bottom > data.boundaries.bottom) {
top = Math.min(popper.top, data.boundaries.bottom - popper.height);
}
return { top: top };
}
};
order.forEach(function (direction) {
data.offsets.popper = Object.assign(popper, check[direction]());
});
return data;
};
/**
* Modifier used to make sure the popper is always near its reference
* @method
* @memberof Popper.modifiers
* @argument {Object} data - The data object generated by _update method
* @returns {Object} The data object, properly modified
*/
Popper.prototype.modifiers.keepTogether = function (data) {
var popper = getPopperClientRect(data.offsets.popper);
var reference = data.offsets.reference;
var f = Math.floor;
if (popper.right < f(reference.left)) {
data.offsets.popper.left = f(reference.left) - popper.width;
}
if (popper.left > f(reference.right)) {
data.offsets.popper.left = f(reference.right);
}
if (popper.bottom < f(reference.top)) {
data.offsets.popper.top = f(reference.top) - popper.height;
}
if (popper.top > f(reference.bottom)) {
data.offsets.popper.top = f(reference.bottom);
}
return data;
};
/**
* Modifier used to flip the placement of the popper when the latter is starting overlapping its reference element.
* Requires the `preventOverflow` modifier before it in order to work.
* **NOTE:** This modifier will run all its previous modifiers everytime it tries to flip the popper!
* @method
* @memberof Popper.modifiers
* @argument {Object} data - The data object generated by _update method
* @returns {Object} The data object, properly modified
*/
Popper.prototype.modifiers.flip = function (data) {
// check if preventOverflow is in the list of modifiers before the flip modifier.
// otherwise flip would not work as expected.
if (!this.isModifierRequired(this.modifiers.flip, this.modifiers.preventOverflow)) {
console.warn('WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!');
return data;
}
if (data.flipped && data.placement === data._originalPlacement) {
// seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
return data;
}
var placement = data.placement.split('-')[0];
var placementOpposite = getOppositePlacement(placement);
var variation = data.placement.split('-')[1] || '';
var flipOrder = [];
if (this._options.flipBehavior === 'flip') {
flipOrder = [placement, placementOpposite];
} else {
flipOrder = this._options.flipBehavior;
}
flipOrder.forEach(function (step, index) {
if (placement !== step || flipOrder.length === index + 1) {
return;
}
placement = data.placement.split('-')[0];
placementOpposite = getOppositePlacement(placement);
var popperOffsets = getPopperClientRect(data.offsets.popper);
// this boolean is used to distinguish right and bottom from top and left
// they need different computations to get flipped
var a = ['right', 'bottom'].indexOf(placement) !== -1;
// using Math.floor because the reference offsets may contain decimals we are not going to consider here
if (a && Math.floor(data.offsets.reference[placement]) > Math.floor(popperOffsets[placementOpposite]) || !a && Math.floor(data.offsets.reference[placement]) < Math.floor(popperOffsets[placementOpposite])) {
// we'll use this boolean to detect any flip loop
data.flipped = true;
data.placement = flipOrder[index + 1];
if (variation) {
data.placement += '-' + variation;
}
data.offsets.popper = this._getOffsets(this._popper, this._reference, data.placement).popper;
data = this.runModifiers(data, this._options.modifiers, this._flip);
}
}.bind(this));
return data;
};
/**
* Modifier used to add an offset to the popper, useful if you more granularity positioning your popper.
* The offsets will shift the popper on the side of its reference element.
* @method
* @memberof Popper.modifiers
* @argument {Object} data - The data object generated by _update method
* @returns {Object} The data object, properly modified
*/
Popper.prototype.modifiers.offset = function (data) {
var offset = this._options.offset;
var popper = data.offsets.popper;
if (data.placement.indexOf('left') !== -1) {
popper.top -= offset;
} else if (data.placement.indexOf('right') !== -1) {
popper.top += offset;
} else if (data.placement.indexOf('top') !== -1) {
popper.left -= offset;
} else if (data.placement.indexOf('bottom') !== -1) {
popper.left += offset;
}
return data;
};
/**
* Modifier used to move the arrows on the edge of the popper to make sure them are always between the popper and the reference element
* It will use the CSS outer size of the arrow element to know how many pixels of conjuction are needed
* @method
* @memberof Popper.modifiers
* @argument {Object} data - The data object generated by _update method
* @returns {Object} The data object, properly modified
*/
Popper.prototype.modifiers.arrow = function (data) {
var arrow = this._options.arrowElement;
// if the arrowElement is a string, suppose it's a CSS selector
if (typeof arrow === 'string') {
arrow = this._popper.querySelector(arrow);
}
// if arrow element is not found, don't run the modifier
if (!arrow) {
return data;
}
// the arrow element must be child of its popper
if (!this._popper.contains(arrow)) {
console.warn('WARNING: `arrowElement` must be child of its popper element!');
return data;
}
// arrow depends on keepTogether in order to work
if (!this.isModifierRequired(this.modifiers.arrow, this.modifiers.keepTogether)) {
console.warn('WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!');
return data;
}
var arrowStyle = {};
var placement = data.placement.split('-')[0];
var popper = getPopperClientRect(data.offsets.popper);
var reference = data.offsets.reference;
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
var len = isVertical ? 'height' : 'width';
var side = isVertical ? 'top' : 'left';
var altSide = isVertical ? 'left' : 'top';
var opSide = isVertical ? 'bottom' : 'right';
var arrowSize = getOuterSizes(arrow)[len];
//
// extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
//
// top/left side
if (reference[opSide] - arrowSize < popper[side]) {
data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowSize);
}
// bottom/right side
if (reference[side] + arrowSize > popper[opSide]) {
data.offsets.popper[side] += reference[side] + arrowSize - popper[opSide];
}
// compute center of the popper
var center = reference[side] + reference[len] / 2 - arrowSize / 2;
var sideValue = center - popper[side];
// prevent arrow from being placed not contiguously to its popper
sideValue = Math.max(Math.min(popper[len] - arrowSize - 3, sideValue), 3);
arrowStyle[side] = sideValue;
arrowStyle[altSide] = ''; // make sure to remove any old style from the arrow
data.offsets.arrow = arrowStyle;
data.arrowElement = arrow;
return data;
};
//
// Helpers
//
/**
* Get the outer sizes of the given element (offset size + margins)
* @function
* @ignore
* @argument {Element} element
* @returns {Object} object containing width and height properties
*/
function getOuterSizes(element) {
// NOTE: 1 DOM access here
var _display = element.style.display,
_visibility = element.style.visibility;
element.style.display = 'block';element.style.visibility = 'hidden';
var calcWidthToForceRepaint = element.offsetWidth;
// original method
var styles = root.getComputedStyle(element);
var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight);
var result = { width: element.offsetWidth + y, height: element.offsetHeight + x };
// reset element styles
element.style.display = _display;element.style.visibility = _visibility;
return result;
}
/**
* Get the opposite placement of the given one/
* @function
* @ignore
* @argument {String} placement
* @returns {String} flipped placement
*/
function getOppositePlacement(placement) {
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
return placement.replace(/left|right|bottom|top/g, function (matched) {
return hash[matched];
});
}
/**
* Given the popper offsets, generate an output similar to getBoundingClientRect
* @function
* @ignore
* @argument {Object} popperOffsets
* @returns {Object} ClientRect like output
*/
function getPopperClientRect(popperOffsets) {
var offsets = Object.assign({}, popperOffsets);
offsets.right = offsets.left + offsets.width;
offsets.bottom = offsets.top + offsets.height;
return offsets;
}
/**
* Given an array and the key to find, returns its index
* @function
* @ignore
* @argument {Array} arr
* @argument keyToFind
* @returns index or null
*/
function getArrayKeyIndex(arr, keyToFind) {
var i = 0,
key;
for (key in arr) {
if (arr[key] === keyToFind) {
return i;
}
i++;
}
return null;
}
/**
* Get CSS computed property of the given element
* @function
* @ignore
* @argument {Eement} element
* @argument {String} property
*/
function getStyleComputedProperty(element, property) {
// NOTE: 1 DOM access here
var css = root.getComputedStyle(element, null);
return css[property];
}
/**
* Returns the offset parent of the given element
* @function
* @ignore
* @argument {Element} element
* @returns {Element} offset parent
*/
function getOffsetParent(element) {
// NOTE: 1 DOM access here
var offsetParent = element.offsetParent;
return offsetParent === root.document.body || !offsetParent ? root.document.documentElement : offsetParent;
}
/**
* Returns the scrolling parent of the given element
* @function
* @ignore
* @argument {Element} element
* @returns {Element} offset parent
*/
function getScrollParent(element) {
var parent = element.parentNode;
if (!parent) {
return element;
}
if (parent === root.document) {
// Firefox puts the scrollTOp value on `documentElement` instead of `body`, we then check which of them is
// greater than 0 and return the proper element
if (root.document.body.scrollTop) {
return root.document.body;
} else {
return root.document.documentElement;
}
}
// Firefox want us to check `-x` and `-y` variations as well
if (['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-x')) !== -1 || ['scroll', 'auto'].indexOf(getStyleComputedProperty(parent, 'overflow-y')) !== -1) {
// If the detected scrollParent is body, we perform an additional check on its parentNode
// in this way we'll get body if the browser is Chrome-ish, or documentElement otherwise
// fixes issue #65
return parent;
}
return getScrollParent(element.parentNode);
}
/**
* Check if the given element is fixed or is inside a fixed parent
* @function
* @ignore
* @argument {Element} element
* @argument {Element} customContainer
* @returns {Boolean} answer to "isFixed?"
*/
function isFixed(element) {
if (element === root.document.body) {
return false;
}
if (getStyleComputedProperty(element, 'position') === 'fixed') {
return true;
}
return element.parentNode ? isFixed(element.parentNode) : element;
}
/**
* Set the style to the given popper
* @function
* @ignore
* @argument {Element} element - Element to apply the style to
* @argument {Object} styles - Object with a list of properties and values which will be applied to the element
*/
function setStyle(element, styles) {
function is_numeric(n) {
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
}
Object.keys(styles).forEach(function (prop) {
var unit = '';
// add unit if the value is numeric and is one of the following
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && is_numeric(styles[prop])) {
unit = 'px';
}
element.style[prop] = styles[prop] + unit;
});
}
/**
* Check if the given variable is a function
* @function
* @ignore
* @argument {*} functionToCheck - variable to check
* @returns {Boolean} answer to: is a function?
*/
function isFunction(functionToCheck) {
var getType = {};
return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
}
/**
* Get the position of the given element, relative to its offset parent
* @function
* @ignore
* @param {Element} element
* @return {Object} position - Coordinates of the element and its `scrollTop`
*/
function getOffsetRect(element) {
var elementRect = {
width: element.offsetWidth,
height: element.offsetHeight,
left: element.offsetLeft,
top: element.offsetTop
};
elementRect.right = elementRect.left + elementRect.width;
elementRect.bottom = elementRect.top + elementRect.height;
// position
return elementRect;
}
/**
* Get bounding client rect of given element
* @function
* @ignore
* @param {HTMLElement} element
* @return {Object} client rect
*/
function getBoundingClientRect(element) {
var rect = element.getBoundingClientRect();
// whether the IE version is lower than 11
var isIE = navigator.userAgent.indexOf("MSIE") != -1;
// fix ie document bounding top always 0 bug
var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
return {
left: rect.left,
top: rectTop,
right: rect.right,
bottom: rect.bottom,
width: rect.right - rect.left,
height: rect.bottom - rectTop
};
}
/**
* Given an element and one of its parents, return the offset
* @function
* @ignore
* @param {HTMLElement} element
* @param {HTMLElement} parent
* @return {Object} rect
*/
function getOffsetRectRelativeToCustomParent(element, parent, fixed) {
var elementRect = getBoundingClientRect(element);
var parentRect = getBoundingClientRect(parent);
if (fixed) {
var scrollParent = getScrollParent(parent);
parentRect.top += scrollParent.scrollTop;
parentRect.bottom += scrollParent.scrollTop;
parentRect.left += scrollParent.scrollLeft;
parentRect.right += scrollParent.scrollLeft;
}
var rect = {
top: elementRect.top - parentRect.top,
left: elementRect.left - parentRect.left,
bottom: elementRect.top - parentRect.top + elementRect.height,
right: elementRect.left - parentRect.left + elementRect.width,
width: elementRect.width,
height: elementRect.height
};
return rect;
}
/**
* Get the prefixed supported property name
* @function
* @ignore
* @argument {String} property (camelCase)
* @returns {String} prefixed property (camelCase)
*/
function getSupportedPropertyName(property) {
var prefixes = ['', 'ms', 'webkit', 'moz', 'o'];
for (var i = 0; i < prefixes.length; i++) {
var toCheck = prefixes[i] ? prefixes[i] + property.charAt(0).toUpperCase() + property.slice(1) : property;
if (typeof root.document.body.style[toCheck] !== 'undefined') {
return toCheck;
}
}
return null;
}
/**
* The Object.assign() method is used to copy the values of all enumerable own properties from one or more source
* objects to a target object. It will return the target object.
* This polyfill doesn't support symbol properties, since ES5 doesn't have symbols anyway
* Source: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
* @function
* @ignore
*/
if (!Object.assign) {
Object.defineProperty(Object, 'assign', {
enumerable: false,
configurable: true,
writable: true,
value: function value(target) {
if (target === undefined || target === null) {
throw new TypeError('Cannot convert first argument to object');
}
var to = Object(target);
for (var i = 1; i < arguments.length; i++) {
var nextSource = arguments[i];
if (nextSource === undefined || nextSource === null) {
continue;
}
nextSource = Object(nextSource);
var keysArray = Object.keys(nextSource);
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) {
to[nextKey] = nextSource[nextKey];
}
}
}
return to;
}
});
}
return Popper;
});
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = {
el: {
colorpicker: {
confirm: '确定',
clear: '清空'
},
datepicker: {
now: '此刻',
today: '今天',
cancel: '取消',
clear: '清空',
confirm: '确定',
selectDate: '选择日期',
selectTime: '选择时间',
startDate: '开始日期',
startTime: '开始时间',
endDate: '结束日期',
endTime: '结束时间',
year: '年',
month1: '1 月',
month2: '2 月',
month3: '3 月',
month4: '4 月',
month5: '5 月',
month6: '6 月',
month7: '7 月',
month8: '8 月',
month9: '9 月',
month10: '10 月',
month11: '11 月',
month12: '12 月',
// week: '周次',
weeks: {
sun: '日',
mon: '一',
tue: '二',
wed: '三',
thu: '四',
fri: '五',
sat: '六'
},
months: {
jan: '一月',
feb: '二月',
mar: '三月',
apr: '四月',
may: '五月',
jun: '六月',
jul: '七月',
aug: '八月',
sep: '九月',
oct: '十月',
nov: '十一月',
dec: '十二月'
}
},
select: {
loading: '加载中',
noMatch: '无匹配数据',
noData: '无数据',
placeholder: '请选择'
},
cascader: {
noMatch: '无匹配数据',
loading: '加载中',
placeholder: '请选择'
},
pagination: {
goto: '前往',
pagesize: '条/页',
total: '共 {total} 条',
pageClassifier: '页'
},
messagebox: {
title: '提示',
confirm: '确定',
cancel: '取消',
error: '输入的数据不合法!'
},
upload: {
delete: '删除',
preview: '查看图片',
continue: '继续上传'
},
table: {
emptyText: '暂无数据',
confirmFilter: '筛选',
resetFilter: '重置',
clearFilter: '全部',
sumText: '合计'
},
tree: {
emptyText: '暂无数据'
},
transfer: {
noMatch: '无匹配数据',
noData: '无数据',
titles: ['列表 1', '列表 2'],
filterPlaceholder: '请输入搜索内容',
noCheckedFormat: '共 {total} 项',
hasCheckedFormat: '已选 {checked}/{total} 项'
}
}
};
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var index$2 = function isMergeableObject(value) {
return isNonNullObject(value) && isNotSpecial(value)
};
function isNonNullObject(value) {
return !!value && typeof value === 'object'
}
function isNotSpecial(value) {
var stringValue = Object.prototype.toString.call(value);
return stringValue !== '[object RegExp]'
&& stringValue !== '[object Date]'
}
function emptyTarget(val) {
return Array.isArray(val) ? [] : {}
}
function cloneIfNecessary(value, optionsArgument) {
var clone = optionsArgument && optionsArgument.clone === true;
return (clone && index$2(value)) ? deepmerge(emptyTarget(value), value, optionsArgument) : value
}
function defaultArrayMerge(target, source, optionsArgument) {
var destination = target.slice();
source.forEach(function(e, i) {
if (typeof destination[i] === 'undefined') {
destination[i] = cloneIfNecessary(e, optionsArgument);
} else if (index$2(e)) {
destination[i] = deepmerge(target[i], e, optionsArgument);
} else if (target.indexOf(e) === -1) {
destination.push(cloneIfNecessary(e, optionsArgument));
}
});
return destination
}
function mergeObject(target, source, optionsArgument) {
var destination = {};
if (index$2(target)) {
Object.keys(target).forEach(function(key) {
destination[key] = cloneIfNecessary(target[key], optionsArgument);
});
}
Object.keys(source).forEach(function(key) {
if (!index$2(source[key]) || !target[key]) {
destination[key] = cloneIfNecessary(source[key], optionsArgument);
} else {
destination[key] = deepmerge(target[key], source[key], optionsArgument);
}
});
return destination
}
function deepmerge(target, source, optionsArgument) {
var sourceIsArray = Array.isArray(source);
var targetIsArray = Array.isArray(target);
var options = optionsArgument || { arrayMerge: defaultArrayMerge };
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
if (!sourceAndTargetTypesMatch) {
return cloneIfNecessary(source, optionsArgument)
} else if (sourceIsArray) {
var arrayMerge = options.arrayMerge || defaultArrayMerge;
return arrayMerge(target, source, optionsArgument)
} else {
return mergeObject(target, source, optionsArgument)
}
}
deepmerge.all = function deepmergeAll(array, optionsArgument) {
if (!Array.isArray(array) || array.length < 2) {
throw new Error('first argument should be an array with at least two elements')
}
// we are sure there are at least 2 values, so it is safe to have no initial value
return array.reduce(function(prev, next) {
return deepmerge(prev, next, optionsArgument)
})
};
var index = deepmerge;
module.exports = index;
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = function (Vue) {
/**
* template
*
* @param {String} string
* @param {Array} ...args
* @return {String}
*/
function template(string) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (args.length === 1 && _typeof(args[0]) === 'object') {
args = args[0];
}
if (!args || !args.hasOwnProperty) {
args = {};
}
return string.replace(RE_NARGS, function (match, prefix, i, index) {
var result = void 0;
if (string[index - 1] === '{' && string[index + match.length] === '}') {
return i;
} else {
result = (0, _util.hasOwn)(args, i) ? args[i] : null;
if (result === null || result === undefined) {
return '';
}
return result;
}
});
}
return template;
};
var _util = __webpack_require__(6);
var RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
/**
* String format template
* - Inspired:
* https://github.com/Matt-Esch/string-template/index.js
*/
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(216);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 14:
/***/ function(module, exports) {
module.exports = __webpack_require__(5);
/***/ },
/***/ 216:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _option = __webpack_require__(217);
var _option2 = _interopRequireDefault(_option);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_option2.default.install = function (Vue) {
Vue.component(_option2.default.name, _option2.default);
};
exports.default = _option2.default;
/***/ },
/***/ 217:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(218),
/* template */
__webpack_require__(220),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 218:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var _emitter = __webpack_require__(14);
var _emitter2 = _interopRequireDefault(_emitter);
var _util = __webpack_require__(219);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_emitter2.default],
name: 'ElOption',
componentName: 'ElOption',
props: {
value: {
required: true
},
label: [String, Number],
created: Boolean,
disabled: {
type: Boolean,
default: false
}
},
data: function data() {
return {
index: -1,
groupDisabled: false,
visible: true,
hitState: false
};
},
computed: {
isObject: function isObject() {
var type = _typeof(this.value);
return type !== 'string' && type !== 'number' && type !== 'boolean';
},
currentLabel: function currentLabel() {
return this.label || (this.isObject ? '' : this.value);
},
currentValue: function currentValue() {
return this.value || this.label || '';
},
parent: function parent() {
var result = this.$parent;
while (!result.isSelect) {
result = result.$parent;
}
return result;
},
itemSelected: function itemSelected() {
if (!this.parent.multiple) {
return this.isEqual(this.value, this.parent.value);
} else {
return this.contains(this.parent.value, this.value);
}
},
limitReached: function limitReached() {
if (this.parent.multiple) {
return !this.itemSelected && this.parent.value.length >= this.parent.multipleLimit && this.parent.multipleLimit > 0;
} else {
return false;
}
}
},
watch: {
currentLabel: function currentLabel() {
if (!this.created && !this.parent.remote) this.dispatch('ElSelect', 'setSelected');
},
value: function value() {
if (!this.created && !this.parent.remote) this.dispatch('ElSelect', 'setSelected');
}
},
methods: {
isEqual: function isEqual(a, b) {
if (!this.isObject) {
return a === b;
} else {
var valueKey = this.parent.valueKey;
return (0, _util.getValueByPath)(a, valueKey) === (0, _util.getValueByPath)(b, valueKey);
}
},
contains: function contains() {
var _this = this;
var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var target = arguments[1];
if (!this.isObject) {
return arr.indexOf(target) > -1;
} else {
var _ret = function () {
var valueKey = _this.parent.valueKey;
return {
v: arr.some(function (item) {
return (0, _util.getValueByPath)(item, valueKey) === (0, _util.getValueByPath)(target, valueKey);
})
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
},
handleGroupDisabled: function handleGroupDisabled(val) {
this.groupDisabled = val;
},
hoverItem: function hoverItem() {
if (!this.disabled && !this.groupDisabled) {
this.parent.hoverIndex = this.parent.options.indexOf(this);
}
},
selectOptionClick: function selectOptionClick() {
if (this.disabled !== true && this.groupDisabled !== true) {
this.dispatch('ElSelect', 'handleOptionClick', this);
}
},
queryChange: function queryChange(query) {
// query 里如果有正则中的特殊字符,需要先将这些字符转义
var parsedQuery = String(query).replace(/(\^|\(|\)|\[|\]|\$|\*|\+|\.|\?|\\|\{|\}|\|)/g, '\\$1');
this.visible = new RegExp(parsedQuery, 'i').test(this.currentLabel) || this.created;
if (!this.visible) {
this.parent.filteredOptionsCount--;
}
},
resetIndex: function resetIndex() {
var _this2 = this;
this.$nextTick(function () {
_this2.index = _this2.parent.options.indexOf(_this2);
});
}
},
created: function created() {
this.parent.options.push(this);
this.parent.cachedOptions.push(this);
this.parent.optionsCount++;
this.parent.filteredOptionsCount++;
this.index = this.parent.options.indexOf(this);
this.$on('queryChange', this.queryChange);
this.$on('handleGroupDisabled', this.handleGroupDisabled);
this.$on('resetIndex', this.resetIndex);
},
beforeDestroy: function beforeDestroy() {
this.dispatch('ElSelect', 'onOptionDestroy', this);
}
};
/***/ },
/***/ 219:
/***/ function(module, exports) {
module.exports = __webpack_require__(6);
/***/ },
/***/ 220:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('li', {
directives: [{
name: "show",
rawName: "v-show",
value: (_vm.visible),
expression: "visible"
}],
staticClass: "el-select-dropdown__item",
class: {
'selected': _vm.itemSelected,
'is-disabled': _vm.disabled || _vm.groupDisabled || _vm.limitReached,
'hover': _vm.parent.hoverIndex === _vm.index
},
on: {
"mouseenter": _vm.hoverItem,
"click": function($event) {
$event.stopPropagation();
_vm.selectOptionClick($event)
}
}
}, [_vm._t("default", [_c('span', [_vm._v(_vm._s(_vm.currentLabel))])])], 2)
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 38 */
/***/ (function(module, exports) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(30);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 30:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _button = __webpack_require__(31);
var _button2 = _interopRequireDefault(_button);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_button2.default.install = function (Vue) {
Vue.component(_button2.default.name, _button2.default);
};
exports.default = _button2.default;
/***/ },
/***/ 31:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(32),
/* template */
__webpack_require__(33),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 32:
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElButton',
props: {
type: {
type: String,
default: 'default'
},
size: String,
icon: {
type: String,
default: ''
},
nativeType: {
type: String,
default: 'button'
},
loading: Boolean,
disabled: Boolean,
plain: Boolean,
autofocus: Boolean
},
methods: {
handleClick: function handleClick(evt) {
this.$emit('click', evt);
}
}
};
/***/ },
/***/ 33:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('button', {
staticClass: "el-button",
class: [
_vm.type ? 'el-button--' + _vm.type : '',
_vm.size ? 'el-button--' + _vm.size : '', {
'is-disabled': _vm.disabled,
'is-loading': _vm.loading,
'is-plain': _vm.plain
}
],
attrs: {
"disabled": _vm.disabled,
"autofocus": _vm.autofocus,
"type": _vm.nativeType
},
on: {
"click": _vm.handleClick
}
}, [(_vm.loading) ? _c('i', {
staticClass: "el-icon-loading"
}) : _vm._e(), (_vm.icon && !_vm.loading) ? _c('i', {
class: 'el-icon-' + _vm.icon
}) : _vm._e(), (_vm.$slots.default) ? _c('span', [_vm._t("default")], 2) : _vm._e()])
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 39 */
/***/ (function(module, exports) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(34);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 34:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _buttonGroup = __webpack_require__(35);
var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_buttonGroup2.default.install = function (Vue) {
Vue.component(_buttonGroup2.default.name, _buttonGroup2.default);
};
exports.default = _buttonGroup2.default;
/***/ },
/***/ 35:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(36),
/* template */
__webpack_require__(37),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 36:
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
/**
* button
* @module components/basic/menu
* @desc 用于按钮组
* @param {string} label - 名称
*/
exports.default = {
name: 'ElButtonGroup'
};
/***/ },
/***/ 37:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-button-group"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _dom = __webpack_require__(4);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Transition = function () {
function Transition() {
_classCallCheck(this, Transition);
}
Transition.prototype.beforeEnter = function beforeEnter(el) {
(0, _dom.addClass)(el, 'collapse-transition');
if (!el.dataset) el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.style.height = '0';
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
};
Transition.prototype.enter = function enter(el) {
el.dataset.oldOverflow = el.style.overflow;
if (el.scrollHeight !== 0) {
el.style.height = el.scrollHeight + 'px';
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
} else {
el.style.height = '';
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
}
el.style.overflow = 'hidden';
};
Transition.prototype.afterEnter = function afterEnter(el) {
// for safari: remove class then reset height is necessary
(0, _dom.removeClass)(el, 'collapse-transition');
el.style.height = '';
el.style.overflow = el.dataset.oldOverflow;
};
Transition.prototype.beforeLeave = function beforeLeave(el) {
if (!el.dataset) el.dataset = {};
el.dataset.oldPaddingTop = el.style.paddingTop;
el.dataset.oldPaddingBottom = el.style.paddingBottom;
el.dataset.oldOverflow = el.style.overflow;
el.style.height = el.scrollHeight + 'px';
el.style.overflow = 'hidden';
};
Transition.prototype.leave = function leave(el) {
if (el.scrollHeight !== 0) {
// for safari: add class after set height, or it will jump to zero height suddenly, weired
(0, _dom.addClass)(el, 'collapse-transition');
el.style.height = 0;
el.style.paddingTop = 0;
el.style.paddingBottom = 0;
}
};
Transition.prototype.afterLeave = function afterLeave(el) {
(0, _dom.removeClass)(el, 'collapse-transition');
el.style.height = '';
el.style.overflow = el.dataset.oldOverflow;
el.style.paddingTop = el.dataset.oldPaddingTop;
el.style.paddingBottom = el.dataset.oldPaddingBottom;
};
return Transition;
}();
exports.default = {
name: 'ElCollapseTransition',
functional: true,
render: function render(h, _ref) {
var children = _ref.children;
var data = {
on: new Transition()
};
return h('transition', data, children);
}
};
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(65);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 14:
/***/ function(module, exports) {
module.exports = __webpack_require__(5);
/***/ },
/***/ 65:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkbox = __webpack_require__(66);
var _checkbox2 = _interopRequireDefault(_checkbox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_checkbox2.default.install = function (Vue) {
Vue.component(_checkbox2.default.name, _checkbox2.default);
};
exports.default = _checkbox2.default;
/***/ },
/***/ 66:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(67),
/* template */
__webpack_require__(68),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 67:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(14);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElCheckbox',
mixins: [_emitter2.default],
componentName: 'ElCheckbox',
data: function data() {
return {
selfModel: false,
focus: false
};
},
computed: {
model: {
get: function get() {
return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
},
set: function set(val) {
if (this.isGroup) {
var isLimitExceeded = false;
this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (isLimitExceeded = true);
this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (isLimitExceeded = true);
isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
} else {
this.$emit('input', val);
this.selfModel = val;
}
}
},
isChecked: function isChecked() {
if ({}.toString.call(this.model) === '[object Boolean]') {
return this.model;
} else if (Array.isArray(this.model)) {
return this.model.indexOf(this.label) > -1;
} else if (this.model !== null && this.model !== undefined) {
return this.model === this.trueLabel;
}
},
isGroup: function isGroup() {
var parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== 'ElCheckboxGroup') {
parent = parent.$parent;
} else {
this._checkboxGroup = parent;
return true;
}
}
return false;
},
store: function store() {
return this._checkboxGroup ? this._checkboxGroup.value : this.value;
}
},
props: {
value: {},
label: {},
indeterminate: Boolean,
disabled: Boolean,
checked: Boolean,
name: String,
trueLabel: [String, Number],
falseLabel: [String, Number]
},
methods: {
addToStore: function addToStore() {
if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
this.model.push(this.label);
} else {
this.model = this.trueLabel || true;
}
},
handleChange: function handleChange(ev) {
var _this = this;
this.$emit('change', ev);
if (this.isGroup) {
this.$nextTick(function (_) {
_this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
});
}
}
},
created: function created() {
this.checked && this.addToStore();
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/***/ 68:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('label', {
staticClass: "el-checkbox"
}, [_c('span', {
staticClass: "el-checkbox__input",
class: {
'is-disabled': _vm.disabled,
'is-checked': _vm.isChecked,
'is-indeterminate': _vm.indeterminate,
'is-focus': _vm.focus
}
}, [_c('span', {
staticClass: "el-checkbox__inner"
}), (_vm.trueLabel || _vm.falseLabel) ? _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.model),
expression: "model"
}],
staticClass: "el-checkbox__original",
attrs: {
"type": "checkbox",
"name": _vm.name,
"disabled": _vm.disabled,
"true-value": _vm.trueLabel,
"false-value": _vm.falseLabel
},
domProps: {
"checked": Array.isArray(_vm.model) ? _vm._i(_vm.model, null) > -1 : _vm._q(_vm.model, _vm.trueLabel)
},
on: {
"change": _vm.handleChange,
"focus": function($event) {
_vm.focus = true
},
"blur": function($event) {
_vm.focus = false
},
"__c": function($event) {
var $$a = _vm.model,
$$el = $event.target,
$$c = $$el.checked ? (_vm.trueLabel) : (_vm.falseLabel);
if (Array.isArray($$a)) {
var $$v = null,
$$i = _vm._i($$a, $$v);
if ($$c) {
$$i < 0 && (_vm.model = $$a.concat($$v))
} else {
$$i > -1 && (_vm.model = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
}
} else {
_vm.model = $$c
}
}
}
}) : _c('input', {
directives: [{
name: "model",
rawName: "v-model",
value: (_vm.model),
expression: "model"
}],
staticClass: "el-checkbox__original",
attrs: {
"type": "checkbox",
"disabled": _vm.disabled,
"name": _vm.name
},
domProps: {
"value": _vm.label,
"checked": Array.isArray(_vm.model) ? _vm._i(_vm.model, _vm.label) > -1 : (_vm.model)
},
on: {
"change": _vm.handleChange,
"focus": function($event) {
_vm.focus = true
},
"blur": function($event) {
_vm.focus = false
},
"__c": function($event) {
var $$a = _vm.model,
$$el = $event.target,
$$c = $$el.checked ? (true) : (false);
if (Array.isArray($$a)) {
var $$v = _vm.label,
$$i = _vm._i($$a, $$v);
if ($$c) {
$$i < 0 && (_vm.model = $$a.concat($$v))
} else {
$$i > -1 && (_vm.model = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
}
} else {
_vm.model = $$c
}
}
}
})]), (_vm.$slots.default || _vm.label) ? _c('span', {
staticClass: "el-checkbox__label"
}, [_vm._t("default"), (!_vm.$slots.default) ? [_vm._v(_vm._s(_vm.label))] : _vm._e()], 2) : _vm._e()])
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(345);
/***/ },
/***/ 13:
/***/ function(module, exports) {
module.exports = __webpack_require__(12);
/***/ },
/***/ 55:
/***/ function(module, exports) {
module.exports = __webpack_require__(3);
/***/ },
/***/ 63:
/***/ function(module, exports) {
module.exports = __webpack_require__(7);
/***/ },
/***/ 197:
/***/ function(module, exports) {
module.exports = __webpack_require__(25);
/***/ },
/***/ 345:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _main = __webpack_require__(346);
var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_main2.default.install = function (Vue) {
Vue.component(_main2.default.name, _main2.default);
};
exports.default = _main2.default;
/***/ },
/***/ 346:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _vuePopper = __webpack_require__(13);
var _vuePopper2 = _interopRequireDefault(_vuePopper);
var _debounce = __webpack_require__(63);
var _debounce2 = _interopRequireDefault(_debounce);
var _vdom = __webpack_require__(197);
var _vue = __webpack_require__(55);
var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElTooltip',
mixins: [_vuePopper2.default],
props: {
openDelay: {
type: Number,
default: 0
},
disabled: Boolean,
manual: Boolean,
effect: {
type: String,
default: 'dark'
},
popperClass: String,
content: String,
visibleArrow: {
default: true
},
transition: {
type: String,
default: 'el-fade-in-linear'
},
popperOptions: {
default: function _default() {
return {
boundariesPadding: 10,
gpuAcceleration: false
};
}
},
enterable: {
type: Boolean,
default: true
}
},
beforeCreate: function beforeCreate() {
var _this = this;
if (this.$isServer) return;
this.popperVM = new _vue2.default({
data: { node: '' },
render: function render(h) {
return this.node;
}
}).$mount();
this.debounceClose = (0, _debounce2.default)(200, function () {
return _this.handleClosePopper();
});
},
render: function render(h) {
var _this2 = this;
if (this.popperVM) {
this.popperVM.node = h(
'transition',
{
attrs: {
name: this.transition
},
on: {
'afterLeave': this.doDestroy
}
},
[h(
'div',
{
on: {
'mouseleave': function mouseleave() {
_this2.setExpectedState(false);_this2.debounceClose();
},
'mouseenter': function mouseenter() {
_this2.setExpectedState(true);
}
},
ref: 'popper',
directives: [{
name: 'show',
value: !this.disabled && this.showPopper
}],
'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
[this.$slots.content || this.content]
)]
);
}
if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
var vnode = (0, _vdom.getFirstComponentChild)(this.$slots.default);
if (!vnode) return vnode;
var data = vnode.data = vnode.data || {};
var on = vnode.data.on = vnode.data.on || {};
var nativeOn = vnode.data.nativeOn = vnode.data.nativeOn || {};
on.mouseenter = this.addEventHandle(on.mouseenter, function () {
_this2.setExpectedState(true);_this2.handleShowPopper();
});
on.mouseleave = this.addEventHandle(on.mouseleave, function () {
_this2.setExpectedState(false);_this2.debounceClose();
});
nativeOn.mouseenter = this.addEventHandle(nativeOn.mouseenter, function () {
_this2.setExpectedState(true);_this2.handleShowPopper();
});
nativeOn.mouseleave = this.addEventHandle(nativeOn.mouseleave, function () {
_this2.setExpectedState(false);_this2.debounceClose();
});
data.staticClass = this.concatClass(data.staticClass, 'el-tooltip');
return vnode;
},
mounted: function mounted() {
this.referenceElm = this.$el;
},
methods: {
addEventHandle: function addEventHandle(old, fn) {
return old ? Array.isArray(old) ? old.concat(fn) : [old, fn] : fn;
},
concatClass: function concatClass(a, b) {
if (a && a.indexOf(b) > -1) return a;
return a ? b ? a + ' ' + b : a : b || '';
},
handleShowPopper: function handleShowPopper() {
var _this3 = this;
if (!this.expectedState || this.manual) return;
clearTimeout(this.timeout);
this.timeout = setTimeout(function () {
_this3.showPopper = true;
}, this.openDelay);
},
handleClosePopper: function handleClosePopper() {
if (this.enterable && this.expectedState || this.manual) return;
clearTimeout(this.timeout);
this.showPopper = false;
},
setExpectedState: function setExpectedState(expectedState) {
this.expectedState = expectedState;
}
}
};
/***/ }
/******/ });
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(73);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 14:
/***/ function(module, exports) {
module.exports = __webpack_require__(5);
/***/ },
/***/ 73:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _checkboxGroup = __webpack_require__(74);
var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_checkboxGroup2.default.install = function (Vue) {
Vue.component(_checkboxGroup2.default.name, _checkboxGroup2.default);
};
exports.default = _checkboxGroup2.default;
/***/ },
/***/ 74:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(75),
/* template */
__webpack_require__(76),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 75:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _emitter = __webpack_require__(14);
var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElCheckboxGroup',
componentName: 'ElCheckboxGroup',
mixins: [_emitter2.default],
props: {
value: {},
min: Number,
max: Number,
size: String,
fill: String,
textColor: String
},
watch: {
value: function value(_value) {
this.dispatch('ElFormItem', 'el.form.change', [_value]);
}
}
};
/***/ },
/***/ 76:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-checkbox-group"
}, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __WEBPACK_AMD_DEFINE_RESULT__;
/* Modified from https://github.com/taylorhakes/fecha
*
* The MIT License (MIT)
*
* Copyright (c) 2015 Taylor Hakes
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*eslint-disable*/
// 把 YYYY-MM-DD 改成了 yyyy-MM-dd
(function (main) {
'use strict';
/**
* Parse or format dates
* @class fecha
*/
var fecha = {};
var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
var twoDigits = /\d\d?/;
var threeDigits = /\d{3}/;
var fourDigits = /\d{4}/;
var word = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
var noop = function noop() {};
function shorten(arr, sLen) {
var newArr = [];
for (var i = 0, len = arr.length; i < len; i++) {
newArr.push(arr[i].substr(0, sLen));
}
return newArr;
}
function monthUpdate(arrName) {
return function (d, v, i18n) {
var index = i18n[arrName].indexOf(v.charAt(0).toUpperCase() + v.substr(1).toLowerCase());
if (~index) {
d.month = index;
}
};
}
function pad(val, len) {
val = String(val);
len = len || 2;
while (val.length < len) {
val = '0' + val;
}
return val;
}
var dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var monthNamesShort = shorten(monthNames, 3);
var dayNamesShort = shorten(dayNames, 3);
fecha.i18n = {
dayNamesShort: dayNamesShort,
dayNames: dayNames,
monthNamesShort: monthNamesShort,
monthNames: monthNames,
amPm: ['am', 'pm'],
DoFn: function DoFn(D) {
return D + ['th', 'st', 'nd', 'rd'][D % 10 > 3 ? 0 : (D - D % 10 !== 10) * D % 10];
}
};
var formatFlags = {
D: function D(dateObj) {
return dateObj.getDay();
},
DD: function DD(dateObj) {
return pad(dateObj.getDay());
},
Do: function Do(dateObj, i18n) {
return i18n.DoFn(dateObj.getDate());
},
d: function d(dateObj) {
return dateObj.getDate();
},
dd: function dd(dateObj) {
return pad(dateObj.getDate());
},
ddd: function ddd(dateObj, i18n) {
return i18n.dayNamesShort[dateObj.getDay()];
},
dddd: function dddd(dateObj, i18n) {
return i18n.dayNames[dateObj.getDay()];
},
M: function M(dateObj) {
return dateObj.getMonth() + 1;
},
MM: function MM(dateObj) {
return pad(dateObj.getMonth() + 1);
},
MMM: function MMM(dateObj, i18n) {
return i18n.monthNamesShort[dateObj.getMonth()];
},
MMMM: function MMMM(dateObj, i18n) {
return i18n.monthNames[dateObj.getMonth()];
},
yy: function yy(dateObj) {
return String(dateObj.getFullYear()).substr(2);
},
yyyy: function yyyy(dateObj) {
return dateObj.getFullYear();
},
h: function h(dateObj) {
return dateObj.getHours() % 12 || 12;
},
hh: function hh(dateObj) {
return pad(dateObj.getHours() % 12 || 12);
},
H: function H(dateObj) {
return dateObj.getHours();
},
HH: function HH(dateObj) {
return pad(dateObj.getHours());
},
m: function m(dateObj) {
return dateObj.getMinutes();
},
mm: function mm(dateObj) {
return pad(dateObj.getMinutes());
},
s: function s(dateObj) {
return dateObj.getSeconds();
},
ss: function ss(dateObj) {
return pad(dateObj.getSeconds());
},
S: function S(dateObj) {
return Math.round(dateObj.getMilliseconds() / 100);
},
SS: function SS(dateObj) {
return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
},
SSS: function SSS(dateObj) {
return pad(dateObj.getMilliseconds(), 3);
},
a: function a(dateObj, i18n) {
return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1];
},
A: function A(dateObj, i18n) {
return dateObj.getHours() < 12 ? i18n.amPm[0].toUpperCase() : i18n.amPm[1].toUpperCase();
},
ZZ: function ZZ(dateObj) {
var o = dateObj.getTimezoneOffset();
return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
}
};
var parseFlags = {
d: [twoDigits, function (d, v) {
d.day = v;
}],
M: [twoDigits, function (d, v) {
d.month = v - 1;
}],
yy: [twoDigits, function (d, v) {
var da = new Date(),
cent = +('' + da.getFullYear()).substr(0, 2);
d.year = '' + (v > 68 ? cent - 1 : cent) + v;
}],
h: [twoDigits, function (d, v) {
d.hour = v;
}],
m: [twoDigits, function (d, v) {
d.minute = v;
}],
s: [twoDigits, function (d, v) {
d.second = v;
}],
yyyy: [fourDigits, function (d, v) {
d.year = v;
}],
S: [/\d/, function (d, v) {
d.millisecond = v * 100;
}],
SS: [/\d{2}/, function (d, v) {
d.millisecond = v * 10;
}],
SSS: [threeDigits, function (d, v) {
d.millisecond = v;
}],
D: [twoDigits, noop],
ddd: [word, noop],
MMM: [word, monthUpdate('monthNamesShort')],
MMMM: [word, monthUpdate('monthNames')],
a: [word, function (d, v, i18n) {
var val = v.toLowerCase();
if (val === i18n.amPm[0]) {
d.isPm = false;
} else if (val === i18n.amPm[1]) {
d.isPm = true;
}
}],
ZZ: [/[\+\-]\d\d:?\d\d/, function (d, v) {
var parts = (v + '').match(/([\+\-]|\d\d)/gi),
minutes;
if (parts) {
minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
}
}]
};
parseFlags.DD = parseFlags.D;
parseFlags.dddd = parseFlags.ddd;
parseFlags.Do = parseFlags.dd = parseFlags.d;
parseFlags.mm = parseFlags.m;
parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
parseFlags.MM = parseFlags.M;
parseFlags.ss = parseFlags.s;
parseFlags.A = parseFlags.a;
// Some common format strings
fecha.masks = {
'default': 'ddd MMM dd yyyy HH:mm:ss',
shortDate: 'M/D/yy',
mediumDate: 'MMM d, yyyy',
longDate: 'MMMM d, yyyy',
fullDate: 'dddd, MMMM d, yyyy',
shortTime: 'HH:mm',
mediumTime: 'HH:mm:ss',
longTime: 'HH:mm:ss.SSS'
};
/***
* Format a date
* @method format
* @param {Date|number} dateObj
* @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
*/
fecha.format = function (dateObj, mask, i18nSettings) {
var i18n = i18nSettings || fecha.i18n;
if (typeof dateObj === 'number') {
dateObj = new Date(dateObj);
}
if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
throw new Error('Invalid Date in fecha.format');
}
mask = fecha.masks[mask] || mask || fecha.masks['default'];
return mask.replace(token, function ($0) {
return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
});
};
/**
* Parse a date string into an object, changes - into /
* @method parse
* @param {string} dateStr Date string
* @param {string} format Date parse format
* @returns {Date|boolean}
*/
fecha.parse = function (dateStr, format, i18nSettings) {
var i18n = i18nSettings || fecha.i18n;
if (typeof format !== 'string') {
throw new Error('Invalid format in fecha.parse');
}
format = fecha.masks[format] || format;
// Avoid regular expression denial of service, fail early for really long strings
// https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
if (dateStr.length > 1000) {
return false;
}
var isValid = true;
var dateInfo = {};
format.replace(token, function ($0) {
if (parseFlags[$0]) {
var info = parseFlags[$0];
var index = dateStr.search(info[0]);
if (!~index) {
isValid = false;
} else {
dateStr.replace(info[0], function (result) {
info[1](dateInfo, result, i18n);
dateStr = dateStr.substr(index + result.length);
return result;
});
}
}
return parseFlags[$0] ? '' : $0.slice(1, $0.length - 1);
});
if (!isValid) {
return false;
}
var today = new Date();
if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
dateInfo.hour = +dateInfo.hour + 12;
} else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
dateInfo.hour = 0;
}
var date;
if (dateInfo.timezoneOffset != null) {
dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
} else {
date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
}
return date;
};
/* istanbul ignore next */
if (typeof module !== 'undefined' && module.exports) {
module.exports = fecha;
} else if (true) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = function () {
return fecha;
}.call(exports, __webpack_require__, exports, module),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
main.fecha = fecha;
}
})(undefined);
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _util = __webpack_require__(0);
var _validator = __webpack_require__(46);
var _validator2 = _interopRequireDefault(_validator);
var _messages2 = __webpack_require__(65);
var _rule = __webpack_require__(1);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Encapsulates a validation schema.
*
* @param descriptor An object declaring validation rules
* for this schema.
*/
function Schema(descriptor) {
this.rules = null;
this._messages = _messages2.messages;
this.define(descriptor);
}
Schema.prototype = {
messages: function messages(_messages) {
if (_messages) {
this._messages = (0, _util.deepMerge)((0, _messages2.newMessages)(), _messages);
}
return this._messages;
},
define: function define(rules) {
if (!rules) {
throw new Error('Cannot configure a schema with no rules');
}
if ((typeof rules === 'undefined' ? 'undefined' : _typeof(rules)) !== 'object' || Array.isArray(rules)) {
throw new Error('Rules must be an object');
}
this.rules = {};
var z = void 0;
var item = void 0;
for (z in rules) {
if (rules.hasOwnProperty(z)) {
item = rules[z];
this.rules[z] = Array.isArray(item) ? item : [item];
}
}
},
validate: function validate(source_) {
var _this = this;
var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var oc = arguments[2];
var source = source_;
var options = o;
var callback = oc;
if (typeof options === 'function') {
callback = options;
options = {};
}
if (!this.rules || Object.keys(this.rules).length === 0) {
if (callback) {
callback();
}
return;
}
function complete(results) {
var i = void 0;
var field = void 0;
var errors = [];
var fields = {};
function add(e) {
if (Array.isArray(e)) {
errors = errors.concat.apply(errors, e);
} else {
errors.push(e);
}
}
for (i = 0; i < results.length; i++) {
add(results[i]);
}
if (!errors.length) {
errors = null;
fields = null;
} else {
for (i = 0; i < errors.length; i++) {
field = errors[i].field;
fields[field] = fields[field] || [];
fields[field].push(errors[i]);
}
}
callback(errors, fields);
}
if (options.messages) {
var messages = this.messages();
if (messages === _messages2.messages) {
messages = (0, _messages2.newMessages)();
}
(0, _util.deepMerge)(messages, options.messages);
options.messages = messages;
} else {
options.messages = this.messages();
}
options.error = _rule.error;
var arr = void 0;
var value = void 0;
var series = {};
var keys = options.keys || Object.keys(this.rules);
keys.forEach(function (z) {
arr = _this.rules[z];
value = source[z];
arr.forEach(function (r) {
var rule = r;
if (typeof rule.transform === 'function') {
if (source === source_) {
source = _extends({}, source);
}
value = source[z] = rule.transform(value);
}
if (typeof rule === 'function') {
rule = {
validator: rule
};
} else {
rule = _extends({}, rule);
}
rule.validator = _this.getValidationMethod(rule);
rule.field = z;
rule.fullField = rule.fullField || z;
rule.type = _this.getType(rule);
if (!rule.validator) {
return;
}
series[z] = series[z] || [];
series[z].push({
rule: rule,
value: value,
source: source,
field: z
});
});
});
var errorFields = {};
(0, _util.asyncMap)(series, options, function (data, doIt) {
var rule = data.rule;
var deep = (rule.type === 'object' || rule.type === 'array') && (_typeof(rule.fields) === 'object' || _typeof(rule.defaultField) === 'object');
deep = deep && (rule.required || !rule.required && data.value);
rule.field = data.field;
function addFullfield(key, schema) {
return _extends({}, schema, {
fullField: rule.fullField + '.' + key
});
}
function cb() {
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var errors = e;
if (!Array.isArray(errors)) {
errors = [errors];
}
if (errors.length) {
(0, _util.warning)('async-validator:', errors);
}
if (errors.length && rule.message) {
errors = [].concat(rule.message);
}
errors = errors.map((0, _util.complementError)(rule));
if ((options.first || options.fieldFirst) && errors.length) {
errorFields[rule.field] = 1;
return doIt(errors);
}
if (!deep) {
doIt(errors);
} else {
// if rule is required but the target object
// does not exist fail at the rule level and don't
// go deeper
if (rule.required && !data.value) {
if (rule.message) {
errors = [].concat(rule.message).map((0, _util.complementError)(rule));
} else {
errors = [options.error(rule, (0, _util.format)(options.messages.required, rule.field))];
}
return doIt(errors);
}
var fieldsSchema = {};
if (rule.defaultField) {
for (var k in data.value) {
if (data.value.hasOwnProperty(k)) {
fieldsSchema[k] = rule.defaultField;
}
}
}
fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
for (var f in fieldsSchema) {
if (fieldsSchema.hasOwnProperty(f)) {
var fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]];
fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f));
}
}
var schema = new Schema(fieldsSchema);
schema.messages(options.messages);
if (data.rule.options) {
data.rule.options.messages = options.messages;
data.rule.options.error = options.error;
}
schema.validate(data.value, data.rule.options || options, function (errs) {
doIt(errs && errs.length ? errors.concat(errs) : errs);
});
}
}
rule.validator(rule, data.value, cb, data.source, options);
}, function (results) {
complete(results);
});
},
getType: function getType(rule) {
if (rule.type === undefined && rule.pattern instanceof RegExp) {
rule.type = 'pattern';
}
if (typeof rule.validator !== 'function' && rule.type && !_validator2["default"].hasOwnProperty(rule.type)) {
throw new Error((0, _util.format)('Unknown rule type %s', rule.type));
}
return rule.type || 'string';
},
getValidationMethod: function getValidationMethod(rule) {
if (typeof rule.validator === 'function') {
return rule.validator;
}
var keys = Object.keys(rule);
var messageIndex = keys.indexOf('message');
if (messageIndex !== -1) {
keys.splice(messageIndex, 1);
}
if (keys.length === 1 && keys[0] === 'required') {
return _validator2["default"].required;
}
return _validator2["default"][this.getType(rule)] || false;
}
};
Schema.register = function register(type, validator) {
if (typeof validator !== 'function') {
throw new Error('Cannot register a validator by type, validator is not a function');
}
_validator2["default"][type] = validator;
};
Schema.messages = _messages2.messages;
exports["default"] = Schema;
module.exports = exports['default'];
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
string: __webpack_require__(47),
method: __webpack_require__(53),
number: __webpack_require__(54),
"boolean": __webpack_require__(55),
regexp: __webpack_require__(56),
integer: __webpack_require__(57),
"float": __webpack_require__(58),
array: __webpack_require__(59),
object: __webpack_require__(60),
"enum": __webpack_require__(61),
pattern: __webpack_require__(62),
email: __webpack_require__(16),
url: __webpack_require__(16),
date: __webpack_require__(63),
hex: __webpack_require__(16),
required: __webpack_require__(64)
};
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Performs validation for string types.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function string(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value, 'string') && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options, 'string');
if (!(0, _util.isEmptyValue)(value, 'string')) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
_rule2["default"].pattern(rule, value, source, errors, options);
if (rule.whitespace === true) {
_rule2["default"].whitespace(rule, value, source, errors, options);
}
}
}
callback(errors);
}
exports["default"] = string;
module.exports = exports['default'];
/***/ }),
/* 48 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = __webpack_require__(0);
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
/**
* Rule for validating whitespace.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param source The source object being validated.
* @param errors An array of errors that this rule may add
* validation errors to.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function whitespace(rule, value, source, errors, options) {
if (/^\s+$/.test(value) || value === '') {
errors.push(util.format(options.messages.whitespace, rule.fullField));
}
}
exports["default"] = whitespace;
module.exports = exports['default'];
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _util = __webpack_require__(0);
var util = _interopRequireWildcard(_util);
var _required = __webpack_require__(26);
var _required2 = _interopRequireDefault(_required);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
/* eslint max-len:0 */
var pattern = {
// http://emailregex.com/
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
url: new RegExp('^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$', 'i'),
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
};
var types = {
integer: function integer(value) {
return types.number(value) && parseInt(value, 10) === value;
},
"float": function float(value) {
return types.number(value) && !types.integer(value);
},
array: function array(value) {
return Array.isArray(value);
},
regexp: function regexp(value) {
if (value instanceof RegExp) {
return true;
}
try {
return !!new RegExp(value);
} catch (e) {
return false;
}
},
date: function date(value) {
return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear === 'function';
},
number: function number(value) {
if (isNaN(value)) {
return false;
}
return typeof value === 'number';
},
object: function object(value) {
return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && !types.array(value);
},
method: function method(value) {
return typeof value === 'function';
},
email: function email(value) {
return typeof value === 'string' && !!value.match(pattern.email);
},
url: function url(value) {
return typeof value === 'string' && !!value.match(pattern.url);
},
hex: function hex(value) {
return typeof value === 'string' && !!value.match(pattern.hex);
}
};
/**
* Rule for validating the type of a value.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param source The source object being validated.
* @param errors An array of errors that this rule may add
* validation errors to.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function type(rule, value, source, errors, options) {
if (rule.required && value === undefined) {
(0, _required2["default"])(rule, value, source, errors, options);
return;
}
var custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex'];
var ruleType = rule.type;
if (custom.indexOf(ruleType) > -1) {
if (!types[ruleType](value)) {
errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));
}
// straight typeof check
} else if (ruleType && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== rule.type) {
errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));
}
}
exports["default"] = type;
module.exports = exports['default'];
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = __webpack_require__(0);
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
/**
* Rule for validating minimum and maximum allowed values.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param source The source object being validated.
* @param errors An array of errors that this rule may add
* validation errors to.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function range(rule, value, source, errors, options) {
var len = typeof rule.len === 'number';
var min = typeof rule.min === 'number';
var max = typeof rule.max === 'number';
var val = value;
var key = null;
var num = typeof value === 'number';
var str = typeof value === 'string';
var arr = Array.isArray(value);
if (num) {
key = 'number';
} else if (str) {
key = 'string';
} else if (arr) {
key = 'array';
}
// if the value is not of a supported type for range validation
// the validation rule rule should use the
// type property to also test for a particular type
if (!key) {
return false;
}
if (str || arr) {
val = value.length;
}
if (len) {
if (val !== rule.len) {
errors.push(util.format(options.messages[key].len, rule.fullField, rule.len));
}
} else if (min && !max && val < rule.min) {
errors.push(util.format(options.messages[key].min, rule.fullField, rule.min));
} else if (max && !min && val > rule.max) {
errors.push(util.format(options.messages[key].max, rule.fullField, rule.max));
} else if (min && max && (val < rule.min || val > rule.max)) {
errors.push(util.format(options.messages[key].range, rule.fullField, rule.min, rule.max));
}
}
exports["default"] = range;
module.exports = exports['default'];
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = __webpack_require__(0);
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
var ENUM = 'enum';
/**
* Rule for validating a value exists in an enumerable list.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param source The source object being validated.
* @param errors An array of errors that this rule may add
* validation errors to.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function enumerable(rule, value, source, errors, options) {
rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : [];
if (rule[ENUM].indexOf(value) === -1) {
errors.push(util.format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')));
}
}
exports["default"] = enumerable;
module.exports = exports['default'];
/***/ }),
/* 52 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = __webpack_require__(0);
var util = _interopRequireWildcard(_util);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
/**
* Rule for validating a regular expression pattern.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param source The source object being validated.
* @param errors An array of errors that this rule may add
* validation errors to.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function pattern(rule, value, source, errors, options) {
if (rule.pattern instanceof RegExp) {
if (!rule.pattern.test(value)) {
errors.push(util.format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
}
}
}
exports["default"] = pattern;
module.exports = exports['default'];
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates a function.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function method(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = method;
module.exports = exports['default'];
/***/ }),
/* 54 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates a number.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function number(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = number;
module.exports = exports['default'];
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _util = __webpack_require__(0);
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates a boolean.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function boolean(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = boolean;
module.exports = exports['default'];
/***/ }),
/* 56 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates the regular expression type.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function regexp(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (!(0, _util.isEmptyValue)(value)) {
_rule2["default"].type(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = regexp;
module.exports = exports['default'];
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates a number is an integer.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function integer(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = integer;
module.exports = exports['default'];
/***/ }),
/* 58 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates a number is a floating point number.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function floatFn(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = floatFn;
module.exports = exports['default'];
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates an array.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function array(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value, 'array') && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options, 'array');
if (!(0, _util.isEmptyValue)(value, 'array')) {
_rule2["default"].type(rule, value, source, errors, options);
_rule2["default"].range(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = array;
module.exports = exports['default'];
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates an object.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function object(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (value !== undefined) {
_rule2["default"].type(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = object;
module.exports = exports['default'];
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var ENUM = 'enum';
/**
* Validates an enumerable list.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function enumerable(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (value) {
_rule2["default"][ENUM](rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = enumerable;
module.exports = exports['default'];
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Validates a regular expression pattern.
*
* Performs validation when a rule only contains
* a pattern property but is not declared as a string type.
*
* @param rule The validation rule.
* @param value The value of the field on the source object.
* @param callback The callback function.
* @param source The source object being validated.
* @param options The validation options.
* @param options.messages The validation messages.
*/
function pattern(rule, value, callback, source, options) {
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
if (validate) {
if ((0, _util.isEmptyValue)(value, 'string') && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (!(0, _util.isEmptyValue)(value, 'string')) {
_rule2["default"].pattern(rule, value, source, errors, options);
}
}
callback(errors);
}
exports["default"] = pattern;
module.exports = exports['default'];
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
var _util = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function date(rule, value, callback, source, options) {
// console.log('integer rule called %j', rule);
var errors = [];
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
// console.log('validate on %s value', value);
if (validate) {
if ((0, _util.isEmptyValue)(value) && !rule.required) {
return callback();
}
_rule2["default"].required(rule, value, source, errors, options);
if (!(0, _util.isEmptyValue)(value)) {
_rule2["default"].type(rule, value, source, errors, options);
if (value) {
_rule2["default"].range(rule, value.getTime(), source, errors, options);
}
}
}
callback(errors);
}
exports["default"] = date;
module.exports = exports['default'];
/***/ }),
/* 64 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _rule = __webpack_require__(1);
var _rule2 = _interopRequireDefault(_rule);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function required(rule, value, callback, source, options) {
var errors = [];
var type = Array.isArray(value) ? 'array' : typeof value === 'undefined' ? 'undefined' : _typeof(value);
_rule2["default"].required(rule, value, source, errors, options, type);
callback(errors);
}
exports["default"] = required;
module.exports = exports['default'];
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.newMessages = newMessages;
function newMessages() {
return {
"default": 'Validation error on field %s',
required: '%s is required',
"enum": '%s must be one of %s',
whitespace: '%s cannot be empty',
date: {
format: '%s date %s is invalid for format %s',
parse: '%s date could not be parsed, %s is invalid ',
invalid: '%s date %s is invalid'
},
types: {
string: '%s is not a %s',
method: '%s is not a %s (function)',
array: '%s is not an %s',
object: '%s is not an %s',
number: '%s is not a %s',
date: '%s is not a %s',
"boolean": '%s is not a %s',
integer: '%s is not an %s',
"float": '%s is not a %s',
regexp: '%s is not a valid %s',
email: '%s is not a valid %s',
url: '%s is not a valid %s',
hex: '%s is not a valid %s'
},
string: {
len: '%s must be exactly %s characters',
min: '%s must be at least %s characters',
max: '%s cannot be longer than %s characters',
range: '%s must be between %s and %s characters'
},
number: {
len: '%s must equal %s',
min: '%s cannot be less than %s',
max: '%s cannot be greater than %s',
range: '%s must be between %s and %s'
},
array: {
len: '%s must be exactly %s in length',
min: '%s cannot be less than %s in length',
max: '%s cannot be greater than %s in length',
range: '%s must be between %s and %s in length'
},
pattern: {
mismatch: '%s value %s does not match pattern %s'
},
clone: function clone() {
var cloned = JSON.parse(JSON.stringify(this));
cloned.clone = this.clone;
return cloned;
}
};
}
var messages = exports.messages = newMessages();
/***/ }),
/* 66 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(172);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 9:
/***/ function(module, exports) {
module.exports = __webpack_require__(10);
/***/ },
/***/ 63:
/***/ function(module, exports) {
module.exports = __webpack_require__(7);
/***/ },
/***/ 123:
/***/ function(module, exports) {
module.exports = __webpack_require__(4);
/***/ },
/***/ 172:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _inputNumber = __webpack_require__(173);
var _inputNumber2 = _interopRequireDefault(_inputNumber);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_inputNumber2.default.install = function (Vue) {
Vue.component(_inputNumber2.default.name, _inputNumber2.default);
};
exports.default = _inputNumber2.default;
/***/ },
/***/ 173:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(174),
/* template */
__webpack_require__(175),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 174:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _input = __webpack_require__(9);
var _input2 = _interopRequireDefault(_input);
var _dom = __webpack_require__(123);
var _debounce = __webpack_require__(63);
var _debounce2 = _interopRequireDefault(_debounce);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'ElInputNumber',
directives: {
repeatClick: {
bind: function bind(el, binding, vnode) {
var interval = null;
var startTime = void 0;
var handler = function handler() {
return vnode.context[binding.expression].apply();
};
var clear = function clear() {
if (new Date() - startTime < 100) {
handler();
}
clearInterval(interval);
interval = null;
};
(0, _dom.on)(el, 'mousedown', function () {
startTime = new Date();
(0, _dom.once)(document, 'mouseup', clear);
clearInterval(interval);
interval = setInterval(handler, 100);
});
}
}
},
components: {
ElInput: _input2.default
},
props: {
step: {
type: Number,
default: 1
},
max: {
type: Number,
default: Infinity
},
min: {
type: Number,
default: -Infinity
},
value: {
default: 0
},
disabled: Boolean,
size: String,
controls: {
type: Boolean,
default: true
},
debounce: {
type: Number,
default: 300
}
},
data: function data() {
return {
currentValue: 0
};
},
watch: {
value: {
immediate: true,
handler: function handler(value) {
var newVal = Number(value);
if (isNaN(newVal)) return;
if (newVal >= this.max) newVal = this.max;
if (newVal <= this.min) newVal = this.min;
this.currentValue = newVal;
this.$emit('input', newVal);
}
}
},
computed: {
minDisabled: function minDisabled() {
return this._decrease(this.value, this.step) < this.min;
},
maxDisabled: function maxDisabled() {
return this._increase(this.value, this.step) > this.max;
},
precision: function precision() {
var value = this.value,
step = this.step,
getPrecision = this.getPrecision;
return Math.max(getPrecision(value), getPrecision(step));
}
},
methods: {
toPrecision: function toPrecision(num, precision) {
if (precision === undefined) precision = this.precision;
return parseFloat(parseFloat(Number(num).toFixed(precision)));
},
getPrecision: function getPrecision(value) {
var valueString = value.toString();
var dotPosition = valueString.indexOf('.');
var precision = 0;
if (dotPosition !== -1) {
precision = valueString.length - dotPosition - 1;
}
return precision;
},
_increase: function _increase(val, step) {
if (typeof val !== 'number') return this.currentValue;
var precisionFactor = Math.pow(10, this.precision);
return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
},
_decrease: function _decrease(val, step) {
if (typeof val !== 'number') return this.currentValue;
var precisionFactor = Math.pow(10, this.precision);
return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
},
increase: function increase() {
if (this.disabled || this.maxDisabled) return;
var value = this.value || 0;
var newVal = this._increase(value, this.step);
if (newVal > this.max) return;
this.setCurrentValue(newVal);
},
decrease: function decrease() {
if (this.disabled || this.minDisabled) return;
var value = this.value || 0;
var newVal = this._decrease(value, this.step);
if (newVal < this.min) return;
this.setCurrentValue(newVal);
},
handleBlur: function handleBlur() {
this.$refs.input.setCurrentValue(this.currentValue);
},
setCurrentValue: function setCurrentValue(newVal) {
var oldVal = this.currentValue;
if (newVal >= this.max) newVal = this.max;
if (newVal <= this.min) newVal = this.min;
if (oldVal === newVal) {
this.$refs.input.setCurrentValue(this.currentValue);
return;
}
this.$emit('change', newVal, oldVal);
this.$emit('input', newVal);
this.currentValue = newVal;
},
handleInput: function handleInput(value) {
if (value === '') {
return;
}
var newVal = Number(value);
if (!isNaN(newVal)) {
this.setCurrentValue(newVal);
} else {
this.$refs.input.setCurrentValue(this.currentValue);
}
}
},
created: function created() {
var _this = this;
this.debounceHandleInput = (0, _debounce2.default)(this.debounce, function (value) {
_this.handleInput(value);
});
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ },
/***/ 175:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-input-number",
class: [
_vm.size ? 'el-input-number--' + _vm.size : '', {
'is-disabled': _vm.disabled
}, {
'is-without-controls': !_vm.controls
}
]
}, [(_vm.controls) ? _c('span', {
directives: [{
name: "repeat-click",
rawName: "v-repeat-click",
value: (_vm.decrease),
expression: "decrease"
}],
staticClass: "el-input-number__decrease",
class: {
'is-disabled': _vm.minDisabled
}
}, [_c('i', {
staticClass: "el-icon-minus"
})]) : _vm._e(), (_vm.controls) ? _c('span', {
directives: [{
name: "repeat-click",
rawName: "v-repeat-click",
value: (_vm.increase),
expression: "increase"
}],
staticClass: "el-input-number__increase",
class: {
'is-disabled': _vm.maxDisabled
}
}, [_c('i', {
staticClass: "el-icon-plus"
})]) : _vm._e(), _c('el-input', {
ref: "input",
attrs: {
"value": _vm.currentValue,
"disabled": _vm.disabled,
"size": _vm.size,
"max": _vm.max,
"min": _vm.min
},
on: {
"blur": _vm.handleBlur,
"input": _vm.debounceHandleInput
},
nativeOn: {
"keydown": [function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "up", 38)) { return null; }
$event.preventDefault();
_vm.increase($event)
}, function($event) {
if (!('button' in $event) && _vm._k($event.keyCode, "down", 40)) { return null; }
$event.preventDefault();
_vm.decrease($event)
}]
}
}, [(_vm.$slots.prepend) ? _c('template', {
slot: "prepend"
}, [_vm._t("prepend")], 2) : _vm._e(), (_vm.$slots.append) ? _c('template', {
slot: "append"
}, [_vm._t("append")], 2) : _vm._e()], 2)], 1)
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 67 */
/***/ (function(module, exports) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(237);
/***/ },
/***/ 3:
/***/ function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context = context || (this.$vnode && this.$vnode.ssrContext)
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ },
/***/ 237:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
var _progress = __webpack_require__(238);
var _progress2 = _interopRequireDefault(_progress);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
_progress2.default.install = function (Vue) {
Vue.component(_progress2.default.name, _progress2.default);
};
exports.default = _progress2.default;
/***/ },
/***/ 238:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
__webpack_require__(239),
/* template */
__webpack_require__(240),
/* styles */
null,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ },
/***/ 239:
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'ElProgress',
props: {
type: {
type: String,
default: 'line',
validator: function validator(val) {
return ['line', 'circle'].indexOf(val) > -1;
}
},
percentage: {
type: Number,
default: 0,
required: true,
validator: function validator(val) {
return val >= 0 && val <= 100;
}
},
status: {
type: String
},
strokeWidth: {
type: Number,
default: 6
},
textInside: {
type: Boolean,
default: false
},
width: {
type: Number,
default: 126
},
showText: {
type: Boolean,
default: true
}
},
computed: {
barStyle: function barStyle() {
var style = {};
style.width = this.percentage + '%';
return style;
},
relativeStrokeWidth: function relativeStrokeWidth() {
return (this.strokeWidth / this.width * 100).toFixed(1);
},
trackPath: function trackPath() {
var radius = parseInt(50 - parseFloat(this.relativeStrokeWidth) / 2, 10);
return 'M 50 50 m 0 -' + radius + ' a ' + radius + ' ' + radius + ' 0 1 1 0 ' + radius * 2 + ' a ' + radius + ' ' + radius + ' 0 1 1 0 -' + radius * 2;
},
perimeter: function perimeter() {
var radius = 50 - parseFloat(this.relativeStrokeWidth) / 2;
return 2 * Math.PI * radius;
},
circlePathStyle: function circlePathStyle() {
var perimeter = this.perimeter;
return {
strokeDasharray: perimeter + 'px,' + perimeter + 'px',
strokeDashoffset: (1 - this.percentage / 100) * perimeter + 'px',
transition: 'stroke-dashoffset 0.6s ease 0s, stroke 0.6s ease'
};
},
stroke: function stroke() {
var ret;
switch (this.status) {
case 'success':
ret = '#13ce66';
break;
case 'exception':
ret = '#ff4949';
break;
default:
ret = '#20a0ff';
}
return ret;
},
iconClass: function iconClass() {
if (this.type === 'line') {
return this.status === 'success' ? 'el-icon-circle-check' : 'el-icon-circle-cross';
} else {
return this.status === 'success' ? 'el-icon-check' : 'el-icon-close';
}
},
progressTextSize: function progressTextSize() {
return this.type === 'line' ? 12 + this.strokeWidth * 0.4 : this.width * 0.111111 + 2;
}
}
};
/***/ },
/***/ 240:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "el-progress",
class: [
'el-progress--' + _vm.type,
_vm.status ? 'is-' + _vm.status : '', {
'el-progress--without-text': !_vm.showText,
'el-progress--text-inside': _vm.textInside,
}
]
}, [(_vm.type === 'line') ? _c('div', {
staticClass: "el-progress-bar"
}, [_c('div', {
staticClass: "el-progress-bar__outer",
style: ({
height: _vm.strokeWidth + 'px'
})
}, [_c('div', {
staticClass: "el-progress-bar__inner",
style: (_vm.barStyle)
}, [(_vm.showText && _vm.textInside) ? _c('div', {
staticClass: "el-progress-bar__innerText"
}, [_vm._v(_vm._s(_vm.percentage) + "%")]) : _vm._e()])])]) : _c('div', {
staticClass: "el-progress-circle",
style: ({
height: _vm.width + 'px',
width: _vm.width + 'px'
})
}, [_c('svg', {
attrs: {
"viewBox": "0 0 100 100"
}
}, [_c('path', {
staticClass: "el-progress-circle__track",
attrs: {
"d": _vm.trackPath,
"stroke": "#e5e9f2",
"stroke-width": _vm.relativeStrokeWidth,
"fill": "none"
}
}), _c('path', {
staticClass: "el-progress-circle__path",
style: (_vm.circlePathStyle),
attrs: {
"d": _vm.trackPath,
"stroke-linecap": "round",
"stroke": _vm.stroke,
"stroke-width": _vm.relativeStrokeWidth,
"fill": "none"
}
})])]), (_vm.showText && !_vm.textInside) ? _c('div', {
staticClass: "el-progress__text",
style: ({
fontSize: _vm.progressTextSize + 'px'
})
}, [(!_vm.status) ? [_vm._v(_vm._s(_vm.percentage) + "%")] : _c('i', {
class: _vm.iconClass
})], 2) : _vm._e()])
},staticRenderFns: []}
/***/ }
/******/ });
/***/ }),
/* 68 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {
exports.__esModule = true;
/**
* Show migrating guide in browser console.
*
* Usage:
* import Migrating from 'element-ui/src/mixins/migrating';
*
* mixins: [Migrating]
*
* add getMigratingConfig method for your component.
* getMigratingConfig() {
* return {
* props: {
* 'allow-no-selection': 'allow-no-selection is removed.',
* 'selection-mode': 'selection-mode is removed.'
* },
* events: {
* selectionchange: 'selectionchange is renamed to selection-change.'
* }
* };
* },
*/
exports.default = {
mounted: function mounted() {
if (process.env.NODE_ENV === 'production') return;
if (!this.$vnode) return;
var _getMigratingConfig = this.getMigratingConfig(),
props = _getMigratingConfig.props,
events = _getMigratingConfig.events;
var _$vnode = this.$vnode,
data = _$vnode.data,
componentOptions = _$vnode.componentOptions;
var definedProps = data.attrs || {};
var definedEvents = componentOptions.listeners || {};
for (var propName in definedProps) {
if (definedProps.hasOwnProperty(propName) && props[propName]) {
console.warn('[Element Migrating][Attribute]: ' + props[propName]);
}
}
for (var eventName in definedEvents) {
if (definedEvents.hasOwnProperty(eventName) && events[eventName]) {
console.warn('[Element Migrating][Event]: ' + events[eventName]);
}
}
},
methods: {
getMigratingConfig: function getMigratingConfig() {
return {
props: {},
events: {}
};
}
}
};
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))
/***/ }),
/* 69 */
/***/ (function(module, exports) {
var nestRE = /^(attrs|props|on|nativeOn|class|style|hook)$/
module.exports = function mergeJSXProps (objs) {
return objs.reduce(function (a, b) {
var aa, bb, key, nestedKey, temp
for (key in b) {
aa = a[key]
bb = b[key]
if (aa && nestRE.test(key)) {
// normalize class
if (key === 'class') {
if (typeof aa === 'string') {
temp = aa
a[key] = aa = {}
aa[temp] = true
}
if (typeof bb === 'string') {
temp = bb
b[key] = bb = {}
bb[temp] = true
}
}
if (key === 'on' || key === 'nativeOn' || key === 'hook') {
// merge functions
for (nestedKey in bb) {
aa[nestedKey] = mergeFn(aa[nestedKey], bb[nestedKey])
}
} else if (Array.isArray(aa)) {
a[key] = aa.concat(bb)
} else if (Array.isArray(bb)) {
a[key] = [aa].concat(bb)
} else {
for (nestedKey in bb) {
aa[nestedKey] = bb[nestedKey]
}
}
} else {
a[key] = b[key]
}
}
return a
}, {})
}
function mergeFn (a, b) {
return function () {
a.apply(this, arguments)
b.apply(this, arguments)
}
}
/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.isDef = isDef;
function isDef(val) {
return val !== undefined && val !== null;
}
/***/ }),
/* 71 */
/***/ (function(module, exports) {
throw new Error("Module build failed: SyntaxError: F:/lx_new/webapp/store/index.js: Unexpected token (49:22)\n\n\u001b[0m \u001b[90m 47 | \u001b[39m\u001b[36mconst\u001b[39m mutations \u001b[33m=\u001b[39m {\n \u001b[90m 48 | \u001b[39m initPage(state\u001b[33m,\u001b[39mdata){\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 49 | \u001b[39m state\u001b[33m.\u001b[39minitData \u001b[33m=\u001b[39m {\u001b[33m...\u001b[39mstate\u001b[33m.\u001b[39minitData\u001b[33m,\u001b[39m\u001b[33m...\u001b[39mdata}\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 50 | \u001b[39m }\u001b[33m,\u001b[39m\n \u001b[90m 51 | \u001b[39m initDone(state\u001b[33m,\u001b[39mresult){\n \u001b[90m 52 | \u001b[39m state\u001b[33m.\u001b[39minitDone \u001b[33m=\u001b[39m result\u001b[0m\n");
/***/ }),
/* 72 */
/***/ (function(module, exports) {
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
module.exports = function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function isObject(what) {
return typeof what === 'object' && what !== null;
}
// Yanked from https://git.io/vS8DV re-used under CC0
// with some tiny modifications
function isError(value) {
switch ({}.toString.call(value)) {
case '[object Error]': return true;
case '[object Exception]': return true;
case '[object DOMException]': return true;
default: return value instanceof Error;
}
}
function wrappedCallback(callback) {
function dataCallback(data, original) {
var normalizedData = callback(data) || data;
if (original) {
return original(normalizedData) || normalizedData;
}
return normalizedData;
}
return dataCallback;
}
module.exports = {
isObject: isObject,
isError: isError,
wrappedCallback: wrappedCallback
};
/***/ }),
/* 74 */,
/* 75 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
// CONCATENATED MODULE: ./webapp/js/util/AppData.js
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__control__ = __webpack_require__(121);
/**
* 数据工厂
*/
var isLogin = false; // 是否登录
var mainAccount; // 主账户
var lotteryAccount; // 彩票账户
var baccaratAccount; // 百家乐账户
var info; // 信息
var msgCount;
var init = function (options, callback) {
if (!options) {
options = {};
}
options.url = __WEBPACK_IMPORTED_MODULE_0__control__["a" /* Route */].PATH + __WEBPACK_IMPORTED_MODULE_0__control__["a" /* Route */].WebAjax.PATH + __WEBPACK_IMPORTED_MODULE_0__control__["a" /* Route */].WebAjax.INIT_PAGE;
options.async = false;
options.success = function (response) {
if (response.error == 0) {
var data = response.data;
isLogin = data.isLogin;
if (isLogin) {
mainAccount = data.main;
lotteryAccount = data.lottery;
info = data.info;
msgCount = data.msgCount;
// callback()
}
}
};
HttpRequest(options);
};
const AppData = {
init: init,
isLogin: function () {
return isLogin;
},
getMainAccount: function () {
return mainAccount;
},
getLotteryAccount: function () {
return lotteryAccount;
},
getBaccaratAccount: function () {
return baccaratAccount;
},
getInfo: function () {
return info;
},
getMsgCount: function () {
return msgCount;
}
};
window.AppData = AppData;
/* harmony default export */ var AppData_defaultExport = (AppData);
// CONCATENATED MODULE: ./webapp/js/util/compt.js
//加减乘除计算
function add(a, b) {
var c, d, e;
try {
c = a.toString().split(".")[1].length;
} catch (f) {
c = 0;
}
try {
d = b.toString().split(".")[1].length;
} catch (f) {
d = 0;
}
return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
}
function sub(a, b) {
var c, d, e;
try {
c = a.toString().split(".")[1].length;
} catch (f) {
c = 0;
}
try {
d = b.toString().split(".")[1].length;
} catch (f) {
d = 0;
}
return e = Math.pow(10, Math.max(c, d)), (mul(a, e) - mul(b, e)) / e;
}
function mul(a, b) {
var c = 0,
d = a.toString(),
e = b.toString();
try {
c += d.split(".")[1].length;
} catch (f) {}
try {
c += e.split(".")[1].length;
} catch (f) {}
return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
}
function div(a, b) {
var c,
d,
e = 0,
f = 0;
try {
e = a.toString().split(".")[1].length;
} catch (g) {}
try {
f = b.toString().split(".")[1].length;
} catch (g) {}
return c = Number(a.toString().replace(".", "")), d = Number(b.toString().replace(".", "")), mul(c / d, Math.pow(10, f - e));
}
/* harmony default export */ var compt_defaultExport = ({
add, sub, mul, div
});
window.compt = {
add, sub, mul, div
};
// CONCATENATED MODULE: ./node_modules/_vue-loader@13.0.4@vue-loader/lib/template-compiler?{"id":"data-v-03229074","hasScoped":false,"preserveWhitespace":false}!./node_modules/_vue-loader@13.0.4@vue-loader/lib/selector.js?type=template&index=0!./webapp/component/bar/index.vue
var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', {
staticClass: "bar"
}, [_c('div', {
staticClass: "container"
}, [_c('Timer'), (_vm.isDevEnv) ? _c('div', {
staticClass: "pull-left"
}, [_c('el-button', {
attrs: {
"type": "primary"
},
on: {
"click": function($event) {
_vm.$swal.confirm('确认提示', '确认关闭')
}
}
}, [_vm._v("主色")]), _c('el-button', {
attrs: {
"type": "success"
},
on: {
"click": function($event) {
_vm.$swal.success('成功提示')
}
}
}, [_vm._v("成功")]), _c('el-button', {
attrs: {
"type": "warning"
},
on: {
"click": function($event) {
_vm.$swal.warning('警告提示')
}
}
}, [_vm._v("警告")]), _c('el-button', {
attrs: {
"type": "info"
},
on: {
"click": function($event) {
_vm.$swal.info('信息提示')
}
}
}, [_vm._v("警告")]), _c('el-button', {
attrs: {
"type": "danger"
},
on: {
"click": function($event) {
_vm.$swal.error('错误提示')
}
}
}, [_vm._v("错误")])], 1) : _vm._e(), (_vm.isLogin) ? _c('div', {
staticClass: "login-done pull-right"
}, [_c(_vm.view, {
ref: "bal",
tag: "component",
attrs: {
"username": _vm.username,
"lottoBal": _vm.lottoBal
}
}), _vm._m(0), _c('div', {
class: {
new: _vm.msgCount, message: true
}
}, [_c('a', {
attrs: {
"href": "manager.html#mode=messageCenter&page=recieveMessage"
}
}, [_c('i', {
staticClass: "imoon-email"
}), _c('span', [_vm._v("消息")]), _c('el-badge', {
attrs: {
"value": _vm.msgCount,
"max": 99
}
})], 1)]), _vm._m(1), _c('Voice', {
attrs: {
"username": _vm.username
}
}), _c('div', {
on: {
"click": _vm.logout
}
}, [_c('i', {
staticClass: "imoon-sign-out",
attrs: {
"aria-hidden": "true"
}
}), _c('span', {
staticClass: "hidden-xs"
}, [_vm._v("退出")])])], 1) : (_vm.isLogin === false) ? _c('div', {
staticClass: "login-no pull-right"
}, [_vm._v("\n 尊敬的玩家您好!欢迎来到利信娱乐,请先"), _c('a', {
staticClass: "inlogin",
attrs: {
"href": "/"
}
}, [_vm._v("登录")])]) : _vm._e()], 1)])
}
var staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', [_c('a', {
attrs: {
"href": "ping.html",
"target": "_blank"
}
}, [_c('i', {}), _vm._v("线路检测")])])
},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
return _c('div', [_c('i', {
staticClass: "imoon-volume"
}), _c('span', [_vm._v("公告")])])
}]
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ var bar_defaultExport = (esExports);
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-loader/node_modules/vue-hot-reload-api").rerender("data-v-03229074", esExports)
}
}
// CONCATENATED MODULE: ./webapp/component/bar/index.vue
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_0_4_vue_loader_lib_selector_type_script_index_0_index_vue__ = __webpack_require__(125);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_0_4_vue_loader_lib_selector_type_script_index_0_index_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_0_4_vue_loader_lib_selector_type_script_index_0_index_vue__);
var disposed = false
function injectStyle (ssrContext) {
if (disposed) return
__webpack_require__(123)
}
var normalizeComponent = __webpack_require__(29)
/* script */
/* template */
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_13_0_4_vue_loader_lib_selector_type_script_index_0_index_vue__["default"],
bar_defaultExport,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "webapp\\component\\bar\\index.vue"
if (Component.esModule && Object.keys(Component.esModule).some(function (key) {return key !== "default" && key.substr(0, 2) !== "__"})) {console.error("named exports are not supported in *.vue files.")}
if (Component.options.functional) {console.error("[vue-loader] index.vue: functional components are not supported with templates, they should use render functions.")}
/* hot reload */
if (false) {(function () {
var hotAPI = require("vue-loader/node_modules/vue-hot-reload-api")
hotAPI.install(require("vue"), false)
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-03229074", Component.options)
} else {
hotAPI.reload("data-v-03229074", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}
/* harmony default export */ var component_bar_defaultExport = (Component.exports);
// CONCATENATED MODULE: ./webapp/js/index.js
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__less_index_less__ = __webpack_require__(76);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__less_index_less___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__less_index_less__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__css_gaga_temp_lx_bg_css__ = __webpack_require__(77);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__css_gaga_temp_lx_bg_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__css_gaga_temp_lx_bg_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__css_gaga_temp_index_bg_css__ = __webpack_require__(78);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__css_gaga_temp_index_bg_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2__css_gaga_temp_index_bg_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_vue__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_element_ui__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_element_ui___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_element_ui__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__css_element_theme_icon_css__ = __webpack_require__(79);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__css_element_theme_icon_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5__css_element_theme_icon_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__css_element_theme_loading_css__ = __webpack_require__(80);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__css_element_theme_loading_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6__css_element_theme_loading_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__css_element_theme_badge_css__ = __webpack_require__(81);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__css_element_theme_badge_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7__css_element_theme_badge_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__css_element_theme_tooltip_css__ = __webpack_require__(82);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__css_element_theme_tooltip_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8__css_element_theme_tooltip_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__css_element_theme_button_css__ = __webpack_require__(83);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__css_element_theme_button_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9__css_element_theme_button_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__css_element_theme_radio_group_css__ = __webpack_require__(84);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__css_element_theme_radio_group_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10__css_element_theme_radio_group_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__css_element_theme_radio_button_css__ = __webpack_require__(85);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__css_element_theme_radio_button_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11__css_element_theme_radio_button_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__css_element_theme_form_css__ = __webpack_require__(86);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__css_element_theme_form_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_12__css_element_theme_form_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__css_element_theme_form_item_css__ = __webpack_require__(87);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__css_element_theme_form_item_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13__css_element_theme_form_item_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__css_element_theme_checkbox_css__ = __webpack_require__(88);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__css_element_theme_checkbox_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_14__css_element_theme_checkbox_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__css_element_theme_select_css__ = __webpack_require__(89);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__css_element_theme_select_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_15__css_element_theme_select_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__css_element_theme_select_dropdown_css__ = __webpack_require__(90);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__css_element_theme_select_dropdown_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16__css_element_theme_select_dropdown_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__css_element_theme_cascader_css__ = __webpack_require__(91);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__css_element_theme_cascader_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_17__css_element_theme_cascader_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__css_element_theme_slider_css__ = __webpack_require__(92);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__css_element_theme_slider_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_18__css_element_theme_slider_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__css_element_theme_date_picker_css__ = __webpack_require__(93);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__css_element_theme_date_picker_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19__css_element_theme_date_picker_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__css_element_theme_pagination_css__ = __webpack_require__(94);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__css_element_theme_pagination_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_20__css_element_theme_pagination_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__css_element_theme_table_css__ = __webpack_require__(95);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__css_element_theme_table_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_21__css_element_theme_table_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__css_element_theme_table_column_css__ = __webpack_require__(96);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__css_element_theme_table_column_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_22__css_element_theme_table_column_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23_animate_css_source_base_css__ = __webpack_require__(97);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23_animate_css_source_base_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_23_animate_css_source_base_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24_animate_css_source_sliding_entrances_slideInDown_css__ = __webpack_require__(98);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24_animate_css_source_sliding_entrances_slideInDown_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_24_animate_css_source_sliding_entrances_slideInDown_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25_animate_css_source_sliding_exits_slideOutup_css__ = __webpack_require__(99);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25_animate_css_source_sliding_exits_slideOutup_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_25_animate_css_source_sliding_exits_slideOutup_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26_animate_css_source_zooming_entrances_zoomIn_css__ = __webpack_require__(100);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26_animate_css_source_zooming_entrances_zoomIn_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_26_animate_css_source_zooming_entrances_zoomIn_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27_animate_css_source_zooming_exits_zoomOut_css__ = __webpack_require__(101);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27_animate_css_source_zooming_exits_zoomOut_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_27_animate_css_source_zooming_exits_zoomOut_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28_animate_css_source_bouncing_entrances_bounceInRight_css__ = __webpack_require__(102);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28_animate_css_source_bouncing_entrances_bounceInRight_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_28_animate_css_source_bouncing_entrances_bounceInRight_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29_animate_css_source_bouncing_exits_bounceOutRight_css__ = __webpack_require__(103);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29_animate_css_source_bouncing_exits_bounceOutRight_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_29_animate_css_source_bouncing_exits_bounceOutRight_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30_animate_css_source_fading_entrances_fadeIn_css__ = __webpack_require__(104);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30_animate_css_source_fading_entrances_fadeIn_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_30_animate_css_source_fading_entrances_fadeIn_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__css_loaders_scss__ = __webpack_require__(105);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__css_loaders_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_31__css_loaders_scss__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__css_sweetalert2_sweetalert2_scss__ = __webpack_require__(106);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__css_sweetalert2_sweetalert2_scss___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_32__css_sweetalert2_sweetalert2_scss__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33_bootstrap_js_transition__ = __webpack_require__(107);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33_bootstrap_js_transition___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_33_bootstrap_js_transition__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34_bootstrap_js_tab__ = __webpack_require__(108);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34_bootstrap_js_tab___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_34_bootstrap_js_tab__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35_formvalidation_src_js_base__ = __webpack_require__(110);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35_formvalidation_src_js_base___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_35_formvalidation_src_js_base__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36_formvalidation_src_js_helper__ = __webpack_require__(111);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36_formvalidation_src_js_helper___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_36_formvalidation_src_js_helper__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37_formvalidation_src_js_validator_digits__ = __webpack_require__(112);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37_formvalidation_src_js_validator_digits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_37_formvalidation_src_js_validator_digits__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38_formvalidation_src_js_validator_numeric__ = __webpack_require__(113);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38_formvalidation_src_js_validator_numeric___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_38_formvalidation_src_js_validator_numeric__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39_formvalidation_src_js_validator_notEmpty__ = __webpack_require__(114);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39_formvalidation_src_js_validator_notEmpty___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_39_formvalidation_src_js_validator_notEmpty__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40_formvalidation_src_js_validator_regexp__ = __webpack_require__(115);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40_formvalidation_src_js_validator_regexp___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_40_formvalidation_src_js_validator_regexp__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41_formvalidation_src_js_validator_stringLength__ = __webpack_require__(116);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41_formvalidation_src_js_validator_stringLength___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_41_formvalidation_src_js_validator_stringLength__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42_formvalidation_src_js_framework_bootstrap__ = __webpack_require__(117);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42_formvalidation_src_js_framework_bootstrap___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_42_formvalidation_src_js_framework_bootstrap__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43_formvalidation_src_js_validator_callback__ = __webpack_require__(118);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43_formvalidation_src_js_validator_callback___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_43_formvalidation_src_js_validator_callback__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44_bootstrap_table_dist_bootstrap_table_css__ = __webpack_require__(119);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44_bootstrap_table_dist_bootstrap_table_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_44_bootstrap_table_dist_bootstrap_table_css__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__util_DataFormat__ = __webpack_require__(120);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__util_Will__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__util_Will___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_46__util_Will__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__util_fallback_app__ = __webpack_require__(122);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__store__ = __webpack_require__(71);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__store___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_50__store__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__router__ = __webpack_require__(126);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__router___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_52__router__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53_moveto__ = __webpack_require__(127);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53_moveto___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_53_moveto__);
// externals jquery
window.jQuery = window.$ = __webpack_require__(2);
// import '../css/_gaga_temp/lobby_lottery_bg.css'
if (true) {
__WEBPACK_IMPORTED_MODULE_3_vue__["default"].config.silent = true;
__WEBPACK_IMPORTED_MODULE_3_vue__["default"].config.devtools = false;
}
__WEBPACK_IMPORTED_MODULE_3_vue__["default"].use(__WEBPACK_IMPORTED_MODULE_4_element_ui__["Badge"]);
__WEBPACK_IMPORTED_MODULE_3_vue__["default"].use(__WEBPACK_IMPORTED_MODULE_4_element_ui__["Tooltip"]);
//lottoRecord & admin Report use
//element-theme el-tag el-checkbox el-select-dropdown... repeat,extra .css use cssnano uniqueSelectors
//http://cssnano.co/optimisations/uniqueSelectors/
// import '../css/element-theme/time-picker.css'
window.Cookies = __webpack_require__(109);
// import 'formvalidation/src/js/validator/identical'
// lottery.less overwrite bootstrap-table.css => xe.css
window.rootIndex = '/';
const pathName = Object(__WEBPACK_IMPORTED_MODULE_46__util_Will__["getPath"])();
pathName !== '/' && new __WEBPACK_IMPORTED_MODULE_3_vue__["default"]({
el: '.bar',
render: h => h(component_bar_defaultExport),
store: __WEBPACK_IMPORTED_MODULE_50__store__["default"]
});
// import ''
// const BANNERTOP = 105;
// const $win = $(window);
// const $nav = $('.navbar-top').addClass('animated')
// if (isDesktopScreen){
// // const bannerTop = 120 + 45;
// const bannerTop = 45;
// let scrollTop = 0
// $win
// .scroll(throttle(() => {
// scrollTop = $win.scrollTop();
// },100))
// .on('mousewheel',throttle(e => {
// if (scrollTop < bannerTop) return;
// if(e.originalEvent.wheelDelta < 0) {
// $nav.addClass('slideOutUp').removeClass('slideInDown')
// }else{
// $nav.addClass('slideInDown').removeClass('slideOutUp')
// }
// },200))
//
// // var $banner = $(".index-banner");
// //
// // $banner.height($win.height() - BANNERTOP)
// //
// // $win.resize(function () {
// // $banner.height($win.height() - BANNERTOP)
// // });
// }
// new Vue({
// el:'.browsers-list',
// render: h => h(require('../component/util/BrowsersList.vue'))
// })
// const easeFunctions = {
// easeInQuad: function (t, b, c, d) {
// t /= d;
// return c * t * t + b;
// },
// easeOutQuad: function (t, b, c, d) {
// t /= d;
// return -c * t* (t - 2) + b;
// }
// }
const moveTo = new __WEBPACK_IMPORTED_MODULE_53_moveto___default.a({
duration: 500
// ease: 'easeInQuad'
});
// }, easeFunctions);
moveTo.registerTrigger(document.querySelector('.footer .pull-right'));
if (true) {
const Raven = __webpack_require__(128);
Raven.config('https://ad49f4ae669d4910a5545dc5c109f19c@sentry.io/154193').install();
}
/***/ }),
/* 76 */
/***/ (function(module, exports) {
throw new Error("Module build failed: ModuleBuildError: Module build failed: \r\n\r\n font-weight: 500;\r\n color: @heading-color;\r\n ^\r\nVariable @heading-color is undefined\r\n in F:\\lx_new\\node_modules\\_vue-beauty@2.0.0-beta.4@vue-beauty\\vb\\components\\modal\\style\\modal.less (line 27, column 11)\n at runLoaders (F:\\lx_new\\node_modules\\_webpack@3.4.1@webpack\\lib\\NormalModule.js:194:19)\n at F:\\lx_new\\node_modules\\_loader-runner@2.3.0@loader-runner\\lib\\LoaderRunner.js:364:11\n at F:\\lx_new\\node_modules\\_loader-runner@2.3.0@loader-runner\\lib\\LoaderRunner.js:230:18\n at context.callback (F:\\lx_new\\node_modules\\_loader-runner@2.3.0@loader-runner\\lib\\LoaderRunner.js:111:13)\n at process._tickCallback (internal/process/next_tick.js:109:7)");
/***/ }),
/* 77 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 78 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 79 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 80 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 81 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 82 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 83 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 84 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 85 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 86 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 87 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 88 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 89 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 90 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 91 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 92 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 93 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 94 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 95 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 96 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 97 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 98 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 99 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 100 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 101 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 102 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 103 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 104 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 105 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 106 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 107 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/* ========================================================================
* Bootstrap: transition.js v3.3.7
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
})
}(jQuery);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 108 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/* ========================================================================
* Bootstrap: tab.js v3.3.7
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
// jscs:disable requireDollarBeforejQueryAssignment
this.element = $(element)
// jscs:enable requireDollarBeforejQueryAssignment
}
Tab.VERSION = '3.3.7'
Tab.TRANSITION_DURATION = 150
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var $previous = $ul.find('.active:last a')
var hideEvent = $.Event('hide.bs.tab', {
relatedTarget: $this[0]
})
var showEvent = $.Event('show.bs.tab', {
relatedTarget: $previous[0]
})
$previous.trigger(hideEvent)
$this.trigger(showEvent)
if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
$previous.trigger({
type: 'hidden.bs.tab',
relatedTarget: $this[0]
})
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: $previous[0]
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', false)
element
.addClass('active')
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu').length) {
element
.closest('li.dropdown')
.addClass('active')
.end()
.find('[data-toggle="tab"]')
.attr('aria-expanded', true)
}
callback && callback()
}
$active.length && transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(Tab.TRANSITION_DURATION) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tab
$.fn.tab = Plugin
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
var clickHandler = function (e) {
e.preventDefault()
Plugin.call($(this), 'show')
}
$(document)
.on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
.on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)
}(jQuery);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 109 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* JavaScript Cookie v2.1.4
* https://github.com/js-cookie/js-cookie
*
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
* Released under the MIT license
*/
;(function (factory) {
var registeredInModuleLoader = false;
if (true) {
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
__WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
registeredInModuleLoader = true;
}
if (true) {
module.exports = factory();
registeredInModuleLoader = true;
}
if (!registeredInModuleLoader) {
var OldCookies = window.Cookies;
var api = window.Cookies = factory();
api.noConflict = function () {
window.Cookies = OldCookies;
return api;
};
}
}(function () {
function extend () {
var i = 0;
var result = {};
for (; i < arguments.length; i++) {
var attributes = arguments[ i ];
for (var key in attributes) {
result[key] = attributes[key];
}
}
return result;
}
function init (converter) {
function api (key, value, attributes) {
var result;
if (typeof document === 'undefined') {
return;
}
// Write
if (arguments.length > 1) {
attributes = extend({
path: '/'
}, api.defaults, attributes);
if (typeof attributes.expires === 'number') {
var expires = new Date();
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
attributes.expires = expires;
}
// We're using "expires" because "max-age" is not supported by IE
attributes.expires = attributes.expires ? attributes.expires.toUTCString() : '';
try {
result = JSON.stringify(value);
if (/^[\{\[]/.test(result)) {
value = result;
}
} catch (e) {}
if (!converter.write) {
value = encodeURIComponent(String(value))
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
} else {
value = converter.write(value, key);
}
key = encodeURIComponent(String(key));
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
key = key.replace(/[\(\)]/g, escape);
var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue;
}
stringifiedAttributes += '; ' + attributeName;
if (attributes[attributeName] === true) {
continue;
}
stringifiedAttributes += '=' + attributes[attributeName];
}
return (document.cookie = key + '=' + value + stringifiedAttributes);
}
// Read
if (!key) {
result = {};
}
// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all. Also prevents odd result when
// calling "get()"
var cookies = document.cookie ? document.cookie.split('; ') : [];
var rdecode = /(%[0-9A-Z]{2})+/g;
var i = 0;
for (; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var cookie = parts.slice(1).join('=');
if (cookie.charAt(0) === '"') {
cookie = cookie.slice(1, -1);
}
try {
var name = parts[0].replace(rdecode, decodeURIComponent);
cookie = converter.read ?
converter.read(cookie, name) : converter(cookie, name) ||
cookie.replace(rdecode, decodeURIComponent);
if (this.json) {
try {
cookie = JSON.parse(cookie);
} catch (e) {}
}
if (key === name) {
result = cookie;
break;
}
if (!key) {
result[name] = cookie;
}
} catch (e) {}
}
return result;
}
api.set = api;
api.get = function (key) {
return api.call(api, key);
};
api.getJSON = function () {
return api.apply({
json: true
}, [].slice.call(arguments));
};
api.defaults = {};
api.remove = function (key, attributes) {
api(key, '', extend(attributes, {
expires: -1
}));
};
api.withConverter = init;
return api;
}
return init(function () {});
}));
/***/ }),
/* 110 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
// Register the namespace
window.FormValidation = {
AddOn: {}, // Add-ons
Framework: {}, // Supported frameworks
I18n: {}, // i18n
Validator: {} // Available validators
};
if (typeof jQuery === 'undefined') {
throw new Error('FormValidation requires jQuery');
}
(function($) {
var version = $.fn.jquery.split(' ')[0].split('.');
if ((+version[0] < 2 && +version[1] < 9) || (+version[0] === 1 && +version[1] === 9 && +version[2] < 1)) {
throw new Error('FormValidation requires jQuery version 1.9.1 or higher');
}
}(jQuery));
(function($) {
// TODO: Remove backward compatibility in v0.7.0
/**
* Constructor
*
* @param {jQuery|String} form The form element or selector
* @param {Object} options The options
* @param {String} [namespace] The optional namespace which is used for data-{namespace}-xxx attributes and internal data.
* Currently, it's used to support backward version
* @constructor
*/
FormValidation.Base = function(form, options, namespace) {
this.$form = $(form);
this.options = $.extend({}, $.fn.formValidation.DEFAULT_OPTIONS, options);
this._namespace = namespace || 'fv';
this.$invalidFields = $([]); // Array of invalid fields
this.$submitButton = null; // The submit button which is clicked to submit form
this.$hiddenButton = null;
// Validating status
this.STATUS_NOT_VALIDATED = 'NOT_VALIDATED';
this.STATUS_VALIDATING = 'VALIDATING';
this.STATUS_INVALID = 'INVALID';
this.STATUS_VALID = 'VALID';
this.STATUS_IGNORED = 'IGNORED';
// Determine the event that is fired when user change the field value
// Most modern browsers supports input event except IE 7, 8.
// IE 9 supports input event but the event is still not fired if I press the backspace key.
// Get IE version
// https://gist.github.com/padolsey/527683/#comment-7595
var ieVersion = (function() {
var v = 3, div = document.createElement('div'), a = div.all || [];
while (div.innerHTML = '<!--[if gt IE '+(++v)+']><br><![endif]-->', a[0]) {}
return v > 4 ? v : !v;
}());
var el = document.createElement('div');
this._changeEvent = (ieVersion === 9 || !('oninput' in el)) ? 'keyup' : 'input';
// The flag to indicate that the form is ready to submit when a remote/callback validator returns
this._submitIfValid = null;
// Field elements
this._cacheFields = {};
this._init();
};
FormValidation.Base.prototype = {
constructor: FormValidation.Base,
/**
* Check if the number of characters of field value exceed the threshold or not
*
* @param {jQuery} $field The field element
* @returns {Boolean}
*/
_exceedThreshold: function($field) {
var ns = this._namespace,
field = $field.attr('data-' + ns + '-field'),
threshold = this.options.fields[field].threshold || this.options.threshold;
if (!threshold) {
return true;
}
var cannotType = $.inArray($field.attr('type'), ['button', 'checkbox', 'file', 'hidden', 'image', 'radio', 'reset', 'submit']) !== -1;
return (cannotType || $field.val().length >= threshold);
},
/**
* Init form
*/
_init: function() {
var that = this,
ns = this._namespace,
options = {
addOns: {},
autoFocus: this.$form.attr('data-' + ns + '-autofocus'),
button: {
selector: this.$form.attr('data-' + ns + '-button-selector') || this.$form.attr('data-' + ns + '-submitbuttons'), // Support backward
disabled: this.$form.attr('data-' + ns + '-button-disabled')
},
control: {
valid: this.$form.attr('data-' + ns + '-control-valid'),
invalid: this.$form.attr('data-' + ns + '-control-invalid')
},
err: {
clazz: this.$form.attr('data-' + ns + '-err-clazz'),
container: this.$form.attr('data-' + ns + '-err-container') || this.$form.attr('data-' + ns + '-container'), // Support backward
parent: this.$form.attr('data-' + ns + '-err-parent')
},
events: {
formInit: this.$form.attr('data-' + ns + '-events-form-init'),
formError: this.$form.attr('data-' + ns + '-events-form-error'),
formSuccess: this.$form.attr('data-' + ns + '-events-form-success'),
fieldAdded: this.$form.attr('data-' + ns + '-events-field-added'),
fieldRemoved: this.$form.attr('data-' + ns + '-events-field-removed'),
fieldInit: this.$form.attr('data-' + ns + '-events-field-init'),
fieldError: this.$form.attr('data-' + ns + '-events-field-error'),
fieldSuccess: this.$form.attr('data-' + ns + '-events-field-success'),
fieldStatus: this.$form.attr('data-' + ns + '-events-field-status'),
localeChanged: this.$form.attr('data-' + ns + '-events-locale-changed'),
validatorError: this.$form.attr('data-' + ns + '-events-validator-error'),
validatorSuccess: this.$form.attr('data-' + ns + '-events-validator-success'),
validatorIgnored: this.$form.attr('data-' + ns + '-events-validator-ignored')
},
excluded: this.$form.attr('data-' + ns + '-excluded'),
icon: {
valid: this.$form.attr('data-' + ns + '-icon-valid') || this.$form.attr('data-' + ns + '-feedbackicons-valid'), // Support backward
invalid: this.$form.attr('data-' + ns + '-icon-invalid') || this.$form.attr('data-' + ns + '-feedbackicons-invalid'), // Support backward
validating: this.$form.attr('data-' + ns + '-icon-validating') || this.$form.attr('data-' + ns + '-feedbackicons-validating'), // Support backward
feedback: this.$form.attr('data-' + ns + '-icon-feedback')
},
live: this.$form.attr('data-' + ns + '-live'),
locale: this.$form.attr('data-' + ns + '-locale'),
message: this.$form.attr('data-' + ns + '-message'),
onError: this.$form.attr('data-' + ns + '-onerror'),
onSuccess: this.$form.attr('data-' + ns + '-onsuccess'),
row: {
selector: this.$form.attr('data-' + ns + '-row-selector') || this.$form.attr('data-' + ns + '-group'), // Support backward
valid: this.$form.attr('data-' + ns + '-row-valid'),
invalid: this.$form.attr('data-' + ns + '-row-invalid'),
feedback: this.$form.attr('data-' + ns + '-row-feedback')
},
threshold: this.$form.attr('data-' + ns + '-threshold'),
trigger: this.$form.attr('data-' + ns + '-trigger'),
verbose: this.$form.attr('data-' + ns + '-verbose'),
fields: {}
};
this.$form
// Disable client side validation in HTML 5
.attr('novalidate', 'novalidate')
.addClass(this.options.elementClass)
// Disable the default submission first
.on('submit.' + ns, function(e) {
e.preventDefault();
that.validate();
})
.on('click.' + ns, this.options.button.selector, function() {
that.$submitButton = $(this);
// The user just click the submit button
that._submitIfValid = true;
});
if (this.options.declarative === true || this.options.declarative === 'true') {
// Find all fields which have either "name" or "data-{namespace}-field" attribute
this.$form
.find('[name], [data-' + ns + '-field]')
.each(function () {
var $field = $(this),
field = $field.attr('name') || $field.attr('data-' + ns + '-field'),
opts = that._parseOptions($field);
if (opts) {
$field.attr('data-' + ns + '-field', field);
options.fields[field] = $.extend({}, opts, options.fields[field]);
}
});
}
this.options = $.extend(true, this.options, options);
// Normalize the err.parent option
if ('string' === typeof this.options.err.parent) {
this.options.err.parent = new RegExp(this.options.err.parent);
}
// Support backward
if (this.options.container) {
this.options.err.container = this.options.container;
delete this.options.container;
}
if (this.options.feedbackIcons) {
this.options.icon = $.extend(true, this.options.icon, this.options.feedbackIcons);
delete this.options.feedbackIcons;
}
if (this.options.group) {
this.options.row.selector = this.options.group;
delete this.options.group;
}
if (this.options.submitButtons) {
this.options.button.selector = this.options.submitButtons;
delete this.options.submitButtons;
}
// If the locale is not found, reset it to default one
if (!FormValidation.I18n[this.options.locale]) {
this.options.locale = $.fn.formValidation.DEFAULT_OPTIONS.locale;
}
// Parse the add-on options from HTML attributes
if (this.options.declarative === true || this.options.declarative === 'true') {
this.options = $.extend(true, this.options, { addOns: this._parseAddOnOptions() });
}
// When pressing Enter on any field in the form, the first submit button will do its job.
// The form then will be submitted.
// I create a first hidden submit button
this.$hiddenButton = $('<button/>')
.attr('type', 'submit')
.prependTo(this.$form)
.addClass('fv-hidden-submit')
.css({ display: 'none', width: 0, height: 0 });
this.$form
.on('click.' + this._namespace, '[type="submit"]', function(e) {
// #746: Check if the button click handler returns false
if (!e.isDefaultPrevented()) {
var $target = $(e.target),
// The button might contain HTML tag
$button = $target.is('[type="submit"]') ? $target.eq(0) : $target.parent('[type="submit"]').eq(0);
// Don't perform validation when clicking on the submit button/input
// which aren't defined by the 'button.selector' option
if (that.options.button.selector && !$button.is(that.options.button.selector) && !$button.is(that.$hiddenButton)) {
that.$form.off('submit.' + that._namespace).submit();
}
}
});
for (var field in this.options.fields) {
this._initField(field);
}
// Init the add-ons
for (var addOn in this.options.addOns) {
if ('function' === typeof FormValidation.AddOn[addOn].init) {
FormValidation.AddOn[addOn].init(this, this.options.addOns[addOn]);
}
}
this.$form.trigger($.Event(this.options.events.formInit), {
bv: this, // Support backward
fv: this,
options: this.options
});
// Prepare the events
if (this.options.onSuccess) {
this.$form.on(this.options.events.formSuccess, function(e) {
FormValidation.Helper.call(that.options.onSuccess, [e]);
});
}
if (this.options.onError) {
this.$form.on(this.options.events.formError, function(e) {
FormValidation.Helper.call(that.options.onError, [e]);
});
}
},
/**
* Init field
*
* @param {String|jQuery} field The field name or field element
*/
_initField: function(field) {
var ns = this._namespace,
fields = $([]);
switch (typeof field) {
case 'object':
fields = field;
field = field.attr('data-' + ns + '-field');
break;
case 'string':
fields = this.getFieldElements(field);
fields.attr('data-' + ns + '-field', field);
break;
default:
break;
}
// We don't need to validate non-existing fields
if (fields.length === 0) {
return;
}
if (this.options.fields[field] === null || this.options.fields[field].validators === null) {
return;
}
var validatorName;
for (validatorName in this.options.fields[field].validators) {
if (!FormValidation.Validator[validatorName]) {
delete this.options.fields[field].validators[validatorName];
}
}
if (this.options.fields[field].enabled === null) {
this.options.fields[field].enabled = true;
}
var that = this,
total = fields.length,
type = fields.attr('type'),
updateAll = (total === 1) || ('radio' === type) || ('checkbox' === type),
trigger = this._getFieldTrigger(fields.eq(0)),
events = $.map(trigger, function(item) {
return item + '.update.' + ns;
}).join(' ');
for (var i = 0; i < total; i++) {
var $field = fields.eq(i),
row = this.options.fields[field].row || this.options.row.selector,
$parent = $field.closest(row),
// Allow user to indicate where the error messages are shown
// Support backward
container = ('function' === typeof (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container))
? (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container).call(this, $field, this)
: (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container),
$message = (container && container !== 'tooltip' && container !== 'popover') ? $(container) : this._getMessageContainer($field, row);
if (container && container !== 'tooltip' && container !== 'popover') {
$message.addClass(this.options.err.clazz);
}
// Remove all error messages and feedback icons
$message.find('.' + this.options.err.clazz.split(' ').join('.') + '[data-' + ns + '-validator][data-' + ns + '-for="' + field + '"]').remove();
$parent.find('i[data-' + ns + '-icon-for="' + field + '"]').remove();
// Whenever the user change the field value, mark it as not validated yet
$field.off(events).on(events, function() {
that.updateStatus($(this), that.STATUS_NOT_VALIDATED);
});
// Create help block elements for showing the error messages
$field.data(ns + '.messages', $message);
for (validatorName in this.options.fields[field].validators) {
$field.data(ns + '.result.' + validatorName, this.STATUS_NOT_VALIDATED);
if (!updateAll || i === total - 1) {
$('<small/>')
.css('display', 'none')
.addClass(this.options.err.clazz)
.attr('data-' + ns + '-validator', validatorName)
.attr('data-' + ns + '-for', field)
.attr('data-' + ns + '-result', this.STATUS_NOT_VALIDATED)
.html(this._getMessage(field, validatorName))
.appendTo($message);
}
// Init the validator
if ('function' === typeof FormValidation.Validator[validatorName].init) {
FormValidation.Validator[validatorName].init(this, $field, this.options.fields[field].validators[validatorName]);
}
}
// Prepare the feedback icons
if (this.options.fields[field].icon !== false && this.options.fields[field].icon !== 'false'
&& this.options.icon
&& this.options.icon.valid && this.options.icon.invalid && this.options.icon.validating
&& (!updateAll || i === total - 1))
{
// $parent.removeClass(this.options.row.valid).removeClass(this.options.row.invalid).addClass(this.options.row.feedback);
// Keep error messages which are populated from back-end
$parent.addClass(this.options.row.feedback);
var $icon = $('<i/>')
.css('display', 'none')
.addClass(this.options.icon.feedback)
.attr('data-' + ns + '-icon-for', field)
.insertAfter($field);
// Store the icon as a data of field element
(!updateAll ? $field : fields).data(ns + '.icon', $icon);
if ('tooltip' === container || 'popover' === container) {
(!updateAll ? $field : fields)
.on(this.options.events.fieldError, function() {
$parent.addClass('fv-has-tooltip');
})
.on(this.options.events.fieldSuccess, function() {
$parent.removeClass('fv-has-tooltip');
});
$field
// Show tooltip/popover message when field gets focus
.off('focus.container.' + ns)
.on('focus.container.' + ns, function() {
that._showTooltip($field, container);
})
// and hide them when losing focus
.off('blur.container.' + ns)
.on('blur.container.' + ns, function() {
that._hideTooltip($field, container);
});
}
if ('string' === typeof this.options.fields[field].icon && this.options.fields[field].icon !== 'true') {
$icon.appendTo($(this.options.fields[field].icon));
} else {
this._fixIcon($field, $icon);
}
}
}
// Prepare the events
fields
.on(this.options.events.fieldSuccess, function(e, data) {
var onSuccess = that.getOptions(data.field, null, 'onSuccess');
if (onSuccess) {
FormValidation.Helper.call(onSuccess, [e, data]);
}
})
.on(this.options.events.fieldError, function(e, data) {
var onError = that.getOptions(data.field, null, 'onError');
if (onError) {
FormValidation.Helper.call(onError, [e, data]);
}
})
.on(this.options.events.fieldStatus, function(e, data) {
var onStatus = that.getOptions(data.field, null, 'onStatus');
if (onStatus) {
FormValidation.Helper.call(onStatus, [e, data]);
}
})
.on(this.options.events.validatorError, function(e, data) {
var onError = that.getOptions(data.field, data.validator, 'onError');
if (onError) {
FormValidation.Helper.call(onError, [e, data]);
}
})
.on(this.options.events.validatorSuccess, function(e, data) {
var onSuccess = that.getOptions(data.field, data.validator, 'onSuccess');
if (onSuccess) {
FormValidation.Helper.call(onSuccess, [e, data]);
}
});
// Set live mode
this.onLiveChange(fields, 'live', function() {
if (that._exceedThreshold($(this))) {
that.validateField($(this));
}
});
fields.trigger($.Event(this.options.events.fieldInit), {
bv: this, // Support backward
fv: this,
field: field,
element: fields
});
},
/**
* Check if the field is excluded.
* Returning true means that the field will not be validated
*
* @param {jQuery} $field The field element
* @returns {Boolean}
*/
_isExcluded: function($field) {
var ns = this._namespace,
excludedAttr = $field.attr('data-' + ns + '-excluded'),
// I still need to check the 'name' attribute while initializing the field
field = $field.attr('data-' + ns + '-field') || $field.attr('name');
switch (true) {
case (!!field && this.options.fields && this.options.fields[field] && (this.options.fields[field].excluded === 'true' || this.options.fields[field].excluded === true)):
case (excludedAttr === 'true'):
case (excludedAttr === ''):
return true;
case (!!field && this.options.fields && this.options.fields[field] && (this.options.fields[field].excluded === 'false' || this.options.fields[field].excluded === false)):
case (excludedAttr === 'false'):
return false;
case (!!field && this.options.fields && this.options.fields[field] && 'function' === typeof this.options.fields[field].excluded):
return this.options.fields[field].excluded.call(this, $field, this);
case (!!field && this.options.fields && this.options.fields[field] && 'string' === typeof this.options.fields[field].excluded):
case (excludedAttr):
return FormValidation.Helper.call(this.options.fields[field].excluded, [$field, this]);
default:
if (this.options.excluded) {
// Convert to array first
if ('string' === typeof this.options.excluded) {
this.options.excluded = $.map(this.options.excluded.split(','), function(item) {
// Trim the spaces
return $.trim(item);
});
}
var length = this.options.excluded.length;
for (var i = 0; i < length; i++) {
if (('string' === typeof this.options.excluded[i] && $field.is(this.options.excluded[i]))
|| ('function' === typeof this.options.excluded[i] && this.options.excluded[i].call(this, $field, this) === true))
{
return true;
}
}
}
return false;
}
},
/**
* Get a field changed trigger event
*
* @param {jQuery} $field The field element
* @returns {String[]} The event names triggered on field change
*/
_getFieldTrigger: function($field) {
var ns = this._namespace,
trigger = $field.data(ns + '.trigger');
if (trigger) {
return trigger;
}
var type = $field.attr('type'),
name = $field.attr('data-' + ns + '-field'),
event = ('radio' === type || 'checkbox' === type || 'file' === type || 'SELECT' === $field.get(0).tagName) ? 'change' : this._changeEvent;
trigger = ((this.options.fields[name] ? this.options.fields[name].trigger : null) || this.options.trigger || event).split(' ');
// Since the trigger data is used many times, I need to cache it to use later
$field.data(ns + '.trigger', trigger);
return trigger;
},
/**
* Get the error message for given field and validator
*
* @param {String} field The field name
* @param {String} validatorName The validator name
* @returns {String}
*/
_getMessage: function(field, validatorName) {
if (!this.options.fields[field] || !FormValidation.Validator[validatorName]
|| !this.options.fields[field].validators || !this.options.fields[field].validators[validatorName])
{
return '';
}
switch (true) {
case !!this.options.fields[field].validators[validatorName].message:
return this.options.fields[field].validators[validatorName].message;
case !!this.options.fields[field].message:
return this.options.fields[field].message;
case (!!FormValidation.I18n[this.options.locale] && !!FormValidation.I18n[this.options.locale][validatorName] && !!FormValidation.I18n[this.options.locale][validatorName]['default']):
return FormValidation.I18n[this.options.locale][validatorName]['default'];
default:
return this.options.message;
}
},
/**
* Get the element to place the error messages
*
* @param {jQuery} $field The field element
* @param {String} row
* @returns {jQuery}
*/
_getMessageContainer: function($field, row) {
if (!this.options.err.parent) {
throw new Error('The err.parent option is not defined');
}
var $parent = $field.parent();
if ($parent.is(row)) {
return $parent;
}
var cssClasses = $parent.attr('class');
if (!cssClasses) {
return this._getMessageContainer($parent, row);
}
if (this.options.err.parent.test(cssClasses)) {
return $parent;
}
return this._getMessageContainer($parent, row);
},
/**
* Parse the add-on options from HTML attributes
*
* @returns {Object}
*/
_parseAddOnOptions: function() {
var ns = this._namespace,
names = this.$form.attr('data-' + ns + '-addons'),
addOns = this.options.addOns || {};
if (names) {
names = names.replace(/\s/g, '').split(',');
for (var i = 0; i < names.length; i++) {
if (!addOns[names[i]]) {
addOns[names[i]] = {};
}
}
}
// Try to parse each add-on options
var addOn, attrMap, attr, option;
for (addOn in addOns) {
if (!FormValidation.AddOn[addOn]) {
// Add-on is not found
delete addOns[addOn];
continue;
}
attrMap = FormValidation.AddOn[addOn].html5Attributes;
if (attrMap) {
for (attr in attrMap) {
option = this.$form.attr('data-' + ns + '-addons-' + addOn.toLowerCase() + '-' + attr.toLowerCase());
if (option) {
addOns[addOn][attrMap[attr]] = option;
}
}
}
}
return addOns;
},
/**
* Parse the validator options from HTML attributes
*
* @param {jQuery} $field The field element
* @returns {Object}
*/
_parseOptions: function($field) {
var ns = this._namespace,
field = $field.attr('name') || $field.attr('data-' + ns + '-field'),
validators = {},
validator,
v, // Validator name
attrName,
enabled,
optionName,
optionAttrName,
optionValue,
html5AttrName,
html5AttrMap;
for (v in FormValidation.Validator) {
validator = FormValidation.Validator[v];
attrName = 'data-' + ns + '-' + v.toLowerCase(),
enabled = $field.attr(attrName) + '';
html5AttrMap = ('function' === typeof validator.enableByHtml5) ? validator.enableByHtml5($field) : null;
if ((html5AttrMap && enabled !== 'false')
|| (html5AttrMap !== true && ('' === enabled || 'true' === enabled || attrName === enabled.toLowerCase())))
{
// Try to parse the options via attributes
validator.html5Attributes = $.extend({}, {
message: 'message',
onerror: 'onError',
onsuccess: 'onSuccess',
transformer: 'transformer'
}, validator.html5Attributes);
validators[v] = $.extend({}, html5AttrMap === true ? {} : html5AttrMap, validators[v]);
for (html5AttrName in validator.html5Attributes) {
optionName = validator.html5Attributes[html5AttrName];
optionAttrName = 'data-' + ns + '-' + v.toLowerCase() + '-' + html5AttrName,
optionValue = $field.attr(optionAttrName);
if (optionValue) {
if ('true' === optionValue || optionAttrName === optionValue.toLowerCase()) {
optionValue = true;
} else if ('false' === optionValue) {
optionValue = false;
}
validators[v][optionName] = optionValue;
}
}
}
}
var opts = {
autoFocus: $field.attr('data-' + ns + '-autofocus'),
err: $field.attr('data-' + ns + '-err-container') || $field.attr('data-' + ns + '-container'), // Support backward
excluded: $field.attr('data-' + ns + '-excluded'),
icon: $field.attr('data-' + ns + '-icon') || $field.attr('data-' + ns + '-feedbackicons') || (this.options.fields && this.options.fields[field] ? this.options.fields[field].feedbackIcons : null), // Support backward
message: $field.attr('data-' + ns + '-message'),
onError: $field.attr('data-' + ns + '-onerror'),
onStatus: $field.attr('data-' + ns + '-onstatus'),
onSuccess: $field.attr('data-' + ns + '-onsuccess'),
row: $field.attr('data-' + ns + '-row') || $field.attr('data-' + ns + '-group') || (this.options.fields && this.options.fields[field] ? this.options.fields[field].group : null), // Support backward
selector: $field.attr('data-' + ns + '-selector'),
threshold: $field.attr('data-' + ns + '-threshold'),
transformer: $field.attr('data-' + ns + '-transformer'),
trigger: $field.attr('data-' + ns + '-trigger'),
verbose: $field.attr('data-' + ns + '-verbose'),
validators: validators
},
emptyOptions = $.isEmptyObject(opts), // Check if the field options are set using HTML attributes
emptyValidators = $.isEmptyObject(validators); // Check if the field validators are set using HTML attributes
if (!emptyValidators || (!emptyOptions && this.options.fields && this.options.fields[field])) {
opts.validators = validators;
return opts;
} else {
return null;
}
},
/**
* Called when all validations are completed
*/
_submit: function() {
var isValid = this.isValid();
if (isValid === null) {
return;
}
var eventType = isValid ? this.options.events.formSuccess : this.options.events.formError,
e = $.Event(eventType);
this.$form.trigger(e);
// Call default handler
// Check if whether the submit button is clicked
if (this.$submitButton) {
isValid ? this._onSuccess(e) : this._onError(e);
}
},
// ~~~~~~
// Events
// ~~~~~~
/**
* The default handler of error.form.fv event.
* It will be called when there is a invalid field
*
* @param {jQuery.Event} e The jQuery event object
*/
_onError: function(e) {
if (e.isDefaultPrevented()) {
return;
}
if ('submitted' === this.options.live) {
// Enable live mode
this.options.live = 'enabled';
var that = this;
for (var field in this.options.fields) {
(function(f) {
var fields = that.getFieldElements(f);
if (fields.length) {
that.onLiveChange(fields, 'live', function() {
if (that._exceedThreshold($(this))) {
that.validateField($(this));
}
});
}
})(field);
}
}
// Determined the first invalid field which will be focused on automatically
var ns = this._namespace;
for (var i = 0; i < this.$invalidFields.length; i++) {
var $field = this.$invalidFields.eq(i),
autoFocus = this.isOptionEnabled($field.attr('data-' + ns + '-field'), 'autoFocus');
if (autoFocus) {
// Focus the field
$field.focus();
break;
}
}
},
/**
* Called after validating a field element
*
* @param {jQuery} $field The field element
* @param {String} [validatorName] The validator name
*/
_onFieldValidated: function($field, validatorName) {
var ns = this._namespace,
field = $field.attr('data-' + ns + '-field'),
validators = this.options.fields[field].validators,
counter = {},
numValidators = 0,
data = {
bv: this, // Support backward
fv: this,
field: field,
element: $field,
validator: validatorName,
result: $field.data(ns + '.response.' + validatorName)
};
// Trigger an event after given validator completes
if (validatorName) {
switch ($field.data(ns + '.result.' + validatorName)) {
case this.STATUS_INVALID:
$field.trigger($.Event(this.options.events.validatorError), data);
break;
case this.STATUS_VALID:
$field.trigger($.Event(this.options.events.validatorSuccess), data);
break;
case this.STATUS_IGNORED:
$field.trigger($.Event(this.options.events.validatorIgnored), data);
break;
default:
break;
}
}
counter[this.STATUS_NOT_VALIDATED] = 0;
counter[this.STATUS_VALIDATING] = 0;
counter[this.STATUS_INVALID] = 0;
counter[this.STATUS_VALID] = 0;
counter[this.STATUS_IGNORED] = 0;
for (var v in validators) {
if (validators[v].enabled === false) {
continue;
}
numValidators++;
var result = $field.data(ns + '.result.' + v);
if (result) {
counter[result]++;
}
}
// The sum of valid fields now also include ignored fields
if (counter[this.STATUS_VALID] + counter[this.STATUS_IGNORED] === numValidators) {
// Remove from the list of invalid fields
this.$invalidFields = this.$invalidFields.not($field);
$field.trigger($.Event(this.options.events.fieldSuccess), data);
}
// If all validators are completed and there is at least one validator which doesn't pass
else if ((counter[this.STATUS_NOT_VALIDATED] === 0 || !this.isOptionEnabled(field, 'verbose')) && counter[this.STATUS_VALIDATING] === 0 && counter[this.STATUS_INVALID] > 0) {
// Add to the list of invalid fields
this.$invalidFields = this.$invalidFields.add($field);
$field.trigger($.Event(this.options.events.fieldError), data);
}
},
/**
* The default handler of success.form.fv event.
* It will be called when all the fields are valid
*
* @param {jQuery.Event} e The jQuery event object
*/
_onSuccess: function(e) {
if (e.isDefaultPrevented()) {
return;
}
// Submit the form
this.disableSubmitButtons(true).defaultSubmit();
},
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Abstract methods
// Need to be implemented by sub-class that supports specific framework
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* Specific framework might need to adjust the icon position
*
* @param {jQuery} $field The field element
* @param {jQuery} $icon The icon element
*/
_fixIcon: function($field, $icon) {
},
/**
* Create a tooltip or popover
* It will be shown when focusing on the field
*
* @param {jQuery} $field The field element
* @param {String} message The message
* @param {String} type Can be 'tooltip' or 'popover'
*/
_createTooltip: function($field, message, type) {
},
/**
* Destroy the tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_destroyTooltip: function($field, type) {
},
/**
* Hide a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_hideTooltip: function($field, type) {
},
/**
* Show a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_showTooltip: function($field, type) {
},
// ~~~~~~~~~~~~~~
// Public methods
// ~~~~~~~~~~~~~~
/**
* Submit the form using default submission.
* It also does not perform any validations when submitting the form
*/
defaultSubmit: function() {
var ns = this._namespace;
if (this.$submitButton) {
// Create hidden input to send the submit buttons
$('<input/>')
.attr({
'type': 'hidden',
name: this.$submitButton.attr('name')
})
.attr('data-' + ns + '-submit-hidden', '')
.val(this.$submitButton.val())
.appendTo(this.$form);
}
// Submit form
this.$form.off('submit.' + ns).submit();
},
/**
* Disable/enable submit buttons
*
* @param {Boolean} disabled Can be true or false
* @returns {FormValidation.Base}
*/
disableSubmitButtons: function(disabled) {
if (!disabled) {
this.$form
.find(this.options.button.selector)
.removeAttr('disabled')
.removeClass(this.options.button.disabled);
} else if (this.options.live !== 'disabled') {
// Don't disable if the live validating mode is disabled
this.$form
.find(this.options.button.selector)
.attr('disabled', 'disabled')
.addClass(this.options.button.disabled);
}
return this;
},
/**
* Retrieve the field elements by given name
*
* @param {String} field The field name
* @returns {null|jQuery[]}
*/
getFieldElements: function(field) {
if (!this._cacheFields[field]) {
if (this.options.fields[field] && this.options.fields[field].selector) {
// Look for the field inside the form first
var f = this.$form.find(this.options.fields[field].selector);
// If not found, search in entire document
this._cacheFields[field] = f.length ? f : $(this.options.fields[field].selector);
} else {
this._cacheFields[field] = this.$form.find('[name="' + field + '"]');
}
}
return this._cacheFields[field];
},
/**
* Get the field value after applying transformer
*
* @param {String|jQuery} field The field name or field element
* @param {String} validatorName The validator name
* @returns {String}
*/
getFieldValue: function(field, validatorName) {
var $field, ns = this._namespace;
if ('string' === typeof field) {
$field = this.getFieldElements(field);
if ($field.length === 0) {
return null;
}
} else {
$field = field;
field = $field.attr('data-' + ns + '-field');
}
if (!field || !this.options.fields[field]) {
return $field.val();
}
var transformer = (this.options.fields[field].validators && this.options.fields[field].validators[validatorName]
? this.options.fields[field].validators[validatorName].transformer : null)
|| this.options.fields[field].transformer;
return transformer ? FormValidation.Helper.call(transformer, [$field, validatorName, this]) : $field.val();
},
/**
* Get the namespace
*
* @returns {String}
*/
getNamespace: function() {
return this._namespace;
},
/**
* Get the field options
*
* @param {String|jQuery} [field] The field name or field element. If it is not set, the method returns the form options
* @param {String} [validator] The name of validator. It null, the method returns form options
* @param {String} [option] The option name
* @return {String|Object}
*/
getOptions: function(field, validator, option) {
var ns = this._namespace;
if (!field) {
return option ? this.options[option] : this.options;
}
if ('object' === typeof field) {
field = field.attr('data-' + ns + '-field');
}
if (!this.options.fields[field]) {
return null;
}
var options = this.options.fields[field];
if (!validator) {
return option ? options[option] : options;
}
if (!options.validators || !options.validators[validator]) {
return null;
}
return option ? options.validators[validator][option] : options.validators[validator];
},
/**
* Get the validating result of field
*
* @param {String|jQuery} field The field name or field element
* @param {String} validatorName The validator name
* @returns {String} The status. Can be 'NOT_VALIDATED', 'VALIDATING', 'INVALID', 'VALID' or 'IGNORED'
*/
getStatus: function(field, validatorName) {
var ns = this._namespace;
switch (typeof field) {
case 'object':
return field.data(ns + '.result.' + validatorName);
case 'string':
/* falls through */
default:
return this.getFieldElements(field).eq(0).data(ns + '.result.' + validatorName);
}
},
/**
* Check whether or not a field option is enabled
*
* @param {String} field The field name
* @param {String} option The option name, "verbose", "autoFocus", for example
* @returns {Boolean}
*/
isOptionEnabled: function(field, option) {
if (this.options.fields[field] && (this.options.fields[field][option] === 'true' || this.options.fields[field][option] === true)) {
return true;
}
if (this.options.fields[field] && (this.options.fields[field][option] === 'false' || this.options.fields[field][option] === false)) {
return false;
}
return this.options[option] === 'true' || this.options[option] === true;
},
/**
* Check the form validity
*
* @returns {Boolean|null} Returns one of three values
* - true, if all fields are valid
* - false, if there is one invalid field
* - null, if there is at least one field which is not validated yet or being validated
*/
isValid: function() {
for (var field in this.options.fields) {
var isValidField = this.isValidField(field);
if (isValidField === null) {
return null;
}
if (isValidField === false) {
return false;
}
}
return true;
},
/**
* Check if all fields inside a given container are valid.
* It's useful when working with a wizard-like such as tab, collapse
*
* @param {String|jQuery} container The container selector or element
* @returns {Boolean|null} Returns one of three values
* - true, if all fields inside the container are valid
* - false, if there is one invalid field inside the container
* - null, if the container consists of at least one field which is not validated yet or being validated
*/
isValidContainer: function(container) {
var that = this,
ns = this._namespace,
fields = [],
$container = ('string' === typeof container) ? $(container) : container;
if ($container.length === 0) {
return true;
}
$container.find('[data-' + ns + '-field]').each(function() {
var $field = $(this);
if (!that._isExcluded($field)) {
fields.push($field);
}
});
var total = fields.length;
for (var i = 0; i < total; i++) {
var $f = fields[i],
field = $f.attr('data-' + ns + '-field'),
$errors = $f.data(ns + '.messages')
.find('.' + this.options.err.clazz.split(' ').join('.') + '[data-' + ns + '-validator][data-' + ns + '-for="' + field + '"]');
if ($errors.filter('[data-' + ns + '-result="' + this.STATUS_INVALID + '"]').length > 0) {
return false;
}
// If the field is not validated
if ($errors.filter('[data-' + ns + '-result="' + this.STATUS_NOT_VALIDATED + '"]').length > 0
|| $errors.filter('[data-' + ns + '-result="' + this.STATUS_VALIDATING + '"]').length > 0)
{
return null;
}
}
return true;
},
/**
* Check if the field is valid or not
*
* @param {String|jQuery} field The field name or field element
* @returns {Boolean|null} Returns one of three values
* - true, if the field passes all validators
* - false, if the field doesn't pass any validator
* - null, if there is at least one validator which isn't validated yet or being validated
*/
isValidField: function(field) {
var ns = this._namespace,
fields = $([]);
switch (typeof field) {
case 'object':
fields = field;
field = field.attr('data-' + ns + '-field');
break;
case 'string':
fields = this.getFieldElements(field);
break;
default:
break;
}
if (fields.length === 0 || !this.options.fields[field] || this.options.fields[field].enabled === false) {
return true;
}
var type = fields.attr('type'),
total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length,
$field, validatorName, status;
for (var i = 0; i < total; i++) {
$field = fields.eq(i);
if (this._isExcluded($field)) {
continue;
}
for (validatorName in this.options.fields[field].validators) {
if (this.options.fields[field].validators[validatorName].enabled === false) {
continue;
}
status = $field.data(ns + '.result.' + validatorName);
if (status === this.STATUS_VALIDATING || status === this.STATUS_NOT_VALIDATED) {
return null;
} else if (status === this.STATUS_INVALID) {
return false;
}
}
}
return true;
},
/**
* Detach a handler function for a field live change event
*
* @param {jQuery[]} $fields The field elements
* @param {String} namespace The event namespace
* @returns {FormValidation.Base}
*/
offLiveChange: function($fields, namespace) {
if ($fields === null || $fields.length === 0) {
return this;
}
var ns = this._namespace,
trigger = this._getFieldTrigger($fields.eq(0)),
events = $.map(trigger, function(item) {
return item + '.' + namespace + '.' + ns;
}).join(' ');
$fields.off(events);
return this;
},
/**
* Attach a handler function for a field live change event
*
* @param {jQuery[]} $fields The field elements
* @param {String} namespace The event namespace
* @param {Function} handler The handler function
* @returns {FormValidation.Base}
*/
onLiveChange: function($fields, namespace, handler) {
if ($fields === null || $fields.length === 0) {
return this;
}
var ns = this._namespace,
trigger = this._getFieldTrigger($fields.eq(0)),
events = $.map(trigger, function(item) {
return item + '.' + namespace + '.' + ns;
}).join(' ');
switch (this.options.live) {
case 'submitted':
break;
case 'disabled':
$fields.off(events);
break;
case 'enabled':
/* falls through */
default:
$fields.off(events).on(events, function(e) {
handler.apply(this, arguments);
});
break;
}
return this;
},
/**
* Update the error message
*
* @param {String|jQuery} field The field name or field element
* @param {String} validator The validator name
* @param {String} message The message
* @returns {FormValidation.Base}
*/
updateMessage: function(field, validator, message) {
var that = this,
ns = this._namespace,
$fields = $([]);
switch (typeof field) {
case 'object':
$fields = field;
field = field.attr('data-' + ns + '-field');
break;
case 'string':
$fields = this.getFieldElements(field);
break;
default:
break;
}
$fields.each(function() {
$(this)
.data(ns + '.messages')
.find('.' + that.options.err.clazz + '[data-' + ns + '-validator="' + validator + '"][data-' + ns + '-for="' + field + '"]').html(message);
});
return this;
},
/**
* Update all validating results of field
*
* @param {String|jQuery} field The field name or field element
* @param {String} status The status. Can be 'NOT_VALIDATED', 'VALIDATING', 'INVALID', 'VALID' or 'IGNORED'
* @param {String} [validatorName] The validator name. If null, the method updates validity result for all validators
* @returns {FormValidation.Base}
*/
updateStatus: function(field, status, validatorName) {
var ns = this._namespace,
fields = $([]);
switch (typeof field) {
case 'object':
fields = field;
field = field.attr('data-' + ns + '-field');
break;
case 'string':
fields = this.getFieldElements(field);
break;
default:
break;
}
if (!field || !this.options.fields[field]) {
return this;
}
if (status === this.STATUS_NOT_VALIDATED) {
// Reset the flag
// To prevent the form from doing submit when a deferred validator returns true while typing
this._submitIfValid = false;
}
var that = this,
type = fields.attr('type'),
row = this.options.fields[field].row || this.options.row.selector,
total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length;
for (var i = 0; i < total; i++) {
var $field = fields.eq(i);
if (this._isExcluded($field)) {
continue;
}
var $parent = $field.closest(row),
$message = $field.data(ns + '.messages'),
$allErrors = $message.find('.' + this.options.err.clazz.split(' ').join('.') + '[data-' + ns + '-validator][data-' + ns + '-for="' + field + '"]'),
$errors = validatorName ? $allErrors.filter('[data-' + ns + '-validator="' + validatorName + '"]') : $allErrors,
$icon = $field.data(ns + '.icon'),
// Support backward
container = ('function' === typeof (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container))
? (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container).call(this, $field, this)
: (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container),
isValidField = null,
isValidating,
isNotValidated;
// Update status
if (validatorName) {
$field.data(ns + '.result.' + validatorName, status);
} else {
for (var v in this.options.fields[field].validators) {
$field.data(ns + '.result.' + v, status);
}
}
// Show/hide error elements and feedback icons
$errors.attr('data-' + ns + '-result', status);
switch (status) {
case this.STATUS_VALIDATING:
isValidField = null;
this.disableSubmitButtons(true);
$field.removeClass(this.options.control.valid).removeClass(this.options.control.invalid);
$parent.removeClass(this.options.row.valid).removeClass(this.options.row.invalid);
if ($icon) {
$icon.removeClass(this.options.icon.valid).removeClass(this.options.icon.invalid).addClass(this.options.icon.validating).show();
}
break;
case this.STATUS_INVALID:
isValidField = false;
this.disableSubmitButtons(true);
$field.removeClass(this.options.control.valid).addClass(this.options.control.invalid);
$parent.removeClass(this.options.row.valid).addClass(this.options.row.invalid);
if ($icon) {
$icon.removeClass(this.options.icon.valid).removeClass(this.options.icon.validating).addClass(this.options.icon.invalid).show();
}
break;
case this.STATUS_VALID:
case this.STATUS_IGNORED: // Treat ignored fields like they are valid with some specialties
isValidating = ($allErrors.filter('[data-' + ns + '-result="' + this.STATUS_VALIDATING +'"]').length > 0);
isNotValidated = ($allErrors.filter('[data-' + ns + '-result="' + this.STATUS_NOT_VALIDATED +'"]').length > 0);
// If the field is valid (passes all validators)
isValidField = (isValidating || isNotValidated) // There are some validators that have not done
? null
: ($allErrors.filter('[data-' + ns + '-result="' + this.STATUS_VALID +'"]').length
+ $allErrors.filter('[data-' + ns + '-result="' + this.STATUS_IGNORED +'"]').length === $allErrors.length); // All validators are completed
$field.removeClass(this.options.control.valid).removeClass(this.options.control.invalid);
if (isValidField === true) {
this.disableSubmitButtons(this.isValid() === false);
if (status === this.STATUS_VALID) {
$field.addClass(this.options.control.valid);
}
} else if (isValidField === false) {
this.disableSubmitButtons(true);
if (status === this.STATUS_VALID) {
$field.addClass(this.options.control.invalid);
}
}
if ($icon) {
$icon.removeClass(this.options.icon.invalid).removeClass(this.options.icon.validating).removeClass(this.options.icon.valid);
if (status === this.STATUS_VALID) {
$icon.addClass(isValidField === null
? '' : (isValidField ? this.options.icon.valid : (isValidating ? this.options.icon.validating : this.options.icon.invalid)))
.show();
}
}
var isValidContainer = this.isValidContainer($parent);
if (isValidContainer !== null) {
$parent.removeClass(this.options.row.valid).removeClass(this.options.row.invalid);
if (status === this.STATUS_VALID || $allErrors.length > 1) {
$parent.addClass(isValidContainer ? this.options.row.valid : this.options.row.invalid);
}
}
break;
case this.STATUS_NOT_VALIDATED:
/* falls through */
default:
isValidField = null;
this.disableSubmitButtons(false);
$field.removeClass(this.options.control.valid).removeClass(this.options.control.invalid);
$parent.removeClass(this.options.row.valid).removeClass(this.options.row.invalid);
if ($icon) {
$icon.removeClass(this.options.icon.valid).removeClass(this.options.icon.invalid).removeClass(this.options.icon.validating).hide();
}
break;
}
if ($icon && ('tooltip' === container || 'popover' === container)) {
(isValidField === false)
// Only show the first error message
? this._createTooltip($field, $allErrors.filter('[data-' + ns + '-result="' + that.STATUS_INVALID + '"]').eq(0).html(), container)
: this._destroyTooltip($field, container);
} else {
(status === this.STATUS_INVALID) ? $errors.show() : $errors.hide();
}
// Trigger an event
$field.trigger($.Event(this.options.events.fieldStatus), {
bv: this, // Support backward
fv: this,
field: field,
element: $field,
status: status
});
this._onFieldValidated($field, validatorName);
}
return this;
},
/**
* Validate the form
*
* @returns {FormValidation.Base}
*/
validate: function() {
if ($.isEmptyObject(this.options.fields)) {
this._submit();
return this;
}
this.disableSubmitButtons(true);
this._submitIfValid = false;
for (var field in this.options.fields) {
this.validateField(field);
}
this._submit();
this._submitIfValid = true;
return this;
},
/**
* Validate given field
*
* @param {String|jQuery} field The field name or field element
* @returns {FormValidation.Base}
*/
validateField: function(field) {
var ns = this._namespace,
fields = $([]);
switch (typeof field) {
case 'object':
fields = field;
field = field.attr('data-' + ns + '-field');
break;
case 'string':
fields = this.getFieldElements(field);
break;
default:
break;
}
if (fields.length === 0 || !this.options.fields[field] || this.options.fields[field].enabled === false) {
return this;
}
var that = this,
type = fields.attr('type'),
total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length,
updateAll = ('radio' === type || 'checkbox' === type),
validators = this.options.fields[field].validators,
verbose = this.isOptionEnabled(field, 'verbose'),
validatorName,
validateResult;
for (var i = 0; i < total; i++) {
var $field = fields.eq(i);
if (this._isExcluded($field)) {
continue;
}
var stop = false;
for (validatorName in validators) {
if ($field.data(ns + '.dfs.' + validatorName)) {
$field.data(ns + '.dfs.' + validatorName).reject();
}
if (stop) {
break;
}
// Don't validate field if it is already done
var result = $field.data(ns + '.result.' + validatorName);
if (result === this.STATUS_VALID || result === this.STATUS_INVALID) {
this._onFieldValidated($field, validatorName);
continue;
} else if (validators[validatorName].enabled === false) {
this.updateStatus(updateAll ? field : $field, this.STATUS_VALID, validatorName);
continue;
}
$field.data(ns + '.result.' + validatorName, this.STATUS_VALIDATING);
validateResult = FormValidation.Validator[validatorName].validate(this, $field, validators[validatorName]);
// validateResult can be a $.Deferred object ...
if ('object' === typeof validateResult && validateResult.resolve) {
this.updateStatus(updateAll ? field : $field, this.STATUS_VALIDATING, validatorName);
$field.data(ns + '.dfs.' + validatorName, validateResult);
validateResult.done(function($f, v, response) {
// v is validator name
$f.removeData(ns + '.dfs.' + v).data(ns + '.response.' + v, response);
if (response.message) {
that.updateMessage($f, v, response.message);
}
that.updateStatus(updateAll ? $f.attr('data-' + ns + '-field') : $f,
response.valid === true ? that.STATUS_VALID : (response.valid === false ? that.STATUS_INVALID : that.STATUS_IGNORED),
v);
if (response.valid && that._submitIfValid === true) {
// If a remote validator returns true and the form is ready to submit, then do it
that._submit();
} else if (response.valid === false && !verbose) {
stop = true;
}
});
}
// ... or object { valid: true/false/null, message: 'dynamic message', otherKey: value, ... }
else if ('object' === typeof validateResult && validateResult.valid !== undefined) {
$field.data(ns + '.response.' + validatorName, validateResult);
if (validateResult.message) {
this.updateMessage(updateAll ? field : $field, validatorName, validateResult.message);
}
this.updateStatus(updateAll ? field : $field,
validateResult.valid === true ? this.STATUS_VALID : (validateResult.valid === false ? this.STATUS_INVALID : this.STATUS_IGNORED),
validatorName);
if (validateResult.valid === false && !verbose) {
break;
}
}
// ... or a boolean value
else if ('boolean' === typeof validateResult) {
$field.data(ns + '.response.' + validatorName, validateResult);
this.updateStatus(updateAll ? field : $field, validateResult ? this.STATUS_VALID : this.STATUS_INVALID, validatorName);
if (!validateResult && !verbose) {
break;
}
}
// ... or null/undefined
// to indicate that the field should be ignored for current validation
else if (null === validateResult || undefined === validateResult) {
$field.data(ns + '.response.' + validatorName, validateResult);
this.updateStatus(updateAll ? field : $field, this.STATUS_IGNORED, validatorName);
}
}
}
return this;
},
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Useful APIs which aren't used internally
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* Add a new field
*
* @param {String|jQuery} field The field name or field element
* @param {Object} [options] The validator rules
* @returns {FormValidation.Base}
*/
addField: function(field, options) {
var ns = this._namespace,
fields = $([]);
switch (typeof field) {
case 'object':
fields = field;
field = field.attr('data-' + ns + '-field') || field.attr('name');
break;
case 'string':
delete this._cacheFields[field];
fields = this.getFieldElements(field);
break;
default:
break;
}
fields.attr('data-' + ns + '-field', field);
var type = fields.attr('type'),
total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length;
for (var i = 0; i < total; i++) {
var $field = fields.eq(i);
// Try to parse the options from HTML attributes
var opts = this._parseOptions($field);
opts = (opts === null) ? options : $.extend(true, opts, options);
this.options.fields[field] = $.extend(true, this.options.fields[field], opts);
// Update the cache
this._cacheFields[field] = this._cacheFields[field] ? this._cacheFields[field].add($field) : $field;
// Init the element
this._initField(('checkbox' === type || 'radio' === type) ? field : $field);
}
this.disableSubmitButtons(false);
// Trigger an event
this.$form.trigger($.Event(this.options.events.fieldAdded), {
field: field,
element: fields,
options: this.options.fields[field]
});
return this;
},
/**
* Destroy the plugin
* It will remove all error messages, feedback icons and turn off the events
*/
destroy: function() {
var ns = this._namespace, i, field, fields, $field, validator, $icon, row;
// Destroy the validators first
for (field in this.options.fields) {
fields = this.getFieldElements(field);
for (i = 0; i < fields.length; i++) {
$field = fields.eq(i);
for (validator in this.options.fields[field].validators) {
if ($field.data(ns + '.dfs.' + validator)) {
$field.data(ns + '.dfs.' + validator).reject();
}
$field.removeData(ns + '.result.' + validator)
.removeData(ns + '.response.' + validator)
.removeData(ns + '.dfs.' + validator);
// Destroy the validator
if ('function' === typeof FormValidation.Validator[validator].destroy) {
FormValidation.Validator[validator].destroy(this, $field, this.options.fields[field].validators[validator]);
}
}
}
}
// Remove messages and icons
for (field in this.options.fields) {
fields = this.getFieldElements(field);
row = this.options.fields[field].row || this.options.row.selector;
for (i = 0; i < fields.length; i++) {
$field = fields.eq(i);
$field
// Remove all error messages
.data(ns + '.messages')
.find('.' + this.options.err.clazz.split(' ').join('.') + '[data-' + ns + '-validator][data-' + ns + '-for="' + field + '"]').remove().end()
.end()
.removeData(ns + '.messages')
// Remove feedback classes
.closest(row)
.removeClass(this.options.row.valid)
.removeClass(this.options.row.invalid)
.removeClass(this.options.row.feedback)
.end()
// Turn off events
.off('.' + ns)
.removeAttr('data-' + ns + '-field');
// Remove feedback icons, tooltip/popover container
// Support backward
var container = ('function' === typeof (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container))
? (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container).call(this, $field, this)
: (this.options.fields[field].container || this.options.fields[field].err || this.options.err.container);
if ('tooltip' === container || 'popover' === container) {
this._destroyTooltip($field, container);
}
$icon = $field.data(ns + '.icon');
if ($icon) {
$icon.remove();
}
$field.removeData(ns + '.icon')
// It's safe to remove trigger data here, because it might be used when destroying the validator
.removeData(ns + '.trigger');
}
}
// Destroy the add-ons
for (var addOn in this.options.addOns) {
if ('function' === typeof FormValidation.AddOn[addOn].destroy) {
FormValidation.AddOn[addOn].destroy(this, this.options.addOns[addOn]);
}
}
this.disableSubmitButtons(false); // Enable submit buttons
this.$hiddenButton.remove(); // Remove the hidden button
this.$form
.removeClass(this.options.elementClass)
.off('.' + ns)
.removeData('bootstrapValidator') // Support backward
.removeData('formValidation')
// Remove generated hidden elements
.find('[data-' + ns + '-submit-hidden]').remove().end()
.find('[type="submit"]')
.off('click.' + ns);
},
/**
* Enable/Disable all validators to given field
*
* @param {String} field The field name
* @param {Boolean} enabled Enable/Disable field validators
* @param {String} [validatorName] The validator name. If null, all validators will be enabled/disabled
* @returns {FormValidation.Base}
*/
enableFieldValidators: function(field, enabled, validatorName) {
var validators = this.options.fields[field].validators;
// Enable/disable particular validator
if (validatorName
&& validators
&& validators[validatorName] && validators[validatorName].enabled !== enabled)
{
this.options.fields[field].validators[validatorName].enabled = enabled;
this.updateStatus(field, this.STATUS_NOT_VALIDATED, validatorName);
}
// Enable/disable all validators
else if (!validatorName && this.options.fields[field].enabled !== enabled) {
this.options.fields[field].enabled = enabled;
for (var v in validators) {
this.enableFieldValidators(field, enabled, v);
}
}
return this;
},
/**
* Some validators have option which its value is dynamic.
* For example, the zipCode validator has the country option which might be changed dynamically by a select element.
*
* @param {jQuery|String} field The field name or element
* @param {String|Function} option The option which can be determined by:
* - a string
* - name of field which defines the value
* - name of function which returns the value
* - a function returns the value
*
* The callback function has the format of
* callback: function(value, validator, $field) {
* // value is the value of field
* // validator is the BootstrapValidator instance
* // $field is the field element
* }
*
* @returns {String}
*/
getDynamicOption: function(field, option) {
var $field = ('string' === typeof field) ? this.getFieldElements(field) : field,
value = $field.val();
// Option can be determined by
// ... a function
if ('function' === typeof option) {
return FormValidation.Helper.call(option, [value, this, $field]);
}
// ... value of other field
else if ('string' === typeof option) {
var $f = this.getFieldElements(option);
if ($f.length) {
return $f.val();
}
// ... return value of callback
else {
return FormValidation.Helper.call(option, [value, this, $field]) || option;
}
}
return null;
},
/**
* Get the form element
*
* @returns {jQuery}
*/
getForm: function() {
return this.$form;
},
/**
* Get the list of invalid fields
*
* @returns {jQuery[]}
*/
getInvalidFields: function() {
return this.$invalidFields;
},
/**
* Get the current locale
*
* @return {String}
*/
getLocale: function() {
return this.options.locale;
},
/**
* Get the error messages
*
* @param {String|jQuery} [field] The field name or field element
* If the field is not defined, the method returns all error messages of all fields
* @param {String} [validator] The name of validator
* If the validator is not defined, the method returns error messages of all validators
* @returns {String[]}
*/
getMessages: function(field, validator) {
var that = this,
ns = this._namespace,
messages = [],
$fields = $([]);
switch (true) {
case (field && 'object' === typeof field):
$fields = field;
break;
case (field && 'string' === typeof field):
var f = this.getFieldElements(field);
if (f.length > 0) {
var type = f.attr('type');
$fields = ('radio' === type || 'checkbox' === type) ? f.eq(0) : f;
}
break;
default:
$fields = this.$invalidFields;
break;
}
var filter = validator ? '[data-' + ns + '-validator="' + validator + '"]' : '';
$fields.each(function() {
messages = messages.concat(
$(this)
.data(ns + '.messages')
.find('.' + that.options.err.clazz + '[data-' + ns + '-for="' + $(this).attr('data-' + ns + '-field') + '"][data-' + ns + '-result="' + that.STATUS_INVALID + '"]' + filter)
.map(function() {
var v = $(this).attr('data-' + ns + '-validator'),
f = $(this).attr('data-' + ns + '-for');
return (that.options.fields[f].validators[v].enabled === false) ? '' : $(this).html();
})
.get()
);
});
return messages;
},
/**
* Returns the clicked submit button
*
* @returns {jQuery}
*/
getSubmitButton: function() {
return this.$submitButton;
},
/**
* Remove a given field
*
* @param {String|jQuery} field The field name or field element
* @returns {FormValidation.Base}
*/
removeField: function(field) {
var ns = this._namespace,
fields = $([]);
switch (typeof field) {
case 'object':
fields = field;
field = field.attr('data-' + ns + '-field') || field.attr('name');
fields.attr('data-' + ns + '-field', field);
break;
case 'string':
fields = this.getFieldElements(field);
break;
default:
break;
}
if (fields.length === 0) {
return this;
}
var type = fields.attr('type'),
total = ('radio' === type || 'checkbox' === type) ? 1 : fields.length;
for (var i = 0; i < total; i++) {
var $field = fields.eq(i);
// Remove from the list of invalid fields
this.$invalidFields = this.$invalidFields.not($field);
// Update the cache
this._cacheFields[field] = this._cacheFields[field].not($field);
}
if (!this._cacheFields[field] || this._cacheFields[field].length === 0) {
delete this.options.fields[field];
}
if ('checkbox' === type || 'radio' === type) {
this._initField(field);
}
this.disableSubmitButtons(false);
// Trigger an event
this.$form.trigger($.Event(this.options.events.fieldRemoved), {
field: field,
element: fields
});
return this;
},
/**
* Reset given field
*
* @param {String|jQuery} field The field name or field element
* @param {Boolean} [resetValue] If true, the method resets field value to empty or remove checked/selected attribute (for radio/checkbox)
* @returns {FormValidation.Base}
*/
resetField: function(field, resetValue) {
var ns = this._namespace,
$fields = $([]);
switch (typeof field) {
case 'object':
$fields = field;
field = field.attr('data-' + ns + '-field');
break;
case 'string':
$fields = this.getFieldElements(field);
break;
default:
break;
}
var total = $fields.length;
if (this.options.fields[field]) {
for (var i = 0; i < total; i++) {
for (var validator in this.options.fields[field].validators) {
$fields.eq(i).removeData(ns + '.dfs.' + validator);
}
}
}
if (resetValue) {
var type = $fields.attr('type');
('radio' === type || 'checkbox' === type) ? $fields.prop('checked', false).removeAttr('selected') : $fields.val('');
}
// Mark field as not validated yet
this.updateStatus(field, this.STATUS_NOT_VALIDATED);
return this;
},
/**
* Reset the form
*
* @param {Boolean} [resetValue] If true, the method resets field value to empty or remove checked/selected attribute (for radio/checkbox)
* @returns {FormValidation.Base}
*/
resetForm: function(resetValue) {
for (var field in this.options.fields) {
this.resetField(field, resetValue);
}
this.$invalidFields = $([]);
this.$submitButton = null;
// Enable submit buttons
this.disableSubmitButtons(false);
return this;
},
/**
* Revalidate given field
* It's used when you need to revalidate the field which its value is updated by other plugin
*
* @param {String|jQuery} field The field name of field element
* @returns {FormValidation.Base}
*/
revalidateField: function(field) {
this.updateStatus(field, this.STATUS_NOT_VALIDATED)
.validateField(field);
return this;
},
/**
* Set the locale
*
* @param {String} locale The locale in format of countrycode_LANGUAGECODE
* @returns {FormValidation.Base}
*/
setLocale: function(locale) {
this.options.locale = locale;
this.$form.trigger($.Event(this.options.events.localeChanged), {
locale: locale,
bv: this, // Support backward
fv: this
});
return this;
},
/**
* Update the option of a specific validator
*
* @param {String|jQuery} field The field name or field element
* @param {String} validator The validator name
* @param {String} option The option name
* @param {String} value The value to set
* @returns {FormValidation.Base}
*/
updateOption: function(field, validator, option, value) {
var ns = this._namespace;
if ('object' === typeof field) {
field = field.attr('data-' + ns + '-field');
}
if (this.options.fields[field] && this.options.fields[field].validators[validator]) {
this.options.fields[field].validators[validator][option] = value;
this.updateStatus(field, this.STATUS_NOT_VALIDATED, validator);
}
return this;
},
/**
* Validate given container
* It can be used with isValidContainer() when you want to work with wizard form
*
* @param {String|jQuery} container The container selector or element
* @returns {FormValidation.Base}
*/
validateContainer: function(container) {
var that = this,
ns = this._namespace,
fields = [],
$container = ('string' === typeof container) ? $(container) : container;
if ($container.length === 0) {
return this;
}
$container.find('[data-' + ns + '-field]').each(function() {
var $field = $(this);
if (!that._isExcluded($field)) {
fields.push($field);
}
});
var total = fields.length;
for (var i = 0; i < total; i++) {
this.validateField(fields[i]);
}
return this;
}
};
// Plugin definition
$.fn.formValidation = function(option) {
var params = arguments;
return this.each(function() {
var $this = $(this),
data = $this.data('formValidation'),
options = 'object' === typeof option && option;
if (!data) {
var framework = (options.framework || $this.attr('data-fv-framework') || 'bootstrap').toLowerCase(),
clazz = framework.substr(0, 1).toUpperCase() + framework.substr(1);
if (typeof FormValidation.Framework[clazz] === 'undefined') {
throw new Error('The class FormValidation.Framework.' + clazz + ' is not implemented');
}
data = new FormValidation.Framework[clazz](this, options);
$this.addClass('fv-form-' + framework)
.data('formValidation', data);
}
// Allow to call plugin method
if ('string' === typeof option) {
data[option].apply(data, Array.prototype.slice.call(params, 1));
}
});
};
$.fn.formValidation.Constructor = FormValidation.Base;
// The default options
// Sorted in alphabetical order
$.fn.formValidation.DEFAULT_OPTIONS = {
// The first invalid field will be focused automatically
autoFocus: true,
// Support declarative usage (setting options via HTML 5 attributes)
// Setting to false can improve the performance
declarative: true,
// The form CSS class
elementClass: 'fv-form',
// Use custom event name to avoid window.onerror being invoked by jQuery
// See #630
events: {
// Support backward
formInit: 'init.form.fv',
formError: 'err.form.fv',
formSuccess: 'success.form.fv',
fieldAdded: 'added.field.fv',
fieldRemoved: 'removed.field.fv',
fieldInit: 'init.field.fv',
fieldError: 'err.field.fv',
fieldSuccess: 'success.field.fv',
fieldStatus: 'status.field.fv',
localeChanged: 'changed.locale.fv',
validatorError: 'err.validator.fv',
validatorSuccess: 'success.validator.fv',
validatorIgnored: 'ignored.validator.fv'
},
// Indicate fields which won't be validated
// By default, the plugin will not validate the following kind of fields:
// - disabled
// - hidden
// - invisible
//
// The setting consists of jQuery filters. Accept 3 formats:
// - A string. Use a comma to separate filter
// - An array. Each element is a filter
// - An array. Each element can be a callback function
// function($field, validator) {
// $field is jQuery object representing the field element
// validator is the BootstrapValidator instance
// return true or false;
// }
//
// The 3 following settings are equivalent:
//
// 1) ':disabled, :hidden, :not(:visible)'
// 2) [':disabled', ':hidden', ':not(:visible)']
// 3) [':disabled', ':hidden', function($field) {
// return !$field.is(':visible');
// }]
excluded: [':disabled', ':hidden', ':not(:visible)'],
// Map the field name with validator rules
fields: null,
// Live validating option
// Can be one of 3 values:
// - enabled: The plugin validates fields as soon as they are changed
// - disabled: Disable the live validating. The error messages are only shown after the form is submitted
// - submitted: The live validating is enabled after the form is submitted
live: 'enabled',
// Locale in the format of languagecode_COUNTRYCODE
locale: 'en_US',
// Default invalid message
message: 'This value is not valid',
// The field will not be live validated if its length is less than this number of characters
threshold: null,
// Whether to be verbose when validating a field or not.
// Possible values:
// - true: when a field has multiple validators, all of them will be checked, and respectively - if errors occur in
// multiple validators, all of them will be displayed to the user
// - false: when a field has multiple validators, validation for this field will be terminated upon the first encountered error.
// Thus, only the very first error message related to this field will be displayed to the user
verbose: true,
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// These options mostly are overridden by specific framework
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
button: {
// The submit buttons selector
// These buttons will be disabled to prevent the valid form from multiple submissions
selector: '[type="submit"]',
// The disabled class
disabled: ''
},
control: {
// The CSS class for valid control
valid: '',
// The CSS class for invalid control
invalid: ''
},
err: {
// The CSS class of each message element
clazz: '',
// The error messages container. It can be:
// - 'tooltip' if you want to use Bootstrap tooltip to show error messages
// - 'popover' if you want to use Bootstrap popover to show error messages
// - a CSS selector indicating the container
// In the first two cases, since the tooltip/popover should be small enough, the plugin only shows only one error message
// You also can define the message container for particular field
container: null,
// Used to determine where the messages are placed
parent: null
},
// Shows ok/error/loading icons based on the field validity.
icon: {
valid: null,
invalid: null,
validating: null,
feedback: ''
},
row: {
// The CSS selector for indicating the element consists of the field
// You should adjust this option if your form group consists of many fields which not all of them need to be validated
selector: null,
valid: '',
invalid: '',
feedback: ''
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 111 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
// Helper methods, which can be used in validator class
FormValidation.Helper = {
/**
* Execute a callback function
*
* @param {String|Function} functionName Can be
* - name of global function
* - name of namespace function (such as A.B.C)
* - a function
* @param {Array} args The callback arguments
*/
call: function(functionName, args) {
if ('function' === typeof functionName) {
return functionName.apply(this, args);
} else if ('string' === typeof functionName) {
if ('()' === functionName.substring(functionName.length - 2)) {
functionName = functionName.substring(0, functionName.length - 2);
}
var ns = functionName.split('.'),
func = ns.pop(),
context = window;
for (var i = 0; i < ns.length; i++) {
context = context[ns[i]];
}
return (typeof context[func] === 'undefined') ? null : context[func].apply(this, args);
}
},
/**
* Validate a date
*
* @param {Number} year The full year in 4 digits
* @param {Number} month The month number
* @param {Number} day The day number
* @param {Boolean} [notInFuture] If true, the date must not be in the future
* @returns {Boolean}
*/
date: function(year, month, day, notInFuture) {
if (isNaN(year) || isNaN(month) || isNaN(day)) {
return false;
}
if (day.length > 2 || month.length > 2 || year.length > 4) {
return false;
}
day = parseInt(day, 10);
month = parseInt(month, 10);
year = parseInt(year, 10);
if (year < 1000 || year > 9999 || month <= 0 || month > 12) {
return false;
}
var numDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
// Update the number of days in Feb of leap year
if (year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0)) {
numDays[1] = 29;
}
// Check the day
if (day <= 0 || day > numDays[month - 1]) {
return false;
}
if (notInFuture === true) {
var currentDate = new Date(),
currentYear = currentDate.getFullYear(),
currentMonth = currentDate.getMonth(),
currentDay = currentDate.getDate();
return (year < currentYear
|| (year === currentYear && month - 1 < currentMonth)
|| (year === currentYear && month - 1 === currentMonth && day < currentDay));
}
return true;
},
/**
* Format a string
* It's used to format the error message
* format('The field must between %s and %s', [10, 20]) = 'The field must between 10 and 20'
*
* @param {String} message
* @param {Array} parameters
* @returns {String}
*/
format: function(message, parameters) {
if (!$.isArray(parameters)) {
parameters = [parameters];
}
for (var i in parameters) {
message = message.replace('%s', parameters[i]);
}
return message;
},
/**
* Implement Luhn validation algorithm
* Credit to https://gist.github.com/ShirtlessKirk/2134376
*
* @see http://en.wikipedia.org/wiki/Luhn
* @param {String} value
* @returns {Boolean}
*/
luhn: function(value) {
var length = value.length,
mul = 0,
prodArr = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]],
sum = 0;
while (length--) {
sum += prodArr[mul][parseInt(value.charAt(length), 10)];
mul ^= 1;
}
return (sum % 10 === 0 && sum > 0);
},
/**
* Implement modulus 11, 10 (ISO 7064) algorithm
*
* @param {String} value
* @returns {Boolean}
*/
mod11And10: function(value) {
var check = 5,
length = value.length;
for (var i = 0; i < length; i++) {
check = (((check || 10) * 2) % 11 + parseInt(value.charAt(i), 10)) % 10;
}
return (check === 1);
},
/**
* Implements Mod 37, 36 (ISO 7064) algorithm
* Usages:
* mod37And36('A12425GABC1234002M')
* mod37And36('002006673085', '0123456789')
*
* @param {String} value
* @param {String} [alphabet]
* @returns {Boolean}
*/
mod37And36: function(value, alphabet) {
alphabet = alphabet || '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var modulus = alphabet.length,
length = value.length,
check = Math.floor(modulus / 2);
for (var i = 0; i < length; i++) {
check = (((check || modulus) * 2) % (modulus + 1) + alphabet.indexOf(value.charAt(i))) % modulus;
}
return (check === 1);
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 112 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* digits validator
*
* @link http://formvalidation.io/validators/digits/
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
'en_US': {
digits: {
'default': 'Please enter only digits'
}
}
});
FormValidation.Validator.digits = {
/**
* Return true if the input value contains digits only
*
* @param {FormValidation.Base} validator Validate plugin instance
* @param {jQuery} $field Field element
* @param {Object} [options]
* @returns {Boolean}
*/
validate: function(validator, $field, options) {
var value = validator.getFieldValue($field, 'digits');
if (value === '') {
return true;
}
return /^\d+$/.test(value);
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* numeric validator
*
* @link http://formvalidation.io/validators/numeric/
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
'en_US': {
numeric: {
'default': 'Please enter a valid float number'
}
}
});
FormValidation.Validator.numeric = {
html5Attributes: {
message: 'message',
separator: 'separator'
},
enableByHtml5: function($field) {
return ('number' === $field.attr('type')) && ($field.attr('step') !== undefined) && ($field.attr('step') % 1 !== 0);
},
/**
* Validate decimal number
*
* @param {FormValidation.Base} validator The validator plugin instance
* @param {jQuery} $field Field element
* @param {Object} options Consist of key:
* - message: The invalid message
* - separator: The decimal separator. Can be "." (default), ","
* @returns {Boolean}
*/
validate: function(validator, $field, options) {
if (this.enableByHtml5($field) && $field.get(0).validity && $field.get(0).validity.badInput === true) {
return false;
}
var value = validator.getFieldValue($field, 'numeric');
if (value === '') {
return true;
}
var separator = options.separator || '.';
if (separator !== '.') {
value = value.replace(separator, '.');
}
return !isNaN(parseFloat(value)) && isFinite(value);
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 114 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* notEmpty validator
*
* @link http://formvalidation.io/validators/notEmpty/
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
'en_US': {
notEmpty: {
'default': 'Please enter a value'
}
}
});
FormValidation.Validator.notEmpty = {
enableByHtml5: function($field) {
var required = $field.attr('required') + '';
return ('required' === required || 'true' === required);
},
/**
* Check if input value is empty or not
*
* @param {FormValidation.Base} validator The validator plugin instance
* @param {jQuery} $field Field element
* @param {Object} options
* @returns {Boolean}
*/
validate: function(validator, $field, options) {
var type = $field.attr('type');
if ('radio' === type || 'checkbox' === type) {
var ns = validator.getNamespace();
return validator
.getFieldElements($field.attr('data-' + ns + '-field'))
.filter(':checked')
.length > 0;
}
if ('number' === type && $field.get(0).validity && $field.get(0).validity.badInput === true) {
return true;
}
var value = validator.getFieldValue($field, 'notEmpty');
return $.trim(value) !== '';
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 115 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* regexp validator
*
* @link http://formvalidation.io/validators/regexp/
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
'en_US': {
regexp: {
'default': 'Please enter a value matching the pattern'
}
}
});
FormValidation.Validator.regexp = {
html5Attributes: {
message: 'message',
regexp: 'regexp'
},
enableByHtml5: function($field) {
var pattern = $field.attr('pattern');
if (pattern) {
return {
regexp: pattern
};
}
return false;
},
/**
* Check if the element value matches given regular expression
*
* @param {FormValidation.Base} validator The validator plugin instance
* @param {jQuery} $field Field element
* @param {Object} options Consists of the following key:
* - regexp: The regular expression you need to check
* @returns {Boolean}
*/
validate: function(validator, $field, options) {
var value = validator.getFieldValue($field, 'regexp');
if (value === '') {
return true;
}
var regexp = ('string' === typeof options.regexp) ? new RegExp(options.regexp) : options.regexp;
return regexp.test(value);
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 116 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* stringLength validator
*
* @link http://formvalidation.io/validators/stringLength/
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
'en_US': {
stringLength: {
'default': 'Please enter a value with valid length',
less: 'Please enter less than %s characters',
more: 'Please enter more than %s characters',
between: 'Please enter value between %s and %s characters long'
}
}
});
FormValidation.Validator.stringLength = {
html5Attributes: {
message: 'message',
min: 'min',
max: 'max',
trim: 'trim',
utf8bytes: 'utf8Bytes'
},
enableByHtml5: function($field) {
var options = {},
maxLength = $field.attr('maxlength'),
minLength = $field.attr('minlength');
if (maxLength) {
options.max = parseInt(maxLength, 10);
}
if (minLength) {
options.min = parseInt(minLength, 10);
}
return $.isEmptyObject(options) ? false : options;
},
/**
* Check if the length of element value is less or more than given number
*
* @param {FormValidation.Base} validator The validator plugin instance
* @param {jQuery} $field Field element
* @param {Object} options Consists of following keys:
* - min
* - max
* At least one of two keys is required
* The min, max keys define the number which the field value compares to. min, max can be
* - A number
* - Name of field which its value defines the number
* - Name of callback function that returns the number
* - A callback function that returns the number
*
* - message: The invalid message
* - trim: Indicate the length will be calculated after trimming the value or not. It is false, by default
* - utf8bytes: Evaluate string length in UTF-8 bytes, default to false
* @returns {Object}
*/
validate: function(validator, $field, options) {
var value = validator.getFieldValue($field, 'stringLength');
if (options.trim === true || options.trim === 'true') {
value = $.trim(value);
}
if (value === '') {
return true;
}
var locale = validator.getLocale(),
min = $.isNumeric(options.min) ? options.min : validator.getDynamicOption($field, options.min),
max = $.isNumeric(options.max) ? options.max : validator.getDynamicOption($field, options.max),
// Credit to http://stackoverflow.com/a/23329386 (@lovasoa) for UTF-8 byte length code
utf8Length = function(str) {
var s = str.length;
for (var i = str.length - 1; i >= 0; i--) {
var code = str.charCodeAt(i);
if (code > 0x7f && code <= 0x7ff) {
s++;
} else if (code > 0x7ff && code <= 0xffff) {
s += 2;
}
if (code >= 0xDC00 && code <= 0xDFFF) {
i--;
}
}
return s;
},
length = options.utf8Bytes ? utf8Length(value) : value.length,
isValid = true,
message = options.message || FormValidation.I18n[locale].stringLength['default'];
if ((min && length < parseInt(min, 10)) || (max && length > parseInt(max, 10))) {
isValid = false;
}
switch (true) {
case (!!min && !!max):
message = FormValidation.Helper.format(options.message || FormValidation.I18n[locale].stringLength.between, [parseInt(min, 10), parseInt(max, 10)]);
break;
case (!!min):
message = FormValidation.Helper.format(options.message || FormValidation.I18n[locale].stringLength.more, parseInt(min, 10));
break;
case (!!max):
message = FormValidation.Helper.format(options.message || FormValidation.I18n[locale].stringLength.less, parseInt(max, 10));
break;
default:
break;
}
return {
valid: isValid,
message: message
};
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 117 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* FormValidation (http://formvalidation.io)
* The best jQuery plugin to validate form fields. Support Bootstrap, Foundation, Pure, SemanticUI, UIKit and custom frameworks
*
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
/**
* This class supports validating Bootstrap form (http://getbootstrap.com/)
*/
(function($) {
FormValidation.Framework.Bootstrap = function(element, options, namespace) {
options = $.extend(true, {
button: {
selector: '[type="submit"]',
// The class of disabled button
// http://getbootstrap.com/css/#buttons-disabled
disabled: 'disabled'
},
err: {
// http://getbootstrap.com/css/#forms-help-text
clazz: 'help-block',
parent: '^(.*)col-(xs|sm|md|lg)-(offset-){0,1}[0-9]+(.*)$'
},
// This feature requires Bootstrap v3.1.0 or later (http://getbootstrap.com/css/#forms-control-validation).
// Since Bootstrap doesn't provide any methods to know its version, this option cannot be on/off automatically.
// In other word, to use this feature you have to upgrade your Bootstrap to v3.1.0 or later.
//
// Examples:
// - Use Glyphicons icons:
// icon: {
// valid: 'glyphicon glyphicon-ok',
// invalid: 'glyphicon glyphicon-remove',
// validating: 'glyphicon glyphicon-refresh',
// feedback: 'form-control-feedback'
// }
// - Use FontAwesome icons:
// icon: {
// valid: 'fa fa-check',
// invalid: 'fa fa-times',
// validating: 'fa fa-refresh',
// feedback: 'form-control-feedback'
// }
icon: {
valid: null,
invalid: null,
validating: null,
feedback: 'form-control-feedback'
},
row: {
// By default, each field is placed inside the <div class="form-group"></div>
// http://getbootstrap.com/css/#forms
selector: '.form-group',
valid: 'has-success',
invalid: 'has-error',
feedback: 'has-feedback'
}
}, options);
FormValidation.Base.apply(this, [element, options, namespace]);
};
FormValidation.Framework.Bootstrap.prototype = $.extend({}, FormValidation.Base.prototype, {
/**
* Specific framework might need to adjust the icon position
*
* @param {jQuery} $field The field element
* @param {jQuery} $icon The icon element
*/
_fixIcon: function($field, $icon) {
var ns = this._namespace,
type = $field.attr('type'),
field = $field.attr('data-' + ns + '-field'),
row = this.options.fields[field].row || this.options.row.selector,
$parent = $field.closest(row);
// Place it after the container of checkbox/radio
// so when clicking the icon, it doesn't effect to the checkbox/radio element
if ('checkbox' === type || 'radio' === type) {
var $fieldParent = $field.parent();
if ($fieldParent.hasClass(type)) {
$icon.insertAfter($fieldParent);
} else if ($fieldParent.parent().hasClass(type)) {
$icon.insertAfter($fieldParent.parent());
}
}
// The feedback icon does not render correctly if there is no label
// https://github.com/twbs/bootstrap/issues/12873
if ($parent.find('label').length === 0) {
$icon.addClass('fv-icon-no-label');
}
// Fix feedback icons in input-group
if ($parent.find('.input-group').length !== 0) {
$icon.addClass('fv-bootstrap-icon-input-group')
.insertAfter($parent.find('.input-group').eq(0));
}
},
/**
* Create a tooltip or popover
* It will be shown when focusing on the field
*
* @param {jQuery} $field The field element
* @param {String} message The message
* @param {String} type Can be 'tooltip' or 'popover'
*/
_createTooltip: function($field, message, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon
.css({
'cursor': 'pointer',
'pointer-events': 'auto'
})
.popover('destroy')
.popover({
container: 'body',
content: message,
html: true,
placement: 'auto top',
trigger: 'hover click'
});
break;
case 'tooltip':
/* falls through */
default:
$icon
.css({
'cursor': 'pointer',
'pointer-events': 'auto'
})
.tooltip('destroy')
.tooltip({
container: 'body',
html: true,
placement: 'auto top',
title: message
});
break;
}
}
},
/**
* Destroy the tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_destroyTooltip: function($field, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon
.css({
'cursor': '',
'pointer-events': 'none'
})
.popover('destroy');
break;
case 'tooltip':
/* falls through */
default:
$icon
.css({
'cursor': '',
'pointer-events': 'none'
})
.tooltip('destroy');
break;
}
}
},
/**
* Hide a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_hideTooltip: function($field, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon.popover('hide');
break;
case 'tooltip':
/* falls through */
default:
$icon.tooltip('hide');
break;
}
}
},
/**
* Show a tooltip or popover
*
* @param {jQuery} $field The field element
* @param {String} type Can be 'tooltip' or 'popover'
*/
_showTooltip: function($field, type) {
var ns = this._namespace,
$icon = $field.data(ns + '.icon');
if ($icon) {
switch (type) {
case 'popover':
$icon.popover('show');
break;
case 'tooltip':
/* falls through */
default:
$icon.tooltip('show');
break;
}
}
}
});
/**
* Plugin definition
* Support backward
* @deprecated It will be removed soon. Instead of using $(form).bootstrapValidator(), use
* $(form).formValidation({
* framework: 'bootstrap' // It's equivalent to use data-fv-framework="bootstrap" for <form>
* });
*/
$.fn.bootstrapValidator = function(option) {
var params = arguments;
return this.each(function() {
var $this = $(this),
data = $this.data('formValidation') || $this.data('bootstrapValidator'),
options = 'object' === typeof option && option;
if (!data) {
data = new FormValidation.Framework.Bootstrap(this, $.extend({}, {
events: {
// Support backward
formInit: 'init.form.bv',
formError: 'error.form.bv',
formSuccess: 'success.form.bv',
fieldAdded: 'added.field.bv',
fieldRemoved: 'removed.field.bv',
fieldInit: 'init.field.bv',
fieldError: 'error.field.bv',
fieldSuccess: 'success.field.bv',
fieldStatus: 'status.field.bv',
localeChanged: 'changed.locale.bv',
validatorError: 'error.validator.bv',
validatorSuccess: 'success.validator.bv'
}
}, options), 'bv');
$this.addClass('fv-form-bootstrap')
.data('formValidation', data)
.data('bootstrapValidator', data);
}
// Allow to call plugin method
if ('string' === typeof option) {
data[option].apply(data, Array.prototype.slice.call(params, 1));
}
});
};
$.fn.bootstrapValidator.Constructor = FormValidation.Framework.Bootstrap;
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 118 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(jQuery) {/**
* callback validator
*
* @link http://formvalidation.io/validators/callback/
* @author https://twitter.com/nghuuphuoc
* @copyright (c) 2013 - 2015 Nguyen Huu Phuoc
* @license http://formvalidation.io/license/
*/
(function($) {
FormValidation.I18n = $.extend(true, FormValidation.I18n || {}, {
'en_US': {
callback: {
'default': 'Please enter a valid value'
}
}
});
FormValidation.Validator.callback = {
html5Attributes: {
message: 'message',
callback: 'callback'
},
/**
* Return result from the callback method
*
* @param {FormValidation.Base} validator The validator plugin instance
* @param {jQuery} $field Field element
* @param {Object} options Can consist of the following keys:
* - callback: The callback method that passes 2 parameters:
* callback: function(fieldValue, validator, $field) {
* // fieldValue is the value of field
* // validator is instance of BootstrapValidator
* // $field is the field element
* }
* - message: The invalid message
* @returns {Deferred}
*/
validate: function(validator, $field, options) {
var value = validator.getFieldValue($field, 'callback'),
dfd = new $.Deferred(),
result = { valid: true };
if (options.callback) {
var response = FormValidation.Helper.call(options.callback, [value, validator, $field]);
result = ('boolean' === typeof response || null === response) ? { valid: response } : response;
}
dfd.resolve($field, 'callback', result);
return dfd;
}
};
}(jQuery));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2)))
/***/ }),
/* 119 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 120 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Will__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Will___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__Will__);
var formatAmount = function (amount) {
if (amount < 1) {
return amount.toFixed(5);
}
if (amount < 100) {
return amount.toFixed(3);
}
return amount.toFixed(3);
};
var formatAccountType = function (code) {
if (code == 1) {
return '彩票账户';
}
if (code == 2) {
return '百家乐账户';
}
};
var greeting = function () {
return Object(__WEBPACK_IMPORTED_MODULE_0__Will__["format"])(new Date(), 'aa[好]', { locale: __WEBPACK_IMPORTED_MODULE_0__Will__["locale"] });
};
var formatUserType = function (type) {
if (type == 0) {
return '玩家';
}
if (type == 1) {
return '代理';
}
};
var formatUserVipLevel = function (level) {
if (level == 0) {
return '普通会员';
}
if (level == 1) {
return '青铜 VIP';
}
if (level == 2) {
return '紫晶 VIP';
}
if (level == 3) {
return '白金 VIP';
}
if (level == 4) {
return '黄金 VIP';
}
if (level == 5) {
return '钻石 VIP';
}
if (level == 6) {
return '至尊 VIP';
}
};
var formatLevelUsers = function (thisUser, list) {
$.each(list, function (i, val) {
thisUser += ' > ' + val;
});
return thisUser;
};
var formatUserOnlineStatus = function (status) {
if (status == 0) {
return '离线';
}
if (status == 1) {
return '在线';
}
};
var formatUserPlanLevel = function (level) {
if (level == 0) {
return '菜鸟';
}
if (level == 1) {
return '学徒';
}
if (level == 2) {
return '出师';
}
if (level == 3) {
return '操盘';
}
if (level == 4) {
return '大师';
}
if (level == 5) {
return '宗师';
}
if (level == 6) {
return '大神';
}
};
var formatUserCardStatus = function (status) {
if (status == 0) {
return '正常';
}
if (status == -1) {
return '资料无效';
}
if (status == -2) {
return '已锁定';
}
};
var formatUserRechargeType = function (type) {
if (type == 1) {
return '网银充值';
}
if (type == 2) {
return '转账汇款';
}
if (type == 0) {
return '系统充值';
}
};
var formatUserWithdrawalsStatus = function (status) {
if (status == 0) {
return '待处理';
}
if (status == 1) {
return '已完成';
}
if (status == -1) {
return '已拒绝';
}
};
var formatUserTransferStatus = function (type) {
if (type == 0) {
return '处理中';
}
if (type == 1) {
return '成功';
}
if (type == 2) {
return '失败';
}
};
var formatUserBetsModel = function (model) {
if (model == 'yuan') {
return '元';
}
if (model == 'jiao') {
return '角';
}
if (model == 'fen') {
return '分';
}
if (model == 'li') {
return '厘';
}
};
var formatUserBetsStatus = function (status) {
if (status == 0) {
return '未开奖';
}
if (status == 1) {
return '未中奖';
}
if (status == 2) {
return '已中奖';
}
if (status == -1) {
return '已撤单';
}
};
var formatUserChaseStatus = function (status) {
if (status == 0) {
return '未开始';
}
if (status == 1) {
return '进行中';
}
if (status == 2) {
return '已完成';
}
if (status == -1) {
return '已撤单';
}
};
var formatUserBillType = function (code) {
if (code == 1000) {
return '存款';
}
if (code == 1001) {
return '取款';
}
if (code == 1002) {
return '取款退回';
}
if (code == 1100) {
return '转入';
}
if (code == 1101) {
return '转出';
}
if (code == 1102) {
return '上下级转账';
}
if (code == 1200) {
return '优惠活动';
}
if (code == 1300) {
return '消费';
}
if (code == 1301) {
return '派奖';
}
if (code == 1302) {
return '消费返点';
}
if (code == 1303) {
return '取消订单';
}
if (code == 1304) {
return '修正奖金';
}
if (code == 1400) {
return '代理返点';
}
if (code == 1500) {
return '分红';
}
if (code == 1600) {
return '管理员增';
}
if (code == 1601) {
return '管理员减';
}
if (code == 1700) {
return '积分兑换';
}
if (code == 1800) {
return '支付佣金';
}
if (code == 1801) {
return '获得佣金';
}
if (code == 1900) {
return '会员返水';
}
};
var formatUserMessageType = function (type) {
if (type == 0) {
return '建议反馈';
}
if (type == 1) {
return '已收消息';
}
if (type == 2) {
return '已发消息';
}
};
var formatUserMessageStatus = function (status, type) {
if (status == 0) {
return '正常';
}
if (status == 1) {
return '已读';
}
if (status == -1) {
return '已删除';
}
};
var formatUserSysMessageType = function (type) {
if (type == 0) {
return '系统通知';
}
if (type == 1) {
return '到账通知';
}
if (type == 2) {
return '提现通知';
}
if (type == 5) {
return 'VIP活动通知';
}
};
var formatLotteryPaymentThridType = function (type) {
if (type == 'ips') {
return '环讯支付';
}
if (type == 'baofoo') {
return '宝付支付';
}
if (type == 'newpay') {
return '新生支付';
}
if (type == 'ecpss') {
return '汇潮支付';
}
if (type == 'yeepay') {
return '易宝支付';
}
if (type == 'mobao') {
return '摩宝支付';
}
if (type == 'gopay') {
return '国付宝支付';
}
if (type == 'pay41') {
return '通汇支付';
}
};
const DataFormat = {
formatAmount: formatAmount,
formatAccountType: formatAccountType,
greeting: greeting,
// 用户类型
formatUserType: formatUserType,
// 用户 VIP等级
formatUserVipLevel: formatUserVipLevel,
// 用户层级关系
formatLevelUsers: formatLevelUsers,
// 用户在线状态
formatUserOnlineStatus: formatUserOnlineStatus,
// 计划等级
formatUserPlanLevel: formatUserPlanLevel,
// 用户银行卡状态
formatUserCardStatus: formatUserCardStatus,
// 充值类型
formatUserRechargeType: formatUserRechargeType,
// 取款状态
formatUserWithdrawalsStatus: formatUserWithdrawalsStatus,
// 账户转账状态
formatUserTransferStatus: formatUserTransferStatus,
// 投注模式
formatUserBetsModel: formatUserBetsModel,
// 订单状态
formatUserBetsStatus: formatUserBetsStatus,
// 账单类别
formatUserBillType: formatUserBillType,
// 消息类型
formatUserMessageType: formatUserMessageType,
// 消息状态
formatUserMessageStatus: formatUserMessageStatus,
// 系统消息类型
formatUserSysMessageType: formatUserSysMessageType,
// 第三方支付类别
formatLotteryPaymentThridType: formatLotteryPaymentThridType,
formatUserChaseStatus: formatUserChaseStatus
};
/* unused harmony default export */ var _unused_webpack_default_export = (DataFormat);
window.DataFormat = DataFormat;
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2)))
/***/ }),
/* 121 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Route; });
/* unused harmony export HttpRequest */
/* unused harmony export MainCtrl */
/* unused harmony export AccountCtrl */
/* unused harmony export GameLotteryCtrl */
/* unused harmony export PaymentCtrl */
/**
* 路由器设置
*/
var Route = {
PATH: "/api",
// 用户登录
LOGIN: "/login",
// 用户退出
LOGOUT: "/logout",
Account: {
PATH: "/account",
// 列出完整的用户信息
LIST_FULL_INFO: "/list-full-info",
// 检查用户名是否存在
CHECK_USERNAME_EXIST: "/check-username-exist",
// 修改用户昵称
MODIFY_NICKNAME: "/modify-nickname",
// 修改用户密码
MODIFY_PASSWORD: "/modify-password",
// 修改头像
MODIFY_AVATAR: "/modify-avatar",
// 修改用户资金密码
MODIFY_WITHDRAW_PASSWORD: "/modify-withdraw-password",
// 准备绑定
PREPARE_BIND: "/prepare-bind",
// 请求绑定
APPLY_BIND: "/apply-bind",
// 列出卡片
LIST_CARD: "/list-card",
// 准备绑定卡片
PREPARE_BIND_CARD: "/prepare-bind-card",
// 绑定卡片
BIND_CARD: "/bind-card",
// 设置默认卡片
SET_DEFAULT_CARD: "/set-default-card",
// 获取随机密保问题
GET_RANDOM_SECURITY: "/get-random-security",
// 绑定密保问题
BIND_SECURITY: "/bind-security",
// 搜索账单
SEARCH_BILL: "/search-bill",
// 获取账单详情
GET_BILL_DETAILS: "/get-bill-details",
// 搜索充值
SEARCH_RECHARGE: "/search-recharge",
// 准备提现
PREPARE_WITHDRAW: "/prepare-withdraw",
// 提现申请
APPLY_WITHDRAW: "/apply-withdraw",
// 搜索提现
SEARCH_WITHDRAW: "/search-withdraw",
// 同账户转账
APPLY_SELF_TRANSFER: "/apply-self-transfer",
// 上下级转账
APPLY_ACCOUNT_TRANSFER: "/apply-account-transfer",
// 彩票账户报表
REPORT_GAME_LOTTERY: "/report-game-lottery",
// 百家乐账户报表
REPORT_GAME_BACCARAT: "/report-game-baccarat",
// 获取消息列表
LIST_MESSAGE: "/list-message",
// 获取消息详情
GET_MESSAGE_DETAILS: "/get-message-details",
// 发送消息
SEND_MESSAGE: "/send-message",
// 读取消息
READ_MESSAGE: "/read-message",
// 删除消息
DELETE_MESSAGE: "/delete-message",
// 列出系统消息
LIST_SYSTEM_MESSAGE: "/list-system-message",
// 清空系统消息
CLEAR_SYSTEM_MESSAGE: "/clear-system-message"
},
Agent: {
PATH: "/agent",
// 添加新的用户
ADD_NEW_ACCOUNT: "/add-new-account",
// 列出来账号配额
LIST_CODE_QUOTA: "/list-code-quota",
// 列出来团队账号
LIST_TEAM_ACCOUNT: "/list-team-account",
// 列出在线用户
LIST_ONLINE_ACCOUNT: "/list-online-account",
// 搜索彩票游戏订单
SEARCH_GAME_LOTTERY_ORDER: "/search-game-lottery-order",
// 搜索账户账单
SEARCH_ACCOUNT_BILL: "/search-account-bill",
// 彩票账户报表
REPORT_GAME_LOTTERY: "/report-game-lottery",
// 百家乐账户报表
REPORT_GAME_BACCARAT: "/report-game-baccarat"
},
GameLottery: {
PATH: "/game-lottery",
// 彩票游戏信息
STATIC_INFO: "/static-info",
// 彩票游戏追号时间
STATIC_CHASE_TIME: "/static-chase-time",
// 彩票游戏开奖号码
STATIC_OPEN_CODE: "/static-open-code",
// 彩票游戏开奖时间
STATIC_OPEN_TIME: "/static-open-time",
// 添加订单
ADD_ORDER: "/add-order",
// 撤销订单
CANCEL_ORDER: "/cancel-order",
// 获取订单
GET_ORDER: "/get-order",
// 搜索订单
SEARCH_ORDER: "/search-order",
// 拉取开奖通知
PULL_OPEN_NOTICE: "/pull-open-notice"
},
GameBaccarat: {
PATH: "/game-baccarat"
},
Payment: {
PATH: "/payment",
// 列出银行
STATIC_LIST_BANK: "/static-list-bank",
// 列出所有可用支付方式
REQUEST_ALL_METHOD: "/request-all-method",
// 请求第三方支付
REQUEST_THRID_PAY: "/request-thrid-pay"
},
System: {
PATH: "/system",
// 列出系统公告
LIST_NOTICE: "/list-notice",
// 获取公告详情
GET_NOTICE_DETAILS: "/get-notice-details"
},
WebAjax: {
PATH: "/webajax",
// 初始化页面
INIT_PAGE: "/init-page",
// 循环
LOOP: "/loop",
// 初始化彩票页面
INIT_GAME_LOTTERY: "/init-game-lottery"
}
};
/**
* HTTP请求
*/
var HttpRequest = function (options) {
var defaults = {
type: 'post',
data: {},
dataType: 'json',
async: true,
cache: false,
beforeSend: null,
success: null,
complete: null
};
var o = $.extend({}, defaults, options);
$.ajax({
type: 'post',
url: o.url,
data: o.data,
dataType: 'json',
async: o.async,
beforeSend: function () {
o.beforeSend && o.beforeSend();
},
success: function (response) {
o.success && o.success(response);
},
complete: function () {
o.complete && o.complete();
}
});
};
var MainCtrl = function () {
/**
* 登录方法
*/
var login = function (options) {
options.url = Route.PATH + Route.LOGIN;
HttpRequest(options);
};
/**
* 退出方法
*/
var logout = function (options) {
options.url = Route.PATH + Route.LOGOUT;
HttpRequest(options);
};
return {
login: login,
logout: logout
};
}();
var AccountCtrl = function () {
var thisScope = 'Account';
var getScopeUrl = function (key) {
return Route.PATH + Route[thisScope].PATH + Route[thisScope][key];
};
/**
* 修改密码方法
*/
var modifyPassword = function (options) {
options.url = getScopeUrl('MODIFY_PASSWORD');
HttpRequest(options);
};
return {
modifyPassword: modifyPassword
};
}();
var GameLotteryCtrl = function () {
var thisScope = 'GameLottery';
var getScopeUrl = function (key) {
return Route.PATH + Route[thisScope].PATH + Route[thisScope][key];
};
/**
* 获取彩票游戏开奖号码
*/
var staticOpenCode = function (options) {
options.url = getScopeUrl('STATIC_OPEN_CODE');
HttpRequest(options);
};
/**
* 获取彩票游戏开奖时间
*/
var staticOpenTime = function (options) {
options.url = getScopeUrl('STATIC_OPEN_TIME');
HttpRequest(options);
};
/**
* 投注方法
*/
var addOrder = function (options) {
options.url = getScopeUrl('ADD_ORDER');
HttpRequest(options);
};
var pullOpenNotice = function (options) {
options.url = getScopeUrl('PULL_OPEN_NOTICE');
HttpRequest(options);
};
return {
staticOpenCode: staticOpenCode,
staticOpenTime: staticOpenTime,
addOrder: addOrder,
pullOpenNotice: pullOpenNotice
};
}();
var PaymentCtrl = function () {
var thisScope = 'Payment';
var getScopeUrl = function (key) {
return Route.PATH + Route[thisScope].PATH + Route[thisScope][key];
};
var requestAllMethod = function (options) {
options.url = getScopeUrl('REQUEST_ALL_METHOD');
HttpRequest(options);
};
var requestThridPay = function (options) {
options.url = getScopeUrl('REQUEST_THRID_PAY');
HttpRequest(options);
};
return {
requestAllMethod: requestAllMethod,
requestThridPay: requestThridPay
};
}();
Object.assign(window, {
Route,
HttpRequest,
MainCtrl,
AccountCtrl,
GameLotteryCtrl,
PaymentCtrl
});
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2)))
/***/ }),
/* 122 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function($) {// var getGlobalImgPath = function() {
// return '/img';
// }
var location = function () {
return window.location.protocol + '//' + window.location.host;
};
// var initScroll = function(el) {
// if(!el) el = '.scroller';
// $(el).each(function () {
// if($(this).attr('data-initialized')) return;
// var color = $(this).attr('data-handle-color') ? $(this).attr('data-handle-color') : '#2AC1CA';
// var distance = $(this).attr('data-handle-distance') ? $(this).attr('data-handle-distance') : '0px';
// var alwaysVisible = $(this).attr('data-always-visible') ? true : false;
// var railVisible = $(this).attr('data-rail-visible') ? true : false;
// $(this).slimScroll({
// allowPageScroll: false,
// size: '7px',
// borderRadius: '0px',
// color: color,
// wrapperClass: 'slim-scroll',
// distance: distance,
// position: 'right',
// height: 'auto',
// alwaysVisible: alwaysVisible,
// railVisible: railVisible,
// disableFadeOut: true
// });
// $(this).attr('data-initialized', 1);
// });
// }
// var destroyScroll = function(el) {
// $(el).each(function() {
// // destroy existing instance before updating the height
// if ($(this).attr("data-initialized") === "1") {
// $(this).removeAttr("data-initialized");
// $(this).removeAttr("style");
// var attrList = {};
// // store the custom attribures so later we will reassign.
// if ($(this).attr("data-handle-color")) {
// attrList["data-handle-color"] = $(this).attr("data-handle-color");
// }
// if ($(this).attr("data-handle-distance")) {
// attrList["data-handle-distance"] = $(this).attr("data-handle-distance");
// }
// if ($(this).attr("data-always-visible")) {
// attrList["data-always-visible"] = $(this).attr("data-always-visible");
// }
// if ($(this).attr("data-rail-visible")) {
// attrList["data-rail-visible"] = $(this).attr("data-rail-visible");
// }
// $(this).slimScroll({
// wrapperClass: 'slim-scroll',
// destroy: true
// });
// var the = $(this);
// // reassign custom attributes
// $.each(attrList, function(key, value) {
// the.attr(key, value);
// });
// }
// });
// }
// var blockUI = function(options) {
// options = $.extend(true, {}, options);
// options.zIndex = 5000;
// var html = '';
// if (options.animate) {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '">' + '<div class="block-spinner-bar"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div></div>' + '</div>';
// } else if (options.iconOnly) {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + getGlobalImgPath() + '/icon/loading-spinner-grey.gif" align=""></div>';
// } else if (options.textOnly) {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><span> ' + (options.message ? options.message : 'LOADING...') + '</span></div>';
// } else {
// html = '<div class="loading-message ' + (options.boxed ? 'loading-message-boxed' : '') + '"><img src="' + getGlobalImgPath() + '/icon/loading-spinner-grey.gif" align=""><span> ' + (options.message ? options.message : '正在加载中...') + '</span></div>';
// }
//
// if (options.target) { // element blocking
// var el = $(options.target);
// if (el.height() <= ($(window).height())) {
// options.cenrerY = true;
// }
// el.block({
// message: html,
// baseZ: options.zIndex ? options.zIndex : 1000,
// centerY: options.cenrerY !== undefined ? options.cenrerY : false,
// css: {
// top: '10%',
// border: '0',
// padding: '0',
// backgroundColor: 'none'
// },
// overlayCSS: {
// backgroundColor: options.overlayColor ? options.overlayColor : '#555',
// opacity: options.boxed ? 0.05 : 0.1,
// cursor: 'wait'
// }
// });
// } else { // page blocking
// $.blockUI({
// message: html,
// baseZ: options.zIndex ? options.zIndex : 1000,
// centerY: 0,
// css: {
// border: '0',
// padding: '0',
// backgroundColor: 'none',
// // top: '10px', left: '', right: '10px'
// },
// overlayCSS: {
// backgroundColor: options.overlayColor ? options.overlayColor : '#555',
// opacity: options.boxed ? 0 : 0,
// cursor: 'wait'
// }
// });
// }
// }
// var unblockUI = function(target) {
// if (target) {
// $(target).unblock({
// onUnblock: function() {
// $(target).css('position', '');
// $(target).css('zoom', '');
// }
// });
// } else {
// $.unblockUI();
// }
// }
var getUrl = function (key, isHash) {
var path = window.location.search;
if (isHash) path = window.location.hash;
var search = path.substring(1),
i,
val,
params = search.split("&");
for (i = 0; i < params.length; i++) {
val = params[i].split("=");
if (val[0] == key) {
return unescape(val[1]);
}
}
};
var getHash = function (key) {
return getUrl(key, 1);
};
// var addHash = function(map){
// $.each(function(){
// });
// }
// var notice = function(content, autoClose) {
// if(autoClose == undefined) autoClose = 3000;
// var noticeBox = new jBox('Notice', {
// content: content,
// autoClose: autoClose,
// addClass: 'common-notice'
// });
// }
// var tips = function(title, content, autoClose) {
// $('.message-tips').remove();
// var messageTips = $('<div class="message-tips">');
// messageTips.append('<div class="title">' + title + '</div>');
// messageTips.append('<div class="content">' + content + '</div>');
// $('body').append(messageTips);
// var width = messageTips.width();
// var height = messageTips.height();
// var winWidth = $(window).width();
// messageTips.css({bottom: -height, right: ((winWidth - 1050) / 2 - width) / 2}).stop().animate({bottom: 202}, 1000, 'easeOutExpo');
// if(autoClose) {
// setTimeout(function() {
// messageTips.stop().animate({bottom: -height,}, 1000, 'easeOutExpo', function() {
// messageTips.remove();
// });
// }, autoClose);
// }
// }
const App = {
loadedModal: false,
location: location,
// initScroll: initScroll,
// destroyScroll: destroyScroll,
blockUI(jqXHR) {
// document.body.style.pointerEvents = 'none'
// if(jqXHR && jqXHR.promise) {
// setTimeout(() => {
// if((jqXHR.readyState != 4) && !this.loadedModal) {
// $('body').append(loadingHTML)
// this.loadedModal = jqXHR.loadedModal = true
// }
// },500)
// }
// else{
// $('body').append(loadingHTML)
// }
},
unblockUI(jqXHR) {
// document.body.style.pointerEvents = 'auto'
// if (jqXHR && jqXHR.promise){
// if(jqXHR.loadedModal) {
// $('.lx-ajax-loader').remove()
// this.loadedModal = false
// }
// }
// else{
$('.ajax-loader').remove();
// }
},
getUrl: getUrl,
getHash: getHash
// notice: notice,
// tips: tips
};
/* unused harmony default export */ var _unused_webpack_default_export = (App);
window.App = App;
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(2)))
/***/ }),
/* 123 */
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(124);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(28)("55570484", content, false);
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/_css-loader@0.28.4@css-loader/index.js!../../../node_modules/_vue-loader@13.0.4@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-03229074\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/_less-loader@4.0.5@less-loader/dist/cjs.js?{}!../../../node_modules/_vue-loader@13.0.4@vue-loader/lib/selector.js?type=styles&index=0!./index.vue", function() {
var newContent = require("!!../../../node_modules/_css-loader@0.28.4@css-loader/index.js!../../../node_modules/_vue-loader@13.0.4@vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-03229074\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/_less-loader@4.0.5@less-loader/dist/cjs.js?{}!../../../node_modules/_vue-loader@13.0.4@vue-loader/lib/selector.js?type=styles&index=0!./index.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/* 124 */
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(17)(undefined);
// imports
// module
exports.push([module.i, ".bar{background:#fff;position:fixed;left:0;right:0;top:0;height:39px;z-index:1031;color:#a9a9a9;font-size:14px}.bar>.container{position:relative}.bar .inlogin{color:#ff6000}.bar .message{cursor:pointer;text-align:center;display:inline-block}.bar .message.new{position:relative}.bar .message.new:after{content:\"\";border-radius:50%;width:7px;height:7px;position:absolute;background:#fe5307;left:23px;top:-2px}.bar .message .el-badge{vertical-align:top}.bar .message .el-badge__content{padding-left:1px;padding-right:1px;line-height:13px;background:transparent;color:#fe5307;height:13px;border:none;border-radius:0;top:0;font-size:14px}.bar .message .el-badge__content:before{content:\"(\"}.bar .message .el-badge__content:after{content:\")\"}.bar .fa-angle-down{font-size:18px;margin-left:5px;vertical-align:-2px}.bar .btn{border-radius:0;padding-top:3px;padding-bottom:3px;float:left;margin-right:5px;margin-top:-4px}.bar [class^=imoon-]{font-size:16px;margin-right:5px}.bar .imoon-email,.bar [class^=imoon-]{vertical-align:middle;position:relative;top:-.1em}.bar .imoon-email{font-size:18px;margin-right:3px}.bar .imoon-volume{vertical-align:middle;position:relative;top:-.1em;font-size:22px}.bar .imoon-volume+span{vertical-align:top}.bar-time{float:left;line-height:39px}.bar-time>span{margin-left:12px}.login-done>div{line-height:16px;height:16px;border-right:1px solid #bababa;padding-right:10px;padding-left:10px;float:left;margin-top:11.5px}.login-done>div:last-child{border-right:none;border-left:1px solid #bababa;cursor:pointer}.login-done>div>a{color:#a9a9a9}@media (max-width:767px){.login-done>div{padding-left:5px;padding-right:5px}}.manager-links,.moneylist,.set-voice{position:relative}.manager-links:hover>.sub-list,.moneylist:hover>.sub-list,.set-voice:hover>.sub-list{display:block}.sub-list{position:absolute;top:25px;background-color:#fff;z-index:700;display:none;left:-10px;border:1px solid #eee;right:-10px;margin:auto}.login-no{padding-right:10px;line-height:39px}", ""]);
// exports
/***/ }),
/* 125 */
/***/ (function(module, exports) {
throw new Error("Module build failed: SyntaxError: F:/lx_new/webapp/component/bar/index.vue: Unexpected token (93:4)\n\n\u001b[0m \u001b[90m 91 | \u001b[39m })\u001b[33m;\u001b[39m\n \u001b[90m 92 | \u001b[39m }\u001b[33m,\u001b[39m\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 93 | \u001b[39m \u001b[33m...\u001b[39mmapActions([\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 94 | \u001b[39m \u001b[32m'initPage'\u001b[39m\u001b[33m,\u001b[39m\n \u001b[90m 95 | \u001b[39m ])\u001b[33m,\u001b[39m\n \u001b[90m 96 | \u001b[39m \u001b[33m...\u001b[39mmapMutations([\u001b[0m\n");
/***/ }),
/* 126 */
/***/ (function(module, exports) {
throw new Error("Module build failed: SyntaxError: F:/lx_new/webapp/js/router.js: 'import' and 'export' may only appear at the top level (25:16)\n\n\u001b[0m \u001b[90m 23 | \u001b[39m preloadImage(\u001b[32m'index/index_bg'\u001b[39m\u001b[33m,\u001b[39m \u001b[36mtrue\u001b[39m\u001b[33m,\u001b[39m { bg\u001b[33m:\u001b[39m \u001b[32m'.index-banner'\u001b[39m }\u001b[33m,\u001b[39m util\u001b[33m.\u001b[39mcheckWebP)\n \u001b[90m 24 | \u001b[39m \u001b[33m.\u001b[39mthen(() \u001b[33m=>\u001b[39m {\n\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 25 | \u001b[39m \u001b[36mimport\u001b[39m (\u001b[32m'./indexPage'\u001b[39m)\n \u001b[90m | \u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\n \u001b[90m 26 | \u001b[39m async$VM(\u001b[32m'util/DomainValidation'\u001b[39m\u001b[33m,\u001b[39m \u001b[32m'#domain-validation'\u001b[39m)\n \u001b[90m 27 | \u001b[39m })\n \u001b[90m 28 | \u001b[39m } \u001b[36melse\u001b[39m {\u001b[0m\n");
/***/ }),
/* 127 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*!
* MoveTo - A lightweight scroll animation javascript library without any dependency.
* Version 1.6.1 (12-04-2017 10:18)
* Licensed under MIT
* Copyright 2017 Hasan Aydoğdu <hsnaydd@gmail.com>
*/
var MoveTo = function () {
/**
* Defaults
* @type {object}
*/
var defaults = {
tolerance: 0,
duration: 800,
easing: 'easeOutQuart',
callback: function callback() {} };
/**
* easeOutQuart Easing Function
* @param {number} t - current time
* @param {number} b - start value
* @param {number} c - change in value
* @param {number} d - duration
* @return {number} - calculated value
*/
function easeOutQuart(t, b, c, d) {
t /= d;
t--;
return -c * (t * t * t * t - 1) + b;
}
/**
* Returns html element's top and left offset
* @param {HTMLElement} elem - Element
* @return {object} Element top and left offset
*/
function getOffsetSum(elem) {
var top = 0;
var left = 0;
while (elem) {
top += elem.offsetTop;
left += elem.offsetLeft;
elem = elem.offsetParent;
}
return {
top: top, left: left };
}
/**
* Merge two object
*
* @param {object} obj1
* @param {object} obj2
* @return {object} merged object
*/
function mergeObject(obj1, obj2) {
var obj3 = {};
Object.keys(obj1).forEach(function (propertyName) {
obj3[propertyName] = obj1[propertyName];
});
Object.keys(obj2).forEach(function (propertyName) {
obj3[propertyName] = obj2[propertyName];
});
return obj3;
};
/**
* Converts camel case to kebab case
* @param {string} val the value to be converted
* @return {string} the converted value
*/
function kebabCase(val) {
return val.replace(/([A-Z])/g, function ($1) {
return '-' + $1.toLowerCase();
});
};
/**
* MoveTo Constructor
* @param {object} options Options
* @param {object} easeFunctions Custom ease functions
*/
function MoveTo() {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};var easeFunctions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
this.options = mergeObject(defaults, options);
this.easeFunctions = mergeObject({ easeOutQuart: easeOutQuart }, easeFunctions);
}
/**
* Register a dom element as trigger
* @param {HTMLElement} dom Dom trigger element
* @param {function} callback Callback function
* @return {function|void} unregister function
*/
MoveTo.prototype.registerTrigger = function (dom, callback) {var _this = this;
if (!dom) {
return;
}
var href = dom.getAttribute('href') || dom.getAttribute('data-target');
// The element to be scrolled
var target = href && href !== '#' ?
document.getElementById(href.substring(1)) :
0;
var options = mergeObject(this.options, _getOptionsFromTriggerDom(dom, this.options));
if (typeof callback === 'function') {
options.callback = callback;
}
var listener = function listener(e) {
e.preventDefault();
_this.move(target, options);
};
dom.addEventListener('click', listener, false);
return function () {return dom.removeEventListener('click', listener, false);};
};
/**
* Move
* Scrolls to given element by using easeOutQuart function
* @param {HTMLElement|number} target Target element to be scrolled or target position
* @param {object} options Custom options
*/
MoveTo.prototype.move = function (target) {var _this2 = this;var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (target !== 0 && !target) {
return;
}
options = mergeObject(this.options, options);
var to = typeof target === 'number' ? target : getOffsetSum(target).top;
var from = window.pageYOffset;
to -= options.tolerance;
var change = to - from;
var startTime = null;
var lastPageYOffset = void 0;
// rAF loop
var loop = function loop(currentTime) {
var currentPageYOffset = window.pageYOffset;
if (!startTime) {
// To starts time from 1, we subtracted 1 from current time
// If time starts from 1 The first loop will not do anything,
// because easing value will be zero
startTime = currentTime - 1;
}
var timeElapsed = currentTime - startTime;
if (lastPageYOffset) {
if (
change > 0 && lastPageYOffset > currentPageYOffset ||
change < 0 && lastPageYOffset < currentPageYOffset)
{
return options.callback(target);
}
}
lastPageYOffset = currentPageYOffset;
var val = _this2.easeFunctions[options.easing](
timeElapsed, from, change, options.duration);
window.scroll(0, val);
if (timeElapsed < options.duration) {
window.requestAnimationFrame(loop);
} else {
window.scroll(0, to);
options.callback(target);
}
};
window.requestAnimationFrame(loop);
};
/**
* Adds custom ease function
* @param {string} name Ease function name
* @param {function} fn Ease function
*/
MoveTo.prototype.addEaseFunction = function (name, fn) {
this.easeFunctions[name] = fn;
};
/**
* Returns options which created from trigger dom element
* @param {HTMLElement} dom Trigger dom element
* @param {object} options The instance's options
* @return {object} The options which created from trigger dom element
*/
function _getOptionsFromTriggerDom(dom, options) {
var domOptions = {};
Object.keys(options).forEach(function (key) {
var value = dom.getAttribute('data-mt-' + kebabCase(key));
if (value) {
domOptions[key] = isNaN(value) ? value : parseInt(value, 10);
}
});
return domOptions;
}
return MoveTo;
}();
if (true) {
module.exports = MoveTo;
} else {
window.MoveTo = MoveTo;
}
/***/ }),
/* 128 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/**
* Enforces a single instance of the Raven client, and the
* main entry point for Raven. If you are a consumer of the
* Raven library, you SHOULD load this file (vs raven.js).
**/
var RavenConstructor = __webpack_require__(129);
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window = typeof window !== 'undefined' ? window
: typeof global !== 'undefined' ? global
: typeof self !== 'undefined' ? self
: {};
var _Raven = _window.Raven;
var Raven = new RavenConstructor();
/*
* Allow multiple versions of Raven to be installed.
* Strip Raven from the global context and returns the instance.
*
* @return {Raven}
*/
Raven.noConflict = function () {
_window.Raven = _Raven;
return Raven;
};
Raven.afterLoad();
module.exports = Raven;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9)))
/***/ }),
/* 129 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/*global XDomainRequest:false, __DEV__:false*/
var TraceKit = __webpack_require__(130);
var stringify = __webpack_require__(131);
var RavenConfigError = __webpack_require__(132);
var utils = __webpack_require__(73);
var isError = utils.isError,
isObject = utils.isObject;
var wrapConsoleMethod = __webpack_require__(133).wrapMethod;
var dsnKeys = 'source protocol user pass host port path'.split(' '),
dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;
function now() {
return +new Date();
}
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window = typeof window !== 'undefined' ? window
: typeof global !== 'undefined' ? global
: typeof self !== 'undefined' ? self
: {};
var _document = _window.document;
var _navigator = _window.navigator;
function keepOriginalCallback(original, callback) {
return isFunction(callback) ?
function (data) { return callback(data, original) } :
callback;
}
// First, check for JSON support
// If there is no JSON, we no-op the core features of Raven
// since JSON is required to encode the payload
function Raven() {
this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);
// Raven can run in contexts where there's no document (react-native)
this._hasDocument = !isUndefined(_document);
this._hasNavigator = !isUndefined(_navigator);
this._lastCapturedException = null;
this._lastData = null;
this._lastEventId = null;
this._globalServer = null;
this._globalKey = null;
this._globalProject = null;
this._globalContext = {};
this._globalOptions = {
logger: 'javascript',
ignoreErrors: [],
ignoreUrls: [],
whitelistUrls: [],
includePaths: [],
crossOrigin: 'anonymous',
collectWindowErrors: true,
maxMessageLength: 0,
// By default, truncates URL values to 250 chars
maxUrlLength: 250,
stackTraceLimit: 50,
autoBreadcrumbs: true,
instrument: true,
sampleRate: 1
};
this._ignoreOnError = 0;
this._isRavenInstalled = false;
this._originalErrorStackTraceLimit = Error.stackTraceLimit;
// capture references to window.console *and* all its methods first
// before the console plugin has a chance to monkey patch
this._originalConsole = _window.console || {};
this._originalConsoleMethods = {};
this._plugins = [];
this._startTime = now();
this._wrappedBuiltIns = [];
this._breadcrumbs = [];
this._lastCapturedEvent = null;
this._keypressTimeout;
this._location = _window.location;
this._lastHref = this._location && this._location.href;
this._resetBackoff();
for (var method in this._originalConsole) { // eslint-disable-line guard-for-in
this._originalConsoleMethods[method] = this._originalConsole[method];
}
}
/*
* The core Raven singleton
*
* @this {Raven}
*/
Raven.prototype = {
// Hardcode version string so that raven source can be loaded directly via
// webpack (using a build step causes webpack #1617). Grunt verifies that
// this value matches package.json during build.
// See: https://github.com/getsentry/raven-js/issues/465
VERSION: '3.17.0',
debug: false,
TraceKit: TraceKit, // alias to TraceKit
/*
* Configure Raven with a DSN and extra options
*
* @param {string} dsn The public Sentry DSN
* @param {object} options Optional set of of global options [optional]
* @return {Raven}
*/
config: function(dsn, options) {
var self = this;
if (self._globalServer) {
this._logDebug('error', 'Error: Raven has already been configured');
return self;
}
if (!dsn) return self;
var globalOptions = self._globalOptions;
// merge in options
if (options) {
each(options, function(key, value){
// tags and extra are special and need to be put into context
if (key === 'tags' || key === 'extra' || key === 'user') {
self._globalContext[key] = value;
} else {
globalOptions[key] = value;
}
});
}
self.setDSN(dsn);
// "Script error." is hard coded into browsers for errors that it can't read.
// this is the result of a script being pulled in from an external domain and CORS.
globalOptions.ignoreErrors.push(/^Script error\.?$/);
globalOptions.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/);
// join regexp rules into one big rule
globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);
globalOptions.ignoreUrls = globalOptions.ignoreUrls.length ? joinRegExp(globalOptions.ignoreUrls) : false;
globalOptions.whitelistUrls = globalOptions.whitelistUrls.length ? joinRegExp(globalOptions.whitelistUrls) : false;
globalOptions.includePaths = joinRegExp(globalOptions.includePaths);
globalOptions.maxBreadcrumbs = Math.max(0, Math.min(globalOptions.maxBreadcrumbs || 100, 100)); // default and hard limit is 100
var autoBreadcrumbDefaults = {
xhr: true,
console: true,
dom: true,
location: true
};
var autoBreadcrumbs = globalOptions.autoBreadcrumbs;
if ({}.toString.call(autoBreadcrumbs) === '[object Object]') {
autoBreadcrumbs = objectMerge(autoBreadcrumbDefaults, autoBreadcrumbs);
} else if (autoBreadcrumbs !== false) {
autoBreadcrumbs = autoBreadcrumbDefaults;
}
globalOptions.autoBreadcrumbs = autoBreadcrumbs;
var instrumentDefaults = {
tryCatch: true
};
var instrument = globalOptions.instrument;
if ({}.toString.call(instrument) === '[object Object]') {
instrument = objectMerge(instrumentDefaults, instrument);
} else if (instrument !== false) {
instrument = instrumentDefaults;
}
globalOptions.instrument = instrument;
TraceKit.collectWindowErrors = !!globalOptions.collectWindowErrors;
// return for chaining
return self;
},
/*
* Installs a global window.onerror error handler
* to capture and report uncaught exceptions.
* At this point, install() is required to be called due
* to the way TraceKit is set up.
*
* @return {Raven}
*/
install: function() {
var self = this;
if (self.isSetup() && !self._isRavenInstalled) {
TraceKit.report.subscribe(function () {
self._handleOnErrorStackInfo.apply(self, arguments);
});
if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) {
self._instrumentTryCatch();
}
if (self._globalOptions.autoBreadcrumbs)
self._instrumentBreadcrumbs();
// Install all of the plugins
self._drainPlugins();
self._isRavenInstalled = true;
}
Error.stackTraceLimit = self._globalOptions.stackTraceLimit;
return this;
},
/*
* Set the DSN (can be called multiple time unlike config)
*
* @param {string} dsn The public Sentry DSN
*/
setDSN: function(dsn) {
var self = this,
uri = self._parseDSN(dsn),
lastSlash = uri.path.lastIndexOf('/'),
path = uri.path.substr(1, lastSlash);
self._dsn = dsn;
self._globalKey = uri.user;
self._globalSecret = uri.pass && uri.pass.substr(1);
self._globalProject = uri.path.substr(lastSlash + 1);
self._globalServer = self._getGlobalServer(uri);
self._globalEndpoint = self._globalServer +
'/' + path + 'api/' + self._globalProject + '/store/';
// Reset backoff state since we may be pointing at a
// new project/server
this._resetBackoff();
},
/*
* Wrap code within a context so Raven can capture errors
* reliably across domains that is executed immediately.
*
* @param {object} options A specific set of options for this context [optional]
* @param {function} func The callback to be immediately executed within the context
* @param {array} args An array of arguments to be called with the callback [optional]
*/
context: function(options, func, args) {
if (isFunction(options)) {
args = func || [];
func = options;
options = undefined;
}
return this.wrap(options, func).apply(this, args);
},
/*
* Wrap code within a context and returns back a new function to be executed
*
* @param {object} options A specific set of options for this context [optional]
* @param {function} func The function to be wrapped in a new context
* @param {function} func A function to call before the try/catch wrapper [optional, private]
* @return {function} The newly wrapped functions with a context
*/
wrap: function(options, func, _before) {
var self = this;
// 1 argument has been passed, and it's not a function
// so just return it
if (isUndefined(func) && !isFunction(options)) {
return options;
}
// options is optional
if (isFunction(options)) {
func = options;
options = undefined;
}
// At this point, we've passed along 2 arguments, and the second one
// is not a function either, so we'll just return the second argument.
if (!isFunction(func)) {
return func;
}
// We don't wanna wrap it twice!
try {
if (func.__raven__) {
return func;
}
// If this has already been wrapped in the past, return that
if (func.__raven_wrapper__ ){
return func.__raven_wrapper__ ;
}
} catch (e) {
// Just accessing custom props in some Selenium environments
// can cause a "Permission denied" exception (see raven-js#495).
// Bail on wrapping and return the function as-is (defers to window.onerror).
return func;
}
function wrapped() {
var args = [], i = arguments.length,
deep = !options || options && options.deep !== false;
if (_before && isFunction(_before)) {
_before.apply(this, arguments);
}
// Recursively wrap all of a function's arguments that are
// functions themselves.
while(i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i];
try {
// Attempt to invoke user-land function
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
// means Raven caught an error invoking your application code. This is
// expected behavior and NOT indicative of a bug with Raven.js.
return func.apply(this, args);
} catch(e) {
self._ignoreNextOnError();
self.captureException(e, options);
throw e;
}
}
// copy over properties of the old function
for (var property in func) {
if (hasKey(func, property)) {
wrapped[property] = func[property];
}
}
wrapped.prototype = func.prototype;
func.__raven_wrapper__ = wrapped;
// Signal that this function has been wrapped already
// for both debugging and to prevent it to being wrapped twice
wrapped.__raven__ = true;
wrapped.__inner__ = func;
return wrapped;
},
/*
* Uninstalls the global error handler.
*
* @return {Raven}
*/
uninstall: function() {
TraceKit.report.uninstall();
this._restoreBuiltIns();
Error.stackTraceLimit = this._originalErrorStackTraceLimit;
this._isRavenInstalled = false;
return this;
},
/*
* Manually capture an exception and send it over to Sentry
*
* @param {error} ex An exception to be logged
* @param {object} options A specific set of options for this error [optional]
* @return {Raven}
*/
captureException: function(ex, options) {
// If not an Error is passed through, recall as a message instead
if (!isError(ex)) {
return this.captureMessage(ex, objectMerge({
trimHeadFrames: 1,
stacktrace: true // if we fall back to captureMessage, default to attempting a new trace
}, options));
}
// Store the raw exception object for potential debugging and introspection
this._lastCapturedException = ex;
// TraceKit.report will re-raise any exception passed to it,
// which means you have to wrap it in try/catch. Instead, we
// can wrap it here and only re-raise if TraceKit.report
// raises an exception different from the one we asked to
// report on.
try {
var stack = TraceKit.computeStackTrace(ex);
this._handleStackInfo(stack, options);
} catch(ex1) {
if(ex !== ex1) {
throw ex1;
}
}
return this;
},
/*
* Manually send a message to Sentry
*
* @param {string} msg A plain message to be captured in Sentry
* @param {object} options A specific set of options for this message [optional]
* @return {Raven}
*/
captureMessage: function(msg, options) {
// config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an
// early call; we'll error on the side of logging anything called before configuration since it's
// probably something you should see:
if (!!this._globalOptions.ignoreErrors.test && this._globalOptions.ignoreErrors.test(msg)) {
return;
}
options = options || {};
var data = objectMerge({
message: msg + '' // Make sure it's actually a string
}, options);
if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
var ex;
// Generate a "synthetic" stack trace from this point.
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative
// of a bug with Raven.js. Sentry generates synthetic traces either by configuration,
// or if it catches a thrown object without a "stack" property.
try {
throw new Error(msg);
} catch (ex1) {
ex = ex1;
}
// null exception name so `Error` isn't prefixed to msg
ex.name = null;
options = objectMerge({
// fingerprint on msg, not stack trace (legacy behavior, could be
// revisited)
fingerprint: msg,
// since we know this is a synthetic trace, the top N-most frames
// MUST be from Raven.js, so mark them as in_app later by setting
// trimHeadFrames
trimHeadFrames: (options.trimHeadFrames || 0) + 1
}, options);
var stack = TraceKit.computeStackTrace(ex);
var frames = this._prepareFrames(stack, options);
data.stacktrace = {
// Sentry expects frames oldest to newest
frames: frames.reverse()
}
}
// Fire away!
this._send(data);
return this;
},
captureBreadcrumb: function (obj) {
var crumb = objectMerge({
timestamp: now() / 1000
}, obj);
if (isFunction(this._globalOptions.breadcrumbCallback)) {
var result = this._globalOptions.breadcrumbCallback(crumb);
if (isObject(result) && !isEmptyObject(result)) {
crumb = result;
} else if (result === false) {
return this;
}
}
this._breadcrumbs.push(crumb);
if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {
this._breadcrumbs.shift();
}
return this;
},
addPlugin: function(plugin /*arg1, arg2, ... argN*/) {
var pluginArgs = [].slice.call(arguments, 1);
this._plugins.push([plugin, pluginArgs]);
if (this._isRavenInstalled) {
this._drainPlugins();
}
return this;
},
/*
* Set/clear a user to be sent along with the payload.
*
* @param {object} user An object representing user data [optional]
* @return {Raven}
*/
setUserContext: function(user) {
// Intentionally do not merge here since that's an unexpected behavior.
this._globalContext.user = user;
return this;
},
/*
* Merge extra attributes to be sent along with the payload.
*
* @param {object} extra An object representing extra data [optional]
* @return {Raven}
*/
setExtraContext: function(extra) {
this._mergeContext('extra', extra);
return this;
},
/*
* Merge tags to be sent along with the payload.
*
* @param {object} tags An object representing tags [optional]
* @return {Raven}
*/
setTagsContext: function(tags) {
this._mergeContext('tags', tags);
return this;
},
/*
* Clear all of the context.
*
* @return {Raven}
*/
clearContext: function() {
this._globalContext = {};
return this;
},
/*
* Get a copy of the current context. This cannot be mutated.
*
* @return {object} copy of context
*/
getContext: function() {
// lol javascript
return JSON.parse(stringify(this._globalContext));
},
/*
* Set environment of application
*
* @param {string} environment Typically something like 'production'.
* @return {Raven}
*/
setEnvironment: function(environment) {
this._globalOptions.environment = environment;
return this;
},
/*
* Set release version of application
*
* @param {string} release Typically something like a git SHA to identify version
* @return {Raven}
*/
setRelease: function(release) {
this._globalOptions.release = release;
return this;
},
/*
* Set the dataCallback option
*
* @param {function} callback The callback to run which allows the
* data blob to be mutated before sending
* @return {Raven}
*/
setDataCallback: function(callback) {
var original = this._globalOptions.dataCallback;
this._globalOptions.dataCallback =
keepOriginalCallback(original, callback);
return this;
},
/*
* Set the breadcrumbCallback option
*
* @param {function} callback The callback to run which allows filtering
* or mutating breadcrumbs
* @return {Raven}
*/
setBreadcrumbCallback: function(callback) {
var original = this._globalOptions.breadcrumbCallback;
this._globalOptions.breadcrumbCallback =
keepOriginalCallback(original, callback);
return this;
},
/*
* Set the shouldSendCallback option
*
* @param {function} callback The callback to run which allows
* introspecting the blob before sending
* @return {Raven}
*/
setShouldSendCallback: function(callback) {
var original = this._globalOptions.shouldSendCallback;
this._globalOptions.shouldSendCallback =
keepOriginalCallback(original, callback);
return this;
},
/**
* Override the default HTTP transport mechanism that transmits data
* to the Sentry server.
*
* @param {function} transport Function invoked instead of the default
* `makeRequest` handler.
*
* @return {Raven}
*/
setTransport: function(transport) {
this._globalOptions.transport = transport;
return this;
},
/*
* Get the latest raw exception that was captured by Raven.
*
* @return {error}
*/
lastException: function() {
return this._lastCapturedException;
},
/*
* Get the last event id
*
* @return {string}
*/
lastEventId: function() {
return this._lastEventId;
},
/*
* Determine if Raven is setup and ready to go.
*
* @return {boolean}
*/
isSetup: function() {
if (!this._hasJSON) return false; // needs JSON support
if (!this._globalServer) {
if (!this.ravenNotConfiguredError) {
this.ravenNotConfiguredError = true;
this._logDebug('error', 'Error: Raven has not been configured.');
}
return false;
}
return true;
},
afterLoad: function () {
// TODO: remove window dependence?
// Attempt to initialize Raven on load
var RavenConfig = _window.RavenConfig;
if (RavenConfig) {
this.config(RavenConfig.dsn, RavenConfig.config).install();
}
},
showReportDialog: function (options) {
if (!_document) // doesn't work without a document (React native)
return;
options = options || {};
var lastEventId = options.eventId || this.lastEventId();
if (!lastEventId) {
throw new RavenConfigError('Missing eventId');
}
var dsn = options.dsn || this._dsn;
if (!dsn) {
throw new RavenConfigError('Missing DSN');
}
var encode = encodeURIComponent;
var qs = '';
qs += '?eventId=' + encode(lastEventId);
qs += '&dsn=' + encode(dsn);
var user = options.user || this._globalContext.user;
if (user) {
if (user.name) qs += '&name=' + encode(user.name);
if (user.email) qs += '&email=' + encode(user.email);
}
var globalServer = this._getGlobalServer(this._parseDSN(dsn));
var script = _document.createElement('script');
script.async = true;
script.src = globalServer + '/api/embed/error-page/' + qs;
(_document.head || _document.body).appendChild(script);
},
/**** Private functions ****/
_ignoreNextOnError: function () {
var self = this;
this._ignoreOnError += 1;
setTimeout(function () {
// onerror should trigger before setTimeout
self._ignoreOnError -= 1;
});
},
_triggerEvent: function(eventType, options) {
// NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it
var evt, key;
if (!this._hasDocument)
return;
options = options || {};
eventType = 'raven' + eventType.substr(0,1).toUpperCase() + eventType.substr(1);
if (_document.createEvent) {
evt = _document.createEvent('HTMLEvents');
evt.initEvent(eventType, true, true);
} else {
evt = _document.createEventObject();
evt.eventType = eventType;
}
for (key in options) if (hasKey(options, key)) {
evt[key] = options[key];
}
if (_document.createEvent) {
// IE9 if standards
_document.dispatchEvent(evt);
} else {
// IE8 regardless of Quirks or Standards
// IE9 if quirks
try {
_document.fireEvent('on' + evt.eventType.toLowerCase(), evt);
} catch(e) {
// Do nothing
}
}
},
/**
* Wraps addEventListener to capture UI breadcrumbs
* @param evtName the event name (e.g. "click")
* @returns {Function}
* @private
*/
_breadcrumbEventHandler: function(evtName) {
var self = this;
return function (evt) {
// reset keypress timeout; e.g. triggering a 'click' after
// a 'keypress' will reset the keypress debounce so that a new
// set of keypresses can be recorded
self._keypressTimeout = null;
// It's possible this handler might trigger multiple times for the same
// event (e.g. event propagation through node ancestors). Ignore if we've
// already captured the event.
if (self._lastCapturedEvent === evt)
return;
self._lastCapturedEvent = evt;
// try/catch both:
// - accessing evt.target (see getsentry/raven-js#838, #768)
// - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly
// can throw an exception in some circumstances.
var target;
try {
target = htmlTreeAsString(evt.target);
} catch (e) {
target = '<unknown>';
}
self.captureBreadcrumb({
category: 'ui.' + evtName, // e.g. ui.click, ui.input
message: target
});
};
},
/**
* Wraps addEventListener to capture keypress UI events
* @returns {Function}
* @private
*/
_keypressEventHandler: function() {
var self = this,
debounceDuration = 1000; // milliseconds
// TODO: if somehow user switches keypress target before
// debounce timeout is triggered, we will only capture
// a single breadcrumb from the FIRST target (acceptable?)
return function (evt) {
var target;
try {
target = evt.target;
} catch (e) {
// just accessing event properties can throw an exception in some rare circumstances
// see: https://github.com/getsentry/raven-js/issues/838
return;
}
var tagName = target && target.tagName;
// only consider keypress events on actual input elements
// this will disregard keypresses targeting body (e.g. tabbing
// through elements, hotkeys, etc)
if (!tagName || tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)
return;
// record first keypress in a series, but ignore subsequent
// keypresses until debounce clears
var timeout = self._keypressTimeout;
if (!timeout) {
self._breadcrumbEventHandler('input')(evt);
}
clearTimeout(timeout);
self._keypressTimeout = setTimeout(function () {
self._keypressTimeout = null;
}, debounceDuration);
};
},
/**
* Captures a breadcrumb of type "navigation", normalizing input URLs
* @param to the originating URL
* @param from the target URL
* @private
*/
_captureUrlChange: function(from, to) {
var parsedLoc = parseUrl(this._location.href);
var parsedTo = parseUrl(to);
var parsedFrom = parseUrl(from);
// because onpopstate only tells you the "new" (to) value of location.href, and
// not the previous (from) value, we need to track the value of the current URL
// state ourselves
this._lastHref = to;
// Use only the path component of the URL if the URL matches the current
// document (almost all the time when using pushState)
if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host)
to = parsedTo.relative;
if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host)
from = parsedFrom.relative;
this.captureBreadcrumb({
category: 'navigation',
data: {
to: to,
from: from
}
});
},
/**
* Wrap timer functions and event targets to catch errors and provide
* better metadata.
*/
_instrumentTryCatch: function() {
var self = this;
var wrappedBuiltIns = self._wrappedBuiltIns;
function wrapTimeFn(orig) {
return function (fn, t) { // preserve arity
// Make a copy of the arguments to prevent deoptimization
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var args = new Array(arguments.length);
for(var i = 0; i < args.length; ++i) {
args[i] = arguments[i];
}
var originalCallback = args[0];
if (isFunction(originalCallback)) {
args[0] = self.wrap(originalCallback);
}
// IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it
// also supports only two arguments and doesn't care what this is, so we
// can just call the original function directly.
if (orig.apply) {
return orig.apply(this, args);
} else {
return orig(args[0], args[1]);
}
};
}
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
function wrapEventTarget(global) {
var proto = _window[global] && _window[global].prototype;
if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) {
fill(proto, 'addEventListener', function(orig) {
return function (evtName, fn, capture, secure) { // preserve arity
try {
if (fn && fn.handleEvent) {
fn.handleEvent = self.wrap(fn.handleEvent);
}
} catch (err) {
// can sometimes get 'Permission denied to access property "handle Event'
}
// More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`
// so that we don't have more than one wrapper function
var before,
clickHandler,
keypressHandler;
if (autoBreadcrumbs && autoBreadcrumbs.dom && (global === 'EventTarget' || global === 'Node')) {
// NOTE: generating multiple handlers per addEventListener invocation, should
// revisit and verify we can just use one (almost certainly)
clickHandler = self._breadcrumbEventHandler('click');
keypressHandler = self._keypressEventHandler();
before = function (evt) {
// need to intercept every DOM event in `before` argument, in case that
// same wrapped method is re-used for different events (e.g. mousemove THEN click)
// see #724
if (!evt) return;
var eventType;
try {
eventType = evt.type
} catch (e) {
// just accessing event properties can throw an exception in some rare circumstances
// see: https://github.com/getsentry/raven-js/issues/838
return;
}
if (eventType === 'click')
return clickHandler(evt);
else if (eventType === 'keypress')
return keypressHandler(evt);
};
}
return orig.call(this, evtName, self.wrap(fn, undefined, before), capture, secure);
};
}, wrappedBuiltIns);
fill(proto, 'removeEventListener', function (orig) {
return function (evt, fn, capture, secure) {
try {
fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn);
} catch (e) {
// ignore, accessing __raven_wrapper__ will throw in some Selenium environments
}
return orig.call(this, evt, fn, capture, secure);
};
}, wrappedBuiltIns);
}
}
fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns);
fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns);
if (_window.requestAnimationFrame) {
fill(_window, 'requestAnimationFrame', function (orig) {
return function (cb) {
return orig(self.wrap(cb));
};
}, wrappedBuiltIns);
}
// event targets borrowed from bugsnag-js:
// https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666
var eventTargets = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];
for (var i = 0; i < eventTargets.length; i++) {
wrapEventTarget(eventTargets[i]);
}
},
/**
* Instrument browser built-ins w/ breadcrumb capturing
* - XMLHttpRequests
* - DOM interactions (click/typing)
* - window.location changes
* - console
*
* Can be disabled or individually configured via the `autoBreadcrumbs` config option
*/
_instrumentBreadcrumbs: function () {
var self = this;
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
var wrappedBuiltIns = self._wrappedBuiltIns;
function wrapProp(prop, xhr) {
if (prop in xhr && isFunction(xhr[prop])) {
fill(xhr, prop, function (orig) {
return self.wrap(orig);
}); // intentionally don't track filled methods on XHR instances
}
}
if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window) {
var xhrproto = XMLHttpRequest.prototype;
fill(xhrproto, 'open', function(origOpen) {
return function (method, url) { // preserve arity
// if Sentry key appears in URL, don't capture
if (isString(url) && url.indexOf(self._globalKey) === -1) {
this.__raven_xhr = {
method: method,
url: url,
status_code: null
};
}
return origOpen.apply(this, arguments);
};
}, wrappedBuiltIns);
fill(xhrproto, 'send', function(origSend) {
return function (data) { // preserve arity
var xhr = this;
function onreadystatechangeHandler() {
if (xhr.__raven_xhr && (xhr.readyState === 1 || xhr.readyState === 4)) {
try {
// touching statusCode in some platforms throws
// an exception
xhr.__raven_xhr.status_code = xhr.status;
} catch (e) { /* do nothing */ }
self.captureBreadcrumb({
type: 'http',
category: 'xhr',
data: xhr.__raven_xhr
});
}
}
var props = ['onload', 'onerror', 'onprogress'];
for (var j = 0; j < props.length; j++) {
wrapProp(props[j], xhr);
}
if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) {
fill(xhr, 'onreadystatechange', function (orig) {
return self.wrap(orig, undefined, onreadystatechangeHandler);
} /* intentionally don't track this instrumentation */);
} else {
// if onreadystatechange wasn't actually set by the page on this xhr, we
// are free to set our own and capture the breadcrumb
xhr.onreadystatechange = onreadystatechangeHandler;
}
return origSend.apply(this, arguments);
};
}, wrappedBuiltIns);
}
if (autoBreadcrumbs.xhr && 'fetch' in _window) {
fill(_window, 'fetch', function(origFetch) {
return function (fn, t) { // preserve arity
// Make a copy of the arguments to prevent deoptimization
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i) {
args[i] = arguments[i];
}
var fetchInput = args[0];
var method = 'GET';
var url;
if (typeof fetchInput === 'string') {
url = fetchInput;
} else {
url = fetchInput.url;
if (fetchInput.method) {
method = fetchInput.method;
}
}
if (args[1] && args[1].method) {
method = args[1].method;
}
var fetchData = {
method: method,
url: url,
status_code: null
};
self.captureBreadcrumb({
type: 'http',
category: 'fetch',
data: fetchData
});
return origFetch.apply(this, args).then(function (response) {
fetchData.status_code = response.status;
return response;
});
};
}, wrappedBuiltIns);
}
// Capture breadcrumbs from any click that is unhandled / bubbled up all the way
// to the document. Do this before we instrument addEventListener.
if (autoBreadcrumbs.dom && this._hasDocument) {
if (_document.addEventListener) {
_document.addEventListener('click', self._breadcrumbEventHandler('click'), false);
_document.addEventListener('keypress', self._keypressEventHandler(), false);
}
else {
// IE8 Compatibility
_document.attachEvent('onclick', self._breadcrumbEventHandler('click'));
_document.attachEvent('onkeypress', self._keypressEventHandler());
}
}
// record navigation (URL) changes
// NOTE: in Chrome App environment, touching history.pushState, *even inside
// a try/catch block*, will cause Chrome to output an error to console.error
// borrowed from: https://github.com/angular/angular.js/pull/13945/files
var chrome = _window.chrome;
var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;
var hasPushState = !isChromePackagedApp && _window.history && history.pushState;
if (autoBreadcrumbs.location && hasPushState) {
// TODO: remove onpopstate handler on uninstall()
var oldOnPopState = _window.onpopstate;
_window.onpopstate = function () {
var currentHref = self._location.href;
self._captureUrlChange(self._lastHref, currentHref);
if (oldOnPopState) {
return oldOnPopState.apply(this, arguments);
}
};
fill(history, 'pushState', function (origPushState) {
// note history.pushState.length is 0; intentionally not declaring
// params to preserve 0 arity
return function (/* state, title, url */) {
var url = arguments.length > 2 ? arguments[2] : undefined;
// url argument is optional
if (url) {
// coerce to string (this is what pushState does)
self._captureUrlChange(self._lastHref, url + '');
}
return origPushState.apply(this, arguments);
};
}, wrappedBuiltIns);
}
if (autoBreadcrumbs.console && 'console' in _window && console.log) {
// console
var consoleMethodCallback = function (msg, data) {
self.captureBreadcrumb({
message: msg,
level: data.level,
category: 'console'
});
};
each(['debug', 'info', 'warn', 'error', 'log'], function (_, level) {
wrapConsoleMethod(console, level, consoleMethodCallback);
});
}
},
_restoreBuiltIns: function () {
// restore any wrapped builtins
var builtin;
while (this._wrappedBuiltIns.length) {
builtin = this._wrappedBuiltIns.shift();
var obj = builtin[0],
name = builtin[1],
orig = builtin[2];
obj[name] = orig;
}
},
_drainPlugins: function() {
var self = this;
// FIX ME TODO
each(this._plugins, function(_, plugin) {
var installer = plugin[0];
var args = plugin[1];
installer.apply(self, [self].concat(args));
});
},
_parseDSN: function(str) {
var m = dsnPattern.exec(str),
dsn = {},
i = 7;
try {
while (i--) dsn[dsnKeys[i]] = m[i] || '';
} catch(e) {
throw new RavenConfigError('Invalid DSN: ' + str);
}
if (dsn.pass && !this._globalOptions.allowSecretKey) {
throw new RavenConfigError('Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key');
}
return dsn;
},
_getGlobalServer: function(uri) {
// assemble the endpoint from the uri pieces
var globalServer = '//' + uri.host +
(uri.port ? ':' + uri.port : '');
if (uri.protocol) {
globalServer = uri.protocol + ':' + globalServer;
}
return globalServer;
},
_handleOnErrorStackInfo: function() {
// if we are intentionally ignoring errors via onerror, bail out
if (!this._ignoreOnError) {
this._handleStackInfo.apply(this, arguments);
}
},
_handleStackInfo: function(stackInfo, options) {
var frames = this._prepareFrames(stackInfo, options);
this._triggerEvent('handle', {
stackInfo: stackInfo,
options: options
});
this._processException(
stackInfo.name,
stackInfo.message,
stackInfo.url,
stackInfo.lineno,
frames,
options
);
},
_prepareFrames: function(stackInfo, options) {
var self = this;
var frames = [];
if (stackInfo.stack && stackInfo.stack.length) {
each(stackInfo.stack, function(i, stack) {
var frame = self._normalizeFrame(stack);
if (frame) {
frames.push(frame);
}
});
// e.g. frames captured via captureMessage throw
if (options && options.trimHeadFrames) {
for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {
frames[j].in_app = false;
}
}
}
frames = frames.slice(0, this._globalOptions.stackTraceLimit);
return frames;
},
_normalizeFrame: function(frame) {
if (!frame.url) return;
// normalize the frames data
var normalized = {
filename: frame.url,
lineno: frame.line,
colno: frame.column,
'function': frame.func || '?'
};
normalized.in_app = !( // determine if an exception came from outside of our app
// first we check the global includePaths list.
!!this._globalOptions.includePaths.test && !this._globalOptions.includePaths.test(normalized.filename) ||
// Now we check for fun, if the function name is Raven or TraceKit
/(Raven|TraceKit)\./.test(normalized['function']) ||
// finally, we do a last ditch effort and check for raven.min.js
/raven\.(min\.)?js$/.test(normalized.filename)
);
return normalized;
},
_processException: function(type, message, fileurl, lineno, frames, options) {
var stacktrace;
if (!!this._globalOptions.ignoreErrors.test && this._globalOptions.ignoreErrors.test(message)) return;
message += '';
if (frames && frames.length) {
fileurl = frames[0].filename || fileurl;
// Sentry expects frames oldest to newest
// and JS sends them as newest to oldest
frames.reverse();
stacktrace = {frames: frames};
} else if (fileurl) {
stacktrace = {
frames: [{
filename: fileurl,
lineno: lineno,
in_app: true
}]
};
}
if (!!this._globalOptions.ignoreUrls.test && this._globalOptions.ignoreUrls.test(fileurl)) return;
if (!!this._globalOptions.whitelistUrls.test && !this._globalOptions.whitelistUrls.test(fileurl)) return;
var data = objectMerge({
// sentry.interfaces.Exception
exception: {
values: [{
type: type,
value: message,
stacktrace: stacktrace
}]
},
culprit: fileurl
}, options);
// Fire away!
this._send(data);
},
_trimPacket: function(data) {
// For now, we only want to truncate the two different messages
// but this could/should be expanded to just trim everything
var max = this._globalOptions.maxMessageLength;
if (data.message) {
data.message = truncate(data.message, max);
}
if (data.exception) {
var exception = data.exception.values[0];
exception.value = truncate(exception.value, max);
}
var request = data.request;
if (request) {
if (request.url) {
request.url = truncate(request.url, this._globalOptions.maxUrlLength);
}
if (request.Referer) {
request.Referer = truncate(request.Referer, this._globalOptions.maxUrlLength);
}
}
if (data.breadcrumbs && data.breadcrumbs.values)
this._trimBreadcrumbs(data.breadcrumbs);
return data;
},
/**
* Truncate breadcrumb values (right now just URLs)
*/
_trimBreadcrumbs: function (breadcrumbs) {
// known breadcrumb properties with urls
// TODO: also consider arbitrary prop values that start with (https?)?://
var urlProps = ['to', 'from', 'url'],
urlProp,
crumb,
data;
for (var i = 0; i < breadcrumbs.values.length; ++i) {
crumb = breadcrumbs.values[i];
if (!crumb.hasOwnProperty('data') || !isObject(crumb.data) || objectFrozen(crumb.data))
continue;
data = objectMerge({}, crumb.data);
for (var j = 0; j < urlProps.length; ++j) {
urlProp = urlProps[j];
if (data.hasOwnProperty(urlProp)) {
data[urlProp] = truncate(data[urlProp], this._globalOptions.maxUrlLength);
}
}
breadcrumbs.values[i].data = data;
}
},
_getHttpData: function() {
if (!this._hasNavigator && !this._hasDocument) return;
var httpData = {};
if (this._hasNavigator && _navigator.userAgent) {
httpData.headers = {
'User-Agent': navigator.userAgent
};
}
if (this._hasDocument) {
if (_document.location && _document.location.href) {
httpData.url = _document.location.href;
}
if (_document.referrer) {
if (!httpData.headers) httpData.headers = {};
httpData.headers.Referer = _document.referrer;
}
}
return httpData;
},
_resetBackoff: function() {
this._backoffDuration = 0;
this._backoffStart = null;
},
_shouldBackoff: function() {
return this._backoffDuration && now() - this._backoffStart < this._backoffDuration;
},
/**
* Returns true if the in-process data payload matches the signature
* of the previously-sent data
*
* NOTE: This has to be done at this level because TraceKit can generate
* data from window.onerror WITHOUT an exception object (IE8, IE9,
* other old browsers). This can take the form of an "exception"
* data object with a single frame (derived from the onerror args).
*/
_isRepeatData: function (current) {
var last = this._lastData;
if (!last ||
current.message !== last.message || // defined for captureMessage
current.culprit !== last.culprit) // defined for captureException/onerror
return false;
// Stacktrace interface (i.e. from captureMessage)
if (current.stacktrace || last.stacktrace) {
return isSameStacktrace(current.stacktrace, last.stacktrace);
}
// Exception interface (i.e. from captureException/onerror)
else if (current.exception || last.exception) {
return isSameException(current.exception, last.exception);
}
return true;
},
_setBackoffState: function(request) {
// If we are already in a backoff state, don't change anything
if (this._shouldBackoff()) {
return;
}
var status = request.status;
// 400 - project_id doesn't exist or some other fatal
// 401 - invalid/revoked dsn
// 429 - too many requests
if (!(status === 400 || status === 401 || status === 429))
return;
var retry;
try {
// If Retry-After is not in Access-Control-Expose-Headers, most
// browsers will throw an exception trying to access it
retry = request.getResponseHeader('Retry-After');
retry = parseInt(retry, 10) * 1000; // Retry-After is returned in seconds
} catch (e) {
/* eslint no-empty:0 */
}
this._backoffDuration = retry
// If Sentry server returned a Retry-After value, use it
? retry
// Otherwise, double the last backoff duration (starts at 1 sec)
: this._backoffDuration * 2 || 1000;
this._backoffStart = now();
},
_send: function(data) {
var globalOptions = this._globalOptions;
var baseData = {
project: this._globalProject,
logger: globalOptions.logger,
platform: 'javascript'
}, httpData = this._getHttpData();
if (httpData) {
baseData.request = httpData;
}
// HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload
if (data.trimHeadFrames) delete data.trimHeadFrames;
data = objectMerge(baseData, data);
// Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
data.tags = objectMerge(objectMerge({}, this._globalContext.tags), data.tags);
data.extra = objectMerge(objectMerge({}, this._globalContext.extra), data.extra);
// Send along our own collected metadata with extra
data.extra['session:duration'] = now() - this._startTime;
if (this._breadcrumbs && this._breadcrumbs.length > 0) {
// intentionally make shallow copy so that additions
// to breadcrumbs aren't accidentally sent in this request
data.breadcrumbs = {
values: [].slice.call(this._breadcrumbs, 0)
};
}
// If there are no tags/extra, strip the key from the payload alltogther.
if (isEmptyObject(data.tags)) delete data.tags;
if (this._globalContext.user) {
// sentry.interfaces.User
data.user = this._globalContext.user;
}
// Include the environment if it's defined in globalOptions
if (globalOptions.environment) data.environment = globalOptions.environment;
// Include the release if it's defined in globalOptions
if (globalOptions.release) data.release = globalOptions.release;
// Include server_name if it's defined in globalOptions
if (globalOptions.serverName) data.server_name = globalOptions.serverName;
if (isFunction(globalOptions.dataCallback)) {
data = globalOptions.dataCallback(data) || data;
}
// Why??????????
if (!data || isEmptyObject(data)) {
return;
}
// Check if the request should be filtered or not
if (isFunction(globalOptions.shouldSendCallback) && !globalOptions.shouldSendCallback(data)) {
return;
}
// Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests),
// so drop requests until "cool-off" period has elapsed.
if (this._shouldBackoff()) {
this._logDebug('warn', 'Raven dropped error due to backoff: ', data);
return;
}
if (typeof globalOptions.sampleRate === 'number') {
if (Math.random() < globalOptions.sampleRate) {
this._sendProcessedPayload(data);
}
} else {
this._sendProcessedPayload(data);
}
},
_getUuid: function () {
return uuid4();
},
_sendProcessedPayload: function(data, callback) {
var self = this;
var globalOptions = this._globalOptions;
if (!this.isSetup()) return;
// Send along an event_id if not explicitly passed.
// This event_id can be used to reference the error within Sentry itself.
// Set lastEventId after we know the error should actually be sent
this._lastEventId = data.event_id || (data.event_id = this._getUuid());
// Try and clean up the packet before sending by truncating long values
data = this._trimPacket(data);
// ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback,
// but this would require copying an un-truncated copy of the data packet, which can be
// arbitrarily deep (extra_data) -- could be worthwhile? will revisit
if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) {
this._logDebug('warn', 'Raven dropped repeat event: ', data);
return;
}
// Store outbound payload after trim
this._lastData = data;
this._logDebug('debug', 'Raven about to send:', data);
var auth = {
sentry_version: '7',
sentry_client: 'raven-js/' + this.VERSION,
sentry_key: this._globalKey
};
if (this._globalSecret) {
auth.sentry_secret = this._globalSecret;
}
var exception = data.exception && data.exception.values[0];
this.captureBreadcrumb({
category: 'sentry',
message: exception
? (exception.type ? exception.type + ': ' : '') + exception.value
: data.message,
event_id: data.event_id,
level: data.level || 'error' // presume error unless specified
});
var url = this._globalEndpoint;
(globalOptions.transport || this._makeRequest).call(this, {
url: url,
auth: auth,
data: data,
options: globalOptions,
onSuccess: function success() {
self._resetBackoff();
self._triggerEvent('success', {
data: data,
src: url
});
callback && callback();
},
onError: function failure(error) {
self._logDebug('error', 'Raven transport failed to send: ', error);
if (error.request) {
self._setBackoffState(error.request);
}
self._triggerEvent('failure', {
data: data,
src: url
});
error = error || new Error('Raven send failed (no additional details provided)');
callback && callback(error);
}
});
},
_makeRequest: function(opts) {
var request = new XMLHttpRequest();
// if browser doesn't support CORS (e.g. IE7), we are out of luck
var hasCORS =
'withCredentials' in request ||
typeof XDomainRequest !== 'undefined';
if (!hasCORS) return;
var url = opts.url;
if ('withCredentials' in request) {
request.onreadystatechange = function () {
if (request.readyState !== 4) {
return;
} else if (request.status === 200) {
opts.onSuccess && opts.onSuccess();
} else if (opts.onError) {
var err = new Error('Sentry error code: ' + request.status);
err.request = request;
opts.onError(err);
}
};
} else {
request = new XDomainRequest();
// xdomainrequest cannot go http -> https (or vice versa),
// so always use protocol relative
url = url.replace(/^https?:/, '');
// onreadystatechange not supported by XDomainRequest
if (opts.onSuccess) {
request.onload = opts.onSuccess;
}
if (opts.onError) {
request.onerror = function () {
var err = new Error('Sentry error code: XDomainRequest');
err.request = request;
opts.onError(err);
}
}
}
// NOTE: auth is intentionally sent as part of query string (NOT as custom
// HTTP header) so as to avoid preflight CORS requests
request.open('POST', url + '?' + urlencode(opts.auth));
request.send(stringify(opts.data));
},
_logDebug: function(level) {
if (this._originalConsoleMethods[level] && this.debug) {
// In IE<10 console methods do not have their own 'apply' method
Function.prototype.apply.call(
this._originalConsoleMethods[level],
this._originalConsole,
[].slice.call(arguments, 1)
);
}
},
_mergeContext: function(key, context) {
if (isUndefined(context)) {
delete this._globalContext[key];
} else {
this._globalContext[key] = objectMerge(this._globalContext[key] || {}, context);
}
}
};
/*------------------------------------------------
* utils
*
* conditionally exported for test via Raven.utils
=================================================
*/
var objectPrototype = Object.prototype;
function isUndefined(what) {
return what === void 0;
}
function isFunction(what) {
return typeof what === 'function';
}
function isString(what) {
return objectPrototype.toString.call(what) === '[object String]';
}
function isEmptyObject(what) {
for (var _ in what) return false; // eslint-disable-line guard-for-in, no-unused-vars
return true;
}
function each(obj, callback) {
var i, j;
if (isUndefined(obj.length)) {
for (i in obj) {
if (hasKey(obj, i)) {
callback.call(null, i, obj[i]);
}
}
} else {
j = obj.length;
if (j) {
for (i = 0; i < j; i++) {
callback.call(null, i, obj[i]);
}
}
}
}
function objectMerge(obj1, obj2) {
if (!obj2) {
return obj1;
}
each(obj2, function(key, value){
obj1[key] = value;
});
return obj1;
}
/**
* This function is only used for react-native.
* react-native freezes object that have already been sent over the
* js bridge. We need this function in order to check if the object is frozen.
* So it's ok that objectFrozen returns false if Object.isFrozen is not
* supported because it's not relevant for other "platforms". See related issue:
* https://github.com/getsentry/react-native-sentry/issues/57
*/
function objectFrozen(obj) {
if (!Object.isFrozen) {
return false;
}
return Object.isFrozen(obj);
}
function truncate(str, max) {
return !max || str.length <= max ? str : str.substr(0, max) + '\u2026';
}
/**
* hasKey, a better form of hasOwnProperty
* Example: hasKey(MainHostObject, property) === true/false
*
* @param {Object} host object to check property
* @param {string} key to check
*/
function hasKey(object, key) {
return objectPrototype.hasOwnProperty.call(object, key);
}
function joinRegExp(patterns) {
// Combine an array of regular expressions and strings into one large regexp
// Be mad.
var sources = [],
i = 0, len = patterns.length,
pattern;
for (; i < len; i++) {
pattern = patterns[i];
if (isString(pattern)) {
// If it's a string, we need to escape it
// Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
sources.push(pattern.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'));
} else if (pattern && pattern.source) {
// If it's a regexp already, we want to extract the source
sources.push(pattern.source);
}
// Intentionally skip other cases
}
return new RegExp(sources.join('|'), 'i');
}
function urlencode(o) {
var pairs = [];
each(o, function(key, value) {
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
});
return pairs.join('&');
}
// borrowed from https://tools.ietf.org/html/rfc3986#appendix-B
// intentionally using regex and not <a/> href parsing trick because React Native and other
// environments where DOM might not be available
function parseUrl(url) {
var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
if (!match) return {};
// coerce to undefined values to empty string so we don't get 'undefined'
var query = match[6] || '';
var fragment = match[8] || '';
return {
protocol: match[2],
host: match[4],
path: match[5],
relative: match[5] + query + fragment // everything minus origin
};
}
function uuid4() {
var crypto = _window.crypto || _window.msCrypto;
if (!isUndefined(crypto) && crypto.getRandomValues) {
// Use window.crypto API if available
var arr = new Uint16Array(8);
crypto.getRandomValues(arr);
// set 4 in byte 7
arr[3] = arr[3] & 0xFFF | 0x4000;
// set 2 most significant bits of byte 9 to '10'
arr[4] = arr[4] & 0x3FFF | 0x8000;
var pad = function(num) {
var v = num.toString(16);
while (v.length < 4) {
v = '0' + v;
}
return v;
};
return pad(arr[0]) + pad(arr[1]) + pad(arr[2]) + pad(arr[3]) + pad(arr[4]) +
pad(arr[5]) + pad(arr[6]) + pad(arr[7]);
} else {
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0,
v = c === 'x' ? r : r&0x3|0x8;
return v.toString(16);
});
}
}
/**
* Given a child DOM element, returns a query-selector statement describing that
* and its ancestors
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
* @param elem
* @returns {string}
*/
function htmlTreeAsString(elem) {
/* eslint no-extra-parens:0*/
var MAX_TRAVERSE_HEIGHT = 5,
MAX_OUTPUT_LEN = 80,
out = [],
height = 0,
len = 0,
separator = ' > ',
sepLength = separator.length,
nextStr;
while (elem && height++ < MAX_TRAVERSE_HEIGHT) {
nextStr = htmlElementAsString(elem);
// bail out if
// - nextStr is the 'html' element
// - the length of the string that would be created exceeds MAX_OUTPUT_LEN
// (ignore this limit if we are on the first iteration)
if (nextStr === 'html' || height > 1 && len + (out.length * sepLength) + nextStr.length >= MAX_OUTPUT_LEN) {
break;
}
out.push(nextStr);
len += nextStr.length;
elem = elem.parentNode;
}
return out.reverse().join(separator);
}
/**
* Returns a simple, query-selector representation of a DOM element
* e.g. [HTMLElement] => input#foo.btn[name=baz]
* @param HTMLElement
* @returns {string}
*/
function htmlElementAsString(elem) {
var out = [],
className,
classes,
key,
attr,
i;
if (!elem || !elem.tagName) {
return '';
}
out.push(elem.tagName.toLowerCase());
if (elem.id) {
out.push('#' + elem.id);
}
className = elem.className;
if (className && isString(className)) {
classes = className.split(/\s+/);
for (i = 0; i < classes.length; i++) {
out.push('.' + classes[i]);
}
}
var attrWhitelist = ['type', 'name', 'title', 'alt'];
for (i = 0; i < attrWhitelist.length; i++) {
key = attrWhitelist[i];
attr = elem.getAttribute(key);
if (attr) {
out.push('[' + key + '="' + attr + '"]');
}
}
return out.join('');
}
/**
* Returns true if either a OR b is truthy, but not both
*/
function isOnlyOneTruthy(a, b) {
return !!(!!a ^ !!b);
}
/**
* Returns true if the two input exception interfaces have the same content
*/
function isSameException(ex1, ex2) {
if (isOnlyOneTruthy(ex1, ex2))
return false;
ex1 = ex1.values[0];
ex2 = ex2.values[0];
if (ex1.type !== ex2.type ||
ex1.value !== ex2.value)
return false;
return isSameStacktrace(ex1.stacktrace, ex2.stacktrace);
}
/**
* Returns true if the two input stack trace interfaces have the same content
*/
function isSameStacktrace(stack1, stack2) {
if (isOnlyOneTruthy(stack1, stack2))
return false;
var frames1 = stack1.frames;
var frames2 = stack2.frames;
// Exit early if frame count differs
if (frames1.length !== frames2.length)
return false;
// Iterate through every frame; bail out if anything differs
var a, b;
for (var i = 0; i < frames1.length; i++) {
a = frames1[i];
b = frames2[i];
if (a.filename !== b.filename ||
a.lineno !== b.lineno ||
a.colno !== b.colno ||
a['function'] !== b['function'])
return false;
}
return true;
}
/**
* Polyfill a method
* @param obj object e.g. `document`
* @param name method name present on object e.g. `addEventListener`
* @param replacement replacement function
* @param track {optional} record instrumentation to an array
*/
function fill(obj, name, replacement, track) {
var orig = obj[name];
obj[name] = replacement(orig);
if (track) {
track.push([obj, name, orig]);
}
}
if (typeof __DEV__ !== 'undefined' && __DEV__) {
Raven.utils = {
isUndefined: isUndefined,
isFunction: isFunction,
isString: isString,
isObject: isObject,
isEmptyObject: isEmptyObject,
isError: isError,
each: each,
objectMerge: objectMerge,
truncate: truncate,
hasKey: hasKey,
joinRegExp: joinRegExp,
urlencode: urlencode,
uuid4: uuid4,
htmlTreeAsString: htmlTreeAsString,
htmlElementAsString: htmlElementAsString,
parseUrl: parseUrl,
fill: fill
};
};
// Deprecations
Raven.prototype.setUser = Raven.prototype.setUserContext;
Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
module.exports = Raven;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9)))
/***/ }),
/* 130 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var utils = __webpack_require__(73);
/*
TraceKit - Cross brower stack traces
This was originally forked from github.com/occ/TraceKit, but has since been
largely re-written and is now maintained as part of raven-js. Tests for
this are in test/vendor.
MIT license
*/
var TraceKit = {
collectWindowErrors: true,
debug: false
};
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window = typeof window !== 'undefined' ? window
: typeof global !== 'undefined' ? global
: typeof self !== 'undefined' ? self
: {};
// global reference to slice
var _slice = [].slice;
var UNKNOWN_FUNCTION = '?';
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;
function getLocationHref() {
if (typeof document === 'undefined' || typeof document.location === 'undefined')
return '';
return document.location.href;
}
/**
* TraceKit.report: cross-browser processing of unhandled exceptions
*
* Syntax:
* TraceKit.report.subscribe(function(stackInfo) { ... })
* TraceKit.report.unsubscribe(function(stackInfo) { ... })
* TraceKit.report(exception)
* try { ...code... } catch(ex) { TraceKit.report(ex); }
*
* Supports:
* - Firefox: full stack trace with line numbers, plus column number
* on top frame; column number is not guaranteed
* - Opera: full stack trace with line and column numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
* - IE: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
*
* In theory, TraceKit should work on all of the following versions:
* - IE5.5+ (only 8.0 tested)
* - Firefox 0.9+ (only 3.5+ tested)
* - Opera 7+ (only 10.50 tested; versions 9 and earlier may require
* Exceptions Have Stacktrace to be enabled in opera:config)
* - Safari 3+ (only 4+ tested)
* - Chrome 1+ (only 5+ tested)
* - Konqueror 3.5+ (untested)
*
* Requires TraceKit.computeStackTrace.
*
* Tries to catch all unhandled exceptions and report them to the
* subscribed handlers. Please note that TraceKit.report will rethrow the
* exception. This is REQUIRED in order to get a useful stack trace in IE.
* If the exception does not reach the top of the browser, you will only
* get a stack trace from the point where TraceKit.report was called.
*
* Handlers receive a stackInfo object as described in the
* TraceKit.computeStackTrace docs.
*/
TraceKit.report = (function reportModuleWrapper() {
var handlers = [],
lastArgs = null,
lastException = null,
lastExceptionStack = null;
/**
* Add a crash handler.
* @param {Function} handler
*/
function subscribe(handler) {
installGlobalHandler();
handlers.push(handler);
}
/**
* Remove a crash handler.
* @param {Function} handler
*/
function unsubscribe(handler) {
for (var i = handlers.length - 1; i >= 0; --i) {
if (handlers[i] === handler) {
handlers.splice(i, 1);
}
}
}
/**
* Remove all crash handlers.
*/
function unsubscribeAll() {
uninstallGlobalHandler();
handlers = [];
}
/**
* Dispatch stack information to all handlers.
* @param {Object.<string, *>} stack
*/
function notifyHandlers(stack, isWindowError) {
var exception = null;
if (isWindowError && !TraceKit.collectWindowErrors) {
return;
}
for (var i in handlers) {
if (handlers.hasOwnProperty(i)) {
try {
handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2)));
} catch (inner) {
exception = inner;
}
}
}
if (exception) {
throw exception;
}
}
var _oldOnerrorHandler, _onErrorHandlerInstalled;
/**
* Ensures all global unhandled exceptions are recorded.
* Supported by Gecko and IE.
* @param {string} message Error message.
* @param {string} url URL of script that generated the exception.
* @param {(number|string)} lineNo The line number at which the error
* occurred.
* @param {?(number|string)} colNo The column number at which the error
* occurred.
* @param {?Error} ex The actual Error object.
*/
function traceKitWindowOnError(message, url, lineNo, colNo, ex) {
var stack = null;
if (lastExceptionStack) {
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);
processLastException();
} else if (ex && utils.isError(ex)) {
// non-string `ex` arg; attempt to extract stack trace
// New chrome and blink send along a real error object
// Let's just report that like a normal error.
// See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
stack = TraceKit.computeStackTrace(ex);
notifyHandlers(stack, true);
} else {
var location = {
'url': url,
'line': lineNo,
'column': colNo
};
var name = undefined;
var msg = message; // must be new var or will modify original `arguments`
var groups;
if ({}.toString.call(message) === '[object String]') {
var groups = message.match(ERROR_TYPES_RE);
if (groups) {
name = groups[1];
msg = groups[2];
}
}
location.func = UNKNOWN_FUNCTION;
stack = {
'name': name,
'message': msg,
'url': getLocationHref(),
'stack': [location]
};
notifyHandlers(stack, true);
}
if (_oldOnerrorHandler) {
return _oldOnerrorHandler.apply(this, arguments);
}
return false;
}
function installGlobalHandler ()
{
if (_onErrorHandlerInstalled) {
return;
}
_oldOnerrorHandler = _window.onerror;
_window.onerror = traceKitWindowOnError;
_onErrorHandlerInstalled = true;
}
function uninstallGlobalHandler ()
{
if (!_onErrorHandlerInstalled) {
return;
}
_window.onerror = _oldOnerrorHandler;
_onErrorHandlerInstalled = false;
_oldOnerrorHandler = undefined;
}
function processLastException() {
var _lastExceptionStack = lastExceptionStack,
_lastArgs = lastArgs;
lastArgs = null;
lastExceptionStack = null;
lastException = null;
notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs));
}
/**
* Reports an unhandled Error to TraceKit.
* @param {Error} ex
* @param {?boolean} rethrow If false, do not re-throw the exception.
* Only used for window.onerror to not cause an infinite loop of
* rethrowing.
*/
function report(ex, rethrow) {
var args = _slice.call(arguments, 1);
if (lastExceptionStack) {
if (lastException === ex) {
return; // already caught by an inner catch block, ignore
} else {
processLastException();
}
}
var stack = TraceKit.computeStackTrace(ex);
lastExceptionStack = stack;
lastException = ex;
lastArgs = args;
// If the stack trace is incomplete, wait for 2 seconds for
// slow slow IE to see if onerror occurs or not before reporting
// this exception; otherwise, we will end up with an incomplete
// stack trace
setTimeout(function () {
if (lastException === ex) {
processLastException();
}
}, (stack.incomplete ? 2000 : 0));
if (rethrow !== false) {
throw ex; // re-throw to propagate to the top level (and cause window.onerror)
}
}
report.subscribe = subscribe;
report.unsubscribe = unsubscribe;
report.uninstall = unsubscribeAll;
return report;
}());
/**
* TraceKit.computeStackTrace: cross-browser stack traces in JavaScript
*
* Syntax:
* s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)
* Returns:
* s.name - exception name
* s.message - exception message
* s.stack[i].url - JavaScript or HTML file URL
* s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)
* s.stack[i].args - arguments passed to the function, if known
* s.stack[i].line - line number, if known
* s.stack[i].column - column number, if known
*
* Supports:
* - Firefox: full stack trace with line numbers and unreliable column
* number on top frame
* - Opera 10: full stack trace with line and column numbers
* - Opera 9-: full stack trace with line numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the topmost stacktrace element
* only
* - IE: no line numbers whatsoever
*
* Tries to guess names of anonymous functions by looking for assignments
* in the source code. In IE and Safari, we have to guess source file names
* by searching for function bodies inside all page scripts. This will not
* work for scripts that are loaded cross-domain.
* Here be dragons: some function names may be guessed incorrectly, and
* duplicate functions may be mismatched.
*
* TraceKit.computeStackTrace should only be used for tracing purposes.
* Logging of unhandled exceptions should be done with TraceKit.report,
* which builds on top of TraceKit.computeStackTrace and provides better
* IE support by utilizing the window.onerror event to retrieve information
* about the top of the stack.
*
* Note: In IE and Safari, no stack trace is recorded on the Error object,
* so computeStackTrace instead walks its *own* chain of callers.
* This means that:
* * in Safari, some methods may be missing from the stack trace;
* * in IE, the topmost function in the stack trace will always be the
* caller of computeStackTrace.
*
* This is okay for tracing (because you are likely to be calling
* computeStackTrace from the function you want to be the topmost element
* of the stack trace anyway), but not okay for logging unhandled
* exceptions (because your catch block will likely be far away from the
* inner function that actually caused the exception).
*
*/
TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
// Contents of Exception in various browsers.
//
// SAFARI:
// ex.message = Can't find variable: qq
// ex.line = 59
// ex.sourceId = 580238192
// ex.sourceURL = http://...
// ex.expressionBeginOffset = 96
// ex.expressionCaretOffset = 98
// ex.expressionEndOffset = 98
// ex.name = ReferenceError
//
// FIREFOX:
// ex.message = qq is not defined
// ex.fileName = http://...
// ex.lineNumber = 59
// ex.columnNumber = 69
// ex.stack = ...stack trace... (see the example below)
// ex.name = ReferenceError
//
// CHROME:
// ex.message = qq is not defined
// ex.name = ReferenceError
// ex.type = not_defined
// ex.arguments = ['aa']
// ex.stack = ...stack trace...
//
// INTERNET EXPLORER:
// ex.message = ...
// ex.name = ReferenceError
//
// OPERA:
// ex.message = ...message... (see the example below)
// ex.name = ReferenceError
// ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)
// ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'
/**
* Computes stack trace information from the stack property.
* Chrome and Gecko use this property.
* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
*/
function computeStackTraceFromStackProp(ex) {
if (typeof ex.stack === 'undefined' || !ex.stack) return;
var chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,
winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
// Used to additionally parse URL/line/column from eval frames
geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i,
chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/,
lines = ex.stack.split('\n'),
stack = [],
submatch,
parts,
element,
reference = /^(.*) is undefined$/.exec(ex.message);
for (var i = 0, j = lines.length; i < j; ++i) {
if ((parts = chrome.exec(lines[i]))) {
var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line
var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
if (isEval && (submatch = chromeEval.exec(parts[2]))) {
// throw out eval line/column and use top-most line/column number
parts[2] = submatch[1]; // url
parts[3] = submatch[2]; // line
parts[4] = submatch[3]; // column
}
element = {
'url': !isNative ? parts[2] : null,
'func': parts[1] || UNKNOWN_FUNCTION,
'args': isNative ? [parts[2]] : [],
'line': parts[3] ? +parts[3] : null,
'column': parts[4] ? +parts[4] : null
};
} else if ( parts = winjs.exec(lines[i]) ) {
element = {
'url': parts[2],
'func': parts[1] || UNKNOWN_FUNCTION,
'args': [],
'line': +parts[3],
'column': parts[4] ? +parts[4] : null
};
} else if ((parts = gecko.exec(lines[i]))) {
var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
if (isEval && (submatch = geckoEval.exec(parts[3]))) {
// throw out eval line/column and use top-most line number
parts[3] = submatch[1];
parts[4] = submatch[2];
parts[5] = null; // no column when eval
} else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') {
// FireFox uses this awesome columnNumber property for its top frame
// Also note, Firefox's column number is 0-based and everything else expects 1-based,
// so adding 1
// NOTE: this hack doesn't work if top-most frame is eval
stack[0].column = ex.columnNumber + 1;
}
element = {
'url': parts[3],
'func': parts[1] || UNKNOWN_FUNCTION,
'args': parts[2] ? parts[2].split(',') : [],
'line': parts[4] ? +parts[4] : null,
'column': parts[5] ? +parts[5] : null
};
} else {
continue;
}
if (!element.func && element.line) {
element.func = UNKNOWN_FUNCTION;
}
stack.push(element);
}
if (!stack.length) {
return null;
}
return {
'name': ex.name,
'message': ex.message,
'url': getLocationHref(),
'stack': stack
};
}
/**
* Adds information about the first frame to incomplete stack traces.
* Safari and IE require this to get complete data on the first frame.
* @param {Object.<string, *>} stackInfo Stack trace information from
* one of the compute* methods.
* @param {string} url The URL of the script that caused an error.
* @param {(number|string)} lineNo The line number of the script that
* caused an error.
* @param {string=} message The error generated by the browser, which
* hopefully contains the name of the object that caused the error.
* @return {boolean} Whether or not the stack information was
* augmented.
*/
function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {
var initial = {
'url': url,
'line': lineNo
};
if (initial.url && initial.line) {
stackInfo.incomplete = false;
if (!initial.func) {
initial.func = UNKNOWN_FUNCTION;
}
if (stackInfo.stack.length > 0) {
if (stackInfo.stack[0].url === initial.url) {
if (stackInfo.stack[0].line === initial.line) {
return false; // already in stack trace
} else if (!stackInfo.stack[0].line && stackInfo.stack[0].func === initial.func) {
stackInfo.stack[0].line = initial.line;
return false;
}
}
}
stackInfo.stack.unshift(initial);
stackInfo.partial = true;
return true;
} else {
stackInfo.incomplete = true;
}
return false;
}
/**
* Computes stack trace information by walking the arguments.caller
* chain at the time the exception occurred. This will cause earlier
* frames to be missed but is the only way to get any stack trace in
* Safari and IE. The top frame is restored by
* {@link augmentStackTraceWithInitialElement}.
* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
*/
function computeStackTraceByWalkingCallerChain(ex, depth) {
var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,
stack = [],
funcs = {},
recursion = false,
parts,
item,
source;
for (var curr = computeStackTraceByWalkingCallerChain.caller; curr && !recursion; curr = curr.caller) {
if (curr === computeStackTrace || curr === TraceKit.report) {
// console.log('skipping internal function');
continue;
}
item = {
'url': null,
'func': UNKNOWN_FUNCTION,
'line': null,
'column': null
};
if (curr.name) {
item.func = curr.name;
} else if ((parts = functionName.exec(curr.toString()))) {
item.func = parts[1];
}
if (typeof item.func === 'undefined') {
try {
item.func = parts.input.substring(0, parts.input.indexOf('{'));
} catch (e) { }
}
if (funcs['' + curr]) {
recursion = true;
}else{
funcs['' + curr] = true;
}
stack.push(item);
}
if (depth) {
// console.log('depth is ' + depth);
// console.log('stack is ' + stack.length);
stack.splice(0, depth);
}
var result = {
'name': ex.name,
'message': ex.message,
'url': getLocationHref(),
'stack': stack
};
augmentStackTraceWithInitialElement(result, ex.sourceURL || ex.fileName, ex.line || ex.lineNumber, ex.message || ex.description);
return result;
}
/**
* Computes a stack trace for an exception.
* @param {Error} ex
* @param {(string|number)=} depth
*/
function computeStackTrace(ex, depth) {
var stack = null;
depth = (depth == null ? 0 : +depth);
try {
stack = computeStackTraceFromStackProp(ex);
if (stack) {
return stack;
}
} catch (e) {
if (TraceKit.debug) {
throw e;
}
}
try {
stack = computeStackTraceByWalkingCallerChain(ex, depth + 1);
if (stack) {
return stack;
}
} catch (e) {
if (TraceKit.debug) {
throw e;
}
}
return {
'name': ex.name,
'message': ex.message,
'url': getLocationHref()
};
}
computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement;
computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp;
return computeStackTrace;
}());
module.exports = TraceKit;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9)))
/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
json-stringify-safe
Like JSON.stringify, but doesn't throw on circular references.
Originally forked from https://github.com/isaacs/json-stringify-safe
version 5.0.1 on 3/8/2017 and modified for IE8 compatibility.
Tests for this are in test/vendor.
ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE
*/
exports = module.exports = stringify
exports.getSerialize = serializer
function indexOf(haystack, needle) {
for (var i = 0; i < haystack.length; ++i) {
if (haystack[i] === needle) return i;
}
return -1;
}
function stringify(obj, replacer, spaces, cycleReplacer) {
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
}
function serializer(replacer, cycleReplacer) {
var stack = [], keys = []
if (cycleReplacer == null) cycleReplacer = function(key, value) {
if (stack[0] === value) return '[Circular ~]'
return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']'
}
return function(key, value) {
if (stack.length > 0) {
var thisPos = indexOf(stack, this);
~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
if (~indexOf(stack, value)) value = cycleReplacer.call(this, key, value)
}
else stack.push(value)
return replacer == null ? value : replacer.call(this, key, value)
}
}
/***/ }),
/* 132 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function RavenConfigError(message) {
this.name = 'RavenConfigError';
this.message = message;
}
RavenConfigError.prototype = new Error();
RavenConfigError.prototype.constructor = RavenConfigError;
module.exports = RavenConfigError;
/***/ }),
/* 133 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var wrapMethod = function(console, level, callback) {
var originalConsoleLevel = console[level];
var originalConsole = console;
if (!(level in console)) {
return;
}
var sentryLevel = level === 'warn'
? 'warning'
: level;
console[level] = function () {
var args = [].slice.call(arguments);
var msg = '' + args.join(' ');
var data = {level: sentryLevel, logger: 'console', extra: {'arguments': args}};
callback && callback(msg, data);
// this fails for some browsers. :(
if (originalConsoleLevel) {
// IE9 doesn't allow calling apply on console functions directly
// See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193
Function.prototype.apply.call(
originalConsoleLevel,
originalConsole,
args
);
}
};
};
module.exports = {
wrapMethod: wrapMethod
};
/***/ })
],[75]);