diff --git a/Modules/Page/Assets/js/PageRoutes.js b/Modules/Page/Assets/js/PageRoutes.js
index c8f407840..6c645a5c0 100644
--- a/Modules/Page/Assets/js/PageRoutes.js
+++ b/Modules/Page/Assets/js/PageRoutes.js
@@ -2,7 +2,7 @@ import PageTable from './components/PageTable.vue'
import PageTableServerSide from './components/PageTableServerSide.vue'
import PageForm from './components/PageForm.vue'
-const locales = window.locales;
+const locales = window.AsgardCMS.locales;
export default [
{
diff --git a/Themes/Adminlte/views/layouts/master.blade.php b/Themes/Adminlte/views/layouts/master.blade.php
index 01552d3fc..69095a88e 100644
--- a/Themes/Adminlte/views/layouts/master.blade.php
+++ b/Themes/Adminlte/views/layouts/master.blade.php
@@ -75,11 +75,10 @@
@endforeach
diff --git a/public/js/app.js b/public/js/app.js
index dd551c704..ed38114c6 100644
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -283,11 +283,11 @@ Object.defineProperty(exports, "__esModule", {
});
exports["default"] = {
required: __webpack_require__(28),
- whitespace: __webpack_require__(58),
- type: __webpack_require__(59),
- range: __webpack_require__(60),
- "enum": __webpack_require__(61),
- pattern: __webpack_require__(62)
+ whitespace: __webpack_require__(59),
+ type: __webpack_require__(60),
+ range: __webpack_require__(61),
+ "enum": __webpack_require__(62),
+ pattern: __webpack_require__(63)
};
module.exports = exports['default'];
@@ -299,7 +299,7 @@ module.exports = exports['default'];
var bind = __webpack_require__(30);
-var isBuffer = __webpack_require__(93);
+var isBuffer = __webpack_require__(94);
/*global toString:true*/
@@ -11087,7 +11087,7 @@ module.exports = function normalizeComponent (
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = __webpack_require__(92);
+module.exports = __webpack_require__(93);
/***/ }),
/* 9 */
@@ -11117,7 +11117,35 @@ module.exports = function ( delay, atBegin, callback ) {
/***/ }),
-/* 10 */,
+/* 10 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = {
+ methods: {
+ trans: function trans(string) {
+ // Makes a string: core.button.cancel | core.button.created at
+ // to: core["button.cancel"] | core["button.created at"]
+ var array = string.split('.');
+
+ if (array.length < 2) {
+ return this.$t(string);
+ }
+
+ var first = array.splice(0, 1);
+ var key = array.join('.');
+
+ return this.$t(first + '[\'' + key + '\']');
+ }
+ }
+};
+
+/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
@@ -11705,7 +11733,7 @@ var _popup = __webpack_require__(21);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var PopperJS = _vue2.default.prototype.$isServer ? function () {} : __webpack_require__(43);
+var PopperJS = _vue2.default.prototype.$isServer ? function () {} : __webpack_require__(44);
var stop = function stop(e) {
return e.stopPropagation();
};
@@ -12128,7 +12156,7 @@ var removeResizeListener = exports.removeResizeListener = function removeResizeL
exports.__esModule = true;
exports.i18n = exports.use = exports.t = undefined;
-var _zhCN = __webpack_require__(44);
+var _zhCN = __webpack_require__(45);
var _zhCN2 = _interopRequireDefault(_zhCN);
@@ -12136,11 +12164,11 @@ var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
-var _deepmerge = __webpack_require__(45);
+var _deepmerge = __webpack_require__(46);
var _deepmerge2 = _interopRequireDefault(_deepmerge);
-var _format = __webpack_require__(46);
+var _format = __webpack_require__(47);
var _format2 = _interopRequireDefault(_format);
@@ -12233,7 +12261,7 @@ module.exports = exports['default'];
/* WEBPACK VAR INJECTION */(function(process) {
var utils = __webpack_require__(2);
-var normalizeHeaderName = __webpack_require__(96);
+var normalizeHeaderName = __webpack_require__(97);
var DEFAULT_CONTENT_TYPE = {
'Content-Type': 'application/x-www-form-urlencoded'
@@ -12323,7 +12351,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
module.exports = defaults;
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(95)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(96)))
/***/ }),
/* 19 */
@@ -12447,7 +12475,7 @@ var _merge = __webpack_require__(12);
var _merge2 = _interopRequireDefault(_merge);
-var _popupManager = __webpack_require__(42);
+var _popupManager = __webpack_require__(43);
var _popupManager2 = _interopRequireDefault(_popupManager);
@@ -13739,12 +13767,12 @@ module.exports = function bind(fn, thisArg) {
var utils = __webpack_require__(2);
-var settle = __webpack_require__(97);
-var buildURL = __webpack_require__(99);
-var parseHeaders = __webpack_require__(100);
-var isURLSameOrigin = __webpack_require__(101);
+var settle = __webpack_require__(98);
+var buildURL = __webpack_require__(100);
+var parseHeaders = __webpack_require__(101);
+var isURLSameOrigin = __webpack_require__(102);
var createError = __webpack_require__(32);
-var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(102);
+var btoa = (typeof window !== 'undefined' && window.btoa && window.btoa.bind(window)) || __webpack_require__(103);
module.exports = function xhrAdapter(config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -13841,7 +13869,7 @@ module.exports = function xhrAdapter(config) {
// This is only done if running in a standard browser environment.
// Specifically not if we're in a web worker, or react-native.
if (utils.isStandardBrowserEnv()) {
- var cookies = __webpack_require__(103);
+ var cookies = __webpack_require__(104);
// Add xsrf header
var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
@@ -13925,7 +13953,7 @@ module.exports = function xhrAdapter(config) {
"use strict";
-var enhanceError = __webpack_require__(98);
+var enhanceError = __webpack_require__(99);
/**
* Create an Error with the specified message, config, error code, request and response.
@@ -31071,7 +31099,7 @@ module.exports = Cancel;
}
}.call(this));
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19), __webpack_require__(114)(module)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(19), __webpack_require__(115)(module)))
/***/ }),
/* 36 */
@@ -31217,29 +31245,29 @@ var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
-var _vueI18n = __webpack_require__(137);
+var _vueI18n = __webpack_require__(39);
var _vueI18n2 = _interopRequireDefault(_vueI18n);
-var _vueRouter = __webpack_require__(39);
+var _vueRouter = __webpack_require__(40);
var _vueRouter2 = _interopRequireDefault(_vueRouter);
-var _elementUi = __webpack_require__(40);
+var _elementUi = __webpack_require__(41);
var _elementUi2 = _interopRequireDefault(_elementUi);
-var _vueDataTables = __webpack_require__(81);
+var _vueDataTables = __webpack_require__(82);
var _vueDataTables2 = _interopRequireDefault(_vueDataTables);
-__webpack_require__(82);
+__webpack_require__(83);
-var _en = __webpack_require__(88);
+var _en = __webpack_require__(89);
var _en2 = _interopRequireDefault(_en);
-var _PageRoutes = __webpack_require__(89);
+var _PageRoutes = __webpack_require__(90);
var _PageRoutes2 = _interopRequireDefault(_PageRoutes);
@@ -31249,17 +31277,19 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-__webpack_require__(123);
+__webpack_require__(124);
_vue2.default.use(_elementUi2.default, { locale: _en2.default });
_vue2.default.use(_vueDataTables2.default, { locale: _en2.default });
_vue2.default.use(_vueI18n2.default);
_vue2.default.use(_vueRouter2.default);
-_vue2.default.component('ckeditor', __webpack_require__(124));
-_vue2.default.component('DeleteButton', __webpack_require__(131));
-_vue2.default.component('TagsInput', __webpack_require__(134));
+_vue2.default.component('ckeditor', __webpack_require__(125));
+_vue2.default.component('DeleteButton', __webpack_require__(132));
+_vue2.default.component('TagsInput', __webpack_require__(135));
+
+var currentLocale = window.AsgardCMS.currentLocale;
var router = new _vueRouter2.default({
mode: 'history',
@@ -31286,4910 +31316,4820 @@ var app = new _vue2.default({
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
-/**
- * vue-router v2.7.0
- * (c) 2017 Evan You
- * @license MIT
- */
+/*!
+ * vue-i18n v7.2.0
+ * (c) 2017 kazuya kawaguchi
+ * Released under the MIT License.
+ */
/* */
-function assert (condition, message) {
- if (!condition) {
- throw new Error(("[vue-router] " + message))
- }
-}
+/**
+ * utilites
+ */
-function warn (condition, message) {
- if ("development" !== 'production' && !condition) {
- typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
+function warn (msg, err) {
+ if (typeof console !== 'undefined') {
+ console.warn('[vue-i18n] ' + msg);
+ /* istanbul ignore if */
+ if (err) {
+ console.warn(err.stack);
+ }
}
}
-function isError (err) {
- return Object.prototype.toString.call(err).indexOf('Error') > -1
+function isObject (obj) {
+ return obj !== null && typeof obj === 'object'
}
-var View = {
- name: 'router-view',
- functional: true,
- props: {
- name: {
- type: String,
- default: 'default'
- }
- },
- render: function render (_, ref) {
- var props = ref.props;
- var children = ref.children;
- var parent = ref.parent;
- var data = ref.data;
+var toString = Object.prototype.toString;
+var OBJECT_STRING = '[object Object]';
+function isPlainObject (obj) {
+ return toString.call(obj) === OBJECT_STRING
+}
- data.routerView = true;
+function isNull (val) {
+ return val === null || val === undefined
+}
- // directly use parent context's createElement() function
- // so that components rendered by router-view can resolve named slots
- var h = parent.$createElement;
- var name = props.name;
- var route = parent.$route;
- var cache = parent._routerViewCache || (parent._routerViewCache = {});
+function parseArgs () {
+ var args = [], len = arguments.length;
+ while ( len-- ) args[ len ] = arguments[ len ];
- // determine current view depth, also check to see if the tree
- // has been toggled inactive but kept-alive.
- var depth = 0;
- var inactive = false;
- while (parent && parent._routerRoot !== parent) {
- if (parent.$vnode && parent.$vnode.data.routerView) {
- depth++;
- }
- if (parent._inactive) {
- inactive = true;
- }
- parent = parent.$parent;
+ var locale = null;
+ var params = null;
+ if (args.length === 1) {
+ if (isObject(args[0]) || Array.isArray(args[0])) {
+ params = args[0];
+ } else if (typeof args[0] === 'string') {
+ locale = args[0];
}
- data.routerViewDepth = depth;
-
- // render previous view if the tree is inactive and kept-alive
- if (inactive) {
- return h(cache[name], data, children)
+ } else if (args.length === 2) {
+ if (typeof args[0] === 'string') {
+ locale = args[0];
}
-
- var matched = route.matched[depth];
- // render empty node if no matched route
- if (!matched) {
- cache[name] = null;
- return h()
+ /* istanbul ignore if */
+ if (isObject(args[1]) || Array.isArray(args[1])) {
+ params = args[1];
}
+ }
- var component = cache[name] = matched.components[name];
+ return { locale: locale, params: params }
+}
- // attach instance registration hook
- // this will be called in the instance's injected lifecycle hooks
- data.registerRouteInstance = function (vm, val) {
- // val could be undefined for unregistration
- var current = matched.instances[name];
- if (
- (val && current !== vm) ||
- (!val && current === vm)
- ) {
- matched.instances[name] = val;
- }
- }
+function getOldChoiceIndexFixed (choice) {
+ return choice
+ ? choice > 1
+ ? 1
+ : 0
+ : 1
+}
- // also regiseter instance in prepatch hook
- // in case the same component instance is reused across different routes
- ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
- matched.instances[name] = vnode.componentInstance;
- };
+function getChoiceIndex (choice, choicesLength) {
+ choice = Math.abs(choice);
- // resolve props
- data.props = resolveProps(route, matched.props && matched.props[name]);
+ if (choicesLength === 2) { return getOldChoiceIndexFixed(choice) }
- return h(component, data, children)
+ return choice ? Math.min(choice, 2) : 0
+}
+
+function fetchChoice (message, choice) {
+ /* istanbul ignore if */
+ if (!message && typeof message !== 'string') { return null }
+ var choices = message.split('|');
+
+ choice = getChoiceIndex(choice, choices.length);
+ if (!choices[choice]) { return message }
+ return choices[choice].trim()
+}
+
+function looseClone (obj) {
+ return JSON.parse(JSON.stringify(obj))
+}
+
+function remove (arr, item) {
+ if (arr.length) {
+ var index = arr.indexOf(item);
+ if (index > -1) {
+ return arr.splice(index, 1)
+ }
}
-};
+}
-function resolveProps (route, config) {
- switch (typeof config) {
- case 'undefined':
- return
- case 'object':
- return config
- case 'function':
- return config(route)
- case 'boolean':
- return config ? route.params : undefined
- default:
- if (true) {
- warn(
- false,
- "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
- "expecting an object, function or boolean."
- );
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+function hasOwn (obj, key) {
+ return hasOwnProperty.call(obj, key)
+}
+
+function merge (target) {
+ var arguments$1 = arguments;
+
+ var output = Object(target);
+ for (var i = 1; i < arguments.length; i++) {
+ var source = arguments$1[i];
+ if (source !== undefined && source !== null) {
+ var key = (void 0);
+ for (key in source) {
+ if (hasOwn(source, key)) {
+ if (isObject(source[key])) {
+ output[key] = merge(output[key], source[key]);
+ } else {
+ output[key] = source[key];
+ }
+ }
}
+ }
}
+ return output
}
-/* */
+var canUseDateTimeFormat =
+ typeof Intl !== 'undefined' && typeof Intl.DateTimeFormat !== 'undefined';
-var encodeReserveRE = /[!'()*]/g;
-var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
-var commaRE = /%2C/g;
+var canUseNumberFormat =
+ typeof Intl !== 'undefined' && typeof Intl.NumberFormat !== 'undefined';
-// fixed encodeURIComponent which is more conformant to RFC3986:
-// - escapes [!'()*]
-// - preserve commas
-var encode = function (str) { return encodeURIComponent(str)
- .replace(encodeReserveRE, encodeReserveReplacer)
- .replace(commaRE, ','); };
+/* */
-var decode = decodeURIComponent;
+function extend (Vue) {
+ Vue.prototype.$t = function (key) {
+ var values = [], len = arguments.length - 1;
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ];
-function resolveQuery (
- query,
- extraQuery,
- _parseQuery
-) {
- if ( extraQuery === void 0 ) extraQuery = {};
+ var i18n = this.$i18n;
+ return i18n._t.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this ].concat( values ))
+ };
- var parse = _parseQuery || parseQuery;
- var parsedQuery;
- try {
- parsedQuery = parse(query || '');
- } catch (e) {
- "development" !== 'production' && warn(false, e.message);
- parsedQuery = {};
- }
- for (var key in extraQuery) {
- var val = extraQuery[key];
- parsedQuery[key] = Array.isArray(val) ? val.slice() : val;
- }
- return parsedQuery
-}
+ Vue.prototype.$tc = function (key, choice) {
+ var values = [], len = arguments.length - 2;
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ];
-function parseQuery (query) {
- var res = {};
+ var i18n = this.$i18n;
+ return i18n._tc.apply(i18n, [ key, i18n.locale, i18n._getMessages(), this, choice ].concat( values ))
+ };
- query = query.trim().replace(/^(\?|#|&)/, '');
+ Vue.prototype.$te = function (key, locale) {
+ var i18n = this.$i18n;
+ return i18n._te(key, i18n.locale, i18n._getMessages(), locale)
+ };
- if (!query) {
- return res
- }
+ Vue.prototype.$d = function (value) {
+ var args = [], len = arguments.length - 1;
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
- query.split('&').forEach(function (param) {
- var parts = param.replace(/\+/g, ' ').split('=');
- var key = decode(parts.shift());
- var val = parts.length > 0
- ? decode(parts.join('='))
- : null;
+ return (ref = this.$i18n).d.apply(ref, [ value ].concat( args ))
+ var ref;
+ };
- if (res[key] === undefined) {
- res[key] = val;
- } else if (Array.isArray(res[key])) {
- res[key].push(val);
- } else {
- res[key] = [res[key], val];
- }
- });
+ Vue.prototype.$n = function (value) {
+ var args = [], len = arguments.length - 1;
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
- return res
+ return (ref = this.$i18n).n.apply(ref, [ value ].concat( args ))
+ var ref;
+ };
}
-function stringifyQuery (obj) {
- var res = obj ? Object.keys(obj).map(function (key) {
- var val = obj[key];
+/* */
- if (val === undefined) {
- return ''
- }
+var mixin = {
+ beforeCreate: function beforeCreate () {
+ var options = this.$options;
+ options.i18n = options.i18n || (options.__i18n ? {} : null);
- if (val === null) {
- return encode(key)
- }
+ if (options.i18n) {
+ if (options.i18n instanceof VueI18n) {
+ // init locale messages via custom blocks
+ if (options.__i18n) {
+ try {
+ var localeMessages = {};
+ options.__i18n.forEach(function (resource) {
+ localeMessages = merge(localeMessages, JSON.parse(resource));
+ });
+ Object.keys(localeMessages).forEach(function (locale) {
+ options.i18n.mergeLocaleMessage(locale, localeMessages[locale]);
+ });
+ } catch (e) {
+ if (true) {
+ warn("Cannot parse locale messages via custom blocks.", e);
+ }
+ }
+ }
+ this._i18n = options.i18n;
+ this._i18nWatcher = this._i18n.watchI18nData();
+ this._i18n.subscribeDataChanging(this);
+ this._subscribing = true;
+ } else if (isPlainObject(options.i18n)) {
+ // component local i18n
+ if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
+ options.i18n.root = this.$root.$i18n;
+ options.i18n.fallbackLocale = this.$root.$i18n.fallbackLocale;
+ options.i18n.silentTranslationWarn = this.$root.$i18n.silentTranslationWarn;
+ }
- if (Array.isArray(val)) {
- var result = [];
- val.forEach(function (val2) {
- if (val2 === undefined) {
- return
+ // init locale messages via custom blocks
+ if (options.__i18n) {
+ try {
+ var localeMessages$1 = {};
+ options.__i18n.forEach(function (resource) {
+ localeMessages$1 = merge(localeMessages$1, JSON.parse(resource));
+ });
+ options.i18n.messages = localeMessages$1;
+ } catch (e) {
+ if (true) {
+ warn("Cannot parse locale messages via custom blocks.", e);
+ }
+ }
}
- if (val2 === null) {
- result.push(encode(key));
- } else {
- result.push(encode(key) + '=' + encode(val2));
+
+ this._i18n = new VueI18n(options.i18n);
+ this._i18nWatcher = this._i18n.watchI18nData();
+ this._i18n.subscribeDataChanging(this);
+ this._subscribing = true;
+
+ if (options.i18n.sync === undefined || !!options.i18n.sync) {
+ this._localeWatcher = this.$i18n.watchLocale();
}
- });
- return result.join('&')
+ } else {
+ if (true) {
+ warn("Cannot be interpreted 'i18n' option.");
+ }
+ }
+ } else if (this.$root && this.$root.$i18n && this.$root.$i18n instanceof VueI18n) {
+ // root i18n
+ this._i18n = this.$root.$i18n;
+ this._i18n.subscribeDataChanging(this);
+ this._subscribing = true;
+ } else if (options.parent && options.parent.$i18n && options.parent.$i18n instanceof VueI18n) {
+ // parent i18n
+ this._i18n = options.parent.$i18n;
+ this._i18n.subscribeDataChanging(this);
+ this._subscribing = true;
}
+ },
- return encode(key) + '=' + encode(val)
- }).filter(function (x) { return x.length > 0; }).join('&') : null;
- return res ? ("?" + res) : ''
-}
+ beforeDestroy: function beforeDestroy () {
+ if (!this._i18n) { return }
-/* */
+ if (this._subscribing) {
+ this._i18n.unsubscribeDataChanging(this);
+ delete this._subscribing;
+ }
+ if (this._i18nWatcher) {
+ this._i18nWatcher();
+ delete this._i18nWatcher;
+ }
-var trailingSlashRE = /\/?$/;
+ if (this._localeWatcher) {
+ this._localeWatcher();
+ delete this._localeWatcher;
+ }
-function createRoute (
- record,
- location,
- redirectedFrom,
- router
-) {
- var stringifyQuery$$1 = router && router.options.stringifyQuery;
- var route = {
- name: location.name || (record && record.name),
- meta: (record && record.meta) || {},
- path: location.path || '/',
- hash: location.hash || '',
- query: location.query || {},
- params: location.params || {},
- fullPath: getFullPath(location, stringifyQuery$$1),
- matched: record ? formatMatch(record) : []
- };
- if (redirectedFrom) {
- route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery$$1);
+ this._i18n = null;
}
- return Object.freeze(route)
-}
+};
-// the starting route that represents the initial state
-var START = createRoute(null, {
- path: '/'
-});
+/* */
-function formatMatch (record) {
- var res = [];
- while (record) {
- res.unshift(record);
- record = record.parent;
- }
- return res
-}
+var component = {
+ name: 'i18n',
+ functional: true,
+ props: {
+ tag: {
+ type: String,
+ default: 'span'
+ },
+ path: {
+ type: String,
+ required: true
+ },
+ locale: {
+ type: String
+ },
+ places: {
+ type: [Array, Object]
+ }
+ },
+ render: function render (h, ref) {
+ var props = ref.props;
+ var data = ref.data;
+ var children = ref.children;
+ var parent = ref.parent;
-function getFullPath (
- ref,
- _stringifyQuery
-) {
- var path = ref.path;
- var query = ref.query; if ( query === void 0 ) query = {};
- var hash = ref.hash; if ( hash === void 0 ) hash = '';
+ var i18n = parent.$i18n;
- var stringify = _stringifyQuery || stringifyQuery;
- return (path || '/') + stringify(query) + hash
-}
+ children = (children || []).filter(function (child) {
+ return child.tag || (child.text = child.text.trim())
+ });
-function isSameRoute (a, b) {
- if (b === START) {
- return a === b
- } else if (!b) {
- return false
- } else if (a.path && b.path) {
- return (
- a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
- a.hash === b.hash &&
- isObjectEqual(a.query, b.query)
- )
- } else if (a.name && b.name) {
- return (
- a.name === b.name &&
- a.hash === b.hash &&
- isObjectEqual(a.query, b.query) &&
- isObjectEqual(a.params, b.params)
- )
- } else {
- return false
- }
-}
-
-function isObjectEqual (a, b) {
- if ( a === void 0 ) a = {};
- if ( b === void 0 ) b = {};
-
- var aKeys = Object.keys(a);
- var bKeys = Object.keys(b);
- if (aKeys.length !== bKeys.length) {
- return false
- }
- return aKeys.every(function (key) {
- var aVal = a[key];
- var bVal = b[key];
- // check nested equality
- if (typeof aVal === 'object' && typeof bVal === 'object') {
- return isObjectEqual(aVal, bVal)
- }
- return String(aVal) === String(bVal)
- })
-}
-
-function isIncludedRoute (current, target) {
- return (
- current.path.replace(trailingSlashRE, '/').indexOf(
- target.path.replace(trailingSlashRE, '/')
- ) === 0 &&
- (!target.hash || current.hash === target.hash) &&
- queryIncludes(current.query, target.query)
- )
-}
-
-function queryIncludes (current, target) {
- for (var key in target) {
- if (!(key in current)) {
- return false
- }
- }
- return true
-}
-
-/* */
-
-// work around weird flow bug
-var toTypes = [String, Object];
-var eventTypes = [String, Array];
-
-var Link = {
- name: 'router-link',
- props: {
- to: {
- type: toTypes,
- required: true
- },
- tag: {
- type: String,
- default: 'a'
- },
- exact: Boolean,
- append: Boolean,
- replace: Boolean,
- activeClass: String,
- exactActiveClass: String,
- event: {
- type: eventTypes,
- default: 'click'
+ if (!i18n) {
+ if (true) {
+ warn('Cannot find VueI18n instance!');
+ }
+ return children
}
- },
- render: function render (h) {
- var this$1 = this;
- var router = this.$router;
- var current = this.$route;
- var ref = router.resolve(this.to, current, this.append);
- var location = ref.location;
- var route = ref.route;
- var href = ref.href;
+ var path = props.path;
+ var locale = props.locale;
- var classes = {};
- var globalActiveClass = router.options.linkActiveClass;
- var globalExactActiveClass = router.options.linkExactActiveClass;
- // Support global empty active class
- var activeClassFallback = globalActiveClass == null
- ? 'router-link-active'
- : globalActiveClass;
- var exactActiveClassFallback = globalExactActiveClass == null
- ? 'router-link-exact-active'
- : globalExactActiveClass;
- var activeClass = this.activeClass == null
- ? activeClassFallback
- : this.activeClass;
- var exactActiveClass = this.exactActiveClass == null
- ? exactActiveClassFallback
- : this.exactActiveClass;
- var compareTarget = location.path
- ? createRoute(null, location, null, router)
- : route;
+ var params = {};
+ var places = props.places || {};
- classes[exactActiveClass] = isSameRoute(current, compareTarget);
- classes[activeClass] = this.exact
- ? classes[exactActiveClass]
- : isIncludedRoute(current, compareTarget);
+ var hasPlaces = Array.isArray(places)
+ ? places.length > 0
+ : Object.keys(places).length > 0;
- var handler = function (e) {
- if (guardEvent(e)) {
- if (this$1.replace) {
- router.replace(location);
- } else {
- router.push(location);
- }
+ var everyPlace = children.every(function (child) {
+ if (child.data && child.data.attrs) {
+ var place = child.data.attrs.place;
+ return (typeof place !== 'undefined') && place !== ''
}
- };
+ });
- var on = { click: guardEvent };
- if (Array.isArray(this.event)) {
- this.event.forEach(function (e) { on[e] = handler; });
- } else {
- on[this.event] = handler;
+ if (hasPlaces && children.length > 0 && !everyPlace) {
+ warn('If places prop is set, all child elements must have place prop set.');
}
- var data = {
- class: classes
- };
-
- if (this.tag === 'a') {
- data.on = on;
- data.attrs = { href: href };
+ if (Array.isArray(places)) {
+ places.forEach(function (el, i) {
+ params[i] = el;
+ });
} else {
- // find the first child and apply listener and href
- var a = findAnchor(this.$slots.default);
- if (a) {
- // in case the is a static node
- a.isStatic = false;
- var extend = _Vue.util.extend;
- var aData = a.data = extend({}, a.data);
- aData.on = on;
- var aAttrs = a.data.attrs = extend({}, a.data.attrs);
- aAttrs.href = href;
- } else {
- // doesn't have child, apply listener to self
- data.on = on;
- }
+ Object.keys(places).forEach(function (key) {
+ params[key] = places[key];
+ });
}
- return h(this.tag, data, this.$slots.default)
- }
-};
+ children.forEach(function (child, i) {
+ var key = everyPlace
+ ? ("" + (child.data.attrs.place))
+ : ("" + i);
+ params[key] = child;
+ });
-function guardEvent (e) {
- // don't redirect with control keys
- if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
- // don't redirect when preventDefault called
- if (e.defaultPrevented) { return }
- // don't redirect on right click
- if (e.button !== undefined && e.button !== 0) { return }
- // don't redirect if `target="_blank"`
- if (e.currentTarget && e.currentTarget.getAttribute) {
- var target = e.currentTarget.getAttribute('target');
- if (/\b_blank\b/i.test(target)) { return }
- }
- // this may be a Weex event which doesn't have this method
- if (e.preventDefault) {
- e.preventDefault();
+ return h(props.tag, data, i18n.i(path, locale, params))
}
- return true
-}
+};
-function findAnchor (children) {
- if (children) {
- var child;
- for (var i = 0; i < children.length; i++) {
- child = children[i];
- if (child.tag === 'a') {
- return child
- }
- if (child.children && (child = findAnchor(child.children))) {
- return child
- }
- }
- }
-}
+var Vue;
-var _Vue;
+function install (_Vue) {
+ Vue = _Vue;
-function install (Vue) {
- if (install.installed) { return }
+ var version = (Vue.version && Number(Vue.version.split('.')[0])) || -1;
+ /* istanbul ignore if */
+ if ("development" !== 'production' && install.installed) {
+ warn('already installed.');
+ return
+ }
install.installed = true;
- _Vue = Vue;
-
- var isDef = function (v) { return v !== undefined; };
-
- var registerInstance = function (vm, callVal) {
- var i = vm.$options._parentVnode;
- if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
- i(vm, callVal);
- }
- };
-
- Vue.mixin({
- beforeCreate: function beforeCreate () {
- if (isDef(this.$options.router)) {
- this._routerRoot = this;
- this._router = this.$options.router;
- this._router.init(this);
- Vue.util.defineReactive(this, '_route', this._router.history.current);
- } else {
- this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
- }
- registerInstance(this, this);
- },
- destroyed: function destroyed () {
- registerInstance(this);
- }
- });
-
- Object.defineProperty(Vue.prototype, '$router', {
- get: function get () { return this._routerRoot._router }
- });
+ /* istanbul ignore if */
+ if ("development" !== 'production' && version < 2) {
+ warn(("vue-i18n (" + (install.version) + ") need to use Vue 2.0 or later (Vue: " + (Vue.version) + ")."));
+ return
+ }
- Object.defineProperty(Vue.prototype, '$route', {
- get: function get () { return this._routerRoot._route }
+ Object.defineProperty(Vue.prototype, '$i18n', {
+ get: function get () { return this._i18n }
});
- Vue.component('router-view', View);
- Vue.component('router-link', Link);
+ extend(Vue);
+ Vue.mixin(mixin);
+ Vue.component(component.name, component);
+ // use object-based merge strategy
var strats = Vue.config.optionMergeStrategies;
- // use the same hook merging strategy for route hooks
- strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
+ strats.i18n = strats.methods;
}
/* */
-var inBrowser = typeof window !== 'undefined';
-
-/* */
+var BaseFormatter = function BaseFormatter () {
+ this._caches = Object.create(null);
+};
-function resolvePath (
- relative,
- base,
- append
-) {
- var firstChar = relative.charAt(0);
- if (firstChar === '/') {
- return relative
+BaseFormatter.prototype.interpolate = function interpolate (message, values) {
+ var tokens = this._caches[message];
+ if (!tokens) {
+ tokens = parse(message);
+ this._caches[message] = tokens;
}
+ return compile(tokens, values)
+};
- if (firstChar === '?' || firstChar === '#') {
- return base + relative
- }
+var RE_TOKEN_LIST_VALUE = /^(\d)+/;
+var RE_TOKEN_NAMED_VALUE = /^(\w)+/;
- var stack = base.split('/');
+function parse (format) {
+ var tokens = [];
+ var position = 0;
- // remove trailing segment if:
- // - not appending
- // - appending to trailing slash (last segment is empty)
- if (!append || !stack[stack.length - 1]) {
- stack.pop();
- }
+ var text = '';
+ while (position < format.length) {
+ var char = format[position++];
+ if (char === '{') {
+ if (text) {
+ tokens.push({ type: 'text', value: text });
+ }
- // resolve relative path
- var segments = relative.replace(/^\//, '').split('/');
- for (var i = 0; i < segments.length; i++) {
- var segment = segments[i];
- if (segment === '..') {
- stack.pop();
- } else if (segment !== '.') {
- stack.push(segment);
+ text = '';
+ var sub = '';
+ char = format[position++];
+ while (char !== '}') {
+ sub += char;
+ char = format[position++];
+ }
+
+ var type = RE_TOKEN_LIST_VALUE.test(sub)
+ ? 'list'
+ : RE_TOKEN_NAMED_VALUE.test(sub)
+ ? 'named'
+ : 'unknown';
+ tokens.push({ value: sub, type: type });
+ } else if (char === '%') {
+ // when found rails i18n syntax, skip text capture
+ if (format[(position)] !== '{') {
+ text += char;
+ }
+ } else {
+ text += char;
}
}
- // ensure leading slash
- if (stack[0] !== '') {
- stack.unshift('');
- }
+ text && tokens.push({ type: 'text', value: text });
- return stack.join('/')
+ return tokens
}
-function parsePath (path) {
- var hash = '';
- var query = '';
-
- var hashIndex = path.indexOf('#');
- if (hashIndex >= 0) {
- hash = path.slice(hashIndex);
- path = path.slice(0, hashIndex);
- }
+function compile (tokens, values) {
+ var compiled = [];
+ var index = 0;
- var queryIndex = path.indexOf('?');
- if (queryIndex >= 0) {
- query = path.slice(queryIndex + 1);
- path = path.slice(0, queryIndex);
- }
+ var mode = Array.isArray(values)
+ ? 'list'
+ : isObject(values)
+ ? 'named'
+ : 'unknown';
+ if (mode === 'unknown') { return compiled }
- return {
- path: path,
- query: query,
- hash: hash
+ while (index < tokens.length) {
+ var token = tokens[index];
+ switch (token.type) {
+ case 'text':
+ compiled.push(token.value);
+ break
+ case 'list':
+ compiled.push(values[parseInt(token.value, 10)]);
+ break
+ case 'named':
+ if (mode === 'named') {
+ compiled.push((values)[token.value]);
+ } else {
+ if (true) {
+ warn(("Type of token '" + (token.type) + "' and format of value '" + mode + "' don't match!"));
+ }
+ }
+ break
+ case 'unknown':
+ if (true) {
+ warn("Detect 'unknown' type of token!");
+ }
+ break
+ }
+ index++;
}
-}
-function cleanPath (path) {
- return path.replace(/\/\//g, '/')
+ return compiled
}
-var index$1 = Array.isArray || function (arr) {
- return Object.prototype.toString.call(arr) == '[object Array]';
-};
-
-/**
- * Expose `pathToRegexp`.
- */
-var index = pathToRegexp;
-var parse_1 = parse;
-var compile_1 = compile;
-var tokensToFunction_1 = tokensToFunction;
-var tokensToRegExp_1 = tokensToRegExp;
+/* */
/**
- * The main path matching regexp utility.
- *
- * @type {RegExp}
+ * Path paerser
+ * - Inspired:
+ * Vue.js Path parser
*/
-var PATH_REGEXP = new RegExp([
- // Match escaped characters that would otherwise appear in future matches.
- // This allows the user to escape special characters that won't transform.
- '(\\\\.)',
- // Match Express-style parameters and un-named parameters with a prefix
- // and optional suffixes. Matches appear as:
- //
- // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
- // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
- // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
- '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
-].join('|'), 'g');
-/**
- * Parse a string for the raw tokens.
- *
- * @param {string} str
- * @param {Object=} options
- * @return {!Array}
- */
-function parse (str, options) {
- var tokens = [];
- var key = 0;
- var index = 0;
- var path = '';
- var defaultDelimiter = options && options.delimiter || '/';
- var res;
+// actions
+var APPEND = 0;
+var PUSH = 1;
+var INC_SUB_PATH_DEPTH = 2;
+var PUSH_SUB_PATH = 3;
- while ((res = PATH_REGEXP.exec(str)) != null) {
- var m = res[0];
- var escaped = res[1];
- var offset = res.index;
- path += str.slice(index, offset);
- index = offset + m.length;
+// states
+var BEFORE_PATH = 0;
+var IN_PATH = 1;
+var BEFORE_IDENT = 2;
+var IN_IDENT = 3;
+var IN_SUB_PATH = 4;
+var IN_SINGLE_QUOTE = 5;
+var IN_DOUBLE_QUOTE = 6;
+var AFTER_PATH = 7;
+var ERROR = 8;
- // Ignore already escaped sequences.
- if (escaped) {
- path += escaped[1];
- continue
- }
+var pathStateMachine = [];
- var next = str[index];
- var prefix = res[2];
- var name = res[3];
- var capture = res[4];
- var group = res[5];
- var modifier = res[6];
- var asterisk = res[7];
+pathStateMachine[BEFORE_PATH] = {
+ 'ws': [BEFORE_PATH],
+ 'ident': [IN_IDENT, APPEND],
+ '[': [IN_SUB_PATH],
+ 'eof': [AFTER_PATH]
+};
- // Push the current path onto the tokens.
- if (path) {
- tokens.push(path);
- path = '';
- }
+pathStateMachine[IN_PATH] = {
+ 'ws': [IN_PATH],
+ '.': [BEFORE_IDENT],
+ '[': [IN_SUB_PATH],
+ 'eof': [AFTER_PATH]
+};
- var partial = prefix != null && next != null && next !== prefix;
- var repeat = modifier === '+' || modifier === '*';
- var optional = modifier === '?' || modifier === '*';
- var delimiter = res[2] || defaultDelimiter;
- var pattern = capture || group;
+pathStateMachine[BEFORE_IDENT] = {
+ 'ws': [BEFORE_IDENT],
+ 'ident': [IN_IDENT, APPEND],
+ '0': [IN_IDENT, APPEND],
+ 'number': [IN_IDENT, APPEND]
+};
- tokens.push({
- name: name || key++,
- prefix: prefix || '',
- delimiter: delimiter,
- optional: optional,
- repeat: repeat,
- partial: partial,
- asterisk: !!asterisk,
- pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
- });
- }
+pathStateMachine[IN_IDENT] = {
+ 'ident': [IN_IDENT, APPEND],
+ '0': [IN_IDENT, APPEND],
+ 'number': [IN_IDENT, APPEND],
+ 'ws': [IN_PATH, PUSH],
+ '.': [BEFORE_IDENT, PUSH],
+ '[': [IN_SUB_PATH, PUSH],
+ 'eof': [AFTER_PATH, PUSH]
+};
- // Match any characters still remaining.
- if (index < str.length) {
- path += str.substr(index);
- }
+pathStateMachine[IN_SUB_PATH] = {
+ "'": [IN_SINGLE_QUOTE, APPEND],
+ '"': [IN_DOUBLE_QUOTE, APPEND],
+ '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH],
+ ']': [IN_PATH, PUSH_SUB_PATH],
+ 'eof': ERROR,
+ 'else': [IN_SUB_PATH, APPEND]
+};
- // If the path exists, push it onto the end.
- if (path) {
- tokens.push(path);
- }
+pathStateMachine[IN_SINGLE_QUOTE] = {
+ "'": [IN_SUB_PATH, APPEND],
+ 'eof': ERROR,
+ 'else': [IN_SINGLE_QUOTE, APPEND]
+};
- return tokens
-}
+pathStateMachine[IN_DOUBLE_QUOTE] = {
+ '"': [IN_SUB_PATH, APPEND],
+ 'eof': ERROR,
+ 'else': [IN_DOUBLE_QUOTE, APPEND]
+};
/**
- * Compile a string to a template function for the path.
- *
- * @param {string} str
- * @param {Object=} options
- * @return {!function(Object=, Object=)}
+ * Check if an expression is a literal value.
*/
-function compile (str, options) {
- return tokensToFunction(parse(str, options))
-}
-/**
- * Prettier encoding of URI path segments.
- *
- * @param {string}
- * @return {string}
- */
-function encodeURIComponentPretty (str) {
- return encodeURI(str).replace(/[\/?#]/g, function (c) {
- return '%' + c.charCodeAt(0).toString(16).toUpperCase()
- })
+var literalValueRE = /^\s?(true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;
+function isLiteral (exp) {
+ return literalValueRE.test(exp)
}
/**
- * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
- *
- * @param {string}
- * @return {string}
+ * Strip quotes from a string
*/
-function encodeAsterisk (str) {
- return encodeURI(str).replace(/[?#]/g, function (c) {
- return '%' + c.charCodeAt(0).toString(16).toUpperCase()
- })
+
+function stripQuotes (str) {
+ var a = str.charCodeAt(0);
+ var b = str.charCodeAt(str.length - 1);
+ return a === b && (a === 0x22 || a === 0x27)
+ ? str.slice(1, -1)
+ : str
}
/**
- * Expose a method for transforming tokens into the path function.
+ * Determine the type of a character in a keypath.
*/
-function tokensToFunction (tokens) {
- // Compile all the tokens into regexps.
- var matches = new Array(tokens.length);
-
- // Compile all the patterns before compilation.
- for (var i = 0; i < tokens.length; i++) {
- if (typeof tokens[i] === 'object') {
- matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
- }
- }
-
- return function (obj, opts) {
- var path = '';
- var data = obj || {};
- var options = opts || {};
- var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
-
- for (var i = 0; i < tokens.length; i++) {
- var token = tokens[i];
-
- if (typeof token === 'string') {
- path += token;
-
- continue
- }
-
- var value = data[token.name];
- var segment;
-
- if (value == null) {
- if (token.optional) {
- // Prepend partial segment prefixes.
- if (token.partial) {
- path += token.prefix;
- }
-
- continue
- } else {
- throw new TypeError('Expected "' + token.name + '" to be defined')
- }
- }
-
- if (index$1(value)) {
- if (!token.repeat) {
- throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
- }
-
- if (value.length === 0) {
- if (token.optional) {
- continue
- } else {
- throw new TypeError('Expected "' + token.name + '" to not be empty')
- }
- }
- for (var j = 0; j < value.length; j++) {
- segment = encode(value[j]);
+function getPathCharType (ch) {
+ if (ch === undefined || ch === null) { return 'eof' }
- if (!matches[i].test(segment)) {
- throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
- }
+ var code = ch.charCodeAt(0);
- path += (j === 0 ? token.prefix : token.delimiter) + segment;
- }
+ switch (code) {
+ case 0x5B: // [
+ case 0x5D: // ]
+ case 0x2E: // .
+ case 0x22: // "
+ case 0x27: // '
+ case 0x30: // 0
+ return ch
- continue
- }
+ case 0x5F: // _
+ case 0x24: // $
+ case 0x2D: // -
+ return 'ident'
- segment = token.asterisk ? encodeAsterisk(value) : encode(value);
+ case 0x20: // Space
+ case 0x09: // Tab
+ case 0x0A: // Newline
+ case 0x0D: // Return
+ case 0xA0: // No-break space
+ case 0xFEFF: // Byte Order Mark
+ case 0x2028: // Line Separator
+ case 0x2029: // Paragraph Separator
+ return 'ws'
+ }
- if (!matches[i].test(segment)) {
- throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
- }
+ // a-z, A-Z
+ if ((code >= 0x61 && code <= 0x7A) || (code >= 0x41 && code <= 0x5A)) {
+ return 'ident'
+ }
- path += token.prefix + segment;
- }
+ // 1-9
+ if (code >= 0x31 && code <= 0x39) { return 'number' }
- return path
- }
+ return 'else'
}
/**
- * Escape a regular expression string.
- *
- * @param {string} str
- * @return {string}
+ * Format a subPath, return its plain form if it is
+ * a literal string or number. Otherwise prepend the
+ * dynamic indicator (*).
*/
-function escapeString (str) {
- return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
-}
-/**
- * Escape the capturing group by escaping special characters and meaning.
- *
- * @param {string} group
- * @return {string}
- */
-function escapeGroup (group) {
- return group.replace(/([=!:$\/()])/g, '\\$1')
-}
+function formatSubPath (path) {
+ var trimmed = path.trim();
+ // invalid leading 0
+ if (path.charAt(0) === '0' && isNaN(path)) { return false }
-/**
- * Attach the keys as a property of the regexp.
- *
- * @param {!RegExp} re
- * @param {Array} keys
- * @return {!RegExp}
- */
-function attachKeys (re, keys) {
- re.keys = keys;
- return re
+ return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed
}
/**
- * Get the flags for a regexp from the options.
- *
- * @param {Object} options
- * @return {string}
+ * Parse a string path into an array of segments
*/
-function flags (options) {
- return options.sensitive ? '' : 'i'
-}
-/**
- * Pull out keys from a regexp.
- *
- * @param {!RegExp} path
- * @param {!Array} keys
- * @return {!RegExp}
- */
-function regexpToRegexp (path, keys) {
- // Use a negative lookahead to match only capturing groups.
- var groups = path.source.match(/\((?!\?)/g);
+function parse$1 (path) {
+ var keys = [];
+ var index = -1;
+ var mode = BEFORE_PATH;
+ var subPathDepth = 0;
+ var c;
+ var key;
+ var newChar;
+ var type;
+ var transition;
+ var action;
+ var typeMap;
+ var actions = [];
- if (groups) {
- for (var i = 0; i < groups.length; i++) {
- keys.push({
- name: i,
- prefix: null,
- delimiter: null,
- optional: false,
- repeat: false,
- partial: false,
- asterisk: false,
- pattern: null
- });
+ actions[PUSH] = function () {
+ if (key !== undefined) {
+ keys.push(key);
+ key = undefined;
}
- }
-
- return attachKeys(path, keys)
-}
-
-/**
- * Transform an array into a regexp.
- *
- * @param {!Array} path
- * @param {Array} keys
- * @param {!Object} options
- * @return {!RegExp}
- */
-function arrayToRegexp (path, keys, options) {
- var parts = [];
-
- for (var i = 0; i < path.length; i++) {
- parts.push(pathToRegexp(path[i], keys, options).source);
- }
+ };
- var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
+ actions[APPEND] = function () {
+ if (key === undefined) {
+ key = newChar;
+ } else {
+ key += newChar;
+ }
+ };
- return attachKeys(regexp, keys)
-}
+ actions[INC_SUB_PATH_DEPTH] = function () {
+ actions[APPEND]();
+ subPathDepth++;
+ };
-/**
- * Create a path regexp from string input.
- *
- * @param {string} path
- * @param {!Array} keys
- * @param {!Object} options
- * @return {!RegExp}
- */
-function stringToRegexp (path, keys, options) {
- return tokensToRegExp(parse(path, options), keys, options)
-}
+ actions[PUSH_SUB_PATH] = function () {
+ if (subPathDepth > 0) {
+ subPathDepth--;
+ mode = IN_SUB_PATH;
+ actions[APPEND]();
+ } else {
+ subPathDepth = 0;
+ key = formatSubPath(key);
+ if (key === false) {
+ return false
+ } else {
+ actions[PUSH]();
+ }
+ }
+ };
-/**
- * Expose a function for taking tokens and returning a RegExp.
- *
- * @param {!Array} tokens
- * @param {(Array|Object)=} keys
- * @param {Object=} options
- * @return {!RegExp}
- */
-function tokensToRegExp (tokens, keys, options) {
- if (!index$1(keys)) {
- options = /** @type {!Object} */ (keys || options);
- keys = [];
+ function maybeUnescapeQuote () {
+ var nextChar = path[index + 1];
+ if ((mode === IN_SINGLE_QUOTE && nextChar === "'") ||
+ (mode === IN_DOUBLE_QUOTE && nextChar === '"')) {
+ index++;
+ newChar = '\\' + nextChar;
+ actions[APPEND]();
+ return true
+ }
}
- options = options || {};
-
- var strict = options.strict;
- var end = options.end !== false;
- var route = '';
-
- // Iterate over the tokens and create our regexp string.
- for (var i = 0; i < tokens.length; i++) {
- var token = tokens[i];
+ while (mode !== null) {
+ index++;
+ c = path[index];
- if (typeof token === 'string') {
- route += escapeString(token);
- } else {
- var prefix = escapeString(token.prefix);
- var capture = '(?:' + token.pattern + ')';
+ if (c === '\\' && maybeUnescapeQuote()) {
+ continue
+ }
- keys.push(token);
+ type = getPathCharType(c);
+ typeMap = pathStateMachine[mode];
+ transition = typeMap[type] || typeMap['else'] || ERROR;
- if (token.repeat) {
- capture += '(?:' + prefix + capture + ')*';
- }
+ if (transition === ERROR) {
+ return // parse error
+ }
- if (token.optional) {
- if (!token.partial) {
- capture = '(?:' + prefix + '(' + capture + '))?';
- } else {
- capture = prefix + '(' + capture + ')?';
- }
- } else {
- capture = prefix + '(' + capture + ')';
+ mode = transition[0];
+ action = actions[transition[1]];
+ if (action) {
+ newChar = transition[2];
+ newChar = newChar === undefined
+ ? c
+ : newChar;
+ if (action() === false) {
+ return
}
+ }
- route += capture;
+ if (mode === AFTER_PATH) {
+ return keys
}
}
+}
- var delimiter = escapeString(options.delimiter || '/');
- var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
- // In non-strict mode we allow a slash at the end of match. If the path to
- // match already ends with a slash, we remove it for consistency. The slash
- // is valid at the end of a path match, not in the middle. This is important
- // in non-ending mode, where "/test/" shouldn't match "/test//route".
- if (!strict) {
- route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
- }
- if (end) {
- route += '$';
+
+
+function empty (target) {
+ /* istanbul ignore else */
+ if (Array.isArray(target)) {
+ return target.length === 0
} else {
- // In non-ending mode, we need the capturing groups to match as much as
- // possible by using a positive lookahead to the end or next path segment.
- route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
+ return false
}
-
- return attachKeys(new RegExp('^' + route, flags(options)), keys)
}
+var I18nPath = function I18nPath () {
+ this._cache = Object.create(null);
+};
+
/**
- * Normalize the given path string, returning a regular expression.
- *
- * An empty array can be passed in for the keys, which will hold the
- * placeholder key descriptions. For example, using `/user/:id`, `keys` will
- * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
- *
- * @param {(string|RegExp|Array)} path
- * @param {(Array|Object)=} keys
- * @param {Object=} options
- * @return {!RegExp}
+ * External parse that check for a cache hit first
*/
-function pathToRegexp (path, keys, options) {
- if (!index$1(keys)) {
- options = /** @type {!Object} */ (keys || options);
- keys = [];
+I18nPath.prototype.parsePath = function parsePath (path) {
+ var hit = this._cache[path];
+ if (!hit) {
+ hit = parse$1(path);
+ if (hit) {
+ this._cache[path] = hit;
+ }
}
+ return hit || []
+};
- options = options || {};
+/**
+ * Get path value from path string
+ */
+I18nPath.prototype.getPathValue = function getPathValue (obj, path) {
+ if (!isObject(obj)) { return null }
- if (path instanceof RegExp) {
- return regexpToRegexp(path, /** @type {!Array} */ (keys))
- }
+ var paths = this.parsePath(path);
+ if (empty(paths)) {
+ return null
+ } else {
+ var length = paths.length;
+ var ret = null;
+ var last = obj;
+ var i = 0;
+ while (i < length) {
+ var value = last[paths[i]];
+ if (value === undefined) {
+ last = null;
+ break
+ }
+ last = value;
+ i++;
+ }
- if (index$1(path)) {
- return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
+ ret = last;
+ return ret
}
-
- return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
-}
-
-index.parse = parse_1;
-index.compile = compile_1;
-index.tokensToFunction = tokensToFunction_1;
-index.tokensToRegExp = tokensToRegExp_1;
+};
/* */
-var regexpCompileCache = Object.create(null);
+var VueI18n = function VueI18n (options) {
+ var this$1 = this;
+ if ( options === void 0 ) options = {};
-function fillParams (
- path,
- params,
- routeMsg
-) {
- try {
- var filler =
- regexpCompileCache[path] ||
- (regexpCompileCache[path] = index.compile(path));
- return filler(params || {}, { pretty: true })
- } catch (e) {
- if (true) {
- warn(false, ("missing param for " + routeMsg + ": " + (e.message)));
- }
- return ''
- }
-}
+ var locale = options.locale || 'en-US';
+ var fallbackLocale = options.fallbackLocale || 'en-US';
+ var messages = options.messages || {};
+ var dateTimeFormats = options.dateTimeFormats || {};
+ var numberFormats = options.numberFormats || {};
-/* */
+ this._vm = null;
+ this._formatter = options.formatter || new BaseFormatter();
+ this._missing = options.missing || null;
+ this._root = options.root || null;
+ this._sync = options.sync === undefined ? true : !!options.sync;
+ this._fallbackRoot = options.fallbackRoot === undefined
+ ? true
+ : !!options.fallbackRoot;
+ this._silentTranslationWarn = options.silentTranslationWarn === undefined
+ ? false
+ : !!options.silentTranslationWarn;
+ this._dateTimeFormatters = {};
+ this._numberFormatters = {};
+ this._path = new I18nPath();
+ this._dataListeners = [];
-function createRouteMap (
- routes,
- oldPathList,
- oldPathMap,
- oldNameMap
-) {
- // the path list is used to control path matching priority
- var pathList = oldPathList || [];
- var pathMap = oldPathMap || Object.create(null);
- var nameMap = oldNameMap || Object.create(null);
+ this._exist = function (message, key) {
+ if (!message || !key) { return false }
+ return !isNull(this$1._path.getPathValue(message, key))
+ };
- routes.forEach(function (route) {
- addRouteRecord(pathList, pathMap, nameMap, route);
+ this._initVM({
+ locale: locale,
+ fallbackLocale: fallbackLocale,
+ messages: messages,
+ dateTimeFormats: dateTimeFormats,
+ numberFormats: numberFormats
});
+};
- // ensure wildcard routes are always at the end
- for (var i = 0, l = pathList.length; i < l; i++) {
- if (pathList[i] === '*') {
- pathList.push(pathList.splice(i, 1)[0]);
- l--;
- i--;
+var prototypeAccessors = { vm: {},messages: {},dateTimeFormats: {},numberFormats: {},locale: {},fallbackLocale: {},missing: {},formatter: {},silentTranslationWarn: {} };
+
+VueI18n.prototype._initVM = function _initVM (data) {
+ var silent = Vue.config.silent;
+ Vue.config.silent = true;
+ this._vm = new Vue({ data: data });
+ Vue.config.silent = silent;
+};
+
+VueI18n.prototype.subscribeDataChanging = function subscribeDataChanging (vm) {
+ this._dataListeners.push(vm);
+};
+
+VueI18n.prototype.unsubscribeDataChanging = function unsubscribeDataChanging (vm) {
+ remove(this._dataListeners, vm);
+};
+
+VueI18n.prototype.watchI18nData = function watchI18nData () {
+ var self = this;
+ return this._vm.$watch('$data', function () {
+ var i = self._dataListeners.length;
+ while (i--) {
+ Vue.nextTick(function () {
+ self._dataListeners[i] && self._dataListeners[i].$forceUpdate();
+ });
}
- }
+ }, { deep: true })
+};
- return {
- pathList: pathList,
- pathMap: pathMap,
- nameMap: nameMap
- }
-}
+VueI18n.prototype.watchLocale = function watchLocale () {
+ /* istanbul ignore if */
+ if (!this._sync || !this._root) { return null }
+ var target = this._vm;
+ return this._root.vm.$watch('locale', function (val) {
+ target.$set(target, 'locale', val);
+ target.$forceUpdate();
+ }, { immediate: true })
+};
-function addRouteRecord (
- pathList,
- pathMap,
- nameMap,
- route,
- parent,
- matchAs
-) {
- var path = route.path;
- var name = route.name;
- if (true) {
- assert(path != null, "\"path\" is required in a route configuration.");
- assert(
- typeof route.component !== 'string',
- "route config \"component\" for path: " + (String(path || name)) + " cannot be a " +
- "string id. Use an actual component instead."
- );
- }
+prototypeAccessors.vm.get = function () { return this._vm };
- var normalizedPath = normalizePath(path, parent);
- var pathToRegexpOptions = route.pathToRegexpOptions || {};
+prototypeAccessors.messages.get = function () { return looseClone(this._getMessages()) };
+prototypeAccessors.dateTimeFormats.get = function () { return looseClone(this._getDateTimeFormats()) };
+prototypeAccessors.numberFormats.get = function () { return looseClone(this._getNumberFormats()) };
- if (typeof route.caseSensitive === 'boolean') {
- pathToRegexpOptions.sensitive = route.caseSensitive;
- }
+prototypeAccessors.locale.get = function () { return this._vm.locale };
+prototypeAccessors.locale.set = function (locale) {
+ this._vm.$set(this._vm, 'locale', locale);
+};
- var record = {
- path: normalizedPath,
- regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
- components: route.components || { default: route.component },
- instances: {},
- name: name,
- parent: parent,
- matchAs: matchAs,
- redirect: route.redirect,
- beforeEnter: route.beforeEnter,
- meta: route.meta || {},
- props: route.props == null
- ? {}
- : route.components
- ? route.props
- : { default: route.props }
- };
+prototypeAccessors.fallbackLocale.get = function () { return this._vm.fallbackLocale };
+prototypeAccessors.fallbackLocale.set = function (locale) {
+ this._vm.$set(this._vm, 'fallbackLocale', locale);
+};
- if (route.children) {
- // Warn if route is named, does not redirect and has a default child route.
- // If users navigate to this route by name, the default child will
- // not be rendered (GH Issue #629)
- if (true) {
- if (route.name && !route.redirect && route.children.some(function (child) { return /^\/?$/.test(child.path); })) {
- warn(
- false,
- "Named Route '" + (route.name) + "' has a default child route. " +
- "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
- "the default child route will not be rendered. Remove the name from " +
- "this route and use the name of the default child route for named " +
- "links instead."
- );
- }
- }
- route.children.forEach(function (child) {
- var childMatchAs = matchAs
- ? cleanPath((matchAs + "/" + (child.path)))
- : undefined;
- addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
- });
- }
+prototypeAccessors.missing.get = function () { return this._missing };
+prototypeAccessors.missing.set = function (handler) { this._missing = handler; };
- if (route.alias !== undefined) {
- var aliases = Array.isArray(route.alias)
- ? route.alias
- : [route.alias];
+prototypeAccessors.formatter.get = function () { return this._formatter };
+prototypeAccessors.formatter.set = function (formatter) { this._formatter = formatter; };
- aliases.forEach(function (alias) {
- var aliasRoute = {
- path: alias,
- children: route.children
- };
- addRouteRecord(
- pathList,
- pathMap,
- nameMap,
- aliasRoute,
- parent,
- record.path || '/' // matchAs
- );
- });
- }
+prototypeAccessors.silentTranslationWarn.get = function () { return this._silentTranslationWarn };
+prototypeAccessors.silentTranslationWarn.set = function (silent) { this._silentTranslationWarn = silent; };
- if (!pathMap[record.path]) {
- pathList.push(record.path);
- pathMap[record.path] = record;
- }
+VueI18n.prototype._getMessages = function _getMessages () { return this._vm.messages };
+VueI18n.prototype._getDateTimeFormats = function _getDateTimeFormats () { return this._vm.dateTimeFormats };
+VueI18n.prototype._getNumberFormats = function _getNumberFormats () { return this._vm.numberFormats };
- if (name) {
- if (!nameMap[name]) {
- nameMap[name] = record;
- } else if ("development" !== 'production' && !matchAs) {
+VueI18n.prototype._warnDefault = function _warnDefault (locale, key, result, vm) {
+ if (!isNull(result)) { return result }
+ if (this.missing) {
+ this.missing.apply(null, [locale, key, vm]);
+ } else {
+ if ("development" !== 'production' && !this._silentTranslationWarn) {
warn(
- false,
- "Duplicate named routes definition: " +
- "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
+ "Cannot translate the value of keypath '" + key + "'. " +
+ 'Use the value of keypath as default.'
);
}
}
-}
-
-function compileRouteRegex (path, pathToRegexpOptions) {
- var regex = index(path, [], pathToRegexpOptions);
- if (true) {
- var keys = {};
- regex.keys.forEach(function (key) {
- warn(!keys[key.name], ("Duplicate param keys in route with path: \"" + path + "\""));
- keys[key.name] = true;
- });
- }
- return regex
-}
+ return key
+};
-function normalizePath (path, parent) {
- path = path.replace(/\/$/, '');
- if (path[0] === '/') { return path }
- if (parent == null) { return path }
- return cleanPath(((parent.path) + "/" + path))
-}
+VueI18n.prototype._isFallbackRoot = function _isFallbackRoot (val) {
+ return !val && !isNull(this._root) && this._fallbackRoot
+};
-/* */
+VueI18n.prototype._interpolate = function _interpolate (
+ locale,
+ message,
+ key,
+ host,
+ interpolateMode,
+ values
+) {
+ if (!message) { return null }
+ var pathRet = this._path.getPathValue(message, key);
+ if (Array.isArray(pathRet)) { return pathRet }
-function normalizeLocation (
- raw,
- current,
- append,
- router
-) {
- var next = typeof raw === 'string' ? { path: raw } : raw;
- // named target
- if (next.name || next._normalized) {
- return next
+ var ret;
+ if (isNull(pathRet)) {
+ /* istanbul ignore else */
+ if (isPlainObject(message)) {
+ ret = message[key];
+ if (typeof ret !== 'string') {
+ if ("development" !== 'production' && !this._silentTranslationWarn) {
+ warn(("Value of key '" + key + "' is not a string!"));
+ }
+ return null
+ }
+ } else {
+ return null
+ }
+ } else {
+ /* istanbul ignore else */
+ if (typeof pathRet === 'string') {
+ ret = pathRet;
+ } else {
+ if ("development" !== 'production' && !this._silentTranslationWarn) {
+ warn(("Value of key '" + key + "' is not a string!"));
+ }
+ return null
+ }
}
- // relative params
- if (!next.path && next.params && current) {
- next = assign({}, next);
- next._normalized = true;
- var params = assign(assign({}, current.params), next.params);
- if (current.name) {
- next.name = current.name;
- next.params = params;
- } else if (current.matched.length) {
- var rawPath = current.matched[current.matched.length - 1].path;
- next.path = fillParams(rawPath, params, ("path " + (current.path)));
- } else if (true) {
- warn(false, "relative params navigation requires a current route.");
- }
- return next
+ // Check for the existance of links within the translated string
+ if (ret.indexOf('@:') >= 0) {
+ ret = this._link(locale, message, ret, host, interpolateMode, values);
}
- var parsedPath = parsePath(next.path || '');
- var basePath = (current && current.path) || '/';
- var path = parsedPath.path
- ? resolvePath(parsedPath.path, basePath, append || next.append)
- : basePath;
+ return !values ? ret : this._render(ret, interpolateMode, values)
+};
- var query = resolveQuery(
- parsedPath.query,
- next.query,
- router && router.options.parseQuery
- );
+VueI18n.prototype._link = function _link (
+ locale,
+ message,
+ str,
+ host,
+ interpolateMode,
+ values
+) {
+ var this$1 = this;
- var hash = next.hash || parsedPath.hash;
- if (hash && hash.charAt(0) !== '#') {
- hash = "#" + hash;
- }
+ var ret = str;
- return {
- _normalized: true,
- path: path,
- query: query,
- hash: hash
- }
-}
+ // Match all the links within the local
+ // We are going to replace each of
+ // them with its translation
+ var matches = ret.match(/(@:[\w\-_|.]+)/g);
+ for (var idx in matches) {
+ // ie compatible: filter custom array
+ // prototype method
+ if (!matches.hasOwnProperty(idx)) {
+ continue
+ }
+ var link = matches[idx];
+ // Remove the leading @:
+ var linkPlaceholder = link.substr(2);
+ // Translate the link
+ var translated = this$1._interpolate(
+ locale, message, linkPlaceholder, host,
+ interpolateMode === 'raw' ? 'string' : interpolateMode,
+ interpolateMode === 'raw' ? undefined : values
+ );
-function assign (a, b) {
- for (var key in b) {
- a[key] = b[key];
+ if (this$1._isFallbackRoot(translated)) {
+ if ("development" !== 'production' && !this$1._silentTranslationWarn) {
+ warn(("Fall back to translate the link placeholder '" + linkPlaceholder + "' with root locale."));
+ }
+ /* istanbul ignore if */
+ if (!this$1._root) { throw Error('unexpected error') }
+ var root = this$1._root;
+ translated = root._translate(
+ root._getMessages(), root.locale, root.fallbackLocale,
+ linkPlaceholder, host, interpolateMode, values
+ );
+ }
+ translated = this$1._warnDefault(locale, linkPlaceholder, translated, host);
+
+ // Replace the link with the translated
+ ret = !translated ? ret : ret.replace(link, translated);
}
- return a
-}
-/* */
+ return ret
+};
+VueI18n.prototype._render = function _render (message, interpolateMode, values) {
+ var ret = this._formatter.interpolate(message, values);
+ // if interpolateMode is **not** 'string' ('row'),
+ // return the compiled data (e.g. ['foo', VNode, 'bar']) with formatter
+ return interpolateMode === 'string' ? ret.join('') : ret
+};
-function createMatcher (
- routes,
- router
+VueI18n.prototype._translate = function _translate (
+ messages,
+ locale,
+ fallback,
+ key,
+ host,
+ interpolateMode,
+ args
) {
- var ref = createRouteMap(routes);
- var pathList = ref.pathList;
- var pathMap = ref.pathMap;
- var nameMap = ref.nameMap;
+ var res =
+ this._interpolate(locale, messages[locale], key, host, interpolateMode, args);
+ if (!isNull(res)) { return res }
- function addRoutes (routes) {
- createRouteMap(routes, pathList, pathMap, nameMap);
+ res = this._interpolate(fallback, messages[fallback], key, host, interpolateMode, args);
+ if (!isNull(res)) {
+ if ("development" !== 'production' && !this._silentTranslationWarn) {
+ warn(("Fall back to translate the keypath '" + key + "' with '" + fallback + "' locale."));
+ }
+ return res
+ } else {
+ return null
}
+};
- function match (
- raw,
- currentRoute,
- redirectedFrom
- ) {
- var location = normalizeLocation(raw, currentRoute, false, router);
- var name = location.name;
-
- if (name) {
- var record = nameMap[name];
- if (true) {
- warn(record, ("Route with name '" + name + "' does not exist"));
- }
- if (!record) { return _createRoute(null, location) }
- var paramNames = record.regex.keys
- .filter(function (key) { return !key.optional; })
- .map(function (key) { return key.name; });
+VueI18n.prototype._t = function _t (key, _locale, messages, host) {
+ var values = [], len = arguments.length - 4;
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 4 ];
- if (typeof location.params !== 'object') {
- location.params = {};
- }
+ if (!key) { return '' }
- if (currentRoute && typeof currentRoute.params === 'object') {
- for (var key in currentRoute.params) {
- if (!(key in location.params) && paramNames.indexOf(key) > -1) {
- location.params[key] = currentRoute.params[key];
- }
- }
- }
+ var parsedArgs = parseArgs.apply(void 0, values);
+ var locale = parsedArgs.locale || _locale;
- if (record) {
- location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
- return _createRoute(record, location, redirectedFrom)
- }
- } else if (location.path) {
- location.params = {};
- for (var i = 0; i < pathList.length; i++) {
- var path = pathList[i];
- var record$1 = pathMap[path];
- if (matchRoute(record$1.regex, location.path, location.params)) {
- return _createRoute(record$1, location, redirectedFrom)
- }
- }
+ var ret = this._translate(
+ messages, locale, this.fallbackLocale, key,
+ host, 'string', parsedArgs.params
+ );
+ if (this._isFallbackRoot(ret)) {
+ if ("development" !== 'production' && !this._silentTranslationWarn) {
+ warn(("Fall back to translate the keypath '" + key + "' with root locale."));
}
- // no match
- return _createRoute(null, location)
+ /* istanbul ignore if */
+ if (!this._root) { throw Error('unexpected error') }
+ return (ref = this._root).t.apply(ref, [ key ].concat( values ))
+ } else {
+ return this._warnDefault(locale, key, ret, host)
}
+ var ref;
+};
- function redirect (
- record,
- location
- ) {
- var originalRedirect = record.redirect;
- var redirect = typeof originalRedirect === 'function'
- ? originalRedirect(createRoute(record, location, null, router))
- : originalRedirect;
+VueI18n.prototype.t = function t (key) {
+ var values = [], len = arguments.length - 1;
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 1 ];
- if (typeof redirect === 'string') {
- redirect = { path: redirect };
- }
+ return (ref = this)._t.apply(ref, [ key, this.locale, this._getMessages(), null ].concat( values ))
+ var ref;
+};
- if (!redirect || typeof redirect !== 'object') {
- if (true) {
- warn(
- false, ("invalid redirect option: " + (JSON.stringify(redirect)))
- );
- }
- return _createRoute(null, location)
- }
-
- var re = redirect;
- var name = re.name;
- var path = re.path;
- var query = location.query;
- var hash = location.hash;
- var params = location.params;
- query = re.hasOwnProperty('query') ? re.query : query;
- hash = re.hasOwnProperty('hash') ? re.hash : hash;
- params = re.hasOwnProperty('params') ? re.params : params;
-
- if (name) {
- // resolved named direct
- var targetRecord = nameMap[name];
- if (true) {
- assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
- }
- return match({
- _normalized: true,
- name: name,
- query: query,
- hash: hash,
- params: params
- }, undefined, location)
- } else if (path) {
- // 1. resolve relative redirect
- var rawPath = resolveRecordPath(path, record);
- // 2. resolve params
- var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
- // 3. rematch with existing query and hash
- return match({
- _normalized: true,
- path: resolvedPath,
- query: query,
- hash: hash
- }, undefined, location)
- } else {
- if (true) {
- warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
- }
- return _createRoute(null, location)
+VueI18n.prototype._i = function _i (key, locale, messages, host, values) {
+ var ret =
+ this._translate(messages, locale, this.fallbackLocale, key, host, 'raw', values);
+ if (this._isFallbackRoot(ret)) {
+ if ("development" !== 'production' && !this._silentTranslationWarn) {
+ warn(("Fall back to interpolate the keypath '" + key + "' with root locale."));
}
+ if (!this._root) { throw Error('unexpected error') }
+ return this._root.i(key, locale, values)
+ } else {
+ return this._warnDefault(locale, key, ret, host)
}
+};
- function alias (
- record,
- location,
- matchAs
- ) {
- var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
- var aliasedMatch = match({
- _normalized: true,
- path: aliasedPath
- });
- if (aliasedMatch) {
- var matched = aliasedMatch.matched;
- var aliasedRecord = matched[matched.length - 1];
- location.params = aliasedMatch.params;
- return _createRoute(aliasedRecord, location)
- }
- return _createRoute(null, location)
- }
+VueI18n.prototype.i = function i (key, locale, values) {
+ /* istanbul ignore if */
+ if (!key) { return '' }
- function _createRoute (
- record,
- location,
- redirectedFrom
- ) {
- if (record && record.redirect) {
- return redirect(record, redirectedFrom || location)
- }
- if (record && record.matchAs) {
- return alias(record, location, record.matchAs)
- }
- return createRoute(record, location, redirectedFrom, router)
+ if (typeof locale !== 'string') {
+ locale = this.locale;
}
- return {
- match: match,
- addRoutes: addRoutes
- }
-}
+ return this._i(key, locale, this._getMessages(), null, values)
+};
-function matchRoute (
- regex,
- path,
- params
+VueI18n.prototype._tc = function _tc (
+ key,
+ _locale,
+ messages,
+ host,
+ choice
) {
- var m = path.match(regex);
+ var values = [], len = arguments.length - 5;
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 5 ];
- if (!m) {
- return false
- } else if (!params) {
- return true
+ if (!key) { return '' }
+ if (choice === undefined) {
+ choice = 1;
}
+ return fetchChoice((ref = this)._t.apply(ref, [ key, _locale, messages, host ].concat( values )), choice)
+ var ref;
+};
- for (var i = 1, len = m.length; i < len; ++i) {
- var key = regex.keys[i - 1];
- var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
- if (key) {
- params[key.name] = val;
- }
- }
+VueI18n.prototype.tc = function tc (key, choice) {
+ var values = [], len = arguments.length - 2;
+ while ( len-- > 0 ) values[ len ] = arguments[ len + 2 ];
- return true
-}
+ return (ref = this)._tc.apply(ref, [ key, this.locale, this._getMessages(), null, choice ].concat( values ))
+ var ref;
+};
-function resolveRecordPath (path, record) {
- return resolvePath(path, record.parent ? record.parent.path : '/', true)
-}
+VueI18n.prototype._te = function _te (key, locale, messages) {
+ var args = [], len = arguments.length - 3;
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ];
-/* */
+ var _locale = parseArgs.apply(void 0, args).locale || locale;
+ return this._exist(messages[_locale], key)
+};
+VueI18n.prototype.te = function te (key, locale) {
+ return this._te(key, this.locale, this._getMessages(), locale)
+};
-var positionStore = Object.create(null);
+VueI18n.prototype.getLocaleMessage = function getLocaleMessage (locale) {
+ return looseClone(this._vm.messages[locale] || {})
+};
-function setupScroll () {
- window.addEventListener('popstate', function (e) {
- saveScrollPosition();
- if (e.state && e.state.key) {
- setStateKey(e.state.key);
- }
- });
-}
+VueI18n.prototype.setLocaleMessage = function setLocaleMessage (locale, message) {
+ this._vm.messages[locale] = message;
+};
-function handleScroll (
- router,
- to,
- from,
- isPop
+ VueI18n.prototype.mergeLocaleMessage = function mergeLocaleMessage (locale, message) {
+ this._vm.messages[locale] = Vue.util.extend(this._vm.messages[locale] || {}, message);
+};
+
+VueI18n.prototype.getDateTimeFormat = function getDateTimeFormat (locale) {
+ return looseClone(this._vm.dateTimeFormats[locale] || {})
+};
+
+VueI18n.prototype.setDateTimeFormat = function setDateTimeFormat (locale, format) {
+ this._vm.dateTimeFormats[locale] = format;
+};
+
+VueI18n.prototype.mergeDateTimeFormat = function mergeDateTimeFormat (locale, format) {
+ this._vm.dateTimeFormats[locale] = Vue.util.extend(this._vm.dateTimeFormats[locale] || {}, format);
+};
+
+VueI18n.prototype._localizeDateTime = function _localizeDateTime (
+ value,
+ locale,
+ fallback,
+ dateTimeFormats,
+ key
) {
- if (!router.app) {
- return
+ var _locale = locale;
+ var formats = dateTimeFormats[_locale];
+
+ // fallback locale
+ if (isNull(formats) || isNull(formats[key])) {
+ if (true) {
+ warn(("Fall back to '" + fallback + "' datetime formats from '" + locale + " datetime formats."));
+ }
+ _locale = fallback;
+ formats = dateTimeFormats[_locale];
}
- var behavior = router.options.scrollBehavior;
- if (!behavior) {
- return
+ if (isNull(formats) || isNull(formats[key])) {
+ return null
+ } else {
+ var format = formats[key];
+ var id = _locale + "__" + key;
+ var formatter = this._dateTimeFormatters[id];
+ if (!formatter) {
+ formatter = this._dateTimeFormatters[id] = new Intl.DateTimeFormat(_locale, format);
+ }
+ return formatter.format(value)
}
+};
- if (true) {
- assert(typeof behavior === 'function', "scrollBehavior must be a function");
+VueI18n.prototype._d = function _d (value, locale, key) {
+ /* istanbul ignore if */
+ if ("development" !== 'production' && !VueI18n.availabilities.dateTimeFormat) {
+ warn('Cannot format a Date value due to not support Intl.DateTimeFormat.');
+ return ''
}
- // wait until re-render finishes before scrolling
- router.app.$nextTick(function () {
- var position = getScrollPosition();
- var shouldScroll = behavior(to, from, isPop ? position : null);
- if (!shouldScroll) {
- return
+ if (!key) {
+ return new Intl.DateTimeFormat(locale).format(value)
+ }
+
+ var ret =
+ this._localizeDateTime(value, locale, this.fallbackLocale, this._getDateTimeFormats(), key);
+ if (this._isFallbackRoot(ret)) {
+ if (true) {
+ warn(("Fall back to datetime localization of root: key '" + key + "' ."));
}
- var isObject = typeof shouldScroll === 'object';
- if (isObject && typeof shouldScroll.selector === 'string') {
- var el = document.querySelector(shouldScroll.selector);
- if (el) {
- var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
- offset = normalizeOffset(offset);
- position = getElementPosition(el, offset);
- } else if (isValidPosition(shouldScroll)) {
- position = normalizePosition(shouldScroll);
+ /* istanbul ignore if */
+ if (!this._root) { throw Error('unexpected error') }
+ return this._root.d(value, key, locale)
+ } else {
+ return ret || ''
+ }
+};
+
+VueI18n.prototype.d = function d (value) {
+ var args = [], len = arguments.length - 1;
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
+
+ var locale = this.locale;
+ var key = null;
+
+ if (args.length === 1) {
+ if (typeof args[0] === 'string') {
+ key = args[0];
+ } else if (isObject(args[0])) {
+ if (args[0].locale) {
+ locale = args[0].locale;
+ }
+ if (args[0].key) {
+ key = args[0].key;
}
- } else if (isObject && isValidPosition(shouldScroll)) {
- position = normalizePosition(shouldScroll);
}
-
- if (position) {
- window.scrollTo(position.x, position.y);
+ } else if (args.length === 2) {
+ if (typeof args[0] === 'string') {
+ key = args[0];
+ }
+ if (typeof args[1] === 'string') {
+ locale = args[1];
}
- });
-}
-
-function saveScrollPosition () {
- var key = getStateKey();
- if (key) {
- positionStore[key] = {
- x: window.pageXOffset,
- y: window.pageYOffset
- };
}
-}
-function getScrollPosition () {
- var key = getStateKey();
- if (key) {
- return positionStore[key]
- }
-}
+ return this._d(value, locale, key)
+};
-function getElementPosition (el, offset) {
- var docEl = document.documentElement;
- var docRect = docEl.getBoundingClientRect();
- var elRect = el.getBoundingClientRect();
- return {
- x: elRect.left - docRect.left - offset.x,
- y: elRect.top - docRect.top - offset.y
+VueI18n.prototype.getNumberFormat = function getNumberFormat (locale) {
+ return looseClone(this._vm.numberFormats[locale] || {})
+};
+
+VueI18n.prototype.setNumberFormat = function setNumberFormat (locale, format) {
+ this._vm.numberFormats[locale] = format;
+};
+
+VueI18n.prototype.mergeNumberFormat = function mergeNumberFormat (locale, format) {
+ this._vm.numberFormats[locale] = Vue.util.extend(this._vm.numberFormats[locale] || {}, format);
+};
+
+VueI18n.prototype._localizeNumber = function _localizeNumber (
+ value,
+ locale,
+ fallback,
+ numberFormats,
+ key
+) {
+ var _locale = locale;
+ var formats = numberFormats[_locale];
+
+ // fallback locale
+ if (isNull(formats) || isNull(formats[key])) {
+ if (true) {
+ warn(("Fall back to '" + fallback + "' number formats from '" + locale + " number formats."));
+ }
+ _locale = fallback;
+ formats = numberFormats[_locale];
}
-}
-function isValidPosition (obj) {
- return isNumber(obj.x) || isNumber(obj.y)
-}
+ if (isNull(formats) || isNull(formats[key])) {
+ return null
+ } else {
+ var format = formats[key];
+ var id = _locale + "__" + key;
+ var formatter = this._numberFormatters[id];
+ if (!formatter) {
+ formatter = this._numberFormatters[id] = new Intl.NumberFormat(_locale, format);
+ }
+ return formatter.format(value)
+ }
+};
-function normalizePosition (obj) {
- return {
- x: isNumber(obj.x) ? obj.x : window.pageXOffset,
- y: isNumber(obj.y) ? obj.y : window.pageYOffset
+VueI18n.prototype._n = function _n (value, locale, key) {
+ /* istanbul ignore if */
+ if ("development" !== 'production' && !VueI18n.availabilities.numberFormat) {
+ warn('Cannot format a Date value due to not support Intl.NumberFormat.');
+ return ''
}
-}
-function normalizeOffset (obj) {
- return {
- x: isNumber(obj.x) ? obj.x : 0,
- y: isNumber(obj.y) ? obj.y : 0
+ if (!key) {
+ return new Intl.NumberFormat(locale).format(value)
}
-}
-function isNumber (v) {
- return typeof v === 'number'
-}
+ var ret =
+ this._localizeNumber(value, locale, this.fallbackLocale, this._getNumberFormats(), key);
+ if (this._isFallbackRoot(ret)) {
+ if (true) {
+ warn(("Fall back to number localization of root: key '" + key + "' ."));
+ }
+ /* istanbul ignore if */
+ if (!this._root) { throw Error('unexpected error') }
+ return this._root.n(value, key, locale)
+ } else {
+ return ret || ''
+ }
+};
-/* */
+VueI18n.prototype.n = function n (value) {
+ var args = [], len = arguments.length - 1;
+ while ( len-- > 0 ) args[ len ] = arguments[ len + 1 ];
-var supportsPushState = inBrowser && (function () {
- var ua = window.navigator.userAgent;
+ var locale = this.locale;
+ var key = null;
- if (
- (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
- ua.indexOf('Mobile Safari') !== -1 &&
- ua.indexOf('Chrome') === -1 &&
- ua.indexOf('Windows Phone') === -1
- ) {
- return false
+ if (args.length === 1) {
+ if (typeof args[0] === 'string') {
+ key = args[0];
+ } else if (isObject(args[0])) {
+ if (args[0].locale) {
+ locale = args[0].locale;
+ }
+ if (args[0].key) {
+ key = args[0].key;
+ }
+ }
+ } else if (args.length === 2) {
+ if (typeof args[0] === 'string') {
+ key = args[0];
+ }
+ if (typeof args[1] === 'string') {
+ locale = args[1];
+ }
}
- return window.history && 'pushState' in window.history
-})();
+ return this._n(value, locale, key)
+};
-// use User Timing api (if present) for more accurate key precision
-var Time = inBrowser && window.performance && window.performance.now
- ? window.performance
- : Date;
+Object.defineProperties( VueI18n.prototype, prototypeAccessors );
-var _key = genKey();
+VueI18n.availabilities = {
+ dateTimeFormat: canUseDateTimeFormat,
+ numberFormat: canUseNumberFormat
+};
+VueI18n.install = install;
+VueI18n.version = '7.2.0';
-function genKey () {
- return Time.now().toFixed(3)
+/* istanbul ignore if */
+if (typeof window !== 'undefined' && window.Vue) {
+ window.Vue.use(VueI18n);
}
-function getStateKey () {
- return _key
-}
+/* harmony default export */ __webpack_exports__["default"] = (VueI18n);
-function setStateKey (key) {
- _key = key;
-}
-function pushState (url, replace) {
- saveScrollPosition();
- // try...catch the pushState call to get around Safari
- // DOM Exception 18 where it limits to 100 pushState calls
- var history = window.history;
- try {
- if (replace) {
- history.replaceState({ key: _key }, '', url);
- } else {
- _key = genKey();
- history.pushState({ key: _key }, '', url);
- }
- } catch (e) {
- window.location[replace ? 'replace' : 'assign'](url);
+/***/ }),
+/* 40 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
+/**
+ * vue-router v2.7.0
+ * (c) 2017 Evan You
+ * @license MIT
+ */
+/* */
+
+function assert (condition, message) {
+ if (!condition) {
+ throw new Error(("[vue-router] " + message))
}
}
-function replaceState (url) {
- pushState(url, true);
+function warn (condition, message) {
+ if ("development" !== 'production' && !condition) {
+ typeof console !== 'undefined' && console.warn(("[vue-router] " + message));
+ }
}
-/* */
+function isError (err) {
+ return Object.prototype.toString.call(err).indexOf('Error') > -1
+}
-function runQueue (queue, fn, cb) {
- var step = function (index) {
- if (index >= queue.length) {
- cb();
- } else {
- if (queue[index]) {
- fn(queue[index], function () {
- step(index + 1);
- });
- } else {
- step(index + 1);
- }
+var View = {
+ name: 'router-view',
+ functional: true,
+ props: {
+ name: {
+ type: String,
+ default: 'default'
}
- };
- step(0);
-}
+ },
+ render: function render (_, ref) {
+ var props = ref.props;
+ var children = ref.children;
+ var parent = ref.parent;
+ var data = ref.data;
-/* */
+ data.routerView = true;
-function resolveAsyncComponents (matched) {
- return function (to, from, next) {
- var hasAsync = false;
- var pending = 0;
- var error = null;
+ // directly use parent context's createElement() function
+ // so that components rendered by router-view can resolve named slots
+ var h = parent.$createElement;
+ var name = props.name;
+ var route = parent.$route;
+ var cache = parent._routerViewCache || (parent._routerViewCache = {});
- flatMapComponents(matched, function (def, _, match, key) {
- // if it's a function and doesn't have cid attached,
- // assume it's an async component resolve function.
- // we are not using Vue's default async resolving mechanism because
- // we want to halt the navigation until the incoming component has been
- // resolved.
- if (typeof def === 'function' && def.cid === undefined) {
- hasAsync = true;
- pending++;
+ // determine current view depth, also check to see if the tree
+ // has been toggled inactive but kept-alive.
+ var depth = 0;
+ var inactive = false;
+ while (parent && parent._routerRoot !== parent) {
+ if (parent.$vnode && parent.$vnode.data.routerView) {
+ depth++;
+ }
+ if (parent._inactive) {
+ inactive = true;
+ }
+ parent = parent.$parent;
+ }
+ data.routerViewDepth = depth;
- var resolve = once(function (resolvedDef) {
- if (resolvedDef.__esModule && resolvedDef.default) {
- resolvedDef = resolvedDef.default;
- }
- // save resolved on async factory in case it's used elsewhere
- def.resolved = typeof resolvedDef === 'function'
- ? resolvedDef
- : _Vue.extend(resolvedDef);
- match.components[key] = resolvedDef;
- pending--;
- if (pending <= 0) {
- next();
- }
- });
+ // render previous view if the tree is inactive and kept-alive
+ if (inactive) {
+ return h(cache[name], data, children)
+ }
- var reject = once(function (reason) {
- var msg = "Failed to resolve async component " + key + ": " + reason;
- "development" !== 'production' && warn(false, msg);
- if (!error) {
- error = isError(reason)
- ? reason
- : new Error(msg);
- next(error);
- }
- });
+ var matched = route.matched[depth];
+ // render empty node if no matched route
+ if (!matched) {
+ cache[name] = null;
+ return h()
+ }
- var res;
- try {
- res = def(resolve, reject);
- } catch (e) {
- reject(e);
- }
- if (res) {
- if (typeof res.then === 'function') {
- res.then(resolve, reject);
- } else {
- // new syntax in Vue 2.3
- var comp = res.component;
- if (comp && typeof comp.then === 'function') {
- comp.then(resolve, reject);
- }
- }
- }
- }
- });
+ var component = cache[name] = matched.components[name];
- if (!hasAsync) { next(); }
- }
-}
+ // attach instance registration hook
+ // this will be called in the instance's injected lifecycle hooks
+ data.registerRouteInstance = function (vm, val) {
+ // val could be undefined for unregistration
+ var current = matched.instances[name];
+ if (
+ (val && current !== vm) ||
+ (!val && current === vm)
+ ) {
+ matched.instances[name] = val;
+ }
+ }
-function flatMapComponents (
- matched,
- fn
-) {
- return flatten(matched.map(function (m) {
- return Object.keys(m.components).map(function (key) { return fn(
- m.components[key],
- m.instances[key],
- m, key
- ); })
- }))
-}
+ // also regiseter instance in prepatch hook
+ // in case the same component instance is reused across different routes
+ ;(data.hook || (data.hook = {})).prepatch = function (_, vnode) {
+ matched.instances[name] = vnode.componentInstance;
+ };
-function flatten (arr) {
- return Array.prototype.concat.apply([], arr)
-}
+ // resolve props
+ data.props = resolveProps(route, matched.props && matched.props[name]);
-// in Webpack 2, require.ensure now also returns a Promise
-// so the resolve/reject functions may get called an extra time
-// if the user uses an arrow function shorthand that happens to
-// return that Promise.
-function once (fn) {
- var called = false;
- return function () {
- var args = [], len = arguments.length;
- while ( len-- ) args[ len ] = arguments[ len ];
+ return h(component, data, children)
+ }
+};
- if (called) { return }
- called = true;
- return fn.apply(this, args)
+function resolveProps (route, config) {
+ switch (typeof config) {
+ case 'undefined':
+ return
+ case 'object':
+ return config
+ case 'function':
+ return config(route)
+ case 'boolean':
+ return config ? route.params : undefined
+ default:
+ if (true) {
+ warn(
+ false,
+ "props in \"" + (route.path) + "\" is a " + (typeof config) + ", " +
+ "expecting an object, function or boolean."
+ );
+ }
}
}
/* */
-var History = function History (router, base) {
- this.router = router;
- this.base = normalizeBase(base);
- // start with a route object that stands for "nowhere"
- this.current = START;
- this.pending = null;
- this.ready = false;
- this.readyCbs = [];
- this.readyErrorCbs = [];
- this.errorCbs = [];
-};
+var encodeReserveRE = /[!'()*]/g;
+var encodeReserveReplacer = function (c) { return '%' + c.charCodeAt(0).toString(16); };
+var commaRE = /%2C/g;
-History.prototype.listen = function listen (cb) {
- this.cb = cb;
-};
+// fixed encodeURIComponent which is more conformant to RFC3986:
+// - escapes [!'()*]
+// - preserve commas
+var encode = function (str) { return encodeURIComponent(str)
+ .replace(encodeReserveRE, encodeReserveReplacer)
+ .replace(commaRE, ','); };
-History.prototype.onReady = function onReady (cb, errorCb) {
- if (this.ready) {
- cb();
- } else {
- this.readyCbs.push(cb);
- if (errorCb) {
- this.readyErrorCbs.push(errorCb);
- }
+var decode = decodeURIComponent;
+
+function resolveQuery (
+ query,
+ extraQuery,
+ _parseQuery
+) {
+ if ( extraQuery === void 0 ) extraQuery = {};
+
+ var parse = _parseQuery || parseQuery;
+ var parsedQuery;
+ try {
+ parsedQuery = parse(query || '');
+ } catch (e) {
+ "development" !== 'production' && warn(false, e.message);
+ parsedQuery = {};
}
-};
+ for (var key in extraQuery) {
+ var val = extraQuery[key];
+ parsedQuery[key] = Array.isArray(val) ? val.slice() : val;
+ }
+ return parsedQuery
+}
-History.prototype.onError = function onError (errorCb) {
- this.errorCbs.push(errorCb);
-};
+function parseQuery (query) {
+ var res = {};
-History.prototype.transitionTo = function transitionTo (location, onComplete, onAbort) {
- var this$1 = this;
+ query = query.trim().replace(/^(\?|#|&)/, '');
- var route = this.router.match(location, this.current);
- this.confirmTransition(route, function () {
- this$1.updateRoute(route);
- onComplete && onComplete(route);
- this$1.ensureURL();
+ if (!query) {
+ return res
+ }
- // fire ready cbs once
- if (!this$1.ready) {
- this$1.ready = true;
- this$1.readyCbs.forEach(function (cb) { cb(route); });
- }
- }, function (err) {
- if (onAbort) {
- onAbort(err);
- }
- if (err && !this$1.ready) {
- this$1.ready = true;
- this$1.readyErrorCbs.forEach(function (cb) { cb(err); });
+ query.split('&').forEach(function (param) {
+ var parts = param.replace(/\+/g, ' ').split('=');
+ var key = decode(parts.shift());
+ var val = parts.length > 0
+ ? decode(parts.join('='))
+ : null;
+
+ if (res[key] === undefined) {
+ res[key] = val;
+ } else if (Array.isArray(res[key])) {
+ res[key].push(val);
+ } else {
+ res[key] = [res[key], val];
}
});
-};
-
-History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
- var this$1 = this;
- var current = this.current;
- var abort = function (err) {
- if (isError(err)) {
- if (this$1.errorCbs.length) {
- this$1.errorCbs.forEach(function (cb) { cb(err); });
- } else {
- warn(false, 'uncaught error during route navigation:');
- console.error(err);
- }
- }
- onAbort && onAbort(err);
- };
- if (
- isSameRoute(route, current) &&
- // in the case the route map has been dynamically appended to
- route.matched.length === current.matched.length
- ) {
- this.ensureURL();
- return abort()
- }
+ return res
+}
- var ref = resolveQueue(this.current.matched, route.matched);
- var updated = ref.updated;
- var deactivated = ref.deactivated;
- var activated = ref.activated;
+function stringifyQuery (obj) {
+ var res = obj ? Object.keys(obj).map(function (key) {
+ var val = obj[key];
- var queue = [].concat(
- // in-component leave guards
- extractLeaveGuards(deactivated),
- // global before hooks
- this.router.beforeHooks,
- // in-component update hooks
- extractUpdateHooks(updated),
- // in-config enter guards
- activated.map(function (m) { return m.beforeEnter; }),
- // async components
- resolveAsyncComponents(activated)
- );
+ if (val === undefined) {
+ return ''
+ }
- this.pending = route;
- var iterator = function (hook, next) {
- if (this$1.pending !== route) {
- return abort()
+ if (val === null) {
+ return encode(key)
}
- try {
- hook(route, current, function (to) {
- if (to === false || isError(to)) {
- // next(false) -> abort navigation, ensure current URL
- this$1.ensureURL(true);
- abort(to);
- } else if (
- typeof to === 'string' ||
- (typeof to === 'object' && (
- typeof to.path === 'string' ||
- typeof to.name === 'string'
- ))
- ) {
- // next('/') or next({ path: '/' }) -> redirect
- abort();
- if (typeof to === 'object' && to.replace) {
- this$1.replace(to);
- } else {
- this$1.push(to);
- }
+
+ if (Array.isArray(val)) {
+ var result = [];
+ val.forEach(function (val2) {
+ if (val2 === undefined) {
+ return
+ }
+ if (val2 === null) {
+ result.push(encode(key));
} else {
- // confirm transition and pass on the value
- next(to);
+ result.push(encode(key) + '=' + encode(val2));
}
});
- } catch (e) {
- abort(e);
+ return result.join('&')
}
- };
- runQueue(queue, iterator, function () {
- var postEnterCbs = [];
- var isValid = function () { return this$1.current === route; };
- // wait until async components are resolved before
- // extracting in-component enter guards
- var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
- var queue = enterGuards.concat(this$1.router.resolveHooks);
- runQueue(queue, iterator, function () {
- if (this$1.pending !== route) {
- return abort()
- }
- this$1.pending = null;
- onComplete(route);
- if (this$1.router.app) {
- this$1.router.app.$nextTick(function () {
- postEnterCbs.forEach(function (cb) { cb(); });
- });
- }
- });
- });
-};
+ return encode(key) + '=' + encode(val)
+ }).filter(function (x) { return x.length > 0; }).join('&') : null;
+ return res ? ("?" + res) : ''
+}
-History.prototype.updateRoute = function updateRoute (route) {
- var prev = this.current;
- this.current = route;
- this.cb && this.cb(route);
- this.router.afterHooks.forEach(function (hook) {
- hook && hook(route, prev);
- });
-};
+/* */
-function normalizeBase (base) {
- if (!base) {
- if (inBrowser) {
- // respect tag
- var baseEl = document.querySelector('base');
- base = (baseEl && baseEl.getAttribute('href')) || '/';
- // strip full URL origin
- base = base.replace(/^https?:\/\/[^\/]+/, '');
- } else {
- base = '/';
- }
- }
- // make sure there's the starting slash
- if (base.charAt(0) !== '/') {
- base = '/' + base;
- }
- // remove trailing slash
- return base.replace(/\/$/, '')
-}
-function resolveQueue (
- current,
- next
+var trailingSlashRE = /\/?$/;
+
+function createRoute (
+ record,
+ location,
+ redirectedFrom,
+ router
) {
- var i;
- var max = Math.max(current.length, next.length);
- for (i = 0; i < max; i++) {
- if (current[i] !== next[i]) {
- break
- }
- }
- return {
- updated: next.slice(0, i),
- activated: next.slice(i),
- deactivated: current.slice(i)
+ var stringifyQuery$$1 = router && router.options.stringifyQuery;
+ var route = {
+ name: location.name || (record && record.name),
+ meta: (record && record.meta) || {},
+ path: location.path || '/',
+ hash: location.hash || '',
+ query: location.query || {},
+ params: location.params || {},
+ fullPath: getFullPath(location, stringifyQuery$$1),
+ matched: record ? formatMatch(record) : []
+ };
+ if (redirectedFrom) {
+ route.redirectedFrom = getFullPath(redirectedFrom, stringifyQuery$$1);
}
+ return Object.freeze(route)
}
-function extractGuards (
- records,
- name,
- bind,
- reverse
-) {
- var guards = flatMapComponents(records, function (def, instance, match, key) {
- var guard = extractGuard(def, name);
- if (guard) {
- return Array.isArray(guard)
- ? guard.map(function (guard) { return bind(guard, instance, match, key); })
- : bind(guard, instance, match, key)
- }
- });
- return flatten(reverse ? guards.reverse() : guards)
-}
+// the starting route that represents the initial state
+var START = createRoute(null, {
+ path: '/'
+});
-function extractGuard (
- def,
- key
-) {
- if (typeof def !== 'function') {
- // extend now so that global mixins are applied.
- def = _Vue.extend(def);
+function formatMatch (record) {
+ var res = [];
+ while (record) {
+ res.unshift(record);
+ record = record.parent;
}
- return def.options[key]
+ return res
}
-function extractLeaveGuards (deactivated) {
- return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
-}
+function getFullPath (
+ ref,
+ _stringifyQuery
+) {
+ var path = ref.path;
+ var query = ref.query; if ( query === void 0 ) query = {};
+ var hash = ref.hash; if ( hash === void 0 ) hash = '';
-function extractUpdateHooks (updated) {
- return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
+ var stringify = _stringifyQuery || stringifyQuery;
+ return (path || '/') + stringify(query) + hash
}
-function bindGuard (guard, instance) {
- if (instance) {
- return function boundRouteGuard () {
- return guard.apply(instance, arguments)
- }
+function isSameRoute (a, b) {
+ if (b === START) {
+ return a === b
+ } else if (!b) {
+ return false
+ } else if (a.path && b.path) {
+ return (
+ a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
+ a.hash === b.hash &&
+ isObjectEqual(a.query, b.query)
+ )
+ } else if (a.name && b.name) {
+ return (
+ a.name === b.name &&
+ a.hash === b.hash &&
+ isObjectEqual(a.query, b.query) &&
+ isObjectEqual(a.params, b.params)
+ )
+ } else {
+ return false
}
}
-function extractEnterGuards (
- activated,
- cbs,
- isValid
-) {
- return extractGuards(activated, 'beforeRouteEnter', function (guard, _, match, key) {
- return bindEnterGuard(guard, match, key, cbs, isValid)
- })
-}
+function isObjectEqual (a, b) {
+ if ( a === void 0 ) a = {};
+ if ( b === void 0 ) b = {};
-function bindEnterGuard (
- guard,
- match,
- key,
- cbs,
- isValid
-) {
- return function routeEnterGuard (to, from, next) {
- return guard(to, from, function (cb) {
- next(cb);
- if (typeof cb === 'function') {
- cbs.push(function () {
- // #750
- // if a router-view is wrapped with an out-in transition,
- // the instance may not have been registered at this time.
- // we will need to poll for registration until current route
- // is no longer valid.
- poll(cb, match.instances, key, isValid);
- });
- }
- })
+ var aKeys = Object.keys(a);
+ var bKeys = Object.keys(b);
+ if (aKeys.length !== bKeys.length) {
+ return false
}
+ return aKeys.every(function (key) {
+ var aVal = a[key];
+ var bVal = b[key];
+ // check nested equality
+ if (typeof aVal === 'object' && typeof bVal === 'object') {
+ return isObjectEqual(aVal, bVal)
+ }
+ return String(aVal) === String(bVal)
+ })
}
-function poll (
- cb, // somehow flow cannot infer this is a function
- instances,
- key,
- isValid
-) {
- if (instances[key]) {
- cb(instances[key]);
- } else if (isValid()) {
- setTimeout(function () {
- poll(cb, instances, key, isValid);
- }, 16);
+function isIncludedRoute (current, target) {
+ return (
+ current.path.replace(trailingSlashRE, '/').indexOf(
+ target.path.replace(trailingSlashRE, '/')
+ ) === 0 &&
+ (!target.hash || current.hash === target.hash) &&
+ queryIncludes(current.query, target.query)
+ )
+}
+
+function queryIncludes (current, target) {
+ for (var key in target) {
+ if (!(key in current)) {
+ return false
+ }
}
+ return true
}
/* */
+// work around weird flow bug
+var toTypes = [String, Object];
+var eventTypes = [String, Array];
-var HTML5History = (function (History$$1) {
- function HTML5History (router, base) {
+var Link = {
+ name: 'router-link',
+ props: {
+ to: {
+ type: toTypes,
+ required: true
+ },
+ tag: {
+ type: String,
+ default: 'a'
+ },
+ exact: Boolean,
+ append: Boolean,
+ replace: Boolean,
+ activeClass: String,
+ exactActiveClass: String,
+ event: {
+ type: eventTypes,
+ default: 'click'
+ }
+ },
+ render: function render (h) {
var this$1 = this;
- History$$1.call(this, router, base);
+ var router = this.$router;
+ var current = this.$route;
+ var ref = router.resolve(this.to, current, this.append);
+ var location = ref.location;
+ var route = ref.route;
+ var href = ref.href;
- var expectScroll = router.options.scrollBehavior;
+ var classes = {};
+ var globalActiveClass = router.options.linkActiveClass;
+ var globalExactActiveClass = router.options.linkExactActiveClass;
+ // Support global empty active class
+ var activeClassFallback = globalActiveClass == null
+ ? 'router-link-active'
+ : globalActiveClass;
+ var exactActiveClassFallback = globalExactActiveClass == null
+ ? 'router-link-exact-active'
+ : globalExactActiveClass;
+ var activeClass = this.activeClass == null
+ ? activeClassFallback
+ : this.activeClass;
+ var exactActiveClass = this.exactActiveClass == null
+ ? exactActiveClassFallback
+ : this.exactActiveClass;
+ var compareTarget = location.path
+ ? createRoute(null, location, null, router)
+ : route;
- if (expectScroll) {
- setupScroll();
- }
+ classes[exactActiveClass] = isSameRoute(current, compareTarget);
+ classes[activeClass] = this.exact
+ ? classes[exactActiveClass]
+ : isIncludedRoute(current, compareTarget);
- window.addEventListener('popstate', function (e) {
- var current = this$1.current;
- this$1.transitionTo(getLocation(this$1.base), function (route) {
- if (expectScroll) {
- handleScroll(router, route, current, true);
+ var handler = function (e) {
+ if (guardEvent(e)) {
+ if (this$1.replace) {
+ router.replace(location);
+ } else {
+ router.push(location);
}
- });
- });
- }
-
- if ( History$$1 ) HTML5History.__proto__ = History$$1;
- HTML5History.prototype = Object.create( History$$1 && History$$1.prototype );
- HTML5History.prototype.constructor = HTML5History;
-
- HTML5History.prototype.go = function go (n) {
- window.history.go(n);
- };
-
- HTML5History.prototype.push = function push (location, onComplete, onAbort) {
- var this$1 = this;
-
- var ref = this;
- var fromRoute = ref.current;
- this.transitionTo(location, function (route) {
- pushState(cleanPath(this$1.base + route.fullPath));
- handleScroll(this$1.router, route, fromRoute, false);
- onComplete && onComplete(route);
- }, onAbort);
- };
+ }
+ };
- HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
- var this$1 = this;
+ var on = { click: guardEvent };
+ if (Array.isArray(this.event)) {
+ this.event.forEach(function (e) { on[e] = handler; });
+ } else {
+ on[this.event] = handler;
+ }
- var ref = this;
- var fromRoute = ref.current;
- this.transitionTo(location, function (route) {
- replaceState(cleanPath(this$1.base + route.fullPath));
- handleScroll(this$1.router, route, fromRoute, false);
- onComplete && onComplete(route);
- }, onAbort);
- };
+ var data = {
+ class: classes
+ };
- HTML5History.prototype.ensureURL = function ensureURL (push) {
- if (getLocation(this.base) !== this.current.fullPath) {
- var current = cleanPath(this.base + this.current.fullPath);
- push ? pushState(current) : replaceState(current);
+ if (this.tag === 'a') {
+ data.on = on;
+ data.attrs = { href: href };
+ } else {
+ // find the first child and apply listener and href
+ var a = findAnchor(this.$slots.default);
+ if (a) {
+ // in case the is a static node
+ a.isStatic = false;
+ var extend = _Vue.util.extend;
+ var aData = a.data = extend({}, a.data);
+ aData.on = on;
+ var aAttrs = a.data.attrs = extend({}, a.data.attrs);
+ aAttrs.href = href;
+ } else {
+ // doesn't have child, apply listener to self
+ data.on = on;
+ }
}
- };
- HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
- return getLocation(this.base)
- };
-
- return HTML5History;
-}(History));
+ return h(this.tag, data, this.$slots.default)
+ }
+};
-function getLocation (base) {
- var path = window.location.pathname;
- if (base && path.indexOf(base) === 0) {
- path = path.slice(base.length);
+function guardEvent (e) {
+ // don't redirect with control keys
+ if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) { return }
+ // don't redirect when preventDefault called
+ if (e.defaultPrevented) { return }
+ // don't redirect on right click
+ if (e.button !== undefined && e.button !== 0) { return }
+ // don't redirect if `target="_blank"`
+ if (e.currentTarget && e.currentTarget.getAttribute) {
+ var target = e.currentTarget.getAttribute('target');
+ if (/\b_blank\b/i.test(target)) { return }
}
- return (path || '/') + window.location.search + window.location.hash
+ // this may be a Weex event which doesn't have this method
+ if (e.preventDefault) {
+ e.preventDefault();
+ }
+ return true
}
-/* */
-
-
-var HashHistory = (function (History$$1) {
- function HashHistory (router, base, fallback) {
- History$$1.call(this, router, base);
- // check history fallback deeplinking
- if (fallback && checkFallback(this.base)) {
- return
+function findAnchor (children) {
+ if (children) {
+ var child;
+ for (var i = 0; i < children.length; i++) {
+ child = children[i];
+ if (child.tag === 'a') {
+ return child
+ }
+ if (child.children && (child = findAnchor(child.children))) {
+ return child
+ }
}
- ensureSlash();
}
+}
- if ( History$$1 ) HashHistory.__proto__ = History$$1;
- HashHistory.prototype = Object.create( History$$1 && History$$1.prototype );
- HashHistory.prototype.constructor = HashHistory;
-
- // this is delayed until the app mounts
- // to avoid the hashchange listener being fired too early
- HashHistory.prototype.setupListeners = function setupListeners () {
- var this$1 = this;
-
- window.addEventListener('hashchange', function () {
- if (!ensureSlash()) {
- return
- }
- this$1.transitionTo(getHash(), function (route) {
- replaceHash(route.fullPath);
- });
- });
- };
+var _Vue;
- HashHistory.prototype.push = function push (location, onComplete, onAbort) {
- this.transitionTo(location, function (route) {
- pushHash(route.fullPath);
- onComplete && onComplete(route);
- }, onAbort);
- };
+function install (Vue) {
+ if (install.installed) { return }
+ install.installed = true;
- HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
- this.transitionTo(location, function (route) {
- replaceHash(route.fullPath);
- onComplete && onComplete(route);
- }, onAbort);
- };
+ _Vue = Vue;
- HashHistory.prototype.go = function go (n) {
- window.history.go(n);
- };
+ var isDef = function (v) { return v !== undefined; };
- HashHistory.prototype.ensureURL = function ensureURL (push) {
- var current = this.current.fullPath;
- if (getHash() !== current) {
- push ? pushHash(current) : replaceHash(current);
+ var registerInstance = function (vm, callVal) {
+ var i = vm.$options._parentVnode;
+ if (isDef(i) && isDef(i = i.data) && isDef(i = i.registerRouteInstance)) {
+ i(vm, callVal);
}
};
- HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
- return getHash()
- };
+ Vue.mixin({
+ beforeCreate: function beforeCreate () {
+ if (isDef(this.$options.router)) {
+ this._routerRoot = this;
+ this._router = this.$options.router;
+ this._router.init(this);
+ Vue.util.defineReactive(this, '_route', this._router.history.current);
+ } else {
+ this._routerRoot = (this.$parent && this.$parent._routerRoot) || this;
+ }
+ registerInstance(this, this);
+ },
+ destroyed: function destroyed () {
+ registerInstance(this);
+ }
+ });
- return HashHistory;
-}(History));
+ Object.defineProperty(Vue.prototype, '$router', {
+ get: function get () { return this._routerRoot._router }
+ });
-function checkFallback (base) {
- var location = getLocation(base);
- if (!/^\/#/.test(location)) {
- window.location.replace(
- cleanPath(base + '/#' + location)
- );
- return true
- }
-}
+ Object.defineProperty(Vue.prototype, '$route', {
+ get: function get () { return this._routerRoot._route }
+ });
-function ensureSlash () {
- var path = getHash();
- if (path.charAt(0) === '/') {
- return true
- }
- replaceHash('/' + path);
- return false
-}
+ Vue.component('router-view', View);
+ Vue.component('router-link', Link);
-function getHash () {
- // We can't use window.location.hash here because it's not
- // consistent across browsers - Firefox will pre-decode it!
- var href = window.location.href;
- var index = href.indexOf('#');
- return index === -1 ? '' : href.slice(index + 1)
+ var strats = Vue.config.optionMergeStrategies;
+ // use the same hook merging strategy for route hooks
+ strats.beforeRouteEnter = strats.beforeRouteLeave = strats.beforeRouteUpdate = strats.created;
}
-function pushHash (path) {
- window.location.hash = path;
-}
+/* */
-function replaceHash (path) {
- var href = window.location.href;
- var i = href.indexOf('#');
- var base = i >= 0 ? href.slice(0, i) : href;
- window.location.replace((base + "#" + path));
-}
+var inBrowser = typeof window !== 'undefined';
/* */
-
-var AbstractHistory = (function (History$$1) {
- function AbstractHistory (router, base) {
- History$$1.call(this, router, base);
- this.stack = [];
- this.index = -1;
+function resolvePath (
+ relative,
+ base,
+ append
+) {
+ var firstChar = relative.charAt(0);
+ if (firstChar === '/') {
+ return relative
}
- if ( History$$1 ) AbstractHistory.__proto__ = History$$1;
- AbstractHistory.prototype = Object.create( History$$1 && History$$1.prototype );
- AbstractHistory.prototype.constructor = AbstractHistory;
-
- AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
- var this$1 = this;
-
- this.transitionTo(location, function (route) {
- this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
- this$1.index++;
- onComplete && onComplete(route);
- }, onAbort);
- };
-
- AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
- var this$1 = this;
+ if (firstChar === '?' || firstChar === '#') {
+ return base + relative
+ }
- this.transitionTo(location, function (route) {
- this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
- onComplete && onComplete(route);
- }, onAbort);
- };
+ var stack = base.split('/');
- AbstractHistory.prototype.go = function go (n) {
- var this$1 = this;
+ // remove trailing segment if:
+ // - not appending
+ // - appending to trailing slash (last segment is empty)
+ if (!append || !stack[stack.length - 1]) {
+ stack.pop();
+ }
- var targetIndex = this.index + n;
- if (targetIndex < 0 || targetIndex >= this.stack.length) {
- return
+ // resolve relative path
+ var segments = relative.replace(/^\//, '').split('/');
+ for (var i = 0; i < segments.length; i++) {
+ var segment = segments[i];
+ if (segment === '..') {
+ stack.pop();
+ } else if (segment !== '.') {
+ stack.push(segment);
}
- var route = this.stack[targetIndex];
- this.confirmTransition(route, function () {
- this$1.index = targetIndex;
- this$1.updateRoute(route);
- });
- };
-
- AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
- var current = this.stack[this.stack.length - 1];
- return current ? current.fullPath : '/'
- };
-
- AbstractHistory.prototype.ensureURL = function ensureURL () {
- // noop
- };
-
- return AbstractHistory;
-}(History));
+ }
-/* */
+ // ensure leading slash
+ if (stack[0] !== '') {
+ stack.unshift('');
+ }
-var VueRouter = function VueRouter (options) {
- if ( options === void 0 ) options = {};
+ return stack.join('/')
+}
- this.app = null;
- this.apps = [];
- this.options = options;
- this.beforeHooks = [];
- this.resolveHooks = [];
- this.afterHooks = [];
- this.matcher = createMatcher(options.routes || [], this);
+function parsePath (path) {
+ var hash = '';
+ var query = '';
- var mode = options.mode || 'hash';
- this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
- if (this.fallback) {
- mode = 'hash';
+ var hashIndex = path.indexOf('#');
+ if (hashIndex >= 0) {
+ hash = path.slice(hashIndex);
+ path = path.slice(0, hashIndex);
}
- if (!inBrowser) {
- mode = 'abstract';
+
+ var queryIndex = path.indexOf('?');
+ if (queryIndex >= 0) {
+ query = path.slice(queryIndex + 1);
+ path = path.slice(0, queryIndex);
}
- this.mode = mode;
- switch (mode) {
- case 'history':
- this.history = new HTML5History(this, options.base);
- break
- case 'hash':
- this.history = new HashHistory(this, options.base, this.fallback);
- break
- case 'abstract':
- this.history = new AbstractHistory(this, options.base);
- break
- default:
- if (true) {
- assert(false, ("invalid mode: " + mode));
- }
+ return {
+ path: path,
+ query: query,
+ hash: hash
}
-};
+}
-var prototypeAccessors = { currentRoute: {} };
+function cleanPath (path) {
+ return path.replace(/\/\//g, '/')
+}
-VueRouter.prototype.match = function match (
- raw,
- current,
- redirectedFrom
-) {
- return this.matcher.match(raw, current, redirectedFrom)
+var index$1 = Array.isArray || function (arr) {
+ return Object.prototype.toString.call(arr) == '[object Array]';
};
-prototypeAccessors.currentRoute.get = function () {
- return this.history && this.history.current
-};
+/**
+ * Expose `pathToRegexp`.
+ */
+var index = pathToRegexp;
+var parse_1 = parse;
+var compile_1 = compile;
+var tokensToFunction_1 = tokensToFunction;
+var tokensToRegExp_1 = tokensToRegExp;
-VueRouter.prototype.init = function init (app /* Vue component instance */) {
- var this$1 = this;
+/**
+ * The main path matching regexp utility.
+ *
+ * @type {RegExp}
+ */
+var PATH_REGEXP = new RegExp([
+ // Match escaped characters that would otherwise appear in future matches.
+ // This allows the user to escape special characters that won't transform.
+ '(\\\\.)',
+ // Match Express-style parameters and un-named parameters with a prefix
+ // and optional suffixes. Matches appear as:
+ //
+ // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
+ // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
+ // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
+ '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
+].join('|'), 'g');
- "development" !== 'production' && assert(
- install.installed,
- "not installed. Make sure to call `Vue.use(VueRouter)` " +
- "before creating root instance."
- );
+/**
+ * Parse a string for the raw tokens.
+ *
+ * @param {string} str
+ * @param {Object=} options
+ * @return {!Array}
+ */
+function parse (str, options) {
+ var tokens = [];
+ var key = 0;
+ var index = 0;
+ var path = '';
+ var defaultDelimiter = options && options.delimiter || '/';
+ var res;
- this.apps.push(app);
+ while ((res = PATH_REGEXP.exec(str)) != null) {
+ var m = res[0];
+ var escaped = res[1];
+ var offset = res.index;
+ path += str.slice(index, offset);
+ index = offset + m.length;
- // main app already initialized.
- if (this.app) {
- return
- }
+ // Ignore already escaped sequences.
+ if (escaped) {
+ path += escaped[1];
+ continue
+ }
- this.app = app;
+ var next = str[index];
+ var prefix = res[2];
+ var name = res[3];
+ var capture = res[4];
+ var group = res[5];
+ var modifier = res[6];
+ var asterisk = res[7];
- var history = this.history;
+ // Push the current path onto the tokens.
+ if (path) {
+ tokens.push(path);
+ path = '';
+ }
- if (history instanceof HTML5History) {
- history.transitionTo(history.getCurrentLocation());
- } else if (history instanceof HashHistory) {
- var setupHashListener = function () {
- history.setupListeners();
- };
- history.transitionTo(
- history.getCurrentLocation(),
- setupHashListener,
- setupHashListener
- );
- }
+ var partial = prefix != null && next != null && next !== prefix;
+ var repeat = modifier === '+' || modifier === '*';
+ var optional = modifier === '?' || modifier === '*';
+ var delimiter = res[2] || defaultDelimiter;
+ var pattern = capture || group;
- history.listen(function (route) {
- this$1.apps.forEach(function (app) {
- app._route = route;
+ tokens.push({
+ name: name || key++,
+ prefix: prefix || '',
+ delimiter: delimiter,
+ optional: optional,
+ repeat: repeat,
+ partial: partial,
+ asterisk: !!asterisk,
+ pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
});
- });
-};
-
-VueRouter.prototype.beforeEach = function beforeEach (fn) {
- return registerHook(this.beforeHooks, fn)
-};
-
-VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
- return registerHook(this.resolveHooks, fn)
-};
-
-VueRouter.prototype.afterEach = function afterEach (fn) {
- return registerHook(this.afterHooks, fn)
-};
-
-VueRouter.prototype.onReady = function onReady (cb, errorCb) {
- this.history.onReady(cb, errorCb);
-};
-
-VueRouter.prototype.onError = function onError (errorCb) {
- this.history.onError(errorCb);
-};
-
-VueRouter.prototype.push = function push (location, onComplete, onAbort) {
- this.history.push(location, onComplete, onAbort);
-};
-
-VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
- this.history.replace(location, onComplete, onAbort);
-};
-
-VueRouter.prototype.go = function go (n) {
- this.history.go(n);
-};
-
-VueRouter.prototype.back = function back () {
- this.go(-1);
-};
-
-VueRouter.prototype.forward = function forward () {
- this.go(1);
-};
-
-VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
- var route = to
- ? to.matched
- ? to
- : this.resolve(to).route
- : this.currentRoute;
- if (!route) {
- return []
}
- return [].concat.apply([], route.matched.map(function (m) {
- return Object.keys(m.components).map(function (key) {
- return m.components[key]
- })
- }))
-};
-VueRouter.prototype.resolve = function resolve (
- to,
- current,
- append
-) {
- var location = normalizeLocation(
- to,
- current || this.history.current,
- append,
- this
- );
- var route = this.match(location, current);
- var fullPath = route.redirectedFrom || route.fullPath;
- var base = this.history.base;
- var href = createHref(base, fullPath, this.mode);
- return {
- location: location,
- route: route,
- href: href,
- // for backwards compat
- normalizedTo: location,
- resolved: route
+ // Match any characters still remaining.
+ if (index < str.length) {
+ path += str.substr(index);
}
-};
-VueRouter.prototype.addRoutes = function addRoutes (routes) {
- this.matcher.addRoutes(routes);
- if (this.history.current !== START) {
- this.history.transitionTo(this.history.getCurrentLocation());
+ // If the path exists, push it onto the end.
+ if (path) {
+ tokens.push(path);
}
-};
-Object.defineProperties( VueRouter.prototype, prototypeAccessors );
-
-function registerHook (list, fn) {
- list.push(fn);
- return function () {
- var i = list.indexOf(fn);
- if (i > -1) { list.splice(i, 1); }
- }
+ return tokens
}
-function createHref (base, fullPath, mode) {
- var path = mode === 'hash' ? '#' + fullPath : fullPath;
- return base ? cleanPath(base + '/' + path) : path
+/**
+ * Compile a string to a template function for the path.
+ *
+ * @param {string} str
+ * @param {Object=} options
+ * @return {!function(Object=, Object=)}
+ */
+function compile (str, options) {
+ return tokensToFunction(parse(str, options))
}
-VueRouter.install = install;
-VueRouter.version = '2.7.0';
-
-if (inBrowser && window.Vue) {
- window.Vue.use(VueRouter);
+/**
+ * Prettier encoding of URI path segments.
+ *
+ * @param {string}
+ * @return {string}
+ */
+function encodeURIComponentPretty (str) {
+ return encodeURI(str).replace(/[\/?#]/g, function (c) {
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
+ })
}
-/* harmony default export */ __webpack_exports__["default"] = (VueRouter);
-
+/**
+ * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
+ *
+ * @param {string}
+ * @return {string}
+ */
+function encodeAsterisk (str) {
+ return encodeURI(str).replace(/[?#]/g, function (c) {
+ return '%' + c.charCodeAt(0).toString(16).toUpperCase()
+ })
+}
-/***/ }),
-/* 40 */
-/***/ (function(module, exports, __webpack_require__) {
+/**
+ * Expose a method for transforming tokens into the path function.
+ */
+function tokensToFunction (tokens) {
+ // Compile all the tokens into regexps.
+ var matches = new Array(tokens.length);
-module.exports =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
+ // Compile all the patterns before compilation.
+ for (var i = 0; i < tokens.length; i++) {
+ if (typeof tokens[i] === 'object') {
+ matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$');
+ }
+ }
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
+ return function (obj, opts) {
+ var path = '';
+ var data = obj || {};
+ var options = opts || {};
+ var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent;
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i];
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
+ if (typeof token === 'string') {
+ path += token;
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+ continue
+ }
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
+ var value = data[token.name];
+ var segment;
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
+ if (value == null) {
+ if (token.optional) {
+ // Prepend partial segment prefixes.
+ if (token.partial) {
+ path += token.prefix;
+ }
+ continue
+ } else {
+ throw new TypeError('Expected "' + token.name + '" to be defined')
+ }
+ }
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+ if (index$1(value)) {
+ if (!token.repeat) {
+ throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
+ }
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
+ if (value.length === 0) {
+ if (token.optional) {
+ continue
+ } else {
+ throw new TypeError('Expected "' + token.name + '" to not be empty')
+ }
+ }
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
+ for (var j = 0; j < value.length; j++) {
+ segment = encode(value[j]);
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
+ if (!matches[i].test(segment)) {
+ throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
+ }
- module.exports = __webpack_require__(1);
+ path += (j === 0 ? token.prefix : token.delimiter) + segment;
+ }
+ continue
+ }
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
+ segment = token.asterisk ? encodeAsterisk(value) : encode(value);
- 'use strict';
+ if (!matches[i].test(segment)) {
+ throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
+ }
- var _index = __webpack_require__(2);
+ path += token.prefix + segment;
+ }
- var _index2 = _interopRequireDefault(_index);
+ return path
+ }
+}
- var _index3 = __webpack_require__(11);
+/**
+ * Escape a regular expression string.
+ *
+ * @param {string} str
+ * @return {string}
+ */
+function escapeString (str) {
+ return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
+}
- var _index4 = _interopRequireDefault(_index3);
+/**
+ * Escape the capturing group by escaping special characters and meaning.
+ *
+ * @param {string} group
+ * @return {string}
+ */
+function escapeGroup (group) {
+ return group.replace(/([=!:$\/()])/g, '\\$1')
+}
- var _index5 = __webpack_require__(17);
+/**
+ * Attach the keys as a property of the regexp.
+ *
+ * @param {!RegExp} re
+ * @param {Array} keys
+ * @return {!RegExp}
+ */
+function attachKeys (re, keys) {
+ re.keys = keys;
+ return re
+}
- var _index6 = _interopRequireDefault(_index5);
+/**
+ * Get the flags for a regexp from the options.
+ *
+ * @param {Object} options
+ * @return {string}
+ */
+function flags (options) {
+ return options.sensitive ? '' : 'i'
+}
- var _index7 = __webpack_require__(28);
+/**
+ * Pull out keys from a regexp.
+ *
+ * @param {!RegExp} path
+ * @param {!Array} keys
+ * @return {!RegExp}
+ */
+function regexpToRegexp (path, keys) {
+ // Use a negative lookahead to match only capturing groups.
+ var groups = path.source.match(/\((?!\?)/g);
- var _index8 = _interopRequireDefault(_index7);
+ if (groups) {
+ for (var i = 0; i < groups.length; i++) {
+ keys.push({
+ name: i,
+ prefix: null,
+ delimiter: null,
+ optional: false,
+ repeat: false,
+ partial: false,
+ asterisk: false,
+ pattern: null
+ });
+ }
+ }
- var _index9 = __webpack_require__(33);
+ return attachKeys(path, keys)
+}
- var _index10 = _interopRequireDefault(_index9);
+/**
+ * Transform an array into a regexp.
+ *
+ * @param {!Array} path
+ * @param {Array} keys
+ * @param {!Object} options
+ * @return {!RegExp}
+ */
+function arrayToRegexp (path, keys, options) {
+ var parts = [];
- var _index11 = __webpack_require__(37);
+ for (var i = 0; i < path.length; i++) {
+ parts.push(pathToRegexp(path[i], keys, options).source);
+ }
- var _index12 = _interopRequireDefault(_index11);
+ var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
- var _index13 = __webpack_require__(41);
+ return attachKeys(regexp, keys)
+}
- var _index14 = _interopRequireDefault(_index13);
+/**
+ * Create a path regexp from string input.
+ *
+ * @param {string} path
+ * @param {!Array} keys
+ * @param {!Object} options
+ * @return {!RegExp}
+ */
+function stringToRegexp (path, keys, options) {
+ return tokensToRegExp(parse(path, options), keys, options)
+}
- var _index15 = __webpack_require__(46);
+/**
+ * Expose a function for taking tokens and returning a RegExp.
+ *
+ * @param {!Array} tokens
+ * @param {(Array|Object)=} keys
+ * @param {Object=} options
+ * @return {!RegExp}
+ */
+function tokensToRegExp (tokens, keys, options) {
+ if (!index$1(keys)) {
+ options = /** @type {!Object} */ (keys || options);
+ keys = [];
+ }
- var _index16 = _interopRequireDefault(_index15);
+ options = options || {};
- var _index17 = __webpack_require__(52);
+ var strict = options.strict;
+ var end = options.end !== false;
+ var route = '';
- var _index18 = _interopRequireDefault(_index17);
+ // Iterate over the tokens and create our regexp string.
+ for (var i = 0; i < tokens.length; i++) {
+ var token = tokens[i];
- var _index19 = __webpack_require__(56);
+ if (typeof token === 'string') {
+ route += escapeString(token);
+ } else {
+ var prefix = escapeString(token.prefix);
+ var capture = '(?:' + token.pattern + ')';
- var _index20 = _interopRequireDefault(_index19);
+ keys.push(token);
- var _index21 = __webpack_require__(60);
+ if (token.repeat) {
+ capture += '(?:' + prefix + capture + ')*';
+ }
- var _index22 = _interopRequireDefault(_index21);
+ if (token.optional) {
+ if (!token.partial) {
+ capture = '(?:' + prefix + '(' + capture + '))?';
+ } else {
+ capture = prefix + '(' + capture + ')?';
+ }
+ } else {
+ capture = prefix + '(' + capture + ')';
+ }
- var _index23 = __webpack_require__(66);
+ route += capture;
+ }
+ }
- var _index24 = _interopRequireDefault(_index23);
+ var delimiter = escapeString(options.delimiter || '/');
+ var endsWithDelimiter = route.slice(-delimiter.length) === delimiter;
- var _index25 = __webpack_require__(71);
-
- var _index26 = _interopRequireDefault(_index25);
+ // In non-strict mode we allow a slash at the end of match. If the path to
+ // match already ends with a slash, we remove it for consistency. The slash
+ // is valid at the end of a path match, not in the middle. This is important
+ // in non-ending mode, where "/test/" shouldn't match "/test//route".
+ if (!strict) {
+ route = (endsWithDelimiter ? route.slice(0, -delimiter.length) : route) + '(?:' + delimiter + '(?=$))?';
+ }
- var _index27 = __webpack_require__(75);
+ if (end) {
+ route += '$';
+ } else {
+ // In non-ending mode, we need the capturing groups to match as much as
+ // possible by using a positive lookahead to the end or next path segment.
+ route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
+ }
- var _index28 = _interopRequireDefault(_index27);
+ return attachKeys(new RegExp('^' + route, flags(options)), keys)
+}
- var _index29 = __webpack_require__(79);
+/**
+ * Normalize the given path string, returning a regular expression.
+ *
+ * An empty array can be passed in for the keys, which will hold the
+ * placeholder key descriptions. For example, using `/user/:id`, `keys` will
+ * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
+ *
+ * @param {(string|RegExp|Array)} path
+ * @param {(Array|Object)=} keys
+ * @param {Object=} options
+ * @return {!RegExp}
+ */
+function pathToRegexp (path, keys, options) {
+ if (!index$1(keys)) {
+ options = /** @type {!Object} */ (keys || options);
+ keys = [];
+ }
- var _index30 = _interopRequireDefault(_index29);
+ options = options || {};
- var _index31 = __webpack_require__(83);
+ if (path instanceof RegExp) {
+ return regexpToRegexp(path, /** @type {!Array} */ (keys))
+ }
- var _index32 = _interopRequireDefault(_index31);
+ if (index$1(path)) {
+ return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
+ }
- var _index33 = __webpack_require__(87);
+ return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
+}
- var _index34 = _interopRequireDefault(_index33);
+index.parse = parse_1;
+index.compile = compile_1;
+index.tokensToFunction = tokensToFunction_1;
+index.tokensToRegExp = tokensToRegExp_1;
- var _index35 = __webpack_require__(91);
+/* */
- var _index36 = _interopRequireDefault(_index35);
+var regexpCompileCache = Object.create(null);
- var _index37 = __webpack_require__(95);
+function fillParams (
+ path,
+ params,
+ routeMsg
+) {
+ try {
+ var filler =
+ regexpCompileCache[path] ||
+ (regexpCompileCache[path] = index.compile(path));
+ return filler(params || {}, { pretty: true })
+ } catch (e) {
+ if (true) {
+ warn(false, ("missing param for " + routeMsg + ": " + (e.message)));
+ }
+ return ''
+ }
+}
- var _index38 = _interopRequireDefault(_index37);
+/* */
- var _index39 = __webpack_require__(99);
+function createRouteMap (
+ routes,
+ oldPathList,
+ oldPathMap,
+ oldNameMap
+) {
+ // the path list is used to control path matching priority
+ var pathList = oldPathList || [];
+ var pathMap = oldPathMap || Object.create(null);
+ var nameMap = oldNameMap || Object.create(null);
- var _index40 = _interopRequireDefault(_index39);
+ routes.forEach(function (route) {
+ addRouteRecord(pathList, pathMap, nameMap, route);
+ });
- var _index41 = __webpack_require__(114);
+ // ensure wildcard routes are always at the end
+ for (var i = 0, l = pathList.length; i < l; i++) {
+ if (pathList[i] === '*') {
+ pathList.push(pathList.splice(i, 1)[0]);
+ l--;
+ i--;
+ }
+ }
- var _index42 = _interopRequireDefault(_index41);
+ return {
+ pathList: pathList,
+ pathMap: pathMap,
+ nameMap: nameMap
+ }
+}
- var _index43 = __webpack_require__(115);
+function addRouteRecord (
+ pathList,
+ pathMap,
+ nameMap,
+ route,
+ parent,
+ matchAs
+) {
+ var path = route.path;
+ var name = route.name;
+ if (true) {
+ assert(path != null, "\"path\" is required in a route configuration.");
+ assert(
+ typeof route.component !== 'string',
+ "route config \"component\" for path: " + (String(path || name)) + " cannot be a " +
+ "string id. Use an actual component instead."
+ );
+ }
- var _index44 = _interopRequireDefault(_index43);
+ var normalizedPath = normalizePath(path, parent);
+ var pathToRegexpOptions = route.pathToRegexpOptions || {};
- var _index45 = __webpack_require__(119);
+ if (typeof route.caseSensitive === 'boolean') {
+ pathToRegexpOptions.sensitive = route.caseSensitive;
+ }
- var _index46 = _interopRequireDefault(_index45);
+ var record = {
+ path: normalizedPath,
+ regex: compileRouteRegex(normalizedPath, pathToRegexpOptions),
+ components: route.components || { default: route.component },
+ instances: {},
+ name: name,
+ parent: parent,
+ matchAs: matchAs,
+ redirect: route.redirect,
+ beforeEnter: route.beforeEnter,
+ meta: route.meta || {},
+ props: route.props == null
+ ? {}
+ : route.components
+ ? route.props
+ : { default: route.props }
+ };
- var _index47 = __webpack_require__(123);
+ if (route.children) {
+ // Warn if route is named, does not redirect and has a default child route.
+ // If users navigate to this route by name, the default child will
+ // not be rendered (GH Issue #629)
+ if (true) {
+ if (route.name && !route.redirect && route.children.some(function (child) { return /^\/?$/.test(child.path); })) {
+ warn(
+ false,
+ "Named Route '" + (route.name) + "' has a default child route. " +
+ "When navigating to this named route (:to=\"{name: '" + (route.name) + "'\"), " +
+ "the default child route will not be rendered. Remove the name from " +
+ "this route and use the name of the default child route for named " +
+ "links instead."
+ );
+ }
+ }
+ route.children.forEach(function (child) {
+ var childMatchAs = matchAs
+ ? cleanPath((matchAs + "/" + (child.path)))
+ : undefined;
+ addRouteRecord(pathList, pathMap, nameMap, child, record, childMatchAs);
+ });
+ }
- var _index48 = _interopRequireDefault(_index47);
+ if (route.alias !== undefined) {
+ var aliases = Array.isArray(route.alias)
+ ? route.alias
+ : [route.alias];
- var _index49 = __webpack_require__(127);
+ aliases.forEach(function (alias) {
+ var aliasRoute = {
+ path: alias,
+ children: route.children
+ };
+ addRouteRecord(
+ pathList,
+ pathMap,
+ nameMap,
+ aliasRoute,
+ parent,
+ record.path || '/' // matchAs
+ );
+ });
+ }
- var _index50 = _interopRequireDefault(_index49);
+ if (!pathMap[record.path]) {
+ pathList.push(record.path);
+ pathMap[record.path] = record;
+ }
- var _index51 = __webpack_require__(147);
+ if (name) {
+ if (!nameMap[name]) {
+ nameMap[name] = record;
+ } else if ("development" !== 'production' && !matchAs) {
+ warn(
+ false,
+ "Duplicate named routes definition: " +
+ "{ name: \"" + name + "\", path: \"" + (record.path) + "\" }"
+ );
+ }
+ }
+}
- var _index52 = _interopRequireDefault(_index51);
+function compileRouteRegex (path, pathToRegexpOptions) {
+ var regex = index(path, [], pathToRegexpOptions);
+ if (true) {
+ var keys = {};
+ regex.keys.forEach(function (key) {
+ warn(!keys[key.name], ("Duplicate param keys in route with path: \"" + path + "\""));
+ keys[key.name] = true;
+ });
+ }
+ return regex
+}
- var _index53 = __webpack_require__(149);
+function normalizePath (path, parent) {
+ path = path.replace(/\/$/, '');
+ if (path[0] === '/') { return path }
+ if (parent == null) { return path }
+ return cleanPath(((parent.path) + "/" + path))
+}
- var _index54 = _interopRequireDefault(_index53);
+/* */
- var _index55 = __webpack_require__(177);
- var _index56 = _interopRequireDefault(_index55);
+function normalizeLocation (
+ raw,
+ current,
+ append,
+ router
+) {
+ var next = typeof raw === 'string' ? { path: raw } : raw;
+ // named target
+ if (next.name || next._normalized) {
+ return next
+ }
- var _index57 = __webpack_require__(182);
+ // relative params
+ if (!next.path && next.params && current) {
+ next = assign({}, next);
+ next._normalized = true;
+ var params = assign(assign({}, current.params), next.params);
+ if (current.name) {
+ next.name = current.name;
+ next.params = params;
+ } else if (current.matched.length) {
+ var rawPath = current.matched[current.matched.length - 1].path;
+ next.path = fillParams(rawPath, params, ("path " + (current.path)));
+ } else if (true) {
+ warn(false, "relative params navigation requires a current route.");
+ }
+ return next
+ }
- var _index58 = _interopRequireDefault(_index57);
+ var parsedPath = parsePath(next.path || '');
+ var basePath = (current && current.path) || '/';
+ var path = parsedPath.path
+ ? resolvePath(parsedPath.path, basePath, append || next.append)
+ : basePath;
- var _index59 = __webpack_require__(187);
+ var query = resolveQuery(
+ parsedPath.query,
+ next.query,
+ router && router.options.parseQuery
+ );
- var _index60 = _interopRequireDefault(_index59);
+ var hash = next.hash || parsedPath.hash;
+ if (hash && hash.charAt(0) !== '#') {
+ hash = "#" + hash;
+ }
- var _index61 = __webpack_require__(192);
+ return {
+ _normalized: true,
+ path: path,
+ query: query,
+ hash: hash
+ }
+}
- var _index62 = _interopRequireDefault(_index61);
+function assign (a, b) {
+ for (var key in b) {
+ a[key] = b[key];
+ }
+ return a
+}
- var _index63 = __webpack_require__(195);
+/* */
- var _index64 = _interopRequireDefault(_index63);
- var _index65 = __webpack_require__(200);
+function createMatcher (
+ routes,
+ router
+) {
+ var ref = createRouteMap(routes);
+ var pathList = ref.pathList;
+ var pathMap = ref.pathMap;
+ var nameMap = ref.nameMap;
- var _index66 = _interopRequireDefault(_index65);
+ function addRoutes (routes) {
+ createRouteMap(routes, pathList, pathMap, nameMap);
+ }
- var _index67 = __webpack_require__(204);
+ function match (
+ raw,
+ currentRoute,
+ redirectedFrom
+ ) {
+ var location = normalizeLocation(raw, currentRoute, false, router);
+ var name = location.name;
- var _index68 = _interopRequireDefault(_index67);
+ if (name) {
+ var record = nameMap[name];
+ if (true) {
+ warn(record, ("Route with name '" + name + "' does not exist"));
+ }
+ if (!record) { return _createRoute(null, location) }
+ var paramNames = record.regex.keys
+ .filter(function (key) { return !key.optional; })
+ .map(function (key) { return key.name; });
- var _index69 = __webpack_require__(208);
+ if (typeof location.params !== 'object') {
+ location.params = {};
+ }
- var _index70 = _interopRequireDefault(_index69);
+ if (currentRoute && typeof currentRoute.params === 'object') {
+ for (var key in currentRoute.params) {
+ if (!(key in location.params) && paramNames.indexOf(key) > -1) {
+ location.params[key] = currentRoute.params[key];
+ }
+ }
+ }
- var _index71 = __webpack_require__(212);
+ if (record) {
+ location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""));
+ return _createRoute(record, location, redirectedFrom)
+ }
+ } else if (location.path) {
+ location.params = {};
+ for (var i = 0; i < pathList.length; i++) {
+ var path = pathList[i];
+ var record$1 = pathMap[path];
+ if (matchRoute(record$1.regex, location.path, location.params)) {
+ return _createRoute(record$1, location, redirectedFrom)
+ }
+ }
+ }
+ // no match
+ return _createRoute(null, location)
+ }
- var _index72 = _interopRequireDefault(_index71);
+ function redirect (
+ record,
+ location
+ ) {
+ var originalRedirect = record.redirect;
+ var redirect = typeof originalRedirect === 'function'
+ ? originalRedirect(createRoute(record, location, null, router))
+ : originalRedirect;
- var _index73 = __webpack_require__(217);
+ if (typeof redirect === 'string') {
+ redirect = { path: redirect };
+ }
- var _index74 = _interopRequireDefault(_index73);
+ if (!redirect || typeof redirect !== 'object') {
+ if (true) {
+ warn(
+ false, ("invalid redirect option: " + (JSON.stringify(redirect)))
+ );
+ }
+ return _createRoute(null, location)
+ }
- var _index75 = __webpack_require__(225);
+ var re = redirect;
+ var name = re.name;
+ var path = re.path;
+ var query = location.query;
+ var hash = location.hash;
+ var params = location.params;
+ query = re.hasOwnProperty('query') ? re.query : query;
+ hash = re.hasOwnProperty('hash') ? re.hash : hash;
+ params = re.hasOwnProperty('params') ? re.params : params;
- var _index76 = _interopRequireDefault(_index75);
+ if (name) {
+ // resolved named direct
+ var targetRecord = nameMap[name];
+ if (true) {
+ assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."));
+ }
+ return match({
+ _normalized: true,
+ name: name,
+ query: query,
+ hash: hash,
+ params: params
+ }, undefined, location)
+ } else if (path) {
+ // 1. resolve relative redirect
+ var rawPath = resolveRecordPath(path, record);
+ // 2. resolve params
+ var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""));
+ // 3. rematch with existing query and hash
+ return match({
+ _normalized: true,
+ path: resolvedPath,
+ query: query,
+ hash: hash
+ }, undefined, location)
+ } else {
+ if (true) {
+ warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))));
+ }
+ return _createRoute(null, location)
+ }
+ }
- var _index77 = __webpack_require__(229);
+ function alias (
+ record,
+ location,
+ matchAs
+ ) {
+ var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""));
+ var aliasedMatch = match({
+ _normalized: true,
+ path: aliasedPath
+ });
+ if (aliasedMatch) {
+ var matched = aliasedMatch.matched;
+ var aliasedRecord = matched[matched.length - 1];
+ location.params = aliasedMatch.params;
+ return _createRoute(aliasedRecord, location)
+ }
+ return _createRoute(null, location)
+ }
- var _index78 = _interopRequireDefault(_index77);
+ function _createRoute (
+ record,
+ location,
+ redirectedFrom
+ ) {
+ if (record && record.redirect) {
+ return redirect(record, redirectedFrom || location)
+ }
+ if (record && record.matchAs) {
+ return alias(record, location, record.matchAs)
+ }
+ return createRoute(record, location, redirectedFrom, router)
+ }
- var _index79 = __webpack_require__(233);
+ return {
+ match: match,
+ addRoutes: addRoutes
+ }
+}
- var _index80 = _interopRequireDefault(_index79);
+function matchRoute (
+ regex,
+ path,
+ params
+) {
+ var m = path.match(regex);
- var _index81 = __webpack_require__(243);
+ if (!m) {
+ return false
+ } else if (!params) {
+ return true
+ }
- var _index82 = _interopRequireDefault(_index81);
+ for (var i = 1, len = m.length; i < len; ++i) {
+ var key = regex.keys[i - 1];
+ var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i];
+ if (key) {
+ params[key.name] = val;
+ }
+ }
- var _index83 = __webpack_require__(247);
+ return true
+}
- var _index84 = _interopRequireDefault(_index83);
+function resolveRecordPath (path, record) {
+ return resolvePath(path, record.parent ? record.parent.path : '/', true)
+}
- var _index85 = __webpack_require__(252);
+/* */
- var _index86 = _interopRequireDefault(_index85);
- var _index87 = __webpack_require__(260);
+var positionStore = Object.create(null);
- var _index88 = _interopRequireDefault(_index87);
+function setupScroll () {
+ window.addEventListener('popstate', function (e) {
+ saveScrollPosition();
+ if (e.state && e.state.key) {
+ setStateKey(e.state.key);
+ }
+ });
+}
- var _index89 = __webpack_require__(266);
+function handleScroll (
+ router,
+ to,
+ from,
+ isPop
+) {
+ if (!router.app) {
+ return
+ }
- var _index90 = _interopRequireDefault(_index89);
+ var behavior = router.options.scrollBehavior;
+ if (!behavior) {
+ return
+ }
- var _index91 = __webpack_require__(270);
+ if (true) {
+ assert(typeof behavior === 'function', "scrollBehavior must be a function");
+ }
- var _index92 = _interopRequireDefault(_index91);
+ // wait until re-render finishes before scrolling
+ router.app.$nextTick(function () {
+ var position = getScrollPosition();
+ var shouldScroll = behavior(to, from, isPop ? position : null);
+ if (!shouldScroll) {
+ return
+ }
+ var isObject = typeof shouldScroll === 'object';
+ if (isObject && typeof shouldScroll.selector === 'string') {
+ var el = document.querySelector(shouldScroll.selector);
+ if (el) {
+ var offset = shouldScroll.offset && typeof shouldScroll.offset === 'object' ? shouldScroll.offset : {};
+ offset = normalizeOffset(offset);
+ position = getElementPosition(el, offset);
+ } else if (isValidPosition(shouldScroll)) {
+ position = normalizePosition(shouldScroll);
+ }
+ } else if (isObject && isValidPosition(shouldScroll)) {
+ position = normalizePosition(shouldScroll);
+ }
- var _index93 = __webpack_require__(272);
+ if (position) {
+ window.scrollTo(position.x, position.y);
+ }
+ });
+}
- var _index94 = _interopRequireDefault(_index93);
+function saveScrollPosition () {
+ var key = getStateKey();
+ if (key) {
+ positionStore[key] = {
+ x: window.pageXOffset,
+ y: window.pageYOffset
+ };
+ }
+}
- var _index95 = __webpack_require__(274);
+function getScrollPosition () {
+ var key = getStateKey();
+ if (key) {
+ return positionStore[key]
+ }
+}
- var _index96 = _interopRequireDefault(_index95);
+function getElementPosition (el, offset) {
+ var docEl = document.documentElement;
+ var docRect = docEl.getBoundingClientRect();
+ var elRect = el.getBoundingClientRect();
+ return {
+ x: elRect.left - docRect.left - offset.x,
+ y: elRect.top - docRect.top - offset.y
+ }
+}
- var _index97 = __webpack_require__(290);
+function isValidPosition (obj) {
+ return isNumber(obj.x) || isNumber(obj.y)
+}
- var _index98 = _interopRequireDefault(_index97);
+function normalizePosition (obj) {
+ return {
+ x: isNumber(obj.x) ? obj.x : window.pageXOffset,
+ y: isNumber(obj.y) ? obj.y : window.pageYOffset
+ }
+}
- var _index99 = __webpack_require__(294);
+function normalizeOffset (obj) {
+ return {
+ x: isNumber(obj.x) ? obj.x : 0,
+ y: isNumber(obj.y) ? obj.y : 0
+ }
+}
- var _index100 = _interopRequireDefault(_index99);
+function isNumber (v) {
+ return typeof v === 'number'
+}
- var _index101 = __webpack_require__(298);
+/* */
- var _index102 = _interopRequireDefault(_index101);
+var supportsPushState = inBrowser && (function () {
+ var ua = window.navigator.userAgent;
- var _index103 = __webpack_require__(308);
+ if (
+ (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
+ ua.indexOf('Mobile Safari') !== -1 &&
+ ua.indexOf('Chrome') === -1 &&
+ ua.indexOf('Windows Phone') === -1
+ ) {
+ return false
+ }
- var _index104 = _interopRequireDefault(_index103);
+ return window.history && 'pushState' in window.history
+})();
- var _index105 = __webpack_require__(312);
+// use User Timing api (if present) for more accurate key precision
+var Time = inBrowser && window.performance && window.performance.now
+ ? window.performance
+ : Date;
- var _index106 = _interopRequireDefault(_index105);
+var _key = genKey();
- var _index107 = __webpack_require__(316);
+function genKey () {
+ return Time.now().toFixed(3)
+}
- var _index108 = _interopRequireDefault(_index107);
+function getStateKey () {
+ return _key
+}
- var _index109 = __webpack_require__(320);
+function setStateKey (key) {
+ _key = key;
+}
- var _index110 = _interopRequireDefault(_index109);
+function pushState (url, replace) {
+ saveScrollPosition();
+ // try...catch the pushState call to get around Safari
+ // DOM Exception 18 where it limits to 100 pushState calls
+ var history = window.history;
+ try {
+ if (replace) {
+ history.replaceState({ key: _key }, '', url);
+ } else {
+ _key = genKey();
+ history.pushState({ key: _key }, '', url);
+ }
+ } catch (e) {
+ window.location[replace ? 'replace' : 'assign'](url);
+ }
+}
- var _index111 = __webpack_require__(324);
+function replaceState (url) {
+ pushState(url, true);
+}
- var _index112 = _interopRequireDefault(_index111);
+/* */
- var _index113 = __webpack_require__(328);
+function runQueue (queue, fn, cb) {
+ var step = function (index) {
+ if (index >= queue.length) {
+ cb();
+ } else {
+ if (queue[index]) {
+ fn(queue[index], function () {
+ step(index + 1);
+ });
+ } else {
+ step(index + 1);
+ }
+ }
+ };
+ step(0);
+}
- var _index114 = _interopRequireDefault(_index113);
+/* */
- var _index115 = __webpack_require__(332);
+function resolveAsyncComponents (matched) {
+ return function (to, from, next) {
+ var hasAsync = false;
+ var pending = 0;
+ var error = null;
- var _index116 = _interopRequireDefault(_index115);
+ flatMapComponents(matched, function (def, _, match, key) {
+ // if it's a function and doesn't have cid attached,
+ // assume it's an async component resolve function.
+ // we are not using Vue's default async resolving mechanism because
+ // we want to halt the navigation until the incoming component has been
+ // resolved.
+ if (typeof def === 'function' && def.cid === undefined) {
+ hasAsync = true;
+ pending++;
- var _index117 = __webpack_require__(336);
+ var resolve = once(function (resolvedDef) {
+ if (resolvedDef.__esModule && resolvedDef.default) {
+ resolvedDef = resolvedDef.default;
+ }
+ // save resolved on async factory in case it's used elsewhere
+ def.resolved = typeof resolvedDef === 'function'
+ ? resolvedDef
+ : _Vue.extend(resolvedDef);
+ match.components[key] = resolvedDef;
+ pending--;
+ if (pending <= 0) {
+ next();
+ }
+ });
- var _index118 = _interopRequireDefault(_index117);
+ var reject = once(function (reason) {
+ var msg = "Failed to resolve async component " + key + ": " + reason;
+ "development" !== 'production' && warn(false, msg);
+ if (!error) {
+ error = isError(reason)
+ ? reason
+ : new Error(msg);
+ next(error);
+ }
+ });
- var _index119 = __webpack_require__(340);
+ var res;
+ try {
+ res = def(resolve, reject);
+ } catch (e) {
+ reject(e);
+ }
+ if (res) {
+ if (typeof res.then === 'function') {
+ res.then(resolve, reject);
+ } else {
+ // new syntax in Vue 2.3
+ var comp = res.component;
+ if (comp && typeof comp.then === 'function') {
+ comp.then(resolve, reject);
+ }
+ }
+ }
+ }
+ });
- var _index120 = _interopRequireDefault(_index119);
+ if (!hasAsync) { next(); }
+ }
+}
- var _index121 = __webpack_require__(344);
+function flatMapComponents (
+ matched,
+ fn
+) {
+ return flatten(matched.map(function (m) {
+ return Object.keys(m.components).map(function (key) { return fn(
+ m.components[key],
+ m.instances[key],
+ m, key
+ ); })
+ }))
+}
- var _index122 = _interopRequireDefault(_index121);
+function flatten (arr) {
+ return Array.prototype.concat.apply([], arr)
+}
- var _index123 = __webpack_require__(348);
+// in Webpack 2, require.ensure now also returns a Promise
+// so the resolve/reject functions may get called an extra time
+// if the user uses an arrow function shorthand that happens to
+// return that Promise.
+function once (fn) {
+ var called = false;
+ return function () {
+ var args = [], len = arguments.length;
+ while ( len-- ) args[ len ] = arguments[ len ];
- var _index124 = _interopRequireDefault(_index123);
+ if (called) { return }
+ called = true;
+ return fn.apply(this, args)
+ }
+}
- var _index125 = __webpack_require__(356);
+/* */
- var _index126 = _interopRequireDefault(_index125);
+var History = function History (router, base) {
+ this.router = router;
+ this.base = normalizeBase(base);
+ // start with a route object that stands for "nowhere"
+ this.current = START;
+ this.pending = null;
+ this.ready = false;
+ this.readyCbs = [];
+ this.readyErrorCbs = [];
+ this.errorCbs = [];
+};
- var _index127 = __webpack_require__(374);
+History.prototype.listen = function listen (cb) {
+ this.cb = cb;
+};
- var _index128 = _interopRequireDefault(_index127);
+History.prototype.onReady = function onReady (cb, errorCb) {
+ if (this.ready) {
+ cb();
+ } else {
+ this.readyCbs.push(cb);
+ if (errorCb) {
+ this.readyErrorCbs.push(errorCb);
+ }
+ }
+};
- var _locale = __webpack_require__(111);
+History.prototype.onError = function onError (errorCb) {
+ this.errorCbs.push(errorCb);
+};
- var _locale2 = _interopRequireDefault(_locale);
+History.prototype.transitionTo = function transitionTo (location, onComplete, onAbort) {
+ var this$1 = this;
- var _collapseTransition = __webpack_require__(49);
+ var route = this.router.match(location, this.current);
+ this.confirmTransition(route, function () {
+ this$1.updateRoute(route);
+ onComplete && onComplete(route);
+ this$1.ensureURL();
- var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
+ // fire ready cbs once
+ if (!this$1.ready) {
+ this$1.ready = true;
+ this$1.readyCbs.forEach(function (cb) { cb(route); });
+ }
+ }, function (err) {
+ if (onAbort) {
+ onAbort(err);
+ }
+ if (err && !this$1.ready) {
+ this$1.ready = true;
+ this$1.readyErrorCbs.forEach(function (cb) { cb(err); });
+ }
+ });
+};
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+History.prototype.confirmTransition = function confirmTransition (route, onComplete, onAbort) {
+ var this$1 = this;
- /* Automatic generated by './build/bin/build-entry.js' */
+ var current = this.current;
+ var abort = function (err) {
+ if (isError(err)) {
+ if (this$1.errorCbs.length) {
+ this$1.errorCbs.forEach(function (cb) { cb(err); });
+ } else {
+ warn(false, 'uncaught error during route navigation:');
+ console.error(err);
+ }
+ }
+ onAbort && onAbort(err);
+ };
+ if (
+ isSameRoute(route, current) &&
+ // in the case the route map has been dynamically appended to
+ route.matched.length === current.matched.length
+ ) {
+ this.ensureURL();
+ return abort()
+ }
- 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 ref = resolveQueue(this.current.matched, route.matched);
+ var updated = ref.updated;
+ var deactivated = ref.deactivated;
+ var activated = ref.activated;
- var install = function install(Vue) {
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var queue = [].concat(
+ // in-component leave guards
+ extractLeaveGuards(deactivated),
+ // global before hooks
+ this.router.beforeHooks,
+ // in-component update hooks
+ extractUpdateHooks(updated),
+ // in-config enter guards
+ activated.map(function (m) { return m.beforeEnter; }),
+ // async components
+ resolveAsyncComponents(activated)
+ );
- /* istanbul ignore if */
- if (install.installed) return;
- _locale2.default.use(opts.locale);
- _locale2.default.i18n(opts.i18n);
+ this.pending = route;
+ var iterator = function (hook, next) {
+ if (this$1.pending !== route) {
+ return abort()
+ }
+ try {
+ hook(route, current, function (to) {
+ if (to === false || isError(to)) {
+ // next(false) -> abort navigation, ensure current URL
+ this$1.ensureURL(true);
+ abort(to);
+ } else if (
+ typeof to === 'string' ||
+ (typeof to === 'object' && (
+ typeof to.path === 'string' ||
+ typeof to.name === 'string'
+ ))
+ ) {
+ // next('/') or next({ path: '/' }) -> redirect
+ abort();
+ if (typeof to === 'object' && to.replace) {
+ this$1.replace(to);
+ } else {
+ this$1.push(to);
+ }
+ } else {
+ // confirm transition and pass on the value
+ next(to);
+ }
+ });
+ } catch (e) {
+ abort(e);
+ }
+ };
- components.map(function (component) {
- Vue.component(component.name, component);
- });
+ runQueue(queue, iterator, function () {
+ var postEnterCbs = [];
+ var isValid = function () { return this$1.current === route; };
+ // wait until async components are resolved before
+ // extracting in-component enter guards
+ var enterGuards = extractEnterGuards(activated, postEnterCbs, isValid);
+ var queue = enterGuards.concat(this$1.router.resolveHooks);
+ runQueue(queue, iterator, function () {
+ if (this$1.pending !== route) {
+ return abort()
+ }
+ this$1.pending = null;
+ onComplete(route);
+ if (this$1.router.app) {
+ this$1.router.app.$nextTick(function () {
+ postEnterCbs.forEach(function (cb) { cb(); });
+ });
+ }
+ });
+ });
+};
- Vue.use(_index88.default.directive);
+History.prototype.updateRoute = function updateRoute (route) {
+ var prev = this.current;
+ this.current = route;
+ this.cb && this.cb(route);
+ this.router.afterHooks.forEach(function (hook) {
+ hook && hook(route, prev);
+ });
+};
- 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;
- };
+function normalizeBase (base) {
+ if (!base) {
+ if (inBrowser) {
+ // respect tag
+ var baseEl = document.querySelector('base');
+ base = (baseEl && baseEl.getAttribute('href')) || '/';
+ // strip full URL origin
+ base = base.replace(/^https?:\/\/[^\/]+/, '');
+ } else {
+ base = '/';
+ }
+ }
+ // make sure there's the starting slash
+ if (base.charAt(0) !== '/') {
+ base = '/' + base;
+ }
+ // remove trailing slash
+ return base.replace(/\/$/, '')
+}
- /* istanbul ignore if */
- if (typeof window !== 'undefined' && window.Vue) {
- install(window.Vue);
- };
+function resolveQueue (
+ current,
+ next
+) {
+ var i;
+ var max = Math.max(current.length, next.length);
+ for (i = 0; i < max; i++) {
+ if (current[i] !== next[i]) {
+ break
+ }
+ }
+ return {
+ updated: next.slice(0, i),
+ activated: next.slice(i),
+ deactivated: current.slice(i)
+ }
+}
- module.exports = {
- version: '1.4.4',
- 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
- };
+function extractGuards (
+ records,
+ name,
+ bind,
+ reverse
+) {
+ var guards = flatMapComponents(records, function (def, instance, match, key) {
+ var guard = extractGuard(def, name);
+ if (guard) {
+ return Array.isArray(guard)
+ ? guard.map(function (guard) { return bind(guard, instance, match, key); })
+ : bind(guard, instance, match, key)
+ }
+ });
+ return flatten(reverse ? guards.reverse() : guards)
+}
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
+function extractGuard (
+ def,
+ key
+) {
+ if (typeof def !== 'function') {
+ // extend now so that global mixins are applied.
+ def = _Vue.extend(def);
+ }
+ return def.options[key]
+}
- 'use strict';
+function extractLeaveGuards (deactivated) {
+ return extractGuards(deactivated, 'beforeRouteLeave', bindGuard, true)
+}
- exports.__esModule = true;
+function extractUpdateHooks (updated) {
+ return extractGuards(updated, 'beforeRouteUpdate', bindGuard)
+}
- var _pagination = __webpack_require__(3);
+function bindGuard (guard, instance) {
+ if (instance) {
+ return function boundRouteGuard () {
+ return guard.apply(instance, arguments)
+ }
+ }
+}
- var _pagination2 = _interopRequireDefault(_pagination);
+function extractEnterGuards (
+ activated,
+ cbs,
+ isValid
+) {
+ return extractGuards(activated, 'beforeRouteEnter', function (guard, _, match, key) {
+ return bindEnterGuard(guard, match, key, cbs, isValid)
+ })
+}
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+function bindEnterGuard (
+ guard,
+ match,
+ key,
+ cbs,
+ isValid
+) {
+ return function routeEnterGuard (to, from, next) {
+ return guard(to, from, function (cb) {
+ next(cb);
+ if (typeof cb === 'function') {
+ cbs.push(function () {
+ // #750
+ // if a router-view is wrapped with an out-in transition,
+ // the instance may not have been registered at this time.
+ // we will need to poll for registration until current route
+ // is no longer valid.
+ poll(cb, match.instances, key, isValid);
+ });
+ }
+ })
+ }
+}
- /* istanbul ignore next */
- _pagination2.default.install = function (Vue) {
- Vue.component(_pagination2.default.name, _pagination2.default);
- };
+function poll (
+ cb, // somehow flow cannot infer this is a function
+ instances,
+ key,
+ isValid
+) {
+ if (instances[key]) {
+ cb(instances[key]);
+ } else if (isValid()) {
+ setTimeout(function () {
+ poll(cb, instances, key, isValid);
+ }, 16);
+ }
+}
- exports.default = _pagination2.default;
+/* */
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
- 'use strict';
+var HTML5History = (function (History$$1) {
+ function HTML5History (router, base) {
+ var this$1 = this;
- exports.__esModule = true;
+ History$$1.call(this, router, base);
- var _pager = __webpack_require__(4);
+ var expectScroll = router.options.scrollBehavior;
- var _pager2 = _interopRequireDefault(_pager);
+ if (expectScroll) {
+ setupScroll();
+ }
- var _select = __webpack_require__(8);
+ window.addEventListener('popstate', function (e) {
+ var current = this$1.current;
+ this$1.transitionTo(getLocation(this$1.base), function (route) {
+ if (expectScroll) {
+ handleScroll(router, route, current, true);
+ }
+ });
+ });
+ }
- var _select2 = _interopRequireDefault(_select);
+ if ( History$$1 ) HTML5History.__proto__ = History$$1;
+ HTML5History.prototype = Object.create( History$$1 && History$$1.prototype );
+ HTML5History.prototype.constructor = HTML5History;
- var _option = __webpack_require__(9);
+ HTML5History.prototype.go = function go (n) {
+ window.history.go(n);
+ };
- var _option2 = _interopRequireDefault(_option);
+ HTML5History.prototype.push = function push (location, onComplete, onAbort) {
+ var this$1 = this;
- var _locale = __webpack_require__(10);
+ var ref = this;
+ var fromRoute = ref.current;
+ this.transitionTo(location, function (route) {
+ pushState(cleanPath(this$1.base + route.fullPath));
+ handleScroll(this$1.router, route, fromRoute, false);
+ onComplete && onComplete(route);
+ }, onAbort);
+ };
- var _locale2 = _interopRequireDefault(_locale);
+ HTML5History.prototype.replace = function replace (location, onComplete, onAbort) {
+ var this$1 = this;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var ref = this;
+ var fromRoute = ref.current;
+ this.transitionTo(location, function (route) {
+ replaceState(cleanPath(this$1.base + route.fullPath));
+ handleScroll(this$1.router, route, fromRoute, false);
+ onComplete && onComplete(route);
+ }, onAbort);
+ };
- exports.default = {
- name: 'ElPagination',
+ HTML5History.prototype.ensureURL = function ensureURL (push) {
+ if (getLocation(this.base) !== this.current.fullPath) {
+ var current = cleanPath(this.base + this.current.fullPath);
+ push ? pushState(current) : replaceState(current);
+ }
+ };
- props: {
- pageSize: {
- type: Number,
- default: 10
- },
+ HTML5History.prototype.getCurrentLocation = function getCurrentLocation () {
+ return getLocation(this.base)
+ };
- small: Boolean,
+ return HTML5History;
+}(History));
- total: Number,
+function getLocation (base) {
+ var path = window.location.pathname;
+ if (base && path.indexOf(base) === 0) {
+ path = path.slice(base.length);
+ }
+ return (path || '/') + window.location.search + window.location.hash
+}
- pageCount: Number,
+/* */
- currentPage: {
- type: Number,
- default: 1
- },
- layout: {
- default: 'prev, pager, next, jumper, ->, total'
- },
+var HashHistory = (function (History$$1) {
+ function HashHistory (router, base, fallback) {
+ History$$1.call(this, router, base);
+ // check history fallback deeplinking
+ if (fallback && checkFallback(this.base)) {
+ return
+ }
+ ensureSlash();
+ }
- pageSizes: {
- type: Array,
- default: function _default() {
- return [10, 20, 30, 40, 50, 100];
- }
- }
- },
+ if ( History$$1 ) HashHistory.__proto__ = History$$1;
+ HashHistory.prototype = Object.create( History$$1 && History$$1.prototype );
+ HashHistory.prototype.constructor = HashHistory;
- 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;
+ // this is delayed until the app mounts
+ // to avoid the hashchange listener being fired too early
+ HashHistory.prototype.setupListeners = function setupListeners () {
+ var this$1 = this;
- if (this.small) {
- template.data.class += ' el-pagination--small';
- }
+ window.addEventListener('hashchange', function () {
+ if (!ensureSlash()) {
+ return
+ }
+ this$1.transitionTo(getHash(), function (route) {
+ replaceHash(route.fullPath);
+ });
+ });
+ };
- components.forEach(function (compo) {
- if (compo === '->') {
- haveRightWrapper = true;
- return;
- }
+ HashHistory.prototype.push = function push (location, onComplete, onAbort) {
+ this.transitionTo(location, function (route) {
+ pushHash(route.fullPath);
+ onComplete && onComplete(route);
+ }, onAbort);
+ };
- if (!haveRightWrapper) {
- template.children.push(TEMPLATE_MAP[compo]);
- } else {
- rightWrapper.children.push(TEMPLATE_MAP[compo]);
- }
- });
+ HashHistory.prototype.replace = function replace (location, onComplete, onAbort) {
+ this.transitionTo(location, function (route) {
+ replaceHash(route.fullPath);
+ onComplete && onComplete(route);
+ }, onAbort);
+ };
- if (haveRightWrapper) {
- template.children.unshift(rightWrapper);
- }
+ HashHistory.prototype.go = function go (n) {
+ window.history.go(n);
+ };
- return template;
- },
+ HashHistory.prototype.ensureURL = function ensureURL (push) {
+ var current = this.current.fullPath;
+ if (getHash() !== current) {
+ push ? pushHash(current) : replaceHash(current);
+ }
+ };
+ HashHistory.prototype.getCurrentLocation = function getCurrentLocation () {
+ return getHash()
+ };
- 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' },
- []
- )]
- );
- }
- },
+ return HashHistory;
+}(History));
- 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' },
- []
- )]
- );
- }
- },
+function checkFallback (base) {
+ var location = getLocation(base);
+ if (!/^\/#/.test(location)) {
+ window.location.replace(
+ cleanPath(base + '/#' + location)
+ );
+ return true
+ }
+}
- Sizes: {
- mixins: [_locale2.default],
+function ensureSlash () {
+ var path = getHash();
+ if (path.charAt(0) === '/') {
+ return true
+ }
+ replaceHash('/' + path);
+ return false
+}
- props: {
- pageSizes: Array
- },
+function getHash () {
+ // We can't use window.location.hash here because it's not
+ // consistent across browsers - Firefox will pre-decode it!
+ var href = window.location.href;
+ var index = href.indexOf('#');
+ return index === -1 ? '' : href.slice(index + 1)
+}
- 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];
- }
- }
- }
- },
+function pushHash (path) {
+ window.location.hash = path;
+}
- render: function render(h) {
- var _this = this;
+function replaceHash (path) {
+ var href = window.location.href;
+ var i = href.indexOf('#');
+ var base = i >= 0 ? href.slice(0, i) : href;
+ window.location.replace((base + "#" + path));
+}
- 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
- },
+var AbstractHistory = (function (History$$1) {
+ function AbstractHistory (router, base) {
+ History$$1.call(this, router, base);
+ this.stack = [];
+ this.index = -1;
+ }
- methods: {
- handleChange: function handleChange(val) {
- if (val !== this.$parent.internalPageSize) {
- this.$parent.internalPageSize = val = parseInt(val, 10);
- this.$parent.$emit('size-change', val);
- }
- }
- }
- },
+ if ( History$$1 ) AbstractHistory.__proto__ = History$$1;
+ AbstractHistory.prototype = Object.create( History$$1 && History$$1.prototype );
+ AbstractHistory.prototype.constructor = AbstractHistory;
- Jumper: {
- mixins: [_locale2.default],
+ AbstractHistory.prototype.push = function push (location, onComplete, onAbort) {
+ var this$1 = this;
- data: function data() {
- return {
- oldValue: null
- };
- },
+ this.transitionTo(location, function (route) {
+ this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route);
+ this$1.index++;
+ onComplete && onComplete(route);
+ }, onAbort);
+ };
+ AbstractHistory.prototype.replace = function replace (location, onComplete, onAbort) {
+ var this$1 = this;
- methods: {
- handleFocus: function handleFocus(event) {
- this.oldValue = event.target.value;
- },
- handleBlur: function handleBlur(_ref) {
- var target = _ref.target;
+ this.transitionTo(location, function (route) {
+ this$1.stack = this$1.stack.slice(0, this$1.index).concat(route);
+ onComplete && onComplete(route);
+ }, onAbort);
+ };
- this.reassignMaxValue(target);
- },
- handleKeyUp: function handleKeyUp(event) {
- var key = event.key || '';
- var keyCode = event.keyCode || '';
- if (key && key === 'Enter' || keyCode && keyCode === 13) {
- this.reassignMaxValue(event.target);
- this.handleChange({ target: event.target });
- }
- },
- handleChange: function handleChange(_ref2) {
- var target = _ref2.target;
+ AbstractHistory.prototype.go = function go (n) {
+ var this$1 = this;
- this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(target.value);
- this.oldValue = null;
- },
- reassignMaxValue: function reassignMaxValue(target) {
- if (+target.value > this.$parent.internalPageCount) {
- target.value = this.$parent.internalPageCount;
- }
- }
- },
+ var targetIndex = this.index + n;
+ if (targetIndex < 0 || targetIndex >= this.stack.length) {
+ return
+ }
+ var route = this.stack[targetIndex];
+ this.confirmTransition(route, function () {
+ this$1.index = targetIndex;
+ this$1.updateRoute(route);
+ });
+ };
- 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.$parent.internalPageCount,
- value: this.$parent.internalCurrentPage,
+ AbstractHistory.prototype.getCurrentLocation = function getCurrentLocation () {
+ var current = this.stack[this.stack.length - 1];
+ return current ? current.fullPath : '/'
+ };
- number: true },
- domProps: {
- 'value': this.$parent.internalCurrentPage
- },
- on: {
- 'change': this.handleChange,
- 'focus': this.handleFocus,
- 'blur': this.handleBlur,
- 'keyup': this.handleKeyUp
- }
- },
- []
- ), this.t('el.pagination.pageClassifier')]
- );
- }
- },
+ AbstractHistory.prototype.ensureURL = function ensureURL () {
+ // noop
+ };
- Total: {
- mixins: [_locale2.default],
+ return AbstractHistory;
+}(History));
- 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
- },
+var VueRouter = function VueRouter (options) {
+ if ( options === void 0 ) options = {};
- 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);
+ this.app = null;
+ this.apps = [];
+ this.options = options;
+ this.beforeHooks = [];
+ this.resolveHooks = [];
+ this.afterHooks = [];
+ this.matcher = createMatcher(options.routes || [], this);
- var havePageCount = typeof this.internalPageCount === 'number';
+ var mode = options.mode || 'hash';
+ this.fallback = mode === 'history' && !supportsPushState && options.fallback !== false;
+ if (this.fallback) {
+ mode = 'hash';
+ }
+ if (!inBrowser) {
+ mode = 'abstract';
+ }
+ this.mode = mode;
- 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;
- }
- }
+ switch (mode) {
+ case 'history':
+ this.history = new HTML5History(this, options.base);
+ break
+ case 'hash':
+ this.history = new HashHistory(this, options.base, this.fallback);
+ break
+ case 'abstract':
+ this.history = new AbstractHistory(this, options.base);
+ break
+ default:
+ if (true) {
+ assert(false, ("invalid mode: " + mode));
+ }
+ }
+};
- if (resetValue === undefined && isNaN(value)) {
- resetValue = 1;
- } else if (resetValue === 0) {
- resetValue = 1;
- }
+var prototypeAccessors = { currentRoute: {} };
- return resetValue === undefined ? value : resetValue;
- }
- },
+VueRouter.prototype.match = function match (
+ raw,
+ current,
+ redirectedFrom
+) {
+ return this.matcher.match(raw, current, redirectedFrom)
+};
- 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;
- }
- },
+prototypeAccessors.currentRoute.get = function () {
+ return this.history && this.history.current
+};
- watch: {
- currentPage: {
- immediate: true,
- handler: function handler(val) {
- this.internalCurrentPage = val;
- }
- },
+VueRouter.prototype.init = function init (app /* Vue component instance */) {
+ var this$1 = this;
- pageSize: {
- immediate: true,
- handler: function handler(val) {
- this.internalPageSize = val;
- }
- },
+ "development" !== 'production' && assert(
+ install.installed,
+ "not installed. Make sure to call `Vue.use(VueRouter)` " +
+ "before creating root instance."
+ );
- internalCurrentPage: function internalCurrentPage(newVal, oldVal) {
- var _this2 = this;
+ this.apps.push(app);
- newVal = parseInt(newVal, 10);
+ // main app already initialized.
+ if (this.app) {
+ return
+ }
- /* istanbul ignore if */
- if (isNaN(newVal)) {
- newVal = oldVal || 1;
- } else {
- newVal = this.getValidCurrentPage(newVal);
- }
+ this.app = app;
- 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;
- }
- }
- }
- };
+ var history = this.history;
-/***/ },
-/* 4 */
-/***/ function(module, exports, __webpack_require__) {
+ if (history instanceof HTML5History) {
+ history.transitionTo(history.getCurrentLocation());
+ } else if (history instanceof HashHistory) {
+ var setupHashListener = function () {
+ history.setupListeners();
+ };
+ history.transitionTo(
+ history.getCurrentLocation(),
+ setupHashListener,
+ setupHashListener
+ );
+ }
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(6),
- /* template */
- __webpack_require__(7),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ history.listen(function (route) {
+ this$1.apps.forEach(function (app) {
+ app._route = route;
+ });
+ });
+};
- module.exports = Component.exports
+VueRouter.prototype.beforeEach = function beforeEach (fn) {
+ return registerHook(this.beforeHooks, fn)
+};
+VueRouter.prototype.beforeResolve = function beforeResolve (fn) {
+ return registerHook(this.resolveHooks, fn)
+};
-/***/ },
-/* 5 */
-/***/ function(module, exports) {
+VueRouter.prototype.afterEach = function afterEach (fn) {
+ return registerHook(this.afterHooks, fn)
+};
- /* globals __VUE_SSR_CONTEXT__ */
+VueRouter.prototype.onReady = function onReady (cb, errorCb) {
+ this.history.onReady(cb, errorCb);
+};
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
+VueRouter.prototype.onError = function onError (errorCb) {
+ this.history.onError(errorCb);
+};
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
+VueRouter.prototype.push = function push (location, onComplete, onAbort) {
+ this.history.push(location, onComplete, onAbort);
+};
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
+VueRouter.prototype.replace = function replace (location, onComplete, onAbort) {
+ this.history.replace(location, onComplete, onAbort);
+};
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
+VueRouter.prototype.go = function go (n) {
+ this.history.go(n);
+};
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
+VueRouter.prototype.back = function back () {
+ this.go(-1);
+};
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
+VueRouter.prototype.forward = function forward () {
+ this.go(1);
+};
- 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
- }
+VueRouter.prototype.getMatchedComponents = function getMatchedComponents (to) {
+ var route = to
+ ? to.matched
+ ? to
+ : this.resolve(to).route
+ : this.currentRoute;
+ if (!route) {
+ return []
+ }
+ return [].concat.apply([], route.matched.map(function (m) {
+ return Object.keys(m.components).map(function (key) {
+ return m.components[key]
+ })
+ }))
+};
- if (hook) {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
+VueRouter.prototype.resolve = function resolve (
+ to,
+ current,
+ append
+) {
+ var location = normalizeLocation(
+ to,
+ current || this.history.current,
+ append,
+ this
+ );
+ var route = this.match(location, current);
+ var fullPath = route.redirectedFrom || route.fullPath;
+ var base = this.history.base;
+ var href = createHref(base, fullPath, this.mode);
+ return {
+ location: location,
+ route: route,
+ href: href,
+ // for backwards compat
+ normalizedTo: location,
+ resolved: route
+ }
+};
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
+VueRouter.prototype.addRoutes = function addRoutes (routes) {
+ this.matcher.addRoutes(routes);
+ if (this.history.current !== START) {
+ this.history.transitionTo(this.history.getCurrentLocation());
+ }
+};
+Object.defineProperties( VueRouter.prototype, prototypeAccessors );
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
+function registerHook (list, fn) {
+ list.push(fn);
+ return function () {
+ var i = list.indexOf(fn);
+ if (i > -1) { list.splice(i, 1); }
+ }
+}
- 'use strict';
+function createHref (base, fullPath, mode) {
+ var path = mode === 'hash' ? '#' + fullPath : fullPath;
+ return base ? cleanPath(base + '/' + path) : path
+}
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+VueRouter.install = install;
+VueRouter.version = '2.7.0';
- exports.default = {
- name: 'ElPager',
-
- props: {
- currentPage: Number,
-
- pageCount: Number
- },
+if (inBrowser && window.Vue) {
+ window.Vue.use(VueRouter);
+}
- watch: {
- showPrevMore: function showPrevMore(val) {
- if (!val) this.quickprevIconClass = 'el-icon-more';
- },
- showNextMore: function showNextMore(val) {
- if (!val) this.quicknextIconClass = 'el-icon-more';
- }
- },
+/* harmony default export */ __webpack_exports__["default"] = (VueRouter);
- 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;
+/***/ }),
+/* 41 */
+/***/ (function(module, exports, __webpack_require__) {
- 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;
- }
- }
+module.exports =
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
- /* istanbul ignore if */
- if (!isNaN(newPage)) {
- if (newPage < 1) {
- newPage = 1;
- }
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
- if (newPage > pageCount) {
- newPage = pageCount;
- }
- }
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
- if (newPage !== currentPage) {
- this.$emit('change', newPage);
- }
- }
- },
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
- computed: {
- pagers: function pagers() {
- var pagerCount = 7;
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- var currentPage = Number(this.currentPage);
- var pageCount = Number(this.pageCount);
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
- var showPrevMore = false;
- var showNextMore = false;
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
- if (pageCount > pagerCount) {
- if (currentPage > pagerCount - 3) {
- showPrevMore = true;
- }
- if (currentPage < pageCount - 3) {
- showNextMore = true;
- }
- }
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
- var array = [];
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
- 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);
- }
- }
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "/dist/";
- this.showPrevMore = showPrevMore;
- this.showNextMore = showNextMore;
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
- return array;
- }
- },
+ module.exports = __webpack_require__(1);
- data: function data() {
- return {
- current: null,
- showPrevMore: false,
- showNextMore: false,
- quicknextIconClass: 'el-icon-more',
- quickprevIconClass: 'el-icon-more'
- };
- }
- };
/***/ },
-/* 7 */
-/***/ function(module, exports) {
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
- 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: []}
+ 'use strict';
-/***/ },
-/* 8 */
-/***/ function(module, exports) {
+ var _index = __webpack_require__(2);
- module.exports = __webpack_require__(41);
+ var _index2 = _interopRequireDefault(_index);
-/***/ },
-/* 9 */
-/***/ function(module, exports) {
+ var _index3 = __webpack_require__(11);
- module.exports = __webpack_require__(47);
+ var _index4 = _interopRequireDefault(_index3);
-/***/ },
-/* 10 */
-/***/ function(module, exports) {
+ var _index5 = __webpack_require__(17);
- module.exports = __webpack_require__(24);
+ var _index6 = _interopRequireDefault(_index5);
-/***/ },
-/* 11 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index7 = __webpack_require__(28);
- 'use strict';
+ var _index8 = _interopRequireDefault(_index7);
- exports.__esModule = true;
+ var _index9 = __webpack_require__(33);
- var _component = __webpack_require__(12);
+ var _index10 = _interopRequireDefault(_index9);
- var _component2 = _interopRequireDefault(_component);
+ var _index11 = __webpack_require__(37);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _index12 = _interopRequireDefault(_index11);
- /* istanbul ignore next */
- _component2.default.install = function (Vue) {
- Vue.component(_component2.default.name, _component2.default);
- };
+ var _index13 = __webpack_require__(41);
- exports.default = _component2.default;
+ var _index14 = _interopRequireDefault(_index13);
-/***/ },
-/* 12 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index15 = __webpack_require__(46);
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(13),
- /* template */
- __webpack_require__(16),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var _index16 = _interopRequireDefault(_index15);
- module.exports = Component.exports
+ var _index17 = __webpack_require__(52);
+ var _index18 = _interopRequireDefault(_index17);
-/***/ },
-/* 13 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index19 = __webpack_require__(56);
- 'use strict';
+ var _index20 = _interopRequireDefault(_index19);
- exports.__esModule = true;
+ var _index21 = __webpack_require__(60);
- var _popup = __webpack_require__(14);
+ var _index22 = _interopRequireDefault(_index21);
- var _popup2 = _interopRequireDefault(_popup);
+ var _index23 = __webpack_require__(66);
- var _emitter = __webpack_require__(15);
+ var _index24 = _interopRequireDefault(_index23);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _index25 = __webpack_require__(71);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _index26 = _interopRequireDefault(_index25);
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ var _index27 = __webpack_require__(75);
- exports.default = {
- name: 'ElDialog',
+ var _index28 = _interopRequireDefault(_index27);
- mixins: [_popup2.default, _emitter2.default],
+ var _index29 = __webpack_require__(79);
- props: {
- title: {
- type: String,
- default: ''
- },
+ var _index30 = _interopRequireDefault(_index29);
- modal: {
- type: Boolean,
- default: true
- },
+ var _index31 = __webpack_require__(83);
- modalAppendToBody: {
- type: Boolean,
- default: true
- },
+ var _index32 = _interopRequireDefault(_index31);
- lockScroll: {
- type: Boolean,
- default: true
- },
+ var _index33 = __webpack_require__(87);
- closeOnClickModal: {
- type: Boolean,
- default: true
- },
+ var _index34 = _interopRequireDefault(_index33);
- closeOnPressEscape: {
- type: Boolean,
- default: true
- },
+ var _index35 = __webpack_require__(91);
- showClose: {
- type: Boolean,
- default: true
- },
+ var _index36 = _interopRequireDefault(_index35);
- size: {
- type: String,
- default: 'small'
- },
+ var _index37 = __webpack_require__(95);
- customClass: {
- type: String,
- default: ''
- },
+ var _index38 = _interopRequireDefault(_index37);
- top: {
- type: String,
- default: '15%'
- },
- beforeClose: Function
- },
+ var _index39 = __webpack_require__(99);
- watch: {
- visible: function visible(val) {
- var _this = this;
+ var _index40 = _interopRequireDefault(_index39);
- 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');
- }
- }
- },
+ var _index41 = __webpack_require__(114);
- computed: {
- sizeClass: function sizeClass() {
- return 'el-dialog--' + this.size;
- },
- style: function style() {
- return this.size === 'full' ? {} : { 'top': this.top };
- }
- },
+ var _index42 = _interopRequireDefault(_index41);
- 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');
- }
- },
+ var _index43 = __webpack_require__(115);
- mounted: function mounted() {
- if (this.visible) {
- this.rendered = true;
- this.open();
- }
- }
- };
+ var _index44 = _interopRequireDefault(_index43);
-/***/ },
-/* 14 */
-/***/ function(module, exports) {
+ var _index45 = __webpack_require__(119);
- module.exports = __webpack_require__(21);
+ var _index46 = _interopRequireDefault(_index45);
-/***/ },
-/* 15 */
-/***/ function(module, exports) {
+ var _index47 = __webpack_require__(123);
- module.exports = __webpack_require__(5);
+ var _index48 = _interopRequireDefault(_index47);
-/***/ },
-/* 16 */
-/***/ function(module, exports) {
+ var _index49 = __webpack_require__(127);
- 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: []}
+ var _index50 = _interopRequireDefault(_index49);
-/***/ },
-/* 17 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index51 = __webpack_require__(147);
- 'use strict';
+ var _index52 = _interopRequireDefault(_index51);
- exports.__esModule = true;
+ var _index53 = __webpack_require__(149);
- var _autocomplete = __webpack_require__(18);
+ var _index54 = _interopRequireDefault(_index53);
- var _autocomplete2 = _interopRequireDefault(_autocomplete);
+ var _index55 = __webpack_require__(177);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _index56 = _interopRequireDefault(_index55);
- /* istanbul ignore next */
- _autocomplete2.default.install = function (Vue) {
- Vue.component(_autocomplete2.default.name, _autocomplete2.default);
- };
+ var _index57 = __webpack_require__(182);
- exports.default = _autocomplete2.default;
+ var _index58 = _interopRequireDefault(_index57);
-/***/ },
-/* 18 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index59 = __webpack_require__(187);
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(19),
- /* template */
- __webpack_require__(27),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var _index60 = _interopRequireDefault(_index59);
- module.exports = Component.exports
+ var _index61 = __webpack_require__(192);
+ var _index62 = _interopRequireDefault(_index61);
-/***/ },
-/* 19 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index63 = __webpack_require__(195);
- 'use strict';
+ var _index64 = _interopRequireDefault(_index63);
- exports.__esModule = true;
+ var _index65 = __webpack_require__(200);
- var _input = __webpack_require__(20);
+ var _index66 = _interopRequireDefault(_index65);
- var _input2 = _interopRequireDefault(_input);
+ var _index67 = __webpack_require__(204);
- var _clickoutside = __webpack_require__(21);
+ var _index68 = _interopRequireDefault(_index67);
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ var _index69 = __webpack_require__(208);
- var _autocompleteSuggestions = __webpack_require__(22);
+ var _index70 = _interopRequireDefault(_index69);
- var _autocompleteSuggestions2 = _interopRequireDefault(_autocompleteSuggestions);
+ var _index71 = __webpack_require__(212);
- var _emitter = __webpack_require__(15);
+ var _index72 = _interopRequireDefault(_index71);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _index73 = __webpack_require__(217);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _index74 = _interopRequireDefault(_index73);
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ var _index75 = __webpack_require__(225);
- exports.default = {
- name: 'ElAutocomplete',
+ var _index76 = _interopRequireDefault(_index75);
- mixins: [_emitter2.default],
+ var _index77 = __webpack_require__(229);
- componentName: 'ElAutocomplete',
+ var _index78 = _interopRequireDefault(_index77);
- components: {
- ElInput: _input2.default,
- ElAutocompleteSuggestions: _autocompleteSuggestions2.default
- },
+ var _index79 = __webpack_require__(233);
- directives: { Clickoutside: _clickoutside2.default },
+ var _index80 = _interopRequireDefault(_index79);
- 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
- };
- },
+ var _index81 = __webpack_require__(243);
- 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;
+ var _index82 = _interopRequireDefault(_index81);
- 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(e) {
- if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
- e.preventDefault();
- this.select(this.suggestions[this.highlightedIndex]);
- }
- },
- select: function select(item) {
- var _this2 = this;
+ var _index83 = __webpack_require__(247);
- 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 _index84 = _interopRequireDefault(_index83);
- var highlightItem = suggestionList[index];
- var scrollTop = suggestion.scrollTop;
- var offsetTop = highlightItem.offsetTop;
+ var _index85 = __webpack_require__(252);
- if (offsetTop + highlightItem.scrollHeight > scrollTop + suggestion.clientHeight) {
- suggestion.scrollTop += highlightItem.scrollHeight;
- }
- if (offsetTop < scrollTop) {
- suggestion.scrollTop -= highlightItem.scrollHeight;
- }
+ var _index86 = _interopRequireDefault(_index85);
- this.highlightedIndex = index;
- }
- },
- mounted: function mounted() {
- var _this3 = this;
+ var _index87 = __webpack_require__(260);
- this.$on('item-click', function (item) {
- _this3.select(item);
- });
- },
- beforeDestroy: function beforeDestroy() {
- this.$refs.suggestions.$destroy();
- }
- };
+ var _index88 = _interopRequireDefault(_index87);
-/***/ },
-/* 20 */
-/***/ function(module, exports) {
+ var _index89 = __webpack_require__(266);
- module.exports = __webpack_require__(11);
+ var _index90 = _interopRequireDefault(_index89);
-/***/ },
-/* 21 */
-/***/ function(module, exports) {
+ var _index91 = __webpack_require__(270);
- module.exports = __webpack_require__(20);
+ var _index92 = _interopRequireDefault(_index91);
-/***/ },
-/* 22 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index93 = __webpack_require__(272);
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(23),
- /* template */
- __webpack_require__(26),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var _index94 = _interopRequireDefault(_index93);
- module.exports = Component.exports
+ var _index95 = __webpack_require__(274);
+ var _index96 = _interopRequireDefault(_index95);
-/***/ },
-/* 23 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index97 = __webpack_require__(290);
- 'use strict';
+ var _index98 = _interopRequireDefault(_index97);
- exports.__esModule = true;
+ var _index99 = __webpack_require__(294);
- var _vuePopper = __webpack_require__(24);
+ var _index100 = _interopRequireDefault(_index99);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+ var _index101 = __webpack_require__(298);
- var _emitter = __webpack_require__(15);
+ var _index102 = _interopRequireDefault(_index101);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _index103 = __webpack_require__(308);
- var _scrollbar = __webpack_require__(25);
+ var _index104 = _interopRequireDefault(_index103);
- var _scrollbar2 = _interopRequireDefault(_scrollbar);
+ var _index105 = __webpack_require__(312);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _index106 = _interopRequireDefault(_index105);
- exports.default = {
- components: { ElScrollbar: _scrollbar2.default },
- mixins: [_vuePopper2.default, _emitter2.default],
+ var _index107 = __webpack_require__(316);
- componentName: 'ElAutocompleteSuggestions',
+ var _index108 = _interopRequireDefault(_index107);
- data: function data() {
- return {
- parent: this.$parent,
- dropdownWidth: ''
- };
- },
+ var _index109 = __webpack_require__(320);
+ var _index110 = _interopRequireDefault(_index109);
- props: {
- props: Object,
- suggestions: Array,
- options: {
- default: function _default() {
- return {
- forceAbsolute: true,
- gpuAcceleration: false
- };
- }
- }
- },
+ var _index111 = __webpack_require__(324);
- methods: {
- select: function select(item) {
- this.dispatch('ElAutocomplete', 'item-click', item);
- }
- },
+ var _index112 = _interopRequireDefault(_index111);
- updated: function updated() {
- var _this = this;
+ var _index113 = __webpack_require__(328);
- 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;
+ var _index114 = _interopRequireDefault(_index113);
- this.$on('visible', function (val, inputWidth) {
- _this2.dropdownWidth = inputWidth + 'px';
- _this2.showPopper = val;
- });
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ var _index115 = __webpack_require__(332);
-/***/ },
-/* 24 */
-/***/ function(module, exports) {
+ var _index116 = _interopRequireDefault(_index115);
- module.exports = __webpack_require__(13);
+ var _index117 = __webpack_require__(336);
-/***/ },
-/* 25 */
-/***/ function(module, exports) {
+ var _index118 = _interopRequireDefault(_index117);
- module.exports = __webpack_require__(22);
+ var _index119 = __webpack_require__(340);
-/***/ },
-/* 26 */
-/***/ function(module, exports) {
+ var _index120 = _interopRequireDefault(_index119);
- 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: []}
+ var _index121 = __webpack_require__(344);
-/***/ },
-/* 27 */
-/***/ function(module, exports) {
+ var _index122 = _interopRequireDefault(_index121);
- 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', _vm._b({
- ref: "input",
- 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; }
- _vm.handleKeyEnter($event)
- }, function($event) {
- if (!('button' in $event) && _vm._k($event.keyCode, "tab", 9)) { return null; }
- _vm.close($event)
- }]
- }
- }, 'el-input', _vm.$props), [(_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: []}
+ var _index123 = __webpack_require__(348);
-/***/ },
-/* 28 */
-/***/ function(module, exports, __webpack_require__) {
+ var _index124 = _interopRequireDefault(_index123);
- 'use strict';
+ var _index125 = __webpack_require__(356);
- exports.__esModule = true;
+ var _index126 = _interopRequireDefault(_index125);
- var _dropdown = __webpack_require__(29);
+ var _index127 = __webpack_require__(374);
- var _dropdown2 = _interopRequireDefault(_dropdown);
+ var _index128 = _interopRequireDefault(_index127);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _locale = __webpack_require__(111);
- /* istanbul ignore next */
- _dropdown2.default.install = function (Vue) {
- Vue.component(_dropdown2.default.name, _dropdown2.default);
- };
+ var _locale2 = _interopRequireDefault(_locale);
- exports.default = _dropdown2.default;
+ var _collapseTransition = __webpack_require__(49);
-/***/ },
-/* 29 */
-/***/ function(module, exports, __webpack_require__) {
+ var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(30),
- /* template */
- null,
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- module.exports = Component.exports
+ /* 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.4',
+ 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
+ };
/***/ },
-/* 30 */
+/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _clickoutside = __webpack_require__(21);
+ var _pagination = __webpack_require__(3);
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ var _pagination2 = _interopRequireDefault(_pagination);
- var _emitter = __webpack_require__(15);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _emitter2 = _interopRequireDefault(_emitter);
+ /* istanbul ignore next */
+ _pagination2.default.install = function (Vue) {
+ Vue.component(_pagination2.default.name, _pagination2.default);
+ };
- var _button = __webpack_require__(31);
+ exports.default = _pagination2.default;
- var _button2 = _interopRequireDefault(_button);
+/***/ },
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
- var _buttonGroup = __webpack_require__(32);
+ 'use strict';
- var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
+ 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: 'ElDropdown',
+ name: 'ElPagination',
- componentName: 'ElDropdown',
+ props: {
+ pageSize: {
+ type: Number,
+ default: 10
+ },
- mixins: [_emitter2.default],
+ small: Boolean,
- directives: { Clickoutside: _clickoutside2.default },
+ total: Number,
- components: {
- ElButton: _button2.default,
- ElButtonGroup: _buttonGroup2.default
- },
+ pageCount: Number,
- props: {
- trigger: {
- type: String,
- default: 'hover'
+ currentPage: {
+ type: Number,
+ default: 1
},
- menuAlign: {
- type: String,
- default: 'end'
+
+ layout: {
+ default: 'prev, pager, next, jumper, ->, total'
},
- type: String,
- size: String,
- splitButton: Boolean,
- hideOnClick: {
- type: Boolean,
- default: true
+
+ pageSizes: {
+ type: Array,
+ default: function _default() {
+ return [10, 20, 30, 40, 50, 100];
+ }
}
},
data: function data() {
return {
- timeout: null,
- visible: false
+ internalCurrentPage: 1,
+ internalPageSize: 0
};
},
- mounted: function mounted() {
- this.$on('menu-item-click', this.handleMenuItemClick);
- this.initEvent();
- },
-
+ 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;
- watch: {
- visible: function visible(val) {
- this.broadcast('ElDropdownMenu', 'visible', val);
- this.$emit('visible-change', val);
+ if (this.small) {
+ template.data.class += ' el-pagination--small';
}
- },
-
- methods: {
- show: function show() {
- var _this = this;
- clearTimeout(this.timeout);
- this.timeout = setTimeout(function () {
- _this.visible = true;
- }, 250);
- },
- hide: function hide() {
- var _this2 = this;
+ components.forEach(function (compo) {
+ if (compo === '->') {
+ haveRightWrapper = true;
+ return;
+ }
- 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;
+ if (!haveRightWrapper) {
+ template.children.push(TEMPLATE_MAP[compo]);
+ } else {
+ rightWrapper.children.push(TEMPLATE_MAP[compo]);
+ }
+ });
- var triggerElm = splitButton ? this.$refs.trigger.$el : this.$slots.default[0].elm;
+ if (haveRightWrapper) {
+ template.children.unshift(rightWrapper);
+ }
- if (triggerElm.disabled) return;
- if (trigger === 'hover') {
- triggerElm.addEventListener('mouseenter', show);
- triggerElm.addEventListener('mouseleave', hide);
+ return template;
+ },
- var dropdownElm = this.$slots.dropdown[0].elm;
- dropdownElm.addEventListener('mouseenter', show);
- dropdownElm.addEventListener('mouseleave', hide);
- } else if (trigger === 'click') {
- triggerElm.addEventListener('click', handleClick);
+ components: {
+ MySlot: {
+ render: function render(h) {
+ return this.$parent.$slots.default ? this.$parent.$slots.default[0] : '';
}
},
- handleMenuItemClick: function handleMenuItemClick(command, instance) {
- if (this.hideOnClick) {
- this.visible = false;
+ 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' },
+ []
+ )]
+ );
}
- 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;
+ 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],
- var handleClick = function handleClick(_) {
- _this3.$emit('click');
- };
+ props: {
+ pageSizes: Array
+ },
- var triggerElm = !splitButton ? this.$slots.default : h(
- 'el-button-group',
- null,
- [h(
- 'el-button',
- {
- attrs: { type: type, size: size },
- nativeOn: {
- 'click': handleClick
+ 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];
+ }
}
- },
- [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__(48);
-
-/***/ },
-/* 32 */
-/***/ function(module, exports) {
- module.exports = __webpack_require__(49);
+ render: function render(h) {
+ var _this = this;
-/***/ },
-/* 33 */
-/***/ function(module, exports, __webpack_require__) {
+ 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') }
+ },
+ []
+ );
+ })]
+ )]
+ );
+ },
- 'use strict';
- exports.__esModule = true;
+ components: {
+ ElSelect: _select2.default,
+ ElOption: _option2.default
+ },
- var _dropdownMenu = __webpack_require__(34);
+ methods: {
+ handleChange: function handleChange(val) {
+ if (val !== this.$parent.internalPageSize) {
+ this.$parent.internalPageSize = val = parseInt(val, 10);
+ this.$parent.$emit('size-change', val);
+ }
+ }
+ }
+ },
- var _dropdownMenu2 = _interopRequireDefault(_dropdownMenu);
+ Jumper: {
+ mixins: [_locale2.default],
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ data: function data() {
+ return {
+ oldValue: null
+ };
+ },
- /* 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
+ methods: {
+ handleFocus: function handleFocus(event) {
+ this.oldValue = event.target.value;
+ },
+ handleBlur: function handleBlur(_ref) {
+ var target = _ref.target;
+ this.reassignMaxValue(target);
+ },
+ handleKeyUp: function handleKeyUp(event) {
+ var key = event.key || '';
+ var keyCode = event.keyCode || '';
+ if (key && key === 'Enter' || keyCode && keyCode === 13) {
+ this.reassignMaxValue(event.target);
+ this.handleChange({ target: event.target });
+ }
+ },
+ handleChange: function handleChange(_ref2) {
+ var target = _ref2.target;
-/***/ },
-/* 35 */
-/***/ function(module, exports, __webpack_require__) {
+ this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(target.value);
+ this.oldValue = null;
+ },
+ reassignMaxValue: function reassignMaxValue(target) {
+ if (+target.value > this.$parent.internalPageCount) {
+ target.value = this.$parent.internalPageCount;
+ }
+ }
+ },
- 'use strict';
+ 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.$parent.internalPageCount,
+ value: this.$parent.internalCurrentPage,
- exports.__esModule = true;
+ number: true },
+ domProps: {
+ 'value': this.$parent.internalCurrentPage
+ },
+ on: {
+ 'change': this.handleChange,
+ 'focus': this.handleFocus,
+ 'blur': this.handleBlur,
+ 'keyup': this.handleKeyUp
+ }
+ },
+ []
+ ), this.t('el.pagination.pageClassifier')]
+ );
+ }
+ },
- var _vuePopper = __webpack_require__(24);
+ Total: {
+ mixins: [_locale2.default],
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+ 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 })]
+ ) : '';
+ }
+ },
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ Pager: _pager2.default
+ },
- exports.default = {
- name: 'ElDropdownMenu',
+ 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);
- componentName: 'ElDropdownMenu',
+ var havePageCount = typeof this.internalPageCount === 'number';
- mixins: [_vuePopper2.default],
+ 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;
+ }
+ }
- created: function created() {
- var _this = this;
+ if (resetValue === undefined && isNaN(value)) {
+ resetValue = 1;
+ } else if (resetValue === 0) {
+ resetValue = 1;
+ }
- 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;
+ 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: {
- '$parent.menuAlign': {
+ currentPage: {
immediate: true,
handler: function handler(val) {
- this.currentPlacement = 'bottom-' + val;
+ this.internalCurrentPage = 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;
+ pageSize: {
+ immediate: true,
+ handler: function handler(val) {
+ this.internalPageSize = val;
+ }
+ },
- var _dropdownItem = __webpack_require__(38);
+ internalCurrentPage: function internalCurrentPage(newVal, oldVal) {
+ var _this2 = this;
- var _dropdownItem2 = _interopRequireDefault(_dropdownItem);
+ newVal = parseInt(newVal, 10);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ /* istanbul ignore if */
+ if (isNaN(newVal)) {
+ newVal = oldVal || 1;
+ } else {
+ newVal = this.getValidCurrentPage(newVal);
+ }
- /* istanbul ignore next */
- _dropdownItem2.default.install = function (Vue) {
- Vue.component(_dropdownItem2.default.name, _dropdownItem2.default);
+ 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;
+ }
+ }
+ }
};
- exports.default = _dropdownItem2.default;
-
/***/ },
-/* 38 */
+/* 4 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(39),
+ __webpack_require__(6),
/* template */
- __webpack_require__(40),
+ __webpack_require__(7),
/* styles */
null,
/* scopeId */
@@ -36202,36 +36142,101 @@ module.exports =
/***/ },
-/* 39 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
+/* 5 */
+/***/ function(module, exports) {
- exports.__esModule = true;
+ /* globals __VUE_SSR_CONTEXT__ */
- var _emitter = __webpack_require__(15);
+ // this module is a runtime utility for cleaner component module output and will
+ // be included in the final webpack user bundle
- var _emitter2 = _interopRequireDefault(_emitter);
+ module.exports = function normalizeComponent (
+ rawScriptExports,
+ compiledTemplate,
+ injectStyles,
+ scopeId,
+ moduleIdentifier /* server only */
+ ) {
+ var esModule
+ var scriptExports = rawScriptExports = rawScriptExports || {}
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ // ES6 modules interop
+ var type = typeof rawScriptExports.default
+ if (type === 'object' || type === 'function') {
+ esModule = rawScriptExports
+ scriptExports = rawScriptExports.default
+ }
- exports.default = {
- name: 'ElDropdownItem',
+ // Vue.extend constructor export interop
+ var options = typeof scriptExports === 'function'
+ ? scriptExports.options
+ : scriptExports
- mixins: [_emitter2.default],
+ // render functions
+ if (compiledTemplate) {
+ options.render = compiledTemplate.render
+ options.staticRenderFns = compiledTemplate.staticRenderFns
+ }
- props: {
- command: {},
- disabled: Boolean,
- divided: Boolean
- },
+ // scopedId
+ if (scopeId) {
+ options._scopeId = scopeId
+ }
- methods: {
- handleClick: function handleClick(e) {
- this.dispatch('ElDropdown', 'menu-item-click', [this.command, this]);
+ 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;
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -36243,81 +36248,6 @@ module.exports =
//
//
//
-
-/***/ },
-/* 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__(45),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
-
- module.exports = Component.exports
-
-
-/***/ },
-/* 43 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _emitter = __webpack_require__(15);
-
- var _emitter2 = _interopRequireDefault(_emitter);
-
- var _dom = __webpack_require__(44);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
//
//
//
@@ -36334,266 +36264,219 @@ module.exports =
//
exports.default = {
- name: 'ElMenu',
-
- componentName: 'ElMenu',
+ name: 'ElPager',
- mixins: [_emitter2.default],
+ props: {
+ currentPage: Number,
- provide: function provide() {
- return {
- rootMenu: this
- };
+ 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';
+ }
+ },
- components: {
- '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 = {};
+ methods: {
+ onPagerClick: function onPagerClick(event) {
+ var target = event.target;
+ if (target.tagName === 'UL') {
+ return;
+ }
- 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');
- }
+ var newPage = Number(event.target.textContent);
+ var pageCount = this.pageCount;
+ var currentPage = this.currentPage;
- 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);
+ 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;
+ }
}
- }
- },
- 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 {
- activeIndex: this.defaultActive,
- openedMenus: this.defaultOpeneds ? this.defaultOpeneds.slice(0) : [],
- items: {},
- submenus: {}
- };
- },
+ /* istanbul ignore if */
+ if (!isNaN(newPage)) {
+ if (newPage < 1) {
+ newPage = 1;
+ }
- watch: {
- defaultActive: function defaultActive(value) {
- var item = this.items[value];
- if (item) {
- this.activeIndex = item.index;
- this.initOpenedMenu();
- } else {
- this.activeIndex = '';
+ if (newPage > pageCount) {
+ newPage = pageCount;
+ }
+ }
+
+ if (newPage !== currentPage) {
+ this.$emit('change', newPage);
}
- },
- defaultOpeneds: function defaultOpeneds(value) {
- this.openedMenus = value;
- },
- collapse: function collapse(value) {
- if (value) this.openedMenus = [];
}
},
- 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) {
- 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;
+ computed: {
+ pagers: function pagers() {
+ var pagerCount = 7;
- if (isOpened) {
- this.closeMenu(index);
- 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;
+ var currentPage = Number(this.currentPage);
+ var pageCount = Number(this.pageCount);
- this.activeIndex = item.index;
- this.$emit('select', index, indexPath, item);
+ var showPrevMore = false;
+ var showNextMore = false;
- if (this.mode === 'horizontal' || this.collapse) {
- this.openedMenus = [];
- }
+ if (pageCount > pagerCount) {
+ if (currentPage > pagerCount - 3) {
+ showPrevMore = true;
+ }
- if (this.router) {
- this.routeToItem(item);
+ if (currentPage < pageCount - 3) {
+ showNextMore = true;
+ }
}
- },
- // 初始化展开菜单
- initOpenedMenu: function initOpenedMenu() {
- var _this = this;
+ var array = [];
- var index = this.activeIndex;
- var activeItem = this.items[index];
- if (!activeItem || this.mode === 'horizontal' || this.collapse) return;
+ 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);
+ }
+ }
- var indexPath = activeItem.indexPath;
+ this.showPrevMore = showPrevMore;
+ this.showNextMore = showNextMore;
- // 展开该菜单项的路径上所有子菜单
- 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);
- }
+ return array;
}
},
- mounted: function mounted() {
- this.initOpenedMenu();
- this.$on('item-click', this.handleItemClick);
- this.$on('submenu-click', this.handleSubmenuClick);
+
+ data: function data() {
+ return {
+ current: null,
+ showPrevMore: false,
+ showNextMore: false,
+ quicknextIconClass: 'el-icon-more',
+ quickprevIconClass: 'el-icon-more'
+ };
}
};
/***/ },
-/* 44 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(4);
-
-/***/ },
-/* 45 */
+/* 7 */
/***/ 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",
+ return _c('ul', {
+ staticClass: "el-pager",
+ on: {
+ "click": _vm.onPagerClick
+ }
+ }, [(_vm.pageCount > 0) ? _c('li', {
+ staticClass: "number",
class: {
- 'el-menu--horizontal': _vm.mode === 'horizontal',
- 'el-menu--dark': _vm.theme === 'dark',
- 'el-menu--collapse': _vm.collapse
+ active: _vm.currentPage === 1
}
- }, [_vm._t("default")], 2)])
+ }, [_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: []}
/***/ },
-/* 46 */
+/* 8 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(42);
+
+/***/ },
+/* 9 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(48);
+
+/***/ },
+/* 10 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(24);
+
+/***/ },
+/* 11 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _submenu = __webpack_require__(47);
+ var _component = __webpack_require__(12);
- var _submenu2 = _interopRequireDefault(_submenu);
+ var _component2 = _interopRequireDefault(_component);
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);
+ _component2.default.install = function (Vue) {
+ Vue.component(_component2.default.name, _component2.default);
};
- exports.default = _submenu2.default;
+ exports.default = _component2.default;
/***/ },
-/* 47 */
+/* 12 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(48),
+ __webpack_require__(13),
/* template */
- __webpack_require__(51),
+ __webpack_require__(16),
/* styles */
null,
/* scopeId */
@@ -36606,20 +36489,16 @@ module.exports =
/***/ },
-/* 48 */
+/* 13 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _collapseTransition = __webpack_require__(49);
-
- var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
-
- var _menuMixin = __webpack_require__(50);
+ var _popup = __webpack_require__(14);
- var _menuMixin2 = _interopRequireDefault(_menuMixin);
+ var _popup2 = _interopRequireDefault(_popup);
var _emitter = __webpack_require__(15);
@@ -36627,121 +36506,6 @@ module.exports =
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);
- }, 300);
- }
- },
- created: function created() {
- this.parentMenu.addSubmenu(this);
- this.rootMenu.addSubmenu(this);
- },
- beforeDestroy: function beforeDestroy() {
- this.parentMenu.removeSubmenu(this);
- this.rootMenu.removeSubmenu(this);
- }
- }; //
- //
- //
- //
//
//
//
@@ -36769,149 +36533,215 @@ module.exports =
//
//
-/***/ },
-/* 49 */
-/***/ function(module, exports) {
+ exports.default = {
+ name: 'ElDialog',
- module.exports = __webpack_require__(50);
+ mixins: [_popup2.default, _emitter2.default],
-/***/ },
-/* 50 */
-/***/ function(module, exports) {
+ props: {
+ title: {
+ type: String,
+ default: ''
+ },
- 'use strict';
+ modal: {
+ type: Boolean,
+ default: true
+ },
- 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;
+ modalAppendToBody: {
+ type: Boolean,
+ default: true
},
- rootMenu: function rootMenu() {
- var parent = this.$parent;
- while (parent && parent.$options.componentName !== 'ElMenu') {
- parent = parent.$parent;
- }
- return parent;
+
+ lockScroll: {
+ type: Boolean,
+ default: true
},
- parentMenu: function parentMenu() {
- var parent = this.$parent;
- while (parent && ['ElMenu', 'ElSubmenu'].indexOf(parent.$options.componentName) === -1) {
- parent = parent.$parent;
- }
- return parent;
+
+ closeOnClickModal: {
+ type: Boolean,
+ default: true
},
- paddingStyle: function paddingStyle() {
- if (this.rootMenu.mode !== 'vertical') return {};
- var padding = 20;
- var parent = this.$parent;
+ closeOnPressEscape: {
+ type: Boolean,
+ default: true
+ },
- if (this.rootMenu.collapse) {
- padding = 20;
+ 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 {
- while (parent && parent.$options.componentName !== 'ElMenu') {
- if (parent.$options.componentName === 'ElSubmenu') {
- padding += 20;
- }
- parent = parent.$parent;
- }
+ this.$el.removeEventListener('scroll', this.updatePopper);
+ this.$emit('close');
}
- return { paddingLeft: padding + 'px' };
}
- }
- };
+ },
-/***/ },
-/* 51 */
-/***/ function(module, exports) {
+ computed: {
+ sizeClass: function sizeClass() {
+ return 'el-dialog--' + this.size;
+ },
+ style: function style() {
+ return this.size === 'full' ? {} : { 'top': this.top };
+ }
+ },
- 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
+ methods: {
+ handleWrapperClick: function handleWrapperClick() {
+ if (!this.closeOnClickModal) return;
+ this.handleClose();
},
- on: {
- "mouseenter": _vm.handleMouseenter,
- "mouseleave": _vm.handleMouseleave
- }
- }, [_c('div', {
- ref: "submenu-title",
- staticClass: "el-submenu__title",
- style: (_vm.paddingStyle),
- on: {
- "click": _vm.handleClick
+ 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');
}
- }, [_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
+ },
+
+ mounted: function mounted() {
+ if (this.visible) {
+ this.rendered = true;
+ this.open();
}
- })], 2), (_vm.rootMenu.mode === 'horizontal' || (_vm.rootMenu.mode === 'vertical' && _vm.rootMenu.collapse)) ? [_c('transition', {
+ }
+ };
+
+/***/ },
+/* 14 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(21);
+
+/***/ },
+/* 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": _vm.menuTransitionName
+ "name": "dialog-fade"
}
- }, [_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', {
+ }, [_c('div', {
directives: [{
name: "show",
rawName: "v-show",
- value: (_vm.opened),
- expression: "opened"
+ value: (_vm.visible),
+ expression: "visible"
}],
- staticClass: "el-menu"
- }, [_vm._t("default")], 2)])], 2)
+ 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: []}
/***/ },
-/* 52 */
+/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _menuItem = __webpack_require__(53);
+ var _autocomplete = __webpack_require__(18);
- var _menuItem2 = _interopRequireDefault(_menuItem);
+ var _autocomplete2 = _interopRequireDefault(_autocomplete);
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);
+ _autocomplete2.default.install = function (Vue) {
+ Vue.component(_autocomplete2.default.name, _autocomplete2.default);
};
- exports.default = _menuItem2.default;
+ exports.default = _autocomplete2.default;
/***/ },
-/* 53 */
+/* 18 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(54),
+ __webpack_require__(19),
/* template */
- __webpack_require__(55),
+ __webpack_require__(27),
/* styles */
null,
/* scopeId */
@@ -36924,16 +36754,24 @@ module.exports =
/***/ },
-/* 54 */
+/* 19 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _menuMixin = __webpack_require__(50);
+ var _input = __webpack_require__(20);
- var _menuMixin2 = _interopRequireDefault(_menuMixin);
+ 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);
@@ -36964,224 +36802,189 @@ module.exports =
//
//
//
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
exports.default = {
- name: 'ElMenuItem',
+ name: 'ElAutocomplete',
- componentName: 'ElMenuItem',
+ mixins: [_emitter2.default],
- mixins: [_menuMixin2.default, _emitter2.default],
+ componentName: 'ElAutocomplete',
+
+ components: {
+ ElInput: _input2.default,
+ ElAutocompleteSuggestions: _autocompleteSuggestions2.default
+ },
+
+ directives: { Clickoutside: _clickoutside2.default },
props: {
- index: {
- type: String,
- required: true
- },
- route: {
+ props: {
type: Object,
- required: false
+ default: function _default() {
+ return {
+ label: 'value',
+ value: 'value'
+ };
+ }
},
- disabled: {
+ popperClass: String,
+ placeholder: String,
+ disabled: Boolean,
+ name: String,
+ size: String,
+ value: String,
+ autofocus: Boolean,
+ fetchSuggestions: Function,
+ triggerOnFocus: {
type: Boolean,
- required: false
- }
+ default: true
+ },
+ customItem: String,
+ icon: String,
+ onIconClick: Function
+ },
+ data: function data() {
+ return {
+ activated: false,
+ isOnComposition: false,
+ suggestions: [],
+ loading: false,
+ highlightedIndex: -1
+ };
},
+
computed: {
- active: function active() {
- return this.index === this.rootMenu.activeIndex;
+ suggestionVisible: function suggestionVisible() {
+ var suggestions = this.suggestions;
+ var isValidData = Array.isArray(suggestions) && suggestions.length > 0;
+ return (isValidData || this.loading) && this.activated;
}
},
- methods: {
- handleClick: function handleClick() {
- this.dispatch('ElMenu', 'item-click', this);
- this.$emit('click', this);
+ watch: {
+ suggestionVisible: function suggestionVisible(val) {
+ this.broadcast('ElAutocompleteSuggestions', 'visible', [val, this.$refs.input.$refs.input.offsetWidth]);
}
},
- created: function created() {
- this.parentMenu.addItem(this);
- this.rootMenu.addItem(this);
- },
- beforeDestroy: function beforeDestroy() {
- this.parentMenu.removeItem(this);
- this.rootMenu.removeItem(this);
- }
- };
-
-/***/ },
-/* 55 */
-/***/ function(module, exports) {
+ methods: {
+ getData: function getData(queryString) {
+ var _this = this;
- 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
+ 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');
+ }
+ });
},
- 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: []}
-
-/***/ },
-/* 56 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _menuItemGroup = __webpack_require__(57);
-
- 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;
-
-/***/ },
-/* 57 */
-/***/ function(module, exports, __webpack_require__) {
-
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(58),
- /* template */
- __webpack_require__(59),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
-
- module.exports = Component.exports
-
-
-/***/ },
-/* 58 */
-/***/ function(module, exports) {
-
- 'use strict';
+ 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(e) {
+ if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
+ e.preventDefault();
+ this.select(this.suggestions[this.highlightedIndex]);
+ }
+ },
+ select: function select(item) {
+ var _this2 = this;
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ 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');
- exports.default = {
- name: 'ElMenuItemGroup',
+ var highlightItem = suggestionList[index];
+ var scrollTop = suggestion.scrollTop;
+ var offsetTop = highlightItem.offsetTop;
- componentName: 'ElMenuItemGroup',
+ if (offsetTop + highlightItem.scrollHeight > scrollTop + suggestion.clientHeight) {
+ suggestion.scrollTop += highlightItem.scrollHeight;
+ }
+ if (offsetTop < scrollTop) {
+ suggestion.scrollTop -= highlightItem.scrollHeight;
+ }
- inject: ['rootMenu'],
- props: {
- title: {
- type: String
+ this.highlightedIndex = index;
}
},
- data: function data() {
- return {
- paddingLeft: 20
- };
- },
+ mounted: function mounted() {
+ var _this3 = this;
- 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;
- }
+ this.$on('item-click', function (item) {
+ _this3.select(item);
+ });
+ },
+ beforeDestroy: function beforeDestroy() {
+ this.$refs.suggestions.$destroy();
}
};
/***/ },
-/* 59 */
+/* 20 */
/***/ 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: []}
+ module.exports = __webpack_require__(11);
/***/ },
-/* 60 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _input = __webpack_require__(61);
-
- 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);
- };
+/* 21 */
+/***/ function(module, exports) {
- exports.default = _input2.default;
+ module.exports = __webpack_require__(20);
/***/ },
-/* 61 */
+/* 22 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(62),
+ __webpack_require__(23),
/* template */
- __webpack_require__(65),
+ __webpack_require__(26),
/* styles */
null,
/* scopeId */
@@ -37194,151 +36997,78 @@ module.exports =
/***/ },
-/* 62 */
+/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _emitter = __webpack_require__(15);
+ var _vuePopper = __webpack_require__(24);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
- var _calcTextareaHeight = __webpack_require__(63);
+ var _emitter = __webpack_require__(15);
- var _calcTextareaHeight2 = _interopRequireDefault(_calcTextareaHeight);
+ var _emitter2 = _interopRequireDefault(_emitter);
- var _merge = __webpack_require__(64);
+ var _scrollbar = __webpack_require__(25);
- var _merge2 = _interopRequireDefault(_merge);
+ var _scrollbar2 = _interopRequireDefault(_scrollbar);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElInput',
-
- componentName: 'ElInput',
+ components: { ElScrollbar: _scrollbar2.default },
+ mixins: [_vuePopper2.default, _emitter2.default],
- mixins: [_emitter2.default],
+ componentName: 'ElAutocompleteSuggestions',
data: function data() {
return {
- currentValue: this.value,
- textareaCalcStyle: {}
+ parent: this.$parent,
+ dropdownWidth: ''
};
},
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);
+ props: Object,
+ suggestions: Array,
+ options: {
+ default: function _default() {
+ return {
+ forceAbsolute: true,
+ gpuAcceleration: false
+ };
+ }
}
},
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]);
- }
+ select: function select(item) {
+ this.dispatch('ElAutocomplete', 'item-click', item);
}
},
- created: function created() {
- this.$on('inputSelect', this.inputSelect);
+ updated: function updated() {
+ var _this = this;
+
+ this.$nextTick(function (_) {
+ _this.updatePopper();
+ });
},
mounted: function mounted() {
- this.resizeTextarea();
+ 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;
+ });
}
}; //
//
@@ -37375,201 +37105,170 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
/***/ },
-/* 63 */
+/* 24 */
/***/ 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(targetElement) {
- var style = window.getComputedStyle(targetElement);
-
- 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(targetElement) {
- 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(targetElement),
- paddingSize = _calculateNodeStyling.paddingSize,
- borderSize = _calculateNodeStyling.borderSize,
- boxSizing = _calculateNodeStyling.boxSizing,
- contextStyle = _calculateNodeStyling.contextStyle;
-
- hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
- hiddenTextarea.value = targetElement.value || targetElement.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' };
- };
+ module.exports = __webpack_require__(13);
/***/ },
-/* 64 */
+/* 25 */
/***/ function(module, exports) {
- module.exports = __webpack_require__(12);
+ module.exports = __webpack_require__(22);
/***/ },
-/* 65 */
+/* 26 */
/***/ 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",
+ return _c('transition', {
attrs: {
- "autocomplete": _vm.autoComplete
- },
- domProps: {
- "value": _vm.currentValue
+ "name": "el-zoom-in-top"
},
on: {
- "input": _vm.handleInput,
- "focus": _vm.handleFocus,
- "blur": _vm.handleBlur
+ "after-leave": _vm.doDestroy
}
- }, '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
+ }, [_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', _vm._b({
+ ref: "input",
on: {
- "input": _vm.handleInput,
- "focus": _vm.handleFocus,
- "blur": _vm.handleBlur
+ "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; }
+ _vm.handleKeyEnter($event)
+ }, function($event) {
+ if (!('button' in $event) && _vm._k($event.keyCode, "tab", 9)) { return null; }
+ _vm.close($event)
+ }]
}
- }, 'textarea', _vm.$props))], 2)
+ }, 'el-input', _vm.$props), [(_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: []}
/***/ },
-/* 66 */
+/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _inputNumber = __webpack_require__(67);
+ var _dropdown = __webpack_require__(29);
- var _inputNumber2 = _interopRequireDefault(_inputNumber);
+ var _dropdown2 = _interopRequireDefault(_dropdown);
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);
+ _dropdown2.default.install = function (Vue) {
+ Vue.component(_dropdown2.default.name, _dropdown2.default);
};
- exports.default = _inputNumber2.default;
+ exports.default = _dropdown2.default;
/***/ },
-/* 67 */
+/* 29 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(68),
+ __webpack_require__(30),
/* template */
- __webpack_require__(70),
+ null,
/* styles */
null,
/* scopeId */
@@ -37582,345 +37281,223 @@ module.exports =
/***/ },
-/* 68 */
+/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _input = __webpack_require__(20);
+ var _clickoutside = __webpack_require__(21);
- var _input2 = _interopRequireDefault(_input);
+ var _clickoutside2 = _interopRequireDefault(_clickoutside);
- var _dom = __webpack_require__(44);
+ var _emitter = __webpack_require__(15);
- var _debounce = __webpack_require__(69);
+ var _emitter2 = _interopRequireDefault(_emitter);
- var _debounce2 = _interopRequireDefault(_debounce);
+ 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: '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;
- };
+ name: 'ElDropdown',
+
+ componentName: 'ElDropdown',
+
+ mixins: [_emitter2.default],
+
+ directives: { Clickoutside: _clickoutside2.default },
- (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
+ ElButton: _button2.default,
+ ElButtonGroup: _buttonGroup2.default
},
+
props: {
- step: {
- type: Number,
- default: 1
- },
- max: {
- type: Number,
- default: Infinity
- },
- min: {
- type: Number,
- default: -Infinity
+ trigger: {
+ type: String,
+ default: 'hover'
},
- value: {
- default: 0
+ menuAlign: {
+ type: String,
+ default: 'end'
},
- disabled: Boolean,
+ type: String,
size: String,
- controls: {
+ splitButton: Boolean,
+ hideOnClick: {
type: Boolean,
default: true
- },
- debounce: {
- type: Number,
- default: 300
}
},
+
data: function data() {
return {
- currentValue: 0
+ timeout: null,
+ visible: false
};
},
+ mounted: function mounted() {
+ this.$on('menu-item-click', this.handleMenuItemClick);
+ this.initEvent();
+ },
+
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);
- }
+ visible: function visible(val) {
+ this.broadcast('ElDropdownMenu', 'visible', val);
+ this.$emit('visible-change', val);
}
},
- 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)));
+ show: function show() {
+ var _this = this;
+
+ clearTimeout(this.timeout);
+ this.timeout = setTimeout(function () {
+ _this.visible = true;
+ }, 250);
},
- 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;
+ hide: function hide() {
+ var _this2 = this;
+
+ clearTimeout(this.timeout);
+ this.timeout = setTimeout(function () {
+ _this2.visible = false;
+ }, 150);
},
- _increase: function _increase(val, step) {
- if (typeof val !== 'number') return this.currentValue;
+ 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 precisionFactor = Math.pow(10, this.precision);
+ var triggerElm = splitButton ? this.$refs.trigger.$el : this.$slots.default[0].elm;
- return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
- },
- _decrease: function _decrease(val, step) {
- if (typeof val !== 'number') return this.currentValue;
+ if (triggerElm.disabled) return;
+ if (trigger === 'hover') {
+ triggerElm.addEventListener('mouseenter', show);
+ triggerElm.addEventListener('mouseleave', hide);
- var precisionFactor = Math.pow(10, this.precision);
+ var dropdownElm = this.$slots.dropdown[0].elm;
- 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;
+ dropdownElm.addEventListener('mouseenter', show);
+ dropdownElm.addEventListener('mouseleave', hide);
+ } else if (trigger === 'click') {
+ triggerElm.addEventListener('click', handleClick);
}
- 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);
+ handleMenuItemClick: function handleMenuItemClick(command, instance) {
+ if (this.hideOnClick) {
+ this.visible = false;
}
+ this.$emit('command', command, instance);
}
},
- created: function created() {
- var _this = this;
- this.debounceHandleInput = (0, _debounce2.default)(this.debounce, function (value) {
- _this.handleInput(value);
- });
+ 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]
+ );
}
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ };
/***/ },
-/* 69 */
+/* 31 */
/***/ function(module, exports) {
- module.exports = __webpack_require__(9);
+ module.exports = __webpack_require__(49);
/***/ },
-/* 70 */
+/* 32 */
/***/ 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: []}
+ module.exports = __webpack_require__(50);
/***/ },
-/* 71 */
+/* 33 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _radio = __webpack_require__(72);
+ var _dropdownMenu = __webpack_require__(34);
- var _radio2 = _interopRequireDefault(_radio);
+ var _dropdownMenu2 = _interopRequireDefault(_dropdownMenu);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* istanbul ignore next */
- _radio2.default.install = function (Vue) {
- Vue.component('el-radio', _radio2.default);
+ _dropdownMenu2.default.install = function (Vue) {
+ Vue.component(_dropdownMenu2.default.name, _dropdownMenu2.default);
};
- exports.default = _radio2.default;
+ exports.default = _dropdownMenu2.default;
/***/ },
-/* 72 */
+/* 34 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(73),
+ __webpack_require__(35),
/* template */
- __webpack_require__(74),
+ __webpack_require__(36),
/* styles */
null,
/* scopeId */
@@ -37933,70 +37510,48 @@ module.exports =
/***/ },
-/* 73 */
+/* 35 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _emitter = __webpack_require__(15);
+ var _vuePopper = __webpack_require__(24);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElRadio',
+ name: 'ElDropdownMenu',
- mixins: [_emitter2.default],
+ componentName: 'ElDropdownMenu',
- componentName: 'ElRadio',
+ mixins: [_vuePopper2.default],
- props: {
- value: {},
- label: {},
- disabled: Boolean,
- name: String
- },
+ created: function created() {
+ var _this = this;
- data: function data() {
- return {
- focus: false
- };
+ 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;
},
- 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);
- }
+ watch: {
+ '$parent.menuAlign': {
+ immediate: true,
+ handler: function handler(val) {
+ this.currentPlacement = 'bottom-' + val;
}
- },
-
- isDisabled: function isDisabled() {
- return this.isGroup ? this._radioGroup.disabled || this.disabled : this.disabled;
}
}
}; //
@@ -38006,105 +37561,60 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
/***/ },
-/* 74 */
+/* 36 */
/***/ 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",
+ return _c('transition', {
attrs: {
- "type": "radio",
- "name": _vm.name,
- "disabled": _vm.isDisabled
- },
- domProps: {
- "value": _vm.label,
- "checked": _vm._q(_vm.model, _vm.label)
+ "name": "el-zoom-in-top"
},
on: {
- "focus": function($event) {
- _vm.focus = true
- },
- "blur": function($event) {
- _vm.focus = false
- },
- "__c": function($event) {
- _vm.model = _vm.label
- }
+ "after-leave": _vm.doDestroy
}
- })]), _c('span', {
- staticClass: "el-radio__label"
- }, [_vm._t("default"), (!_vm.$slots.default) ? [_vm._v(_vm._s(_vm.label))] : _vm._e()], 2)])
+ }, [_c('ul', {
+ directives: [{
+ name: "show",
+ rawName: "v-show",
+ value: (_vm.showPopper),
+ expression: "showPopper"
+ }],
+ staticClass: "el-dropdown-menu"
+ }, [_vm._t("default")], 2)])
},staticRenderFns: []}
/***/ },
-/* 75 */
+/* 37 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _radioGroup = __webpack_require__(76);
+ var _dropdownItem = __webpack_require__(38);
- var _radioGroup2 = _interopRequireDefault(_radioGroup);
+ var _dropdownItem2 = _interopRequireDefault(_dropdownItem);
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);
+ _dropdownItem2.default.install = function (Vue) {
+ Vue.component(_dropdownItem2.default.name, _dropdownItem2.default);
};
- exports.default = _radioGroup2.default;
+ exports.default = _dropdownItem2.default;
/***/ },
-/* 76 */
+/* 38 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(77),
+ __webpack_require__(39),
/* template */
- __webpack_require__(78),
+ __webpack_require__(40),
/* styles */
null,
/* scopeId */
@@ -38117,7 +37627,7 @@ module.exports =
/***/ },
-/* 77 */
+/* 39 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -38131,23 +37641,19 @@ module.exports =
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElRadioGroup',
-
- componentName: 'ElRadioGroup',
+ name: 'ElDropdownItem',
mixins: [_emitter2.default],
props: {
- value: {},
- size: String,
- fill: String,
- textColor: String,
- disabled: Boolean
+ command: {},
+ disabled: Boolean,
+ divided: Boolean
},
- watch: {
- value: function value(_value) {
- this.$emit('change', _value);
- this.dispatch('ElFormItem', 'el.form.change', [this.value]);
+
+ methods: {
+ handleClick: function handleClick(e) {
+ this.dispatch('ElDropdown', 'menu-item-click', [this.command, this]);
}
}
}; //
@@ -38155,47 +37661,61 @@ module.exports =
//
//
//
+ //
+ //
+ //
+ //
+ //
+ //
+ //
/***/ },
-/* 78 */
+/* 40 */
/***/ 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"
+ 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: []}
/***/ },
-/* 79 */
+/* 41 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _radioButton = __webpack_require__(80);
+ var _menu = __webpack_require__(42);
- var _radioButton2 = _interopRequireDefault(_radioButton);
+ var _menu2 = _interopRequireDefault(_menu);
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);
+ _menu2.default.install = function (Vue) {
+ Vue.component(_menu2.default.name, _menu2.default);
};
- exports.default = _radioButton2.default;
+ exports.default = _menu2.default;
/***/ },
-/* 80 */
+/* 42 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(81),
+ __webpack_require__(43),
/* template */
- __webpack_require__(82),
+ __webpack_require__(45),
/* styles */
null,
/* scopeId */
@@ -38208,20 +37728,21 @@ module.exports =
/***/ },
-/* 81 */
-/***/ function(module, exports) {
+/* 43 */
+/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
+
+ var _emitter = __webpack_require__(15);
+
+ var _emitter2 = _interopRequireDefault(_emitter);
+
+ var _dom = __webpack_require__(44);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
//
//
//
@@ -38238,122 +37759,266 @@ module.exports =
//
exports.default = {
- name: 'ElRadioButton',
+ name: 'ElMenu',
+
+ componentName: 'ElMenu',
+
+ mixins: [_emitter2.default],
+
+ provide: function provide() {
+ return {
+ rootMenu: this
+ };
+ },
+
+
+ components: {
+ '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);
+ }
+ }
+ },
props: {
- label: {},
- disabled: Boolean,
- name: String
+ 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
},
- computed: {
- value: {
- get: function get() {
- return this._radioGroup.value;
- },
- set: function set(value) {
- this._radioGroup.$emit('input', value);
+ data: function data() {
+ return {
+ activeIndex: this.defaultActive,
+ openedMenus: this.defaultOpeneds ? this.defaultOpeneds.slice(0) : [],
+ items: {},
+ submenus: {}
+ };
+ },
+
+ watch: {
+ defaultActive: function defaultActive(value) {
+ var item = this.items[value];
+ if (item) {
+ this.activeIndex = item.index;
+ this.initOpenedMenu();
+ } else {
+ this.activeIndex = '';
}
},
- _radioGroup: function _radioGroup() {
- var parent = this.$parent;
- while (parent) {
- if (parent.$options.componentName !== 'ElRadioGroup') {
- parent = parent.$parent;
- } else {
- return parent;
- }
+ defaultOpeneds: function defaultOpeneds(value) {
+ this.openedMenus = value;
+ },
+ collapse: function collapse(value) {
+ if (value) this.openedMenus = [];
+ }
+ },
+ 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;
+ });
}
- return false;
+ this.openedMenus.push(index);
},
- 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 || ''
- };
+ closeMenu: function closeMenu(index) {
+ this.openedMenus.splice(this.openedMenus.indexOf(index), 1);
},
- size: function size() {
- return this._radioGroup.size;
+ handleSubmenuClick: function handleSubmenuClick(submenu) {
+ var index = submenu.index,
+ indexPath = submenu.indexPath;
+
+ var isOpened = this.openedMenus.indexOf(index) !== -1;
+
+ if (isOpened) {
+ this.closeMenu(index);
+ this.$emit('close', index, indexPath);
+ } else {
+ this.openMenu(index, indexPath);
+ this.$emit('open', index, indexPath);
+ }
},
- isDisabled: function isDisabled() {
- return this.disabled || this._radioGroup.disabled;
+ handleItemClick: function handleItemClick(item) {
+ var index = item.index,
+ indexPath = item.indexPath;
+
+ this.activeIndex = 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.activeIndex;
+ 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);
}
};
/***/ },
-/* 82 */
+/* 44 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(4);
+
+/***/ },
+/* 45 */
/***/ 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
- }
+ 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
}
- }), _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)])
+ }, [_vm._t("default")], 2)])
},staticRenderFns: []}
/***/ },
-/* 83 */
+/* 46 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _checkbox = __webpack_require__(84);
+ var _submenu = __webpack_require__(47);
- var _checkbox2 = _interopRequireDefault(_checkbox);
+ var _submenu2 = _interopRequireDefault(_submenu);
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);
+ _submenu2.default.install = function (Vue) {
+ Vue.component(_submenu2.default.name, _submenu2.default);
};
- exports.default = _checkbox2.default;
+ exports.default = _submenu2.default;
/***/ },
-/* 84 */
+/* 47 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(85),
+ __webpack_require__(48),
/* template */
- __webpack_require__(86),
+ __webpack_require__(51),
/* styles */
null,
/* scopeId */
@@ -38366,13 +38031,21 @@ module.exports =
/***/ },
-/* 85 */
+/* 48 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
+ var _collapseTransition = __webpack_require__(49);
+
+ var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
+
+ var _menuMixin = __webpack_require__(50);
+
+ var _menuMixin2 = _interopRequireDefault(_menuMixin);
+
var _emitter = __webpack_require__(15);
var _emitter2 = _interopRequireDefault(_emitter);
@@ -38380,99 +38053,115 @@ module.exports =
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElCheckbox',
+ name: 'ElSubmenu',
- mixins: [_emitter2.default],
+ componentName: 'ElSubmenu',
- componentName: 'ElCheckbox',
+ mixins: [_menuMixin2.default, _emitter2.default],
+
+ components: { ElCollapseTransition: _collapseTransition2.default },
+
+ props: {
+ index: {
+ type: String,
+ required: true
+ }
+ },
data: function data() {
return {
- selfModel: false,
- focus: false
+ timeout: null,
+ items: {},
+ submenus: {}
};
},
-
computed: {
- model: {
+ 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() {
- 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);
+ var isActive = false;
+ var submenus = this.submenus;
+ var items = this.items;
- this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (isLimitExceeded = true);
+ Object.keys(items).forEach(function (index) {
+ if (items[index].active) {
+ isActive = true;
+ }
+ });
- isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
- } else {
- this.$emit('input', val);
- this.selfModel = val;
- }
- }
- },
+ Object.keys(submenus).forEach(function (index) {
+ if (submenus[index].active) {
+ isActive = true;
+ }
+ });
- 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;
+ return isActive;
}
+ }
+ },
+ methods: {
+ addItem: function addItem(item) {
+ this.$set(this.items, item.index, item);
},
- isGroup: function isGroup() {
- var parent = this.$parent;
- while (parent) {
- if (parent.$options.componentName !== 'ElCheckboxGroup') {
- parent = parent.$parent;
- } else {
- this._checkboxGroup = parent;
- return true;
- }
+ 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;
}
- return false;
+ this.dispatch('ElMenu', 'submenu-click', this);
},
- store: function store() {
- return this._checkboxGroup ? this._checkboxGroup.value : this.value;
- }
- },
+ handleMouseenter: function handleMouseenter() {
+ var _this = this;
- props: {
- value: {},
- label: {},
- indeterminate: Boolean,
- disabled: Boolean,
- checked: Boolean,
- name: String,
- trueLabel: [String, Number],
- falseLabel: [String, Number]
- },
+ var rootMenu = this.rootMenu;
- 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;
+ 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);
},
- handleChange: function handleChange(ev) {
- var _this = this;
+ handleMouseleave: function handleMouseleave() {
+ var _this2 = this;
- this.$emit('change', ev);
- if (this.isGroup) {
- this.$nextTick(function (_) {
- _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
- });
+ 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);
+ }, 300);
}
},
-
created: function created() {
- this.checked && this.addToStore();
+ this.parentMenu.addSubmenu(this);
+ this.rootMenu.addSubmenu(this);
+ },
+ beforeDestroy: function beforeDestroy() {
+ this.parentMenu.removeSubmenu(this);
+ this.rootMenu.removeSubmenu(this);
}
}; //
//
@@ -38504,155 +38193,150 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
/***/ },
-/* 86 */
+/* 49 */
/***/ 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
+ module.exports = __webpack_require__(51);
+
+/***/ },
+/* 50 */
+/***/ 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;
}
- }
- }) : _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
+ return path;
},
- domProps: {
- "value": _vm.label,
- "checked": Array.isArray(_vm.model) ? _vm._i(_vm.model, _vm.label) > -1 : (_vm.model)
+ rootMenu: function rootMenu() {
+ var parent = this.$parent;
+ while (parent && parent.$options.componentName !== 'ElMenu') {
+ parent = parent.$parent;
+ }
+ return parent;
},
- 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)))
+ 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;
}
- } else {
- _vm.model = $$c
+ parent = parent.$parent;
}
}
+ return { paddingLeft: padding + 'px' };
}
- })]), (_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()])
+ }
+ };
+
+/***/ },
+/* 51 */
+/***/ 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: []}
/***/ },
-/* 87 */
+/* 52 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _checkboxButton = __webpack_require__(88);
+ var _menuItem = __webpack_require__(53);
- var _checkboxButton2 = _interopRequireDefault(_checkboxButton);
+ var _menuItem2 = _interopRequireDefault(_menuItem);
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);
+ _menuItem2.default.install = function (Vue) {
+ Vue.component(_menuItem2.default.name, _menuItem2.default);
};
- exports.default = _checkboxButton2.default;
+ exports.default = _menuItem2.default;
/***/ },
-/* 88 */
+/* 53 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(89),
+ __webpack_require__(54),
/* template */
- __webpack_require__(90),
+ __webpack_require__(55),
/* styles */
null,
/* scopeId */
@@ -38665,140 +38349,23 @@ module.exports =
/***/ },
-/* 89 */
+/* 54 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
+ var _menuMixin = __webpack_require__(50);
+
+ 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: '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();
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
//
//
//
@@ -38823,142 +38390,114 @@ module.exports =
//
//
+ 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.activeIndex;
+ }
+ },
+ 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);
+ }
+ };
+
/***/ },
-/* 90 */
+/* 55 */
/***/ 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)
+ return _c('li', {
+ staticClass: "el-menu-item",
+ class: {
+ 'is-active': _vm.active,
+ 'is-disabled': _vm.disabled
},
+ style: (_vm.paddingStyle),
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
- }
- }
+ "click": _vm.handleClick
}
- }) : _c('input', {
- directives: [{
- name: "model",
- rawName: "v-model",
- value: (_vm.model),
- expression: "model"
- }],
- staticClass: "el-checkbox-button__original",
+ }, [(_vm.$parent === _vm.rootMenu && _vm.rootMenu.collapse) ? _c('el-tooltip', {
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
- }
- }
+ "effect": "dark",
+ "placement": "right"
}
- }), (_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()])
+ }, [_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: []}
/***/ },
-/* 91 */
+/* 56 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _checkboxGroup = __webpack_require__(92);
+ var _menuItemGroup = __webpack_require__(57);
- var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
+ var _menuItemGroup2 = _interopRequireDefault(_menuItemGroup);
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);
+ _menuItemGroup2.default.install = function (Vue) {
+ Vue.component(_menuItemGroup2.default.name, _menuItemGroup2.default);
};
- exports.default = _checkboxGroup2.default;
+ exports.default = _menuItemGroup2.default;
/***/ },
-/* 92 */
+/* 57 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(93),
+ __webpack_require__(58),
/* template */
- __webpack_require__(94),
+ __webpack_require__(59),
/* styles */
null,
/* scopeId */
@@ -38971,82 +38510,103 @@ module.exports =
/***/ },
-/* 93 */
-/***/ function(module, exports, __webpack_require__) {
+/* 58 */
+/***/ function(module, exports) {
'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',
+ name: 'ElMenuItemGroup',
- mixins: [_emitter2.default],
+ componentName: 'ElMenuItemGroup',
+ inject: ['rootMenu'],
props: {
- value: {},
- min: Number,
- max: Number,
- size: String,
- fill: String,
- textColor: String
+ title: {
+ type: String
+ }
+ },
+ data: function data() {
+ return {
+ paddingLeft: 20
+ };
},
- watch: {
- value: function value(_value) {
- this.dispatch('ElFormItem', 'el.form.change', [_value]);
+ 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;
}
}
};
/***/ },
-/* 94 */
+/* 59 */
/***/ 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)
+ 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: []}
/***/ },
-/* 95 */
+/* 60 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _component = __webpack_require__(96);
+ var _input = __webpack_require__(61);
- var _component2 = _interopRequireDefault(_component);
+ var _input2 = _interopRequireDefault(_input);
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);
+ _input2.default.install = function (Vue) {
+ Vue.component(_input2.default.name, _input2.default);
};
- exports.default = _component2.default;
+ exports.default = _input2.default;
/***/ },
-/* 96 */
+/* 61 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(97),
+ __webpack_require__(62),
/* template */
- __webpack_require__(98),
+ __webpack_require__(65),
/* styles */
null,
/* scopeId */
@@ -39059,326 +38619,153 @@ module.exports =
/***/ },
-/* 97 */
-/***/ function(module, exports) {
+/* 62 */
+/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+
+ var _emitter = __webpack_require__(15);
+
+ var _emitter2 = _interopRequireDefault(_emitter);
+
+ var _calcTextareaHeight = __webpack_require__(63);
+
+ var _calcTextareaHeight2 = _interopRequireDefault(_calcTextareaHeight);
+
+ var _merge = __webpack_require__(64);
+
+ var _merge2 = _interopRequireDefault(_merge);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElSwitch',
+ name: 'ElInput',
+
+ componentName: 'ElInput',
+
+ mixins: [_emitter2.default],
+
+ data: function data() {
+ return {
+ currentValue: this.value,
+ textareaCalcStyle: {}
+ };
+ },
+
+
props: {
- value: {
- type: [Boolean, String, Number],
- default: false
+ value: [String, Number],
+ placeholder: String,
+ size: String,
+ resize: String,
+ readonly: Boolean,
+ autofocus: Boolean,
+ icon: String,
+ disabled: Boolean,
+ type: {
+ type: String,
+ default: 'text'
},
- disabled: {
- type: Boolean,
+ name: String,
+ autosize: {
+ type: [Boolean, Object],
default: false
},
- width: {
+ rows: {
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: ''
+ default: 2
},
- offColor: {
+ autoComplete: {
type: String,
- default: ''
+ default: 'off'
},
- onValue: {
- type: [Boolean, String, Number],
+ form: String,
+ maxlength: Number,
+ minlength: Number,
+ max: {},
+ min: {},
+ step: {},
+ validateEvent: {
+ type: Boolean,
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);
- }
+ onIconClick: Function
},
computed: {
- checked: function checked() {
- return this.value === this.onValue;
- },
- hasText: function hasText() {
- /* istanbul ignore next */
- return this.onText || this.offText;
+ validating: function validating() {
+ return this.$parent.validateState === 'validating';
},
- transform: function transform() {
- return this.checked ? 'translate(' + (this.coreWidth - 20) + 'px, 2px)' : 'translate(2px, 2px)';
+ textareaStyle: function textareaStyle() {
+ return (0, _merge2.default)({}, this.textareaCalcStyle, { resize: this.resize });
}
},
+
watch: {
- checked: function checked() {
- this.$refs.input.checked = this.checked;
- if (this.onColor || this.offColor) {
- this.setBackgroundColor();
- }
+ 'value': function value(val, oldValue) {
+ this.setCurrentValue(val);
}
},
+
methods: {
- handleChange: function handleChange(event) {
+ 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;
- this.$emit('input', !this.checked ? this.onValue : this.offValue);
- this.$emit('change', !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;
+ if (value === this.currentValue) return;
+ this.$nextTick(function (_) {
+ _this.resizeTextarea();
});
- },
- setBackgroundColor: function setBackgroundColor() {
- var newColor = this.checked ? this.onColor : this.offColor;
- this.$refs.core.style.borderColor = newColor;
- this.$refs.core.style.backgroundColor = newColor;
+ this.currentValue = value;
+ if (this.validateEvent) {
+ this.dispatch('ElFormItem', 'el.form.change', [value]);
+ }
}
},
+
+ created: function created() {
+ this.$on('inputSelect', this.inputSelect);
+ },
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;
+ this.resizeTextarea();
}
- };
-
-/***/ },
-/* 98 */
-/***/ 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: []}
-
-/***/ },
-/* 99 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _select = __webpack_require__(100);
-
- 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;
-
-/***/ },
-/* 100 */
-/***/ function(module, exports, __webpack_require__) {
-
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(101),
- /* template */
- __webpack_require__(113),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
-
- module.exports = Component.exports
-
-
-/***/ },
-/* 101 */
-/***/ 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; }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ }; //
//
//
//
@@ -39436,665 +38823,529 @@ module.exports =
//
//
- var _emitter = __webpack_require__(15);
-
- var _emitter2 = _interopRequireDefault(_emitter);
-
- var _locale = __webpack_require__(10);
+/***/ },
+/* 63 */
+/***/ function(module, exports) {
- var _locale2 = _interopRequireDefault(_locale);
+ 'use strict';
- var _input = __webpack_require__(20);
+ exports.__esModule = true;
+ exports.default = calcTextareaHeight;
+ var hiddenTextarea = void 0;
- var _input2 = _interopRequireDefault(_input);
+ 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 _selectDropdown = __webpack_require__(102);
+ 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'];
- var _selectDropdown2 = _interopRequireDefault(_selectDropdown);
+ function calculateNodeStyling(targetElement) {
+ var style = window.getComputedStyle(targetElement);
- var _option = __webpack_require__(105);
+ var boxSizing = style.getPropertyValue('box-sizing');
- var _option2 = _interopRequireDefault(_option);
+ var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
- var _tag = __webpack_require__(109);
+ var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
- var _tag2 = _interopRequireDefault(_tag);
+ var contextStyle = CONTEXT_STYLE.map(function (name) {
+ return name + ':' + style.getPropertyValue(name);
+ }).join(';');
- var _scrollbar = __webpack_require__(25);
+ return { contextStyle: contextStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing };
+ }
- var _scrollbar2 = _interopRequireDefault(_scrollbar);
+ function calcTextareaHeight(targetElement) {
+ var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
+ var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
- var _debounce = __webpack_require__(69);
+ if (!hiddenTextarea) {
+ hiddenTextarea = document.createElement('textarea');
+ document.body.appendChild(hiddenTextarea);
+ }
- var _debounce2 = _interopRequireDefault(_debounce);
+ var _calculateNodeStyling = calculateNodeStyling(targetElement),
+ paddingSize = _calculateNodeStyling.paddingSize,
+ borderSize = _calculateNodeStyling.borderSize,
+ boxSizing = _calculateNodeStyling.boxSizing,
+ contextStyle = _calculateNodeStyling.contextStyle;
- var _clickoutside = __webpack_require__(21);
+ hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
+ hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ var height = hiddenTextarea.scrollHeight;
- var _dom = __webpack_require__(44);
+ if (boxSizing === 'border-box') {
+ height = height + borderSize;
+ } else if (boxSizing === 'content-box') {
+ height = height - paddingSize;
+ }
- var _resizeEvent = __webpack_require__(110);
+ hiddenTextarea.value = '';
+ var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
- var _locale3 = __webpack_require__(111);
+ 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);
+ }
- var _scrollIntoView = __webpack_require__(112);
+ return { height: height + 'px' };
+ };
- var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
+/***/ },
+/* 64 */
+/***/ function(module, exports) {
- var _util = __webpack_require__(107);
+ module.exports = __webpack_require__(12);
+
+/***/ },
+/* 65 */
+/***/ 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: []}
+
+/***/ },
+/* 66 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var _inputNumber = __webpack_require__(67);
+
+ var _inputNumber2 = _interopRequireDefault(_inputNumber);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var sizeMap = {
- 'large': 42,
- 'small': 30,
- 'mini': 22
+ /* istanbul ignore next */
+ _inputNumber2.default.install = function (Vue) {
+ Vue.component(_inputNumber2.default.name, _inputNumber2.default);
};
- exports.default = {
- mixins: [_emitter2.default, _locale2.default],
+ exports.default = _inputNumber2.default;
- name: 'ElSelect',
+/***/ },
+/* 67 */
+/***/ function(module, exports, __webpack_require__) {
- componentName: 'ElSelect',
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(68),
+ /* template */
+ __webpack_require__(70),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- 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;
+ module.exports = Component.exports
- 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;
+
+/***/ },
+/* 68 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var _input = __webpack_require__(20);
+
+ var _input2 = _interopRequireDefault(_input);
+
+ var _dom = __webpack_require__(44);
+
+ var _debounce = __webpack_require__(69);
+
+ 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,
- ElSelectMenu: _selectDropdown2.default,
- ElOption: _option2.default,
- ElTag: _tag2.default,
- ElScrollbar: _scrollbar2.default
+ ElInput: _input2.default
},
-
- directives: { Clickoutside: _clickoutside2.default },
-
props: {
- name: String,
- value: {
- required: true
+ step: {
+ type: Number,
+ default: 1
},
- 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: {
+ max: {
+ type: Number,
+ default: Infinity
+ },
+ min: {
type: Number,
+ default: -Infinity
+ },
+ value: {
default: 0
},
- placeholder: {
- type: String,
- default: function _default() {
- return (0, _locale3.t)('el.select.placeholder');
- }
+ disabled: Boolean,
+ size: String,
+ controls: {
+ type: Boolean,
+ default: true
},
- defaultFirstOption: Boolean,
- valueKey: {
- type: String,
- default: 'value'
+ debounce: {
+ type: Number,
+ default: 300
}
},
-
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: ''
+ currentValue: 0
};
},
-
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;
+ 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);
}
- this.$emit('change', val);
- this.dispatch('ElFormItem', 'el.form.change', val);
+ }
+ },
+ computed: {
+ minDisabled: function minDisabled() {
+ return this._decrease(this.value, this.step) < this.min;
},
- 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();
- }
+ maxDisabled: function maxDisabled() {
+ return this._increase(this.value, this.step) > this.max;
},
- visible: function visible(val) {
- var _this3 = this;
+ precision: function precision() {
+ var value = this.value,
+ step = this.step,
+ getPrecision = this.getPrecision;
- 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();
- }
+ return Math.max(getPrecision(value), getPrecision(step));
}
},
-
methods: {
- handleIconHide: function handleIconHide() {
- var icon = this.$el.querySelector('.el-input__icon');
- if (icon) {
- (0, _dom.removeClass)(icon, 'is-reverse');
- }
+ toPrecision: function toPrecision(num, precision) {
+ if (precision === undefined) precision = this.precision;
+ return parseFloat(parseFloat(Number(num).toFixed(precision)));
},
- 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');
+ 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;
},
- scrollToOption: function scrollToOption(option) {
- var target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
- if (this.$refs.popper && target) {
- var menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
- (0, _scrollIntoView2.default)(menu, target);
- }
+ _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);
},
- handleMenuEnter: function handleMenuEnter() {
- var _this4 = this;
+ _decrease: function _decrease(val, step) {
+ if (typeof val !== 'number') return this.currentValue;
- this.$nextTick(function () {
- return _this4.scrollToOption(_this4.selected);
- });
+ var precisionFactor = Math.pow(10, this.precision);
+
+ return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
},
- getOption: function getOption(value) {
- var option = void 0;
- var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
- 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;
+ 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);
},
- 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;
+ 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;
}
- var result = [];
- if (Array.isArray(this.value)) {
- this.value.forEach(function (value) {
- result.push(_this5.getOption(value));
- });
+ this.$emit('change', newVal, oldVal);
+ this.$emit('input', newVal);
+ this.currentValue = newVal;
+ },
+ handleInput: function handleInput(value) {
+ if (value === '') {
+ return;
}
- 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);
+ var newVal = Number(value);
+ if (!isNaN(newVal)) {
+ this.setCurrentValue(newVal);
} 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;
+ this.$refs.input.setCurrentValue(this.currentValue);
}
- },
- 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;
+ }
+ },
+ created: function created() {
+ var _this = 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(option);
- });
- },
- getValueIndex: function getValueIndex() {
- var _this9 = this;
+ this.debounceHandleInput = (0, _debounce2.default)(this.debounce, function (value) {
+ _this.handleInput(value);
+ });
+ }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- var value = arguments[1];
+/***/ },
+/* 69 */
+/***/ function(module, exports) {
- var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
- 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
- };
- }();
+ module.exports = __webpack_require__(9);
- 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;
+/***/ },
+/* 70 */
+/***/ function(module, exports) {
- 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(_this10.options[_this10.hoverIndex]);
- });
- },
- 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);
+ 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
}
- 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();
+ ]
+ }, [(_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
},
- 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;
- }
- }
- }
+ on: {
+ "blur": _vm.handleBlur,
+ "input": _vm.debounceHandleInput
},
- 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);
- }
+ 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: []}
- created: function created() {
- var _this11 = this;
+/***/ },
+/* 71 */
+/***/ function(module, exports, __webpack_require__) {
- 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();
+ 'use strict';
- this.debouncedOnInputChange = (0, _debounce2.default)(this.debounce, function () {
- _this11.onInputChange();
- });
+ exports.__esModule = true;
- this.$on('handleOptionClick', this.handleOptionSelect);
- this.$on('onOptionDestroy', this.onOptionDestroy);
- this.$on('setSelected', this.setSelected);
- },
- mounted: function mounted() {
- var _this12 = this;
+ var _radio = __webpack_require__(72);
- 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);
- }
+ 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;
+
/***/ },
-/* 102 */
+/* 72 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(103),
+ __webpack_require__(73),
/* template */
- __webpack_require__(104),
+ __webpack_require__(74),
/* styles */
null,
/* scopeId */
@@ -40107,73 +39358,71 @@ module.exports =
/***/ },
-/* 103 */
+/* 73 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _vuePopper = __webpack_require__(24);
+ var _emitter = __webpack_require__(15);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+ var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElSelectDropdown',
+ name: 'ElRadio',
- componentName: 'ElSelectDropdown',
+ mixins: [_emitter2.default],
- mixins: [_vuePopper2.default],
+ componentName: 'ElRadio',
props: {
- placement: {
- default: 'bottom-start'
- },
-
- boundariesPadding: {
- default: 0
- },
-
- popperOptions: {
- default: function _default() {
- return {
- forceAbsolute: true,
- gpuAcceleration: false
- };
- }
- }
+ value: {},
+ label: {},
+ disabled: Boolean,
+ name: String
},
data: function data() {
return {
- minWidth: ''
+ focus: false
};
},
computed: {
- popperClass: function popperClass() {
- return this.$parent.popperClass;
- }
- },
+ 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;
+ },
- watch: {
- '$parent.inputWidth': function $parentInputWidth() {
- this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
- }
- },
- mounted: function mounted() {
- var _this = this;
+ 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);
+ }
+ }
+ },
- 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);
+ isDisabled: function isDisabled() {
+ return this.isGroup ? this._radioGroup.disabled || this.disabled : this.disabled;
+ }
}
}; //
//
@@ -40184,52 +39433,6 @@ module.exports =
//
//
//
-
-/***/ },
-/* 104 */
-/***/ 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: []}
-
-/***/ },
-/* 105 */
-/***/ function(module, exports, __webpack_require__) {
-
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(106),
- /* template */
- __webpack_require__(108),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
-
- module.exports = Component.exports
-
-
-/***/ },
-/* 106 */
-/***/ 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; }; //
//
//
//
@@ -40246,472 +39449,87 @@ module.exports =
//
//
//
-
- var _emitter = __webpack_require__(15);
-
- var _emitter2 = _interopRequireDefault(_emitter);
-
- var _util = __webpack_require__(107);
-
- 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() {
- return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
- },
- 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);
- }
- };
-
-/***/ },
-/* 107 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(6);
+ //
/***/ },
-/* 108 */
+/* 74 */
/***/ 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",
+ return _c('label', {
+ staticClass: "el-radio"
+ }, [_c('span', {
+ staticClass: "el-radio__input",
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: []}
-
-/***/ },
-/* 109 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(26);
-
-/***/ },
-/* 110 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(15);
-
-/***/ },
-/* 111 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(16);
-
-/***/ },
-/* 112 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(23);
-
-/***/ },
-/* 113 */
-/***/ 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
+ 'is-disabled': _vm.isDisabled,
+ 'is-checked': _vm.model === _vm.label,
+ 'is-focus': _vm.focus
}
- }, _vm._l((_vm.selected), function(item) {
- return _c('el-tag', {
- key: _vm.getValueKey(item),
- attrs: {
- "closable": !_vm.disabled,
- "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', {
+ }, [_c('span', {
+ staticClass: "el-radio__inner"
+ }), _c('input', {
directives: [{
name: "model",
rawName: "v-model",
- value: (_vm.query),
- expression: "query"
+ value: (_vm.model),
+ expression: "model"
}],
- ref: "input",
- staticClass: "el-select__input",
- class: ("is-" + _vm.size),
- style: ({
- width: _vm.inputLength + 'px',
- 'max-width': _vm.inputWidth - 42 + 'px'
- }),
+ staticClass: "el-radio__original",
attrs: {
- "type": "text",
- "disabled": _vm.disabled,
- "debounce": _vm.remote ? 300 : 0
+ "type": "radio",
+ "name": _vm.name,
+ "disabled": _vm.isDisabled
},
domProps: {
- "value": (_vm.query)
+ "value": _vm.label,
+ "checked": _vm._q(_vm.model, _vm.label)
},
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)
+ _vm.focus = true
},
- "mouseenter": function($event) {
- _vm.inputHovering = true
+ "blur": function($event) {
+ _vm.focus = false
},
- "mouseleave": function($event) {
- _vm.inputHovering = false
+ "__c": function($event) {
+ _vm.model = _vm.label
}
- },
- 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)
+ })]), _c('span', {
+ staticClass: "el-radio__label"
+ }, [_vm._t("default"), (!_vm.$slots.default) ? [_vm._v(_vm._s(_vm.label))] : _vm._e()], 2)])
},staticRenderFns: []}
/***/ },
-/* 114 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _option = __webpack_require__(105);
-
- 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;
-
-/***/ },
-/* 115 */
+/* 75 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _optionGroup = __webpack_require__(116);
+ var _radioGroup = __webpack_require__(76);
- var _optionGroup2 = _interopRequireDefault(_optionGroup);
+ var _radioGroup2 = _interopRequireDefault(_radioGroup);
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);
+ _radioGroup2.default.install = function (Vue) {
+ Vue.component(_radioGroup2.default.name, _radioGroup2.default);
};
- exports.default = _optionGroup2.default;
+ exports.default = _radioGroup2.default;
/***/ },
-/* 116 */
+/* 76 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(117),
+ __webpack_require__(77),
/* template */
- __webpack_require__(118),
+ __webpack_require__(78),
/* styles */
null,
/* scopeId */
@@ -40724,7 +39542,7 @@ module.exports =
/***/ },
-/* 117 */
+/* 77 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -40738,47 +39556,23 @@ module.exports =
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- mixins: [_emitter2.default],
+ name: 'ElRadioGroup',
- name: 'ElOptionGroup',
+ componentName: 'ElRadioGroup',
- componentName: 'ElOptionGroup',
+ mixins: [_emitter2.default],
props: {
- label: String,
- disabled: {
- type: Boolean,
- default: false
- }
- },
-
- data: function data() {
- return {
- visible: true
- };
+ value: {},
+ size: String,
+ fill: String,
+ textColor: String,
+ disabled: Boolean
},
-
-
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);
+ value: function value(_value) {
+ this.$emit('change', _value);
+ this.dispatch('ElFormItem', 'el.form.change', [this.value]);
}
}
}; //
@@ -40786,63 +39580,47 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
/***/ },
-/* 118 */
+/* 78 */
/***/ 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)])])
+ return _c('div', {
+ staticClass: "el-radio-group"
+ }, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
-/* 119 */
+/* 79 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _button = __webpack_require__(120);
+ var _radioButton = __webpack_require__(80);
- var _button2 = _interopRequireDefault(_button);
+ var _radioButton2 = _interopRequireDefault(_radioButton);
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);
+ _radioButton2.default.install = function (Vue) {
+ Vue.component(_radioButton2.default.name, _radioButton2.default);
};
- exports.default = _button2.default;
+ exports.default = _radioButton2.default;
/***/ },
-/* 120 */
+/* 80 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(121),
+ __webpack_require__(81),
/* template */
- __webpack_require__(122),
+ __webpack_require__(82),
/* styles */
null,
/* scopeId */
@@ -40855,7 +39633,7 @@ module.exports =
/***/ },
-/* 121 */
+/* 81 */
/***/ function(module, exports) {
'use strict';
@@ -40881,112 +39659,126 @@ module.exports =
//
//
//
+ //
+ //
exports.default = {
- name: 'ElButton',
+ name: 'ElRadioButton',
props: {
- type: {
- type: String,
- default: 'default'
- },
- size: String,
- icon: {
- type: String,
- default: ''
- },
- nativeType: {
- type: String,
- default: 'button'
- },
- loading: Boolean,
+ label: {},
disabled: Boolean,
- plain: Boolean,
- autofocus: Boolean
+ name: String
},
-
- methods: {
- handleClick: function handleClick(evt) {
- this.$emit('click', evt);
+ computed: {
+ value: {
+ get: function get() {
+ return this._radioGroup.value;
+ },
+ set: function set(value) {
+ this._radioGroup.$emit('input', value);
+ }
},
- handleInnerClick: function handleInnerClick(evt) {
- if (this.disabled) {
- evt.stopPropagation();
+ _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;
}
}
};
/***/ },
-/* 122 */
+/* 82 */
/***/ 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",
+ return _c('label', {
+ staticClass: "el-radio-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
+ _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: {
- "disabled": _vm.disabled,
- "autofocus": _vm.autofocus,
- "type": _vm.nativeType
+ "type": "radio",
+ "name": _vm.name,
+ "disabled": _vm.isDisabled
+ },
+ domProps: {
+ "value": _vm.label,
+ "checked": _vm._q(_vm.value, _vm.label)
},
on: {
- "click": _vm.handleClick
- }
- }, [(_vm.loading) ? _c('i', {
- staticClass: "el-icon-loading",
- on: {
- "click": _vm.handleInnerClick
- }
- }) : _vm._e(), (_vm.icon && !_vm.loading) ? _c('i', {
- class: 'el-icon-' + _vm.icon,
- on: {
- "click": _vm.handleInnerClick
- }
- }) : _vm._e(), (_vm.$slots.default) ? _c('span', {
- on: {
- "click": _vm.handleInnerClick
+ "__c": function($event) {
+ _vm.value = _vm.label
+ }
}
- }, [_vm._t("default")], 2) : _vm._e()])
+ }), _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: []}
/***/ },
-/* 123 */
+/* 83 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _buttonGroup = __webpack_require__(124);
+ var _checkbox = __webpack_require__(84);
- var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
+ var _checkbox2 = _interopRequireDefault(_checkbox);
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);
+ _checkbox2.default.install = function (Vue) {
+ Vue.component(_checkbox2.default.name, _checkbox2.default);
};
- exports.default = _buttonGroup2.default;
+ exports.default = _checkbox2.default;
/***/ },
-/* 124 */
+/* 84 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(125),
+ __webpack_require__(85),
/* template */
- __webpack_require__(126),
+ __webpack_require__(86),
/* styles */
null,
/* scopeId */
@@ -40999,230 +39791,115 @@ module.exports =
/***/ },
-/* 125 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- exports.__esModule = true;
- //
- //
- //
- //
- //
-
- /**
- * button
- * @module components/basic/menu
- * @desc 用于按钮组
- * @param {string} label - 名称
- */
- exports.default = {
- name: 'ElButtonGroup'
- };
-
-/***/ },
-/* 126 */
-/***/ 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: []}
-
-/***/ },
-/* 127 */
+/* 85 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _table = __webpack_require__(128);
+ var _emitter = __webpack_require__(15);
- var _table2 = _interopRequireDefault(_table);
+ var _emitter2 = _interopRequireDefault(_emitter);
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;
-
-/***/ },
-/* 128 */
-/***/ function(module, exports, __webpack_require__) {
-
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(129),
- /* template */
- __webpack_require__(146),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
-
- module.exports = Component.exports
-
-
-/***/ },
-/* 129 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _checkbox = __webpack_require__(130);
-
- var _checkbox2 = _interopRequireDefault(_checkbox);
-
- var _throttle = __webpack_require__(131);
-
- var _throttle2 = _interopRequireDefault(_throttle);
-
- var _debounce = __webpack_require__(69);
-
- var _debounce2 = _interopRequireDefault(_debounce);
-
- var _resizeEvent = __webpack_require__(110);
-
- var _locale = __webpack_require__(10);
-
- var _locale2 = _interopRequireDefault(_locale);
-
- var _tableStore = __webpack_require__(132);
+ exports.default = {
+ name: 'ElCheckbox',
- var _tableStore2 = _interopRequireDefault(_tableStore);
+ mixins: [_emitter2.default],
- var _tableLayout = __webpack_require__(135);
+ componentName: 'ElCheckbox',
- var _tableLayout2 = _interopRequireDefault(_tableLayout);
+ data: function data() {
+ return {
+ selfModel: false,
+ focus: false
+ };
+ },
- var _tableBody = __webpack_require__(137);
- var _tableBody2 = _interopRequireDefault(_tableBody);
+ 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);
- var _tableHeader = __webpack_require__(139);
+ this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (isLimitExceeded = true);
- var _tableHeader2 = _interopRequireDefault(_tableHeader);
+ isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
+ } else {
+ this.$emit('input', val);
+ this.selfModel = val;
+ }
+ }
+ },
- var _tableFooter = __webpack_require__(145);
+ 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;
+ }
+ },
- var _tableFooter2 = _interopRequireDefault(_tableFooter);
+ props: {
+ value: {},
+ label: {},
+ indeterminate: Boolean,
+ disabled: Boolean,
+ checked: Boolean,
+ name: String,
+ trueLabel: [String, Number],
+ falseLabel: [String, Number]
+ },
- var _util = __webpack_require__(134);
+ 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;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ this.$emit('change', ev);
+ if (this.isGroup) {
+ this.$nextTick(function (_) {
+ _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
+ });
+ }
+ }
+ },
- var tableIdSeed = 1; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ created: function created() {
+ this.checked && this.addToStore();
+ }
+ }; //
//
//
//
@@ -41264,2024 +39941,2202 @@ module.exports =
//
//
- exports.default = {
- name: 'ElTable',
-
- mixins: [_locale2.default],
+/***/ },
+/* 86 */
+/***/ function(module, exports) {
- props: {
- data: {
- type: Array,
- default: function _default() {
- return [];
+ 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
},
-
- width: [String, Number],
-
- height: [String, Number],
-
- maxHeight: [String, Number],
-
- fit: {
- type: Boolean,
- default: true
+ 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: []}
- stripe: Boolean,
+/***/ },
+/* 87 */
+/***/ function(module, exports, __webpack_require__) {
- border: Boolean,
+ 'use strict';
- rowKey: [String, Function],
+ exports.__esModule = true;
- context: {},
+ var _checkboxButton = __webpack_require__(88);
- showHeader: {
- type: Boolean,
- default: true
- },
+ var _checkboxButton2 = _interopRequireDefault(_checkboxButton);
- showSummary: Boolean,
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- sumText: String,
+ /* istanbul ignore next */
+ _checkboxButton2.default.install = function (Vue) {
+ Vue.component(_checkboxButton2.default.name, _checkboxButton2.default);
+ };
- summaryMethod: Function,
+ exports.default = _checkboxButton2.default;
- rowClassName: [String, Function],
+/***/ },
+/* 88 */
+/***/ function(module, exports, __webpack_require__) {
- rowStyle: [Object, Function],
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(89),
+ /* template */
+ __webpack_require__(90),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- highlightCurrentRow: Boolean,
+ module.exports = Component.exports
- currentRowKey: [String, Number],
- emptyText: String,
+/***/ },
+/* 89 */
+/***/ function(module, exports, __webpack_require__) {
- expandRowKeys: Array,
+ 'use strict';
- defaultExpandAll: Boolean,
+ exports.__esModule = true;
- defaultSort: Object,
+ var _emitter = __webpack_require__(15);
- tooltipEffect: String
- },
+ var _emitter2 = _interopRequireDefault(_emitter);
- components: {
- TableHeader: _tableHeader2.default,
- TableFooter: _tableFooter2.default,
- TableBody: _tableBody2.default,
- ElCheckbox: _checkbox2.default
- },
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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;
+ exports.default = {
+ name: 'ElCheckboxButton',
- var _$refs = this.$refs,
- headerWrapper = _$refs.headerWrapper,
- footerWrapper = _$refs.footerWrapper;
+ mixins: [_emitter2.default],
- 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;
- });
+ data: function data() {
+ return {
+ selfModel: false,
+ focus: false
+ };
+ },
- var scrollBodyWrapper = function scrollBodyWrapper(event) {
- var deltaX = event.deltaX,
- deltaY = event.deltaY;
+ 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);
- if (Math.abs(deltaX) < Math.abs(deltaY)) return;
+ this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (isLimitExceeded = true);
- if (deltaX > 0) {
- _this.bodyWrapper.scrollLeft += 10;
- } else if (deltaX < 0) {
- _this.bodyWrapper.scrollLeft -= 10;
+ isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
+ } else if (this.value !== undefined) {
+ this.$emit('input', val);
+ } else {
+ this.selfModel = val;
}
- };
- 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);
+ 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;
}
},
- 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();
- }
- if (_this2.$el) {
- _this2.isHidden = _this2.$el.clientWidth === 0;
+ _checkboxGroup: function _checkboxGroup() {
+ var parent = this.$parent;
+ while (parent) {
+ if (parent.$options.componentName !== 'ElCheckboxGroup') {
+ parent = parent.$parent;
+ } else {
+ return parent;
}
- });
- }
- },
-
- 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;
+ return false;
},
- bodyWidth: function bodyWidth() {
- var _layout = this.layout,
- bodyWidth = _layout.bodyWidth,
- scrollY = _layout.scrollY,
- gutterWidth = _layout.gutterWidth;
-
- return bodyWidth ? bodyWidth - (scrollY ? gutterWidth : 0) + 'px' : '';
+ store: function store() {
+ return this._checkboxGroup ? this._checkboxGroup.value : this.value;
},
- 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'
- };
- }
+ 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
- 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;
+ size: function size() {
+ return this._checkboxGroup.size;
}
},
-
- 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();
+ 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;
- 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.$emit('change', ev);
+ if (this._checkboxGroup) {
+ this.$nextTick(function (_) {
+ _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
});
}
- });
-
- 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,
- isHidden: false,
- renderExpanded: null,
- resizeProxyVisible: false
- };
+
+ created: function created() {
+ this.checked && this.addToStore();
}
- };
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
/***/ },
-/* 130 */
+/* 90 */
/***/ function(module, exports) {
- module.exports = __webpack_require__(51);
-
-/***/ },
-/* 131 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(25);
+ 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: []}
/***/ },
-/* 132 */
+/* 91 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _vue = __webpack_require__(133);
-
- var _vue2 = _interopRequireDefault(_vue);
-
- var _debounce = __webpack_require__(69);
-
- var _debounce2 = _interopRequireDefault(_debounce);
+ var _checkboxGroup = __webpack_require__(92);
- var _util = __webpack_require__(134);
+ var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
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);
+ /* istanbul ignore next */
+ _checkboxGroup2.default.install = function (Vue) {
+ Vue.component(_checkboxGroup2.default.name, _checkboxGroup2.default);
};
- 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;
- };
+ exports.default = _checkboxGroup2.default;
- 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;
- }
- }
+/***/ },
+/* 92 */
+/***/ function(module, exports, __webpack_require__) {
- return changed;
- };
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(93),
+ /* template */
+ __webpack_require__(94),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- var TableStore = function TableStore(table) {
- var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ module.exports = Component.exports
- 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
- };
+/***/ },
+/* 93 */
+/***/ function(module, exports, __webpack_require__) {
- for (var prop in initialState) {
- if (initialState.hasOwnProperty(prop) && this.states.hasOwnProperty(prop)) {
- this.states[prop] = initialState[prop];
- }
- }
- };
+ 'use strict';
- TableStore.prototype.mutations = {
- setData: function setData(states, data) {
- var _this = this;
+ exports.__esModule = true;
- var dataInstanceChanged = states._data !== data;
- states._data = data;
- states.data = sortData(data || [], states);
+ var _emitter = __webpack_require__(15);
- // states.data.forEach((item) => {
- // if (!item.$extra) {
- // Object.defineProperty(item, '$extra', {
- // value: {},
- // enumerable: false
- // });
- // }
- // });
+ var _emitter2 = _interopRequireDefault(_emitter);
- this.updateCurrentRow();
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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);
+ exports.default = {
+ name: 'ElCheckboxGroup',
- states.data.forEach(function (row) {
- var rowId = (0, _util.getRowIdentity)(row, rowKey);
- var rowInfo = selectedMap[rowId];
- if (rowInfo) {
- selection[rowInfo.index] = row;
- }
- });
+ componentName: 'ElCheckboxGroup',
- _this.updateAllSelected();
- })();
- } else {
- console.warn('WARN: rowKey is required when reserve-selection is enabled.');
- }
- })();
- }
+ mixins: [_emitter2.default],
- var defaultExpandAll = states.defaultExpandAll;
- if (defaultExpandAll) {
- this.states.expandRows = (states.data || []).slice(0);
+ props: {
+ value: {},
+ min: Number,
+ max: Number,
+ size: String,
+ fill: String,
+ textColor: String
+ },
+
+ watch: {
+ value: function value(_value) {
+ this.dispatch('ElFormItem', 'el.form.change', [_value]);
}
+ }
+ };
- _vue2.default.nextTick(function () {
- return _this.table.updateScrollY();
- });
- },
- changeSortCondition: function changeSortCondition(states) {
- var _this2 = this;
+/***/ },
+/* 94 */
+/***/ function(module, exports) {
- states.data = sortData(states.filteredData || states._data || [], states);
+ 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: []}
- this.table.$emit('sort-change', {
- column: this.states.sortingColumn,
- prop: this.states.sortProp,
- order: this.states.sortOrder
- });
+/***/ },
+/* 95 */
+/***/ function(module, exports, __webpack_require__) {
- _vue2.default.nextTick(function () {
- return _this2.table.updateScrollY();
- });
- },
- filterChange: function filterChange(states, options) {
- var _this3 = this;
+ 'use strict';
- var column = options.column,
- values = options.values,
- silent = options.silent;
+ exports.__esModule = true;
- if (values && !Array.isArray(values)) {
- values = [values];
- }
+ var _component = __webpack_require__(96);
- var prop = column.property;
- var filters = {};
+ var _component2 = _interopRequireDefault(_component);
- if (prop) {
- states.filters[column.id] = values;
- filters[column.columnKey || column.id] = values;
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var data = states._data;
+ /* istanbul ignore next */
+ _component2.default.install = function (Vue) {
+ Vue.component(_component2.default.name, _component2.default);
+ };
- 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);
- });
- });
- }
- });
+ exports.default = _component2.default;
- states.filteredData = data;
- states.data = sortData(data, states);
+/***/ },
+/* 96 */
+/***/ function(module, exports, __webpack_require__) {
- if (!silent) {
- this.table.$emit('filter-change', filters);
- }
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(97),
+ /* template */
+ __webpack_require__(98),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- _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 = [];
- }
+ module.exports = Component.exports
- 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;
- }
+/***/ },
+/* 97 */
+/***/ function(module, exports) {
- 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);
- }
+ 'use strict';
- 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;
+ exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- if (oldCurrentRow !== row) {
- this.table.$emit('current-change', row, oldCurrentRow);
+ 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: ''
}
},
- 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);
+ data: function data() {
+ return {
+ coreWidth: this.width
+ };
+ },
+ created: function created() {
+ if (!~[this.onValue, this.offValue].indexOf(this.value)) {
+ this.$emit('input', this.offValue);
}
+ },
- this.updateAllSelected();
+ 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)';
+ }
},
-
-
- 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);
+ watch: {
+ checked: function checked() {
+ this.$refs.input.checked = this.checked;
+ if (this.onColor || this.offColor) {
+ this.setBackgroundColor();
}
}
- this.table.$emit('expand', row, expandRows.indexOf(row) !== -1);
},
+ methods: {
+ handleChange: function handleChange(event) {
+ var _this = this;
- 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);
+ this.$emit('input', !this.checked ? this.onValue : this.offValue);
+ this.$emit('change', !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;
}
- table.$emit('select-all', selection);
- states.isAllSelected = value;
- })
+ },
+ 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;
+ }
};
- 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);
+/***/ },
+/* 98 */
+/***/ 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
}
- });
- return result;
- };
+ }, [_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: []}
- 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';
- });
+/***/ },
+/* 99 */
+/***/ function(module, exports, __webpack_require__) {
- 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;
- };
+ 'use strict';
- TableStore.prototype.isSelected = function (row) {
- return (this.states.selection || []).indexOf(row) > -1;
- };
+ exports.__esModule = true;
- 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);
- }
- };
+ var _select = __webpack_require__(100);
- 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);
- }
- });
+ var _select2 = _interopRequireDefault(_select);
- this.states.expandRows = expandRows;
- };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- TableStore.prototype.toggleRowSelection = function (row, selected) {
- var changed = toggleRowSelection(this.states, row, selected);
- if (changed) {
- this.table.$emit('selection-change', this.states.selection);
- }
+ /* istanbul ignore next */
+ _select2.default.install = function (Vue) {
+ Vue.component(_select2.default.name, _select2.default);
};
- 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;
- });
- }
+ exports.default = _select2.default;
- deleted.forEach(function (deletedItem) {
- selection.splice(selection.indexOf(deletedItem), 1);
- });
+/***/ },
+/* 100 */
+/***/ function(module, exports, __webpack_require__) {
- if (deleted.length) {
- this.table.$emit('selection-change', selection);
- }
- };
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(101),
+ /* template */
+ __webpack_require__(113),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- TableStore.prototype.updateAllSelected = function () {
- var states = this.states;
- var selection = states.selection,
- rowKey = states.rowKey,
- selectable = states.selectable,
- data = states.data;
+ module.exports = Component.exports
- if (!data || data.length === 0) {
- states.isAllSelected = false;
- return;
- }
- var selectedMap = void 0;
- if (rowKey) {
- selectedMap = getKeysMap(states.selection, rowKey);
- }
+/***/ },
+/* 101 */
+/***/ function(module, exports, __webpack_require__) {
- var isSelected = function isSelected(row) {
- if (selectedMap) {
- return !!selectedMap[(0, _util.getRowIdentity)(row, rowKey)];
- } else {
- return selection.indexOf(row) !== -1;
- }
- };
+ 'use strict';
- 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++;
- }
- }
- }
+ exports.__esModule = true;
- if (selectedCount === 0) isAllSelected = false;
+ 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; }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- states.isAllSelected = isAllSelected;
- };
+ var _emitter = __webpack_require__(15);
- TableStore.prototype.scheduleLayout = function () {
- this.table.debouncedLayout();
- };
+ var _emitter2 = _interopRequireDefault(_emitter);
- 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;
- }
- };
+ var _locale = __webpack_require__(10);
- TableStore.prototype.updateCurrentRow = function () {
- var states = this.states;
- var table = this.table;
- var data = states.data || [];
- var oldCurrentRow = states.currentRow;
+ var _locale2 = _interopRequireDefault(_locale);
- if (data.indexOf(oldCurrentRow) === -1) {
- states.currentRow = null;
+ var _input = __webpack_require__(20);
- if (states.currentRow !== oldCurrentRow) {
- table.$emit('current-change', null, oldCurrentRow);
- }
- }
- };
+ var _input2 = _interopRequireDefault(_input);
- 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];
- }
+ var _selectDropdown = __webpack_require__(102);
- mutations[name].apply(this, [this.states].concat(args));
- } else {
- throw new Error('Action not found: ' + name);
- }
- };
+ var _selectDropdown2 = _interopRequireDefault(_selectDropdown);
- exports.default = TableStore;
+ var _option = __webpack_require__(105);
-/***/ },
-/* 133 */
-/***/ function(module, exports) {
+ var _option2 = _interopRequireDefault(_option);
- module.exports = __webpack_require__(3);
+ var _tag = __webpack_require__(109);
-/***/ },
-/* 134 */
-/***/ function(module, exports, __webpack_require__) {
+ var _tag2 = _interopRequireDefault(_tag);
- 'use strict';
+ var _scrollbar = __webpack_require__(25);
- exports.__esModule = true;
- exports.getRowIdentity = exports.mousewheel = exports.getColumnByCell = exports.getColumnById = exports.orderBy = exports.getCell = undefined;
+ var _scrollbar2 = _interopRequireDefault(_scrollbar);
- 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 _debounce = __webpack_require__(69);
- var _util = __webpack_require__(107);
+ var _debounce2 = _interopRequireDefault(_debounce);
- var getCell = exports.getCell = function getCell(event) {
- var cell = event.target;
+ var _clickoutside = __webpack_require__(21);
- while (cell && cell.tagName.toUpperCase() !== 'HTML') {
- if (cell.tagName.toUpperCase() === 'TD') {
- return cell;
- }
- cell = cell.parentNode;
- }
+ var _clickoutside2 = _interopRequireDefault(_clickoutside);
- return null;
- };
+ var _dom = __webpack_require__(44);
- var isObject = function isObject(obj) {
- return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
- };
+ var _resizeEvent = __webpack_require__(110);
- var orderBy = exports.orderBy = function orderBy(array, sortKey, reverse, sortMethod) {
- if (typeof reverse === 'string') {
- reverse = reverse === 'descending' ? -1 : 1;
- }
- if (!sortKey && !sortMethod) {
- return array;
- }
- var order = reverse && reverse < 0 ? -1 : 1;
+ var _locale3 = __webpack_require__(111);
- // 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 _scrollIntoView = __webpack_require__(112);
- var _scrollbarWidth = __webpack_require__(136);
+ var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
- var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
+ var _util = __webpack_require__(107);
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 sizeMap = {
+ 'large': 42,
+ 'small': 30,
+ 'mini': 22
+ };
- var TableLayout = function () {
- function TableLayout(options) {
- _classCallCheck(this, TableLayout);
+ exports.default = {
+ mixins: [_emitter2.default, _locale2.default],
- this.table = null;
- this.store = null;
- this.columns = null;
- this.fit = true;
- this.showHeader = true;
+ name: 'ElSelect',
- 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)();
+ componentName: 'ElSelect',
- for (var name in options) {
- if (options.hasOwnProperty(name)) {
- this[name] = options[name];
+ 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');
+ }
}
- }
-
- 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';
+ return null;
+ },
+ showNewOption: function showNewOption() {
+ var _this = this;
- var el = this.table.$el;
- if (typeof value === 'string' && /^\d+$/.test(value)) {
- value = Number(value);
+ 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;
}
+ },
- this.height = value;
+ components: {
+ ElInput: _input2.default,
+ ElSelectMenu: _selectDropdown2.default,
+ ElOption: _option2.default,
+ ElTag: _tag2.default,
+ ElScrollbar: _scrollbar2.default
+ },
- if (!el) return;
- if (typeof value === 'number') {
- el.style[prop] = value + 'px';
+ directives: { Clickoutside: _clickoutside2.default },
- this.updateHeight();
- } else if (typeof value === 'string') {
- if (value === '') {
- el.style[prop] = '';
+ 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');
}
- this.updateHeight();
+ },
+ defaultFirstOption: Boolean,
+ valueKey: {
+ type: String,
+ default: 'value'
}
- };
+ },
- TableLayout.prototype.setMaxHeight = function setMaxHeight(value) {
- return this.setHeight(value, 'max-height');
- };
+ 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: ''
+ };
+ },
- 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);
+ 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.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.setSelected();
+ if (this.filterable && !this.multiple) {
+ this.inputLength = 20;
}
- 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;
+ this.$emit('change', val);
+ this.dispatch('ElFormItem', 'el.form.change', val);
+ },
+ query: function query(val) {
+ var _this2 = this;
- var flattenColumns = [];
- columns.forEach(function (column) {
- if (column.isColumnGroup) {
- flattenColumns.push.apply(flattenColumns, column.columns);
+ 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 {
- flattenColumns.push(column);
+ this.filteredOptionsCount = this.optionsCount;
+ this.broadcast('ElOption', 'queryChange', val);
+ this.broadcast('ElOptionGroup', 'queryChange');
}
- });
-
- 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;
- });
+ if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
+ this.checkDefaultFirstOption();
+ }
+ },
+ visible: function visible(val) {
+ var _this3 = this;
- flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
- })();
+ if (!val) {
+ this.$refs.reference.$el.querySelector('input').blur();
+ this.handleIconHide();
+ this.broadcast('ElSelectDropdown', 'destroyPopper');
+ if (this.$refs.input) {
+ this.$refs.input.blur();
}
- } else {
- // HAVE HORIZONTAL SCROLL BAR
- this.scrollX = true;
- flexColumns.forEach(function (column) {
- column.realWidth = column.minWidth;
+ 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;
+ }
});
- }
-
- 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;
+ 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;
+ }
}
-
- bodyMinWidth += column.realWidth;
- });
- this.scrollX = bodyMinWidth > bodyWidth;
-
- this.bodyWidth = bodyMinWidth;
+ } 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();
+ }
}
+ },
- var fixedColumns = this.store.states.fixedColumns;
+ 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(option) {
+ var target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
+ if (this.$refs.popper && target) {
+ var menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
+ (0, _scrollIntoView2.default)(menu, target);
+ }
+ },
+ handleMenuEnter: function handleMenuEnter() {
+ var _this4 = this;
- if (fixedColumns.length > 0) {
- var fixedWidth = 0;
- fixedColumns.forEach(function (column) {
- fixedWidth += column.realWidth;
+ this.$nextTick(function () {
+ return _this4.scrollToOption(_this4.selected);
});
+ },
+ getOption: function getOption(value) {
+ var option = void 0;
+ var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
+ 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;
- this.fixedWidth = fixedWidth;
- }
-
- var rightFixedColumns = this.store.states.rightFixedColumns;
- if (rightFixedColumns.length > 0) {
- var rightFixedWidth = 0;
- rightFixedColumns.forEach(function (column) {
- rightFixedWidth += column.realWidth;
+ 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();
});
-
- this.rightFixedWidth = rightFixedWidth;
- }
- };
-
- return TableLayout;
- }();
-
- exports.default = TableLayout;
-
-/***/ },
-/* 136 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(14);
-
-/***/ },
-/* 137 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _util = __webpack_require__(134);
-
- var _dom = __webpack_require__(44);
-
- var _checkbox = __webpack_require__(130);
-
- var _checkbox2 = _interopRequireDefault(_checkbox);
-
- var _tooltip = __webpack_require__(138);
-
- var _tooltip2 = _interopRequireDefault(_tooltip);
-
- var _debounce = __webpack_require__(69);
-
- 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
+ handleFocus: function handleFocus() {
+ this.visible = 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');
+ handleIconClick: function handleIconClick(event) {
+ if (this.iconClass.indexOf('circle-close') > -1) {
+ this.deleteSelected(event);
+ } else {
+ this.toggleMenu();
}
},
- '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');
+ handleMouseDown: function handleMouseDown(event) {
+ if (event.target.tagName !== 'INPUT') return;
+ if (this.visible) {
+ this.handleClose();
+ event.preventDefault();
}
- }
- },
-
- 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;
+ doDestroy: function doDestroy() {
+ this.$refs.popper && this.$refs.popper.doDestroy();
+ this.dropdownUl = null;
},
- rightFixedCount: function rightFixedCount() {
- return this.store.states.rightFixedColumns.length;
+ handleClose: function handleClose() {
+ this.visible = false;
},
- 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();
- });
- },
-
+ toggleLastOptionHitState: function toggleLastOptionHitState(hit) {
+ if (!Array.isArray(this.selected)) return;
+ var option = this.selected[this.selected.length - 1];
+ if (!option) return;
- methods: {
- getKeyOfRow: function getKeyOfRow(row, index) {
- var rowKey = this.table.rowKey;
- if (rowKey) {
- return (0, _util.getRowIdentity)(row, rowKey);
+ if (hit === true || hit === false) {
+ option.hitState = hit;
+ return hit;
}
- return index;
+
+ option.hitState = !option.hitState;
+ return option.hitState;
},
- 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;
+ deletePrevTag: function deletePrevTag(e) {
+ if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
+ var value = this.value.slice();
+ value.pop();
+ this.$emit('input', value);
}
},
- getRowStyle: function getRowStyle(row, index) {
- var rowStyle = this.rowStyle;
- if (typeof rowStyle === 'function') {
- return rowStyle.call(null, row, index);
+ managePlaceholder: function managePlaceholder() {
+ if (this.currentPlaceholder !== '') {
+ this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
}
- return rowStyle;
},
- getRowClass: function getRowClass(row, index) {
- var classes = ['el-table__row'];
+ 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;
- 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) || '');
- }
+ 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;
- return classes.join(' ');
+ 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);
},
- handleCellMouseEnter: function handleCellMouseEnter(event, row) {
- var table = this.table;
- var cell = (0, _util.getCell)(event);
+ handleOptionSelect: function handleOptionSelect(option) {
+ var _this8 = this;
- 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);
+ 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(option);
+ });
+ },
+ getValueIndex: function getValueIndex() {
+ var _this9 = this;
- // 判断是否text-overflow, 如果是就显示tooltip
- var cellChild = event.target.querySelector('.cell');
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var value = arguments[1];
- if ((0, _dom.hasClass)(cellChild, 'el-tooltip') && cellChild.scrollWidth > cellChild.offsetWidth) {
- var tooltip = this.$refs.tooltip;
+ var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
+ 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
+ };
+ }();
- this.tooltipContent = cell.innerText;
- tooltip.referenceElm = cell;
- tooltip.$refs.popper && (tooltip.$refs.popper.style.display = 'none');
- tooltip.doDestroy();
- tooltip.setExpectedState(true);
- this.activateTooltip(tooltip);
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
},
- handleCellMouseLeave: function handleCellMouseLeave(event) {
- var tooltip = this.$refs.tooltip;
- if (tooltip) {
- tooltip.setExpectedState(false);
- tooltip.handleClosePopper();
+ toggleMenu: function toggleMenu() {
+ if (this.filterable && this.query === '' && this.visible) {
+ return;
}
- var cell = (0, _util.getCell)(event);
- if (!cell) return;
+ if (!this.disabled) {
+ this.visible = !this.visible;
+ }
+ },
+ navigateOptions: function navigateOptions(direction) {
+ var _this10 = this;
- var oldHoverState = this.table.hoverState;
- this.table.$emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
+ 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(_this10.options[_this10.hoverIndex]);
+ });
},
- handleMouseEnter: function handleMouseEnter(index) {
- this.store.commit('setHoverRow', index);
+ selectOption: function selectOption() {
+ if (this.options[this.hoverIndex]) {
+ this.handleOptionSelect(this.options[this.hoverIndex]);
+ }
},
- handleMouseLeave: function handleMouseLeave() {
- this.store.commit('setHoverRow', null);
+ deleteSelected: function deleteSelected(event) {
+ event.stopPropagation();
+ this.$emit('input', '');
+ this.visible = false;
+ this.$emit('clear');
},
- handleContextMenu: function handleContextMenu(event, row) {
- this.handleEvent(event, row, 'contextmenu');
+ 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();
},
- handleDoubleClick: function handleDoubleClick(event, row) {
- this.handleEvent(event, row, 'dblclick');
+ onInputChange: function onInputChange() {
+ if (this.filterable) {
+ this.query = this.selectedLabel;
+ }
},
- handleClick: function handleClick(event, row) {
- this.store.commit('setCurrentRow', row);
- this.handleEvent(event, row, 'click');
+ 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');
},
- 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);
+ 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;
+ }
}
}
- table.$emit('row-' + name, row, event, column);
},
- handleExpandClick: function handleExpandClick(row) {
- this.store.commit('toggleRowExpanded', row);
+ 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);
+ }
};
/***/ },
-/* 138 */
-/***/ function(module, exports) {
+/* 102 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(103),
+ /* template */
+ __webpack_require__(104),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
+
+ module.exports = Component.exports
- module.exports = __webpack_require__(52);
/***/ },
-/* 139 */
+/* 103 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _dom = __webpack_require__(44);
+ var _vuePopper = __webpack_require__(24);
- var _checkbox = __webpack_require__(130);
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
- var _checkbox2 = _interopRequireDefault(_checkbox);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _tag = __webpack_require__(109);
+ exports.default = {
+ name: 'ElSelectDropdown',
- var _tag2 = _interopRequireDefault(_tag);
+ componentName: 'ElSelectDropdown',
- var _vue = __webpack_require__(133);
+ mixins: [_vuePopper2.default],
- var _vue2 = _interopRequireDefault(_vue);
+ props: {
+ placement: {
+ default: 'bottom-start'
+ },
- var _filterPanel = __webpack_require__(140);
+ boundariesPadding: {
+ default: 0
+ },
- var _filterPanel2 = _interopRequireDefault(_filterPanel);
+ popperOptions: {
+ default: function _default() {
+ return {
+ forceAbsolute: true,
+ gpuAcceleration: false
+ };
+ }
+ }
+ },
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ data: function data() {
+ return {
+ minWidth: ''
+ };
+ },
- 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;
- }
+ computed: {
+ popperClass: function popperClass() {
+ return this.$parent.popperClass;
}
- if (column.children) {
- var colSpan = 0;
- column.children.forEach(function (subColumn) {
- traverse(subColumn, column);
- colSpan += subColumn.colSpan;
- });
- column.colSpan = colSpan;
- } else {
- column.colSpan = 1;
+ },
+
+ watch: {
+ '$parent.inputWidth': function $parentInputWidth() {
+ this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
}
- };
+ },
- originColumns.forEach(function (column) {
- column.level = 1;
- traverse(column);
- });
+ mounted: function mounted() {
+ var _this = this;
- var rows = [];
- for (var i = 0; i < maxLevel; i++) {
- rows.push([]);
+ 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);
}
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- var allColumns = getAllColumns(originColumns);
+/***/ },
+/* 104 */
+/***/ function(module, exports) {
- allColumns.forEach(function (column) {
- if (!column.children) {
- column.rowSpan = maxLevel - column.level + 1;
- } else {
- column.rowSpan = 1;
- }
- rows[column.level - 1].push(column);
- });
+ 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: []}
- return rows;
- };
+/***/ },
+/* 105 */
+/***/ function(module, exports, __webpack_require__) {
- exports.default = {
- name: 'ElTableHeader',
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(106),
+ /* template */
+ __webpack_require__(108),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- render: function render(h) {
- var _this = this;
+ module.exports = Component.exports
- 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);
- }
- },
+/***/ },
+/* 106 */
+/***/ function(module, exports, __webpack_require__) {
- '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' } },
- []
- ) : '']
- );
- })]
- )]
- );
- },
+ '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__(107);
+
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ exports.default = {
+ mixins: [_emitter2.default],
+
+ name: 'ElOption',
+
+ componentName: 'ElOption',
props: {
- fixed: String,
- store: {
- required: true
- },
- layout: {
+ value: {
required: true
},
- border: Boolean,
- defaultSort: {
- type: Object,
- default: function _default() {
- return {
- prop: '',
- order: ''
- };
- }
+ label: [String, Number],
+ created: Boolean,
+ disabled: {
+ type: Boolean,
+ default: false
}
},
- components: {
- ElCheckbox: _checkbox2.default,
- ElTag: _tag2.default
+ data: function data() {
+ return {
+ index: -1,
+ groupDisabled: false,
+ visible: true,
+ hitState: false
+ };
},
+
computed: {
- isAllSelected: function isAllSelected() {
- return this.store.states.isAllSelected;
+ isObject: function isObject() {
+ return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
},
- columnsCount: function columnsCount() {
- return this.store.states.columns.length;
+ currentLabel: function currentLabel() {
+ return this.label || (this.isObject ? '' : this.value);
},
- leftFixedCount: function leftFixedCount() {
- return this.store.states.fixedColumns.length;
+ currentValue: function currentValue() {
+ return this.value || this.label || '';
},
- rightFixedCount: function rightFixedCount() {
- return this.store.states.rightFixedColumns.length;
+ parent: function parent() {
+ var result = this.$parent;
+ while (!result.isSelect) {
+ result = result.$parent;
+ }
+ return result;
},
- columns: function columns() {
- return this.store.states.columns;
+ 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;
+ }
}
},
- 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);
- }
+ 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: {
- 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;
+ isEqual: function isEqual(a, b) {
+ if (!this.isObject) {
+ return a === b;
} else {
- return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
+ var valueKey = this.parent.valueKey;
+ return (0, _util.getValueByPath)(a, valueKey) === (0, _util.getValueByPath)(b, valueKey);
}
},
- 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;
+ contains: function contains() {
+ var _this = this;
- var filterPanel = this.filterPanels[column.id];
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var target = arguments[1];
- if (filterPanel && column.filterOpened) {
- filterPanel.showPopper = false;
- return;
- }
+ 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 (!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'));
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
-
- 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);
+ handleGroupDisabled: function handleGroupDisabled(val) {
+ this.groupDisabled = val;
+ },
+ hoverItem: function hoverItem() {
+ if (!this.disabled && !this.groupDisabled) {
+ this.parent.hoverIndex = this.parent.options.indexOf(this);
}
-
- this.$parent.$emit('header-click', column, event);
},
- handleMouseDown: function handleMouseDown(event, column) {
- var _this3 = 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;
- if (this.$isServer) return;
- if (column.children && column.children.length > 0) return;
- /* istanbul ignore if */
- if (this.draggingColumn && this.border) {
- (function () {
- _this3.dragging = true;
+ this.$nextTick(function () {
+ _this2.index = _this2.parent.options.indexOf(_this2);
+ });
+ }
+ },
- _this3.$parent.resizeProxyVisible = true;
+ 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);
- 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;
+ this.$on('queryChange', this.queryChange);
+ this.$on('handleGroupDisabled', this.handleGroupDisabled);
+ this.$on('resetIndex', this.resetIndex);
+ },
+ beforeDestroy: function beforeDestroy() {
+ this.dispatch('ElSelect', 'onOptionDestroy', this);
+ }
+ };
- (0, _dom.addClass)(columnEl, 'noclick');
+/***/ },
+/* 107 */
+/***/ function(module, exports) {
- _this3.dragState = {
- startMouseLeft: event.clientX,
- startLeft: columnRect.right - tableLeft,
- startColumnLeft: columnRect.left - tableLeft,
- tableLeft: tableLeft
- };
+ module.exports = __webpack_require__(6);
- var resizeProxy = table.$refs.resizeProxy;
- resizeProxy.style.left = _this3.dragState.startLeft + 'px';
+/***/ },
+/* 108 */
+/***/ function(module, exports) {
- document.onselectstart = function () {
- return false;
- };
- document.ondragstart = function () {
- return false;
- };
+ 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: []}
- var handleMouseMove = function handleMouseMove(event) {
- var deltaLeft = event.clientX - _this3.dragState.startMouseLeft;
- var proxyLeft = _this3.dragState.startLeft + deltaLeft;
+/***/ },
+/* 109 */
+/***/ function(module, exports) {
- resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
- };
+ module.exports = __webpack_require__(26);
- var handleMouseUp = function handleMouseUp() {
- if (_this3.dragging) {
- var _dragState = _this3.dragState,
- startColumnLeft = _dragState.startColumnLeft,
- startLeft = _dragState.startLeft;
+/***/ },
+/* 110 */
+/***/ function(module, exports) {
- 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);
+ module.exports = __webpack_require__(15);
- _this3.store.scheduleLayout();
+/***/ },
+/* 111 */
+/***/ function(module, exports) {
- document.body.style.cursor = '';
- _this3.dragging = false;
- _this3.draggingColumn = null;
- _this3.dragState = {};
+ module.exports = __webpack_require__(16);
- table.resizeProxyVisible = false;
- }
+/***/ },
+/* 112 */
+/***/ function(module, exports) {
- document.removeEventListener('mousemove', handleMouseMove);
- document.removeEventListener('mouseup', handleMouseUp);
- document.onselectstart = null;
- document.ondragstart = null;
+ module.exports = __webpack_require__(23);
- setTimeout(function () {
- (0, _dom.removeClass)(columnEl, 'noclick');
- }, 0);
- };
+/***/ },
+/* 113 */
+/***/ function(module, exports) {
- document.addEventListener('mousemove', handleMouseMove);
- document.addEventListener('mouseup', handleMouseUp);
- })();
+ 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": !_vm.disabled,
+ "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
},
- 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;
+ 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
}
-
- 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;
- }
+ }
+ }) : _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
}
},
- handleMouseOut: function handleMouseOut() {
- if (this.$isServer) return;
- document.body.style.cursor = '';
+ model: {
+ value: (_vm.selectedLabel),
+ callback: function($$v) {
+ _vm.selectedLabel = $$v
+ },
+ expression: "selectedLabel"
+ }
+ }), _c('transition', {
+ attrs: {
+ "name": "el-zoom-in-top"
},
- toggleOrder: function toggleOrder(order) {
- return !order ? 'ascending' : order === 'ascending' ? 'descending' : null;
+ 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
},
- handleSortClick: function handleSortClick(event, column, givenOrder) {
- event.stopPropagation();
- var order = givenOrder || this.toggleOrder(column.order);
+ 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: []}
- var target = event.target;
- while (target && target.tagName !== 'TH') {
- target = target.parentNode;
- }
+/***/ },
+/* 114 */
+/***/ function(module, exports, __webpack_require__) {
- if (target && target.tagName === 'TH') {
- if ((0, _dom.hasClass)(target, 'noclick')) {
- (0, _dom.removeClass)(target, 'noclick');
- return;
- }
- }
+ 'use strict';
- if (!column.sortable) return;
+ exports.__esModule = true;
- var states = this.store.states;
- var sortProp = states.sortProp;
- var sortOrder = void 0;
- var sortingColumn = states.sortingColumn;
+ var _option = __webpack_require__(105);
- if (sortingColumn !== column) {
- if (sortingColumn) {
- sortingColumn.order = null;
- }
- states.sortingColumn = column;
- sortProp = column.property;
- }
+ var _option2 = _interopRequireDefault(_option);
- if (!order) {
- sortOrder = column.order = null;
- states.sortingColumn = null;
- sortProp = null;
- } else {
- sortOrder = column.order = order;
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- states.sortProp = sortProp;
- states.sortOrder = sortOrder;
+ /* istanbul ignore next */
+ _option2.default.install = function (Vue) {
+ Vue.component(_option2.default.name, _option2.default);
+ };
- this.store.commit('changeSortCondition');
- }
- },
+ exports.default = _option2.default;
- data: function data() {
- return {
- draggingColumn: null,
- dragging: false,
- dragState: {}
- };
- }
+/***/ },
+/* 115 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var _optionGroup = __webpack_require__(116);
+
+ 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;
+
/***/ },
-/* 140 */
+/* 116 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(141),
+ __webpack_require__(117),
/* template */
- __webpack_require__(144),
+ __webpack_require__(118),
/* styles */
null,
/* scopeId */
@@ -43294,222 +42149,143 @@ module.exports =
/***/ },
-/* 141 */
+/* 117 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _vuePopper = __webpack_require__(24);
+ var _emitter = __webpack_require__(15);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+ var _emitter2 = _interopRequireDefault(_emitter);
- var _popup = __webpack_require__(14);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _locale = __webpack_require__(10);
+ exports.default = {
+ mixins: [_emitter2.default],
- var _locale2 = _interopRequireDefault(_locale);
+ name: 'ElOptionGroup',
- var _clickoutside = __webpack_require__(21);
+ componentName: 'ElOptionGroup',
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ props: {
+ label: String,
+ disabled: {
+ type: Boolean,
+ default: false
+ }
+ },
- var _dropdown = __webpack_require__(142);
+ data: function data() {
+ return {
+ visible: true
+ };
+ },
- var _dropdown2 = _interopRequireDefault(_dropdown);
- var _checkbox = __webpack_require__(130);
+ watch: {
+ disabled: function disabled(val) {
+ this.broadcast('ElOption', 'handleGroupDisabled', val);
+ }
+ },
- var _checkbox2 = _interopRequireDefault(_checkbox);
+ methods: {
+ queryChange: function queryChange() {
+ this.visible = this.$children && Array.isArray(this.$children) && this.$children.some(function (option) {
+ return option.visible === true;
+ });
+ }
+ },
- 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
+ created: function created() {
+ this.$on('queryChange', this.queryChange);
},
-
- props: {
- placement: {
- type: String,
- default: 'bottom-end'
+ mounted: function mounted() {
+ if (this.disabled) {
+ this.broadcast('ElOption', 'handleGroupDisabled', this.disabled);
}
- },
+ }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- 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')]
- )]
- )]
- );
- },
+/***/ },
+/* 118 */
+/***/ 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: []}
- 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;
+/***/ },
+/* 119 */
+/***/ function(module, exports, __webpack_require__) {
- if (typeof filterValue !== 'undefined' && filterValue !== null) {
- this.confirmFilter(this.filteredValue);
- } else {
- this.confirmFilter([]);
- }
+ 'use strict';
- this.handleOutsideClick();
- },
- confirmFilter: function confirmFilter(filteredValue) {
- this.table.store.commit('filterChange', {
- column: this.column,
- values: filteredValue
- });
- }
- },
+ exports.__esModule = true;
- data: function data() {
- return {
- table: null,
- cell: null,
- column: null
- };
- },
+ var _button = __webpack_require__(120);
+ var _button2 = _interopRequireDefault(_button);
- computed: {
- filters: function filters() {
- return this.column && this.column.filters;
- },
+ 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);
+ };
- 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);
- }
- }
- }
- },
+ exports.default = _button2.default;
- filteredValue: {
- get: function get() {
- if (this.column) {
- return this.column.filteredValue || [];
- }
- return [];
- },
- set: function set(value) {
- if (this.column) {
- this.column.filteredValue = value;
- }
- }
- },
+/***/ },
+/* 120 */
+/***/ function(module, exports, __webpack_require__) {
- multiple: function multiple() {
- if (this.column) {
- return this.column.filterMultiple;
- }
- return true;
- }
- },
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(121),
+ /* template */
+ __webpack_require__(122),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- mounted: function mounted() {
- var _this = this;
+ module.exports = Component.exports
- 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);
- }
- });
- },
+/***/ },
+/* 121 */
+/***/ function(module, exports) {
- 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();
- }
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ 'use strict';
+
+ exports.__esModule = true;
//
//
//
@@ -43531,558 +42307,198 @@ module.exports =
//
//
-/***/ },
-/* 142 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _vue = __webpack_require__(133);
-
- 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);
- }
+ 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
},
- close: function close(instance) {
- var index = dropdowns.indexOf(instance);
- if (index !== -1) {
- dropdowns.splice(instance, 1);
+
+ methods: {
+ handleClick: function handleClick(evt) {
+ this.$emit('click', evt);
+ },
+ handleInnerClick: function handleInnerClick(evt) {
+ if (this.disabled) {
+ evt.stopPropagation();
+ }
}
}
};
/***/ },
-/* 143 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(53);
-
-/***/ },
-/* 144 */
+/* 122 */
/***/ 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
+ 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
}
- }, [_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
+ "disabled": _vm.disabled,
+ "autofocus": _vm.autofocus,
+ "type": _vm.nativeType
},
on: {
- "click": _vm.handleConfirm
+ "click": _vm.handleClick
}
- }, [_vm._v(_vm._s(_vm.t('el.table.confirmFilter')))]), _c('button', {
+ }, [(_vm.loading) ? _c('i', {
+ staticClass: "el-icon-loading",
on: {
- "click": _vm.handleReset
+ "click": _vm.handleInnerClick
}
- }, [_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
- },
+ }) : _vm._e(), (_vm.icon && !_vm.loading) ? _c('i', {
+ class: 'el-icon-' + _vm.icon,
on: {
- "click": function($event) {
- _vm.handleSelect(null)
- }
+ "click": _vm.handleInnerClick
}
- }, [_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)])])
+ }) : _vm._e(), (_vm.$slots.default) ? _c('span', {
+ on: {
+ "click": _vm.handleInnerClick
+ }
+ }, [_vm._t("default")], 2) : _vm._e()])
},staticRenderFns: []}
/***/ },
-/* 145 */
+/* 123 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var _buttonGroup = __webpack_require__(124);
+
+ 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;
+
+/***/ },
+/* 124 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(125),
+ /* template */
+ __webpack_require__(126),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
+
+ module.exports = Component.exports
+
+
+/***/ },
+/* 125 */
/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+
+ /**
+ * button
+ * @module components/basic/menu
+ * @desc 用于按钮组
+ * @param {string} label - 名称
+ */
exports.default = {
- name: 'ElTableFooter',
+ name: 'ElButtonGroup'
+ };
- render: function render(h) {
- var _this = this;
+/***/ },
+/* 126 */
+/***/ function(module, exports) {
- 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(Math.min(precision, 20)));
- } 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--hidden': _vm.isHidden,
- '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: []}
+ 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: []}
/***/ },
-/* 147 */
+/* 127 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _tableColumn = __webpack_require__(148);
+ var _table = __webpack_require__(128);
- var _tableColumn2 = _interopRequireDefault(_tableColumn);
+ var _table2 = _interopRequireDefault(_table);
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);
+ _table2.default.install = function (Vue) {
+ Vue.component(_table2.default.name, _table2.default);
};
- exports.default = _tableColumn2.default;
+ exports.default = _table2.default;
/***/ },
-/* 148 */
+/* 128 */
+/***/ function(module, exports, __webpack_require__) {
+
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(129),
+ /* template */
+ __webpack_require__(146),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
+
+ module.exports = Component.exports
+
+
+/***/ },
+/* 129 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
@@ -44093,2032 +42509,2204 @@ module.exports =
var _checkbox2 = _interopRequireDefault(_checkbox);
- var _tag = __webpack_require__(109);
+ var _throttle = __webpack_require__(131);
- var _tag2 = _interopRequireDefault(_tag);
+ var _throttle2 = _interopRequireDefault(_throttle);
- var _merge = __webpack_require__(64);
+ var _debounce = __webpack_require__(69);
- var _merge2 = _interopRequireDefault(_merge);
+ var _debounce2 = _interopRequireDefault(_debounce);
- var _util = __webpack_require__(107);
+ var _resizeEvent = __webpack_require__(110);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _locale = __webpack_require__(10);
- function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }
+ var _locale2 = _interopRequireDefault(_locale);
- var columnIdSeed = 1;
+ var _tableStore = __webpack_require__(132);
- 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 _tableStore2 = _interopRequireDefault(_tableStore);
- 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;
+ var _tableLayout = __webpack_require__(135);
- 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;
+ var _tableLayout2 = _interopRequireDefault(_tableLayout);
- return column.label || '#';
- },
- renderCell: function renderCell(h, _ref3) {
- var $index = _ref3.$index;
+ var _tableBody = __webpack_require__(137);
- return h(
- 'div',
- null,
- [$index + 1]
- );
- },
- sortable: false
- },
- expand: {
- renderHeader: function renderHeader(h, _ref4) {
- _objectDestructuringEmpty(_ref4);
+ var _tableBody2 = _interopRequireDefault(_tableBody);
- return '';
- },
- renderCell: function renderCell(h, _ref5, proxy) {
- var row = _ref5.row,
- store = _ref5.store;
+ var _tableHeader = __webpack_require__(139);
- 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 _tableHeader2 = _interopRequireDefault(_tableHeader);
- var getDefaultColumn = function getDefaultColumn(type, options) {
- var column = {};
+ var _tableFooter = __webpack_require__(145);
- (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;
+ var _tableFooter2 = _interopRequireDefault(_tableFooter);
- return column;
- };
+ var _util = __webpack_require__(134);
- var DEFAULT_RENDER_CELL = function DEFAULT_RENDER_CELL(h, _ref6) {
- var row = _ref6.row,
- column = _ref6.column;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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;
- };
+ var tableIdSeed = 1; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
exports.default = {
- name: 'ElTableColumn',
+ name: 'ElTable',
+
+ mixins: [_locale2.default],
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
+ data: {
+ type: Array,
+ default: function _default() {
+ return [];
+ }
},
- sortMethod: Function,
- resizable: {
+
+ width: [String, Number],
+
+ height: [String, Number],
+
+ maxHeight: [String, Number],
+
+ fit: {
type: Boolean,
default: true
},
+
+ stripe: Boolean,
+
+ border: Boolean,
+
+ rowKey: [String, Function],
+
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: {
+
+ showHeader: {
type: Boolean,
default: true
- }
- },
+ },
- data: function data() {
- return {
- isSubColumn: false,
- columns: []
- };
- },
- beforeCreate: function beforeCreate() {
- this.row = {};
- this.column = {};
- this.$index = 0;
- },
+ showSummary: Boolean,
+ sumText: String,
- components: {
- ElCheckbox: _checkbox2.default,
- ElTag: _tag2.default
- },
+ summaryMethod: Function,
- computed: {
- owner: function owner() {
- var parent = this.$parent;
- while (parent && !parent.tableId) {
- parent = parent.$parent;
- }
- return parent;
- }
- },
+ rowClassName: [String, Function],
- created: function created() {
- var _this = this;
+ rowStyle: [Object, Function],
- 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++;
+ highlightCurrentRow: Boolean,
- var parent = this.$parent;
- var owner = this.owner;
- this.isSubColumn = owner !== parent;
+ currentRowKey: [String, Number],
- var type = this.type;
+ emptyText: String,
- var width = this.width;
- if (width !== undefined) {
- width = parseInt(width, 10);
- if (isNaN(width)) {
- width = null;
- }
- }
+ expandRowKeys: Array,
- var minWidth = this.minWidth;
- if (minWidth !== undefined) {
- minWidth = parseInt(minWidth, 10);
- if (isNaN(minWidth)) {
- minWidth = 80;
- }
- }
+ defaultExpandAll: Boolean,
- var isColumnGroup = false;
+ defaultSort: Object,
- 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 || ''
- });
+ tooltipEffect: String
+ },
- (0, _merge2.default)(column, forced[type] || {});
+ components: {
+ TableHeader: _tableHeader2.default,
+ TableFooter: _tableFooter2.default,
+ TableBody: _tableBody2.default,
+ ElCheckbox: _checkbox2.default
+ },
- this.columnConfig = column;
+ 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 renderCell = column.renderCell;
- var _self = this;
+ var _$refs = this.$refs,
+ headerWrapper = _$refs.headerWrapper,
+ footerWrapper = _$refs.footerWrapper;
- if (type === 'expand') {
- owner.renderExpanded = function (h, data) {
- return _self.$scopedSlots.default ? _self.$scopedSlots.default(data) : _self.$slots.default;
- };
+ 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;
+ });
- column.renderCell = function (h, data) {
- return h(
- 'div',
- { 'class': 'cell' },
- [renderCell(h, data, this._renderProxy)]
- );
- };
+ var scrollBodyWrapper = function scrollBodyWrapper(event) {
+ var deltaX = event.deltaX,
+ deltaY = event.deltaY;
- 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 (Math.abs(deltaX) < Math.abs(deltaY)) return;
+
+ if (deltaX > 0) {
+ _this.bodyWrapper.scrollLeft += 10;
+ } else if (deltaX < 0) {
+ _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 (!renderCell) {
- renderCell = DEFAULT_RENDER_CELL;
+ 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;
- 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)]
- );
- };
+ 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();
+ }
+ if (_this2.$el) {
+ _this2.isHidden = _this2.$el.clientWidth === 0;
+ }
+ });
+ }
},
- destroyed: function destroyed() {
- if (!this.$parent) return;
- this.owner.store.commit('removeColumn', this.columnConfig);
+
+ created: function created() {
+ var _this3 = this;
+
+ this.tableId = 'el-table_' + tableIdSeed + '_';
+ this.debouncedLayout = (0, _debounce2.default)(50, function () {
+ return _this3.doLayout();
+ });
},
- watch: {
- label: function label(newVal) {
- if (this.columnConfig) {
- this.columnConfig.label = newVal;
- }
+ computed: {
+ bodyWrapper: function bodyWrapper() {
+ return this.$refs.bodyWrapper;
},
- prop: function prop(newVal) {
- if (this.columnConfig) {
- this.columnConfig.property = newVal;
- }
+ shouldUpdateHeight: function shouldUpdateHeight() {
+ return typeof this.height === 'number' || this.fixedColumns.length > 0 || this.rightFixedColumns.length > 0;
},
- property: function property(newVal) {
- if (this.columnConfig) {
- this.columnConfig.property = newVal;
- }
+ selection: function selection() {
+ return this.store.states.selection;
},
- filters: function filters(newVal) {
- if (this.columnConfig) {
- this.columnConfig.filters = newVal;
- }
+ columns: function columns() {
+ return this.store.states.columns;
},
- filterMultiple: function filterMultiple(newVal) {
- if (this.columnConfig) {
- this.columnConfig.filterMultiple = newVal;
- }
+ tableData: function tableData() {
+ return this.store.states.data;
},
- align: function align(newVal) {
- if (this.columnConfig) {
- this.columnConfig.align = newVal ? 'is-' + newVal : null;
-
- if (!this.headerAlign) {
- this.columnConfig.headerAlign = newVal ? 'is-' + newVal : null;
- }
- }
+ fixedColumns: function fixedColumns() {
+ return this.store.states.fixedColumns;
},
- headerAlign: function headerAlign(newVal) {
- if (this.columnConfig) {
- this.columnConfig.headerAlign = 'is-' + (newVal ? newVal : this.align);
- }
+ rightFixedColumns: function rightFixedColumns() {
+ return this.store.states.rightFixedColumns;
},
- width: function width(newVal) {
- if (this.columnConfig) {
- this.columnConfig.width = newVal;
- this.owner.store.scheduleLayout();
+ 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;
},
- minWidth: function minWidth(newVal) {
- if (this.columnConfig) {
- this.columnConfig.minWidth = newVal;
- this.owner.store.scheduleLayout();
+ 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;
},
- fixed: function fixed(newVal) {
- if (this.columnConfig) {
- this.columnConfig.fixed = newVal;
- this.owner.store.scheduleLayout();
+ 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);
},
- sortable: function sortable(newVal) {
- if (this.columnConfig) {
- this.columnConfig.sortable = newVal;
+ 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 owner = this.owner;
- var parent = this.$parent;
- var columnIndex = void 0;
+ var _this4 = this;
- if (!this.isSubColumn) {
- columnIndex = [].indexOf.call(parent.$refs.hiddenColumns.children, this.$el);
- } else {
- columnIndex = [].indexOf.call(parent.$el.children, this.$el);
- }
+ this.bindEvents();
+ this.doLayout();
- owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null);
+ // 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,
+ isHidden: false,
+ renderExpanded: null,
+ resizeProxyVisible: false
+ };
}
};
/***/ },
-/* 149 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _datePicker = __webpack_require__(150);
-
- var _datePicker2 = _interopRequireDefault(_datePicker);
+/* 130 */
+/***/ function(module, exports) {
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ module.exports = __webpack_require__(52);
- /* istanbul ignore next */
- _datePicker2.default.install = function install(Vue) {
- Vue.component(_datePicker2.default.name, _datePicker2.default);
- };
+/***/ },
+/* 131 */
+/***/ function(module, exports) {
- exports.default = _datePicker2.default;
+ module.exports = __webpack_require__(25);
/***/ },
-/* 150 */
+/* 132 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _picker = __webpack_require__(151);
-
- var _picker2 = _interopRequireDefault(_picker);
+ var _vue = __webpack_require__(133);
- var _date = __webpack_require__(156);
+ var _vue2 = _interopRequireDefault(_vue);
- var _date2 = _interopRequireDefault(_date);
+ var _debounce = __webpack_require__(69);
- var _dateRange = __webpack_require__(174);
+ var _debounce2 = _interopRequireDefault(_debounce);
- var _dateRange2 = _interopRequireDefault(_dateRange);
+ var _util = __webpack_require__(134);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var getPanel = function getPanel(type) {
- if (type === 'daterange' || type === 'datetimerange') {
- return _dateRange2.default;
+ var sortData = function sortData(data, states) {
+ var sortingColumn = states.sortingColumn;
+ if (!sortingColumn || typeof sortingColumn.sortable === 'string') {
+ return data;
}
- return _date2.default;
+ return (0, _util.orderBy)(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod);
};
- exports.default = {
- mixins: [_picker2.default],
-
- name: 'ElDatePicker',
+ 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;
+ };
- props: {
- type: {
- type: String,
- default: 'date'
+ 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;
}
- },
-
- watch: {
- type: function type(_type) {
- if (this.picker) {
- this.unmountPicker();
- this.panel = getPanel(_type);
- this.mountPicker();
- } else {
- this.panel = getPanel(_type);
- }
+ } else {
+ if (selected && index === -1) {
+ selection.push(row);
+ changed = true;
+ } else if (!selected && index > -1) {
+ selection.splice(index, 1);
+ changed = true;
}
- },
-
- created: function created() {
- this.panel = getPanel(this.type);
}
+
+ return changed;
};
-/***/ },
-/* 151 */
-/***/ function(module, exports, __webpack_require__) {
+ var TableStore = function TableStore(table) {
+ var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(152),
- /* template */
- __webpack_require__(155),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ if (!table) {
+ throw new Error('Table is required.');
+ }
+ this.table = table;
- module.exports = Component.exports
+ 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];
+ }
+ }
+ };
-/***/ },
-/* 152 */
-/***/ function(module, exports, __webpack_require__) {
+ TableStore.prototype.mutations = {
+ setData: function setData(states, data) {
+ var _this = this;
- 'use strict';
+ var dataInstanceChanged = states._data !== data;
+ states._data = data;
+ states.data = sortData(data || [], states);
- exports.__esModule = true;
+ // states.data.forEach((item) => {
+ // if (!item.$extra) {
+ // Object.defineProperty(item, '$extra', {
+ // value: {},
+ // enumerable: false
+ // });
+ // }
+ // });
- var _vue = __webpack_require__(133);
+ this.updateCurrentRow();
- var _vue2 = _interopRequireDefault(_vue);
+ 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);
- var _clickoutside = __webpack_require__(21);
+ states.data.forEach(function (row) {
+ var rowId = (0, _util.getRowIdentity)(row, rowKey);
+ var rowInfo = selectedMap[rowId];
+ if (rowInfo) {
+ selection[rowInfo.index] = row;
+ }
+ });
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ _this.updateAllSelected();
+ })();
+ } else {
+ console.warn('WARN: rowKey is required when reserve-selection is enabled.');
+ }
+ })();
+ }
- var _util = __webpack_require__(153);
+ var defaultExpandAll = states.defaultExpandAll;
+ if (defaultExpandAll) {
+ this.states.expandRows = (states.data || []).slice(0);
+ }
- var _vuePopper = __webpack_require__(24);
+ _vue2.default.nextTick(function () {
+ return _this.table.updateScrollY();
+ });
+ },
+ changeSortCondition: function changeSortCondition(states) {
+ var _this2 = this;
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+ states.data = sortData(states.filteredData || states._data || [], states);
- var _emitter = __webpack_require__(15);
+ this.table.$emit('sort-change', {
+ column: this.states.sortingColumn,
+ prop: this.states.sortProp,
+ order: this.states.sortOrder
+ });
- var _emitter2 = _interopRequireDefault(_emitter);
+ _vue2.default.nextTick(function () {
+ return _this2.table.updateScrollY();
+ });
+ },
+ filterChange: function filterChange(states, options) {
+ var _this3 = this;
- var _input = __webpack_require__(20);
+ var column = options.column,
+ values = options.values,
+ silent = options.silent;
- var _input2 = _interopRequireDefault(_input);
+ if (values && !Array.isArray(values)) {
+ values = [values];
+ }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var prop = column.property;
+ var filters = {};
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ if (prop) {
+ states.filters[column.id] = values;
+ filters[column.columnKey || column.id] = values;
+ }
- 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 data = states._data;
- 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];
+ 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);
+ });
+ });
+ }
+ });
- 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];
+ states.filteredData = data;
+ states.data = sortData(data, states);
- 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;
+ if (!silent) {
+ this.table.$emit('filter-change', filters);
}
+
+ _vue2.default.nextTick(function () {
+ return _this3.table.updateScrollY();
+ });
},
- week: {
- formatter: function formatter(value, format) {
- var date = (0, _util.formatDate)(value, format);
- var week = (0, _util.getWeekNumber)(value);
+ insertColumn: function insertColumn(states, column, index, parent) {
+ var array = states._columns;
+ if (parent) {
+ array = parent.children;
+ if (!array) array = parent.children = [];
+ }
- 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 (typeof index !== 'undefined') {
+ array.splice(index, 0, column);
+ } else {
+ array.push(column);
+ }
- if (!isNaN(year) && !isNaN(month) && month < 54) {
- return text;
- }
- }
- return null;
+ if (column.type === 'selection') {
+ states.selectable = column.selectable;
+ states.reserveSelection = column.reserveSelection;
}
+
+ this.updateColumns(); // hack for dynamics insert column
+ this.scheduleLayout();
},
- 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
+ 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();
},
- year: {
- formatter: DATE_FORMATTER,
- parser: DATE_PARSER
+ setHoverRow: function setHoverRow(states, row) {
+ states.hoverRow = row;
},
- number: {
- formatter: function formatter(value) {
- if (!value) return '';
- return '' + value;
- },
- parser: function parser(text) {
- var result = Number(text);
+ setCurrentRow: function setCurrentRow(states, row) {
+ var oldCurrentRow = states.currentRow;
+ states.currentRow = row;
- if (!isNaN(text)) {
- return result;
- } else {
- return null;
- }
+ if (oldCurrentRow !== row) {
+ this.table.$emit('current-change', row, oldCurrentRow);
}
- }
- };
- 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: {}
},
+ rowSelectedChanged: function rowSelectedChanged(states, row) {
+ var changed = toggleRowSelection(states, row);
+ var selection = states.selection;
- components: { ElInput: _input2.default },
-
- directives: { Clickoutside: _clickoutside2.default },
+ if (changed) {
+ var table = this.table;
+ table.$emit('selection-change', selection);
+ table.$emit('select', selection, row);
+ }
- data: function data() {
- return {
- pickerVisible: false,
- showClose: false,
- currentValue: '',
- unwatchPickerOptions: null
- };
+ this.updateAllSelected();
},
- 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();
+ 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 {
- this.$emit('input');
+ if (index !== -1) expandRows.splice(index, 1);
}
- },
-
- value: {
- immediate: true,
- handler: function handler(val) {
- this.currentValue = (0, _util.isDate)(val) ? new Date(val) : val;
+ } else {
+ var _index = expandRows.indexOf(row);
+ if (_index === -1) {
+ expandRows.push(row);
+ } else {
+ expandRows.splice(_index, 1);
}
- },
- displayValue: function displayValue(val) {
- this.$emit('change', val);
- this.dispatch('ElFormItem', 'el.form.change');
}
+ this.table.$emit('expand', row, expandRows.indexOf(row) !== -1);
},
- 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;
- }
+ 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 (val) {
- return false;
+ if (toggleRowSelection(states, item, value)) {
+ selectionChanged = true;
}
}
- 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;
- },
+ 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;
+ };
- 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];
+ 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';
+ });
- 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 (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;
+ };
- if (parsedValue && this.picker) {
- this.picker.value = parsedValue;
- }
- } else {
- this.$emit('input', value);
- this.picker.value = value;
- }
- this.$forceUpdate();
- }
+ 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);
}
- },
+ });
- created: function created() {
- // vue-popper
- this.popperOptions = {
- boundariesPadding: 0,
- gpuAcceleration: false
- };
- this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
- },
+ 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);
+ }
+ };
- 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;
+ 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;
+ });
+ }
- return false;
- },
- handleClose: function handleClose() {
- this.pickerVisible = false;
- },
- handleFocus: function handleFocus() {
- var type = this.type;
+ deleted.forEach(function (deletedItem) {
+ selection.splice(selection.indexOf(deletedItem), 1);
+ });
- 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;
+ if (deleted.length) {
+ this.table.$emit('selection-change', selection);
+ }
+ };
- // 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;
+ TableStore.prototype.updateAllSelected = function () {
+ var states = this.states;
+ var selection = states.selection,
+ rowKey = states.rowKey,
+ selectable = states.selectable,
+ data = states.data;
- if (this.$isServer) return;
- if (!this.picker) {
- this.mountPicker();
- }
- this.pickerVisible = this.picker.visible = true;
+ if (!data || data.length === 0) {
+ states.isAllSelected = false;
+ return;
+ }
- this.updatePopper();
+ var selectedMap = void 0;
+ if (rowKey) {
+ selectedMap = getKeysMap(states.selection, rowKey);
+ }
- if (this.currentValue instanceof Date) {
- this.picker.date = new Date(this.currentValue.getTime());
+ 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 {
- this.picker.value = this.currentValue;
+ selectedCount++;
}
- this.picker.resetView && this.picker.resetView();
+ }
+ }
- this.$nextTick(function () {
- _this.picker.ajustScrollTop && _this.picker.ajustScrollTop();
- });
- },
- mountPicker: function mountPicker() {
- var _this2 = this;
+ if (selectedCount === 0) isAllSelected = false;
- 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;
- }
+ states.isAllSelected = isAllSelected;
+ };
- var updateOptions = function updateOptions() {
- var options = _this2.pickerOptions;
+ TableStore.prototype.scheduleLayout = function () {
+ this.table.debouncedLayout();
+ };
- if (options && options.selectableRange) {
- (function () {
- var ranges = options.selectableRange;
- var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
- var format = DEFAULT_FORMATS.timerange;
+ 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;
+ }
+ };
- ranges = Array.isArray(ranges) ? ranges : [ranges];
- _this2.picker.selectableRange = ranges.map(function (range) {
- return parser(range, format, _this2.rangeSeparator);
- });
- })();
- }
+ TableStore.prototype.updateCurrentRow = function () {
+ var states = this.states;
+ var table = this.table;
+ var data = states.data || [];
+ var oldCurrentRow = states.currentRow;
- 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;
+ if (data.indexOf(oldCurrentRow) === -1) {
+ states.currentRow = null;
- // 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();
- });
+ if (states.currentRow !== oldCurrentRow) {
+ table.$emit('current-change', null, oldCurrentRow);
+ }
+ }
+ };
- 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);
- }
+ 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;
+
/***/ },
-/* 153 */
+/* 133 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(3);
+
+/***/ },
+/* 134 */
/***/ 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);
+ exports.getRowIdentity = exports.mousewheel = exports.getColumnByCell = exports.getColumnById = exports.orderBy = exports.getCell = undefined;
- var _locale = __webpack_require__(111);
+ 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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _util = __webpack_require__(107);
- var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
- var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
- var getI18nSettings = function getI18nSettings() {
- return {
- 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));
- }),
- amPm: ['am', 'pm']
- };
- };
+ var getCell = exports.getCell = function getCell(event) {
+ var cell = event.target;
- var newArray = function newArray(start, end) {
- var result = [];
- for (var i = start; i <= end; i++) {
- result.push(i);
+ while (cell && cell.tagName.toUpperCase() !== 'HTML') {
+ if (cell.tagName.toUpperCase() === 'TD') {
+ return cell;
+ }
+ cell = cell.parentNode;
}
- 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', getI18nSettings());
+ return null;
};
- var parseDate = exports.parseDate = function parseDate(string, format) {
- return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
+ var isObject = function isObject(obj) {
+ return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object';
};
- var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) {
- if (month === 3 || month === 5 || month === 8 || month === 10) {
- return 30;
+ var orderBy = exports.orderBy = function orderBy(array, sortKey, reverse, sortMethod) {
+ if (typeof reverse === 'string') {
+ reverse = reverse === 'descending' ? -1 : 1;
}
-
- if (month === 1) {
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
- return 29;
- } else {
- return 28;
- }
+ if (!sortKey && !sortMethod) {
+ return array;
}
+ var order = reverse && reverse < 0 ? -1 : 1;
- return 31;
+ // 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 getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) {
- var temp = new Date(date.getTime());
- temp.setDate(1);
- return temp.getDay();
+ 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 DAY_DURATION = exports.DAY_DURATION = 86400000;
+ 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 getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) {
- var result = new Date(year, month, 1);
- var day = result.getDay();
+ var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
- if (day === 0) {
- result.setTime(result.getTime() - DAY_DURATION * 7);
- } else {
- result.setTime(result.getTime() - DAY_DURATION * day);
+ var mousewheel = exports.mousewheel = function mousewheel(element, callback) {
+ if (element && element.addEventListener) {
+ element.addEventListener(isFirefox ? 'DOMMouseScroll' : 'mousewheel', callback);
}
-
- 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 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);
+ }
};
- 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);
- }
+/***/ },
+/* 135 */
+/***/ function(module, exports, __webpack_require__) {
- src.setMonth(newMonth);
- src.setFullYear(newYear);
+ 'use strict';
- return new Date(src.getTime());
- };
+ exports.__esModule = true;
- var nextMonth = exports.nextMonth = function nextMonth(src) {
- var year = src.getFullYear();
- var month = src.getMonth();
- var date = src.getDate();
+ var _scrollbarWidth = __webpack_require__(136);
- var newYear = month === 11 ? year + 1 : year;
- var newMonth = month === 11 ? 0 : month + 1;
+ var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
- var newMonthDayCount = getDayCountOfMonth(newYear, newMonth);
- if (newMonthDayCount < date) {
- src.setDate(newMonthDayCount);
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- src.setMonth(newMonth);
- src.setFullYear(newYear);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- return new Date(src.getTime());
- };
+ var TableLayout = function () {
+ function TableLayout(options) {
+ _classCallCheck(this, TableLayout);
- var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) {
- var hours = [];
- var disabledHours = [];
+ this.table = null;
+ this.store = null;
+ this.columns = null;
+ this.fit = true;
+ this.showHeader = true;
- (ranges || []).forEach(function (range) {
- var value = range.map(function (date) {
- return date.getHours();
- });
+ 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)();
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
- });
+ for (var name in options) {
+ if (options.hasOwnProperty(name)) {
+ this[name] = options[name];
+ }
+ }
- if (disabledHours.length) {
- for (var i = 0; i < 24; i++) {
- hours[i] = disabledHours.indexOf(i) === -1;
+ if (!this.table) {
+ throw new Error('table is required for Table Layout');
}
- } else {
- for (var _i = 0; _i < 24; _i++) {
- hours[_i] = false;
+ if (!this.store) {
+ throw new Error('store is required for Table Layout');
}
}
- 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;
+ 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;
+ }
+ };
- var len = ranges.length;
+ TableLayout.prototype.setHeight = function setHeight(value) {
+ var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'height';
- 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 el = this.table.$el;
+ if (typeof value === 'string' && /^\d+$/.test(value)) {
+ value = Number(value);
}
- }
-
- 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));
- });
+ this.height = value;
- return date < minDate ? minDate : maxDate;
- };
+ if (!el) return;
+ if (typeof value === 'number') {
+ el.style[prop] = value + 'px';
-/***/ },
-/* 154 */
-/***/ function(module, exports) {
+ this.updateHeight();
+ } else if (typeof value === 'string') {
+ if (value === '') {
+ el.style[prop] = '';
+ }
+ this.updateHeight();
+ }
+ };
- module.exports = __webpack_require__(54);
+ TableLayout.prototype.setMaxHeight = function setMaxHeight(value) {
+ return this.setHeight(value, 'max-height');
+ };
-/***/ },
-/* 155 */
-/***/ function(module, exports) {
+ 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;
- 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
+ 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);
}
- }
- }, [(_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
+ 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;
}
- },
- slot: "icon"
- }) : _vm._e()])
- },staticRenderFns: []}
+ this.fixedBodyHeight = this.scrollX ? bodyHeight - this.gutterWidth : bodyHeight;
+ }
+ this.viewportHeight = this.scrollX ? height - (noData ? 0 : this.gutterWidth) : height;
+ };
-/***/ },
-/* 156 */
-/***/ function(module, exports, __webpack_require__) {
+ TableLayout.prototype.update = function update() {
+ var fit = this.fit;
+ var columns = this.table.columns;
+ var bodyWidth = this.table.$el.clientWidth;
+ var bodyMinWidth = 0;
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(157),
- /* template */
- __webpack_require__(173),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var flattenColumns = [];
+ columns.forEach(function (column) {
+ if (column.isColumnGroup) {
+ flattenColumns.push.apply(flattenColumns, column.columns);
+ } else {
+ flattenColumns.push(column);
+ }
+ });
- module.exports = Component.exports
+ 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;
+ });
-/***/ },
-/* 157 */
-/***/ function(module, exports, __webpack_require__) {
+ if (bodyMinWidth < bodyWidth - this.gutterWidth) {
+ // DON'T HAVE SCROLL BAR
+ this.scrollX = false;
- 'use strict';
+ var totalFlexWidth = bodyWidth - this.gutterWidth - bodyMinWidth;
- exports.__esModule = true;
+ 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;
- var _util = __webpack_require__(153);
+ 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;
+ });
- var _locale = __webpack_require__(10);
+ 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;
+ });
+ }
- var _locale2 = _interopRequireDefault(_locale);
+ 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;
+ }
- var _input = __webpack_require__(20);
+ bodyMinWidth += column.realWidth;
+ });
+ this.scrollX = bodyMinWidth > bodyWidth;
- var _input2 = _interopRequireDefault(_input);
+ this.bodyWidth = bodyMinWidth;
+ }
- var _time = __webpack_require__(158);
+ var fixedColumns = this.store.states.fixedColumns;
- var _time2 = _interopRequireDefault(_time);
+ if (fixedColumns.length > 0) {
+ var fixedWidth = 0;
+ fixedColumns.forEach(function (column) {
+ fixedWidth += column.realWidth;
+ });
- var _yearTable = __webpack_require__(164);
+ this.fixedWidth = fixedWidth;
+ }
- var _yearTable2 = _interopRequireDefault(_yearTable);
+ var rightFixedColumns = this.store.states.rightFixedColumns;
+ if (rightFixedColumns.length > 0) {
+ var rightFixedWidth = 0;
+ rightFixedColumns.forEach(function (column) {
+ rightFixedWidth += column.realWidth;
+ });
- var _monthTable = __webpack_require__(167);
+ this.rightFixedWidth = rightFixedWidth;
+ }
+ };
- var _monthTable2 = _interopRequireDefault(_monthTable);
+ return TableLayout;
+ }();
- var _dateTable = __webpack_require__(170);
+ exports.default = TableLayout;
- var _dateTable2 = _interopRequireDefault(_dateTable);
+/***/ },
+/* 136 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(14);
+
+/***/ },
+/* 137 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var _util = __webpack_require__(134);
+
+ var _dom = __webpack_require__(44);
+
+ var _checkbox = __webpack_require__(130);
+
+ var _checkbox2 = _interopRequireDefault(_checkbox);
+
+ var _tooltip = __webpack_require__(138);
+
+ var _tooltip2 = _interopRequireDefault(_tooltip);
+
+ var _debounce = __webpack_require__(69);
+
+ var _debounce2 = _interopRequireDefault(_debounce);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- mixins: [_locale2.default],
-
- watch: {
- showTime: function showTime(val) {
- var _this = this;
+ components: {
+ ElCheckbox: _checkbox2.default,
+ ElTooltip: _tooltip2.default
+ },
- /* istanbul ignore if */
- if (!val) return;
- this.$nextTick(function (_) {
- var inputElm = _this.$refs.input.$el;
- if (inputElm) {
- _this.pickerWidth = inputElm.getBoundingClientRect().width + 10;
- }
- });
+ props: {
+ store: {
+ required: true
},
- 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);
- }
+ stripe: Boolean,
+ context: {},
+ layout: {
+ required: true
},
- timePickerVisible: function timePickerVisible(val) {
- var _this2 = this;
+ rowClassName: [String, Function],
+ rowStyle: [Object, Function],
+ fixed: String,
+ highlight: Boolean
+ },
- 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);
+ 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');
}
},
- date: function date(newVal) {
- this.year = newVal.getFullYear();
- this.month = newVal.getMonth();
- if (this.selectionMode === 'week') this.week = (0, _util.getWeekNumber)(newVal);
+ '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');
+ }
}
},
- methods: {
- handleClear: function handleClear() {
- this.date = this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date();
- this.$emit('pick');
+ computed: {
+ table: function table() {
+ return this.$parent;
},
- resetDate: function resetDate() {
- this.date = new Date(this.date);
+ data: function data() {
+ return this.store.states.data;
},
- showMonthPicker: function showMonthPicker() {
- this.currentView = 'month';
+ columnsCount: function columnsCount() {
+ return this.store.states.columns.length;
},
- showYearPicker: function showYearPicker() {
- this.currentView = 'year';
+ 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();
+ });
+ },
- // 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();
+ methods: {
+ getKeyOfRow: function getKeyOfRow(row, index) {
+ var rowKey = this.table.rowKey;
+ if (rowKey) {
+ return (0, _util.getRowIdentity)(row, rowKey);
}
+ return index;
},
- prevYear: function prevYear() {
- if (this.currentView === 'year') {
- this.$refs.yearTable.prevTenYear();
+ 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 {
- this.year--;
- this.date.setFullYear(this.year);
- this.resetDate();
+ return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
}
},
- handleShortcutClick: function handleShortcutClick(shortcut) {
- if (shortcut.onClick) {
- shortcut.onClick(this);
+ getRowStyle: function getRowStyle(row, index) {
+ var rowStyle = this.rowStyle;
+ if (typeof rowStyle === 'function') {
+ return rowStyle.call(null, row, index);
}
+ return rowStyle;
},
- 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());
- }
+ getRowClass: function getRowClass(row, index) {
+ var classes = ['el-table__row'];
- if (!first) {
- this.timePickerVisible = visible;
+ if (this.stripe && index % 2 === 1) {
+ classes.push('el-table__row--striped');
}
- },
- 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);
+ 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(' ');
},
- 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);
+ 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);
}
- this.resetDate();
- },
- handleYearPick: function handleYearPick(year) {
- var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
+ // 判断是否text-overflow, 如果是就显示tooltip
+ var cellChild = event.target.querySelector('.cell');
- this.year = year;
- if (!close) return;
+ if ((0, _dom.hasClass)(cellChild, 'el-tooltip') && cellChild.scrollWidth > cellChild.offsetWidth) {
+ var tooltip = this.$refs.tooltip;
- this.date.setFullYear(year);
- if (this.selectionMode === 'year') {
- this.$emit('pick', new Date(year, 0, 1));
- } else {
- this.currentView = 'month';
+ this.tooltipContent = cell.innerText;
+ tooltip.referenceElm = cell;
+ tooltip.$refs.popper && (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;
- this.resetDate();
+ var oldHoverState = this.table.hoverState;
+ this.table.$emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
},
- changeToNow: function changeToNow() {
- this.date.setTime(+new Date());
- this.$emit('pick', new Date(this.date.getTime()));
- this.resetDate();
+ handleMouseEnter: function handleMouseEnter(index) {
+ this.store.commit('setHoverRow', index);
},
- confirm: function confirm() {
- this.date.setMilliseconds(0);
- this.$emit('pick', this.date);
+ handleMouseLeave: function handleMouseLeave() {
+ this.store.commit('setHoverRow', null);
},
- 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();
+ 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);
}
- },
+ }
+ };
- components: {
- TimePicker: _time2.default, YearTable: _yearTable2.default, MonthTable: _monthTable2.default, DateTable: _dateTable2.default, ElInput: _input2.default
- },
+/***/ },
+/* 138 */
+/***/ function(module, exports) {
- 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: ''
- };
- },
+ module.exports = __webpack_require__(53);
+/***/ },
+/* 139 */
+/***/ function(module, exports, __webpack_require__) {
- computed: {
- footerVisible: function footerVisible() {
- return this.showTime;
- },
+ 'use strict';
+ exports.__esModule = true;
- 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;
- }
- }
- }
- },
+ var _dom = __webpack_require__(44);
- 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();
- }
- },
+ var _checkbox = __webpack_require__(130);
- 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';
- }
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ var _checkbox2 = _interopRequireDefault(_checkbox);
-/***/ },
-/* 158 */
-/***/ function(module, exports, __webpack_require__) {
+ var _tag = __webpack_require__(109);
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(159),
- /* template */
- __webpack_require__(163),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var _tag2 = _interopRequireDefault(_tag);
- module.exports = Component.exports
+ var _vue = __webpack_require__(133);
+ var _vue2 = _interopRequireDefault(_vue);
-/***/ },
-/* 159 */
-/***/ function(module, exports, __webpack_require__) {
+ var _filterPanel = __webpack_require__(140);
- 'use strict';
+ var _filterPanel2 = _interopRequireDefault(_filterPanel);
- exports.__esModule = true;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _util = __webpack_require__(153);
+ 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 _locale = __webpack_require__(10);
+ 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;
+ }
+ };
- var _locale2 = _interopRequireDefault(_locale);
+ originColumns.forEach(function (column) {
+ column.level = 1;
+ traverse(column);
+ });
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ 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 = {
- mixins: [_locale2.default],
+ name: 'ElTableHeader',
- components: {
- TimeSpinner: __webpack_require__(160)
+ 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: {
- pickerWidth: {},
- date: {
+ fixed: String,
+ store: {
+ required: true
+ },
+ layout: {
+ required: true
+ },
+ border: Boolean,
+ defaultSort: {
+ type: Object,
default: function _default() {
- return new Date();
+ return {
+ prop: '',
+ order: ''
+ };
}
- },
- visible: Boolean
+ }
},
- watch: {
- visible: function visible(val) {
- this.currentVisible = val;
+ components: {
+ ElCheckbox: _checkbox2.default,
+ ElTag: _tag2.default
+ },
+
+ computed: {
+ isAllSelected: function isAllSelected() {
+ return this.store.states.isAllSelected;
},
- pickerWidth: function pickerWidth(val) {
- this.width = val;
+ columnsCount: function columnsCount() {
+ return this.store.states.columns.length;
},
- 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();
- });
+ leftFixedCount: function leftFixedCount() {
+ return this.store.states.fixedColumns.length;
},
- selectableRange: function selectableRange(val) {
- this.$refs.spinner.selectableRange = val;
+ rightFixedCount: function rightFixedCount() {
+ return this.store.states.rightFixedColumns.length;
+ },
+ columns: function columns() {
+ return this.store.states.columns;
}
},
- 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
- };
+ 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;
+ }
+ }
- computed: {
- showSeconds: function showSeconds() {
- return (this.format || '').indexOf('ss') !== -1;
+ 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: {
- handleClear: function handleClear() {
- this.$emit('pick');
+ 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;
+ }
},
- handleCancel: function handleCancel() {
- this.$emit('pick');
+ toggleAllSelection: function toggleAllSelection() {
+ this.store.commit('toggleAllSelection');
},
- handleChange: function handleChange(date) {
- if (date.hours !== undefined) {
- this.currentDate.setHours(date.hours);
- this.hours = this.currentDate.getHours();
+ 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 (date.minutes !== undefined) {
- this.currentDate.setMinutes(date.minutes);
- this.minutes = this.currentDate.getMinutes();
+
+ 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'));
}
- if (date.seconds !== undefined) {
- this.currentDate.setSeconds(date.seconds);
- this.seconds = this.currentDate.getSeconds();
+
+ 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.handleConfirm(true);
+ this.$parent.$emit('header-click', column, event);
},
- setSelectionRange: function setSelectionRange(start, end) {
- this.$emit('select-range', start, end);
+ 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);
+ })();
+ }
},
- handleConfirm: function handleConfirm() {
- var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- var first = arguments[1];
+ 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 (first) return;
- var date = new Date((0, _util.limitRange)(this.currentDate, this.selectableRange, 'HH:mm:ss'));
- this.$emit('pick', date, visible, first);
+ 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;
+ }
+ }
},
- ajustScrollTop: function ajustScrollTop() {
- return this.$refs.spinner.ajustScrollTop();
- }
- },
+ 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);
- created: function created() {
- this.hours = this.currentDate.getHours();
- this.minutes = this.currentDate.getMinutes();
- this.seconds = this.currentDate.getSeconds();
+ 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');
+ }
},
- mounted: function mounted() {
- var _this2 = this;
- this.$nextTick(function () {
- return _this2.handleConfirm(true, true);
- });
- this.$emit('mounted');
+ data: function data() {
+ return {
+ draggingColumn: null,
+ dragging: false,
+ dragState: {}
+ };
}
};
/***/ },
-/* 160 */
+/* 140 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(161),
+ __webpack_require__(141),
/* template */
- __webpack_require__(162),
+ __webpack_require__(144),
/* styles */
null,
/* scopeId */
@@ -46131,157 +44719,206 @@ module.exports =
/***/ },
-/* 161 */
+/* 141 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _util = __webpack_require__(153);
+ var _vuePopper = __webpack_require__(24);
- var _scrollbar = __webpack_require__(25);
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
- var _scrollbar2 = _interopRequireDefault(_scrollbar);
+ var _popup = __webpack_require__(14);
- var _debounce = __webpack_require__(69);
+ var _locale = __webpack_require__(10);
- var _debounce2 = _interopRequireDefault(_debounce);
+ 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__(130);
+
+ 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 = {
- components: { ElScrollbar: _scrollbar2.default },
+ name: 'ElTableFilterPanel',
- props: {
- hours: {
- type: Number,
- default: 0
- },
+ mixins: [_vuePopper2.default, _locale2.default],
- minutes: {
- type: Number,
- default: 0
- },
+ directives: {
+ Clickoutside: _clickoutside2.default
+ },
- seconds: {
- type: Number,
- default: 0
- },
+ components: {
+ ElCheckbox: _checkbox2.default,
+ ElCheckboxGroup: _checkboxGroup2.default
+ },
- showSeconds: {
- type: Boolean,
- default: true
+ props: {
+ placement: {
+ type: String,
+ default: 'bottom-end'
}
},
- 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 });
- }
+ 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')]
+ )]
+ )]
+ );
},
- computed: {
- hoursList: function hoursList() {
- return (0, _util.getRangeHours)(this.selectableRange);
+
+ methods: {
+ isActive: function isActive(filter) {
+ return filter.value === this.filterValue;
},
- hourEl: function hourEl() {
- return this.$refs.hour.wrap;
+ handleOutsideClick: function handleOutsideClick() {
+ this.showPopper = false;
},
- minuteEl: function minuteEl() {
- return this.$refs.minute.wrap;
+ handleConfirm: function handleConfirm() {
+ this.confirmFilter(this.filteredValue);
+ this.handleOutsideClick();
},
- secondEl: function secondEl() {
- return this.$refs.second.wrap;
+ 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 {
- hoursPrivate: 0,
- minutesPrivate: 0,
- secondsPrivate: 0,
- selectableRange: []
+ table: null,
+ cell: null,
+ column: null
};
},
- 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();
- });
- },
+ computed: {
+ filters: function filters() {
+ return this.column && this.column.filters;
+ },
- methods: {
- handleClick: function handleClick(type, value, disabled) {
- if (value.disabled) {
- return;
+ 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);
+ }
+ }
}
-
- 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);
+
+ filteredValue: {
+ get: function get() {
+ if (this.column) {
+ return this.column.filteredValue || [];
+ }
+ return [];
+ },
+ set: function set(value) {
+ if (this.column) {
+ this.column.filteredValue = value;
+ }
}
},
- 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), '' + type === 'hour' ? 23 : 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);
+ 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();
+ }
}
}
}; //
@@ -46318,1692 +44955,2264 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
/***/ },
-/* 162 */
-/***/ function(module, exports) {
+/* 142 */
+/***/ function(module, exports, __webpack_require__) {
- 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')
- }
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var _vue = __webpack_require__(133);
+
+ 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;
}
- }, _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')
- }
+ dropdown.handleOutsideClick && dropdown.handleOutsideClick(event);
+ });
+ });
+
+ exports.default = {
+ open: function open(instance) {
+ if (instance) {
+ dropdowns.push(instance);
}
- }, _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')
- }
+ },
+ close: function close(instance) {
+ var index = dropdowns.indexOf(instance);
+ if (index !== -1) {
+ dropdowns.splice(instance, 1);
}
- }, _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 */
+/* 143 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(54);
+
+/***/ },
+/* 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"
- },
- on: {
- "after-leave": function($event) {
- _vm.$emit('dodestroy')
- }
}
- }, [_c('div', {
+ }, [(_vm.multiple) ? _c('div', {
directives: [{
name: "show",
rawName: "v-show",
- value: (_vm.currentVisible),
- expression: "currentVisible"
+ value: (_vm.showPopper),
+ expression: "showPopper"
}],
- staticClass: "el-time-panel",
- class: _vm.popperClass,
- style: ({
- width: _vm.width + 'px'
- })
+ staticClass: "el-table-filter"
}, [_c('div', {
- staticClass: "el-time-panel__content",
- class: {
- 'has-seconds': _vm.showSeconds
+ 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"
}
- }, [_c('time-spinner', {
- ref: "spinner",
+ }, _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: {
- "show-seconds": _vm.showSeconds,
- "hours": _vm.hours,
- "minutes": _vm.minutes,
- "seconds": _vm.seconds
+ "disabled": _vm.filteredValue.length === 0
},
on: {
- "change": _vm.handleChange,
- "select-range": _vm.setSelectionRange
+ "click": _vm.handleConfirm
}
- })], 1), _c('div', {
- staticClass: "el-time-panel__footer"
- }, [_c('button', {
- staticClass: "el-time-panel__btn cancel",
- attrs: {
- "type": "button"
- },
+ }, [_vm._v(_vm._s(_vm.t('el.table.confirmFilter')))]), _c('button', {
on: {
- "click": _vm.handleCancel
+ "click": _vm.handleReset
}
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.cancel')))]), _c('button', {
- staticClass: "el-time-panel__btn confirm",
- attrs: {
- "type": "button"
+ }, [_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.handleConfirm()
+ _vm.handleSelect(null)
}
}
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.confirm')))])])])])
+ }, [_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: []}
/***/ },
-/* 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
- )
+/* 145 */
+/***/ function(module, exports) {
- module.exports = Component.exports
+ 'use strict';
+ exports.__esModule = true;
+ exports.default = {
+ name: 'ElTableFooter',
-/***/ },
-/* 165 */
-/***/ function(module, exports, __webpack_require__) {
+ render: function render(h) {
+ var _this = this;
- 'use strict';
+ 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(Math.min(precision, 20)));
+ } else {
+ return prev;
+ }
+ }, 0);
+ } else {
+ sums[index] = '';
+ }
+ });
- exports.__esModule = true;
+ 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' } },
+ []
+ ) : '']
+ )]
+ )]
+ );
+ },
- var _dom = __webpack_require__(44);
- exports.default = {
props: {
- disabledDate: {},
- date: {},
- year: {}
+ fixed: String,
+ store: {
+ required: true
+ },
+ layout: {
+ required: true
+ },
+ summaryMethod: Function,
+ sumText: String,
+ border: Boolean,
+ defaultSort: {
+ type: Object,
+ default: function _default() {
+ return {
+ prop: '',
+ order: ''
+ };
+ }
+ }
},
computed: {
- startYear: function startYear() {
- return Math.floor(this.year / 10) * 10;
+ 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: {
- 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;
- }
+ 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;
}
- if (date - nextYear === 0) flag = true;
+ return before < this.columnsCount - this.rightFixedCount;
+ } else {
+ return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
}
+ }
+ }
+ };
- style.disabled = flag;
- style.current = Number(this.year) === year;
+/***/ },
+/* 146 */
+/***/ function(module, exports) {
- return style;
- },
- nextTenYear: function nextTenYear() {
- this.$emit('pick', Number(this.year) + 10, false);
+ 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--hidden': _vm.isHidden,
+ '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
},
- 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));
+ on: {
+ "mouseleave": function($event) {
+ _vm.handleMouseLeave($event)
}
}
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
-
-/***/ },
-/* 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('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
}
- }, [_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')])])])
+ })], 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: []}
/***/ },
-/* 167 */
+/* 147 */
/***/ 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
- )
+ 'use strict';
- module.exports = Component.exports
+ 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;
/***/ },
-/* 168 */
+/* 148 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _locale = __webpack_require__(10);
-
- var _locale2 = _interopRequireDefault(_locale);
+ var _checkbox = __webpack_require__(130);
- var _dom = __webpack_require__(44);
+ var _checkbox2 = _interopRequireDefault(_checkbox);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _tag = __webpack_require__(109);
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ var _tag2 = _interopRequireDefault(_tag);
- exports.default = {
- props: {
- disabledDate: {},
- date: {},
- month: {
- type: Number
- }
- },
- mixins: [_locale2.default],
- methods: {
- getCellStyle: function getCellStyle(month) {
- var style = {};
+ var _merge = __webpack_require__(64);
- 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 _merge2 = _interopRequireDefault(_merge);
- var flag = false;
- if (typeof this.disabledDate === 'function') {
+ var _util = __webpack_require__(107);
- while (date < nextMonth) {
- if (this.disabledDate(date)) {
- date = new Date(date.getTime() + 8.64e7);
- flag = true;
- } else {
- flag = false;
- break;
- }
- }
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- style.disabled = flag;
- style.current = this.month === month;
+ function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }
- 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;
+ var columnIdSeed = 1;
- this.$emit('pick', month);
- }
+ 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: ''
}
};
-/***/ },
-/* 169 */
-/***/ function(module, exports) {
+ 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;
- 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
- )
+ 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;
- module.exports = Component.exports
+ 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);
-/***/ },
-/* 171 */
-/***/ function(module, exports, __webpack_require__) {
+ return '';
+ },
+ renderCell: function renderCell(h, _ref5, proxy) {
+ var row = _ref5.row,
+ store = _ref5.store;
- 'use strict';
+ 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'
+ }
+ };
- exports.__esModule = true;
+ var getDefaultColumn = function getDefaultColumn(type, options) {
+ var column = {};
- var _util = __webpack_require__(153);
+ (0, _merge2.default)(column, defaults[type || 'default']);
- var _dom = __webpack_require__(44);
+ for (var name in options) {
+ if (options.hasOwnProperty(name)) {
+ var value = options[name];
+ if (typeof value !== 'undefined') {
+ column[name] = value;
+ }
+ }
+ }
- var _locale = __webpack_require__(10);
+ if (!column.minWidth) {
+ column.minWidth = 80;
+ }
- var _locale2 = _interopRequireDefault(_locale);
+ column.realWidth = column.width || column.minWidth;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ return column;
+ };
- var _WEEKS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ var DEFAULT_RENDER_CELL = function DEFAULT_RENDER_CELL(h, _ref6) {
+ var row = _ref6.row,
+ column = _ref6.column;
- var clearHours = function clearHours(time) {
- var cloneDate = new Date(time);
- cloneDate.setHours(0, 0, 0, 0);
- return cloneDate.getTime();
+ 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 = {
- mixins: [_locale2.default],
+ name: 'ElTableColumn',
props: {
- firstDayOfWeek: {
- default: 7,
- type: Number,
- validator: function validator(val) {
- return val >= 1 && val <= 7;
- }
+ type: {
+ type: String,
+ default: 'default'
},
-
- date: {},
-
- year: {},
-
- month: {},
-
- week: {},
-
- selectionMode: {
- default: 'day'
+ label: String,
+ className: String,
+ labelClassName: String,
+ property: String,
+ prop: String,
+ width: {},
+ minWidth: {},
+ renderHeader: Function,
+ sortable: {
+ type: [String, Boolean],
+ default: false
},
-
- showWeekNumber: {
+ sortMethod: Function,
+ resizable: {
type: Boolean,
- default: false
+ 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
+ }
+ },
- disabledDate: {},
+ data: function data() {
+ return {
+ isSubColumn: false,
+ columns: []
+ };
+ },
+ beforeCreate: function beforeCreate() {
+ this.row = {};
+ this.column = {};
+ this.$index = 0;
+ },
- minDate: {},
- maxDate: {},
+ components: {
+ ElCheckbox: _checkbox2.default,
+ ElTag: _tag2.default
+ },
- rangeState: {
- default: function _default() {
- return {
- endDate: null,
- selecting: false,
- row: null,
- column: null
- };
+ computed: {
+ owner: function owner() {
+ var parent = this.$parent;
+ while (parent && !parent.tableId) {
+ parent = parent.$parent;
}
+ return parent;
}
},
- 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);
+ created: function created() {
+ var _this = this;
- day = day === 0 ? 7 : day;
+ 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 offset = this.offsetDay;
- var rows = this.tableRows;
- var count = 1;
- var firstDayPosition = void 0;
+ var parent = this.$parent;
+ var owner = this.owner;
+ this.isSubColumn = owner !== parent;
- var startDate = this.startDate;
- var disabledDate = this.disabledDate;
- var now = clearHours(new Date());
+ var type = this.type;
- for (var i = 0; i < 6; i++) {
- var row = rows[i];
+ var width = this.width;
+ if (width !== undefined) {
+ width = parseInt(width, 10);
+ if (isNaN(width)) {
+ width = null;
+ }
+ }
- if (this.showWeekNumber) {
- if (!row[0]) {
- row[0] = { type: 'week', text: (0, _util.getWeekNumber)(new Date(startDate.getTime() + _util.DAY_DURATION * (i * 7 + 1))) };
- }
- }
+ var minWidth = this.minWidth;
+ if (minWidth !== undefined) {
+ minWidth = parseInt(minWidth, 10);
+ if (isNaN(minWidth)) {
+ minWidth = 80;
+ }
+ }
- 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 };
- }
+ var isColumnGroup = false;
- cell.type = 'normal';
+ 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 || ''
+ });
- 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;
+ (0, _merge2.default)(column, forced[type] || {});
- if (isToday) {
- cell.type = 'today';
- }
+ this.columnConfig = column;
- 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';
- }
- }
+ var renderCell = column.renderCell;
+ var _self = this;
- cell.disabled = typeof disabledDate === 'function' && disabledDate(new Date(time));
+ if (type === 'expand') {
+ owner.renderExpanded = function (h, data) {
+ return _self.$scopedSlots.default ? _self.$scopedSlots.default(data) : _self.$slots.default;
+ };
- this.$set(row, this.showWeekNumber ? j + 1 : j, cell);
- }
+ column.renderCell = function (h, data) {
+ return h(
+ 'div',
+ { 'class': 'cell' },
+ [renderCell(h, data, this._renderProxy)]
+ );
+ };
- if (this.selectionMode === 'week') {
- var start = this.showWeekNumber ? 1 : 0;
- var end = this.showWeekNumber ? 7 : 6;
- var isWeekActive = this.isWeekActive(row[start + 1]);
+ return;
+ }
- row[start].inRange = isWeekActive;
- row[start].start = isWeekActive;
- row[end].inRange = isWeekActive;
- row[end].end = isWeekActive;
- }
+ 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);
+ };
}
- rows.firstDayPosition = firstDayPosition;
+ if (!renderCell) {
+ renderCell = DEFAULT_RENDER_CELL;
+ }
- return rows;
- }
+ 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: {
- 'rangeState.endDate': function rangeStateEndDate(newVal) {
- this.markRange(newVal);
+ label: function label(newVal) {
+ if (this.columnConfig) {
+ this.columnConfig.label = 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();
+ prop: function prop(newVal) {
+ if (this.columnConfig) {
+ this.columnConfig.property = newVal;
}
},
- maxDate: function maxDate(newVal, oldVal) {
- if (newVal && !oldVal) {
- this.rangeState.selecting = false;
- this.markRange(newVal);
- this.$emit('pick', {
- minDate: this.minDate,
- maxDate: this.maxDate
- });
+ 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;
}
}
},
- data: function data() {
- return {
- tableRows: [[], [], [], [], [], []]
- };
- },
+ 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);
+ }
- methods: {
- getCellClasses: function getCellClasses(cell) {
- var selectionMode = this.selectionMode;
- var monthDate = this.monthDate;
+ owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null);
+ }
+ };
- 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);
- }
+/***/ },
+/* 149 */
+/***/ function(module, exports, __webpack_require__) {
- 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');
- }
+ 'use strict';
- if (cell.inRange && (cell.type === 'normal' || cell.type === 'today' || this.selectionMode === 'week')) {
- classes.push('in-range');
+ exports.__esModule = true;
- if (cell.start) {
- classes.push('start-date');
- }
+ var _datePicker = __webpack_require__(150);
- if (cell.end) {
- classes.push('end-date');
- }
- }
+ var _datePicker2 = _interopRequireDefault(_datePicker);
- if (cell.disabled) {
- classes.push('disabled');
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- return classes.join(' ');
- },
- getDateOfCell: function getDateOfCell(row, column) {
- var startDate = this.startDate;
+ /* istanbul ignore next */
+ _datePicker2.default.install = function install(Vue) {
+ Vue.component(_datePicker2.default.name, _datePicker2.default);
+ };
- 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)];
+ exports.default = _datePicker2.default;
- 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();
+/***/ },
+/* 150 */
+/***/ function(module, exports, __webpack_require__) {
- if (cell.type === 'prev-month') {
- newDate.setMonth(month === 0 ? 11 : month - 1);
- newDate.setFullYear(month === 0 ? year - 1 : year);
- }
+ 'use strict';
- if (cell.type === 'next-month') {
- newDate.setMonth(month === 11 ? 0 : month + 1);
- newDate.setFullYear(month === 11 ? year + 1 : year);
- }
+ exports.__esModule = true;
- newDate.setDate(parseInt(cell.text, 10));
+ var _picker = __webpack_require__(151);
- return (0, _util.getWeekNumber)(newDate) === this.week;
- },
- markRange: function markRange(maxDate) {
- var startDate = this.startDate;
- if (!maxDate) {
- maxDate = this.maxDate;
- }
+ var _picker2 = _interopRequireDefault(_picker);
- 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 _date = __webpack_require__(156);
- var cell = row[j];
- var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
- var time = startDate.getTime() + _util.DAY_DURATION * (index - this.offsetDay);
+ var _date2 = _interopRequireDefault(_date);
- 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;
+ var _dateRange = __webpack_require__(174);
- this.$emit('changerange', {
- minDate: this.minDate,
- maxDate: this.maxDate,
- rangeState: this.rangeState
- });
+ var _dateRange2 = _interopRequireDefault(_dateRange);
- var target = event.target;
- if (target.tagName !== 'TD') return;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var column = target.cellIndex;
- var row = target.parentNode.rowIndex - 1;
- var _rangeState = this.rangeState,
- oldRow = _rangeState.row,
- oldColumn = _rangeState.column;
+ var getPanel = function getPanel(type) {
+ if (type === 'daterange' || type === 'datetimerange') {
+ return _dateRange2.default;
+ }
+ return _date2.default;
+ };
+ exports.default = {
+ mixins: [_picker2.default],
- if (oldRow !== row || oldColumn !== column) {
- this.rangeState.row = row;
- this.rangeState.column = column;
+ name: 'ElDatePicker',
- this.rangeState.endDate = this.getDateOfCell(row, column);
+ 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);
}
- },
- 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;
+ created: function created() {
+ this.panel = getPanel(this.type);
+ }
+ };
- var selectionMode = this.selectionMode;
+/***/ },
+/* 151 */
+/***/ function(module, exports, __webpack_require__) {
- if (selectionMode === 'week') {
- target = target.parentNode.cells[1];
- }
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(152),
+ /* template */
+ __webpack_require__(155),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- var year = Number(this.year);
- var month = Number(this.month);
+ module.exports = Component.exports
- var cellIndex = target.cellIndex;
- var rowIndex = target.parentNode.rowIndex;
- var cell = this.rows[rowIndex - 1][cellIndex];
- var text = cell.text;
- var className = target.className;
+/***/ },
+/* 152 */
+/***/ function(module, exports, __webpack_require__) {
- var newDate = new Date(year, month, 1);
+ 'use strict';
- 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);
- }
+ exports.__esModule = true;
- newDate.setDate(parseInt(text, 10));
+ var _vue = __webpack_require__(133);
- if (this.selectionMode === 'range') {
- if (this.minDate && this.maxDate) {
- var minDate = new Date(newDate.getTime());
- var maxDate = null;
+ var _vue2 = _interopRequireDefault(_vue);
- 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;
+ var _clickoutside = __webpack_require__(21);
- this.$emit('pick', {
- minDate: this.minDate,
- maxDate: _maxDate
- });
- } else {
- var _minDate = new Date(newDate.getTime());
+ var _clickoutside2 = _interopRequireDefault(_clickoutside);
- this.$emit('pick', { minDate: _minDate, maxDate: this.maxDate }, false);
- }
- } else if (!this.minDate) {
- var _minDate2 = new Date(newDate.getTime());
+ var _util = __webpack_require__(153);
- 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 _vuePopper = __webpack_require__(24);
- var value = newDate.getFullYear() + 'w' + weekNumber;
- this.$emit('pick', {
- year: newDate.getFullYear(),
- week: weekNumber,
- value: value,
- date: newDate
- });
- }
+ 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];
-/***/ },
-/* 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"
+ 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;
},
- on: {
- "click": _vm.handleClick,
- "mousemove": _vm.handleMouseMove
+ parser: function parser(text) {
+ if (text === undefined || text === '') return null;
+ return text;
}
- }, [_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) {
+ },
+ week: {
+ formatter: function formatter(value, format) {
+ var date = (0, _util.formatDate)(value, format);
+ var week = (0, _util.getWeekNumber)(value);
- 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"
+ date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
+ return date;
},
- 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)
+ 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;
}
}
- }, [_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"
+ 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;
},
- nativeOn: {
- "change": function($event) {
- _vm.visibleDate = $event.target.value
+ parser: function parser(text) {
+ var result = Number(text);
+
+ if (!isNaN(text)) {
+ return result;
+ } else {
+ return null;
}
}
- })], 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"
+ }
+ };
+ 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
},
- on: {
- "focus": function($event) {
- _vm.timePickerVisible = !_vm.timePickerVisible
- }
+ popperClass: String,
+ editable: {
+ type: Boolean,
+ default: true
},
- 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
+ align: {
+ type: String,
+ default: 'left'
},
- 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"
+ value: {},
+ defaultValue: {},
+ rangeSeparator: {
+ default: ' - '
},
- 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"
+ 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();
},
- 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'
+ currentValue: function currentValue(val) {
+ if (val) return;
+ if (this.picker && typeof this.picker.handleClear === 'function') {
+ this.picker.handleClear();
+ } else {
+ this.$emit('input');
+ }
},
- 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"
+
+ value: {
+ immediate: true,
+ handler: function handler(val) {
+ this.currentValue = (0, _util.isDate)(val) ? new Date(val) : val;
+ }
},
- on: {
- "click": _vm.nextYear
+ displayValue: function displayValue(val) {
+ this.$emit('change', val);
+ this.dispatch('ElFormItem', 'el.form.change');
}
- }), _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"
+ },
+
+ computed: {
+ reference: function reference() {
+ return this.$refs.reference.$el;
},
- 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
+ refInput: function refInput() {
+ if (this.reference) return this.reference.querySelector('input');
+ return {};
},
- 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
+ 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;
},
- 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
+ triggerClass: function triggerClass() {
+ return this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date';
},
- 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:"
+ 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';
},
- on: {
- "click": _vm.changeToNow
- }
- }, [_vm._v(_vm._s(_vm.t('el.datepicker.now')))]), _c('button', {
- staticClass: "el-picker-panel__btn",
- attrs: {
- "type": "button"
+ haveTrigger: function haveTrigger() {
+ if (typeof this.showTrigger !== 'undefined') {
+ return this.showTrigger;
+ }
+ return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
},
- 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
- )
+ 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];
- module.exports = Component.exports
+ 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();
+ }
+ }
+ },
-/***/ },
-/* 175 */
-/***/ function(module, exports, __webpack_require__) {
+ created: function created() {
+ // vue-popper
+ this.popperOptions = {
+ boundariesPadding: 0,
+ gpuAcceleration: false
+ };
+ this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
+ },
- 'use strict';
- exports.__esModule = true;
+ 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;
+ }
- var _util = __webpack_require__(153);
+ return false;
+ },
+ handleClose: function handleClose() {
+ this.pickerVisible = false;
+ },
+ handleFocus: function handleFocus() {
+ var type = this.type;
- var _locale = __webpack_require__(10);
+ 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;
- var _locale2 = _interopRequireDefault(_locale);
+ // 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;
- var _time = __webpack_require__(158);
+ if (this.$isServer) return;
+ if (!this.picker) {
+ this.mountPicker();
+ }
+ this.pickerVisible = this.picker.visible = true;
- var _time2 = _interopRequireDefault(_time);
+ this.updatePopper();
- var _dateTable = __webpack_require__(170);
+ 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();
- var _dateTable2 = _interopRequireDefault(_dateTable);
+ this.$nextTick(function () {
+ _this.picker.ajustScrollTop && _this.picker.ajustScrollTop();
+ });
+ },
+ mountPicker: function mountPicker() {
+ var _this2 = this;
- var _input = __webpack_require__(20);
+ 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 _input2 = _interopRequireDefault(_input);
+ var updateOptions = function updateOptions() {
+ var options = _this2.pickerOptions;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ if (options && options.selectableRange) {
+ (function () {
+ var ranges = options.selectableRange;
+ var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
+ var format = DEFAULT_FORMATS.timerange;
- exports.default = {
- mixins: [_locale2.default],
+ ranges = Array.isArray(ranges) ? ranges : [ranges];
+ _this2.picker.selectableRange = ranges.map(function (range) {
+ return parser(range, format, _this2.rangeSeparator);
+ });
+ })();
+ }
- 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) : '';
+ 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();
+ });
},
- minVisibleTime: function minVisibleTime() {
- return this.minDate ? (0, _util.formatDate)(this.minDate, 'HH:mm:ss') : '';
+ 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__(111);
+
+ 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'];
+ var getI18nSettings = function getI18nSettings() {
+ return {
+ 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));
+ }),
+ amPm: ['am', 'pm']
+ };
+ };
+
+ 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', getI18nSettings());
+ };
+
+ var parseDate = exports.parseDate = function parseDate(string, format) {
+ return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings());
+ };
+
+ 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__(55);
+
+/***/ },
+/* 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
},
- maxVisibleTime: function maxVisibleTime() {
- return this.maxDate || this.minDate ? (0, _util.formatDate)(this.maxDate || this.minDate, 'HH:mm:ss') : '';
+ on: {
+ "focus": _vm.handleFocus,
+ "blur": _vm.handleBlur
},
- 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);
+ nativeOn: {
+ "keydown": function($event) {
+ _vm.handleKeydown($event)
+ },
+ "change": function($event) {
+ _vm.displayValue = $event.target.value
}
- return newDate;
}
- },
+ }, [(_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: []}
- 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
- };
- },
+/***/ },
+/* 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 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;
+ var inputElm = _this.$refs.input.$el;
+ if (inputElm) {
+ _this.pickerWidth = inputElm.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)]];
+ 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;
}
- });
- },
- minTimePickerVisible: function minTimePickerVisible(val) {
- var _this3 = this;
-
- if (val) this.$nextTick(function () {
- return _this3.$refs.minTimePicker.ajustScrollTop();
- });
+ this.date = newVal;
+ this.year = newVal.getFullYear();
+ this.month = newVal.getMonth();
+ this.$emit('pick', newVal, false);
+ }
},
- maxTimePickerVisible: function maxTimePickerVisible(val) {
- var _this4 = this;
+ timePickerVisible: function timePickerVisible(val) {
+ var _this2 = this;
if (val) this.$nextTick(function () {
- return _this4.$refs.maxTimePicker.ajustScrollTop();
+ return _this2.$refs.timepicker.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);
+ 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.minDate = null;
- this.maxDate = null;
- this.handleConfirm(false);
+ this.date = this.$options.defaultValue ? new Date(this.$options.defaultValue) : new Date();
+ this.$emit('pick');
},
- 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());
- }
- }
+ resetDate: function resetDate() {
+ this.date = new Date(this.date);
},
- handleChangeRange: function handleChangeRange(val) {
- this.minDate = val.minDate;
- this.maxDate = val.maxDate;
- this.rangeState = val.rangeState;
+ showMonthPicker: function showMonthPicker() {
+ this.currentView = 'month';
},
- 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;
- }
- }
- }
+ 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--;
}
},
- 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;
+ nextMonth: function nextMonth() {
+ this.month++;
+ if (this.month > 11) {
+ this.month = 0;
+ this.year++;
}
},
- 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;
+ nextYear: function nextYear() {
+ if (this.currentView === 'year') {
+ this.$refs.yearTable.nextTenYear();
+ } else {
+ this.year++;
+ this.date.setFullYear(this.year);
+ this.resetDate();
}
- 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();
+ 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);
}
},
- 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);
+ 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.minTimePickerVisible = visible;
+ this.timePickerVisible = visible;
}
},
- handleMaxTimePick: function handleMaxTimePick(value, visible, first) {
- if (!this.maxDate) {
- var now = new Date();
- if (now >= this.minDate) {
- this.maxDate = new Date();
+ 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);
}
- if (this.maxDate && value) {
- this.maxDate = this.setTime(this.maxDate, value);
- }
+ this.resetDate();
+ },
+ handleYearPick: function handleYearPick(year) {
+ var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
- if (!first) {
- this.maxTimePickerVisible = visible;
+ 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';
}
- },
- 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);
+ changeToNow: function changeToNow() {
+ this.date.setTime(+new Date());
+ this.$emit('pick', new Date(this.date.getTime()));
this.resetDate();
},
- handleConfirm: function handleConfirm() {
- var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
-
- this.$emit('pick', [this.minDate, this.maxDate], visible);
+ confirm: function confirm() {
+ this.date.setMilliseconds(0);
+ this.$emit('pick', this.date);
},
- resetDate: function resetDate() {
- this.date = new Date(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, DateTable: _dateTable2.default, ElInput: _input2.default }
+ 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';
+ }
+ }
+ }
}; //
//
//
@@ -48132,6 +47341,55 @@ module.exports =
//
//
//
+
+/***/ },
+/* 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 }; }
+
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -48153,309 +47411,139 @@ module.exports =
//
//
-/***/ },
-/* 176 */
-/***/ function(module, exports) {
+ exports.default = {
+ mixins: [_locale2.default],
- 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)
- }
+ components: {
+ TimeSpinner: __webpack_require__(160)
+ },
+
+ props: {
+ pickerWidth: {},
+ date: {
+ default: function _default() {
+ return new Date();
}
- }, [_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
+ visible: Boolean
+ },
+
+ watch: {
+ visible: function visible(val) {
+ this.currentVisible = val;
},
- on: {
- "focus": function($event) {
- _vm.minTimePickerVisible = !_vm.minTimePickerVisible
- }
+ pickerWidth: function pickerWidth(val) {
+ this.width = val;
},
- nativeOn: {
- "change": function($event) {
- _vm.handleTimeChange($event, 'min')
+ 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();
}
- }
- }), _c('time-picker', {
- ref: "minTimePicker",
- attrs: {
- "picker-width": _vm.minPickerWidth,
- "date": _vm.minDate,
- "visible": _vm.minTimePickerVisible
+
+ this.handleChange({
+ hours: date.getHours(),
+ minutes: date.getMinutes(),
+ seconds: date.getSeconds()
+ });
+ this.$nextTick(function (_) {
+ return _this.ajustScrollTop();
+ });
},
- on: {
- "pick": _vm.handleMinTimePick
+ selectableRange: function selectableRange(val) {
+ this.$refs.spinner.selectableRange = val;
}
- })], 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')
- }
+ },
+
+ 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;
}
- })], 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
+ },
+
+ methods: {
+ handleClear: function handleClear() {
+ this.$emit('pick');
},
- on: {
- "focus": function($event) {
- _vm.minDate && (_vm.maxTimePickerVisible = !_vm.maxTimePickerVisible)
- }
+ handleCancel: function handleCancel() {
+ this.$emit('pick');
},
- nativeOn: {
- "change": function($event) {
- _vm.handleTimeChange($event, 'max')
+ handleChange: function handleChange(date) {
+ if (date.hours !== undefined) {
+ this.currentDate.setHours(date.hours);
+ this.hours = this.currentDate.getHours();
}
- }
- }), _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"
+ 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);
},
- 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
+ setSelectionRange: function setSelectionRange(start, end) {
+ this.$emit('select-range', start, end);
},
- 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
+ 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);
},
- on: {
- "click": function($event) {
- _vm.handleConfirm()
- }
+ ajustScrollTop: function ajustScrollTop() {
+ return this.$refs.spinner.ajustScrollTop();
}
- }, [_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',
+ created: function created() {
+ this.hours = this.currentDate.getHours();
+ this.minutes = this.currentDate.getMinutes();
+ this.seconds = this.currentDate.getSeconds();
+ },
+ mounted: function mounted() {
+ var _this2 = this;
- beforeCreate: function beforeCreate() {
- this.type = 'time-select';
- this.panel = _timeSelect2.default;
+ this.$nextTick(function () {
+ return _this2.handleConfirm(true, true);
+ });
+ this.$emit('mounted');
}
};
/***/ },
-/* 179 */
+/* 160 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(180),
+ __webpack_require__(161),
/* template */
- __webpack_require__(181),
+ __webpack_require__(162),
/* styles */
null,
/* scopeId */
@@ -48468,354 +47556,160 @@ module.exports =
/***/ },
-/* 180 */
+/* 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 _scrollIntoView = __webpack_require__(112);
+ var _debounce = __webpack_require__(69);
- var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
+ var _debounce2 = _interopRequireDefault(_debounce);
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
- };
+ exports.default = {
+ components: { ElScrollbar: _scrollbar2.default },
- next.minutes += stepValue.minutes;
- next.hours += stepValue.hours;
+ props: {
+ hours: {
+ type: Number,
+ default: 0
+ },
- next.hours += Math.floor(next.minutes / 60);
- next.minutes = next.minutes % 60;
+ minutes: {
+ type: Number,
+ default: 0
+ },
- return formatTime(next);
- };
+ seconds: {
+ type: Number,
+ default: 0
+ },
- exports.default = {
- components: { ElScrollbar: _scrollbar2.default },
+ showSeconds: {
+ type: Boolean,
+ default: true
+ }
+ },
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');
+ hoursPrivate: function hoursPrivate(newVal, oldVal) {
+ if (!(newVal >= 0 && newVal <= 23)) {
+ this.hoursPrivate = oldVal;
}
- this.$nextTick(function () {
- return _this.scrollToOption();
- });
+ 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 });
}
},
- methods: {
- handleClick: function handleClick(item) {
- if (!item.disabled) {
- this.$emit('pick', item.value);
- }
+ computed: {
+ hoursList: function hoursList() {
+ return (0, _util.getRangeHours)(this.selectableRange);
},
- handleClear: function handleClear() {
- this.$emit('pick');
+ hourEl: function hourEl() {
+ return this.$refs.hour.wrap;
},
- 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]);
+ minuteEl: function minuteEl() {
+ return this.$refs.minute.wrap;
},
- handleMenuEnter: function handleMenuEnter() {
- var _this2 = this;
-
- this.$nextTick(function () {
- return _this2.scrollToOption();
- });
+ secondEl: function secondEl() {
+ return this.$refs.second.wrap;
}
},
data: function data() {
return {
- popperClass: '',
- start: '09:00',
- end: '18:00',
- step: '00:30',
- value: '',
- visible: false,
- minTime: '',
- maxTime: '',
- width: 0
+ 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;
- computed: {
- items: function items() {
- var start = this.start;
- var end = this.end;
- var step = this.step;
+ this.$nextTick(function () {
+ _this2.bindScrollEvent();
+ });
+ },
- 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);
- }
+ methods: {
+ handleClick: function handleClick(type, value, disabled) {
+ if (value.disabled) {
+ return;
}
- return result;
- }
- }
- };
-
-/***/ },
-/* 181 */
-/***/ function(module, exports) {
+ this[type + 'Private'] = value.value >= 0 ? value.value : value;
- 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"
+ this.emitSelectRange(type);
},
- 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)
- }
+ 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);
}
- }, [_vm._v(_vm._s(item.value))])
- }))], 1)])
- },staticRenderFns: []}
-
-/***/ },
-/* 182 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
+ },
+ bindScrollEvent: function bindScrollEvent() {
+ var _this3 = this;
- 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;
- }
+ 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), '' + type === 'hour' ? 23 : 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);
}
- },
-
- 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'); //
- //
- //
- //
- //
- //
- //
- //
+ }; //
//
//
//
@@ -48868,170 +47762,120 @@ module.exports =
//
//
- 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;
+/***/ },
+/* 162 */
+/***/ function(module, exports) {
- this.panelCreated();
- this.$nextTick(function (_) {
- return _this.ajustScrollTop();
- });
+ 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
}
- },
-
- 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);
+ }, [_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"
},
- 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();
+ nativeOn: {
+ "mouseenter": function($event) {
+ _vm.emitSelectRange('hours')
}
- if (date.seconds !== undefined) {
- this.maxTime.setSeconds(date.seconds);
- this.maxSeconds = this.maxTime.getSeconds();
+ }
+ }, _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)
+ }
}
- this.handleChange();
+ })
+ })), _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"
},
- 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();
+ nativeOn: {
+ "mouseenter": function($event) {
+ _vm.emitSelectRange('minutes')
}
- if (date.seconds !== undefined) {
- this.minTime.setSeconds(date.seconds);
- this.minSeconds = this.minTime.getSeconds();
+ }
+ }, _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)
+ }
}
-
- 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);
+ })
+ })), _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"
},
- ajustScrollTop: function ajustScrollTop() {
- this.$refs.minSpinner.ajustScrollTop();
- this.$refs.maxSpinner.ajustScrollTop();
+ nativeOn: {
+ "mouseenter": function($event) {
+ _vm.emitSelectRange('seconds')
+ }
}
- },
-
- mounted: function mounted() {
- var _this2 = this;
-
- this.$nextTick(function () {
- return _this2.handleConfirm(true, true);
- });
- }
- };
+ }, _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: []}
/***/ },
-/* 186 */
+/* 163 */
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
@@ -49040,7 +47884,6 @@ module.exports =
"name": "el-zoom-in-top"
},
on: {
- "before-enter": _vm.panelCreated,
"after-leave": function($event) {
_vm.$emit('dodestroy')
}
@@ -49049,59 +47892,32 @@ module.exports =
directives: [{
name: "show",
rawName: "v-show",
- value: (_vm.visible),
- expression: "visible"
+ value: (_vm.currentVisible),
+ expression: "currentVisible"
}],
- staticClass: "el-time-range-picker el-picker-panel",
+ staticClass: "el-time-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",
+ staticClass: "el-time-panel__content",
class: {
'has-seconds': _vm.showSeconds
}
}, [_c('time-spinner', {
- ref: "maxSpinner",
+ ref: "spinner",
attrs: {
"show-seconds": _vm.showSeconds,
- "hours": _vm.maxHours,
- "minutes": _vm.maxMinutes,
- "seconds": _vm.maxSeconds
+ "hours": _vm.hours,
+ "minutes": _vm.minutes,
+ "seconds": _vm.seconds
},
on: {
- "change": _vm.handleMaxChange,
- "select-range": _vm.setMaxSelectionRange
+ "change": _vm.handleChange,
+ "select-range": _vm.setSelectionRange
}
- })], 1)])]), _c('div', {
+ })], 1), _c('div', {
staticClass: "el-time-panel__footer"
}, [_c('button', {
staticClass: "el-time-panel__btn cancel",
@@ -49109,15 +47925,12 @@ module.exports =
"type": "button"
},
on: {
- "click": function($event) {
- _vm.handleCancel()
- }
+ "click": _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
+ "type": "button"
},
on: {
"click": function($event) {
@@ -49128,47 +47941,14 @@ module.exports =
},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__(133);
-
- 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 */
+/* 164 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(189),
+ __webpack_require__(165),
/* template */
- __webpack_require__(190),
+ __webpack_require__(166),
/* styles */
null,
/* scopeId */
@@ -49181,21 +47961,101 @@ module.exports =
/***/ },
-/* 189 */
+/* 165 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _vuePopper = __webpack_require__(24);
+ var _dom = __webpack_require__(44);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+ exports.default = {
+ props: {
+ disabledDate: {},
+ date: {},
+ year: {}
+ },
- var _dom = __webpack_require__(44);
+ computed: {
+ startYear: function startYear() {
+ return Math.floor(this.year / 10) * 10;
+ }
+ },
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ 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));
+ }
+ }
+ }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -49211,655 +48071,1033 @@ module.exports =
//
//
//
- //
- //
-
- exports.default = {
- name: 'ElPopover',
- mixins: [_vuePopper2.default],
+/***/ },
+/* 166 */
+/***/ function(module, exports) {
- 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'
+ 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: []}
- watch: {
- showPopper: function showPopper(newVal, oldVal) {
- newVal ? this.$emit('show') : this.$emit('hide');
+/***/ },
+/* 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__(44);
+
+ 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 = {};
- mounted: function mounted() {
- var reference = this.reference || this.$refs.reference;
- var popper = this.popper || this.$refs.popper;
+ 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);
- 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;
+ var flag = false;
+ if (typeof this.disabledDate === 'function') {
- 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;
+ while (date < nextMonth) {
+ if (this.disabledDate(date)) {
+ date = new Date(date.getTime() + 8.64e7);
+ flag = true;
+ } else {
+ flag = false;
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;
+ style.disabled = flag;
+ style.current = this.month === month;
- clearTimeout(this._timer);
- this._timer = setTimeout(function () {
- _this2.showPopper = false;
- }, 200);
+ return style;
},
- handleDocumentClick: function handleDocumentClick(e) {
- var reference = this.reference || this.$refs.reference;
- var popper = this.popper || this.$refs.popper;
+ 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;
- 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;
+ this.$emit('pick', month);
}
- },
-
- 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 */
+/* 169 */
/***/ 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
- },
+ return _c('table', {
+ staticClass: "el-month-table",
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)
+ "click": _vm.handleMonthTableClick
}
- }) : _vm._e(), _vm._t("default", [_vm._v(_vm._s(_vm.content))])], 2)]), _vm._t("reference")], 2)
+ }, [_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: []}
/***/ },
-/* 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 */
+/* 170 */
/***/ 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 }; }
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(171),
+ /* template */
+ __webpack_require__(172),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- /* istanbul ignore next */
- _main2.default.install = function (Vue) {
- Vue.component(_main2.default.name, _main2.default);
- };
+ module.exports = Component.exports
- exports.default = _main2.default;
/***/ },
-/* 193 */
+/* 171 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _vuePopper = __webpack_require__(24);
-
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
-
- var _debounce = __webpack_require__(69);
-
- var _debounce2 = _interopRequireDefault(_debounce);
+ var _util = __webpack_require__(153);
- var _vdom = __webpack_require__(194);
+ var _dom = __webpack_require__(44);
- var _vue = __webpack_require__(133);
+ var _locale = __webpack_require__(10);
- var _vue2 = _interopRequireDefault(_vue);
+ var _locale2 = _interopRequireDefault(_locale);
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'
+ 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;
+ }
},
- popperClass: String,
- content: String,
- visibleArrow: {
- default: true
+
+ date: {},
+
+ year: {},
+
+ month: {},
+
+ week: {},
+
+ selectionMode: {
+ default: 'day'
},
- transition: {
- type: String,
- default: 'el-fade-in-linear'
+
+ showWeekNumber: {
+ type: Boolean,
+ default: false
},
- popperOptions: {
+
+ disabledDate: {},
+
+ minDate: {},
+
+ maxDate: {},
+
+ rangeState: {
default: function _default() {
return {
- boundariesPadding: 10,
- gpuAcceleration: false
+ endDate: null,
+ selecting: false,
+ row: null,
+ column: null
};
}
- },
- enterable: {
- type: Boolean,
- default: true
}
},
- beforeCreate: function beforeCreate() {
- var _this = this;
+ 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);
- if (this.$isServer) return;
+ day = day === 0 ? 7 : day;
- this.popperVM = new _vue2.default({
- data: { node: '' },
- render: function render(h) {
- return this.node;
- }
- }).$mount();
+ var offset = this.offsetDay;
+ var rows = this.tableRows;
+ var count = 1;
+ var firstDayPosition = void 0;
- this.debounceClose = (0, _debounce2.default)(200, function () {
- return _this.handleClosePopper();
- });
- },
- render: function render(h) {
- var _this2 = this;
+ var startDate = this.startDate;
+ var disabledDate = this.disabledDate;
+ var now = clearHours(new Date());
- if (this.popperVM) {
- this.popperVM.node = h(
- 'transition',
- {
- attrs: {
- name: this.transition
- },
- on: {
- 'afterLeave': this.doDestroy
+ 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))) };
}
- },
- [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
- }],
+ 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 };
+ }
- 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
- [this.$slots.content || this.content]
- )]
- );
- }
+ cell.type = 'normal';
- if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
+ 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;
- 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 || {};
+ if (isToday) {
+ cell.type = 'today';
+ }
- 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');
+ 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';
+ }
+ }
- return vnode;
- },
- mounted: function mounted() {
- this.referenceElm = this.$el;
- },
+ cell.disabled = typeof disabledDate === 'function' && disabledDate(new Date(time));
+ this.$set(row, this.showWeekNumber ? j + 1 : j, cell);
+ }
- 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.selectionMode === 'week') {
+ var start = this.showWeekNumber ? 1 : 0;
+ var end = this.showWeekNumber ? 7 : 6;
+ var isWeekActive = this.isWeekActive(row[start + 1]);
- if (!this.expectedState || this.manual) return;
- clearTimeout(this.timeout);
- this.timeout = setTimeout(function () {
- _this3.showPopper = true;
- }, this.openDelay);
+ 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);
},
- handleClosePopper: function handleClosePopper() {
- if (this.enterable && this.expectedState || this.manual) return;
- clearTimeout(this.timeout);
- this.showPopper = false;
+ 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();
+ }
},
- setExpectedState: function setExpectedState(expectedState) {
- this.expectedState = expectedState;
+ maxDate: function maxDate(newVal, oldVal) {
+ if (newVal && !oldVal) {
+ this.rangeState.selecting = false;
+ this.markRange(newVal);
+ this.$emit('pick', {
+ minDate: this.minDate,
+ maxDate: this.maxDate
+ });
+ }
}
- }
- };
+ },
-/***/ },
-/* 194 */
-/***/ function(module, exports) {
+ data: function data() {
+ return {
+ tableRows: [[], [], [], [], [], []]
+ };
+ },
- module.exports = __webpack_require__(27);
-/***/ },
-/* 195 */
-/***/ function(module, exports, __webpack_require__) {
+ methods: {
+ getCellClasses: function getCellClasses(cell) {
+ var selectionMode = this.selectionMode;
+ var monthDate = this.monthDate;
- 'use strict';
+ 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);
+ }
- exports.__esModule = true;
+ 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');
+ }
- var _main = __webpack_require__(196);
+ if (cell.inRange && (cell.type === 'normal' || cell.type === 'today' || this.selectionMode === 'week')) {
+ classes.push('in-range');
- var _main2 = _interopRequireDefault(_main);
+ if (cell.start) {
+ classes.push('start-date');
+ }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ if (cell.end) {
+ classes.push('end-date');
+ }
+ }
- exports.default = _main2.default;
+ if (cell.disabled) {
+ classes.push('disabled');
+ }
-/***/ },
-/* 196 */
-/***/ function(module, exports, __webpack_require__) {
+ return classes.join(' ');
+ },
+ getDateOfCell: function getDateOfCell(row, column) {
+ var startDate = this.startDate;
- 'use strict';
+ 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)];
- exports.__esModule = true;
- exports.MessageBox = undefined;
+ 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();
- 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; };
+ if (cell.type === 'prev-month') {
+ newDate.setMonth(month === 0 ? 11 : month - 1);
+ newDate.setFullYear(month === 0 ? year - 1 : year);
+ }
- var _vue = __webpack_require__(133);
+ if (cell.type === 'next-month') {
+ newDate.setMonth(month === 11 ? 0 : month + 1);
+ newDate.setFullYear(month === 11 ? year + 1 : year);
+ }
- var _vue2 = _interopRequireDefault(_vue);
+ newDate.setDate(parseInt(cell.text, 10));
- var _main = __webpack_require__(197);
+ return (0, _util.getWeekNumber)(newDate) === this.week;
+ },
+ markRange: function markRange(maxDate) {
+ var startDate = this.startDate;
+ if (!maxDate) {
+ maxDate = this.maxDate;
+ }
- var _main2 = _interopRequireDefault(_main);
+ 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 _merge = __webpack_require__(64);
+ var cell = row[j];
+ var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
+ var time = startDate.getTime() + _util.DAY_DURATION * (index - this.offsetDay);
- var _merge2 = _interopRequireDefault(_merge);
+ 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;
- var _vdom = __webpack_require__(194);
+ this.$emit('changerange', {
+ minDate: this.minDate,
+ maxDate: this.maxDate,
+ rangeState: this.rangeState
+ });
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var target = event.target;
+ if (target.tagName !== 'TD') return;
- 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 column = target.cellIndex;
+ var row = target.parentNode.rowIndex - 1;
+ var _rangeState = this.rangeState,
+ oldRow = _rangeState.row,
+ oldColumn = _rangeState.column;
- var MessageBoxConstructor = _vue2.default.extend(_main2.default);
- var currentMsg = void 0,
- instance = void 0;
- var msgQueue = [];
+ if (oldRow !== row || oldColumn !== column) {
+ this.rangeState.row = row;
+ this.rangeState.column = column;
- 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);
+ this.rangeState.endDate = this.getDateOfCell(row, column);
}
- }
- }
- };
+ },
+ handleClick: function handleClick(event) {
+ var target = event.target;
- var initInstance = function initInstance() {
- instance = new MessageBoxConstructor({
- el: document.createElement('div')
- });
+ if (target.tagName !== 'TD') return;
+ if ((0, _dom.hasClass)(target, 'disabled') || (0, _dom.hasClass)(target, 'week')) return;
- instance.callback = defaultCallback;
- };
+ var selectionMode = this.selectionMode;
- var showNextMsg = function showNextMsg() {
- if (!instance) {
- initInstance();
- }
- instance.action = '';
+ if (selectionMode === 'week') {
+ target = target.parentNode.cells[1];
+ }
- if (!instance.visible || instance.closeTimer) {
- if (msgQueue.length > 0) {
- (function () {
- currentMsg = msgQueue.shift();
+ var year = Number(this.year);
+ var month = Number(this.month);
- 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 cellIndex = target.cellIndex;
+ var rowIndex = target.parentNode.rowIndex;
- 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;
+ 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 {
- delete instance.$slots.default;
+ month = month - 1;
}
- ['modal', 'showClose', 'closeOnClickModal', 'closeOnPressEscape'].forEach(function (prop) {
- if (instance[prop] === undefined) {
- instance[prop] = true;
- }
- });
- document.body.appendChild(instance.$el);
+ 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);
+ }
- _vue2.default.nextTick(function () {
- instance.visible = true;
- });
- })();
- }
- }
- };
+ newDate.setDate(parseInt(text, 10));
- 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 (this.selectionMode === 'range') {
+ if (this.minDate && this.maxDate) {
+ var minDate = new Date(newDate.getTime());
+ var maxDate = null;
- 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
- });
+ 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;
- showNextMsg();
- });
- } else {
- msgQueue.push({
- options: (0, _merge2.default)({}, defaults, MessageBox.defaults, options),
- callback: callback
- });
+ this.$emit('pick', {
+ minDate: this.minDate,
+ maxDate: _maxDate
+ });
+ } else {
+ var _minDate = new Date(newDate.getTime());
- showNextMsg();
- }
- };
+ this.$emit('pick', { minDate: _minDate, maxDate: this.maxDate }, false);
+ }
+ } else if (!this.minDate) {
+ var _minDate2 = new Date(newDate.getTime());
- MessageBox.setDefaults = function (defaults) {
- MessageBox.defaults = defaults;
- };
+ 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);
- MessageBox.alert = function (message, title, options) {
- if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
- options = title;
- title = '';
- } else if (title === undefined) {
- title = '';
+ var value = newDate.getFullYear() + 'w' + weekNumber;
+ this.$emit('pick', {
+ year: newDate.getFullYear(),
+ week: weekNumber,
+ value: value,
+ date: newDate
+ });
+ }
+ }
}
- 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 = '';
- } else if (title === undefined) {
- title = '';
- }
- return MessageBox((0, _merge2.default)({
- title: title,
- message: message,
- $type: 'confirm',
- showCancelButton: true
- }, options));
- };
+/***/ },
+/* 172 */
+/***/ function(module, exports) {
- MessageBox.prompt = function (message, title, options) {
- if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
- options = title;
- title = '';
- } else if (title === undefined) {
- title = '';
- }
- return MessageBox((0, _merge2.default)({
- title: title,
- message: message,
- showCancelButton: true,
- showInput: true,
- $type: 'prompt'
- }, options));
- };
+ 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: []}
- MessageBox.close = function () {
- instance.visible = false;
- msgQueue = [];
- currentMsg = null;
- };
+/***/ },
+/* 173 */
+/***/ function(module, exports) {
- exports.default = MessageBox;
- exports.MessageBox = MessageBox;
+ 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: []}
/***/ },
-/* 197 */
+/* 174 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(198),
+ __webpack_require__(175),
/* template */
- __webpack_require__(199),
+ __webpack_require__(176),
/* styles */
null,
/* scopeId */
@@ -49872,503 +49110,777 @@ module.exports =
/***/ },
-/* 198 */
+/* 175 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _popup = __webpack_require__(14);
-
- var _popup2 = _interopRequireDefault(_popup);
+ var _util = __webpack_require__(153);
var _locale = __webpack_require__(10);
var _locale2 = _interopRequireDefault(_locale);
- var _input = __webpack_require__(20);
+ var _time = __webpack_require__(158);
- var _input2 = _interopRequireDefault(_input);
+ var _time2 = _interopRequireDefault(_time);
- var _button = __webpack_require__(31);
+ var _dateTable = __webpack_require__(170);
- var _button2 = _interopRequireDefault(_button);
+ var _dateTable2 = _interopRequireDefault(_dateTable);
- var _dom = __webpack_require__(44);
+ var _input = __webpack_require__(20);
- var _locale3 = __webpack_require__(111);
+ var _input2 = _interopRequireDefault(_input);
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],
+ mixins: [_locale2.default],
- props: {
- modal: {
- default: true
+ computed: {
+ btnDisabled: function btnDisabled() {
+ return !(this.minDate && this.maxDate && !this.selecting);
},
- lockScroll: {
- default: true
+ leftLabel: function leftLabel() {
+ return this.date.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.date.getMonth() + 1));
},
- showClose: {
- type: Boolean,
- default: true
+ rightLabel: function rightLabel() {
+ return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.rightDate.getMonth() + 1));
},
- closeOnClickModal: {
- default: true
+ leftYear: function leftYear() {
+ return this.date.getFullYear();
},
- closeOnPressEscape: {
- default: true
+ 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;
}
},
- components: {
- ElInput: _input2.default,
- ElButton: _button2.default
+ 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
+ };
},
- 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() {
+ watch: {
+ showTime: function showTime(val) {
var _this = this;
- var currentId = this.uid;
- return function () {
- _this.$nextTick(function () {
- if (currentId === _this.uid) _this.doClose();
- });
- };
+ 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;
+ }
+ });
},
- doClose: function doClose() {
+ minDate: function minDate() {
var _this2 = this;
- if (!this.visible) return;
- this.visible = false;
- this._closing = true;
+ this.$nextTick(function () {
+ if (_this2.maxDate && _this2.maxDate < _this2.minDate) {
+ var format = 'HH:mm:ss';
- this.onClose && this.onClose();
+ _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 (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 (val) this.$nextTick(function () {
+ return _this3.$refs.minTimePicker.ajustScrollTop();
+ });
+ },
+ maxTimePickerVisible: function maxTimePickerVisible(val) {
+ var _this4 = this;
- if (!this.transition) {
- this.doAfterClose();
- }
- if (this.action) this.callback(this.action, this);
+ if (val) this.$nextTick(function () {
+ return _this4.$refs.maxTimePicker.ajustScrollTop();
+ });
},
- handleWrapperClick: function handleWrapperClick() {
- if (this.closeOnClickModal) {
- this.handleAction('cancel');
+ 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);
},
- 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();
+ 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());
+ }
}
},
- 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;
+ 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());
}
- 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 (type === 'min') {
+ if (target < this.maxDate) {
+ this.minDate = new Date(target.getTime());
}
- if (typeof validateResult === 'string') {
- this.editorErrorMessage = validateResult;
- return false;
+ } else {
+ if (target > this.minDate) {
+ this.maxDate = new Date(target.getTime());
+ if (this.minDate && this.minDate > this.maxDate) {
+ this.minDate = null;
+ }
}
}
}
- 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();
+ },
+ 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;
- 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');
+ if (this.maxDate === val.maxDate && this.minDate === val.minDate) {
+ return;
}
- }
- },
-
- 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"
+ this.onPick && this.onPick(val);
+ this.maxDate = val.maxDate;
+ this.minDate = val.minDate;
+ if (!close || this.showTime) return;
+ this.handleConfirm();
},
- 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.showClose) ? _c('button', {
- staticClass: "el-message-box__headerbtn",
- attrs: {
- "type": "button",
- "aria-label": "Close"
+ changeToToday: function changeToToday() {
+ this.date = new Date();
},
- on: {
- "click": function($event) {
- _vm.handleAction('cancel')
+ handleShortcutClick: function handleShortcutClick(shortcut) {
+ if (shortcut.onClick) {
+ shortcut.onClick(this);
}
- }
- }, [_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')
- }
+ resetView: function resetView() {
+ this.minTimePickerVisible = false;
+ this.maxTimePickerVisible = false;
},
- 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
+ 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());
},
- nativeOn: {
- "click": function($event) {
- _vm.handleAction('cancel')
+ 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;
}
- }
- }, [_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')
+ handleMaxTimePick: function handleMaxTimePick(value, visible, first) {
+ if (!this.maxDate) {
+ var now = new Date();
+ if (now >= this.minDate) {
+ this.maxDate = new Date();
+ }
}
- }
- }, [_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);
+ if (this.maxDate && value) {
+ this.maxDate = this.setTime(this.maxDate, value);
+ }
- 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) {
+ 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;
- 'use strict';
+ this.$emit('pick', [this.minDate, this.maxDate], visible);
+ },
+ resetDate: function resetDate() {
+ this.date = new Date(this.date);
+ }
+ },
- exports.__esModule = true;
+ components: { TimePicker: _time2.default, DateTable: _dateTable2.default, ElInput: _input2.default }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
//
//
-
- exports.default = {
- name: 'ElBreadcrumb',
-
- props: {
- separator: {
- type: String,
- default: '/'
- }
- }
- };
/***/ },
-/* 203 */
+/* 176 */
/***/ 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)
+ 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: []}
/***/ },
-/* 204 */
+/* 177 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _breadcrumbItem = __webpack_require__(205);
+ var _timeSelect = __webpack_require__(178);
- var _breadcrumbItem2 = _interopRequireDefault(_breadcrumbItem);
+ var _timeSelect2 = _interopRequireDefault(_timeSelect);
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);
+ _timeSelect2.default.install = function (Vue) {
+ Vue.component(_timeSelect2.default.name, _timeSelect2.default);
};
- exports.default = _breadcrumbItem2.default;
+ exports.default = _timeSelect2.default;
/***/ },
-/* 205 */
+/* 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__(206),
+ __webpack_require__(180),
/* template */
- __webpack_require__(207),
+ __webpack_require__(181),
/* styles */
null,
/* scopeId */
@@ -50381,254 +49893,315 @@ module.exports =
/***/ },
-/* 206 */
-/***/ function(module, exports) {
+/* 180 */
+/***/ function(module, exports, __webpack_require__) {
'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);
- });
- }
- }
- };
+ var _scrollbar = __webpack_require__(25);
-/***/ },
-/* 207 */
-/***/ function(module, exports) {
+ var _scrollbar2 = _interopRequireDefault(_scrollbar);
- 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: []}
+ var _scrollIntoView = __webpack_require__(112);
-/***/ },
-/* 208 */
-/***/ function(module, exports, __webpack_require__) {
+ var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
- 'use strict';
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- var _form = __webpack_require__(209);
+ 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);
- var _form2 = _interopRequireDefault(_form);
+ return {
+ hours: hours,
+ minutes: minutes
+ };
+ }
+ /* istanbul ignore next */
+ return null;
+ };
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var compareTime = function compareTime(time1, time2) {
+ var value1 = parseTime(time1);
+ var value2 = parseTime(time2);
- /* istanbul ignore next */
- _form2.default.install = function (Vue) {
- Vue.component(_form2.default.name, _form2.default);
- };
+ var minutes1 = value1.minutes + value1.hours * 60;
+ var minutes2 = value2.minutes + value2.hours * 60;
- exports.default = _form2.default;
+ if (minutes1 === minutes2) {
+ return 0;
+ }
-/***/ },
-/* 209 */
-/***/ function(module, exports, __webpack_require__) {
+ return minutes1 > minutes2 ? 1 : -1;
+ };
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(210),
- /* template */
- __webpack_require__(211),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var formatTime = function formatTime(time) {
+ return (time.hours < 10 ? '0' + time.hours : time.hours) + ':' + (time.minutes < 10 ? '0' + time.minutes : time.minutes);
+ };
- module.exports = Component.exports
+ var nextTime = function nextTime(time, step) {
+ var timeValue = parseTime(time);
+ var stepValue = parseTime(step);
+ var next = {
+ hours: timeValue.hours,
+ minutes: timeValue.minutes
+ };
-/***/ },
-/* 210 */
-/***/ function(module, exports, __webpack_require__) {
+ next.minutes += stepValue.minutes;
+ next.hours += stepValue.hours;
- 'use strict';
+ next.hours += Math.floor(next.minutes / 60);
+ next.minutes = next.minutes % 60;
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
+ return formatTime(next);
+ };
exports.default = {
- name: 'ElForm',
+ components: { ElScrollbar: _scrollbar2.default },
- componentName: 'ElForm',
+ watch: {
+ value: function value(val) {
+ var _this = this;
- props: {
- model: Object,
- rules: Object,
- labelPosition: String,
- labelWidth: String,
- labelSuffix: {
- type: String,
- default: ''
- },
- inline: Boolean,
- showMessage: {
- type: Boolean,
- default: true
+ 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();
+ });
}
},
- watch: {
- rules: function rules() {
- this.validate();
+
+ 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 {
- fields: []
+ popperClass: '',
+ start: '09:00',
+ end: '18:00',
+ step: '00:30',
+ value: '',
+ visible: false,
+ minTime: '',
+ maxTime: '',
+ width: 0
};
},
- 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;
+ computed: {
+ items: function items() {
+ var start = this.start;
+ var end = this.end;
+ var step = this.step;
- 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!');
+ 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);
+ }
}
- field.validate('', cb);
+ return result;
}
}
};
/***/ },
-/* 211 */
+/* 181 */
/***/ 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
+ return _c('transition', {
+ attrs: {
+ "name": "el-zoom-in-top"
+ },
+ on: {
+ "before-enter": _vm.handleMenuEnter,
+ "after-leave": function($event) {
+ _vm.$emit('dodestroy')
}
- ]
- }, [_vm._t("default")], 2)
+ }
+ }, [_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: []}
/***/ },
-/* 212 */
+/* 182 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _formItem = __webpack_require__(213);
+ var _timePicker = __webpack_require__(183);
- var _formItem2 = _interopRequireDefault(_formItem);
+ var _timePicker2 = _interopRequireDefault(_timePicker);
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);
+ _timePicker2.default.install = function (Vue) {
+ Vue.component(_timePicker2.default.name, _timePicker2.default);
};
- exports.default = _formItem2.default;
+ exports.default = _timePicker2.default;
/***/ },
-/* 213 */
+/* 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__(214),
+ __webpack_require__(185),
/* template */
- __webpack_require__(216),
+ __webpack_require__(186),
/* styles */
null,
/* scopeId */
@@ -50641,23 +50214,67 @@ module.exports =
/***/ },
-/* 214 */
+/* 185 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _asyncValidator = __webpack_require__(215);
+ var _util = __webpack_require__(153);
- var _asyncValidator2 = _interopRequireDefault(_asyncValidator);
+ var _locale = __webpack_require__(10);
- var _emitter = __webpack_require__(15);
+ var _locale2 = _interopRequireDefault(_locale);
- var _emitter2 = _interopRequireDefault(_emitter);
+ 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'); //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -50676,304 +50293,307 @@ module.exports =
//
//
- function noop() {}
-
- function getPropByPath(obj, path) {
- var tempObj = obj;
- path = path.replace(/\[(\w+)\]/g, '.$1');
- path = path.replace(/^\./, '');
+ 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();
- var keyArr = path.split('.');
- var i = 0;
+ 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;
- 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]]
- };
- }
+ if (minTime > maxTime) return clacTime();
+ return { minTime: minTime, maxTime: maxTime };
+ };
exports.default = {
- name: 'ElFormItem',
+ mixins: [_locale2.default],
- componentName: 'ElFormItem',
+ components: { TimeSpinner: _timeSpinner2.default },
- mixins: [_emitter2.default],
+ computed: {
+ showSeconds: function showSeconds() {
+ return (this.format || '').indexOf('ss') !== -1;
+ }
+ },
- 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;
+ props: ['value'],
- if (rules && rules.length) {
- rules.every(function (rule) {
- if (rule.required) {
- isRequired = true;
- return false;
- }
- return true;
- });
- }
- return isRequired;
- }
- },
data: function data() {
+ var time = clacTime(this.$options.defaultValue);
+
return {
- validateState: '',
- validateMessage: '',
- validateDisabled: false,
- validator: {},
- isNested: false
+ 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
};
},
- methods: {
- validate: function validate(trigger) {
+
+ watch: {
+ value: function value(newVal) {
var _this = this;
- var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
+ this.panelCreated();
+ this.$nextTick(function (_) {
+ return _this.ajustScrollTop();
+ });
+ }
+ },
- var rules = this.getFilteredRule(trigger);
- if (!rules || rules.length === 0) {
- callback();
- return true;
+ methods: {
+ panelCreated: function panelCreated() {
+ var time = clacTime(this.value);
+ if (time.minTime === this.minTime && time.maxTime === this.maxTime) {
+ return;
}
- 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);
+ 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()
});
},
- 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(/:/, '.');
+ 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();
}
-
- 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;
+ 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();
},
- getRules: function getRules() {
- var formRules = this.form.rules;
- var selfRuels = this.rules;
-
- formRules = formRules ? formRules[this.prop] : [];
+ 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();
+ }
- return [].concat(selfRuels || formRules || []);
+ this.handleChange();
},
- getFilteredRule: function getFilteredRule(trigger) {
- var rules = this.getRules();
-
- return rules.filter(function (rule) {
- return !rule.trigger || rule.trigger.indexOf(trigger) !== -1;
- });
+ setMinSelectionRange: function setMinSelectionRange(start, end) {
+ this.$emit('select-range', start, end);
},
- onFieldBlur: function onFieldBlur() {
- this.validate('blur');
+ setMaxSelectionRange: function setMaxSelectionRange(start, end) {
+ this.$emit('select-range', start + 11, end + 11);
},
- 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]);
+ 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 initialValue = this.fieldValue;
- if (Array.isArray(initialValue)) {
- initialValue = [].concat(initialValue);
- }
- Object.defineProperty(this, 'initialValue', {
- value: initialValue
- });
+ var minSelectableRange = this.$refs.minSpinner.selectableRange;
+ var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
- var rules = this.getRules();
+ this.minTime = (0, _util.limitRange)(this.minTime, minSelectableRange);
+ this.maxTime = (0, _util.limitRange)(this.maxTime, maxSelectableRange);
- if (rules.length) {
- this.$on('el.form.blur', this.onFieldBlur);
- this.$on('el.form.change', this.onFieldChange);
- }
+ if (first) return;
+ this.$emit('pick', [this.minTime, this.maxTime], visible, first);
+ },
+ ajustScrollTop: function ajustScrollTop() {
+ this.$refs.minSpinner.ajustScrollTop();
+ this.$refs.maxSpinner.ajustScrollTop();
}
},
- beforeDestroy: function beforeDestroy() {
- this.dispatch('ElForm', 'el.form.removeField', [this]);
- }
- };
-/***/ },
-/* 215 */
-/***/ function(module, exports) {
+ mounted: function mounted() {
+ var _this2 = this;
- module.exports = __webpack_require__(55);
+ this.$nextTick(function () {
+ return _this2.handleConfirm(true, true);
+ });
+ }
+ };
/***/ },
-/* 216 */
+/* 186 */
/***/ 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",
+ 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: {
- 'is-error': _vm.validateState === 'error',
- 'is-validating': _vm.validateState === 'validating',
- 'is-required': _vm.isRequired || _vm.required
+ 'has-seconds': _vm.showSeconds
}
- }, [(_vm.label || _vm.$slots.label) ? _c('label', {
- staticClass: "el-form-item__label",
- style: (_vm.labelStyle),
+ }, [_c('time-spinner', {
+ ref: "minSpinner",
attrs: {
- "for": _vm.prop
+ "show-seconds": _vm.showSeconds,
+ "hours": _vm.minHours,
+ "minutes": _vm.minMinutes,
+ "seconds": _vm.minSeconds
+ },
+ on: {
+ "change": _vm.handleMinChange,
+ "select-range": _vm.setMinSelectionRange
}
- }, [_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', {
+ })], 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: {
- "name": "el-zoom-in-top"
+ "show-seconds": _vm.showSeconds,
+ "hours": _vm.maxHours,
+ "minutes": _vm.maxMinutes,
+ "seconds": _vm.maxSeconds
+ },
+ on: {
+ "change": _vm.handleMaxChange,
+ "select-range": _vm.setMaxSelectionRange
}
- }, [(_vm.validateState === 'error' && _vm.showMessage && _vm.form.showMessage) ? _c('div', {
- staticClass: "el-form-item__error"
- }, [_vm._v(_vm._s(_vm.validateMessage))]) : _vm._e()])], 2)])
+ })], 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: []}
/***/ },
-/* 217 */
+/* 187 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _tabs = __webpack_require__(218);
+ var _main = __webpack_require__(188);
- var _tabs2 = _interopRequireDefault(_tabs);
+ var _main2 = _interopRequireDefault(_main);
+
+ var _directive = __webpack_require__(191);
+
+ var _directive2 = _interopRequireDefault(_directive);
+
+ var _vue = __webpack_require__(133);
+
+ var _vue2 = _interopRequireDefault(_vue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ _vue2.default.directive('popover', _directive2.default);
+
/* istanbul ignore next */
- _tabs2.default.install = function (Vue) {
- Vue.component(_tabs2.default.name, _tabs2.default);
+ _main2.default.install = function (Vue) {
+ Vue.directive('popover', _directive2.default);
+ Vue.component(_main2.default.name, _main2.default);
};
+ _main2.default.directive = _directive2.default;
- exports.default = _tabs2.default;
+ exports.default = _main2.default;
/***/ },
-/* 218 */
+/* 188 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(219),
+ __webpack_require__(189),
/* template */
- null,
+ __webpack_require__(190),
/* styles */
null,
/* scopeId */
@@ -50986,749 +50606,685 @@ module.exports =
/***/ },
-/* 219 */
+/* 189 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _tabNav = __webpack_require__(220);
+ var _vuePopper = __webpack_require__(24);
- var _tabNav2 = _interopRequireDefault(_tabNav);
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
+
+ var _dom = __webpack_require__(44);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+
exports.default = {
- name: 'ElTabs',
+ name: 'ElPopover',
- components: {
- TabNav: _tabNav2.default
- },
+ mixins: [_vuePopper2.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);
+ trigger: {
+ type: String,
+ default: 'click',
+ validator: function validator(value) {
+ return ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1;
+ }
},
- value: function value(_value) {
- this.setCurrentName(_value);
+ openDelay: {
+ type: Number,
+ default: 0
},
- currentName: function currentName(value) {
- var _this = this;
+ title: String,
+ disabled: Boolean,
+ content: String,
+ reference: {},
+ popperClass: String,
+ width: {},
+ visibleArrow: {
+ default: true
+ },
+ transition: {
+ type: String,
+ default: 'fade-in-linear'
+ }
+ },
- if (this.$refs.nav) {
- this.$nextTick(function (_) {
- _this.$refs.nav.scrollToActiveTab();
- });
- }
+ watch: {
+ showPopper: function showPopper(newVal, oldVal) {
+ newVal ? this.$emit('show') : this.$emit('hide');
}
},
- 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);
+ 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);
}
}
},
- 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;
+ 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;
- var navData = {
- props: {
- currentName: currentName,
- onTabClick: handleTabClick,
- onTabRemove: handleTabRemove,
- editable: editable,
- type: type,
- panes: panes
- },
- ref: 'nav'
- };
+ 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;
- 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');
+ 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);
}
};
/***/ },
-/* 220 */
-/***/ function(module, exports, __webpack_require__) {
+/* 190 */
+/***/ function(module, exports) {
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(221),
- /* template */
- null,
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ 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: []}
- module.exports = Component.exports
+/***/ },
+/* 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;
+ }
+ };
/***/ },
-/* 221 */
+/* 192 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _tabBar = __webpack_require__(222);
-
- var _tabBar2 = _interopRequireDefault(_tabBar);
+ var _main = __webpack_require__(193);
- var _resizeEvent = __webpack_require__(110);
+ var _main2 = _interopRequireDefault(_main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function noop() {}
+ /* istanbul ignore next */
+ _main2.default.install = function (Vue) {
+ Vue.component(_main2.default.name, _main2.default);
+ };
- exports.default = {
- name: 'TabNav',
+ exports.default = _main2.default;
- components: {
- TabBar: _tabBar2.default
- },
+/***/ },
+/* 193 */
+/***/ function(module, exports, __webpack_require__) {
- props: {
- panes: Array,
- currentName: String,
- editable: Boolean,
- onTabClick: {
- type: Function,
- default: noop
- },
- onTabRemove: {
- type: Function,
- default: noop
- },
- type: String
- },
+ 'use strict';
- data: function data() {
- return {
- scrollable: false,
- navStyle: {
- transform: ''
- }
- };
- },
+ exports.__esModule = true;
+ var _vuePopper = __webpack_require__(24);
- methods: {
- scrollPrev: function scrollPrev() {
- var containerWidth = this.$refs.navScroll.offsetWidth;
- var currentOffset = this.getCurrentScrollOffset();
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
- if (!currentOffset) return;
+ var _debounce = __webpack_require__(69);
- var newOffset = currentOffset > containerWidth ? currentOffset - containerWidth : 0;
+ var _debounce2 = _interopRequireDefault(_debounce);
- this.setOffset(newOffset);
- },
- scrollNext: function scrollNext() {
- var navWidth = this.$refs.nav.offsetWidth;
- var containerWidth = this.$refs.navScroll.offsetWidth;
- var currentOffset = this.getCurrentScrollOffset();
+ var _vdom = __webpack_require__(194);
- if (navWidth - currentOffset <= containerWidth) return;
+ var _vue = __webpack_require__(133);
- var newOffset = navWidth - currentOffset > containerWidth * 2 ? currentOffset + containerWidth : navWidth - containerWidth;
+ var _vue2 = _interopRequireDefault(_vue);
- 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;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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;
+ exports.default = {
+ name: 'ElTooltip',
- return navStyle.transform ? Number(navStyle.transform.match(/translateX\(-(\d+(\.\d+)*)px\)/)[1]) : 0;
+ mixins: [_vuePopper2.default],
+
+ props: {
+ openDelay: {
+ type: Number,
+ default: 0
},
- setOffset: function setOffset(value) {
- this.navStyle.transform = 'translateX(-' + value + 'px)';
+ disabled: Boolean,
+ manual: Boolean,
+ effect: {
+ type: String,
+ default: 'dark'
},
- 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);
- }
+ 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
}
},
- 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;
+ beforeCreate: function beforeCreate() {
+ var _this = this;
- var tabs = this._l(panes, function (pane, index) {
- var tabName = pane.name || pane.index || index;
- var closable = pane.isClosable || editable;
+ if (this.$isServer) return;
- pane.index = '' + index;
+ this.popperVM = new _vue2.default({
+ data: { node: '' },
+ render: function render(h) {
+ return this.node;
+ }
+ }).$mount();
- var btnClose = closable ? h(
- 'span',
- { 'class': 'el-icon-close', on: {
- 'click': function click(ev) {
- onTabRemove(pane, ev);
- }
- }
- },
- []
- ) : null;
+ this.debounceClose = (0, _debounce2.default)(200, function () {
+ return _this.handleClosePopper();
+ });
+ },
+ render: function render(h) {
+ var _this2 = this;
- var tabLabelContent = pane.$slots.label || pane.label;
- return h(
- 'div',
+ if (this.popperVM) {
+ this.popperVM.node = h(
+ 'transition',
{
- 'class': {
- 'el-tabs__item': true,
- 'is-active': pane.active,
- 'is-disabled': pane.disabled,
- 'is-closable': closable
+ attrs: {
+ name: this.transition
},
- ref: 'tabs',
- refInFor: true,
on: {
- 'click': function click(ev) {
- onTabClick(pane, tabName, ev);
- }
+ 'afterLeave': this.doDestroy
}
},
- [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 }
+ {
+ on: {
+ 'mouseleave': function mouseleave() {
+ _this2.setExpectedState(false);_this2.debounceClose();
+ },
+ 'mouseenter': function mouseenter() {
+ _this2.setExpectedState(true);
+ }
},
- []
- ) : 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__) {
+ ref: 'popper',
+ directives: [{
+ name: 'show',
+ value: !this.disabled && this.showPopper
+ }],
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(223),
- /* template */
- __webpack_require__(224),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
+ [this.$slots.content || this.content]
+ )]
+ );
+ }
- module.exports = Component.exports
-
-
-/***/ },
-/* 223 */
-/***/ function(module, exports) {
-
- 'use strict';
+ if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
- exports.__esModule = true;
- //
- //
- //
+ 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 || {};
- exports.default = {
- name: 'TabBar',
+ 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');
- props: {
- tabs: Array
+ return vnode;
+ },
+ mounted: function mounted() {
+ this.referenceElm = this.$el;
},
- 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;
+ 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;
- return style;
- }
+ 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;
}
}
};
/***/ },
-/* 224 */
+/* 194 */
/***/ 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: []}
+ module.exports = __webpack_require__(27);
/***/ },
-/* 225 */
+/* 195 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _tabPane = __webpack_require__(226);
+ var _main = __webpack_require__(196);
- var _tabPane2 = _interopRequireDefault(_tabPane);
+ var _main2 = _interopRequireDefault(_main);
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;
+ exports.default = _main2.default;
/***/ },
-/* 226 */
+/* 196 */
/***/ 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
- )
+ 'use strict';
- module.exports = Component.exports
+ 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; };
-/***/ },
-/* 227 */
-/***/ function(module, exports) {
+ var _vue = __webpack_require__(133);
- 'use strict';
+ var _vue2 = _interopRequireDefault(_vue);
- exports.__esModule = true;
- //
- //
- //
- //
- //
+ var _main = __webpack_require__(197);
- exports.default = {
- name: 'ElTabPane',
+ var _main2 = _interopRequireDefault(_main);
- componentName: 'ElTabPane',
+ var _merge = __webpack_require__(64);
- props: {
- label: String,
- labelContent: Function,
- name: String,
- closable: Boolean,
- disabled: Boolean
- },
+ var _merge2 = _interopRequireDefault(_merge);
- data: function data() {
- return {
- index: null
- };
- },
+ var _vdom = __webpack_require__(194);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- computed: {
- isClosable: function isClosable() {
- return this.closable || this.$parent.closable;
- },
- active: function active() {
- return this.$parent.currentName === (this.name || this.index);
- }
- },
+ 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
+ };
- 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);
- },
+ var MessageBoxConstructor = _vue2.default.extend(_main2.default);
+ var currentMsg = void 0,
+ instance = void 0;
+ var msgQueue = [];
- watch: {
- label: function label() {
- this.$parent.$forceUpdate();
+ 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);
+ }
}
}
};
-/***/ },
-/* 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 }; }
+ var initInstance = function initInstance() {
+ instance = new MessageBoxConstructor({
+ el: document.createElement('div')
+ });
- /* istanbul ignore next */
- _tag2.default.install = function (Vue) {
- Vue.component(_tag2.default.name, _tag2.default);
+ instance.callback = defaultCallback;
};
- 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
-
+ var showNextMsg = function showNextMsg() {
+ if (!instance) {
+ initInstance();
+ }
+ instance.action = '';
-/***/ },
-/* 231 */
-/***/ function(module, exports) {
+ if (!instance.visible || instance.closeTimer) {
+ if (msgQueue.length > 0) {
+ (function () {
+ currentMsg = msgQueue.shift();
- 'use strict';
+ var options = currentMsg.options;
+ for (var prop in options) {
+ if (options.hasOwnProperty(prop)) {
+ instance[prop] = options[prop];
+ }
+ }
+ if (options.callback === undefined) {
+ instance.callback = defaultCallback;
+ }
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ 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);
- 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);
+ _vue2.default.nextTick(function () {
+ instance.visible = true;
+ });
+ })();
}
}
};
-/***/ },
-/* 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'
+ 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];
}
- }, [_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
+ if (arguments[2]) {
+ options.type = arguments[2];
}
- }) : _vm._e()], 2)])
- },staticRenderFns: []}
+ } else if (options.callback && !callback) {
+ callback = options.callback;
+ }
-/***/ },
-/* 233 */
-/***/ function(module, exports, __webpack_require__) {
+ 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
+ });
- 'use strict';
+ showNextMsg();
+ });
+ } else {
+ msgQueue.push({
+ options: (0, _merge2.default)({}, defaults, MessageBox.defaults, options),
+ callback: callback
+ });
- exports.__esModule = true;
+ showNextMsg();
+ }
+ };
- var _tree = __webpack_require__(234);
+ MessageBox.setDefaults = function (defaults) {
+ MessageBox.defaults = defaults;
+ };
- var _tree2 = _interopRequireDefault(_tree);
+ MessageBox.alert = function (message, title, options) {
+ if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
+ options = title;
+ title = '';
+ } else if (title === undefined) {
+ title = '';
+ }
+ return MessageBox((0, _merge2.default)({
+ title: title,
+ message: message,
+ $type: 'alert',
+ closeOnPressEscape: false,
+ closeOnClickModal: false
+ }, options));
+ };
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ MessageBox.confirm = function (message, title, options) {
+ if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
+ options = title;
+ title = '';
+ } else if (title === undefined) {
+ title = '';
+ }
+ return MessageBox((0, _merge2.default)({
+ title: title,
+ message: message,
+ $type: 'confirm',
+ showCancelButton: true
+ }, options));
+ };
- /* istanbul ignore next */
- _tree2.default.install = function (Vue) {
- Vue.component(_tree2.default.name, _tree2.default);
+ MessageBox.prompt = function (message, title, options) {
+ if ((typeof title === 'undefined' ? 'undefined' : _typeof(title)) === 'object') {
+ options = title;
+ title = '';
+ } else if (title === undefined) {
+ title = '';
+ }
+ return MessageBox((0, _merge2.default)({
+ title: title,
+ message: message,
+ showCancelButton: true,
+ showInput: true,
+ $type: 'prompt'
+ }, options));
};
- exports.default = _tree2.default;
+ MessageBox.close = function () {
+ instance.visible = false;
+ msgQueue = [];
+ currentMsg = null;
+ };
+
+ exports.default = MessageBox;
+ exports.MessageBox = MessageBox;
/***/ },
-/* 234 */
+/* 197 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(235),
+ __webpack_require__(198),
/* template */
- __webpack_require__(242),
+ __webpack_require__(199),
/* styles */
null,
/* scopeId */
@@ -51741,1040 +51297,1285 @@ module.exports =
/***/ },
-/* 235 */
+/* 198 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _treeStore = __webpack_require__(236);
+ var _popup = __webpack_require__(14);
- var _treeStore2 = _interopRequireDefault(_treeStore);
+ var _popup2 = _interopRequireDefault(_popup);
- var _locale = __webpack_require__(111);
+ var _locale = __webpack_require__(10);
- var _emitter = __webpack_require__(15);
+ var _locale2 = _interopRequireDefault(_locale);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _input = __webpack_require__(20);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _input2 = _interopRequireDefault(_input);
- exports.default = {
- name: 'ElTree',
+ var _button = __webpack_require__(31);
- mixins: [_emitter2.default],
+ var _button2 = _interopRequireDefault(_button);
- components: {
- ElTreeNode: __webpack_require__(239)
- },
+ var _dom = __webpack_require__(44);
- data: function data() {
- return {
- store: null,
- root: null,
- currentNode: null
- };
- },
+ var _locale3 = __webpack_require__(111);
+
+ 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: {
- 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,
+ modal: {
default: true
},
- autoExpandParent: {
- type: Boolean,
+ lockScroll: {
default: true
},
- defaultCheckedKeys: Array,
- defaultExpandedKeys: Array,
- renderContent: Function,
- showCheckbox: {
+ showClose: {
type: Boolean,
- default: false
- },
- props: {
- default: function _default() {
- return {
- children: 'children',
- label: 'label',
- icon: 'icon',
- disabled: 'disabled'
- };
- }
+ default: true
},
- lazy: {
- type: Boolean,
- default: false
+ closeOnClickModal: {
+ default: true
},
- highlightCurrent: Boolean,
- currentNodeKey: [String, Number],
- load: Function,
- filterNodeMethod: Function,
- accordion: Boolean,
- indent: {
- type: Number,
- default: 16
+ closeOnPressEscape: {
+ default: true
}
},
- computed: {
- children: {
- set: function set(value) {
- this.data = value;
- },
- get: function get() {
- return this.data;
- }
- }
+ components: {
+ ElInput: _input2.default,
+ ElButton: _button2.default
},
- 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);
+ computed: {
+ typeClass: function typeClass() {
+ return this.type && typeMap[this.type] ? 'el-icon-' + typeMap[this.type] : '';
},
- currentNodeKey: function currentNodeKey(newVal) {
- this.store.setCurrentNodeKey(newVal);
- this.store.currentNodeKey = newVal;
+ confirmButtonClasses: function confirmButtonClasses() {
+ return 'el-button--primary ' + this.confirmButtonClass;
},
- data: function data(newVal) {
- this.store.setData(newVal);
+ cancelButtonClasses: function cancelButtonClasses() {
+ return '' + this.cancelButtonClass;
}
},
methods: {
- filter: function filter(value) {
- if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
- this.store.filter(value);
+ getSafeClose: function getSafeClose() {
+ var _this = this;
+
+ var currentId = this.uid;
+ return function () {
+ _this.$nextTick(function () {
+ if (currentId === _this.uid) _this.doClose();
+ });
+ };
},
- getNodeKey: function getNodeKey(node, index) {
- var nodeKey = this.nodeKey;
- if (nodeKey && node) {
- return node.data[nodeKey];
+ 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);
}
- 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);
+ this.opened = false;
+
+ if (!this.transition) {
+ this.doAfterClose();
+ }
+ if (this.action) this.callback(this.action, this);
},
- setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
- if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
- this.store.setCheckedKeys(keys, leafOnly);
+ handleWrapperClick: function handleWrapperClick() {
+ if (this.closeOnClickModal) {
+ this.handleAction('cancel');
+ }
},
- setChecked: function setChecked(data, checked, deep) {
- this.store.setChecked(data, checked, deep);
+ 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();
+ }
},
- handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
- this.$emit('node-expand', nodeData, node, instance);
+ 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;
}
},
- created: function created() {
- this.isTree = true;
+ watch: {
+ inputValue: {
+ immediate: true,
+ handler: function handler(val) {
+ var _this3 = this;
- 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.$nextTick(function (_) {
+ if (_this3.$type === 'prompt' && val !== null) {
+ _this3.validate();
+ }
+ });
+ }
+ },
- this.root = this.store.root;
+ 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
+ };
}
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ };
/***/ },
-/* 236 */
+/* 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.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 _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 _breadcrumb = __webpack_require__(201);
- var _util = __webpack_require__(238);
+ var _breadcrumb2 = _interopRequireDefault(_breadcrumb);
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"); } }
+ /* istanbul ignore next */
+ _breadcrumb2.default.install = function (Vue) {
+ Vue.component(_breadcrumb2.default.name, _breadcrumb2.default);
+ };
- var TreeStore = function () {
- function TreeStore(options) {
- var _this = this;
+ exports.default = _breadcrumb2.default;
- _classCallCheck(this, TreeStore);
+/***/ },
+/* 201 */
+/***/ function(module, exports, __webpack_require__) {
- this.currentNode = null;
- this.currentNodeKey = null;
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(202),
+ /* template */
+ __webpack_require__(203),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- for (var option in options) {
- if (options.hasOwnProperty(option)) {
- this[option] = options[option];
- }
- }
+ module.exports = Component.exports
- this.nodesMap = {};
- this.root = new _node2.default({
- data: this.data,
- store: this
- });
+/***/ },
+/* 202 */
+/***/ function(module, exports) {
- if (this.lazy && this.load) {
- var loadFn = this.load;
- loadFn(this.root, function (data) {
- _this.root.doCreateChildren(data);
- _this._initDefaultCheckedNodes();
- });
- } else {
- this._initDefaultCheckedNodes();
+ 'use strict';
+
+ exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+
+ exports.default = {
+ name: 'ElBreadcrumb',
+
+ props: {
+ separator: {
+ type: String,
+ default: '/'
}
}
+ };
- TreeStore.prototype.filter = function filter(value) {
- var filterNodeMethod = this.filterNodeMethod;
- var traverse = function traverse(node) {
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
+/***/ },
+/* 203 */
+/***/ function(module, exports) {
- childNodes.forEach(function (child) {
- child.visible = filterNodeMethod.call(child, value, child.data, child);
+ 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: []}
- traverse(child);
- });
+/***/ },
+/* 204 */
+/***/ function(module, exports, __webpack_require__) {
- if (!node.visible && childNodes.length) {
- var allHidden = true;
+ 'use strict';
- childNodes.forEach(function (child) {
- if (child.visible) allHidden = false;
- });
+ exports.__esModule = true;
- if (node.root) {
- node.root.visible = allHidden === false;
- } else {
- node.visible = allHidden === false;
- }
- }
+ var _breadcrumbItem = __webpack_require__(205);
- if (node.visible && !node.isLeaf) node.expand();
- };
+ var _breadcrumbItem2 = _interopRequireDefault(_breadcrumbItem);
- traverse(this);
- };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- TreeStore.prototype.setData = function setData(newVal) {
- var instanceChanged = newVal !== this.root.data;
- this.root.setData(newVal);
- if (instanceChanged) {
- this._initDefaultCheckedNodes();
- }
- };
+ /* istanbul ignore next */
+ _breadcrumbItem2.default.install = function (Vue) {
+ Vue.component(_breadcrumbItem2.default.name, _breadcrumbItem2.default);
+ };
- 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];
- };
+ exports.default = _breadcrumbItem2.default;
- TreeStore.prototype.insertBefore = function insertBefore(data, refData) {
- var refNode = this.getNode(refData);
- refNode.parent.insertBefore({ data: data }, refNode);
- };
+/***/ },
+/* 205 */
+/***/ function(module, exports, __webpack_require__) {
- TreeStore.prototype.insertAfter = function insertAfter(data, refData) {
- var refNode = this.getNode(refData);
- refNode.parent.insertAfter({ data: data }, refNode);
- };
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(206),
+ /* template */
+ __webpack_require__(207),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- TreeStore.prototype.remove = function remove(data) {
- var node = this.getNode(data);
- if (node) {
- node.parent.removeChild(node);
- }
- };
+ module.exports = Component.exports
- TreeStore.prototype.append = function append(data, parentData) {
- var parentNode = parentData ? this.getNode(parentData) : this.root;
- if (parentNode) {
- parentNode.insertChild({ data: data });
- }
- };
+/***/ },
+/* 206 */
+/***/ function(module, exports) {
- TreeStore.prototype._initDefaultCheckedNodes = function _initDefaultCheckedNodes() {
- var _this2 = this;
+ 'use strict';
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
- var nodesMap = this.nodesMap;
+ exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
- defaultCheckedKeys.forEach(function (checkedKey) {
- var node = nodesMap[checkedKey];
+ exports.default = {
+ name: 'ElBreadcrumbItem',
+ props: {
+ to: {},
+ replace: Boolean
+ },
+ data: function data() {
+ return {
+ separator: ''
+ };
+ },
+ mounted: function mounted() {
+ var _this = this;
- if (node) {
- node.setChecked(true, !_this2.checkStrictly);
- }
- });
- };
+ 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);
+ });
+ }
+ }
+ };
- TreeStore.prototype._initDefaultCheckedNode = function _initDefaultCheckedNode(node) {
- var defaultCheckedKeys = this.defaultCheckedKeys || [];
+/***/ },
+/* 207 */
+/***/ function(module, exports) {
- if (defaultCheckedKeys.indexOf(node.key) !== -1) {
- node.setChecked(true, !this.checkStrictly);
- }
- };
+ 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: []}
- TreeStore.prototype.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
- if (newVal !== this.defaultCheckedKeys) {
- this.defaultCheckedKeys = newVal;
- this._initDefaultCheckedNodes();
- }
- };
+/***/ },
+/* 208 */
+/***/ function(module, exports, __webpack_require__) {
- TreeStore.prototype.registerNode = function registerNode(node) {
- var key = this.key;
- if (!key || !node || !node.data) return;
+ 'use strict';
- var nodeKey = node.key;
- if (nodeKey !== undefined) this.nodesMap[node.key] = node;
- };
+ exports.__esModule = true;
- TreeStore.prototype.deregisterNode = function deregisterNode(node) {
- var key = this.key;
- if (!key || !node || !node.data) return;
+ var _form = __webpack_require__(209);
- delete this.nodesMap[node.key];
- };
+ var _form2 = _interopRequireDefault(_form);
- TreeStore.prototype.getCheckedNodes = function getCheckedNodes() {
- var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var checkedNodes = [];
- var traverse = function traverse(node) {
- var childNodes = node.root ? node.root.childNodes : node.childNodes;
+ /* istanbul ignore next */
+ _form2.default.install = function (Vue) {
+ Vue.component(_form2.default.name, _form2.default);
+ };
- childNodes.forEach(function (child) {
- if (!leafOnly && child.checked || leafOnly && child.isLeaf && child.checked) {
- checkedNodes.push(child.data);
- }
+ exports.default = _form2.default;
- traverse(child);
- });
- };
+/***/ },
+/* 209 */
+/***/ function(module, exports, __webpack_require__) {
- traverse(this);
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(210),
+ /* template */
+ __webpack_require__(211),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- return checkedNodes;
- };
+ module.exports = Component.exports
- 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;
- };
+/***/ },
+/* 210 */
+/***/ function(module, exports, __webpack_require__) {
- TreeStore.prototype._getAllNodes = function _getAllNodes() {
- var allNodes = [];
- var nodesMap = this.nodesMap;
- for (var nodeKey in nodesMap) {
- if (nodesMap.hasOwnProperty(nodeKey)) {
- allNodes.push(nodesMap[nodeKey]);
- }
- }
+ 'use strict';
- return allNodes;
- };
+ exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- TreeStore.prototype._setCheckedKeys = function _setCheckedKeys(key) {
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var checkedKeys = arguments[2];
+ exports.default = {
+ name: 'ElForm',
- 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);
+ 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);
+ }
});
- 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;
+ /* istanbul ignore next */
+ this.$on('el.form.removeField', function (field) {
+ if (field.prop) {
+ _this.fields.splice(_this.fields.indexOf(field), 1);
}
+ });
+ },
- var parent = node.parent;
- while (parent && parent.level > 0) {
- cache[parent.data[key]] = true;
- parent = parent.parent;
+ 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 (node.isLeaf || this.checkStrictly) {
- node.setChecked(true, false);
- continue;
+ 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);
}
- 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);
- })();
+ 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!');
}
- }
- };
- 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;
- });
+ field.validate('', cb);
+ }
+ }
+ };
- this._setCheckedKeys(key, leafOnly, checkedKeys);
- };
+/***/ },
+/* 211 */
+/***/ function(module, exports) {
- TreeStore.prototype.setCheckedKeys = function setCheckedKeys(keys) {
- var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
+ 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: []}
- this.defaultCheckedKeys = keys;
- var key = this.key;
- var checkedKeys = {};
- keys.forEach(function (key) {
- checkedKeys[key] = true;
- });
+/***/ },
+/* 212 */
+/***/ function(module, exports, __webpack_require__) {
- this._setCheckedKeys(key, leafOnly, checkedKeys);
- };
+ 'use strict';
- TreeStore.prototype.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
- var _this3 = this;
+ exports.__esModule = true;
- keys = keys || [];
- this.defaultExpandedKeys = keys;
+ var _formItem = __webpack_require__(213);
- keys.forEach(function (key) {
- var node = _this3.getNode(key);
- if (node) node.expand(null, _this3.autoExpandParent);
- });
- };
+ var _formItem2 = _interopRequireDefault(_formItem);
- TreeStore.prototype.setChecked = function setChecked(data, checked, deep) {
- var node = this.getNode(data);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- if (node) {
- node.setChecked(!!checked, deep);
- }
- };
+ /* istanbul ignore next */
+ _formItem2.default.install = function (Vue) {
+ Vue.component(_formItem2.default.name, _formItem2.default);
+ };
- TreeStore.prototype.getCurrentNode = function getCurrentNode() {
- return this.currentNode;
- };
+ exports.default = _formItem2.default;
- TreeStore.prototype.setCurrentNode = function setCurrentNode(node) {
- this.currentNode = node;
- };
+/***/ },
+/* 213 */
+/***/ function(module, exports, __webpack_require__) {
- TreeStore.prototype.setCurrentNodeKey = function setCurrentNodeKey(key) {
- var node = this.getNode(key);
- if (node) {
- this.currentNode = node;
- }
- };
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(214),
+ /* template */
+ __webpack_require__(216),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- return TreeStore;
- }();
+ module.exports = Component.exports
- exports.default = TreeStore;
- ;
/***/ },
-/* 237 */
+/* 214 */
/***/ 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 _asyncValidator = __webpack_require__(215);
- var _merge = __webpack_require__(64);
+ var _asyncValidator2 = _interopRequireDefault(_asyncValidator);
- var _merge2 = _interopRequireDefault(_merge);
+ var _emitter = __webpack_require__(15);
- var _util = __webpack_require__(238);
+ var _emitter2 = _interopRequireDefault(_emitter);
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;
+ 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]]
+ };
+ }
- return { all: all, none: none, allWithoutDisable: allWithoutDisable, half: !all && !none };
- };
+ exports.default = {
+ name: 'ElFormItem',
- var reInitChecked = function reInitChecked(node) {
- var _getChildState = getChildState(node.childNodes),
- all = _getChildState.all,
- none = _getChildState.none,
- half = _getChildState.half;
+ componentName: 'ElFormItem',
- 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;
- }
+ mixins: [_emitter2.default],
- var parent = node.parent;
- if (!parent || parent.level === 0) return;
+ 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;
+ },
- if (!node.store.checkStrictly) {
- reInitChecked(parent);
- }
- };
+ fieldValue: {
+ cache: false,
+ get: function get() {
+ var model = this.form.model;
+ if (!model || !this.prop) {
+ return;
+ }
- 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 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
+ };
+ },
- var parent = node.parent;
- if (!parent || parent.level === 0) return;
- reInitChecked(parent);
- };
+ methods: {
+ validate: function validate(trigger) {
+ var _this = this;
- var getPropertyFromData = function getPropertyFromData(node, prop) {
- var props = node.store.props;
- var data = node.data || {};
- var config = props[prop];
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop;
- if (typeof config === 'function') {
- return config(data, node);
- } else if (typeof config === 'string') {
- return data[config];
- } else if (typeof config === 'undefined') {
- return '';
- }
- };
+ var rules = this.getFilteredRule(trigger);
+ if (!rules || rules.length === 0) {
+ callback();
+ return true;
+ }
- var nodeIdSeed = 0;
+ this.validateState = 'validating';
- var Node = function () {
- function Node(options) {
- _classCallCheck(this, Node);
+ var descriptor = {};
+ descriptor[this.prop] = rules;
- this.id = nodeIdSeed++;
- this.text = null;
- this.checked = false;
- this.indeterminate = false;
- this.data = null;
- this.expanded = false;
- this.parent = null;
- this.visible = true;
+ var validator = new _asyncValidator2.default(descriptor);
+ var model = {};
- for (var name in options) {
- if (options.hasOwnProperty(name)) {
- this[name] = options[name];
- }
- }
+ model[this.prop] = this.fieldValue;
- // internal
- this.level = 0;
- this.loaded = false;
- this.childNodes = [];
- this.loading = false;
+ validator.validate(model, { firstFields: true }, function (errors, fields) {
+ _this.validateState = !errors ? 'success' : 'error';
+ _this.validateMessage = errors ? errors[0].message : '';
- if (this.parent) {
- this.level = this.parent.level + 1;
- }
+ callback(_this.validateMessage);
+ });
+ },
+ resetField: function resetField() {
+ this.validateState = '';
+ this.validateMessage = '';
- var store = this.store;
- if (!store) {
- throw new Error('[Node]store is required!');
- }
- store.registerNode(this);
+ var model = this.form.model;
+ var value = this.fieldValue;
+ var path = this.prop;
+ if (path.indexOf(':') !== -1) {
+ path = path.replace(/:/, '.');
+ }
- var props = store.props;
- if (props && typeof props.isLeaf !== 'undefined') {
- var isLeaf = getPropertyFromData(this, 'isLeaf');
- if (typeof isLeaf === 'boolean') {
- this.isLeafByUser = isLeaf;
+ 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;
- if (store.lazy !== true && this.data) {
- this.setData(this.data);
+ formRules = formRules ? formRules[this.prop] : [];
- if (store.defaultExpandAll) {
- this.expanded = true;
+ 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;
}
- } 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);
+ this.validate('change');
}
+ },
+ mounted: function mounted() {
+ if (this.prop) {
+ this.dispatch('ElForm', 'el.form.addField', [this]);
- if (key && store.currentNodeKey && this.key === store.currentNodeKey) {
- store.currentNode = this;
- }
+ var initialValue = this.fieldValue;
+ if (Array.isArray(initialValue)) {
+ initialValue = [].concat(initialValue);
+ }
+ Object.defineProperty(this, 'initialValue', {
+ value: initialValue
+ });
- if (store.lazy) {
- store._initDefaultCheckedNode(this);
- }
+ var rules = this.getRules();
- this.updateLeafState();
+ 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]);
}
+ };
- Node.prototype.setData = function setData(data) {
- if (!Array.isArray(data)) {
- (0, _util.markNodeData)(this, data);
- }
+/***/ },
+/* 215 */
+/***/ function(module, exports) {
- this.data = data;
- this.childNodes = [];
+ module.exports = __webpack_require__(56);
- var children = void 0;
- if (this.level === 0 && this.data instanceof Array) {
- children = this.data;
- } else {
- children = getPropertyFromData(this, 'children') || [];
- }
+/***/ },
+/* 216 */
+/***/ function(module, exports) {
- for (var i = 0, j = children.length; i < j; i++) {
- this.insertChild({ data: children[i] });
+ 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
}
- };
-
- 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);
+ }, [(_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: []}
- child.level = this.level + 1;
+/***/ },
+/* 217 */
+/***/ function(module, exports, __webpack_require__) {
- if (typeof index === 'undefined' || index < 0) {
- this.childNodes.push(child);
- } else {
- this.childNodes.splice(index, 0, child);
- }
+ 'use strict';
- this.updateLeafState();
- };
+ exports.__esModule = true;
- Node.prototype.insertBefore = function insertBefore(child, ref) {
- var index = void 0;
- if (ref) {
- index = this.childNodes.indexOf(ref);
- }
- this.insertChild(child, index);
- };
+ var _tabs = __webpack_require__(218);
- 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);
- };
+ var _tabs2 = _interopRequireDefault(_tabs);
- Node.prototype.removeChild = function removeChild(child) {
- var index = this.childNodes.indexOf(child);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- if (index > -1) {
- this.store && this.store.deregisterNode(child);
- child.parent = null;
- this.childNodes.splice(index, 1);
- }
+ /* istanbul ignore next */
+ _tabs2.default.install = function (Vue) {
+ Vue.component(_tabs2.default.name, _tabs2.default);
+ };
- this.updateLeafState();
- };
+ exports.default = _tabs2.default;
- Node.prototype.removeChildByData = function removeChildByData(data) {
- var targetNode = null;
- this.childNodes.forEach(function (node) {
- if (node.data === data) {
- targetNode = node;
- }
- });
+/***/ },
+/* 218 */
+/***/ function(module, exports, __webpack_require__) {
- if (targetNode) {
- this.removeChild(targetNode);
- }
- };
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(219),
+ /* template */
+ null,
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- Node.prototype.expand = function expand(callback, expandParent) {
- var _this = this;
+ module.exports = Component.exports
- 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();
- }
- };
+/***/ },
+/* 219 */
+/***/ function(module, exports, __webpack_require__) {
- Node.prototype.doCreateChildren = function doCreateChildren(array) {
- var _this2 = this;
+ 'use strict';
- var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ exports.__esModule = true;
- array.forEach(function (item) {
- _this2.insertChild((0, _merge2.default)({ data: item }, defaultProps));
- });
- };
+ var _tabNav = __webpack_require__(220);
- Node.prototype.collapse = function collapse() {
- this.expanded = false;
- };
+ var _tabNav2 = _interopRequireDefault(_tabNav);
- Node.prototype.shouldLoadData = function shouldLoadData() {
- return this.store.lazy === true && this.store.load && !this.loaded;
- };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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;
- }
+ exports.default = {
+ name: 'ElTabs',
- 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);
- }
+ components: {
+ TabNav: _tabNav2.default
+ },
- var _getChildState3 = getChildState(childNodes),
- half = _getChildState3.half,
- _all = _getChildState3.all;
+ props: {
+ type: String,
+ activeName: String,
+ closable: Boolean,
+ addable: Boolean,
+ value: {},
+ editable: Boolean
+ },
- if (!_all) {
- _this3.checked = _all;
- _this3.indeterminate = half;
- }
- }
+ data: function data() {
+ return {
+ currentName: this.value || this.activeName,
+ panes: []
};
+ },
- 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';
- }
+ watch: {
+ activeName: function activeName(value) {
+ this.setCurrentName(value);
+ },
+ value: function value(_value) {
+ this.setCurrentName(_value);
+ },
+ currentName: function currentName(value) {
+ var _this = this;
- if (data[children] === undefined) {
- data[children] = null;
+ if (this.$refs.nav) {
+ this.$nextTick(function (_) {
+ _this.$refs.nav.scrollToActiveTab();
+ });
+ }
}
+ },
- 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 });
+ 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);
}
- });
-
- 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 = [];
+ }
+ },
+ 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;
- _this5.doCreateChildren(children, defaultProps);
- _this5.updateLeafState();
- if (callback) {
- callback.call(_this5, children);
+ var newButton = editable || addable ? h(
+ 'span',
+ {
+ 'class': 'el-tabs__new-tab',
+ on: {
+ 'click': handleTabAdd
}
- };
+ },
+ [h(
+ 'i',
+ { 'class': 'el-icon-plus' },
+ []
+ )]
+ ) : null;
- this.store.load(this, resolve);
- } else {
- if (callback) {
- callback.call(this);
- }
- }
- };
+ var navData = {
+ props: {
+ currentName: currentName,
+ onTabClick: handleTabClick,
+ onTabRemove: handleTabRemove,
+ editable: editable,
+ type: type,
+ panes: panes
+ },
+ ref: 'nav'
+ };
- _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 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');
}
- }]);
-
- 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 */
+/* 220 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(240),
+ __webpack_require__(221),
/* template */
- __webpack_require__(241),
+ null,
/* styles */
null,
/* scopeId */
@@ -52787,370 +52588,351 @@ module.exports =
/***/ },
-/* 240 */
+/* 221 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _collapseTransition = __webpack_require__(49);
-
- var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
-
- var _checkbox = __webpack_require__(130);
-
- var _checkbox2 = _interopRequireDefault(_checkbox);
+ var _tabBar = __webpack_require__(222);
- var _emitter = __webpack_require__(15);
+ var _tabBar2 = _interopRequireDefault(_tabBar);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _resizeEvent = __webpack_require__(110);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = {
- name: 'ElTreeNode',
+ function noop() {}
- componentName: 'ElTreeNode',
+ exports.default = {
+ name: 'TabNav',
- mixins: [_emitter2.default],
+ components: {
+ TabBar: _tabBar2.default
+ },
props: {
- node: {
- default: function _default() {
- return {};
- }
+ panes: Array,
+ currentName: String,
+ editable: Boolean,
+ onTabClick: {
+ type: Function,
+ default: noop
},
- 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]
- );
- }
- }
+ onTabRemove: {
+ type: Function,
+ default: noop
+ },
+ type: String
},
data: function data() {
return {
- tree: null,
- expanded: false,
- childNodeRendered: false,
- showCheckbox: false,
- oldChecked: null,
- oldIndeterminate: null
+ scrollable: false,
+ navStyle: {
+ transform: ''
+ }
};
},
- watch: {
- 'node.indeterminate': function nodeIndeterminate(val) {
- this.handleSelectChange(this.node.checked, val);
+ 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);
},
- 'node.checked': function nodeChecked(val) {
- this.handleSelectChange(val, this.node.indeterminate);
+ 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);
},
- 'node.expanded': function nodeExpanded(val) {
- this.expanded = val;
- if (val) {
- this.childNodeRendered = true;
- }
- }
- },
+ 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;
- methods: {
- getNodeKey: function getNodeKey(node, index) {
- var nodeKey = this.tree.nodeKey;
- if (nodeKey && node) {
- return node.data[nodeKey];
+ if (activeTabBounding.left < navScrollBounding.left) {
+ newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
}
- return index;
- },
- handleSelectChange: function handleSelectChange(checked, indeterminate) {
- if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
- this.tree.$emit('check-change', this.node.data, checked, indeterminate);
+ if (activeTabBounding.right > navScrollBounding.right) {
+ newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
}
- 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();
+ if (navBounding.right < navScrollBounding.right) {
+ newOffset = nav.offsetWidth - navScrollBounding.width;
}
- this.tree.$emit('node-click', this.node.data, this.node, this);
+ this.setOffset(Math.max(newOffset, 0));
},
- 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);
- }
+ getCurrentScrollOffset: function getCurrentScrollOffset() {
+ var navStyle = this.navStyle;
+
+ return navStyle.transform ? Number(navStyle.transform.match(/translateX\(-(\d+(\.\d+)*)px\)/)[1]) : 0;
},
- handleCheckChange: function handleCheckChange(ev) {
- this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
+ setOffset: function setOffset(value) {
+ this.navStyle.transform = 'translateX(-' + value + 'px)';
},
- handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
- this.broadcast('ElTreeNode', 'tree-node-expand', node);
- this.tree.$emit('node-expand', nodeData, node, instance);
+ 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);
+ }
+ }
}
},
- created: function created() {
- var _this = this;
+ 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 parent = this.$parent;
- if (parent.isTree) {
- this.tree = parent;
- } else {
- this.tree = parent.tree;
- }
+ 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 tree = this.tree;
- if (!tree) {
- console.warn('Can not find node\'s tree.');
- }
+ var tabs = this._l(panes, function (pane, index) {
+ var tabName = pane.name || pane.index || index;
+ var closable = pane.isClosable || editable;
- var props = tree.props || {};
- var childrenKey = props['children'] || 'children';
+ pane.index = '' + index;
- this.$watch('node.data.' + childrenKey, function () {
- _this.node.updateChildren();
+ 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);
+ }
+ };
- this.showCheckbox = tree.showCheckbox;
+/***/ },
+/* 222 */
+/***/ function(module, exports, __webpack_require__) {
- if (this.node.expanded) {
- this.expanded = true;
- this.childNodeRendered = true;
- }
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(223),
+ /* template */
+ __webpack_require__(224),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- if (this.tree.accordion) {
- this.$on('tree-node-expand', function (node) {
- if (_this.node !== node) {
- _this.node.collapse();
- }
- });
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ module.exports = Component.exports
+
+
+/***/ },
+/* 223 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ exports.__esModule = true;
//
//
//
-/***/ },
-/* 241 */
-/***/ function(module, exports) {
+ exports.default = {
+ name: 'TabBar',
- 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();
+ 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;
}
- },
- 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 */
+/* 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-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)
+ staticClass: "el-tabs__active-bar",
+ style: (_vm.barStyle)
+ })
},staticRenderFns: []}
/***/ },
-/* 243 */
+/* 225 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(244);
+ var _tabPane = __webpack_require__(226);
- var _main2 = _interopRequireDefault(_main);
+ var _tabPane2 = _interopRequireDefault(_tabPane);
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);
+ _tabPane2.default.install = function (Vue) {
+ Vue.component(_tabPane2.default.name, _tabPane2.default);
};
- exports.default = _main2.default;
+ exports.default = _tabPane2.default;
/***/ },
-/* 244 */
+/* 226 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(245),
+ __webpack_require__(227),
/* template */
- __webpack_require__(246),
+ __webpack_require__(228),
/* styles */
null,
/* scopeId */
@@ -53163,7 +52945,7 @@ module.exports =
/***/ },
-/* 245 */
+/* 227 */
/***/ function(module, exports) {
'use strict';
@@ -53174,264 +52956,113 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- var TYPE_CLASSES_MAP = {
- 'success': 'el-icon-circle-check',
- 'warning': 'el-icon-warning',
- 'error': 'el-icon-circle-cross'
- };
exports.default = {
- name: 'ElAlert',
+ name: 'ElTabPane',
+
+ componentName: 'ElTabPane',
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
- }
+ label: String,
+ labelContent: Function,
+ name: String,
+ closable: Boolean,
+ disabled: Boolean
},
data: function data() {
return {
- visible: true
+ index: null
};
},
- methods: {
- close: function close() {
- this.visible = false;
- this.$emit('close');
+ computed: {
+ isClosable: function isClosable() {
+ return this.closable || this.$parent.closable;
+ },
+ active: function active() {
+ return this.$parent.currentName === (this.name || this.index);
}
},
- 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 || this.$slots.default ? 'is-big' : '';
- },
- isBoldTitle: function isBoldTitle() {
- return this.description || this.$slots.default ? 'is-bold' : '';
+ 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();
}
}
};
/***/ },
-/* 246 */
+/* 228 */
/***/ 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', {
+ return _c('div', {
directives: [{
name: "show",
rawName: "v-show",
- value: (_vm.closable),
- expression: "closable"
+ value: (_vm.active),
+ expression: "active"
}],
- 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)])])
+ staticClass: "el-tab-pane"
+ }, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
-/* 247 */
+/* 229 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(248);
+ var _tag = __webpack_require__(230);
- var _main2 = _interopRequireDefault(_main);
+ var _tag2 = _interopRequireDefault(_tag);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = _main2.default;
+ /* istanbul ignore next */
+ _tag2.default.install = function (Vue) {
+ Vue.component(_tag2.default.name, _tag2.default);
+ };
+
+ exports.default = _tag2.default;
/***/ },
-/* 248 */
+/* 230 */
/***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- exports.__esModule = true;
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(231),
+ /* template */
+ __webpack_require__(232),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- var _vue = __webpack_require__(133);
-
- 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
+ module.exports = Component.exports
/***/ },
-/* 250 */
+/* 231 */
/***/ function(module, exports) {
'use strict';
@@ -53450,191 +53081,79 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
-
- 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);
- }
- }
+ name: 'ElTag',
+ props: {
+ text: String,
+ closable: Boolean,
+ type: String,
+ hit: Boolean,
+ closeTransition: Boolean,
+ color: String
},
-
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);
+ handleClose: function handleClose(event) {
+ this.$emit('close', event);
}
}
};
/***/ },
-/* 251 */
+/* 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": "el-notification-fade"
+ "name": _vm.closeTransition ? '' : 'el-zoom-in-center'
}
- }, [_c('div', {
- directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.visible),
- expression: "visible"
+ }, [_c('span', {
+ staticClass: "el-tag",
+ class: [_vm.type ? 'el-tag--' + _vm.type : '', {
+ 'is-hit': _vm.hit
}],
- 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",
+ backgroundColor: _vm.color
+ })
+ }, [_vm._t("default"), (_vm.closable) ? _c('i', {
+ staticClass: "el-tag__close el-icon-close",
on: {
- "click": function($event) {
- $event.stopPropagation();
- _vm.close($event)
- }
+ "click": _vm.handleClose
}
- })])])])
+ }) : _vm._e()], 2)])
},staticRenderFns: []}
/***/ },
-/* 252 */
+/* 233 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(253);
+ var _tree = __webpack_require__(234);
- var _main2 = _interopRequireDefault(_main);
+ var _tree2 = _interopRequireDefault(_tree);
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);
+ _tree2.default.install = function (Vue) {
+ Vue.component(_tree2.default.name, _tree2.default);
};
- exports.default = _main2.default;
+ exports.default = _tree2.default;
/***/ },
-/* 253 */
+/* 234 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(254),
+ __webpack_require__(235),
/* template */
- __webpack_require__(259),
+ __webpack_require__(242),
/* styles */
null,
/* scopeId */
@@ -53647,20 +53166,18 @@ module.exports =
/***/ },
-/* 254 */
+/* 235 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _inputNumber = __webpack_require__(255);
-
- var _inputNumber2 = _interopRequireDefault(_inputNumber);
+ var _treeStore = __webpack_require__(236);
- var _button = __webpack_require__(256);
+ var _treeStore2 = _interopRequireDefault(_treeStore);
- var _button2 = _interopRequireDefault(_button);
+ var _locale = __webpack_require__(111);
var _emitter = __webpack_require__(15);
@@ -53669,274 +53186,159 @@ module.exports =
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElSlider',
+ name: 'ElTree',
mixins: [_emitter2.default],
+ components: {
+ ElTreeNode: __webpack_require__(239)
+ },
+
+ data: function data() {
+ return {
+ store: null,
+ root: null,
+ currentNode: null
+ };
+ },
+
+
props: {
- min: {
- type: Number,
- default: 0
- },
- max: {
- type: Number,
- default: 100
- },
- step: {
- type: Number,
- default: 1
- },
- value: {
- type: [Number, Array],
- default: 0
+ data: {
+ type: Array
},
- showInput: {
- type: Boolean,
- default: false
+ emptyText: {
+ type: String,
+ default: function _default() {
+ return (0, _locale.t)('el.tree.emptyText');
+ }
},
- showInputControls: {
+ nodeKey: String,
+ checkStrictly: Boolean,
+ defaultExpandAll: Boolean,
+ expandOnClickNode: {
type: Boolean,
default: true
},
- showStops: {
- type: Boolean,
- default: false
- },
- showTooltip: {
+ autoExpandParent: {
type: Boolean,
default: true
},
- formatTooltip: Function,
- disabled: {
+ defaultCheckedKeys: Array,
+ defaultExpandedKeys: Array,
+ renderContent: Function,
+ showCheckbox: {
type: Boolean,
default: false
},
- range: {
- type: Boolean,
- default: false
+ props: {
+ default: function _default() {
+ return {
+ children: 'children',
+ label: 'label',
+ icon: 'icon',
+ disabled: 'disabled'
+ };
+ }
},
- vertical: {
+ lazy: {
type: Boolean,
default: false
},
- height: {
- type: String
- },
- debounce: {
+ highlightCurrent: Boolean,
+ currentNodeKey: [String, Number],
+ load: Function,
+ filterNodeMethod: Function,
+ accordion: Boolean,
+ indent: {
type: Number,
- default: 300
+ default: 16
}
},
- components: {
- ElInputNumber: _inputNumber2.default,
- SliderButton: _button2.default
- },
-
- data: function data() {
- return {
- firstValue: null,
- secondValue: null,
- oldValue: null,
- dragging: false,
- sliderSize: 1
- };
+ computed: {
+ children: {
+ set: function set(value) {
+ this.data = value;
+ },
+ get: function get() {
+ return this.data;
+ }
+ }
},
-
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);
- }
+ defaultCheckedKeys: function defaultCheckedKeys(newVal) {
+ this.store.defaultCheckedKeys = newVal;
+ this.store.setDefaultCheckedKey(newVal);
},
- secondValue: function secondValue() {
- if (this.range) {
- this.$emit('input', [this.minValue, this.maxValue]);
- }
+ defaultExpandedKeys: function defaultExpandedKeys(newVal) {
+ this.store.defaultExpandedKeys = newVal;
+ this.store.setDefaultExpandedKeys(newVal);
},
- min: function min() {
- this.setValues();
+ currentNodeKey: function currentNodeKey(newVal) {
+ this.store.setCurrentNodeKey(newVal);
+ this.store.currentNodeKey = newVal;
},
- max: function max() {
- this.setValues();
+ data: function data(newVal) {
+ this.store.setData(newVal);
}
},
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;
- }
+ filter: function filter(value) {
+ if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
+ this.store.filter(value);
},
- 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;
- }
- }
+ getNodeKey: function getNodeKey(node, index) {
+ var nodeKey = this.nodeKey;
+ if (nodeKey && node) {
+ return node.data[nodeKey];
}
+ return index;
},
- 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);
+ getCheckedNodes: function getCheckedNodes(leafOnly) {
+ return this.store.getCheckedNodes(leafOnly);
},
- onSliderClick: function onSliderClick(event) {
- if (this.disabled || this.dragging) return;
- this.resetSize();
- 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);
- }
+ getCheckedKeys: function getCheckedKeys(leafOnly) {
+ return this.store.getCheckedKeys(leafOnly);
},
- resetSize: function resetSize() {
- if (this.$refs.slider) {
- this.sliderSize = this.$refs.slider['client' + (this.vertical ? 'Height' : 'Width')];
- }
- }
- },
-
- computed: {
- 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%';
+ setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
+ if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
+ this.store.setCheckedNodes(nodes, leafOnly);
},
- 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);
+ setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
+ if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
+ this.store.setCheckedKeys(keys, leafOnly);
},
- runwayStyle: function runwayStyle() {
- return this.vertical ? { height: this.height } : {};
+ setChecked: function setChecked(data, checked, deep) {
+ this.store.setChecked(data, checked, deep);
},
- barStyle: function barStyle() {
- return this.vertical ? {
- height: this.barSize,
- bottom: this.barStart
- } : {
- width: this.barSize,
- left: this.barStart
- };
+ handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
+ this.broadcast('ElTreeNode', 'tree-node-expand', node);
+ this.$emit('node-expand', nodeData, node, instance);
}
},
- 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;
- }
- this.resetSize();
- window.addEventListener('resize', this.resetSize);
- },
- beforeDestroy: function beforeDestroy() {
- window.removeEventListener('resize', this.resetSize);
+ 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;
}
}; //
//
@@ -53954,1015 +53356,851 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
-
-/***/ },
-/* 255 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(76);
/***/ },
-/* 256 */
+/* 236 */
/***/ 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
- )
+ 'use strict';
- module.exports = Component.exports
+ 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; };
-/***/ },
-/* 257 */
-/***/ function(module, exports, __webpack_require__) {
+ var _node = __webpack_require__(237);
- 'use strict';
+ var _node2 = _interopRequireDefault(_node);
- exports.__esModule = true;
+ var _util = __webpack_require__(238);
- var _tooltip = __webpack_require__(138);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _tooltip2 = _interopRequireDefault(_tooltip);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var TreeStore = function () {
+ function TreeStore(options) {
+ var _this = this;
- exports.default = {
- name: 'ElSliderButton',
+ _classCallCheck(this, TreeStore);
- components: {
- ElTooltip: _tooltip2.default
- },
+ this.currentNode = null;
+ this.currentNodeKey = null;
- props: {
- value: {
- type: Number,
- default: 0
- },
- vertical: {
- type: Boolean,
- default: false
+ for (var option in options) {
+ if (options.hasOwnProperty(option)) {
+ this[option] = options[option];
+ }
}
- },
- data: function data() {
- return {
- hovering: false,
- dragging: false,
- startX: 0,
- currentX: 0,
- startY: 0,
- currentY: 0,
- startPosition: 0,
- newPosition: null,
- oldValue: this.value
- };
- },
+ this.nodesMap = {};
+ this.root = new _node2.default({
+ data: this.data,
+ store: this
+ });
- 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 };
+ if (this.lazy && this.load) {
+ var loadFn = this.load;
+ loadFn(this.root, function (data) {
+ _this.root.doCreateChildren(data);
+ _this._initDefaultCheckedNodes();
+ });
+ } else {
+ this._initDefaultCheckedNodes();
}
- },
+ }
- watch: {
- dragging: function dragging(val) {
- this.$parent.dragging = val;
- }
- },
+ TreeStore.prototype.filter = function filter(value) {
+ var filterNodeMethod = this.filterNodeMethod;
+ var traverse = function traverse(node) {
+ var childNodes = node.root ? node.root.childNodes : node.childNodes;
- 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();
- this.$parent.resetSize();
- var diff = 0;
- if (this.vertical) {
- this.currentY = event.clientY;
- diff = (this.startY - this.currentY) / this.$parent.sliderSize * 100;
+ 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 {
- this.currentX = event.clientX;
- diff = (this.currentX - this.startX) / this.$parent.sliderSize * 100;
+ node.visible = allHidden === false;
}
- 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 === null) return;
- 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;
- }
- }
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ if (node.visible && !node.isLeaf) node.expand();
+ };
-/***/ },
-/* 258 */
-/***/ function(module, exports) {
+ traverse(this);
+ };
- 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
+ TreeStore.prototype.setData = function setData(newVal) {
+ var instanceChanged = newVal !== this.root.data;
+ this.root.setData(newVal);
+ if (instanceChanged) {
+ this._initDefaultCheckedNodes();
}
- }, [_c('span', {
- slot: "content"
- }, [_vm._v(_vm._s(_vm.formatValue))]), _c('div', {
- staticClass: "el-slider__button",
- class: {
- 'hover': _vm.hovering, 'dragging': _vm.dragging
+ };
+
+ 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);
}
- })])], 1)
- },staticRenderFns: []}
+ };
-/***/ },
-/* 259 */
-/***/ function(module, exports) {
+ TreeStore.prototype.append = function append(data, parentData) {
+ var parentNode = parentData ? this.getNode(parentData) : this.root;
- 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
+ if (parentNode) {
+ parentNode.insertChild({ data: data });
}
- }, [(_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,
- "debounce": _vm.debounce,
- "size": "small"
- },
- model: {
- value: (_vm.firstValue),
- callback: function($$v) {
- _vm.firstValue = $$v
- },
- expression: "firstValue"
+ };
+
+ 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);
}
- }) : _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
+ };
+
+ TreeStore.prototype.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
+ if (newVal !== this.defaultCheckedKeys) {
+ this.defaultCheckedKeys = newVal;
+ this._initDefaultCheckedNodes();
}
- }, [_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__) {
+ TreeStore.prototype.registerNode = function registerNode(node) {
+ var key = this.key;
+ if (!key || !node || !node.data) return;
- 'use strict';
+ var nodeKey = node.key;
+ if (nodeKey !== undefined) this.nodesMap[node.key] = node;
+ };
- var _vue = __webpack_require__(133);
+ TreeStore.prototype.deregisterNode = function deregisterNode(node) {
+ var key = this.key;
+ if (!key || !node || !node.data) return;
- var _vue2 = _interopRequireDefault(_vue);
+ delete this.nodesMap[node.key];
+ };
- var _dom = __webpack_require__(44);
+ TreeStore.prototype.getCheckedNodes = function getCheckedNodes() {
+ var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var checkedNodes = [];
+ var traverse = function traverse(node) {
+ var childNodes = node.root ? node.root.childNodes : node.childNodes;
- var Mask = _vue2.default.extend(__webpack_require__(262));
+ childNodes.forEach(function (child) {
+ if (!leafOnly && child.checked || leafOnly && child.isLeaf && child.checked) {
+ checkedNodes.push(child.data);
+ }
- 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 = (0, _dom.getStyle)(document.body, 'position');
- el.originalOverflow = (0, _dom.getStyle)(document.body, 'overflow');
+ traverse(child);
+ });
+ };
- (0, _dom.addClass)(el.mask, 'is-fullscreen');
- insertDom(document.body, el, binding);
- } else {
- (0, _dom.removeClass)(el.mask, 'is-fullscreen');
+ traverse(this);
- if (binding.modifiers.body) {
- el.originalPosition = (0, _dom.getStyle)(document.body, 'position');
+ return checkedNodes;
+ };
- ['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';
- });
+ TreeStore.prototype.getCheckedKeys = function getCheckedKeys() {
+ var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- insertDom(document.body, el, binding);
- } else {
- el.originalPosition = (0, _dom.getStyle)(el, 'position');
- insertDom(el, el, binding);
- }
+ 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]);
}
- });
- } 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;
}
- }
+ });
+ return keys;
};
- 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' && el.originalPosition !== 'fixed') {
- parent.style.position = 'relative';
- }
- if (binding.modifiers.fullscreen && binding.modifiers.lock) {
- parent.style.overflow = 'hidden';
+ TreeStore.prototype._getAllNodes = function _getAllNodes() {
+ var allNodes = [];
+ var nodesMap = this.nodesMap;
+ for (var nodeKey in nodesMap) {
+ if (nodesMap.hasOwnProperty(nodeKey)) {
+ allNodes.push(nodesMap[nodeKey]);
}
- el.domVisible = true;
-
- parent.appendChild(el.mask);
- Vue.nextTick(function () {
- el.instance.visible = true;
- });
- el.domInserted = true;
}
+
+ return allNodes;
};
- 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
+ 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);
}
- });
- el.instance = mask;
- el.mask = mask.$el;
- el.maskStyle = {};
+ continue;
+ }
- toggleLoading(el, binding);
- },
+ var parent = node.parent;
+ while (parent && parent.level > 0) {
+ cache[parent.data[key]] = true;
+ parent = parent.parent;
+ }
- update: function update(el, binding) {
- el.instance.setText(el.getAttribute('element-loading-text'));
- if (binding.oldValue !== binding.value) {
- toggleLoading(el, binding);
+ if (node.isLeaf || this.checkStrictly) {
+ node.setChecked(true, false);
+ continue;
}
- },
+ node.setChecked(true, true);
- 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);
- }
+ 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);
+ })();
}
}
- });
- };
+ };
-/***/ },
-/* 262 */
-/***/ function(module, exports, __webpack_require__) {
+ TreeStore.prototype.setCheckedNodes = function setCheckedNodes(array) {
+ var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(263),
- /* template */
- __webpack_require__(264),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var key = this.key;
+ var checkedKeys = {};
+ array.forEach(function (item) {
+ checkedKeys[(item || {})[key]] = true;
+ });
- module.exports = Component.exports
+ this._setCheckedKeys(key, leafOnly, checkedKeys);
+ };
+ TreeStore.prototype.setCheckedKeys = function setCheckedKeys(keys) {
+ var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
-/***/ },
-/* 263 */
-/***/ function(module, exports) {
+ this.defaultCheckedKeys = keys;
+ var key = this.key;
+ var checkedKeys = {};
+ keys.forEach(function (key) {
+ checkedKeys[key] = true;
+ });
- 'use strict';
+ this._setCheckedKeys(key, leafOnly, checkedKeys);
+ };
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ TreeStore.prototype.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
+ var _this3 = this;
- exports.default = {
- data: function data() {
- return {
- text: null,
- fullscreen: true,
- visible: false,
- customClass: ''
- };
- },
+ 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);
- methods: {
- handleAfterLeave: function handleAfterLeave() {
- this.$emit('after-leave');
- },
- setText: function setText(text) {
- this.text = text;
+ if (node) {
+ node.setChecked(!!checked, deep);
}
- }
- };
+ };
-/***/ },
-/* 264 */
-/***/ function(module, exports) {
+ TreeStore.prototype.getCurrentNode = function getCurrentNode() {
+ return this.currentNode;
+ };
- 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"
+ 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;
}
- })]), (_vm.text) ? _c('p', {
- staticClass: "el-loading-text"
- }, [_vm._v(_vm._s(_vm.text))]) : _vm._e()])])])
- },staticRenderFns: []}
+ };
+
+ return TreeStore;
+ }();
+
+ exports.default = TreeStore;
+ ;
/***/ },
-/* 265 */
+/* 237 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
+ exports.getChildState = undefined;
- var _vue = __webpack_require__(133);
-
- var _vue2 = _interopRequireDefault(_vue);
-
- var _loading = __webpack_require__(262);
-
- var _loading2 = _interopRequireDefault(_loading);
-
- var _dom = __webpack_require__(44);
+ 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__(64);
var _merge2 = _interopRequireDefault(_merge);
+ var _util = __webpack_require__(238);
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var LoadingConstructor = _vue2.default.extend(_loading2.default);
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var defaults = {
- text: null,
- fullscreen: true,
- body: false,
- lock: false,
- customClass: ''
+ 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 fullscreenLoading = void 0;
+ var reInitChecked = function reInitChecked(node) {
+ var _getChildState = getChildState(node.childNodes),
+ all = _getChildState.all,
+ none = _getChildState.none,
+ half = _getChildState.half;
- LoadingConstructor.prototype.originalPosition = '';
- LoadingConstructor.prototype.originalOverflow = '';
+ 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;
+ }
- LoadingConstructor.prototype.close = function () {
- var _this = this;
+ var parent = node.parent;
+ if (!parent || parent.level === 0) return;
- 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;
+ if (!node.store.checkStrictly) {
+ reInitChecked(parent);
}
- 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 = (0, _dom.getStyle)(document.body, 'position');
- instance.originalOverflow = (0, _dom.getStyle)(document.body, 'overflow');
- } else if (options.body) {
- instance.originalPosition = (0, _dom.getStyle)(document.body, '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 = (0, _dom.getStyle)(parent, 'position');
+ 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;
+ }
+ }
}
- Object.keys(maskStyle).forEach(function (property) {
- instance.$el.style[property] = maskStyle[property];
- });
+
+ var parent = node.parent;
+ if (!parent || parent.level === 0) return;
+ reInitChecked(parent);
};
- var Loading = function Loading() {
- var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
+ var getPropertyFromData = function getPropertyFromData(node, prop) {
+ var props = node.store.props;
+ var data = node.data || {};
+ var config = props[prop];
- 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' && instance.originalPosition !== 'fixed') {
- 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;
+ if (typeof config === 'function') {
+ return config(data, node);
+ } else if (typeof config === 'string') {
+ return data[config];
+ } else if (typeof config === 'undefined') {
+ return '';
}
- return instance;
};
- exports.default = Loading;
-
-/***/ },
-/* 266 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
-
- var _icon = __webpack_require__(267);
+ var nodeIdSeed = 0;
- var _icon2 = _interopRequireDefault(_icon);
+ var Node = function () {
+ function Node(options) {
+ _classCallCheck(this, Node);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ this.id = nodeIdSeed++;
+ this.text = null;
+ this.checked = false;
+ this.indeterminate = false;
+ this.data = null;
+ this.expanded = false;
+ this.parent = null;
+ this.visible = true;
- /* istanbul ignore next */
- _icon2.default.install = function (Vue) {
- Vue.component(_icon2.default.name, _icon2.default);
- };
+ for (var name in options) {
+ if (options.hasOwnProperty(name)) {
+ this[name] = options[name];
+ }
+ }
- exports.default = _icon2.default;
+ // internal
+ this.level = 0;
+ this.loaded = false;
+ this.childNodes = [];
+ this.loading = false;
-/***/ },
-/* 267 */
-/***/ function(module, exports, __webpack_require__) {
+ if (this.parent) {
+ this.level = this.parent.level + 1;
+ }
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(268),
- /* template */
- __webpack_require__(269),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var store = this.store;
+ if (!store) {
+ throw new Error('[Node]store is required!');
+ }
+ store.registerNode(this);
- module.exports = Component.exports
+ 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);
-/***/ },
-/* 268 */
-/***/ function(module, exports) {
+ if (store.defaultExpandAll) {
+ this.expanded = true;
+ }
+ } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
+ this.expand();
+ }
- 'use strict';
+ 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);
+ }
- exports.__esModule = true;
- //
- //
- //
- //
+ if (key && store.currentNodeKey && this.key === store.currentNodeKey) {
+ store.currentNode = this;
+ }
- exports.default = {
- name: 'ElIcon',
+ if (store.lazy) {
+ store._initDefaultCheckedNode(this);
+ }
- props: {
- name: String
+ this.updateLeafState();
}
- };
-/***/ },
-/* 269 */
-/***/ function(module, exports) {
+ Node.prototype.setData = function setData(data) {
+ if (!Array.isArray(data)) {
+ (0, _util.markNodeData)(this, data);
+ }
- 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: []}
+ this.data = data;
+ this.childNodes = [];
-/***/ },
-/* 270 */
-/***/ function(module, exports, __webpack_require__) {
+ var children = void 0;
+ if (this.level === 0 && this.data instanceof Array) {
+ children = this.data;
+ } else {
+ children = getPropertyFromData(this, 'children') || [];
+ }
- 'use strict';
+ for (var i = 0, j = children.length; i < j; i++) {
+ this.insertChild({ data: children[i] });
+ }
+ };
- exports.__esModule = true;
+ Node.prototype.insertChild = function insertChild(child, index) {
+ if (!child) throw new Error('insertChild error: child is required.');
- var _row = __webpack_require__(271);
+ if (!(child instanceof Node)) {
+ (0, _merge2.default)(child, {
+ parent: this,
+ store: this.store
+ });
+ child = new Node(child);
+ }
- var _row2 = _interopRequireDefault(_row);
+ child.level = this.level + 1;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ if (typeof index === 'undefined' || index < 0) {
+ this.childNodes.push(child);
+ } else {
+ this.childNodes.splice(index, 0, child);
+ }
- /* istanbul ignore next */
- _row2.default.install = function (Vue) {
- Vue.component(_row2.default.name, _row2.default);
- };
+ this.updateLeafState();
+ };
- exports.default = _row2.default;
+ Node.prototype.insertBefore = function insertBefore(child, ref) {
+ var index = void 0;
+ if (ref) {
+ index = this.childNodes.indexOf(ref);
+ }
+ this.insertChild(child, index);
+ };
-/***/ },
-/* 271 */
-/***/ function(module, exports) {
+ 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);
+ };
- 'use strict';
+ Node.prototype.removeChild = function removeChild(child) {
+ var index = this.childNodes.indexOf(child);
- exports.__esModule = true;
- exports.default = {
- name: 'ElRow',
+ if (index > -1) {
+ this.store && this.store.deregisterNode(child);
+ child.parent = null;
+ this.childNodes.splice(index, 1);
+ }
- componentName: 'ElRow',
+ this.updateLeafState();
+ };
- props: {
- tag: {
- type: String,
- default: 'div'
- },
- gutter: Number,
- type: String,
- justify: {
- type: String,
- default: 'start'
- },
- align: {
- type: String,
- default: 'top'
+ 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);
}
- },
+ };
- computed: {
- style: function style() {
- var ret = {};
+ Node.prototype.expand = function expand(callback, expandParent) {
+ var _this = this;
- if (this.gutter) {
- ret.marginLeft = '-' + this.gutter / 2 + 'px';
- ret.marginRight = ret.marginLeft;
+ 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();
+ };
- return ret;
+ if (this.shouldLoadData()) {
+ this.loadData(function (data) {
+ if (data instanceof Array) {
+ initLazyLoadChild(_this);
+ done();
+ }
+ });
+ } else {
+ done();
}
- },
+ };
- 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);
- }
- };
+ Node.prototype.doCreateChildren = function doCreateChildren(array) {
+ var _this2 = this;
-/***/ },
-/* 272 */
-/***/ function(module, exports, __webpack_require__) {
+ var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- 'use strict';
+ array.forEach(function (item) {
+ _this2.insertChild((0, _merge2.default)({ data: item }, defaultProps));
+ });
+ };
- exports.__esModule = true;
+ Node.prototype.collapse = function collapse() {
+ this.expanded = false;
+ };
- var _col = __webpack_require__(273);
+ Node.prototype.shouldLoadData = function shouldLoadData() {
+ return this.store.lazy === true && this.store.load && !this.loaded;
+ };
- var _col2 = _interopRequireDefault(_col);
+ 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;
+ };
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ Node.prototype.setChecked = function setChecked(value, deep, recursion, passValue) {
+ var _this3 = this;
- /* istanbul ignore next */
- _col2.default.install = function (Vue) {
- Vue.component(_col2.default.name, _col2.default);
- };
+ this.indeterminate = value === 'half';
+ this.checked = value === true;
- exports.default = _col2.default;
+ var _getChildState2 = getChildState(this.childNodes),
+ all = _getChildState2.all,
+ allWithoutDisable = _getChildState2.allWithoutDisable;
-/***/ },
-/* 273 */
-/***/ function(module, exports) {
+ if (this.childNodes.length && !all && allWithoutDisable) {
+ this.checked = false;
+ value = false;
+ }
- 'use strict';
+ 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);
+ }
- exports.__esModule = true;
+ var _getChildState3 = getChildState(childNodes),
+ half = _getChildState3.half,
+ _all = _getChildState3.all;
- 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; };
+ if (!_all) {
+ _this3.checked = _all;
+ _this3.indeterminate = half;
+ }
+ }
+ };
- exports.default = {
- name: 'ElCol',
+ if (!this.store.checkStrictly && this.shouldLoadData()) {
+ // Only work on lazy load data.
+ this.loadData(function () {
+ handleDescendants(true);
+ }, {
+ checked: value !== false
+ });
+ } else {
+ handleDescendants();
+ }
- 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]
- },
+ var parent = this.parent;
+ if (!parent || parent.level === 0) return;
- computed: {
- gutter: function gutter() {
- var parent = this.$parent;
- while (parent && parent.$options.componentName !== 'ElRow') {
- parent = parent.$parent;
- }
- return parent ? parent.gutter : 0;
+ if (!this.store.checkStrictly && !recursion) {
+ reInitChecked(parent);
}
- },
- render: function render(h) {
- var _this = this;
+ };
- var classList = [];
- var style = {};
+ Node.prototype.getChildren = function getChildren() {
+ // this is data
+ var data = this.data;
+ if (!data) return null;
- if (this.gutter) {
- style.paddingLeft = this.gutter / 2 + 'px';
- style.paddingRight = style.paddingLeft;
+ var props = this.store.props;
+ var children = 'children';
+ if (props) {
+ children = props.children || 'children';
}
- ['span', 'offset', 'pull', 'push'].forEach(function (prop) {
- if (_this[prop]) {
- classList.push(prop !== 'span' ? 'el-col-' + prop + '-' + _this[prop] : 'el-col-' + _this[prop]);
- }
+ 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;
});
- ['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]);
- });
- })();
+ 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 });
}
});
- return h(this.tag, {
- class: ['el-col', classList],
- style: style
- }, this.$slots.default);
- }
- };
+ oldData.forEach(function (item) {
+ if (!newDataMap[item[_util.NODE_KEY]]) _this4.removeChildByData(item);
+ });
-/***/ },
-/* 274 */
-/***/ function(module, exports, __webpack_require__) {
+ newNodes.forEach(function (_ref) {
+ var index = _ref.index,
+ data = _ref.data;
- 'use strict';
+ _this4.insertChild({ data: data }, index);
+ });
- exports.__esModule = true;
+ this.updateLeafState();
+ };
- var _src = __webpack_require__(275);
+ Node.prototype.loadData = function loadData(callback) {
+ var _this5 = this;
- var _src2 = _interopRequireDefault(_src);
+ var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
+ this.loading = true;
- /* istanbul ignore next */
- _src2.default.install = function (Vue) {
- Vue.component(_src2.default.name, _src2.default);
- };
+ var resolve = function resolve(children) {
+ _this5.loaded = true;
+ _this5.loading = false;
+ _this5.childNodes = [];
- exports.default = _src2.default;
+ _this5.doCreateChildren(children, defaultProps);
-/***/ },
-/* 275 */
-/***/ function(module, exports, __webpack_require__) {
+ _this5.updateLeafState();
+ if (callback) {
+ callback.call(_this5, children);
+ }
+ };
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(276),
- /* template */
- null,
- /* styles */
+ 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,
@@ -54974,348 +54212,177 @@ module.exports =
/***/ },
-/* 276 */
+/* 240 */
/***/ 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 _collapseTransition = __webpack_require__(49);
- var _iframeUpload2 = _interopRequireDefault(_iframeUpload);
+ var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
- var _progress = __webpack_require__(279);
+ var _checkbox = __webpack_require__(130);
- var _progress2 = _interopRequireDefault(_progress);
+ var _checkbox2 = _interopRequireDefault(_checkbox);
- var _migrating = __webpack_require__(289);
+ var _emitter = __webpack_require__(15);
- var _migrating2 = _interopRequireDefault(_migrating);
+ var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function noop() {}
-
exports.default = {
- name: 'ElUpload',
-
- mixins: [_migrating2.default],
+ name: 'ElTreeNode',
- components: {
- ElProgress: _progress2.default,
- UploadList: _uploadList2.default,
- Upload: _upload2.default,
- IframeUpload: _iframeUpload2.default
- },
+ componentName: 'ElTreeNode',
- provide: {
- uploader: undefined
- },
+ mixins: [_emitter2.default],
props: {
- action: {
- type: String,
- required: true
- },
- headers: {
- type: Object,
+ node: {
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 [];
+ 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]
+ );
}
- },
- 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
+ tree: null,
+ expanded: false,
+ childNodeRendered: false,
+ showCheckbox: false,
+ oldChecked: null,
+ oldIndeterminate: null
};
},
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;
- });
+ '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: {
- 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;
+ getNodeKey: function getNodeKey(node, index) {
+ var nodeKey = this.tree.nodeKey;
+ if (nodeKey && node) {
+ return node.data[nodeKey];
}
-
- 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;
+ return index;
},
- 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);
+ 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;
},
- 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);
+ 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.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);
+ this.tree.$emit('node-click', this.node.data, this.node, this);
},
- clearFiles: function clearFiles() {
- this.uploadFiles = [];
+ 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);
+ }
},
- 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);
- });
+ handleCheckChange: function handleCheckChange(ev) {
+ this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
},
- 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'
- }
- };
+ handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
+ this.broadcast('ElTreeNode', 'tree-node-expand', node);
+ this.tree.$emit('node-expand', nodeData, node, instance);
}
},
- render: function render(h) {
- var uploadList;
+ created: function created() {
+ var _this = this;
- if (this.showFileList) {
- uploadList = h(
- _uploadList2.default,
- {
- attrs: {
- disabled: this.disabled,
- listType: this.listType,
- files: this.uploadFiles,
+ var parent = this.$parent;
- handlePreview: this.onPreview },
- on: {
- 'remove': this.handleRemove
- }
- },
- []
- );
+ if (parent.isTree) {
+ this.tree = parent;
+ } else {
+ this.tree = parent.tree;
}
- 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 tree = this.tree;
+ if (!tree) {
+ console.warn('Can not find node\'s tree.');
+ }
- var _locale2 = _interopRequireDefault(_locale);
+ var props = tree.props || {};
+ var childrenKey = props['children'] || 'children';
- var _progress = __webpack_require__(279);
+ this.$watch('node.data.' + childrenKey, function () {
+ _this.node.updateChildren();
+ });
- var _progress2 = _interopRequireDefault(_progress);
+ this.showCheckbox = tree.showCheckbox;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ 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();
+ }
+ });
+ }
+ }
+ }; //
//
//
//
@@ -55361,142 +54428,154 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
-
- 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__(77);
-
-/***/ },
-/* 280 */
+/* 241 */
/***/ 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
+ 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)
}
- ],
- 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
+ }, [_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.disabled) ? _c('i', {
- staticClass: "el-icon-close",
- on: {
- "click": function($event) {
- _vm.$emit('remove', file)
- }
+ }
+ }), (_vm.showCheckbox) ? _c('el-checkbox', {
+ attrs: {
+ "indeterminate": _vm.node.indeterminate,
+ "disabled": !!_vm.node.disabled
+ },
+ on: {
+ "change": _vm.handleCheckChange
+ },
+ nativeOn: {
+ "click": function($event) {
+ $event.stopPropagation();
}
- }) : _vm._e(), (file.status === 'uploading') ? _c('el-progress', {
+ },
+ 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: {
- "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",
+ "render-content": _vm.renderContent,
+ "node": child
+ },
on: {
- "click": function($event) {
- _vm.handlePreview(file)
- }
+ "node-expand": _vm.handleChildNodeExpand
}
- }, [_c('i', {
- staticClass: "el-icon-view"
- })]) : _vm._e(), (!_vm.disabled) ? _c('span', {
- staticClass: "el-upload-list__item-delete",
+ })
+ }))])], 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: {
- "click": function($event) {
- _vm.$emit('remove', file)
- }
+ "node-expand": _vm.handleNodeExpand
}
- }, [_c('i', {
- staticClass: "el-icon-delete2"
- })]) : _vm._e()]) : _vm._e()], 1)
- }))
+ })
+ }), (!_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: []}
/***/ },
-/* 281 */
+/* 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__(282),
+ __webpack_require__(245),
/* template */
- null,
+ __webpack_require__(246),
/* styles */
null,
/* scopeId */
@@ -55509,330 +54588,262 @@ module.exports =
/***/ },
-/* 282 */
-/***/ function(module, exports, __webpack_require__) {
+/* 245 */
+/***/ function(module, exports) {
'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 }; }
-
+ var TYPE_CLASSES_MAP = {
+ 'success': 'el-icon-circle-check',
+ 'warning': 'el-icon-warning',
+ 'error': 'el-icon-circle-cross'
+ };
exports.default = {
- inject: ['uploader'],
- components: {
- UploadDragger: _uploadDragger2.default
- },
+ name: 'ElAlert',
+
props: {
- type: String,
- action: {
+ title: {
type: String,
+ default: '',
required: true
},
- name: {
+ description: {
type: String,
- default: 'file'
+ default: ''
},
- 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() {}
+ type: {
+ type: String,
+ default: 'info'
},
- onRemove: {
- type: Function,
- default: function _default() {}
+ closable: {
+ type: Boolean,
+ default: true
},
- fileList: Array,
- autoUpload: Boolean,
- listType: String,
- httpRequest: {
- type: Function,
- default: _ajax2.default
+ closeText: {
+ type: String,
+ default: ''
},
- disabled: Boolean
+ showIcon: {
+ type: Boolean,
+ default: false
+ }
},
data: function data() {
return {
- mouseover: false,
- reqs: {}
+ visible: true
};
},
methods: {
- isImage: function isImage(str) {
- return str.indexOf('image') !== -1;
- },
- handleChange: function handleChange(ev) {
- var files = ev.target.files;
+ close: function close() {
+ this.visible = false;
+ this.$emit('close');
+ }
+ },
- if (!files) return;
- this.uploadFiles(files);
+ computed: {
+ typeClass: function typeClass() {
+ return 'el-alert--' + this.type;
},
- 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);
- });
+ iconClass: function iconClass() {
+ return TYPE_CLASSES_MAP[this.type] || 'el-icon-information';
},
- upload: function upload(rawFile, file) {
- var _this2 = this;
+ isBigIcon: function isBigIcon() {
+ return this.description || this.$slots.default ? 'is-big' : '';
+ },
+ isBoldTitle: function isBoldTitle() {
+ return this.description || this.$slots.default ? 'is-bold' : '';
+ }
+ }
+ };
- this.$refs.input.value = null;
+/***/ },
+/* 246 */
+/***/ function(module, exports) {
- if (!this.beforeUpload) {
- return this.post(rawFile);
+ 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: []}
- 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;
+/***/ },
+/* 247 */
+/***/ function(module, exports, __webpack_require__) {
- 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;
+ 'use strict';
- var uid = rawFile.uid;
+ exports.__esModule = true;
- 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();
- }
- }
- },
+ var _main = __webpack_require__(248);
- 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 _main2 = _interopRequireDefault(_main);
- 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
- }
- },
- []
- )]
- );
- }
- };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+ exports.default = _main2.default;
/***/ },
-/* 283 */
-/***/ function(module, exports) {
+/* 248 */
+/***/ function(module, exports, __webpack_require__) {
'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;
- }
+ var _vue = __webpack_require__(133);
- try {
- return JSON.parse(text);
- } catch (e) {
- return text;
- }
- }
+ var _vue2 = _interopRequireDefault(_vue);
- function upload(option) {
- if (typeof XMLHttpRequest === 'undefined') {
- return;
- }
+ var _popup = __webpack_require__(14);
- var xhr = new XMLHttpRequest();
- var action = option.action;
+ var _vdom = __webpack_require__(194);
- if (xhr.upload) {
- xhr.upload.onprogress = function progress(e) {
- if (e.total > 0) {
- e.percent = e.loaded / e.total * 100;
- }
- option.onProgress(e);
- };
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var formData = new FormData();
+ var NotificationConstructor = _vue2.default.extend(__webpack_require__(249));
- if (option.data) {
- Object.keys(option.data).map(function (key) {
- formData.append(key, option.data[key]);
- });
- }
+ var instance = void 0;
+ var instances = [];
+ var seed = 1;
- formData.append(option.filename, option.file);
+ var Notification = function Notification(options) {
+ if (_vue2.default.prototype.$isServer) return;
+ options = options || {};
+ var userOnClose = options.onClose;
+ var id = 'notification_' + seed++;
- xhr.onerror = function error(e) {
- option.onError(e);
+ options.onClose = function () {
+ Notification.close(id, userOnClose);
};
- xhr.onload = function onload() {
- if (xhr.status < 200 || xhr.status >= 300) {
- return option.onError(getError(action, option, xhr));
- }
-
- option.onSuccess(getBody(xhr));
- };
+ instance = new NotificationConstructor({
+ data: options
+ });
- xhr.open('post', action, true);
+ 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();
- if (option.withCredentials && 'withCredentials' in xhr) {
- xhr.withCredentials = true;
+ 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;
+ };
- var headers = option.headers || {};
+ ['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);
+ };
+ });
- for (var item in headers) {
- if (headers.hasOwnProperty(item) && headers[item] !== null) {
- xhr.setRequestHeader(item, headers[item]);
+ 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;
}
}
- xhr.send(formData);
- return xhr;
- }
+
+ 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;
/***/ },
-/* 284 */
+/* 249 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(285),
+ __webpack_require__(250),
/* template */
- __webpack_require__(286),
+ __webpack_require__(251),
/* styles */
null,
/* scopeId */
@@ -55845,7 +54856,7 @@ module.exports =
/***/ },
-/* 285 */
+/* 250 */
/***/ function(module, exports) {
'use strict';
@@ -55864,69 +54875,191 @@ module.exports =
//
//
//
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+
+ var typeMap = {
+ success: 'circle-check',
+ info: 'information',
+ warning: 'warning',
+ error: 'circle-cross'
+ };
exports.default = {
- name: 'ElUploadDrag',
- props: {
- disabled: Boolean
- },
data: function data() {
return {
- dragover: false
+ 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: {
- onDragover: function onDragover() {
- if (!this.disabled) {
- this.dragover = true;
+ 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();
}
},
- onDrop: function onDrop(e) {
- if (!this.disabled) {
- this.dragover = false;
- this.$emit('file', e.dataTransfer.files);
+ 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);
+ }
}
};
/***/ },
-/* 286 */
+/* 251 */
/***/ 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
- },
+ 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: {
- "drop": function($event) {
- $event.preventDefault();
- _vm.onDrop($event)
+ "mouseenter": function($event) {
+ _vm.clearTimer()
},
- "dragover": function($event) {
- $event.preventDefault();
- _vm.onDragover($event)
+ "mouseleave": function($event) {
+ _vm.startTimer()
},
- "dragleave": function($event) {
- $event.preventDefault();
- _vm.dragover = false
+ "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)
}
}
- }, [_vm._t("default")], 2)
+ })])])])
},staticRenderFns: []}
/***/ },
-/* 287 */
+/* 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__(288),
+ __webpack_require__(254),
/* template */
- null,
+ __webpack_require__(259),
/* styles */
null,
/* scopeId */
@@ -55939,260 +55072,308 @@ module.exports =
/***/ },
-/* 288 */
+/* 254 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _uploadDragger = __webpack_require__(284);
+ var _inputNumber = __webpack_require__(255);
- var _uploadDragger2 = _interopRequireDefault(_uploadDragger);
+ var _inputNumber2 = _interopRequireDefault(_inputNumber);
+
+ var _button = __webpack_require__(256);
+
+ var _button2 = _interopRequireDefault(_button);
+
+ var _emitter = __webpack_require__(15);
+
+ var _emitter2 = _interopRequireDefault(_emitter);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- components: {
- UploadDragger: _uploadDragger2.default
- },
+ name: 'ElSlider',
+
+ mixins: [_emitter2.default],
+
props: {
- type: String,
- data: {},
- action: {
- type: String,
- required: true
+ min: {
+ type: Number,
+ default: 0
},
- name: {
- type: String,
- default: 'file'
+ max: {
+ type: Number,
+ default: 100
},
- withCredentials: Boolean,
- accept: String,
- onStart: Function,
- onProgress: Function,
- onSuccess: Function,
- onError: Function,
- beforeUpload: Function,
- onPreview: {
- type: Function,
- default: function _default() {}
+ step: {
+ type: Number,
+ default: 1
},
- onRemove: {
- type: Function,
- default: function _default() {}
+ value: {
+ type: [Number, Array],
+ default: 0
},
- drag: Boolean,
- listType: String,
- disabled: Boolean
+ 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
+ },
+ debounce: {
+ type: Number,
+ default: 300
+ }
+ },
+
+ components: {
+ ElInputNumber: _inputNumber2.default,
+ SliderButton: _button2.default
},
data: function data() {
return {
- mouseover: false,
- domain: '',
- file: null,
- submitting: false
+ firstValue: null,
+ secondValue: null,
+ oldValue: null,
+ dragging: false,
+ sliderSize: 1
};
},
- methods: {
- isImage: function isImage(str) {
- return str.indexOf('image') !== -1;
- },
- handleClick: function handleClick() {
- if (!this.disabled) {
- this.$refs.input.click();
+ 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();
},
- handleChange: function handleChange(ev) {
- var file = ev.target.value;
- if (file) {
- this.uploadFiles(file);
+ dragging: function dragging(val) {
+ if (!val) {
+ this.setValues();
}
},
- 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);
+ firstValue: function firstValue(val) {
+ if (this.range) {
+ this.$emit('input', [this.minValue, this.maxValue]);
+ } else {
+ this.$emit('input', val);
}
- var inputs = [];
- for (var key in data) {
- if (data.hasOwnProperty(key)) {
- inputs.push('');
- }
+ },
+ secondValue: function secondValue() {
+ if (this.range) {
+ this.$emit('input', [this.minValue, this.maxValue]);
}
- dataSpan.innerHTML = inputs.join('');
- formNode.submit();
- dataSpan.innerHTML = '';
},
- getFormNode: function getFormNode() {
- return this.$refs.form;
+ min: function min() {
+ this.setValues();
},
- getFormDataNode: function getFormDataNode() {
- return this.$refs.data;
+ max: function max() {
+ this.setValues();
}
},
- 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;
+ methods: {
+ valueChanged: function valueChanged() {
+ var _this = this;
- return h(
- 'div',
- {
- 'class': oClass,
- on: {
- 'click': this.handleClick
- },
- nativeOn: {
- 'drop': this.onDrop,
- 'dragover': this.handleDragover,
- 'dragleave': this.handleDragleave
+ 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();
+ }
}
- },
- [h(
- 'iframe',
- {
- on: {
- 'load': this.onload
- },
-
- ref: 'iframe',
- attrs: { name: frameName
+ } 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;
}
- },
- []
- ), 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__(78);
-
-/***/ },
-/* 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
-
+ }
+ }
+ },
+ 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;
+ this.resetSize();
+ 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);
+ }
+ },
+ resetSize: function resetSize() {
+ if (this.$refs.slider) {
+ this.sliderSize = this.$refs.slider['client' + (this.vertical ? 'Height' : 'Width')];
+ }
+ }
+ },
-/***/ },
-/* 292 */
-/***/ function(module, exports) {
+ computed: {
+ stops: function stops() {
+ var _this2 = this;
- 'use strict';
+ 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
+ };
+ }
+ },
- exports.__esModule = true;
+ 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;
+ }
+ this.resetSize();
+ window.addEventListener('resize', this.resetSize);
+ },
+ beforeDestroy: function beforeDestroy() {
+ window.removeEventListener('resize', this.resetSize);
+ }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -56228,192 +55409,22 @@ module.exports =
//
//
//
-
- 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 */
+/* 255 */
/***/ 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;
+ module.exports = __webpack_require__(77);
/***/ },
-/* 295 */
+/* 256 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(296),
+ __webpack_require__(257),
/* template */
- __webpack_require__(297),
+ __webpack_require__(258),
/* styles */
null,
/* scopeId */
@@ -56426,180 +55437,462 @@ module.exports =
/***/ },
-/* 296 */
-/***/ function(module, 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: 'ElSpinner',
+ name: 'ElSliderButton',
+
+ components: {
+ ElTooltip: _tooltip2.default
+ },
+
props: {
- type: String,
- radius: {
- type: Number,
- default: 100
- },
- strokeWidth: {
+ value: {
type: Number,
- default: 5
+ default: 0
},
- strokeColor: {
- type: String,
- default: '#efefef'
+ vertical: {
+ type: Boolean,
+ default: false
}
- }
- };
-
-/***/ },
-/* 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'
- }),
+ 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();
+ this.$parent.resetSize();
+ 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 === null) return;
+ 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: {
- "viewBox": "0 0 50 50"
+ "placement": "top",
+ "disabled": !_vm.showTooltip
}
- }, [_c('circle', {
- staticClass: "path",
+ }, [_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: {
- "cx": "25",
- "cy": "25",
- "r": "20",
- "fill": "none",
- "stroke": _vm.strokeColor,
- "stroke-width": _vm.strokeWidth
+ "step": _vm.step,
+ "disabled": _vm.disabled,
+ "controls": _vm.showInputControls,
+ "min": _vm.min,
+ "max": _vm.max,
+ "debounce": _vm.debounce,
+ "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: []}
/***/ },
-/* 298 */
+/* 260 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(299);
+ var _directive = __webpack_require__(261);
- var _main2 = _interopRequireDefault(_main);
+ 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 = _main2.default;
+ exports.default = {
+ install: function install(Vue) {
+ Vue.use(_directive2.default);
+ Vue.prototype.$loading = _index2.default;
+ },
+
+ directive: _directive2.default,
+ service: _index2.default
+ };
/***/ },
-/* 299 */
+/* 261 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
- exports.__esModule = true;
-
var _vue = __webpack_require__(133);
var _vue2 = _interopRequireDefault(_vue);
- var _popup = __webpack_require__(14);
-
- var _vdom = __webpack_require__(194);
+ var _dom = __webpack_require__(44);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var MessageConstructor = _vue2.default.extend(__webpack_require__(300));
+ var Mask = _vue2.default.extend(__webpack_require__(262));
- var instance = void 0;
- var instances = [];
- var seed = 1;
+ 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 = (0, _dom.getStyle)(document.body, 'position');
+ el.originalOverflow = (0, _dom.getStyle)(document.body, 'overflow');
- 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++;
+ (0, _dom.addClass)(el.mask, 'is-fullscreen');
+ insertDom(document.body, el, binding);
+ } else {
+ (0, _dom.removeClass)(el.mask, 'is-fullscreen');
- 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;
- };
+ if (binding.modifiers.body) {
+ el.originalPosition = (0, _dom.getStyle)(document.body, 'position');
- ['success', 'warning', 'info', 'error'].forEach(function (type) {
- Message[type] = function (options) {
- if (typeof options === 'string') {
- options = {
- message: options
- };
+ ['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 = (0, _dom.getStyle)(el, '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;
+ }
}
- options.type = type;
- return Message(options);
};
- });
+ 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];
+ });
- 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]);
+ if (el.originalPosition !== 'absolute' && el.originalPosition !== 'fixed') {
+ parent.style.position = 'relative';
}
- instances.splice(i, 1);
- break;
+ 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;
}
- }
- };
+ };
- Message.closeAll = function () {
- for (var i = instances.length - 1; i >= 0; i--) {
- instances[i].close();
- }
- };
+ 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 = {};
- exports.default = Message;
+ 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);
+ }
+ }
+ }
+ });
+ };
/***/ },
-/* 300 */
+/* 262 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(301),
+ __webpack_require__(263),
/* template */
- __webpack_require__(307),
+ __webpack_require__(264),
/* styles */
null,
/* scopeId */
@@ -56612,8 +55905,8 @@ module.exports =
/***/ },
-/* 301 */
-/***/ function(module, exports, __webpack_require__) {
+/* 263 */
+/***/ function(module, exports) {
'use strict';
@@ -56634,129 +55927,39 @@ module.exports =
//
//
//
- //
exports.default = {
data: function data() {
return {
+ text: null,
+ fullscreen: true,
visible: false,
- message: '',
- duration: 3000,
- type: 'info',
- iconClass: '',
- customClass: '',
- onClose: null,
- showClose: false,
- closed: false,
- timer: null
+ customClass: ''
};
},
- computed: {
- typeImg: function typeImg() {
- return __webpack_require__(302)("./" + this.type + '.svg');
+ methods: {
+ handleAfterLeave: function handleAfterLeave() {
+ this.$emit('after-leave');
+ },
+ setText: function setText(text) {
+ this.text = text;
}
- },
+ }
+ };
- watch: {
- closed: function closed(newVal) {
- if (newVal) {
- this.visible = false;
- this.$el.addEventListener('transitionend', this.destroyElement);
- }
- }
- },
+/***/ },
+/* 264 */
+/***/ function(module, exports) {
- methods: {
- destroyElement: function destroyElement() {
- this.$el.removeEventListener('transitionend', this.destroyElement);
- this.$destroy(true);
- this.$el.parentNode.removeChild(this.$el);
+ 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"
},
- 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"
+ on: {
+ "after-leave": _vm.handleAfterLeave
}
}, [_c('div', {
directives: [{
@@ -56765,181 +55968,185 @@ module.exports =
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",
+ staticClass: "el-loading-mask",
+ class: [_vm.customClass, {
+ 'is-fullscreen': _vm.fullscreen
+ }]
+ }, [_c('div', {
+ staticClass: "el-loading-spinner"
+ }, [_c('svg', {
+ staticClass: "circular",
attrs: {
- "src": _vm.typeImg,
- "alt": ""
- }
- }) : _vm._e(), _c('div', {
- staticClass: "el-message__group",
- class: {
- 'is-with-icon': _vm.iconClass
+ "viewBox": "25 25 50 50"
}
- }, [_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
+ }, [_c('circle', {
+ staticClass: "path",
+ attrs: {
+ "cx": "50",
+ "cy": "50",
+ "r": "20",
+ "fill": "none"
}
- }) : _vm._e()], 2)])])
+ })]), (_vm.text) ? _c('p', {
+ staticClass: "el-loading-text"
+ }, [_vm._v(_vm._s(_vm.text))]) : _vm._e()])])])
},staticRenderFns: []}
/***/ },
-/* 308 */
+/* 265 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(309);
+ var _vue = __webpack_require__(133);
- var _main2 = _interopRequireDefault(_main);
+ var _vue2 = _interopRequireDefault(_vue);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _loading = __webpack_require__(262);
- /* istanbul ignore next */
- _main2.default.install = function (Vue) {
- Vue.component(_main2.default.name, _main2.default);
- };
+ var _loading2 = _interopRequireDefault(_loading);
- exports.default = _main2.default;
+ var _dom = __webpack_require__(44);
-/***/ },
-/* 309 */
-/***/ function(module, exports, __webpack_require__) {
+ var _merge = __webpack_require__(64);
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(310),
- /* template */
- __webpack_require__(311),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ var _merge2 = _interopRequireDefault(_merge);
- module.exports = Component.exports
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var LoadingConstructor = _vue2.default.extend(_loading2.default);
-/***/ },
-/* 310 */
-/***/ function(module, exports) {
+ var defaults = {
+ text: null,
+ fullscreen: true,
+ body: false,
+ lock: false,
+ customClass: ''
+ };
- 'use strict';
+ var fullscreenLoading = void 0;
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ LoadingConstructor.prototype.originalPosition = '';
+ LoadingConstructor.prototype.originalOverflow = '';
- exports.default = {
- name: 'ElBadge',
+ LoadingConstructor.prototype.close = function () {
+ var _this = this;
- props: {
- value: {},
- max: Number,
- isDot: Boolean,
- hidden: Boolean
- },
+ 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;
+ };
- computed: {
- content: function content() {
- if (this.isDot) return;
+ var addStyle = function addStyle(options, parent, instance) {
+ var maskStyle = {};
+ if (options.fullscreen) {
+ instance.originalPosition = (0, _dom.getStyle)(document.body, 'position');
+ instance.originalOverflow = (0, _dom.getStyle)(document.body, 'overflow');
+ } else if (options.body) {
+ instance.originalPosition = (0, _dom.getStyle)(document.body, '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 = (0, _dom.getStyle)(parent, 'position');
+ }
+ Object.keys(maskStyle).forEach(function (property) {
+ instance.$el.style[property] = maskStyle[property];
+ });
+ };
- var value = this.value;
- var max = this.max;
+ var Loading = function Loading() {
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- if (typeof value === 'number' && typeof max === 'number') {
- return max < value ? max + '+' : value;
- }
+ 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;
+ }
- return value;
- }
+ 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' && instance.originalPosition !== 'fixed') {
+ 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;
};
-/***/ },
-/* 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: []}
+ exports.default = Loading;
/***/ },
-/* 312 */
+/* 266 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(313);
+ var _icon = __webpack_require__(267);
- var _main2 = _interopRequireDefault(_main);
+ var _icon2 = _interopRequireDefault(_icon);
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);
+ _icon2.default.install = function (Vue) {
+ Vue.component(_icon2.default.name, _icon2.default);
};
- exports.default = _main2.default;
+ exports.default = _icon2.default;
/***/ },
-/* 313 */
+/* 267 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(314),
+ __webpack_require__(268),
/* template */
- __webpack_require__(315),
+ __webpack_require__(269),
/* styles */
null,
/* scopeId */
@@ -56952,7 +56159,7 @@ module.exports =
/***/ },
-/* 314 */
+/* 268 */
/***/ function(module, exports) {
'use strict';
@@ -56962,418 +56169,224 @@ module.exports =
//
//
//
- //
- //
- //
- //
- //
- //
- //
exports.default = {
- name: 'ElCard',
+ name: 'ElIcon',
- props: ['header', 'bodyStyle']
+ props: {
+ name: String
+ }
};
/***/ },
-/* 315 */
+/* 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-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)])
+ return _c('i', {
+ class: 'el-icon-' + _vm.name
+ })
},staticRenderFns: []}
/***/ },
-/* 316 */
+/* 270 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(317);
+ var _row = __webpack_require__(271);
- var _main2 = _interopRequireDefault(_main);
+ var _row2 = _interopRequireDefault(_row);
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);
+ _row2.default.install = function (Vue) {
+ Vue.component(_row2.default.name, _row2.default);
};
- exports.default = _main2.default;
+ exports.default = _row2.default;
/***/ },
-/* 317 */
-/***/ function(module, exports, __webpack_require__) {
+/* 271 */
+/***/ function(module, exports) {
- var Component = __webpack_require__(5)(
- /* script */
- __webpack_require__(318),
- /* template */
- __webpack_require__(319),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ 'use strict';
- module.exports = Component.exports
+ 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);
+ }
+ };
/***/ },
-/* 318 */
+/* 272 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _dom = __webpack_require__(44);
+ var _col = __webpack_require__(273);
- exports.default = {
- name: 'ElRate',
+ var _col2 = _interopRequireDefault(_col);
- data: function data() {
- return {
- classMap: {},
- colorMap: {},
- pointerAtLeftHalf: true,
- currentValue: this.value,
- hoverIndex: -1
- };
- },
+ 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: {
- value: {
- type: Number,
- default: 0
- },
- lowThreshold: {
- type: Number,
- default: 2
- },
- highThreshold: {
- type: Number,
- default: 4
- },
- max: {
+ span: {
type: Number,
- default: 5
- },
- colors: {
- type: Array,
- default: function _default() {
- return ['#F7BA2A', '#F7BA2A', '#F7BA2A'];
- }
- },
- voidColor: {
- type: String,
- default: '#C6D1DE'
+ default: 24
},
- disabledVoidColor: {
+ tag: {
type: String,
- default: '#EFF2F7'
+ default: 'div'
},
- iconClasses: {
- type: Array,
- default: function _default() {
- return ['el-icon-star-on', 'el-icon-star-on', 'el-icon-star-on'];
+ 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;
}
- },
- 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}'
+ return parent ? parent.gutter : 0;
}
},
+ render: function render(h) {
+ var _this = this;
- 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;
- }
- },
+ var classList = [];
+ var style = {};
- watch: {
- value: function value(val) {
- this.$emit('change', val);
- this.currentValue = val;
- this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
+ if (this.gutter) {
+ style.paddingLeft = this.gutter / 2 + 'px';
+ style.paddingRight = style.paddingLeft;
}
- },
- 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;
+ ['span', 'offset', 'pull', 'push'].forEach(function (prop) {
+ if (_this[prop]) {
+ classList.push(prop !== 'span' ? 'el-col-' + prop + '-' + _this[prop] : 'el-col-' + _this[prop]);
}
- if (this.allowHalf) {
- this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
+ });
+
+ ['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]);
+ });
+ })();
}
- 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
- };
+ return h(this.tag, {
+ class: ['el-col', classList],
+ style: style
+ }, this.$slots.default);
}
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
-
-/***/ },
-/* 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 */
+/* 274 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _steps = __webpack_require__(321);
+ var _src = __webpack_require__(275);
- var _steps2 = _interopRequireDefault(_steps);
+ var _src2 = _interopRequireDefault(_src);
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);
+ _src2.default.install = function (Vue) {
+ Vue.component(_src2.default.name, _src2.default);
};
- exports.default = _steps2.default;
+ exports.default = _src2.default;
/***/ },
-/* 321 */
+/* 275 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(322),
+ __webpack_require__(276),
/* template */
- __webpack_require__(323),
+ null,
/* styles */
null,
/* scopeId */
@@ -57386,114 +56399,319 @@ module.exports =
/***/ },
-/* 322 */
-/***/ function(module, 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: 'ElSteps',
+ name: 'ElUpload',
+
+ mixins: [_migrating2.default],
+
+ components: {
+ ElProgress: _progress2.default,
+ UploadList: _uploadList2.default,
+ Upload: _upload2.default,
+ IframeUpload: _iframeUpload2.default
+ },
+
+ provide: {
+ uploader: undefined
+ },
props: {
- space: [Number, String],
- active: Number,
- direction: {
+ action: {
type: String,
- default: 'horizontal'
+ required: true
},
- alignCenter: Boolean,
- center: Boolean,
- finishStatus: {
+ headers: {
+ type: Object,
+ default: function _default() {
+ return {};
+ }
+ },
+ data: Object,
+ multiple: Boolean,
+ name: {
type: String,
- default: 'finish'
+ default: 'file'
},
- processStatus: {
+ drag: Boolean,
+ dragger: Boolean,
+ withCredentials: Boolean,
+ showFileList: {
+ type: Boolean,
+ default: true
+ },
+ accept: String,
+ type: {
type: String,
- default: 'process'
- }
+ 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 {
- steps: [],
- stepOffset: 0
+ uploadFiles: [],
+ dragOver: false,
+ draging: false,
+ tempIndex: 1
};
},
watch: {
- active: function active(newVal, oldVal) {
- this.$emit('change', newVal, oldVal);
- },
- steps: function steps(_steps) {
- var _this = this;
+ fileList: {
+ immediate: true,
+ handler: function handler(fileList) {
+ 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);
- });
- })();
+ this.uploadFiles = fileList.map(function (item) {
+ item.uid = item.uid || Date.now() + _this.tempIndex++;
+ item.status = 'success';
+ return item;
+ });
}
}
- }
- };
-
-/***/ },
-/* 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';
+ 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
+ };
- exports.__esModule = true;
+ try {
+ file.url = URL.createObjectURL(rawFile);
+ } catch (err) {
+ console.error(err);
+ return;
+ }
- var _step = __webpack_require__(325);
+ 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);
- var _step2 = _interopRequireDefault(_step);
+ if (file) {
+ file.status = 'success';
+ file.response = res;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ 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;
- /* istanbul ignore next */
- _step2.default.install = function (Vue) {
- Vue.component(_step2.default.name, _step2.default);
- };
+ file.status = 'fail';
- exports.default = _step2.default;
+ fileList.splice(fileList.indexOf(file), 1);
-/***/ },
-/* 325 */
-/***/ function(module, exports, __webpack_require__) {
+ 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__(326),
+ __webpack_require__(278),
/* template */
- __webpack_require__(327),
+ __webpack_require__(280),
/* styles */
null,
/* scopeId */
@@ -57506,12 +56724,33 @@ module.exports =
/***/ },
-/* 326 */
-/***/ function(module, 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 }; }
+
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -57560,197 +56799,129 @@ module.exports =
//
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);
- }
- },
+ mixins: [_locale2.default],
+ components: { ElProgress: _progress2.default },
- computed: {
- currentStatus: function currentStatus() {
- return this.status || this.internalStatus;
- },
- prevStatus: function prevStatus() {
- var prevStep = this.$parent.steps[this.index - 1];
- return prevStep ? prevStep.currentStatus : 'wait';
+ props: {
+ files: {
+ type: Array,
+ default: function _default() {
+ return [];
+ }
},
-
- isLast: function isLast() {
- var parent = this.$parent;
- return parent.steps[parent.steps.length - 1] === this;
+ disabled: {
+ type: Boolean,
+ default: false
},
- 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 };
- }
- }
- }
+ handlePreview: Function,
+ listType: String
},
-
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.prevStatus !== 'error') {
- this.internalStatus = this.$parent.processStatus;
- } else {
- this.internalStatus = 'wait';
- }
-
- if (prevChild) prevChild.calcProgress(this.internalStatus);
+ parsePercentage: function parsePercentage(val) {
+ return parseInt(val, 10);
},
- calcProgress: function calcProgress(status) {
- var step = 100;
- var style = {};
-
- style.transitionDelay = 150 * this.index + 'ms';
- if (status === this.$parent.processStatus) {
- step = this.currentStatus !== 'error' ? 50 : 0;
- } 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';
- }
+ handleClick: function handleClick(file) {
+ this.handlePreview && this.handlePreview(file);
}
-
- var unwatch = this.$watch('index', function (val) {
- _this.$watch('$parent.active', _this.updateStatus, { immediate: true });
- unwatch();
- });
}
};
/***/ },
-/* 327 */
+/* 279 */
/***/ 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: []}
+ module.exports = __webpack_require__(78);
/***/ },
-/* 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);
- };
+/* 280 */
+/***/ function(module, exports) {
- exports.default = _main2.default;
+ 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: []}
/***/ },
-/* 329 */
+/* 281 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(330),
+ __webpack_require__(282),
/* template */
- __webpack_require__(331),
+ null,
/* styles */
null,
/* scopeId */
@@ -57763,725 +56934,672 @@ module.exports =
/***/ },
-/* 330 */
+/* 282 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _throttle = __webpack_require__(131);
+ var _ajax = __webpack_require__(283);
- var _throttle2 = _interopRequireDefault(_throttle);
+ var _ajax2 = _interopRequireDefault(_ajax);
- var _resizeEvent = __webpack_require__(110);
+ var _uploadDragger = __webpack_require__(284);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var _uploadDragger2 = _interopRequireDefault(_uploadDragger);
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- name: 'ElCarousel',
-
+ inject: ['uploader'],
+ components: {
+ UploadDragger: _uploadDragger2.default
+ },
props: {
- initialIndex: {
- type: Number,
- default: 0
- },
- height: String,
- trigger: {
+ type: String,
+ action: {
type: String,
- default: 'hover'
- },
- autoplay: {
- type: Boolean,
- default: true
- },
- interval: {
- type: Number,
- default: 3000
- },
- indicatorPosition: String,
- indicator: {
- type: Boolean,
- default: true
+ required: true
},
- arrow: {
+ name: {
type: String,
- default: 'hover'
+ default: 'file'
},
- type: String
- },
-
- data: function data() {
- return {
- items: [],
- activeIndex: -1,
- containerWidth: 0,
- timer: null,
- hover: false
- };
+ 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
},
-
- computed: {
- hasLabel: function hasLabel() {
- return this.items.some(function (item) {
- return item.label.toString().length > 0;
- });
- }
+ data: function data() {
+ return {
+ mouseover: false,
+ reqs: {}
+ };
},
- watch: {
- items: function items(val) {
- if (val.length > 0) this.setActiveItem(this.initialIndex);
- },
- activeIndex: function activeIndex(val, oldVal) {
- this.resetItemPosition(oldVal);
- 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();
+ isImage: function isImage(str) {
+ return str.indexOf('image') !== -1;
},
- 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;
+ handleChange: function handleChange(ev) {
+ var files = ev.target.files;
+
+ if (!files) return;
+ this.uploadFiles(files);
},
- handleButtonEnter: function handleButtonEnter(arrow) {
+ uploadFiles: function uploadFiles(files) {
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';
+ 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);
});
},
- resetItemPosition: function resetItemPosition(oldIndex) {
+ upload: function upload(rawFile, file) {
var _this2 = this;
- this.items.forEach(function (item, index) {
- item.translateItem(index, _this2.activeIndex, oldIndex);
- });
- },
- playSlides: function playSlides() {
- if (this.activeIndex < this.items.length - 1) {
- this.activeIndex++;
+ 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.activeIndex = 0;
+ this.onRemove(rawFile, true);
}
},
- 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]);
+ 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();
}
- }
- 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;
+ Object.keys(reqs).forEach(function (uid) {
+ if (reqs[uid]) reqs[uid].abort();
+ delete reqs[uid];
+ });
}
},
- 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;
+ post: function post(rawFile) {
+ 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;
+ var uid = rawFile.uid;
- 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;
+ 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);
}
- _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)
+ handleClick: function handleClick() {
+ if (!this.disabled) {
+ this.$refs.input.value = null;
+ this.$refs.input.click();
}
}
- }, [_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",
+ },
+
+ 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: {
- 'is-active': index === _vm.activeIndex
+ 'el-upload': true
},
on: {
- "mouseenter": function($event) {
- _vm.throttledIndicatorHover(index)
- },
- "click": function($event) {
- $event.stopPropagation();
- _vm.handleIndicatorClick(index)
- }
+ click: handleClick
}
- }, [_c('button', {
- staticClass: "el-carousel__button"
- }, [(_vm.hasLabel) ? _c('span', [_vm._v(_vm._s(item.label))]) : _vm._e()])])
- })) : _vm._e()])
- },staticRenderFns: []}
+ };
+ 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
+ }
+ },
+ []
+ )]
+ );
+ }
+ };
/***/ },
-/* 332 */
-/***/ function(module, exports, __webpack_require__) {
+/* 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 _main = __webpack_require__(333);
-
- var _main2 = _interopRequireDefault(_main);
+ var err = new Error(msg);
+ err.status = xhr.status;
+ err.method = 'post';
+ err.url = action;
+ return err;
+ }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ function getBody(xhr) {
+ var text = xhr.responseText || xhr.response;
+ if (!text) {
+ return text;
+ }
- /* istanbul ignore next */
- _main2.default.install = function (Vue) {
- Vue.component(_main2.default.name, _main2.default);
- };
+ try {
+ return JSON.parse(text);
+ } catch (e) {
+ return text;
+ }
+ }
- exports.default = _main2.default;
+ function upload(option) {
+ if (typeof XMLHttpRequest === 'undefined') {
+ return;
+ }
-/***/ },
-/* 333 */
-/***/ function(module, exports, __webpack_require__) {
+ var xhr = new XMLHttpRequest();
+ var action = option.action;
- 'use strict';
+ if (xhr.upload) {
+ xhr.upload.onprogress = function progress(e) {
+ if (e.total > 0) {
+ e.percent = e.loaded / e.total * 100;
+ }
+ option.onProgress(e);
+ };
+ }
- exports.__esModule = true;
+ var formData = new FormData();
- var _resizeEvent = __webpack_require__(110);
+ if (option.data) {
+ Object.keys(option.data).map(function (key) {
+ formData.append(key, option.data[key]);
+ });
+ }
- var _scrollbarWidth = __webpack_require__(136);
+ formData.append(option.filename, option.file);
- var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
+ xhr.onerror = function error(e) {
+ option.onError(e);
+ };
- var _util = __webpack_require__(107);
+ xhr.onload = function onload() {
+ if (xhr.status < 200 || xhr.status >= 300) {
+ return option.onError(getError(action, option, xhr));
+ }
- var _bar = __webpack_require__(334);
+ option.onSuccess(getBody(xhr));
+ };
- var _bar2 = _interopRequireDefault(_bar);
+ xhr.open('post', action, true);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ if (option.withCredentials && 'withCredentials' in xhr) {
+ xhr.withCredentials = true;
+ }
- /* istanbul ignore next */
- // reference https://github.com/noeldelgado/gemini-scrollbar/blob/master/index.js
+ var headers = option.headers || {};
- exports.default = {
- name: 'ElScrollbar',
+ for (var item in headers) {
+ if (headers.hasOwnProperty(item) && headers[item] !== null) {
+ xhr.setRequestHeader(item, headers[item]);
+ }
+ }
+ xhr.send(formData);
+ return xhr;
+ }
- components: { Bar: _bar2.default },
+/***/ },
+/* 284 */
+/***/ function(module, exports, __webpack_require__) {
- props: {
- native: Boolean,
- wrapStyle: {},
- wrapClass: {},
- viewClass: {},
- viewStyle: {},
- noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能
- tag: {
- type: String,
- default: 'div'
- }
- },
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(285),
+ /* template */
+ __webpack_require__(286),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- data: function data() {
- return {
- sizeWidth: '0',
- sizeHeight: '0',
- moveX: 0,
- moveY: 0
- };
- },
+ module.exports = Component.exports
- computed: {
- wrap: function wrap() {
- return this.$refs.wrap;
- }
- },
+/***/ },
+/* 285 */
+/***/ function(module, exports) {
- render: function render(h) {
- var gutter = (0, _scrollbarWidth2.default)();
- var style = this.wrapStyle;
+ 'use strict';
- if (gutter) {
- var gutterWith = '-' + gutter + 'px';
- var gutterStyle = 'margin-bottom: ' + gutterWith + '; margin-right: ' + gutterWith + ';';
+ exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- 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;
+ 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);
}
}
- 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;
+/***/ },
+/* 286 */
+/***/ function(module, exports) {
- 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]]
- )];
+ 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
+ }
}
- return h('div', { class: 'el-scrollbar' }, nodes);
- },
-
-
- methods: {
- handleScroll: function handleScroll() {
- var wrap = this.wrap;
+ }, [_vm._t("default")], 2)
+ },staticRenderFns: []}
- 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;
+/***/ },
+/* 287 */
+/***/ function(module, exports, __webpack_require__) {
- heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
- widthPercentage = wrap.clientWidth * 100 / wrap.scrollWidth;
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(288),
+ /* template */
+ null,
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : '';
- this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : '';
- }
- },
+ module.exports = Component.exports
- 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 */
+/* 288 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _dom = __webpack_require__(44);
+ var _uploadDragger = __webpack_require__(284);
- var _util = __webpack_require__(335);
+ var _uploadDragger2 = _interopRequireDefault(_uploadDragger);
- /* istanbul ignore next */
- exports.default = {
- name: 'Bar',
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ exports.default = {
+ components: {
+ UploadDragger: _uploadDragger2.default
+ },
props: {
- vertical: Boolean,
- size: String,
- move: Number
+ 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
},
- computed: {
- bar: function bar() {
- return _util.BAR_MAP[this.vertical ? 'vertical' : 'horizontal'];
+ data: function data() {
+ return {
+ mouseover: false,
+ domain: '',
+ file: null,
+ submitting: false
+ };
+ },
+
+
+ methods: {
+ isImage: function isImage(str) {
+ return str.indexOf('image') !== -1;
},
- wrap: function wrap() {
- return this.$parent.wrap;
+ 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('');
+ }
+ }
+ 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 size = this.size,
- move = this.move,
- bar = this.bar;
+ 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': ['el-scrollbar__bar', 'is-' + bar.key],
+ 'class': oClass,
on: {
- 'mousedown': this.clickTrackHandler
+ 'click': this.handleClick
+ },
+ nativeOn: {
+ 'drop': this.onDrop,
+ 'dragover': this.handleDragover,
+ 'dragleave': this.handleDragleave
}
},
[h(
- 'div',
+ 'iframe',
{
- ref: 'thumb',
- 'class': 'el-scrollbar__thumb',
on: {
- 'mousedown': this.clickThumbHandler
+ 'load': this.onload
},
- style: (0, _util.renderThumbStyle)({ size: size, move: move, bar: bar }) },
+ ref: 'iframe',
+ attrs: { name: frameName
+ }
+ },
[]
- )]
- );
- },
-
-
- 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];
+ ), 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',
- 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;
- }
- },
+ name: 'file',
- destroyed: function destroyed() {
- (0, _dom.off)(document, 'mouseup', this.mouseUpDocumentHandler);
+ 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]
+ );
}
};
/***/ },
-/* 335 */
+/* 289 */
/***/ 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;
- };
+ module.exports = __webpack_require__(79);
/***/ },
-/* 336 */
+/* 290 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _item = __webpack_require__(337);
+ var _progress = __webpack_require__(291);
- var _item2 = _interopRequireDefault(_item);
+ var _progress2 = _interopRequireDefault(_progress);
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);
+ _progress2.default.install = function (Vue) {
+ Vue.component(_progress2.default.name, _progress2.default);
};
- exports.default = _item2.default;
+ exports.default = _progress2.default;
/***/ },
-/* 337 */
+/* 291 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(338),
+ __webpack_require__(292),
/* template */
- __webpack_require__(339),
+ __webpack_require__(293),
/* styles */
null,
/* scopeId */
@@ -58494,7 +57612,7 @@ module.exports =
/***/ },
-/* 338 */
+/* 292 */
/***/ function(module, exports) {
'use strict';
@@ -58526,160 +57644,201 @@ module.exports =
//
//
//
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- var CARD_SCALE = 0.83;
exports.default = {
- name: 'ElCarouselItem',
-
+ name: 'ElProgress',
props: {
- name: String,
- label: {
- type: [String, Number],
- default: ''
- }
- },
-
- data: function data() {
- return {
- hover: false,
- translate: 0,
- scale: 1,
- active: false,
- ready: false,
- inStage: false,
- animating: 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;
+ type: {
+ type: String,
+ default: 'line',
+ validator: function validator(val) {
+ return ['line', 'circle'].indexOf(val) > -1;
}
- 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;
+ percentage: {
+ type: Number,
+ default: 0,
+ required: true,
+ validator: function validator(val) {
+ return val >= 0 && val <= 100;
}
},
- translateItem: function translateItem(index, activeIndex, oldIndex) {
- var parentWidth = this.$parent.$el.offsetWidth;
- var length = this.$parent.items.length;
- if (this.$parent.type !== 'card' && oldIndex !== undefined) {
- this.animating = index === activeIndex || index === oldIndex;
- }
- if (index !== activeIndex && length > 2) {
- index = this.processIndex(index, activeIndex, length);
+ 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';
}
- 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;
+ return ret;
+ },
+ iconClass: function iconClass() {
+ if (this.type === 'line') {
+ return this.status === 'success' ? 'el-icon-circle-check' : 'el-icon-circle-cross';
} else {
- this.active = index === activeIndex;
- this.translate = parentWidth * (index - activeIndex);
+ return this.status === 'success' ? 'el-icon-check' : 'el-icon-close';
}
- this.ready = true;
},
- handleItemClick: function handleItemClick() {
- var parent = this.$parent;
- if (parent && parent.type === 'card') {
- var index = parent.items.indexOf(this);
- parent.setActiveItem(index);
- }
+ progressTextSize: function progressTextSize() {
+ return this.type === 'line' ? 12 + this.strokeWidth * 0.4 : this.width * 0.111111 + 2;
}
- },
-
- created: function created() {
- this.$parent && this.$parent.updateItems();
- },
- destroyed: function destroyed() {
- this.$parent && this.$parent.updateItems();
}
};
/***/ },
-/* 339 */
+/* 293 */
/***/ 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,
- 'is-animating': _vm.animating
- },
+ 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: ({
- 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
+ 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"
}
- }, [(_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)
+ }, [_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: []}
/***/ },
-/* 340 */
+/* 294 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _collapse = __webpack_require__(341);
+ var _spinner = __webpack_require__(295);
- var _collapse2 = _interopRequireDefault(_collapse);
+ var _spinner2 = _interopRequireDefault(_spinner);
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);
+ _spinner2.default.install = function (Vue) {
+ Vue.component(_spinner2.default.name, _spinner2.default);
};
- exports.default = _collapse2.default;
+ exports.default = _spinner2.default;
/***/ },
-/* 341 */
+/* 295 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(342),
+ __webpack_require__(296),
/* template */
- __webpack_require__(343),
+ __webpack_require__(297),
/* styles */
null,
/* scopeId */
@@ -58692,7 +57851,7 @@ module.exports =
/***/ },
-/* 342 */
+/* 296 */
/***/ function(module, exports) {
'use strict';
@@ -58703,105 +57862,169 @@ module.exports =
//
//
//
+ //
+ //
exports.default = {
- name: 'ElCollapse',
-
- componentName: 'ElCollapse',
-
+ name: 'ElSpinner',
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);
+ type: String,
+ radius: {
+ type: Number,
+ default: 100
},
- 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);
- }
+ strokeWidth: {
+ type: Number,
+ default: 5
+ },
+ strokeColor: {
+ type: String,
+ default: '#efefef'
}
- },
-
- created: function created() {
- this.$on('item-click', this.handleItemClick);
}
};
/***/ },
-/* 343 */
+/* 297 */
/***/ 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)
+ 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: []}
/***/ },
-/* 344 */
+/* 298 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _collapseItem = __webpack_require__(345);
+ var _main = __webpack_require__(299);
- var _collapseItem2 = _interopRequireDefault(_collapseItem);
+ var _main2 = _interopRequireDefault(_main);
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 = _main2.default;
+
+/***/ },
+/* 299 */
+/***/ function(module, exports, __webpack_require__) {
+
+ 'use strict';
+
+ exports.__esModule = true;
+
+ var _vue = __webpack_require__(133);
+
+ 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;
};
- exports.default = _collapseItem2.default;
+ ['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;
/***/ },
-/* 345 */
+/* 300 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(346),
+ __webpack_require__(301),
/* template */
- __webpack_require__(347),
+ __webpack_require__(307),
/* styles */
null,
/* scopeId */
@@ -58814,23 +58037,14 @@ module.exports =
/***/ },
-/* 346 */
+/* 301 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
-
- var _collapseTransition = __webpack_require__(49);
-
- var _collapseTransition2 = _interopRequireDefault(_collapseTransition);
-
- var _emitter = __webpack_require__(15);
-
- var _emitter2 = _interopRequireDefault(_emitter);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
+ //
+ //
//
//
//
@@ -58848,93 +58062,171 @@ module.exports =
//
exports.default = {
- name: 'ElCollapseItem',
-
- componentName: 'ElCollapseItem',
-
- mixins: [_emitter2.default],
-
- components: { ElCollapseTransition: _collapseTransition2.default },
-
data: function data() {
return {
- contentWrapStyle: {
- height: 'auto',
- display: 'block'
- },
- contentHeight: 0
+ visible: false,
+ message: '',
+ duration: 3000,
+ type: 'info',
+ iconClass: '',
+ customClass: '',
+ onClose: null,
+ showClose: false,
+ closed: false,
+ timer: null
};
},
- 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;
+ typeImg: function typeImg() {
+ return __webpack_require__(302)("./" + this.type + '.svg');
}
},
watch: {
- 'isActive': function isActive(value) {}
+ closed: function closed(newVal) {
+ if (newVal) {
+ this.visible = false;
+ this.$el.addEventListener('transitionend', this.destroyElement);
+ }
+ }
},
methods: {
- handleHeaderClick: function handleHeaderClick() {
- this.dispatch('ElCollapse', 'item-click', this);
+ 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() {}
+ mounted: function mounted() {
+ this.startTimer();
+ }
};
/***/ },
-/* 347 */
-/***/ function(module, exports) {
+/* 302 */
+/***/ function(module, exports, __webpack_require__) {
- 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
+ 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', {
- 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"
+ value: (_vm.visible),
+ expression: "visible"
}],
- staticClass: "el-collapse-item__wrap"
- }, [_c('div', {
- staticClass: "el-collapse-item__content"
- }, [_vm._t("default")], 2)])])], 1)
+ 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: []}
/***/ },
-/* 348 */
+/* 308 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(349);
+ var _main = __webpack_require__(309);
var _main2 = _interopRequireDefault(_main);
@@ -58948,14 +58240,14 @@ module.exports =
exports.default = _main2.default;
/***/ },
-/* 349 */
+/* 309 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(350),
+ __webpack_require__(310),
/* template */
- __webpack_require__(355),
+ __webpack_require__(311),
/* styles */
null,
/* scopeId */
@@ -58968,107 +58260,129 @@ module.exports =
/***/ },
-/* 350 */
-/***/ function(module, exports, __webpack_require__) {
+/* 310 */
+/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- var _vue = __webpack_require__(133);
+ exports.default = {
+ name: 'ElBadge',
- var _vue2 = _interopRequireDefault(_vue);
+ props: {
+ value: {},
+ max: Number,
+ isDot: Boolean,
+ hidden: Boolean
+ },
- var _menu = __webpack_require__(351);
+ computed: {
+ content: function content() {
+ if (this.isDot) return;
- var _menu2 = _interopRequireDefault(_menu);
+ var value = this.value;
+ var max = this.max;
- var _input = __webpack_require__(20);
+ if (typeof value === 'number' && typeof max === 'number') {
+ return max < value ? max + '+' : value;
+ }
- var _input2 = _interopRequireDefault(_input);
+ return value;
+ }
+ }
+ };
- var _vuePopper = __webpack_require__(24);
+/***/ },
+/* 311 */
+/***/ function(module, exports) {
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+ 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: []}
- var _clickoutside = __webpack_require__(21);
+/***/ },
+/* 312 */
+/***/ function(module, exports, __webpack_require__) {
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ 'use strict';
- var _emitter = __webpack_require__(15);
+ exports.__esModule = true;
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _main = __webpack_require__(313);
- var _locale = __webpack_require__(10);
+ var _main2 = _interopRequireDefault(_main);
- var _locale2 = _interopRequireDefault(_locale);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _locale3 = __webpack_require__(111);
+ /* istanbul ignore next */
+ _main2.default.install = function (Vue) {
+ Vue.component(_main2.default.name, _main2.default);
+ };
- var _debounce = __webpack_require__(69);
+ exports.default = _main2.default;
- var _debounce2 = _interopRequireDefault(_debounce);
+/***/ },
+/* 313 */
+/***/ function(module, exports, __webpack_require__) {
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(314),
+ /* template */
+ __webpack_require__(315),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- 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
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ module.exports = Component.exports
+
+
+/***/ },
+/* 314 */
+/***/ function(module, exports) {
+
+ 'use strict';
+
+ exports.__esModule = true;
//
//
//
@@ -59082,325 +58396,409 @@ module.exports =
//
exports.default = {
- name: 'ElCascader',
+ name: 'ElCard',
- directives: { Clickoutside: _clickoutside2.default },
+ props: ['header', 'bodyStyle']
+ };
- mixins: [popperMixin, _emitter2.default, _locale2.default],
+/***/ },
+/* 315 */
+/***/ function(module, exports) {
- components: {
- ElInput: _input2.default
+ 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__(44);
+
+ exports.default = {
+ name: 'ElRate',
+
+ data: function data() {
+ return {
+ classMap: {},
+ colorMap: {},
+ pointerAtLeftHalf: true,
+ currentValue: this.value,
+ hoverIndex: -1
+ };
},
+
props: {
- options: {
- type: Array,
- required: true
+ value: {
+ type: Number,
+ default: 0
},
- props: {
- type: Object,
- default: function _default() {
- return {
- children: 'children',
- label: 'label',
- value: 'value',
- disabled: 'disabled'
- };
- }
+ lowThreshold: {
+ type: Number,
+ default: 2
},
- value: {
+ highThreshold: {
+ type: Number,
+ default: 4
+ },
+ max: {
+ type: Number,
+ default: 5
+ },
+ colors: {
type: Array,
default: function _default() {
- return [];
+ return ['#F7BA2A', '#F7BA2A', '#F7BA2A'];
}
},
- placeholder: {
+ voidColor: {
+ type: String,
+ default: '#C6D1DE'
+ },
+ disabledVoidColor: {
type: String,
+ default: '#EFF2F7'
+ },
+ iconClasses: {
+ type: Array,
default: function _default() {
- return (0, _locale3.t)('el.cascader.placeholder');
+ return ['el-icon-star-on', 'el-icon-star-on', 'el-icon-star-on'];
}
},
- disabled: Boolean,
- clearable: {
+ voidIconClass: {
+ type: String,
+ default: 'el-icon-star-off'
+ },
+ disabledVoidIconClass: {
+ type: String,
+ default: 'el-icon-star-on'
+ },
+ disabled: {
type: Boolean,
default: false
},
- changeOnSelect: Boolean,
- popperClass: String,
- expandTrigger: {
- type: String,
- default: 'click'
+ allowHalf: {
+ type: Boolean,
+ default: false
},
- filterable: Boolean,
- size: String,
- showAllLevels: {
+ showText: {
type: Boolean,
- default: true
+ default: false
},
- debounce: {
- type: Number,
- default: 300
+ textColor: {
+ type: String,
+ default: '#1f2d3d'
},
- beforeFilter: {
- type: Function,
+ texts: {
+ type: Array,
default: function _default() {
- return function () {};
+ return ['极差', '失望', '一般', '满意', '惊喜'];
}
+ },
+ textTemplate: {
+ type: String,
+ default: '{value}'
}
},
- 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';
+ 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;
},
- valueKey: function valueKey() {
- return this.props.value || 'value';
+ 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
+ };
},
- childrenKey: function childrenKey() {
- return this.props.children || 'children';
+ valueDecimal: function valueDecimal() {
+ return this.value * 100 - Math.floor(this.value) * 100;
},
- 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();
+ decimalIconClass: function decimalIconClass() {
+ return this.getValueFromMap(this.value, this.classMap);
},
- value: function value(_value) {
- this.currentValue = _value;
+ voidClass: function voidClass() {
+ return this.disabled ? this.classMap.disabledVoidClass : this.classMap.voidClass;
},
- currentValue: function currentValue(value) {
- this.dispatch('ElFormItem', 'el.form.change', [value]);
+ activeClass: function activeClass() {
+ return this.getValueFromMap(this.currentValue, this.classMap);
},
-
- options: {
- deep: true,
- handler: function handler(value) {
- if (!this.menu) {
- this.initMenu();
- }
- this.flatOptions = this.flattenOptions(this.options);
- this.menu.options = value;
+ 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;
}
},
- 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;
+ watch: {
+ value: function value(val) {
+ this.$emit('change', val);
+ this.currentValue = val;
+ this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
+ }
+ },
- if (!this.menu) {
- this.initMenu();
+ 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;
}
-
- 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;
- });
+ return result;
},
- hideMenu: function hideMenu() {
- this.inputValue = '';
- this.menu.visible = false;
+ 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;
},
- handleActiveItemChange: function handleActiveItemChange(value) {
- var _this3 = this;
-
- this.$nextTick(function (_) {
- _this3.updatePopper();
- });
- this.$emit('active-item-change', value);
+ getIconStyle: function getIconStyle(item) {
+ var voidColor = this.disabled ? this.colorMap.disabledVoidColor : this.colorMap.voidColor;
+ return {
+ color: item <= this.currentValue ? this.activeColor : voidColor
+ };
},
- 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;
+ selectValue: function selectValue(value) {
+ if (this.disabled) {
+ return;
+ }
+ if (this.allowHalf && this.pointerAtLeftHalf) {
+ this.$emit('input', this.currentValue);
} else {
- this.$nextTick(this.updatePopper);
+ this.$emit('input', value);
}
},
- 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);
+ setCurrentValue: function setCurrentValue(value, event) {
+ if (this.disabled) {
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)
- };
- });
+ /* 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 {
- filteredFlatOptions = [{
- __IS__FLAT__OPTIONS: true,
- label: this.t('el.cascader.noMatch'),
- value: '',
- disabled: true
- }];
+ this.currentValue = value;
}
- 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;
+ this.hoverIndex = value;
},
- handleClick: function handleClick() {
- if (this.disabled) return;
- if (this.filterable) {
- this.menuVisible = true;
- this.$refs.input.$refs.input.focus();
+ resetCurrentValue: function resetCurrentValue() {
+ if (this.disabled) {
return;
}
- this.menuVisible = !this.menuVisible;
+ if (this.allowHalf) {
+ this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
+ }
+ this.currentValue = this.value;
+ this.hoverIndex = -1;
}
},
created: function created() {
- var _this8 = this;
+ 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
+ };
+ }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- this.debouncedInputChange = (0, _debounce2.default)(this.debounce, function (value) {
- var before = _this8.beforeFilter(value);
+/***/ },
+/* 319 */
+/***/ function(module, exports) {
- 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);
- });
+ 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)
+ }
}
- });
- },
- mounted: function mounted() {
- this.flatOptions = this.flattenOptions(this.options);
- }
+ }, [_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;
+
/***/ },
-/* 351 */
+/* 321 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(352),
+ __webpack_require__(322),
/* template */
- null,
+ __webpack_require__(323),
/* styles */
null,
/* scopeId */
@@ -59413,358 +58811,350 @@ module.exports =
/***/ },
-/* 352 */
-/***/ function(module, exports, __webpack_require__) {
+/* 322 */
+/***/ function(module, exports) {
'use strict';
exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- var _babelHelperVueJsxMergeProps = __webpack_require__(353);
-
- var _babelHelperVueJsxMergeProps2 = _interopRequireDefault(_babelHelperVueJsxMergeProps);
-
- var _shared = __webpack_require__(354);
-
- var _scrollIntoView = __webpack_require__(112);
-
- var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ exports.default = {
+ name: 'ElSteps',
- var copyArray = function copyArray(arr, props) {
- if (!arr || !Array.isArray(arr) || !props) return arr;
- var result = [];
- var configurableProps = ['__IS__FLAT__OPTIONS', 'label', 'value', 'disabled'];
- var childrenProp = props.children || 'children';
- arr.forEach(function (item) {
- var itemCopy = {};
- configurableProps.forEach(function (prop) {
- var propName = props[prop] || prop;
- var value = item[propName];
- if (value !== undefined) itemCopy[propName] = value;
- });
- if (Array.isArray(item[childrenProp])) {
- itemCopy[childrenProp] = copyArray(item[childrenProp], props);
+ 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'
}
- result.push(itemCopy);
- });
- return result;
- };
-
- exports.default = {
- name: 'ElCascaderMenu',
+ },
data: function data() {
return {
- inputWidth: 0,
- options: [],
- props: {},
- visible: false,
- activeValue: [],
- value: [],
- expandTrigger: 'click',
- changeOnSelect: false,
- popperClass: ''
+ steps: [],
+ stepOffset: 0
};
},
watch: {
- visible: function visible(value) {
- if (value) {
- this.activeValue = this.value;
- }
+ active: function active(newVal, oldVal) {
+ this.$emit('change', newVal, oldVal);
},
+ steps: function steps(_steps) {
+ var _this = this;
- value: {
- immediate: true,
- handler: function handler(value) {
- this.activeValue = value;
+ _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);
+ });
+ })();
}
}
- },
+ }
+ };
- computed: {
- activeOptions: {
- cache: false,
- get: function get() {
- var _this = this;
+/***/ },
+/* 323 */
+/***/ function(module, exports) {
- var activeValue = this.activeValue;
- var configurableProps = ['label', 'value', 'children', 'disabled'];
+ 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: []}
- 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 !== undefined) option[prop] = value;
- });
- if (Array.isArray(option.children)) {
- formatOptions(option.children);
- }
- });
- };
+/***/ },
+/* 324 */
+/***/ function(module, exports, __webpack_require__) {
- var loadActiveOptions = function loadActiveOptions(options) {
- var activeOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
+ 'use strict';
- 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;
- };
+ exports.__esModule = true;
- var optionsCopy = copyArray(this.options, this.props);
- formatOptions(optionsCopy);
- return loadActiveOptions(optionsCopy);
- }
- }
- },
+ var _step = __webpack_require__(325);
- 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.slice());
- },
- handleMenuLeave: function handleMenuLeave() {
- this.$emit('menuLeave');
+ 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;
},
- 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.slice(), false);
- } else {
- this.$emit('activeItemChange', this.activeValue);
- }
+ prevStatus: function prevStatus() {
+ var prevStep = this.$parent.steps[this.index - 1];
+ return prevStep ? prevStep.currentStatus : 'wait';
},
- scrollMenu: function scrollMenu(menu) {
- (0, _scrollIntoView2.default)(menu, menu.getElementsByClassName('is-active')[0]);
+
+ isLast: function isLast() {
+ var parent = this.$parent;
+ return parent.steps[parent.steps.length - 1] === this;
},
- handleMenuEnter: function handleMenuEnter() {
- var _this2 = this;
+ style: function style() {
+ var parent = this.$parent;
+ var isCenter = parent.center;
+ var len = parent.steps.length;
- this.$nextTick(function () {
- return _this2.$refs.menus.forEach(function (menu) {
- return _this2.scrollMenu(menu);
- });
- });
+ 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 };
+ }
+ }
}
},
- render: function render(h) {
- var _this3 = this;
+ methods: {
+ updateStatus: function updateStatus(val) {
+ var prevChild = this.$parent.$children[this.index - 1];
- var activeValue = this.activeValue,
- activeOptions = this.activeOptions,
- visible = this.visible,
- expandTrigger = this.expandTrigger,
- popperClass = this.popperClass;
+ if (val > this.index) {
+ this.internalStatus = this.$parent.finishStatus;
+ } else if (val === this.index && this.prevStatus !== 'error') {
+ 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 = this.currentStatus !== 'error' ? 50 : 0;
+ } else if (status === 'wait') {
+ step = 0;
+ style.transitionDelay = -150 * this.index + 'ms';
+ }
- var menus = this._l(activeOptions, function (menu, menuIndex) {
- var isFlat = false;
- var items = _this3._l(menu, function (item) {
- var events = {
- on: {}
- };
+ style.borderWidth = step ? '1px' : 0;
+ this.$parent.direction === 'vertical' ? style.height = step + '%' : style.width = step + '%';
- if (item.__IS__FLAT__OPTIONS) isFlat = true;
+ this.lineStyle = style;
+ }
+ },
- 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]);
- });
- };
- }
- }
+ mounted: function mounted() {
+ var _this = this;
- 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';
+ var parent = this.$parent;
+
+ if (parent.direction === 'horizontal') {
+ if (parent.alignCenter) {
+ this.mainOffset = -this.$refs.title.getBoundingClientRect().width / 2 + 16 + 'px';
}
+ }
- return h(
- 'ul',
- {
- 'class': {
- 'el-cascader-menu': true,
- 'el-cascader-menu--flexible': isFlat
- },
- style: menuStyle,
- refInFor: true,
- ref: 'menus' },
- [items]
- );
+ var unwatch = this.$watch('index', function (val) {
+ _this.$watch('$parent.active', _this.updateStatus, { immediate: true });
+ unwatch();
});
- 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__(79);
-
-/***/ },
-/* 354 */
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(80);
-
-/***/ },
-/* 355 */
+/* 327 */
/***/ 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 === ''"
+ 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
}],
- 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)
+ 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: []}
/***/ },
-/* 356 */
+/* 328 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(357);
+ var _main = __webpack_require__(329);
var _main2 = _interopRequireDefault(_main);
@@ -59778,14 +59168,14 @@ module.exports =
exports.default = _main2.default;
/***/ },
-/* 357 */
+/* 329 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(358),
+ __webpack_require__(330),
/* template */
- __webpack_require__(373),
+ __webpack_require__(331),
/* styles */
null,
/* scopeId */
@@ -59798,522 +59188,725 @@ module.exports =
/***/ },
-/* 358 */
+/* 330 */
/***/ 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 _throttle = __webpack_require__(131);
- var _clickoutside = __webpack_require__(21);
+ var _throttle2 = _interopRequireDefault(_throttle);
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ var _resizeEvent = __webpack_require__(110);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+
exports.default = {
- name: 'ElColorPicker',
+ name: 'ElCarousel',
props: {
- value: {
- type: String
+ initialIndex: {
+ type: Number,
+ default: 0
},
- showAlpha: {
- type: Boolean
+ height: String,
+ trigger: {
+ type: String,
+ default: 'hover'
},
- colorFormat: {
- type: String
- }
- },
-
- directives: { Clickoutside: _clickoutside2.default },
+ autoplay: {
+ type: Boolean,
+ default: true
+ },
+ interval: {
+ type: Number,
+ default: 3000
+ },
+ indicatorPosition: String,
+ indicator: {
+ type: Boolean,
+ default: true
+ },
+ arrow: {
+ type: String,
+ default: 'hover'
+ },
+ type: String
+ },
- 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;
+ data: function data() {
+ return {
+ items: [],
+ activeIndex: -1,
+ containerWidth: 0,
+ timer: null,
+ hover: false
+ };
+ },
- return this.showAlpha ? 'rgba(' + r + ', ' + g + ', ' + b + ', ' + this.color.get('alpha') / 100 + ')' : 'rgb(' + r + ', ' + g + ', ' + b + ')';
- }
+
+ computed: {
+ hasLabel: function hasLabel() {
+ return this.items.some(function (item) {
+ return item.label.toString().length > 0;
+ });
}
},
watch: {
- value: function value(val) {
- if (!val) {
- this.showPanelColor = false;
- } else if (val && val !== this.color.value) {
- this.color.fromString(val);
- }
+ items: function items(val) {
+ if (val.length > 0) this.setActiveItem(this.initialIndex);
},
-
- color: {
- deep: true,
- handler: function handler() {
- this.showPanelColor = true;
- }
+ activeIndex: function activeIndex(val, oldVal) {
+ this.resetItemPosition(oldVal);
+ this.$emit('change', val, oldVal);
},
- displayedColor: function displayedColor(val) {
- this.$emit('active-change', val);
+ autoplay: function autoplay(val) {
+ val ? this.startTimer() : this.pauseTimer();
}
},
methods: {
- confirmValue: function confirmValue(value) {
- this.$emit('input', this.color.value);
- this.$emit('change', this.color.value);
- this.showPicker = false;
+ handleMouseEnter: function handleMouseEnter() {
+ this.hover = true;
+ this.pauseTimer();
},
- clearValue: function clearValue() {
- this.$emit('input', null);
- this.$emit('change', null);
- this.showPanelColor = false;
- this.showPicker = false;
- this.resetColor();
+ handleMouseLeave: function handleMouseLeave() {
+ this.hover = false;
+ this.startTimer();
},
- hide: function hide() {
- this.showPicker = false;
- this.resetColor();
+ 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;
},
- resetColor: function resetColor() {
+ handleButtonEnter: function handleButtonEnter(arrow) {
var _this = this;
- this.$nextTick(function (_) {
- if (_this.value) {
- _this.color.fromString(_this.value);
- } else {
- _this.showPanelColor = false;
+ 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(oldIndex) {
+ var _this2 = this;
- mounted: function mounted() {
- var value = this.value;
- if (value) {
- this.color.fromString(value);
+ this.items.forEach(function (item, index) {
+ item.translateItem(index, _this2.activeIndex, oldIndex);
+ });
+ },
+ 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;
+ }
}
- this.popperElm = this.$refs.dropdown.$el;
},
- data: function data() {
- var color = new _color2.default({
- enableAlpha: this.showAlpha,
- format: this.colorFormat
+
+ 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);
});
- return {
- color: color,
- showPicker: false,
- showPanelColor: false
- };
},
+ mounted: function mounted() {
+ var _this4 = this;
-
- components: {
- PickerDropdown: _pickerDropdown2.default
+ 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);
}
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ };
/***/ },
-/* 359 */
+/* 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 _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 _main = __webpack_require__(333);
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+ var _main2 = _interopRequireDefault(_main);
- var hsv2hsl = function hsv2hsl(hue, sat, val) {
- return [hue, sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0, hue / 2];
- };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
- //
- var isOnePointZero = function isOnePointZero(n) {
- return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
+ /* istanbul ignore next */
+ _main2.default.install = function (Vue) {
+ Vue.component(_main2.default.name, _main2.default);
};
- var isPercentage = function isPercentage(n) {
- return typeof n === 'string' && n.indexOf('%') !== -1;
- };
+ exports.default = _main2.default;
- // Take input from [0, n] and return it as [0, 1]
- var bound01 = function bound01(value, max) {
- if (isOnePointZero(value)) value = '100%';
+/***/ },
+/* 333 */
+/***/ function(module, exports, __webpack_require__) {
- var processPercent = isPercentage(value);
- value = Math.min(max, Math.max(0, parseFloat(value)));
+ 'use strict';
- // Automatically convert percentage into number
- if (processPercent) {
- value = parseInt(value * max, 10) / 100;
- }
+ exports.__esModule = true;
- // Handle floating point rounding errors
- if (Math.abs(value - max) < 0.000001) {
- return 1;
- }
+ var _resizeEvent = __webpack_require__(110);
- // Convert into [0, 1] range if it isn't already
- return value % max / parseFloat(max);
- };
+ var _scrollbarWidth = __webpack_require__(136);
- var INT_HEX_MAP = { 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F' };
+ var _scrollbarWidth2 = _interopRequireDefault(_scrollbarWidth);
- var toHex = function toHex(_ref) {
- var r = _ref.r,
- g = _ref.g,
- b = _ref.b;
+ var _util = __webpack_require__(107);
- 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);
- };
+ var _bar = __webpack_require__(334);
- if (isNaN(r) || isNaN(g) || isNaN(b)) return '';
+ var _bar2 = _interopRequireDefault(_bar);
- return '#' + hexOne(r) + hexOne(g) + hexOne(b);
- };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var HEX_INT_MAP = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
+ /* istanbul ignore next */
+ // reference https://github.com/noeldelgado/gemini-scrollbar/blob/master/index.js
- 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]);
- }
+ exports.default = {
+ name: 'ElScrollbar',
- return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
- };
+ components: { Bar: _bar2.default },
- 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;
+ props: {
+ native: Boolean,
+ wrapStyle: {},
+ wrapClass: {},
+ viewClass: {},
+ viewStyle: {},
+ noresize: Boolean, // 如果 container 尺寸不会发生变化,最好设置它可以优化性能
+ tag: {
+ type: String,
+ default: 'div'
+ }
+ },
- 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);
+ data: function data() {
+ return {
+ sizeWidth: '0',
+ sizeHeight: '0',
+ moveX: 0,
+ moveY: 0
+ };
+ },
- 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);
+ computed: {
+ wrap: function wrap() {
+ return this.$refs.wrap;
+ }
+ },
- var max = Math.max(r, g, b);
- var min = Math.min(r, g, b);
- var h = void 0,
- s = void 0;
- var v = max;
+ render: function render(h) {
+ var gutter = (0, _scrollbarWidth2.default)();
+ var style = this.wrapStyle;
- var d = max - min;
- s = max === 0 ? 0 : d / max;
+ if (gutter) {
+ var gutterWith = '-' + gutter + 'px';
+ var gutterStyle = 'margin-bottom: ' + gutterWith + '; margin-right: ' + gutterWith + ';';
- 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;
+ 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;
+ }
}
- h /= 6;
- }
+ 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
+ },
- 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];
+ 'class': [this.wrapClass, 'el-scrollbar__wrap', gutter ? '' : 'el-scrollbar__wrap--hidden-default'] },
+ [[view]]
+ );
+ var nodes = void 0;
- return {
- r: Math.round(r * 255),
- g: Math.round(g * 255),
- b: Math.round(b * 255)
- };
- };
+ 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);
+ },
- var Color = function () {
- function Color(options) {
- _classCallCheck(this, Color);
- this._hue = 0;
- this._saturation = 100;
- this._value = 100;
- this._alpha = 100;
+ methods: {
+ handleScroll: function handleScroll() {
+ var wrap = this.wrap;
- this.enableAlpha = false;
- this.format = 'hex';
- this.value = '';
+ 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;
- options = options || {};
+ heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
+ widthPercentage = wrap.clientWidth * 100 / wrap.scrollWidth;
- for (var option in options) {
- if (options.hasOwnProperty(option)) {
- this[option] = options[option];
- }
+ this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : '';
+ this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : '';
}
+ },
- this.doOnChange();
+ 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);
}
+ };
- 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]);
- }
- }
+/***/ },
+/* 334 */
+/***/ function(module, exports, __webpack_require__) {
- return;
- }
+ 'use strict';
- this['_' + prop] = value;
- this.doOnChange();
- };
+ exports.__esModule = true;
- Color.prototype.get = function get(prop) {
- return this['_' + prop];
- };
+ var _dom = __webpack_require__(44);
- Color.prototype.toRgb = function toRgb() {
- return hsv2rgb(this._hue, this._saturation, this._value);
- };
+ var _util = __webpack_require__(335);
- Color.prototype.fromString = function fromString(value) {
- var _this = this;
+ /* istanbul ignore next */
+ exports.default = {
+ name: 'Bar',
- if (!value) {
- this._hue = 0;
- this._saturation = 100;
- this._value = 100;
+ props: {
+ vertical: Boolean,
+ size: String,
+ move: Number
+ },
- this.doOnChange();
- return;
+ computed: {
+ bar: function bar() {
+ return _util.BAR_MAP[this.vertical ? 'vertical' : 'horizontal'];
+ },
+ wrap: function wrap() {
+ return this.$parent.wrap;
}
+ },
- var fromHSV = function fromHSV(h, s, v) {
- _this._hue = h;
- _this._saturation = s;
- _this._value = v;
+ render: function render(h) {
+ var size = this.size,
+ move = this.move,
+ bar = this.bar;
- _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);
- });
+ 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
+ },
- 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;
+ style: (0, _util.renderThumbStyle)({ size: size, move: move, bar: bar }) },
+ []
+ )]
+ );
+ },
- 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);
- });
+ 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];
- 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;
+ this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
+ },
+ startDrag: function startDrag(e) {
+ e.stopImmediatePropagation();
+ this.cursorDown = true;
- fromHSV(_h, _s, _v);
- }
- } else if (value.indexOf('#') !== -1) {
- var hex = value.replace('#', '').trim();
- var r = void 0,
- g = void 0,
- b = void 0;
+ (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 (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));
- }
+ if (!prevPage) return;
- var _rgb2hsv2 = rgb2hsv(r, g, b),
- _h2 = _rgb2hsv2.h,
- _s2 = _rgb2hsv2.s,
- _v2 = _rgb2hsv2.v;
+ 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];
- fromHSV(_h2, _s2, _v2);
+ 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;
}
- };
+ },
- Color.prototype.doOnChange = function doOnChange() {
- var _hue = this._hue,
- _saturation = this._saturation,
- _value = this._value,
- _alpha = this._alpha,
- format = this.format;
+ destroyed: function destroyed() {
+ (0, _dom.off)(document, 'mouseup', this.mouseUpDocumentHandler);
+ }
+ };
+/***/ },
+/* 335 */
+/***/ function(module, exports) {
- 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;
+ 'use strict';
- 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;
+ 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'
+ }
+ };
- this.value = 'rgb(' + _r + ', ' + _g + ', ' + _b + ')';
- break;
- default:
- this.value = toHex(hsv2rgb(_hue, _saturation, _value));
- }
- }
- };
+ function renderThumbStyle(_ref) {
+ var move = _ref.move,
+ size = _ref.size,
+ bar = _ref.bar;
- return Color;
- }();
+ var style = {};
+ var translate = 'translate' + bar.axis + '(' + move + '%)';
- exports.default = Color;
- ;
+ style[bar.size] = size;
+ style.transform = translate;
+ style.msTransform = translate;
+ style.webkitTransform = translate;
+
+ return style;
+ };
/***/ },
-/* 360 */
+/* 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__(361),
+ __webpack_require__(338),
/* template */
- __webpack_require__(372),
+ __webpack_require__(339),
/* styles */
null,
/* scopeId */
@@ -60326,91 +59919,20 @@ module.exports =
/***/ },
-/* 361 */
-/***/ function(module, exports, __webpack_require__) {
+/* 338 */
+/***/ function(module, exports) {
'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();
- });
- }
- }
- }
- }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -60430,227 +59952,159 @@ module.exports =
//
//
-/***/ },
-/* 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',
+ var CARD_SCALE = 0.83;
+ exports.default = {
+ name: 'ElCarouselItem',
props: {
- color: {
- required: true
+ name: String,
+ label: {
+ type: [String, Number],
+ default: ''
}
},
- computed: {
- colorValue: function colorValue() {
- var hue = this.color.get('hue');
- var value = this.color.get('value');
- return { hue: hue, value: value };
- }
+ data: function data() {
+ return {
+ hover: false,
+ translate: 0,
+ scale: 1,
+ active: false,
+ ready: false,
+ inStage: false,
+ animating: false
+ };
},
- 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%)';
+ 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;
},
- 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
- });
+ 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, oldIndex) {
+ var parentWidth = this.$parent.$el.offsetWidth;
+ var length = this.$parent.items.length;
+ if (this.$parent.type !== 'card' && oldIndex !== undefined) {
+ this.animating = index === activeIndex || index === oldIndex;
+ }
+ 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);
+ }
}
},
- 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();
+ created: function created() {
+ this.$parent && this.$parent.updateItems();
},
- data: function data() {
- return {
- cursorTop: 0,
- cursorLeft: 0,
- background: 'hsl(0, 100%, 50%)'
- };
+ destroyed: function destroyed() {
+ this.$parent && this.$parent.updateItems();
}
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ };
/***/ },
-/* 364 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- exports.__esModule = true;
+/* 339 */
+/***/ function(module, exports) {
- exports.default = function (element, options) {
- if (_vue2.default.prototype.$isServer) return;
- var moveFn = function moveFn(event) {
- if (options.drag) {
- options.drag(event);
+ 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,
+ 'is-animating': _vm.animating
+ },
+ 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
}
- };
- var upFn = function upFn(event) {
- document.removeEventListener('mousemove', moveFn);
- document.removeEventListener('mouseup', upFn);
- document.onselectstart = null;
- document.ondragstart = null;
-
- isDragging = false;
+ }, [(_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: []}
- if (options.end) {
- options.end(event);
- }
- };
- element.addEventListener('mousedown', function (event) {
- if (isDragging) return;
- document.onselectstart = function () {
- return false;
- };
- document.ondragstart = function () {
- return false;
- };
+/***/ },
+/* 340 */
+/***/ function(module, exports, __webpack_require__) {
- document.addEventListener('mousemove', moveFn);
- document.addEventListener('mouseup', upFn);
- isDragging = true;
+ 'use strict';
- if (options.start) {
- options.start(event);
- }
- });
- };
+ exports.__esModule = true;
- var _vue = __webpack_require__(133);
+ var _collapse = __webpack_require__(341);
- var _vue2 = _interopRequireDefault(_vue);
+ var _collapse2 = _interopRequireDefault(_collapse);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var isDragging = false;
-
-/***/ },
-/* 365 */
-/***/ function(module, exports) {
+ /* istanbul ignore next */
+ _collapse2.default.install = function (Vue) {
+ Vue.component(_collapse2.default.name, _collapse2.default);
+ };
- 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: []}
+ exports.default = _collapse2.default;
/***/ },
-/* 366 */
+/* 341 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(367),
+ __webpack_require__(342),
/* template */
- __webpack_require__(368),
+ __webpack_require__(343),
/* styles */
null,
/* scopeId */
@@ -60663,176 +60117,116 @@ module.exports =
/***/ },
-/* 367 */
-/***/ function(module, exports, __webpack_require__) {
+/* 342 */
+/***/ function(module, exports) {
'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',
+ name: 'ElCollapse',
- props: {
- color: {
- required: true
- },
+ componentName: 'ElCollapse',
- vertical: Boolean
+ props: {
+ accordion: Boolean,
+ value: {
+ type: [Array, String, Number],
+ default: function _default() {
+ return [];
+ }
+ }
},
data: function data() {
return {
- thumbLeft: 0,
- thumbTop: 0
+ activeNames: [].concat(this.value)
};
},
- computed: {
- hueValue: function hueValue() {
- var hue = this.color.get('hue');
- return hue;
- }
- },
-
watch: {
- hueValue: function hueValue() {
- this.update();
+ value: function value(_value) {
+ this.activeNames = [].concat(_value);
}
},
methods: {
- handleClick: function handleClick(event) {
- var thumb = this.$refs.thumb;
- var target = event.target;
-
- if (target !== thumb) {
- this.handleDrag(event);
- }
+ 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);
},
- 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);
+ 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 top = event.clientY - rect.top;
- top = Math.min(top, rect.height - thumb.offsetHeight / 2);
- top = Math.max(thumb.offsetHeight / 2, top);
+ var activeNames = this.activeNames.slice(0);
+ var index = activeNames.indexOf(item.name);
- hue = Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 360);
+ if (index > -1) {
+ activeNames.splice(index, 1);
+ } else {
+ activeNames.push(item.name);
+ }
+ this.setActiveNames(activeNames);
}
-
- 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();
+ created: function created() {
+ this.$on('item-click', this.handleItemClick);
}
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ };
/***/ },
-/* 368 */
+/* 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-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'
- })
- })])
+ staticClass: "el-collapse"
+ }, [_vm._t("default")], 2)
},staticRenderFns: []}
/***/ },
-/* 369 */
+/* 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__(370),
+ __webpack_require__(346),
/* template */
- __webpack_require__(371),
+ __webpack_require__(347),
/* styles */
null,
/* scopeId */
@@ -60845,306 +60239,127 @@ module.exports =
/***/ },
-/* 370 */
+/* 346 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _draggable = __webpack_require__(364);
+ var _collapseTransition = __webpack_require__(49);
- var _draggable2 = _interopRequireDefault(_draggable);
+ 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: 'el-color-alpha-slider',
+ name: 'ElCollapseItem',
- props: {
- color: {
- required: true
- },
- vertical: Boolean
- },
+ componentName: 'ElCollapseItem',
- 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);
+ mixins: [_emitter2.default],
- 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;
+ components: { ElCollapseTransition: _collapseTransition2.default },
- 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;
+ data: function data() {
+ return {
+ contentWrapStyle: {
+ height: 'auto',
+ display: 'block'
+ },
+ contentHeight: 0
+ };
+ },
- 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%)';
+ props: {
+ title: String,
+ name: {
+ type: [String, Number],
+ default: function _default() {
+ return this._uid;
}
- 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
- };
+ computed: {
+ isActive: function isActive() {
+ return this.$parent.activeNames.indexOf(this.name) > -1;
+ }
},
- mounted: function mounted() {
- var _this = this;
-
- var _$refs = this.$refs,
- bar = _$refs.bar,
- thumb = _$refs.thumb;
+ watch: {
+ 'isActive': function isActive(value) {}
+ },
- var dragConfig = {
- drag: function drag(event) {
- _this.handleDrag(event);
- },
- end: function end(event) {
- _this.handleDrag(event);
- }
- };
+ methods: {
+ handleHeaderClick: function handleHeaderClick() {
+ this.dispatch('ElCollapse', 'item-click', this);
+ }
+ },
- (0, _draggable2.default)(bar, dragConfig);
- (0, _draggable2.default)(thumb, dragConfig);
- this.update();
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ mounted: function mounted() {}
+ };
/***/ },
-/* 371 */
+/* 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-color-alpha-slider",
+ staticClass: "el-collapse-item",
class: {
- 'is-vertical': _vm.vertical
+ 'is-active': _vm.isActive
}
}, [_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"
- },
+ staticClass: "el-collapse-item__header",
on: {
- "after-leave": _vm.doDestroy
+ "click": _vm.handleHeaderClick
}
- }, [_c('div', {
+ }, [_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.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"
+ value: (_vm.isActive),
+ expression: "isActive"
}],
- staticClass: "el-color-picker"
+ staticClass: "el-collapse-item__wrap"
}, [_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)
+ staticClass: "el-collapse-item__content"
+ }, [_vm._t("default")], 2)])])], 1)
},staticRenderFns: []}
/***/ },
-/* 374 */
+/* 348 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(375);
+ var _main = __webpack_require__(349);
var _main2 = _interopRequireDefault(_main);
@@ -61158,14 +60373,14 @@ module.exports =
exports.default = _main2.default;
/***/ },
-/* 375 */
+/* 349 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(376),
+ __webpack_require__(350),
/* template */
- __webpack_require__(380),
+ __webpack_require__(355),
/* styles */
null,
/* scopeId */
@@ -61178,16 +60393,32 @@ module.exports =
/***/ },
-/* 376 */
+/* 350 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _button = __webpack_require__(31);
+ var _vue = __webpack_require__(133);
- var _button2 = _interopRequireDefault(_button);
+ 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);
@@ -61197,12 +60428,42 @@ module.exports =
var _locale2 = _interopRequireDefault(_locale);
- var _transferPanel = __webpack_require__(377);
+ var _locale3 = __webpack_require__(111);
- var _transferPanel2 = _interopRequireDefault(_transferPanel);
+ var _debounce = __webpack_require__(69);
+
+ 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
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -61246,150 +60507,325 @@ module.exports =
//
exports.default = {
- name: 'ElTransfer',
+ name: 'ElCascader',
- mixins: [_emitter2.default, _locale2.default],
+ directives: { Clickoutside: _clickoutside2.default },
+
+ mixins: [popperMixin, _emitter2.default, _locale2.default],
components: {
- TransferPanel: _transferPanel2.default,
- ElButton: _button2.default
+ ElInput: _input2.default
},
props: {
- data: {
+ options: {
type: Array,
- default: function _default() {
- return [];
- }
+ required: true
},
- titles: {
- type: Array,
+ props: {
+ type: Object,
default: function _default() {
- return [];
+ return {
+ children: 'children',
+ label: 'label',
+ value: 'value',
+ disabled: 'disabled'
+ };
}
},
- buttonTexts: {
+ value: {
type: Array,
default: function _default() {
return [];
}
},
- filterPlaceholder: {
+ placeholder: {
type: String,
- default: ''
- },
- filterMethod: Function,
- leftDefaultChecked: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- rightDefaultChecked: {
- type: Array,
default: function _default() {
- return [];
+ return (0, _locale3.t)('el.cascader.placeholder');
}
},
- renderContent: Function,
- value: {
- type: Array,
- default: function _default() {
- return [];
- }
+ disabled: Boolean,
+ clearable: {
+ type: Boolean,
+ default: false
},
- footerFormat: {
- type: Object,
- default: function _default() {
- return {};
- }
+ changeOnSelect: Boolean,
+ popperClass: String,
+ expandTrigger: {
+ type: String,
+ default: 'click'
},
filterable: Boolean,
- props: {
- type: Object,
+ size: String,
+ showAllLevels: {
+ type: Boolean,
+ default: true
+ },
+ debounce: {
+ type: Number,
+ default: 300
+ },
+ beforeFilter: {
+ type: Function,
default: function _default() {
- return {
- label: 'label',
- key: 'key',
- disabled: 'disabled'
- };
+ return function () {};
}
}
},
data: function data() {
return {
- leftChecked: [],
- rightChecked: []
+ currentValue: this.value || [],
+ menu: null,
+ debouncedInputChange: function debouncedInputChange() {},
+
+ menuVisible: false,
+ inputHover: false,
+ inputValue: '',
+ flatOptions: null
};
},
computed: {
- sourceData: function sourceData() {
- var _this = this;
-
- return this.data.filter(function (item) {
- return _this.value.indexOf(item[_this.props.key]) === -1;
- });
+ labelKey: function labelKey() {
+ return this.props.label || 'label';
},
- targetData: function targetData() {
- var _this2 = this;
+ valueKey: function valueKey() {
+ return this.props.value || 'value';
+ },
+ childrenKey: function childrenKey() {
+ return this.props.children || 'children';
+ },
+ currentLabels: function currentLabels() {
+ var _this = this;
- return this.data.filter(function (item) {
- return _this2.value.indexOf(item[_this2.props.key]) > -1;
+ 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: {
- value: function value(val) {
- this.dispatch('ElFormItem', 'el.form.change', val);
- }
- },
-
- methods: {
- onSourceCheckedChange: function onSourceCheckedChange(val) {
- this.leftChecked = val;
+ menuVisible: function menuVisible(value) {
+ value ? this.showMenu() : this.hideMenu();
},
- onTargetCheckedChange: function onTargetCheckedChange(val) {
- this.rightChecked = val;
+ value: function value(_value) {
+ this.currentValue = _value;
},
- 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);
+ currentValue: function currentValue(value) {
+ this.dispatch('ElFormItem', 'el.form.change', [value]);
},
- 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);
+ options: {
+ deep: true,
+ handler: function handler(value) {
+ if (!this.menu) {
+ this.initMenu();
}
- });
- this.$emit('input', currentValue);
- this.$emit('change', currentValue, 'right', this.leftChecked);
+ 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);
}
};
/***/ },
-/* 377 */
+/* 351 */
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(378),
+ __webpack_require__(352),
/* template */
- __webpack_require__(379),
+ null,
/* styles */
null,
/* scopeId */
@@ -61402,656 +60838,907 @@ module.exports =
/***/ },
-/* 378 */
+/* 352 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _checkboxGroup = __webpack_require__(143);
-
- var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
-
- var _checkbox = __webpack_require__(130);
-
- var _checkbox2 = _interopRequireDefault(_checkbox);
+ var _babelHelperVueJsxMergeProps = __webpack_require__(353);
- var _input = __webpack_require__(20);
+ var _babelHelperVueJsxMergeProps2 = _interopRequireDefault(_babelHelperVueJsxMergeProps);
- var _input2 = _interopRequireDefault(_input);
+ var _shared = __webpack_require__(354);
- var _locale = __webpack_require__(10);
+ var _scrollIntoView = __webpack_require__(112);
- var _locale2 = _interopRequireDefault(_locale);
+ var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
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]]
- );
- }
+ var copyArray = function copyArray(arr, props) {
+ if (!arr || !Array.isArray(arr) || !props) return arr;
+ var result = [];
+ var configurableProps = ['__IS__FLAT__OPTIONS', 'label', 'value', 'disabled'];
+ var childrenProp = props.children || 'children';
+ arr.forEach(function (item) {
+ var itemCopy = {};
+ configurableProps.forEach(function (prop) {
+ var propName = props[prop] || prop;
+ var value = item[propName];
+ if (value !== undefined) itemCopy[propName] = value;
+ });
+ if (Array.isArray(item[childrenProp])) {
+ itemCopy[childrenProp] = copyArray(item[childrenProp], props);
}
- },
+ result.push(itemCopy);
+ });
+ return result;
+ };
- props: {
- data: {
- type: Array,
- default: function _default() {
- return [];
- }
- },
- renderContent: Function,
- placeholder: String,
- title: String,
- filterable: Boolean,
- footerFormat: Object,
- filterMethod: Function,
- defaultChecked: Array,
- props: Object
- },
+ exports.default = {
+ name: 'ElCascaderMenu',
data: function data() {
return {
- checked: [],
- allChecked: false,
- query: '',
- inputHover: false
+ inputWidth: 0,
+ options: [],
+ props: {},
+ visible: false,
+ activeValue: [],
+ value: [],
+ expandTrigger: 'click',
+ changeOnSelect: false,
+ popperClass: ''
};
},
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();
+ visible: function visible(value) {
+ if (value) {
+ this.activeValue = this.value;
+ }
},
-
- defaultChecked: {
+ value: {
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;
+ handler: function handler(value) {
+ this.activeValue = value;
}
}
},
computed: {
- filteredData: function filteredData() {
- var _this3 = this;
+ activeOptions: {
+ cache: false,
+ get: function get() {
+ var _this = 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;
+ var activeValue = this.activeValue;
+ var configurableProps = ['label', 'value', 'children', 'disabled'];
- 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;
+ 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 !== undefined) option[prop] = value;
+ });
+ if (Array.isArray(option.children)) {
+ formatOptions(option.children);
+ }
+ });
+ };
- if (noChecked && hasChecked) {
- return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength).replace(/\${total}/g, dataLength) : noChecked.replace(/\${total}/g, dataLength);
+ 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;
+ };
+
+ var optionsCopy = copyArray(this.options, this.props);
+ formatOptions(optionsCopy);
+ return loadActiveOptions(optionsCopy);
+ }
+ }
+ },
+
+ 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 {
- return checkedLength > 0 ? this.t('el.transfer.hasCheckedFormat', { total: dataLength, checked: checkedLength }) : this.t('el.transfer.noCheckedFormat', { total: dataLength });
+ this.activeValue = [item.value];
}
+ this.$emit('pick', this.activeValue.slice());
},
- 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';
+ handleMenuLeave: function handleMenuLeave() {
+ this.$emit('menuLeave');
},
- labelProp: function labelProp() {
- return this.props.label || 'label';
+ 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.slice(), false);
+ } else {
+ this.$emit('activeItemChange', this.activeValue);
+ }
},
- keyProp: function keyProp() {
- return this.props.key || 'key';
+ scrollMenu: function scrollMenu(menu) {
+ (0, _scrollIntoView2.default)(menu, menu.getElementsByClassName('is-active')[0]);
},
- disabledProp: function disabledProp() {
- return this.props.disabled || 'disabled';
+ handleMenuEnter: function handleMenuEnter() {
+ var _this2 = this;
+
+ this.$nextTick(function () {
+ return _this2.$refs.menus.forEach(function (menu) {
+ return _this2.scrollMenu(menu);
+ });
+ });
}
},
- methods: {
- updateAllChecked: function updateAllChecked() {
- var _this5 = this;
+ render: function render(h) {
+ var _this3 = 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;
+ var activeValue = this.activeValue,
+ activeOptions = this.activeOptions,
+ visible = this.visible,
+ expandTrigger = this.expandTrigger,
+ popperClass = this.popperClass;
- this.checked = value.target.checked ? this.checkableData.map(function (item) {
- return item[_this6.keyProp];
- }) : [];
- },
- clearQuery: function clearQuery() {
- if (this.inputIcon === 'circle-close') {
- this.query = '';
+
+ 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]
+ )]
+ );
}
};
/***/ },
-/* 379 */
+/* 353 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(80);
+
+/***/ },
+/* 354 */
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(81);
+
+/***/ },
+/* 355 */
/***/ 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
- },
+ 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.clearQuery
- },
- nativeOn: {
+ "click": _vm.handleClick,
"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', {
+ }, [_c('el-input', {
+ ref: "input",
attrs: {
- "indeterminate": _vm.isIndeterminate
+ "readonly": !_vm.filterable,
+ "placeholder": _vm.currentLabels.length ? undefined : _vm.placeholder,
+ "validate-event": false,
+ "size": _vm.size,
+ "disabled": _vm.disabled
},
on: {
- "change": _vm.handleAllCheckedChange
+ "change": _vm.debouncedInputChange
},
model: {
- value: (_vm.allChecked),
+ value: (_vm.inputValue),
callback: function($$v) {
- _vm.allChecked = $$v
+ _vm.inputValue = $$v
},
- expression: "allChecked"
+ expression: "inputValue"
}
- }, [_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')
- },
+ }, [_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: {
- "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)
- }
+ "click": _vm.clearValue
}
- }, [(_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
+ }) : _c('i', {
+ key: "2",
+ staticClass: "el-input__icon el-icon-caret-bottom",
+ class: {
+ 'is-reverse': _vm.menuVisible
}
- }, 'transfer-panel', _vm.$props), [_vm._t("right-footer")], 2)], 1)
+ })])], 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__) {
-/***/ }),
-/* 41 */
-/***/ (function(module, exports, __webpack_require__) {
+ 'use strict';
-module.exports =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
+ exports.__esModule = true;
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
+ var _main = __webpack_require__(357);
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
+ var _main2 = _interopRequireDefault(_main);
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+ /* istanbul ignore next */
+ _main2.default.install = function (Vue) {
+ Vue.component(_main2.default.name, _main2.default);
+ };
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
+ exports.default = _main2.default;
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
+/***/ },
+/* 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
+ )
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+ module.exports = Component.exports
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
+/***/ },
+/* 358 */
+/***/ function(module, exports, __webpack_require__) {
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ({
+ 'use strict';
-/***/ 0:
-/***/ function(module, exports, __webpack_require__) {
+ exports.__esModule = true;
- module.exports = __webpack_require__(264);
+ var _color = __webpack_require__(359);
+ var _color2 = _interopRequireDefault(_color);
-/***/ },
+ var _pickerDropdown = __webpack_require__(360);
-/***/ 3:
-/***/ function(module, exports) {
+ var _pickerDropdown2 = _interopRequireDefault(_pickerDropdown);
- /* globals __VUE_SSR_CONTEXT__ */
+ var _clickoutside = __webpack_require__(21);
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
+ var _clickoutside2 = _interopRequireDefault(_clickoutside);
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
+ exports.default = {
+ name: 'ElColorPicker',
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
+ props: {
+ value: {
+ type: String
+ },
+ showAlpha: {
+ type: Boolean
+ },
+ colorFormat: {
+ type: String
+ }
+ },
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
+ directives: { Clickoutside: _clickoutside2.default },
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
+ 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;
- 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)
+ return this.showAlpha ? 'rgba(' + r + ', ' + g + ', ' + b + ', ' + this.color.get('alpha') / 100 + ')' : 'rgb(' + r + ', ' + g + ', ' + b + ')';
}
}
- // 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
- }
- }
+ 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;
-/***/ 9:
-/***/ function(module, exports) {
+ this.$nextTick(function (_) {
+ if (_this.value) {
+ _this.color.fromString(_this.value);
+ } else {
+ _this.showPanelColor = false;
+ }
+ });
+ }
+ },
- module.exports = __webpack_require__(11);
+ 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
+ };
+ },
-/***/ },
-/***/ 10:
+ components: {
+ PickerDropdown: _pickerDropdown2.default
+ }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+
+/***/ },
+/* 359 */
/***/ function(module, exports) {
- module.exports = __webpack_require__(20);
+ 'use strict';
-/***/ },
+ exports.__esModule = true;
-/***/ 13:
-/***/ function(module, exports) {
+ 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; };
- module.exports = __webpack_require__(13);
+ 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];
+ };
-/***/ 14:
-/***/ function(module, exports) {
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
+ //
+ var isOnePointZero = function isOnePointZero(n) {
+ return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
+ };
- module.exports = __webpack_require__(5);
+ 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%';
-/***/ 15:
-/***/ function(module, exports) {
+ var processPercent = isPercentage(value);
+ value = Math.min(max, Math.max(0, parseFloat(value)));
- module.exports = __webpack_require__(22);
+ // 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;
+ }
-/***/ 46:
-/***/ function(module, exports) {
+ // Convert into [0, 1] range if it isn't already
+ return value % max / parseFloat(max);
+ };
- module.exports = __webpack_require__(15);
+ 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;
-/***/ 60:
-/***/ function(module, exports) {
+ 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);
+ };
- module.exports = __webpack_require__(23);
+ if (isNaN(r) || isNaN(g) || isNaN(b)) return '';
-/***/ },
+ return '#' + hexOne(r) + hexOne(g) + hexOne(b);
+ };
-/***/ 61:
-/***/ function(module, exports) {
+ var HEX_INT_MAP = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
- module.exports = __webpack_require__(24);
+ 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];
+ };
-/***/ 62:
-/***/ function(module, exports) {
+ 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;
- module.exports = __webpack_require__(16);
+ 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
+ };
+ };
-/***/ 63:
-/***/ function(module, exports) {
+ // `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);
- module.exports = __webpack_require__(9);
+ 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;
-/***/ 123:
-/***/ function(module, exports) {
+ 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;
+ }
- module.exports = __webpack_require__(4);
+ 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);
-/***/ 217:
+ 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__(3)(
+ var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(218),
+ __webpack_require__(361),
/* template */
- __webpack_require__(220),
+ __webpack_require__(372),
/* styles */
null,
/* scopeId */
@@ -62064,351 +61751,228 @@ module.exports =
/***/ },
-
-/***/ 218:
+/* 361 */
/***/ 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 _svPanel = __webpack_require__(362);
- var _emitter = __webpack_require__(14);
+ var _svPanel2 = _interopRequireDefault(_svPanel);
- var _emitter2 = _interopRequireDefault(_emitter);
+ var _hueSlider = __webpack_require__(366);
- var _util = __webpack_require__(219);
+ 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 = {
- mixins: [_emitter2.default],
+ name: 'el-color-picker-dropdown',
- name: 'ElOption',
+ mixins: [_vuePopper2.default, _locale2.default],
- componentName: 'ElOption',
+ components: {
+ SvPanel: _svPanel2.default,
+ HueSlider: _hueSlider2.default,
+ AlphaSlider: _alphaSlider2.default
+ },
props: {
- value: {
+ color: {
required: true
},
- label: [String, Number],
- created: Boolean,
- disabled: {
- type: Boolean,
- default: false
+ showAlpha: Boolean
+ },
+
+ computed: {
+ currentColor: function currentColor() {
+ var parent = this.$parent;
+ return !parent.value && !parent.showPanelColor ? '' : parent.color.value;
}
},
- data: function data() {
- return {
- index: -1,
- groupDisabled: false,
- visible: true,
- hitState: false
- };
+ methods: {
+ confirmValue: function confirmValue() {
+ this.$emit('pick');
+ }
},
+ mounted: function mounted() {
+ this.$parent.popperElm = this.popperElm = this.$el;
+ this.referenceElm = this.$parent.$el;
+ },
- computed: {
- isObject: function isObject() {
- return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
- },
- 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() {
+ showPopper: function showPopper(val) {
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 (val === true) {
+ this.$nextTick(function () {
+ var _$refs = _this.$refs,
+ sl = _$refs.sl,
+ hue = _$refs.hue,
+ alpha = _$refs.alpha;
- 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--;
+ sl && sl.update();
+ hue && hue.update();
+ alpha && alpha.update();
+ });
}
- },
- 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);
}
- };
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
/***/ },
+/* 362 */
+/***/ function(module, exports, __webpack_require__) {
-/***/ 219:
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(6);
-
-/***/ },
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(363),
+ /* template */
+ __webpack_require__(365),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
-/***/ 220:
-/***/ function(module, exports) {
+ module.exports = Component.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:
+/* 363 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _select = __webpack_require__(265);
+ var _draggable = __webpack_require__(364);
- var _select2 = _interopRequireDefault(_select);
+ var _draggable2 = _interopRequireDefault(_draggable);
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 = {
+ name: 'el-sl-panel',
- exports.default = _select2.default;
+ 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 };
+ }
+ },
-/***/ 265:
-/***/ function(module, exports, __webpack_require__) {
+ watch: {
+ colorValue: function colorValue() {
+ this.update();
+ }
+ },
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(266),
- /* template */
- __webpack_require__(271),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ methods: {
+ update: function update() {
+ var saturation = this.color.get('saturation');
+ var value = this.color.get('value');
- module.exports = Component.exports
+ var el = this.$el;
+ var _el$getBoundingClient = el.getBoundingClientRect(),
+ width = _el$getBoundingClient.width,
+ height = _el$getBoundingClient.height;
-/***/ },
+ if (!height) height = width * 3 / 4;
-/***/ 266:
-/***/ function(module, exports, __webpack_require__) {
+ this.cursorLeft = saturation * width / 100;
+ this.cursorTop = (100 - value) * height / 100;
- 'use strict';
+ this.background = 'hsl(' + this.color.get('hue') + ', 100%, 50%)';
+ },
+ handleDrag: function handleDrag(event) {
+ var el = this.$el;
+ var rect = el.getBoundingClientRect();
- exports.__esModule = true;
+ var left = event.clientX - rect.left;
+ var top = event.clientY - rect.top;
+ left = Math.max(0, left);
+ left = Math.min(left, rect.width);
- 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; }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ 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%)'
+ };
+ }
+ }; //
//
//
//
@@ -62426,666 +61990,607 @@ module.exports =
//
//
- var _emitter = __webpack_require__(14);
-
- var _emitter2 = _interopRequireDefault(_emitter);
+/***/ },
+/* 364 */
+/***/ function(module, exports, __webpack_require__) {
- var _locale = __webpack_require__(61);
+ 'use strict';
- var _locale2 = _interopRequireDefault(_locale);
+ exports.__esModule = true;
- var _input = __webpack_require__(9);
+ 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;
- var _input2 = _interopRequireDefault(_input);
+ isDragging = false;
- var _selectDropdown = __webpack_require__(267);
+ if (options.end) {
+ options.end(event);
+ }
+ };
+ element.addEventListener('mousedown', function (event) {
+ if (isDragging) return;
+ document.onselectstart = function () {
+ return false;
+ };
+ document.ondragstart = function () {
+ return false;
+ };
- var _selectDropdown2 = _interopRequireDefault(_selectDropdown);
+ document.addEventListener('mousemove', moveFn);
+ document.addEventListener('mouseup', upFn);
+ isDragging = true;
- var _option = __webpack_require__(217);
+ if (options.start) {
+ options.start(event);
+ }
+ });
+ };
- var _option2 = _interopRequireDefault(_option);
+ var _vue = __webpack_require__(133);
- var _tag = __webpack_require__(270);
+ var _vue2 = _interopRequireDefault(_vue);
- var _tag2 = _interopRequireDefault(_tag);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- var _scrollbar = __webpack_require__(15);
+ var isDragging = false;
- var _scrollbar2 = _interopRequireDefault(_scrollbar);
+/***/ },
+/* 365 */
+/***/ function(module, exports) {
- var _debounce = __webpack_require__(63);
+ 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: []}
- var _debounce2 = _interopRequireDefault(_debounce);
+/***/ },
+/* 366 */
+/***/ function(module, exports, __webpack_require__) {
- var _clickoutside = __webpack_require__(10);
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(367),
+ /* template */
+ __webpack_require__(368),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- var _clickoutside2 = _interopRequireDefault(_clickoutside);
+ module.exports = Component.exports
- var _dom = __webpack_require__(123);
- var _resizeEvent = __webpack_require__(46);
+/***/ },
+/* 367 */
+/***/ function(module, exports, __webpack_require__) {
- var _locale3 = __webpack_require__(62);
+ 'use strict';
- var _scrollIntoView = __webpack_require__(60);
+ exports.__esModule = true;
- var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
+ var _draggable = __webpack_require__(364);
- var _util = __webpack_require__(219);
+ var _draggable2 = _interopRequireDefault(_draggable);
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',
+ name: 'el-color-hue-slider',
- 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;
+ props: {
+ color: {
+ required: true
},
- 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;
- }
+ vertical: Boolean
},
- components: {
- ElInput: _input2.default,
- ElSelectMenu: _selectDropdown2.default,
- ElOption: _option2.default,
- ElTag: _tag2.default,
- ElScrollbar: _scrollbar2.default
+ data: function data() {
+ return {
+ thumbLeft: 0,
+ thumbTop: 0
+ };
},
- 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'
+ computed: {
+ hueValue: function hueValue() {
+ var hue = this.color.get('hue');
+ return hue;
}
},
- 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: {
+ hueValue: function hueValue() {
+ this.update();
+ }
},
+ methods: {
+ handleClick: function handleClick(event) {
+ var thumb = this.$refs.thumb;
+ var target = event.target;
- 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;
+ if (target !== thumb) {
+ this.handleDrag(event);
}
- this.$emit('change', val);
- this.dispatch('ElFormItem', 'el.form.change', val);
},
- query: function query(val) {
- var _this2 = this;
+ handleDrag: function handleDrag(event) {
+ var rect = this.$el.getBoundingClientRect();
+ var thumb = this.$refs.thumb;
- 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');
+ 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 {
- this.filteredOptionsCount = this.optionsCount;
- this.broadcast('ElOption', 'queryChange', val);
- this.broadcast('ElOptionGroup', 'queryChange');
- }
- if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
- this.checkDefaultFirstOption();
+ 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);
},
- visible: function visible(val) {
- var _this3 = this;
+ getThumbLeft: function getThumbLeft() {
+ if (this.vertical) return 0;
+ var el = this.$el;
+ var hue = this.color.get('hue');
- 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);
+ if (!el) return 0;
+ var thumb = this.$refs.thumb;
+ return Math.round(hue * (el.offsetWidth - thumb.offsetWidth / 2) / 360);
},
- 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();
- }
+ 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();
}
},
- 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(option) {
- var target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
- if (this.$refs.popper && target) {
- var menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
- (0, _scrollIntoView2.default)(menu, target);
- }
- },
- handleMenuEnter: function handleMenuEnter() {
- var _this4 = this;
+ mounted: function mounted() {
+ var _this = this;
- this.$nextTick(function () {
- return _this4.scrollToOption(_this4.selected);
- });
- },
- getOption: function getOption(value) {
- var option = void 0;
- var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
- 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;
+ var _$refs = this.$refs,
+ bar = _$refs.bar,
+ thumb = _$refs.thumb;
- 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));
- });
+
+ var dragConfig = {
+ drag: function drag(event) {
+ _this.handleDrag(event);
+ },
+ end: function end(event) {
+ _this.handleDrag(event);
}
- this.selected = result;
- this.$nextTick(function () {
- _this5.resetInputHeight();
- });
- },
- handleFocus: function handleFocus() {
- this.visible = true;
+ };
+
+ (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
},
- handleIconClick: function handleIconClick(event) {
- if (this.iconClass.indexOf('circle-close') > -1) {
- this.deleteSelected(event);
- } else {
- this.toggleMenu();
- }
+ vertical: Boolean
+ },
+
+ watch: {
+ 'color._alpha': function color_alpha() {
+ this.update();
},
- handleMouseDown: function handleMouseDown(event) {
- if (event.target.tagName !== 'INPUT') return;
- if (this.visible) {
- this.handleClose();
- event.preventDefault();
+ '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);
}
},
- 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;
+ handleDrag: function handleDrag(event) {
+ var rect = this.$el.getBoundingClientRect();
+ var thumb = this.$refs.thumb;
- 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);
+ 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));
}
},
- managePlaceholder: function managePlaceholder() {
- if (this.currentPlaceholder !== '') {
- this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
- }
+ 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);
},
- resetInputState: function resetInputState(e) {
- if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
- this.inputLength = this.$refs.input.value.length * 15 + 20;
- this.resetInputHeight();
+ 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);
},
- resetInputHeight: function resetInputHeight() {
- var _this6 = this;
+ 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;
- 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');
- }
- });
+ return 'linear-gradient(to right, rgba(' + r + ', ' + g + ', ' + b + ', 0) 0%, rgba(' + r + ', ' + g + ', ' + b + ', 1) 100%)';
+ }
+ return null;
},
- resetHoverIndex: function resetHoverIndex() {
- var _this7 = this;
+ update: function update() {
+ this.thumbLeft = this.getThumbLeft();
+ this.thumbTop = this.getThumbTop();
+ this.background = this.getBackground();
+ }
+ },
- 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;
+ data: function data() {
+ return {
+ thumbLeft: 0,
+ thumbTop: 0,
+ background: null
+ };
+ },
+ mounted: function mounted() {
+ var _this = 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;
+ 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);
}
- this.$nextTick(function () {
- return _this8.scrollToOption(option);
- });
- },
- getValueIndex: function getValueIndex() {
- var _this9 = this;
+ };
- var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- var value = arguments[1];
+ (0, _draggable2.default)(bar, dragConfig);
+ (0, _draggable2.default)(thumb, dragConfig);
+ this.update();
+ }
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
- 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
- };
- }();
+/***/ },
+/* 371 */
+/***/ function(module, exports) {
- 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;
+ 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: []}
- 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(_this10.options[_this10.hoverIndex]);
- });
- },
- selectOption: function selectOption() {
- if (this.options[this.hoverIndex]) {
- this.handleOptionSelect(this.options[this.hoverIndex]);
- }
+/***/ },
+/* 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"
},
- deleteSelected: function deleteSelected(event) {
- event.stopPropagation();
- this.$emit('input', '');
- this.visible = false;
- this.$emit('clear');
+ 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"
},
- 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();
+ 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:"
},
- onInputChange: function onInputChange() {
- if (this.filterable) {
- this.query = this.selectedLabel;
+ on: {
+ "click": function($event) {
+ _vm.$emit('clear')
}
- },
- onOptionDestroy: function onOptionDestroy(option) {
- this.optionsCount--;
- this.filteredOptionsCount--;
- var index = this.options.indexOf(option);
- if (index > -1) {
- this.options.splice(index, 1);
+ }
+ }, [_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
}
- 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();
+ }
+ }, [_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
},
- 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;
- }
- }
- }
+ on: {
+ "pick": _vm.confirmValue,
+ "clear": _vm.clearValue
},
- 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);
- }
+ model: {
+ value: (_vm.showPicker),
+ callback: function($$v) {
+ _vm.showPicker = $$v
+ },
+ expression: "showPicker"
}
- },
+ })], 1)
+ },staticRenderFns: []}
- created: function created() {
- var _this11 = this;
+/***/ },
+/* 374 */
+/***/ function(module, exports, __webpack_require__) {
- 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();
+ 'use strict';
- this.debouncedOnInputChange = (0, _debounce2.default)(this.debounce, function () {
- _this11.onInputChange();
- });
+ exports.__esModule = true;
- this.$on('handleOptionClick', this.handleOptionSelect);
- this.$on('onOptionDestroy', this.onOptionDestroy);
- this.$on('setSelected', this.setSelected);
- },
- mounted: function mounted() {
- var _this12 = this;
+ var _main = __webpack_require__(375);
- 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);
- }
+ 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;
-/***/ 267:
+/***/ },
+/* 375 */
/***/ function(module, exports, __webpack_require__) {
- var Component = __webpack_require__(3)(
+ var Component = __webpack_require__(5)(
/* script */
- __webpack_require__(268),
+ __webpack_require__(376),
/* template */
- __webpack_require__(269),
+ __webpack_require__(380),
/* styles */
null,
/* scopeId */
@@ -63098,76 +62603,64 @@ module.exports =
/***/ },
-
-/***/ 268:
+/* 376 */
/***/ 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],
+ var _button = __webpack_require__(31);
- props: {
- placement: {
- default: 'bottom-start'
- },
+ var _button2 = _interopRequireDefault(_button);
- boundariesPadding: {
- default: 0
- },
+ var _emitter = __webpack_require__(15);
- popperOptions: {
- default: function _default() {
- return {
- forceAbsolute: true,
- gpuAcceleration: false
- };
- }
- }
- },
+ var _emitter2 = _interopRequireDefault(_emitter);
- data: function data() {
- return {
- minWidth: ''
- };
- },
+ var _locale = __webpack_require__(10);
+ var _locale2 = _interopRequireDefault(_locale);
- computed: {
- popperClass: function popperClass() {
- return this.$parent.popperClass;
- }
- },
+ var _transferPanel = __webpack_require__(377);
- watch: {
- '$parent.inputWidth': function $parentInputWidth() {
- this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
- }
- },
+ var _transferPanel2 = _interopRequireDefault(_transferPanel);
- mounted: function mounted() {
- var _this = this;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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);
- }
- }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
//
//
//
@@ -63177,2149 +62670,1847 @@ module.exports =
//
//
-/***/ },
+ exports.default = {
+ name: 'ElTransfer',
-/***/ 269:
-/***/ function(module, exports) {
+ mixins: [_emitter2.default, _locale2.default],
- 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__(26);
-
-/***/ },
-
-/***/ 271:
-/***/ function(module, exports) {
+ components: {
+ TransferPanel: _transferPanel2.default,
+ ElButton: _button2.default
+ },
- 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": !_vm.disabled,
- "hit": item.hitState,
- "type": "primary",
- "close-transition": ""
- },
- on: {
- "close": function($event) {
- _vm.deleteTag($event, item)
- }
+ props: {
+ data: {
+ type: Array,
+ default: function _default() {
+ return [];
}
- }, [_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)
+ titles: {
+ type: Array,
+ default: function _default() {
+ return [];
+ }
},
- 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
+ buttonTexts: {
+ type: Array,
+ default: function _default() {
+ return [];
}
- }
- }) : _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
+ filterPlaceholder: {
+ type: String,
+ default: ''
},
- 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
+ filterMethod: Function,
+ leftDefaultChecked: {
+ type: Array,
+ default: function _default() {
+ return [];
}
},
- model: {
- value: (_vm.selectedLabel),
- callback: function($$v) {
- _vm.selectedLabel = $$v
- },
- expression: "selectedLabel"
- }
- }), _c('transition', {
- attrs: {
- "name": "el-zoom-in-top"
+ rightDefaultChecked: {
+ type: Array,
+ default: function _default() {
+ return [];
+ }
},
- 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
+ renderContent: Function,
+ value: {
+ type: Array,
+ default: function _default() {
+ return [];
+ }
},
- 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": ""
+ footerFormat: {
+ type: Object,
+ default: function _default() {
+ return {};
+ }
+ },
+ filterable: Boolean,
+ props: {
+ type: Object,
+ default: function _default() {
+ return {
+ label: 'label',
+ key: 'key',
+ disabled: 'disabled'
+ };
+ }
}
- }) : _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: []}
-
-/***/ }
+ },
-/******/ });
+ data: function data() {
+ return {
+ leftChecked: [],
+ rightChecked: []
+ };
+ },
-/***/ }),
-/* 42 */
-/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+ 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;
-exports.__esModule = true;
+ return this.data.filter(function (item) {
+ return _this2.value.indexOf(item[_this2.props.key]) > -1;
+ });
+ }
+ },
-var _vue = __webpack_require__(3);
+ watch: {
+ value: function value(val) {
+ this.dispatch('ElFormItem', 'el.form.change', val);
+ }
+ },
-var _vue2 = _interopRequireDefault(_vue);
+ 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 _dom = __webpack_require__(4);
+ 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);
+ }
+ }
+ };
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+/***/ },
+/* 377 */
+/***/ function(module, exports, __webpack_require__) {
-var hasModal = false;
+ var Component = __webpack_require__(5)(
+ /* script */
+ __webpack_require__(378),
+ /* template */
+ __webpack_require__(379),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
-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;
+ module.exports = Component.exports
- modalDom.addEventListener('touchmove', function (event) {
- event.preventDefault();
- event.stopPropagation();
- });
- modalDom.addEventListener('click', function () {
- PopupManager.doOnModalClick && PopupManager.doOnModalClick();
- });
- }
+/***/ },
+/* 378 */
+/***/ function(module, exports, __webpack_require__) {
- return modalDom;
-};
+ 'use strict';
-var instances = {};
+ exports.__esModule = true;
-var PopupManager = {
- zIndex: 2000,
+ var _checkboxGroup = __webpack_require__(143);
- modalFade: true,
+ var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
- getInstance: function getInstance(id) {
- return instances[id];
- },
+ var _checkbox = __webpack_require__(130);
- register: function register(id, instance) {
- if (id && instance) {
- instances[id] = instance;
- }
- },
+ var _checkbox2 = _interopRequireDefault(_checkbox);
- deregister: function deregister(id) {
- if (id) {
- instances[id] = null;
- delete instances[id];
- }
- },
+ var _input = __webpack_require__(20);
- nextZIndex: function nextZIndex() {
- return PopupManager.zIndex++;
- },
+ var _input2 = _interopRequireDefault(_input);
- modalStack: [],
+ var _locale = __webpack_require__(10);
- doOnModalClick: function doOnModalClick() {
- var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1];
- if (!topItem) return;
+ var _locale2 = _interopRequireDefault(_locale);
- var instance = PopupManager.getInstance(topItem.id);
- if (instance && instance.closeOnClickModal) {
- instance.close();
- }
- },
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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;
+ exports.default = {
+ mixins: [_locale2.default],
- for (var i = 0, j = modalStack.length; i < j; i++) {
- var item = modalStack[i];
- if (item.id === id) {
- return;
- }
- }
+ name: 'ElTransferPanel',
- var modalDom = getModal();
+ componentName: 'ElTransferPanel',
- (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);
+ 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]]
+ );
+ }
+ }
+ },
- if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) {
- dom.parentNode.appendChild(modalDom);
- } else {
- document.body.appendChild(modalDom);
- }
+ props: {
+ data: {
+ type: Array,
+ default: function _default() {
+ return [];
+ }
+ },
+ renderContent: Function,
+ placeholder: String,
+ title: String,
+ filterable: Boolean,
+ footerFormat: Object,
+ filterMethod: Function,
+ defaultChecked: Array,
+ props: Object
+ },
- if (zIndex) {
- modalDom.style.zIndex = zIndex;
- }
- modalDom.style.display = '';
+ data: function data() {
+ return {
+ checked: [],
+ allChecked: false,
+ query: '',
+ inputHover: false
+ };
+ },
- this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass });
- },
- closeModal: function closeModal(id) {
- var modalStack = this.modalStack;
- var modalDom = getModal();
+ watch: {
+ checked: function checked(val) {
+ this.updateAllChecked();
+ this.$emit('checked-change', val);
+ },
+ data: function data() {
+ var _this = this;
- 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);
- });
- }
+ 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();
+ },
- 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);
- }
- }
-};
+ defaultChecked: {
+ immediate: true,
+ handler: function handler(val, oldVal) {
+ var _this2 = this;
-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);
+ 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;
+ }
+ }
+ },
- return instance;
- }
-};
+ computed: {
+ filteredData: function filteredData() {
+ var _this3 = this;
-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();
+ 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;
- if (topPopup && topPopup.closeOnPressEscape) {
- topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
- }
- }
- });
-}
+ 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;
-exports.default = PopupManager;
+ 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: []}
+
+/***/ }
+/******/ ]);
/***/ }),
-/* 43 */
+/* 42 */
/***/ (function(module, exports, __webpack_require__) {
-"use strict";
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
+module.exports =
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
-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; };
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
-/**
- * @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.
- */
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
-//
-// 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 () {
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
- 'use strict';
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- var root = window;
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
- // default options
- var DEFAULTS = {
- // placement of the popper
- placement: 'bottom',
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
- gpuAcceleration: true,
- // shift popper from its origin by the given amount of pixels (can be negative)
- offset: 0,
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
- // the element which will act as boundary of the popper
- boundariesElement: 'viewport',
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
- // amount of pixel used to define a minimum distance between the boundaries and the popper
- boundariesPadding: 5,
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "/dist/";
- // 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'],
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ({
- // the behavior used by flip to change the placement of the popper
- flipBehavior: 'flip',
+/***/ 0:
+/***/ function(module, exports, __webpack_require__) {
- arrowElement: '[x-arrow]',
+ module.exports = __webpack_require__(264);
- // 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
- };
+/***/ 3:
+/***/ function(module, exports) {
- /**
- * 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 = {};
+ /* globals __VUE_SSR_CONTEXT__ */
- // 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;
- }
+ // this module is a runtime utility for cleaner component module output and will
+ // be included in the final webpack user bundle
- // with {} we create a new object with the options inside it
- this._options = Object.assign({}, DEFAULTS, options);
+ module.exports = function normalizeComponent (
+ rawScriptExports,
+ compiledTemplate,
+ injectStyles,
+ scopeId,
+ moduleIdentifier /* server only */
+ ) {
+ var esModule
+ var scriptExports = rawScriptExports = rawScriptExports || {}
- // refactoring modifiers' list
- this._options.modifiers = this._options.modifiers.map(function (modifier) {
- // remove ignored modifiers
- if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
+ // ES6 modules interop
+ var type = typeof rawScriptExports.default
+ if (type === 'object' || type === 'function') {
+ esModule = rawScriptExports
+ scriptExports = rawScriptExports.default
+ }
- // 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);
- }
+ // Vue.extend constructor export interop
+ var options = typeof scriptExports === 'function'
+ ? scriptExports.options
+ : scriptExports
- // return predefined modifier identified by string or keep the custom one
- return this.modifiers[modifier] || modifier;
- }.bind(this));
+ // render functions
+ if (compiledTemplate) {
+ options.render = compiledTemplate.render
+ options.staticRenderFns = compiledTemplate.staticRenderFns
+ }
- // 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 });
+ // scopedId
+ if (scopeId) {
+ options._scopeId = scopeId
+ }
- // fire the first update to position the popper in the right place
- this.update();
+ 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
+ }
- // setup event listeners, they will take care of update the position in specific situations
- this._setupEventListeners();
- return this;
- }
+ if (hook) {
+ // inject component registration as beforeCreate hook
+ var existing = options.beforeCreate
+ options.beforeCreate = existing
+ ? [].concat(existing, hook)
+ : [hook]
+ }
- //
- // 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();
+ return {
+ esModule: esModule,
+ exports: scriptExports,
+ options: options
+ }
+ }
- // 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;
+/***/ 9:
+/***/ function(module, exports) {
- // compute the popper and reference offsets and put them inside data.offsets
- data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
+ module.exports = __webpack_require__(11);
- // get boundaries
- data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
+/***/ },
- data = this.runModifiers(data, this._options.modifiers);
+/***/ 10:
+/***/ function(module, exports) {
- if (typeof this.state.updateCallback === 'function') {
- this.state.updateCallback(data);
- }
- };
+ module.exports = __webpack_require__(20);
- /**
- * 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;
- };
+/***/ 13:
+/***/ function(module, exports) {
- /**
- * 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);
+ module.exports = __webpack_require__(13);
- 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;
- }
+/***/ 14:
+/***/ function(module, exports) {
- if (config.arrowTagName) {
- var arrow = d.createElement(config.arrowTagName);
- addClassNames(arrow, config.arrowClassNames);
- addAttributes(arrow, config.arrowAttributes);
- popper.appendChild(arrow);
- }
+ module.exports = __webpack_require__(5);
- 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];
- }
+/***/ 15:
+/***/ function(module, exports) {
- // append the generated popper to its parent
- parent.appendChild(popper);
+ module.exports = __webpack_require__(22);
- 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);
- });
- }
+/***/ 46:
+/***/ function(module, exports) {
- /**
- * 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] || '');
- });
- }
- };
+ module.exports = __webpack_require__(15);
- /**
- * 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';
- }
+/***/ 60:
+/***/ function(module, exports) {
- // 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';
- };
+ module.exports = __webpack_require__(23);
- /**
- * 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';
+/***/ 61:
+/***/ function(module, exports) {
- //
- // Get reference element position
- //
- var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
+ module.exports = __webpack_require__(24);
- //
- // Get popper sizes
- //
- var popperRect = getOuterSizes(popper);
+/***/ },
- //
- // Compute offsets of popper
- //
+/***/ 62:
+/***/ function(module, exports) {
- // 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;
- }
- }
+ module.exports = __webpack_require__(16);
- // Add width and height to our offsets object
- popperOffsets.width = popperRect.width;
- popperOffsets.height = popperRect.height;
+/***/ },
- return {
- popper: popperOffsets,
- reference: referenceOffsets
- };
- };
+/***/ 63:
+/***/ function(module, exports) {
- /**
- * 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);
- }
- };
+ module.exports = __webpack_require__(9);
- /**
- * 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;
+/***/ 123:
+/***/ function(module, exports) {
- 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);
+ module.exports = __webpack_require__(4);
- 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;
- };
+/***/ 217:
+/***/ function(module, exports, __webpack_require__) {
- // 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);
+ var Component = __webpack_require__(3)(
+ /* script */
+ __webpack_require__(218),
+ /* template */
+ __webpack_require__(220),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- 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));
+ module.exports = Component.exports
- 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
- //
+/***/ 218:
+/***/ function(module, exports, __webpack_require__) {
- /**
- * Modifiers list
- * @namespace Popper.modifiers
- * @memberof Popper
- * @type {Object}
- */
- Popper.prototype.modifiers = {};
+ 'use strict';
- /**
- * 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
- };
+ exports.__esModule = true;
- // round top and left to avoid blurry text
- var left = Math.round(data.offsets.popper.left);
- var top = Math.round(data.offsets.popper.top);
+ 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; }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- // 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;
- }
+ var _emitter = __webpack_require__(14);
- // 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);
+ var _emitter2 = _interopRequireDefault(_emitter);
- setStyle(this._popper, styles);
+ var _util = __webpack_require__(219);
- // 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);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // 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);
- }
+ exports.default = {
+ mixins: [_emitter2.default],
- return data;
- };
+ name: 'ElOption',
- /**
- * 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];
+ componentName: 'ElOption',
- // if shift shiftVariation is specified, run the modifier
- if (shiftVariation) {
- var reference = data.offsets.reference;
- var popper = getPopperClientRect(data.offsets.popper);
+ props: {
+ value: {
+ required: true
+ },
+ label: [String, Number],
+ created: Boolean,
+ disabled: {
+ type: Boolean,
+ default: false
+ }
+ },
- 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 }
- }
- };
+ data: function data() {
+ return {
+ index: -1,
+ groupDisabled: false,
+ visible: true,
+ hitState: false
+ };
+ },
- var axis = ['bottom', 'top'].indexOf(basePlacement) !== -1 ? 'x' : 'y';
- data.offsets.popper = Object.assign(popper, shiftOffsets[axis][shiftVariation]);
- }
+ computed: {
+ isObject: function isObject() {
+ return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
+ },
+ 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;
+ }
+ }
+ },
- return data;
- };
+ 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');
+ }
+ },
- /**
- * 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);
+ 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 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 };
- }
- };
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var target = arguments[1];
- order.forEach(function (direction) {
- data.offsets.popper = Object.assign(popper, check[direction]());
- });
+ 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);
+ })
+ };
+ }();
- return data;
- };
+ 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;
- /**
- * 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;
+ this.$nextTick(function () {
+ _this2.index = _this2.parent.options.indexOf(_this2);
+ });
+ }
+ },
- 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);
- }
+ 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);
- return data;
- };
+ this.$on('queryChange', this.queryChange);
+ this.$on('handleGroupDisabled', this.handleGroupDisabled);
+ this.$on('resetIndex', this.resetIndex);
+ },
+ beforeDestroy: function beforeDestroy() {
+ this.dispatch('ElSelect', 'onOptionDestroy', this);
+ }
+ };
- /**
- * 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;
- }
+/***/ 219:
+/***/ function(module, exports) {
- var placement = data.placement.split('-')[0];
- var placementOpposite = getOppositePlacement(placement);
- var variation = data.placement.split('-')[1] || '';
+ module.exports = __webpack_require__(6);
- 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;
- }
+/***/ 220:
+/***/ function(module, exports) {
- placement = data.placement.split('-')[0];
- placementOpposite = getOppositePlacement(placement);
+ 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: []}
- 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;
+/***/ 264:
+/***/ function(module, exports, __webpack_require__) {
- // 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;
+ 'use strict';
- data = this.runModifiers(data, this._options.modifiers, this._flip);
- }
- }.bind(this));
- return data;
- };
+ exports.__esModule = true;
- /**
- * 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;
+ var _select = __webpack_require__(265);
- 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;
- };
+ var _select2 = _interopRequireDefault(_select);
- /**
- * 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;
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- // if the arrowElement is a string, suppose it's a CSS selector
- if (typeof arrow === 'string') {
- arrow = this._popper.querySelector(arrow);
- }
+ /* istanbul ignore next */
+ _select2.default.install = function (Vue) {
+ Vue.component(_select2.default.name, _select2.default);
+ };
- // if arrow element is not found, don't run the modifier
- if (!arrow) {
- return data;
- }
+ exports.default = _select2.default;
- // 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;
- }
+/***/ 265:
+/***/ function(module, exports, __webpack_require__) {
- 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 Component = __webpack_require__(3)(
+ /* script */
+ __webpack_require__(266),
+ /* template */
+ __webpack_require__(271),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- 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];
+ module.exports = Component.exports
- //
- // 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;
+/***/ 266:
+/***/ function(module, exports, __webpack_require__) {
- var sideValue = center - popper[side];
+ 'use strict';
- // 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
+ exports.__esModule = true;
- data.offsets.arrow = arrowStyle;
- data.arrowElement = arrow;
+ 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; }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
- return data;
- };
+ var _emitter = __webpack_require__(14);
- //
- // Helpers
- //
+ var _emitter2 = _interopRequireDefault(_emitter);
- /**
- * 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;
+ var _locale = __webpack_require__(61);
- // 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 };
+ var _locale2 = _interopRequireDefault(_locale);
- // reset element styles
- element.style.display = _display;element.style.visibility = _visibility;
- return result;
- }
+ var _input = __webpack_require__(9);
- /**
- * 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];
- });
- }
+ var _input2 = _interopRequireDefault(_input);
- /**
- * 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;
- }
+ var _selectDropdown = __webpack_require__(267);
- /**
- * 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;
- }
+ var _selectDropdown2 = _interopRequireDefault(_selectDropdown);
- /**
- * 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];
- }
+ var _option = __webpack_require__(217);
- /**
- * 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;
- }
+ var _option2 = _interopRequireDefault(_option);
- /**
- * Returns the scrolling parent of the given element
- * @function
- * @ignore
- * @argument {Element} element
- * @returns {Element} offset parent
- */
- function getScrollParent(element) {
- var parent = element.parentNode;
+ var _tag = __webpack_require__(270);
- if (!parent) {
- return element;
- }
+ var _tag2 = _interopRequireDefault(_tag);
- 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;
- }
- }
+ var _scrollbar = __webpack_require__(15);
- // 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);
- }
+ var _scrollbar2 = _interopRequireDefault(_scrollbar);
- /**
- * 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;
- }
+ var _debounce = __webpack_require__(63);
- /**
- * 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;
- });
- }
+ var _debounce2 = _interopRequireDefault(_debounce);
- /**
- * 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]';
- }
+ var _clickoutside = __webpack_require__(10);
- /**
- * 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
- };
+ var _clickoutside2 = _interopRequireDefault(_clickoutside);
- elementRect.right = elementRect.left + elementRect.width;
- elementRect.bottom = elementRect.top + elementRect.height;
+ var _dom = __webpack_require__(123);
- // position
- return elementRect;
- }
+ var _resizeEvent = __webpack_require__(46);
- /**
- * Get bounding client rect of given element
- * @function
- * @ignore
- * @param {HTMLElement} element
- * @return {Object} client rect
- */
- function getBoundingClientRect(element) {
- var rect = element.getBoundingClientRect();
+ var _locale3 = __webpack_require__(62);
- // whether the IE version is lower than 11
- var isIE = navigator.userAgent.indexOf("MSIE") != -1;
+ var _scrollIntoView = __webpack_require__(60);
- // fix ie document bounding top always 0 bug
- var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
+ var _scrollIntoView2 = _interopRequireDefault(_scrollIntoView);
- return {
- left: rect.left,
- top: rectTop,
- right: rect.right,
- bottom: rect.bottom,
- width: rect.right - rect.left,
- height: rect.bottom - rectTop
- };
- }
+ var _util = __webpack_require__(219);
- /**
- * 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);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- if (fixed) {
- var scrollParent = getScrollParent(parent);
- parentRect.top += scrollParent.scrollTop;
- parentRect.bottom += scrollParent.scrollTop;
- parentRect.left += scrollParent.scrollLeft;
- parentRect.right += scrollParent.scrollLeft;
- }
+ var sizeMap = {
+ 'large': 42,
+ 'small': 30,
+ 'mini': 22
+ };
- 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;
- }
+ exports.default = {
+ mixins: [_emitter2.default, _locale2.default],
- /**
- * 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'];
+ name: 'ElSelect',
- 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;
- }
+ componentName: 'ElSelect',
- /**
- * 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');
- }
+ 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 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 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;
+ }
+ },
- 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;
- }
- });
- }
+ components: {
+ ElInput: _input2.default,
+ ElSelectMenu: _selectDropdown2.default,
+ ElOption: _option2.default,
+ ElTag: _tag2.default,
+ ElScrollbar: _scrollbar2.default
+ },
- return Popper;
-});
-
-/***/ }),
-/* 44 */
-/***/ (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} 项'
- }
- }
-};
-
-/***/ }),
-/* 45 */
-/***/ (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;
-
-
-/***/ }),
-/* 46 */
-/***/ (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
- */
-
-/***/ }),
-/* 47 */
-/***/ (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;
-/******/ }
+ 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'
+ }
+ },
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+ 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: ''
+ };
+ },
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
+ 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;
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ({
+ 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;
-/***/ 0:
-/***/ function(module, exports, __webpack_require__) {
+ 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();
+ }
+ }
+ },
- module.exports = __webpack_require__(216);
+ 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(option) {
+ var target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
+ if (this.$refs.popper && target) {
+ var menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
+ (0, _scrollIntoView2.default)(menu, target);
+ }
+ },
+ handleMenuEnter: function handleMenuEnter() {
+ var _this4 = this;
+ this.$nextTick(function () {
+ return _this4.scrollToOption(_this4.selected);
+ });
+ },
+ getOption: function getOption(value) {
+ var option = void 0;
+ var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
+ 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;
-/***/ 3:
-/***/ function(module, exports) {
+ if (hit === true || hit === false) {
+ option.hitState = hit;
+ return hit;
+ }
- /* globals __VUE_SSR_CONTEXT__ */
+ 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 module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
+ 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;
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
+ 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;
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
+ 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(option);
+ });
+ },
+ getValueIndex: function getValueIndex() {
+ var _this9 = this;
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var value = arguments[1];
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
+ var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
+ 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
+ };
+ }();
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
+ 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;
- 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__
+ if (!this.visible) {
+ this.visible = true;
+ return;
}
- // inject component styles
- if (injectStyles) {
- injectStyles.call(this, context)
+ 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');
+ }
+ }
}
- // register component module identifier for async chunk inferrence
- if (context && context._registeredComponents) {
- context._registeredComponents.add(moduleIdentifier)
+ this.$nextTick(function () {
+ return _this10.scrollToOption(_this10.options[_this10.hoverIndex]);
+ });
+ },
+ 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);
}
}
- // 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;
+ created: function created() {
+ var _this11 = this;
- var _option = __webpack_require__(217);
+ 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();
- var _option2 = _interopRequireDefault(_option);
+ this.debouncedOnInputChange = (0, _debounce2.default)(this.debounce, function () {
+ _this11.onInputChange();
+ });
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ this.$on('handleOptionClick', this.handleOptionSelect);
+ this.$on('onOptionDestroy', this.onOptionDestroy);
+ this.$on('setSelected', this.setSelected);
+ },
+ mounted: function mounted() {
+ var _this12 = this;
- /* istanbul ignore next */
- _option2.default.install = function (Vue) {
- Vue.component(_option2.default.name, _option2.default);
+ 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);
+ }
};
- exports.default = _option2.default;
-
/***/ },
-/***/ 217:
+/***/ 267:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
- __webpack_require__(218),
+ __webpack_require__(268),
/* template */
- __webpack_require__(220),
+ __webpack_require__(269),
/* styles */
null,
/* scopeId */
@@ -65333,220 +64524,308 @@ module.exports =
/***/ },
-/***/ 218:
+/***/ 268:
/***/ 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 _vuePopper = __webpack_require__(13);
- var _util = __webpack_require__(219);
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
- mixins: [_emitter2.default],
+ name: 'ElSelectDropdown',
- name: 'ElOption',
+ componentName: 'ElSelectDropdown',
- componentName: 'ElOption',
+ mixins: [_vuePopper2.default],
props: {
- value: {
- required: true
+ placement: {
+ default: 'bottom-start'
},
- 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() {
- return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
- },
- 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);
- }
+ boundariesPadding: {
+ default: 0
},
- limitReached: function limitReached() {
- if (this.parent.multiple) {
- return !this.itemSelected && this.parent.value.length >= this.parent.multipleLimit && this.parent.multipleLimit > 0;
- } else {
- return false;
+
+ popperOptions: {
+ default: function _default() {
+ return {
+ forceAbsolute: true,
+ gpuAcceleration: 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');
- }
+ data: function data() {
+ return {
+ minWidth: ''
+ };
},
- 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;
+ computed: {
+ popperClass: function popperClass() {
+ return this.$parent.popperClass;
+ }
+ },
- this.$nextTick(function () {
- _this2.index = _this2.parent.options.indexOf(_this2);
- });
+ watch: {
+ '$parent.inputWidth': function $parentInputWidth() {
+ this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
}
},
- 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);
+ mounted: function mounted() {
+ var _this = this;
- this.$on('queryChange', this.queryChange);
- this.$on('handleGroupDisabled', this.handleGroupDisabled);
- this.$on('resetIndex', this.resetIndex);
- },
- beforeDestroy: function beforeDestroy() {
- this.dispatch('ElSelect', 'onOptionDestroy', 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);
}
- };
+ }; //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
/***/ },
-/***/ 219:
+/***/ 269:
/***/ function(module, exports) {
- module.exports = __webpack_require__(6);
+ 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: []}
/***/ },
-/***/ 220:
+/***/ 270:
+/***/ function(module, exports) {
+
+ module.exports = __webpack_require__(26);
+
+/***/ },
+
+/***/ 271:
/***/ function(module, exports) {
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('li', {
+ return _c('div', {
directives: [{
- name: "show",
- rawName: "v-show",
- value: (_vm.visible),
- expression: "visible"
+ name: "clickoutside",
+ rawName: "v-clickoutside",
+ value: (_vm.handleClose),
+ expression: "handleClose"
}],
- staticClass: "el-select-dropdown__item",
- class: {
- 'selected': _vm.itemSelected,
- 'is-disabled': _vm.disabled || _vm.groupDisabled || _vm.limitReached,
- 'hover': _vm.parent.hoverIndex === _vm.index
- },
+ staticClass: "el-select"
+ }, [(_vm.multiple) ? _c('div', {
+ ref: "tags",
+ staticClass: "el-select__tags",
+ style: ({
+ 'max-width': _vm.inputWidth - 32 + 'px'
+ }),
on: {
- "mouseenter": _vm.hoverItem,
"click": function($event) {
$event.stopPropagation();
- _vm.selectOptionClick($event)
+ _vm.toggleMenu($event)
}
}
- }, [_vm._t("default", [_c('span', [_vm._v(_vm._s(_vm.currentLabel))])])], 2)
+ }, [_c('transition-group', {
+ on: {
+ "after-leave": _vm.resetInputHeight
+ }
+ }, _vm._l((_vm.selected), function(item) {
+ return _c('el-tag', {
+ key: _vm.getValueKey(item),
+ attrs: {
+ "closable": !_vm.disabled,
+ "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: []}
/***/ }
@@ -65554,1069 +64833,1742 @@ module.exports =
/******/ });
/***/ }),
-/* 48 */
-/***/ (function(module, exports) {
+/* 43 */
+/***/ (function(module, exports, __webpack_require__) {
-module.exports =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
+"use strict";
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
+exports.__esModule = true;
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
+var _vue = __webpack_require__(3);
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+var _vue2 = _interopRequireDefault(_vue);
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
+var _dom = __webpack_require__(4);
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
+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);
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+ return instance;
+ }
+};
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
+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();
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
+ if (topPopup && topPopup.closeOnPressEscape) {
+ topPopup.handleClose ? topPopup.handleClose() : topPopup.handleAction ? topPopup.handleAction('cancel') : topPopup.close();
+ }
+ }
+ });
+}
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ({
+exports.default = PopupManager;
-/***/ 0:
-/***/ function(module, exports, __webpack_require__) {
+/***/ }),
+/* 44 */
+/***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(30);
+"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.
+ */
-/***/ 3:
-/***/ function(module, exports) {
+//
+// 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 () {
- /* globals __VUE_SSR_CONTEXT__ */
+ 'use strict';
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
+ var root = window;
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
+ // default options
+ var DEFAULTS = {
+ // placement of the popper
+ placement: 'bottom',
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
+ gpuAcceleration: true,
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
+ // shift popper from its origin by the given amount of pixels (can be negative)
+ offset: 0,
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
+ // the element which will act as boundary of the popper
+ boundariesElement: 'viewport',
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
+ // amount of pixel used to define a minimum distance between the boundaries and the popper
+ boundariesPadding: 5,
- 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
- }
+ // 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'],
- if (hook) {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
+ // the behavior used by flip to change the placement of the popper
+ flipBehavior: 'flip',
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
+ 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: [],
-/***/ 30:
-/***/ function(module, exports, __webpack_require__) {
+ forceAbsolute: false
+ };
- 'use strict';
+ /**
+ * 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 = {};
- exports.__esModule = true;
+ // 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;
+ }
- var _button = __webpack_require__(31);
+ // with {} we create a new object with the options inside it
+ this._options = Object.assign({}, DEFAULTS, options);
- var _button2 = _interopRequireDefault(_button);
+ // refactoring modifiers' list
+ this._options.modifiers = this._options.modifiers.map(function (modifier) {
+ // remove ignored modifiers
+ if (this._options.modifiersIgnored.indexOf(modifier) !== -1) return;
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ // 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);
+ }
- /* istanbul ignore next */
- _button2.default.install = function (Vue) {
- Vue.component(_button2.default.name, _button2.default);
- };
+ // return predefined modifier identified by string or keep the custom one
+ return this.modifiers[modifier] || modifier;
+ }.bind(this));
- exports.default = _button2.default;
+ // 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();
-/***/ 31:
-/***/ function(module, exports, __webpack_require__) {
+ // setup event listeners, they will take care of update the position in specific situations
+ this._setupEventListeners();
+ return this;
+ }
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(32),
- /* template */
- __webpack_require__(33),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ //
+ // 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();
- module.exports = Component.exports
+ // 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;
-/***/ 32:
-/***/ function(module, exports) {
+ // compute the popper and reference offsets and put them inside data.offsets
+ data.offsets = this._getOffsets(this._popper, this._reference, data.placement);
- 'use strict';
+ // get boundaries
+ data.boundaries = this._getBoundaries(data, this._options.boundariesPadding, this._options.boundariesElement);
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ data = this.runModifiers(data, this._options.modifiers);
- exports.default = {
- name: 'ElButton',
+ if (typeof this.state.updateCallback === 'function') {
+ this.state.updateCallback(data);
+ }
+ };
- 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
- },
+ /**
+ * 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;
+ };
- methods: {
- handleClick: function handleClick(evt) {
- this.$emit('click', evt);
- },
- handleInnerClick: function handleInnerClick(evt) {
- if (this.disabled) {
- evt.stopPropagation();
- }
- }
- }
- };
+ /**
+ * 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);
-/***/ 33:
-/***/ function(module, exports) {
+ var d = root.document;
- 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",
- on: {
- "click": _vm.handleInnerClick
- }
- }) : _vm._e(), (_vm.icon && !_vm.loading) ? _c('i', {
- class: 'el-icon-' + _vm.icon,
- on: {
- "click": _vm.handleInnerClick
- }
- }) : _vm._e(), (_vm.$slots.default) ? _c('span', {
- on: {
- "click": _vm.handleInnerClick
- }
- }, [_vm._t("default")], 2) : _vm._e()])
- },staticRenderFns: []}
+ 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;
-/***/ }),
-/* 49 */
-/***/ (function(module, exports) {
+ // 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];
+ }
-module.exports =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
+ // append the generated popper to its parent
+ parent.appendChild(popper);
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
+ return popper;
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
+ /**
+ * 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);
+ });
+ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
+ /**
+ * 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] || '');
+ });
+ }
+ };
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+ /**
+ * 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);
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
+ if (this._options.forceAbsolute) {
+ return 'absolute';
+ }
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
+ // 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 = {};
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+ popperOffsets.position = this.state.position;
+ var isParentFixed = popperOffsets.position === 'fixed';
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
+ //
+ // Get reference element position
+ //
+ var referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
+ //
+ // Get popper sizes
+ //
+ var popperRect = getOuterSizes(popper);
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ({
+ //
+ // Compute offsets of popper
+ //
-/***/ 0:
-/***/ function(module, exports, __webpack_require__) {
+ // 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;
+ }
+ }
- module.exports = __webpack_require__(34);
+ // 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);
+ }
+ };
-/***/ 3:
-/***/ function(module, exports) {
+ /**
+ * 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;
+ };
- /* globals __VUE_SSR_CONTEXT__ */
+ /**
+ * 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;
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
+ 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);
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
+ 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);
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
+ // 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;
+ };
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
+ // 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);
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
+ 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;
+ };
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
+ /**
+ * 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));
+ }
- 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
- }
+ modifiersToRun.forEach(function (modifier) {
+ if (isFunction(modifier)) {
+ data = modifier.call(this, data);
+ }
+ }.bind(this));
- if (hook) {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
+ return data;
+ };
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
+ /**
+ * 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 = {};
-/***/ 34:
-/***/ function(module, exports, __webpack_require__) {
+ /**
+ * 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
+ };
- 'use strict';
+ // round top and left to avoid blurry text
+ var left = Math.round(data.offsets.popper.left);
+ var top = Math.round(data.offsets.popper.top);
- exports.__esModule = true;
+ // 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;
+ }
- var _buttonGroup = __webpack_require__(35);
+ // 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);
- var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
+ setStyle(this._popper, styles);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ // 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);
- /* istanbul ignore next */
- _buttonGroup2.default.install = function (Vue) {
- Vue.component(_buttonGroup2.default.name, _buttonGroup2.default);
- };
+ // 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);
+ }
- exports.default = _buttonGroup2.default;
+ 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];
-/***/ 35:
-/***/ function(module, exports, __webpack_require__) {
+ // if shift shiftVariation is specified, run the modifier
+ if (shiftVariation) {
+ var reference = data.offsets.reference;
+ var popper = getPopperClientRect(data.offsets.popper);
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(36),
- /* template */
- __webpack_require__(37),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+ 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 }
+ }
+ };
- module.exports = Component.exports
+ 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;
+ };
-/***/ 36:
-/***/ function(module, exports) {
+ /**
+ * 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;
- 'use strict';
+ 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);
+ }
- exports.__esModule = true;
- //
- //
- //
- //
- //
+ return data;
+ };
- /**
- * button
- * @module components/basic/menu
- * @desc 用于按钮组
- * @param {string} label - 名称
- */
- exports.default = {
- name: 'ElButtonGroup'
- };
+ /**
+ * 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;
+ }
-/***/ 37:
-/***/ function(module, exports) {
+ var placement = data.placement.split('-')[0];
+ var placementOpposite = getOppositePlacement(placement);
+ var variation = data.placement.split('-')[1] || '';
- 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: []}
+ 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);
-/***/ }),
-/* 50 */
-/***/ (function(module, exports, __webpack_require__) {
+ var popperOffsets = getPopperClientRect(data.offsets.popper);
-"use strict";
+ // 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;
-exports.__esModule = true;
+ data = this.runModifiers(data, this._options.modifiers, this._flip);
+ }
+ }.bind(this));
+ return data;
+ };
-var _dom = __webpack_require__(4);
+ /**
+ * 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;
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+ 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;
+ };
-var Transition = function () {
- function Transition() {
- _classCallCheck(this, Transition);
- }
+ /**
+ * 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;
- Transition.prototype.beforeEnter = function beforeEnter(el) {
- (0, _dom.addClass)(el, 'collapse-transition');
- if (!el.dataset) el.dataset = {};
+ // if the arrowElement is a string, suppose it's a CSS selector
+ if (typeof arrow === 'string') {
+ arrow = this._popper.querySelector(arrow);
+ }
- el.dataset.oldPaddingTop = el.style.paddingTop;
- el.dataset.oldPaddingBottom = el.style.paddingBottom;
+ // if arrow element is not found, don't run the modifier
+ if (!arrow) {
+ return data;
+ }
- el.style.height = '0';
- el.style.paddingTop = 0;
- el.style.paddingBottom = 0;
- };
+ // 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;
+ }
- 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;
- }
+ // 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;
+ }
- el.style.overflow = 'hidden';
- };
+ 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;
- 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;
- };
+ 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];
- 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;
+ //
+ // extends keepTogether behavior making sure the popper and its reference have enough pixels in conjuction
+ //
- el.style.height = el.scrollHeight + 'px';
- el.style.overflow = 'hidden';
- };
+ // 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];
+ }
- 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;
- }
- };
+ // compute center of the popper
+ var center = reference[side] + reference[len] / 2 - arrowSize / 2;
- 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;
- };
+ var sideValue = center - popper[side];
- return Transition;
-}();
+ // 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
-exports.default = {
- name: 'ElCollapseTransition',
- functional: true,
- render: function render(h, _ref) {
- var children = _ref.children;
+ data.offsets.arrow = arrowStyle;
+ data.arrowElement = arrow;
- var data = {
- on: new Transition()
+ return data;
};
- return h('transition', data, children);
- }
-};
-
-/***/ }),
-/* 51 */
-/***/ (function(module, exports, __webpack_require__) {
-
-module.exports =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
+ //
+ // Helpers
+ //
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
+ /**
+ * 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;
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
+ // 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 };
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+ // reset element styles
+ element.style.display = _display;element.style.visibility = _visibility;
+ return result;
+ }
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
+ /**
+ * 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];
+ });
+ }
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
+ /**
+ * 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;
+ }
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+ /**
+ * 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];
+ }
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
+ /**
+ * 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;
+ }
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
+ /**
+ * Returns the scrolling parent of the given element
+ * @function
+ * @ignore
+ * @argument {Element} element
+ * @returns {Element} offset parent
+ */
+ function getScrollParent(element) {
+ var parent = element.parentNode;
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ({
+ if (!parent) {
+ return element;
+ }
-/***/ 0:
-/***/ function(module, exports, __webpack_require__) {
+ 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;
+ }
+ }
- module.exports = __webpack_require__(65);
+ // 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;
+ });
+ }
-/***/ 3:
-/***/ function(module, exports) {
+ /**
+ * 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]';
+ }
- /* globals __VUE_SSR_CONTEXT__ */
+ /**
+ * 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
+ };
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
+ elementRect.right = elementRect.left + elementRect.width;
+ elementRect.bottom = elementRect.top + elementRect.height;
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
+ // position
+ return elementRect;
+ }
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
+ /**
+ * Get bounding client rect of given element
+ * @function
+ * @ignore
+ * @param {HTMLElement} element
+ * @return {Object} client rect
+ */
+ function getBoundingClientRect(element) {
+ var rect = element.getBoundingClientRect();
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
+ // whether the IE version is lower than 11
+ var isIE = navigator.userAgent.indexOf("MSIE") != -1;
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
+ // fix ie document bounding top always 0 bug
+ var rectTop = isIE && element.tagName === 'HTML' ? -element.scrollTop : rect.top;
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
+ return {
+ left: rect.left,
+ top: rectTop,
+ right: rect.right,
+ bottom: rect.bottom,
+ width: rect.right - rect.left,
+ height: rect.bottom - rectTop
+ };
+ }
- 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
- }
+ /**
+ * 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 (hook) {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
+ if (fixed) {
+ var scrollParent = getScrollParent(parent);
+ parentRect.top += scrollParent.scrollTop;
+ parentRect.bottom += scrollParent.scrollTop;
+ parentRect.left += scrollParent.scrollLeft;
+ parentRect.right += scrollParent.scrollLeft;
+ }
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
+ 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;
+ }
-/***/ 14:
-/***/ function(module, exports) {
+ /**
+ * 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');
+ }
- module.exports = __webpack_require__(5);
+ 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;
+ }
+ });
+ }
-/***/ 65:
-/***/ function(module, exports, __webpack_require__) {
+ return Popper;
+});
- 'use strict';
+/***/ }),
+/* 45 */
+/***/ (function(module, exports, __webpack_require__) {
- exports.__esModule = true;
+"use strict";
- var _checkbox = __webpack_require__(66);
- var _checkbox2 = _interopRequireDefault(_checkbox);
+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} 项'
+ }
+ }
+};
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+/***/ }),
+/* 46 */
+/***/ (function(module, exports, __webpack_require__) {
- /* istanbul ignore next */
- _checkbox2.default.install = function (Vue) {
- Vue.component(_checkbox2.default.name, _checkbox2.default);
- };
+"use strict";
- exports.default = _checkbox2.default;
-/***/ },
+var index$2 = function isMergeableObject(value) {
+ return isNonNullObject(value) && isNotSpecial(value)
+};
-/***/ 66:
-/***/ function(module, exports, __webpack_require__) {
+function isNonNullObject(value) {
+ return !!value && typeof value === 'object'
+}
- var Component = __webpack_require__(3)(
- /* script */
- __webpack_require__(67),
- /* template */
- __webpack_require__(68),
- /* styles */
- null,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
+function isNotSpecial(value) {
+ var stringValue = Object.prototype.toString.call(value);
- module.exports = Component.exports
+ 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
+}
-/***/ 67:
-/***/ function(module, exports, __webpack_require__) {
+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
+}
- 'use strict';
+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
+}
- exports.__esModule = true;
+function deepmerge(target, source, optionsArgument) {
+ var sourceIsArray = Array.isArray(source);
+ var targetIsArray = Array.isArray(target);
+ var options = optionsArgument || { arrayMerge: defaultArrayMerge };
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
- var _emitter = __webpack_require__(14);
+ 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)
+ }
+}
- var _emitter2 = _interopRequireDefault(_emitter);
+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')
+ }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+ // 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)
+ })
+};
- exports.default = {
- name: 'ElCheckbox',
+var index = deepmerge;
- mixins: [_emitter2.default],
+module.exports = index;
- componentName: 'ElCheckbox',
- data: function data() {
- return {
- selfModel: false,
- focus: false
- };
- },
+/***/ }),
+/* 47 */
+/***/ (function(module, exports, __webpack_require__) {
+"use strict";
- 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);
+exports.__esModule = true;
- isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
- } else {
- this.$emit('input', val);
- this.selfModel = val;
- }
- }
- },
+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; };
- 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;
- }
- },
+exports.default = function (Vue) {
- props: {
- value: {},
- label: {},
- indeterminate: Boolean,
- disabled: Boolean,
- checked: Boolean,
- name: String,
- trueLabel: [String, Number],
- falseLabel: [String, Number]
- },
+ /**
+ * template
+ *
+ * @param {String} string
+ * @param {Array} ...args
+ * @return {String}
+ */
- 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;
+ 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];
+ }
- this.$emit('change', ev);
- if (this.isGroup) {
- this.$nextTick(function (_) {
- _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
- });
- }
- }
- },
+ if (args.length === 1 && _typeof(args[0]) === 'object') {
+ args = args[0];
+ }
- created: function created() {
- this.checked && this.addToStore();
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ if (!args || !args.hasOwnProperty) {
+ args = {};
+ }
-/***/ },
+ return string.replace(RE_NARGS, function (match, prefix, i, index) {
+ var result = void 0;
-/***/ 68:
-/***/ function(module, exports) {
+ 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 '';
+ }
- 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: []}
+ 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
+ */
/***/ }),
-/* 52 */
+/* 48 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
@@ -66667,241 +66619,368 @@ module.exports =
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(345);
+ module.exports = __webpack_require__(216);
/***/ },
-/***/ 13:
+/***/ 3:
/***/ function(module, exports) {
- module.exports = __webpack_require__(13);
+ /* 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
-/***/ 55:
-/***/ function(module, exports) {
+ module.exports = function normalizeComponent (
+ rawScriptExports,
+ compiledTemplate,
+ injectStyles,
+ scopeId,
+ moduleIdentifier /* server only */
+ ) {
+ var esModule
+ var scriptExports = rawScriptExports = rawScriptExports || {}
- module.exports = __webpack_require__(3);
+ // 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
-/***/ 63:
-/***/ function(module, exports) {
+ // 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
+ }
+ }
- module.exports = __webpack_require__(9);
/***/ },
-/***/ 197:
+/***/ 14:
/***/ function(module, exports) {
- module.exports = __webpack_require__(27);
+ module.exports = __webpack_require__(5);
/***/ },
-/***/ 345:
+/***/ 216:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _main = __webpack_require__(346);
+ var _option = __webpack_require__(217);
- var _main2 = _interopRequireDefault(_main);
+ var _option2 = _interopRequireDefault(_option);
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);
+ _option2.default.install = function (Vue) {
+ Vue.component(_option2.default.name, _option2.default);
};
- exports.default = _main2.default;
+ exports.default = _option2.default;
/***/ },
-/***/ 346:
+/***/ 217:
/***/ function(module, exports, __webpack_require__) {
- 'use strict';
+ var Component = __webpack_require__(3)(
+ /* script */
+ __webpack_require__(218),
+ /* template */
+ __webpack_require__(220),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
- exports.__esModule = true;
+ module.exports = Component.exports
- var _vuePopper = __webpack_require__(13);
- var _vuePopper2 = _interopRequireDefault(_vuePopper);
+/***/ },
- var _debounce = __webpack_require__(63);
+/***/ 218:
+/***/ function(module, exports, __webpack_require__) {
- var _debounce2 = _interopRequireDefault(_debounce);
+ 'use strict';
- var _vdom = __webpack_require__(197);
+ exports.__esModule = true;
- var _vue = __webpack_require__(55);
+ 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 _vue2 = _interopRequireDefault(_vue);
+ 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 = {
- name: 'ElTooltip',
+ mixins: [_emitter2.default],
- mixins: [_vuePopper2.default],
+ name: 'ElOption',
+
+ componentName: 'ElOption',
props: {
- openDelay: {
- type: Number,
- default: 0
+ value: {
+ required: true
},
- disabled: Boolean,
- manual: Boolean,
- effect: {
- type: String,
- default: 'dark'
+ 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() {
+ return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
},
- popperClass: String,
- content: String,
- visibleArrow: {
- default: true
+ currentLabel: function currentLabel() {
+ return this.label || (this.isObject ? '' : this.value);
},
- transition: {
- type: String,
- default: 'el-fade-in-linear'
+ currentValue: function currentValue() {
+ return this.value || this.label || '';
},
- popperOptions: {
- default: function _default() {
- return {
- boundariesPadding: 10,
- gpuAcceleration: false
- };
+ parent: function parent() {
+ var result = this.$parent;
+ while (!result.isSelect) {
+ result = result.$parent;
}
+ return result;
},
- enterable: {
- type: Boolean,
- default: true
+ 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;
+ }
}
},
- beforeCreate: function beforeCreate() {
- var _this = this;
-
- if (this.$isServer) return;
+ 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');
+ }
+ },
- this.popperVM = new _vue2.default({
- data: { node: '' },
- render: function render(h) {
- return this.node;
+ 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);
}
- }).$mount();
+ },
+ contains: function contains() {
+ var _this = this;
- this.debounceClose = (0, _debounce2.default)(200, function () {
- return _this.handleClosePopper();
- });
- },
- render: function render(h) {
- var _this2 = this;
+ var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var target = arguments[1];
- 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);
- }
- },
+ 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);
+ })
+ };
+ }();
- ref: 'popper',
- directives: [{
- name: 'show',
- value: !this.disabled && this.showPopper
- }],
+ 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;
- 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
- [this.$slots.content || this.content]
- )]
- );
+ this.$nextTick(function () {
+ _this2.index = _this2.parent.options.indexOf(_this2);
+ });
}
+ },
- if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
+ 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);
- 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 || {};
+ this.$on('queryChange', this.queryChange);
+ this.$on('handleGroupDisabled', this.handleGroupDisabled);
+ this.$on('resetIndex', this.resetIndex);
+ },
+ beforeDestroy: function beforeDestroy() {
+ this.dispatch('ElSelect', 'onOptionDestroy', this);
+ }
+ };
- 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;
- },
+/***/ 219:
+/***/ function(module, exports) {
+ module.exports = __webpack_require__(6);
- 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;
+/***/ 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
},
- setExpectedState: function setExpectedState(expectedState) {
- this.expectedState = expectedState;
+ 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: []}
/***/ }
/******/ });
/***/ }),
-/* 53 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 49 */
+/***/ (function(module, exports) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
@@ -66951,7 +67030,7 @@ module.exports =
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(73);
+ module.exports = __webpack_require__(30);
/***/ },
@@ -66989,1782 +67068,1264 @@ module.exports =
// 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: []}
-
-/***/ }
-
-/******/ });
-
-/***/ }),
-/* 54 */
-/***/ (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;
+ options.staticRenderFns = compiledTemplate.staticRenderFns
+ }
- if (typeof dateObj === 'number') {
- dateObj = new Date(dateObj);
- }
+ // scopedId
+ if (scopeId) {
+ options._scopeId = scopeId
+ }
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
- throw new Error('Invalid Date in fecha.format');
- }
+ 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
+ }
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
+ if (hook) {
+ // inject component registration as beforeCreate hook
+ var existing = options.beforeCreate
+ options.beforeCreate = existing
+ ? [].concat(existing, hook)
+ : [hook]
+ }
- return mask.replace(token, function ($0) {
- return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
- });
- };
+ return {
+ esModule: esModule,
+ exports: scriptExports,
+ options: options
+ }
+ }
- /**
- * 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;
+/***/ 30:
+/***/ function(module, exports, __webpack_require__) {
- // 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;
- }
+ 'use strict';
- 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;
- });
- }
- }
+ exports.__esModule = true;
- return parseFlags[$0] ? '' : $0.slice(1, $0.length - 1);
- });
+ var _button = __webpack_require__(31);
- if (!isValid) {
- return false;
- }
+ var _button2 = _interopRequireDefault(_button);
- 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;
- }
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- 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 */
+ _button2.default.install = function (Vue) {
+ Vue.component(_button2.default.name, _button2.default);
+ };
- /* 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);
+ exports.default = _button2.default;
-/***/ }),
-/* 55 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ },
-"use strict";
+/***/ 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
+ )
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ module.exports = Component.exports
-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);
+/***/ 32:
+/***/ function(module, exports) {
-var _validator = __webpack_require__(56);
+ 'use strict';
-var _validator2 = _interopRequireDefault(_validator);
+ exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
+ //
-var _messages2 = __webpack_require__(75);
+ exports.default = {
+ name: 'ElButton',
-var _rule = __webpack_require__(1);
+ 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
+ },
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ methods: {
+ handleClick: function handleClick(evt) {
+ this.$emit('click', evt);
+ },
+ handleInnerClick: function handleInnerClick(evt) {
+ if (this.disabled) {
+ evt.stopPropagation();
+ }
+ }
+ }
+ };
-/**
- * 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;
+/***/ 33:
+/***/ function(module, exports) {
- var o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var oc = arguments[2];
+ 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",
+ on: {
+ "click": _vm.handleInnerClick
+ }
+ }) : _vm._e(), (_vm.icon && !_vm.loading) ? _c('i', {
+ class: 'el-icon-' + _vm.icon,
+ on: {
+ "click": _vm.handleInnerClick
+ }
+ }) : _vm._e(), (_vm.$slots.default) ? _c('span', {
+ on: {
+ "click": _vm.handleInnerClick
+ }
+ }, [_vm._t("default")], 2) : _vm._e()])
+ },staticRenderFns: []}
- 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);
- }
+/***/ }),
+/* 50 */
+/***/ (function(module, exports) {
- 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();
- }
+module.exports =
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
- 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
- });
- }
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
- function cb() {
- var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
- 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);
- }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
- errors = errors.map((0, _util.complementError)(rule));
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- 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);
- }
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
- 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);
- });
- }
- }
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
- 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;
-};
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
-Schema.messages = _messages2.messages;
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "/dist/";
-exports["default"] = Schema;
-module.exports = exports['default'];
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ({
-/***/ }),
-/* 56 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ 0:
+/***/ function(module, exports, __webpack_require__) {
-"use strict";
+ module.exports = __webpack_require__(34);
-module.exports = {
- string: __webpack_require__(57),
- method: __webpack_require__(63),
- number: __webpack_require__(64),
- "boolean": __webpack_require__(65),
- regexp: __webpack_require__(66),
- integer: __webpack_require__(67),
- "float": __webpack_require__(68),
- array: __webpack_require__(69),
- object: __webpack_require__(70),
- "enum": __webpack_require__(71),
- pattern: __webpack_require__(72),
- email: __webpack_require__(17),
- url: __webpack_require__(17),
- date: __webpack_require__(73),
- hex: __webpack_require__(17),
- required: __webpack_require__(74)
-};
+/***/ },
-/***/ }),
-/* 57 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ 3:
+/***/ function(module, exports) {
-"use strict";
+ /* 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
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ module.exports = function normalizeComponent (
+ rawScriptExports,
+ compiledTemplate,
+ injectStyles,
+ scopeId,
+ moduleIdentifier /* server only */
+ ) {
+ var esModule
+ var scriptExports = rawScriptExports = rawScriptExports || {}
-var _rule = __webpack_require__(1);
+ // ES6 modules interop
+ var type = typeof rawScriptExports.default
+ if (type === 'object' || type === 'function') {
+ esModule = rawScriptExports
+ scriptExports = rawScriptExports.default
+ }
-var _rule2 = _interopRequireDefault(_rule);
+ // Vue.extend constructor export interop
+ var options = typeof scriptExports === 'function'
+ ? scriptExports.options
+ : scriptExports
-var _util = __webpack_require__(0);
+ // render functions
+ if (compiledTemplate) {
+ options.render = compiledTemplate.render
+ options.staticRenderFns = compiledTemplate.staticRenderFns
+ }
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ // scopedId
+ if (scopeId) {
+ options._scopeId = scopeId
+ }
-/**
- * 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);
-}
+ 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
+ }
-exports["default"] = string;
-module.exports = exports['default'];
+ if (hook) {
+ // inject component registration as beforeCreate hook
+ var existing = options.beforeCreate
+ options.beforeCreate = existing
+ ? [].concat(existing, hook)
+ : [hook]
+ }
-/***/ }),
-/* 58 */
-/***/ (function(module, exports, __webpack_require__) {
+ return {
+ esModule: esModule,
+ exports: scriptExports,
+ options: options
+ }
+ }
-"use strict";
+/***/ },
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+/***/ 34:
+/***/ function(module, exports, __webpack_require__) {
-var _util = __webpack_require__(0);
+ 'use strict';
-var util = _interopRequireWildcard(_util);
+ exports.__esModule = true;
-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 _buttonGroup = __webpack_require__(35);
-/**
- * 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));
- }
-}
+ var _buttonGroup2 = _interopRequireDefault(_buttonGroup);
-exports["default"] = whitespace;
-module.exports = exports['default'];
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-/***/ }),
-/* 59 */
-/***/ (function(module, exports, __webpack_require__) {
+ /* istanbul ignore next */
+ _buttonGroup2.default.install = function (Vue) {
+ Vue.component(_buttonGroup2.default.name, _buttonGroup2.default);
+ };
-"use strict";
+ exports.default = _buttonGroup2.default;
+/***/ },
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+/***/ 35:
+/***/ function(module, exports, __webpack_require__) {
-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 Component = __webpack_require__(3)(
+ /* script */
+ __webpack_require__(36),
+ /* template */
+ __webpack_require__(37),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
-var _util = __webpack_require__(0);
+ module.exports = Component.exports
-var util = _interopRequireWildcard(_util);
-var _required = __webpack_require__(28);
+/***/ },
-var _required2 = _interopRequireDefault(_required);
+/***/ 36:
+/***/ function(module, exports) {
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ 'use strict';
-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; } }
+ exports.__esModule = true;
+ //
+ //
+ //
+ //
+ //
-/* eslint max-len:0 */
+ /**
+ * button
+ * @module components/basic/menu
+ * @desc 用于按钮组
+ * @param {string} label - 名称
+ */
+ exports.default = {
+ name: 'ElButtonGroup'
+ };
-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);
- }
-};
+/***/ 37:
+/***/ function(module, exports) {
-/**
- * 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));
- }
-}
+ 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: []}
-exports["default"] = type;
-module.exports = exports['default'];
+/***/ }
+
+/******/ });
/***/ }),
-/* 60 */
+/* 51 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _util = __webpack_require__(0);
+exports.__esModule = true;
-var util = _interopRequireWildcard(_util);
+var _dom = __webpack_require__(4);
-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; } }
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-/**
- * 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;
+var Transition = function () {
+ function Transition() {
+ _classCallCheck(this, Transition);
}
- if (len) {
- if (val !== rule.len) {
- errors.push(util.format(options.messages[key].len, rule.fullField, rule.len));
+
+ 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;
}
- } 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'];
+ el.style.overflow = 'hidden';
+ };
-/***/ }),
-/* 61 */
-/***/ (function(module, exports, __webpack_require__) {
+ 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;
+ };
-"use strict";
+ 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';
+ };
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ 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;
+ }
+ };
-var _util = __webpack_require__(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;
+ };
-var util = _interopRequireWildcard(_util);
+ return Transition;
+}();
-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; } }
+exports.default = {
+ name: 'ElCollapseTransition',
+ functional: true,
+ render: function render(h, _ref) {
+ var children = _ref.children;
-var ENUM = 'enum';
+ var data = {
+ on: new Transition()
+ };
-/**
- * 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(', ')));
+ return h('transition', data, children);
}
-}
+};
+
+/***/ }),
+/* 52 */
+/***/ (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;
+/******/ }
-exports["default"] = enumerable;
-module.exports = exports['default'];
-/***/ }),
-/* 62 */
-/***/ (function(module, exports, __webpack_require__) {
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
-"use strict";
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "/dist/";
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ({
-var _util = __webpack_require__(0);
+/***/ 0:
+/***/ function(module, exports, __webpack_require__) {
-var util = _interopRequireWildcard(_util);
+ module.exports = __webpack_require__(65);
-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'];
+/***/ 3:
+/***/ function(module, exports) {
-/***/ }),
-/* 63 */
-/***/ (function(module, exports, __webpack_require__) {
+ /* globals __VUE_SSR_CONTEXT__ */
-"use strict";
+ // 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 || {}
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ // ES6 modules interop
+ var type = typeof rawScriptExports.default
+ if (type === 'object' || type === 'function') {
+ esModule = rawScriptExports
+ scriptExports = rawScriptExports.default
+ }
-var _rule = __webpack_require__(1);
+ // Vue.extend constructor export interop
+ var options = typeof scriptExports === 'function'
+ ? scriptExports.options
+ : scriptExports
-var _rule2 = _interopRequireDefault(_rule);
+ // render functions
+ if (compiledTemplate) {
+ options.render = compiledTemplate.render
+ options.staticRenderFns = compiledTemplate.staticRenderFns
+ }
-var _util = __webpack_require__(0);
+ // scopedId
+ if (scopeId) {
+ options._scopeId = scopeId
+ }
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ 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
+ }
-/**
- * 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);
-}
+ if (hook) {
+ // inject component registration as beforeCreate hook
+ var existing = options.beforeCreate
+ options.beforeCreate = existing
+ ? [].concat(existing, hook)
+ : [hook]
+ }
-exports["default"] = method;
-module.exports = exports['default'];
+ return {
+ esModule: esModule,
+ exports: scriptExports,
+ options: options
+ }
+ }
-/***/ }),
-/* 64 */
-/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+/***/ },
+/***/ 14:
+/***/ function(module, exports) {
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ module.exports = __webpack_require__(5);
-var _rule = __webpack_require__(1);
+/***/ },
-var _rule2 = _interopRequireDefault(_rule);
+/***/ 65:
+/***/ function(module, exports, __webpack_require__) {
-var _util = __webpack_require__(0);
+ 'use strict';
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ exports.__esModule = true;
-/**
- * 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);
-}
+ var _checkbox = __webpack_require__(66);
-exports["default"] = number;
-module.exports = exports['default'];
+ var _checkbox2 = _interopRequireDefault(_checkbox);
-/***/ }),
-/* 65 */
-/***/ (function(module, exports, __webpack_require__) {
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-"use strict";
+ /* istanbul ignore next */
+ _checkbox2.default.install = function (Vue) {
+ Vue.component(_checkbox2.default.name, _checkbox2.default);
+ };
+ exports.default = _checkbox2.default;
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+/***/ },
-var _util = __webpack_require__(0);
+/***/ 66:
+/***/ function(module, exports, __webpack_require__) {
-var _rule = __webpack_require__(1);
+ var Component = __webpack_require__(3)(
+ /* script */
+ __webpack_require__(67),
+ /* template */
+ __webpack_require__(68),
+ /* styles */
+ null,
+ /* scopeId */
+ null,
+ /* moduleIdentifier (server only) */
+ null
+ )
-var _rule2 = _interopRequireDefault(_rule);
+ module.exports = Component.exports
-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'];
+/***/ 67:
+/***/ function(module, exports, __webpack_require__) {
-/***/ }),
-/* 66 */
-/***/ (function(module, exports, __webpack_require__) {
+ 'use strict';
-"use strict";
+ exports.__esModule = true;
+ var _emitter = __webpack_require__(14);
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ var _emitter2 = _interopRequireDefault(_emitter);
-var _rule = __webpack_require__(1);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var _rule2 = _interopRequireDefault(_rule);
+ exports.default = {
+ name: 'ElCheckbox',
-var _util = __webpack_require__(0);
+ mixins: [_emitter2.default],
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ componentName: 'ElCheckbox',
-/**
- * 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);
-}
+ data: function data() {
+ return {
+ selfModel: false,
+ focus: false
+ };
+ },
-exports["default"] = regexp;
-module.exports = exports['default'];
-/***/ }),
-/* 67 */
-/***/ (function(module, exports, __webpack_require__) {
+ 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);
-"use strict";
+ 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;
+ }
+ }
+ },
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ 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;
+ }
+ },
-var _rule = __webpack_require__(1);
+ props: {
+ value: {},
+ label: {},
+ indeterminate: Boolean,
+ disabled: Boolean,
+ checked: Boolean,
+ name: String,
+ trueLabel: [String, Number],
+ falseLabel: [String, Number]
+ },
-var _rule2 = _interopRequireDefault(_rule);
+ 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;
-var _util = __webpack_require__(0);
+ this.$emit('change', ev);
+ if (this.isGroup) {
+ this.$nextTick(function (_) {
+ _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
+ });
+ }
+ }
+ },
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ 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: []}
-/**
- * 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'];
+/******/ });
/***/ }),
-/* 68 */
+/* 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 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'];
+module.exports =
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
-/***/ }),
-/* 69 */
-/***/ (function(module, exports, __webpack_require__) {
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
-"use strict";
+/******/ // 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
+/******/ };
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-var _rule = __webpack_require__(1);
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
-var _rule2 = _interopRequireDefault(_rule);
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
-var _util = __webpack_require__(0);
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
-/**
- * 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);
-}
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
-exports["default"] = array;
-module.exports = exports['default'];
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "/dist/";
-/***/ }),
-/* 70 */
-/***/ (function(module, exports, __webpack_require__) {
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ({
-"use strict";
+/***/ 0:
+/***/ function(module, exports, __webpack_require__) {
+ module.exports = __webpack_require__(345);
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-var _rule = __webpack_require__(1);
+/***/ },
-var _rule2 = _interopRequireDefault(_rule);
+/***/ 13:
+/***/ function(module, exports) {
-var _util = __webpack_require__(0);
+ module.exports = __webpack_require__(13);
-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);
-}
+/***/ 55:
+/***/ function(module, exports) {
-exports["default"] = object;
-module.exports = exports['default'];
+ module.exports = __webpack_require__(3);
-/***/ }),
-/* 71 */
-/***/ (function(module, exports, __webpack_require__) {
+/***/ },
-"use strict";
+/***/ 63:
+/***/ function(module, exports) {
+ module.exports = __webpack_require__(9);
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+/***/ },
-var _rule = __webpack_require__(1);
+/***/ 197:
+/***/ function(module, exports) {
-var _rule2 = _interopRequireDefault(_rule);
+ module.exports = __webpack_require__(27);
-var _util = __webpack_require__(0);
+/***/ },
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+/***/ 345:
+/***/ function(module, exports, __webpack_require__) {
-var ENUM = 'enum';
+ 'use strict';
-/**
- * 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.__esModule = true;
-exports["default"] = enumerable;
-module.exports = exports['default'];
+ var _main = __webpack_require__(346);
-/***/ }),
-/* 72 */
-/***/ (function(module, exports, __webpack_require__) {
+ var _main2 = _interopRequireDefault(_main);
-"use strict";
+ 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);
+ };
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ exports.default = _main2.default;
-var _rule = __webpack_require__(1);
+/***/ },
-var _rule2 = _interopRequireDefault(_rule);
+/***/ 346:
+/***/ function(module, exports, __webpack_require__) {
-var _util = __webpack_require__(0);
+ 'use strict';
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ exports.__esModule = true;
-/**
- * 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);
-}
+ var _vuePopper = __webpack_require__(13);
-exports["default"] = pattern;
-module.exports = exports['default'];
+ var _vuePopper2 = _interopRequireDefault(_vuePopper);
-/***/ }),
-/* 73 */
-/***/ (function(module, exports, __webpack_require__) {
+ var _debounce = __webpack_require__(63);
-"use strict";
+ var _debounce2 = _interopRequireDefault(_debounce);
+ var _vdom = __webpack_require__(197);
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ var _vue = __webpack_require__(55);
-var _rule = __webpack_require__(1);
+ var _vue2 = _interopRequireDefault(_vue);
-var _rule2 = _interopRequireDefault(_rule);
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var _util = __webpack_require__(0);
+ exports.default = {
+ name: 'ElTooltip',
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ mixins: [_vuePopper2.default],
-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);
-}
+ 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
+ }
+ },
-exports["default"] = date;
-module.exports = exports['default'];
+ beforeCreate: function beforeCreate() {
+ var _this = this;
-/***/ }),
-/* 74 */
-/***/ (function(module, exports, __webpack_require__) {
+ if (this.$isServer) return;
-"use strict";
+ 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;
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
+ 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);
+ }
+ },
-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; };
+ ref: 'popper',
+ directives: [{
+ name: 'show',
+ value: !this.disabled && this.showPopper
+ }],
-var _rule = __webpack_require__(1);
+ 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
+ [this.$slots.content || this.content]
+ )]
+ );
+ }
-var _rule2 = _interopRequireDefault(_rule);
+ if (!this.$slots.default || !this.$slots.default.length) return this.$slots.default;
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
+ 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 || {};
-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);
-}
+ 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');
-exports["default"] = required;
-module.exports = exports['default'];
+ return vnode;
+ },
+ mounted: function mounted() {
+ this.referenceElm = this.$el;
+ },
-/***/ }),
-/* 75 */
-/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+ 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;
+ }
+ }
+ };
-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();
+/******/ });
/***/ }),
-/* 76 */
+/* 54 */
/***/ (function(module, exports, __webpack_require__) {
module.exports =
@@ -68815,7 +68376,7 @@ module.exports =
/***/ 0:
/***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(172);
+ module.exports = __webpack_require__(73);
/***/ },
@@ -68904,57 +68465,43 @@ module.exports =
/***/ },
-/***/ 9:
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(11);
-
-/***/ },
-
-/***/ 63:
-/***/ function(module, exports) {
-
- module.exports = __webpack_require__(9);
-
-/***/ },
-
-/***/ 123:
+/***/ 14:
/***/ function(module, exports) {
- module.exports = __webpack_require__(4);
+ module.exports = __webpack_require__(5);
/***/ },
-/***/ 172:
+/***/ 73:
/***/ function(module, exports, __webpack_require__) {
'use strict';
exports.__esModule = true;
- var _inputNumber = __webpack_require__(173);
+ var _checkboxGroup = __webpack_require__(74);
- var _inputNumber2 = _interopRequireDefault(_inputNumber);
+ var _checkboxGroup2 = _interopRequireDefault(_checkboxGroup);
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);
+ _checkboxGroup2.default.install = function (Vue) {
+ Vue.component(_checkboxGroup2.default.name, _checkboxGroup2.default);
};
- exports.default = _inputNumber2.default;
+ exports.default = _checkboxGroup2.default;
/***/ },
-/***/ 173:
+/***/ 74:
/***/ function(module, exports, __webpack_require__) {
var Component = __webpack_require__(3)(
/* script */
- __webpack_require__(174),
+ __webpack_require__(75),
/* template */
- __webpack_require__(175),
+ __webpack_require__(76),
/* styles */
null,
/* scopeId */
@@ -68968,3250 +68515,3415 @@ module.exports =
/***/ },
-/***/ 174:
+/***/ 75:
/***/ 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 _emitter = __webpack_require__(14);
- var _debounce2 = _interopRequireDefault(_debounce);
+ var _emitter2 = _interopRequireDefault(_emitter);
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;
- };
+ name: 'ElCheckboxGroup',
+
+ componentName: 'ElCheckboxGroup',
+
+ mixins: [_emitter2.default],
- (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,
+ value: {},
+ min: Number,
+ max: Number,
size: String,
- controls: {
- type: Boolean,
- default: true
- },
- debounce: {
- type: Number,
- default: 300
- }
- },
- data: function data() {
- return {
- currentValue: 0
- };
+ fill: String,
+ textColor: String
},
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);
- }
+ value: function value(_value) {
+ this.dispatch('ElFormItem', 'el.form.change', [_value]);
}
- },
- 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;
+ }
+ };
+
+/***/ },
+
+/***/ 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: []}
+
+/***/ }
+
+/******/ });
+
+/***/ }),
+/* 55 */
+/***/ (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');
+ }
- 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;
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
- var precisionFactor = Math.pow(10, this.precision);
+ return mask.replace(token, function ($0) {
+ return $0 in formatFlags ? formatFlags[$0](dateObj, i18n) : $0.slice(1, $0.length - 1);
+ });
+ };
- return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
- },
- _decrease: function _decrease(val, step) {
- if (typeof val !== 'number') return this.currentValue;
+ /**
+ * 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;
- var precisionFactor = Math.pow(10, this.precision);
+ if (typeof format !== 'string') {
+ throw new Error('Invalid format in fecha.parse');
+ }
- 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;
+ format = fecha.masks[format] || format;
- this.debounceHandleInput = (0, _debounce2.default)(this.debounce, function (value) {
- _this.handleInput(value);
- });
- }
- }; //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+ // 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;
+ });
+ }
+ }
-/***/ 175:
-/***/ function(module, exports) {
+ return parseFlags[$0] ? '' : $0.slice(1, $0.length - 1);
+ });
- 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: []}
+ 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);
/***/ }),
-/* 77 */
-/***/ (function(module, exports) {
+/* 56 */
+/***/ (function(module, exports, __webpack_require__) {
-module.exports =
-/******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
+"use strict";
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
+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; };
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+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; };
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
+var _util = __webpack_require__(0);
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
+var _validator = __webpack_require__(57);
+var _validator2 = _interopRequireDefault(_validator);
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
+var _messages2 = __webpack_require__(76);
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
+var _rule = __webpack_require__(1);
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "/dist/";
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ({
+/**
+ * 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);
+}
-/***/ 0:
-/***/ function(module, exports, __webpack_require__) {
+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;
- module.exports = __webpack_require__(237);
+ 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);
+ }
+ }
-/***/ 3:
-/***/ function(module, exports) {
+ 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);
+ }
- /* globals __VUE_SSR_CONTEXT__ */
+ 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();
+ }
- // this module is a runtime utility for cleaner component module output and will
- // be included in the final webpack user bundle
+ 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
+ });
+ }
- module.exports = function normalizeComponent (
- rawScriptExports,
- compiledTemplate,
- injectStyles,
- scopeId,
- moduleIdentifier /* server only */
- ) {
- var esModule
- var scriptExports = rawScriptExports = rawScriptExports || {}
+ 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);
+ });
+ }
+ }
- // ES6 modules interop
- var type = typeof rawScriptExports.default
- if (type === 'object' || type === 'function') {
- esModule = rawScriptExports
- scriptExports = rawScriptExports.default
- }
+ 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;
+ }
+};
- // Vue.extend constructor export interop
- var options = typeof scriptExports === 'function'
- ? scriptExports.options
- : scriptExports
+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;
+};
- // render functions
- if (compiledTemplate) {
- options.render = compiledTemplate.render
- options.staticRenderFns = compiledTemplate.staticRenderFns
- }
+Schema.messages = _messages2.messages;
- // scopedId
- if (scopeId) {
- options._scopeId = scopeId
- }
+exports["default"] = Schema;
+module.exports = exports['default'];
- 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
- }
+/***/ }),
+/* 57 */
+/***/ (function(module, exports, __webpack_require__) {
- if (hook) {
- // inject component registration as beforeCreate hook
- var existing = options.beforeCreate
- options.beforeCreate = existing
- ? [].concat(existing, hook)
- : [hook]
- }
+"use strict";
- return {
- esModule: esModule,
- exports: scriptExports,
- options: options
- }
- }
+module.exports = {
+ string: __webpack_require__(58),
+ method: __webpack_require__(64),
+ number: __webpack_require__(65),
+ "boolean": __webpack_require__(66),
+ regexp: __webpack_require__(67),
+ integer: __webpack_require__(68),
+ "float": __webpack_require__(69),
+ array: __webpack_require__(70),
+ object: __webpack_require__(71),
+ "enum": __webpack_require__(72),
+ pattern: __webpack_require__(73),
+ email: __webpack_require__(17),
+ url: __webpack_require__(17),
+ date: __webpack_require__(74),
+ hex: __webpack_require__(17),
+ required: __webpack_require__(75)
+};
-/***/ },
+/***/ }),
+/* 58 */
+/***/ (function(module, exports, __webpack_require__) {
-/***/ 237:
-/***/ function(module, exports, __webpack_require__) {
+"use strict";
- 'use strict';
- exports.__esModule = true;
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
- var _progress = __webpack_require__(238);
+var _rule = __webpack_require__(1);
- var _progress2 = _interopRequireDefault(_progress);
+var _rule2 = _interopRequireDefault(_rule);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+var _util = __webpack_require__(0);
- /* istanbul ignore next */
- _progress2.default.install = function (Vue) {
- Vue.component(_progress2.default.name, _progress2.default);
- };
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- exports.default = _progress2.default;
+/**
+ * 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'];
-/***/ 238:
-/***/ function(module, exports, __webpack_require__) {
+/***/ }),
+/* 59 */
+/***/ (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
- )
+"use strict";
- module.exports = Component.exports
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
-/***/ },
+var _util = __webpack_require__(0);
-/***/ 239:
-/***/ function(module, exports) {
+var util = _interopRequireWildcard(_util);
- 'use strict';
+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; } }
- exports.__esModule = true;
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
+/**
+ * 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 = {
- 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);
+exports["default"] = whitespace;
+module.exports = exports['default'];
- 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;
- }
- }
- };
+/***/ }),
+/* 60 */
+/***/ (function(module, exports, __webpack_require__) {
-/***/ },
+"use strict";
-/***/ 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: []}
+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);
-/***/ }),
-/* 78 */
-/***/ (function(module, exports, __webpack_require__) {
+var util = _interopRequireWildcard(_util);
-"use strict";
+var _required = __webpack_require__(28);
+var _required2 = _interopRequireDefault(_required);
-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 (false) return;
- if (!this.$vnode) return;
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
- var _getMigratingConfig = this.getMigratingConfig(),
- props = _getMigratingConfig.props,
- events = _getMigratingConfig.events;
+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 _$vnode = this.$vnode,
- data = _$vnode.data,
- componentOptions = _$vnode.componentOptions;
+/* eslint max-len:0 */
- var definedProps = data.attrs || {};
- var definedEvents = componentOptions.listeners || {};
+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
+};
- for (var propName in definedProps) {
- if (definedProps.hasOwnProperty(propName) && props[propName]) {
- console.warn('[Element Migrating][Attribute]: ' + props[propName]);
- }
+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;
}
-
- for (var eventName in definedEvents) {
- if (definedEvents.hasOwnProperty(eventName) && events[eventName]) {
- console.warn('[Element Migrating][Event]: ' + events[eventName]);
- }
+ 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);
},
-
- methods: {
- getMigratingConfig: function getMigratingConfig() {
- return {
- props: {},
- events: {}
- };
- }
+ url: function url(value) {
+ return typeof value === 'string' && !!value.match(pattern.url);
+ },
+ hex: function hex(value) {
+ return typeof value === 'string' && !!value.match(pattern.hex);
}
};
-/***/ }),
-/* 79 */
-/***/ (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]
- }
+/**
+ * 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));
}
- return a
- }, {})
-}
-
-function mergeFn (a, b) {
- return function () {
- a.apply(this, arguments)
- b.apply(this, arguments)
+ // 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'];
/***/ }),
-/* 80 */
+/* 61 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-exports.__esModule = true;
-exports.isDef = isDef;
-function isDef(val) {
- return val !== undefined && val !== null;
-}
-
-/***/ }),
-/* 81 */
-/***/ (function(module, exports, __webpack_require__) {
-
-!function(e,t){ true?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DataTables=t():e.DataTables=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=17)}([function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){e.exports=!n(1)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(3),o=n(0),i=n(28),a=n(32),c=function(e,t,n){var s,u,f,l=e&c.F,p=e&c.G,h=e&c.S,d=e&c.P,v=e&c.B,g=e&c.W,b=p?o:o[t]||(o[t]={}),y=b.prototype,m=p?r:h?r[t]:(r[t]||{}).prototype;p&&(n=t);for(s in n)(u=!l&&m&&void 0!==m[s])&&s in b||(f=u?m[s]:n[s],b[s]=p&&"function"!=typeof m[s]?n[s]:v&&u?i(f,r):g&&m[s]==f?function(e){var t=function(t,n,r){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,n)}return new e(t,n,r)}return e.apply(this,arguments)};return t.prototype=e.prototype,t}(f):d&&"function"==typeof f?i(Function.call,f):f,d&&((b.virtual||(b.virtual={}))[s]=f,e&c.R&&y&&!y[s]&&a(y,s,f)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,n){var r=n(27);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(37),o=n(30);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(7),o=n(5);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(5);e.exports=function(e){return Object(r(e))}},function(e,t){function n(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var i=r(o);return[n].concat(o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"})).concat([i]).join("\n")}return[n].join("\n")}function r(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var r=n(t,e);return t[2]?"@media "+t[2]+"{"+r+"}":r}).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;on.parts.length&&(r.parts.length=n.parts.length)}else{for(var a=[],o=0;o0},innerColNotRowClick:function(){return this.colNotRowClick.concat([this.actionColProp])},innerCustomFilters:function(){var e=this,t=this.formatToArray(this.customFilters),n=[];return t.forEach(function(t){var r=a()({},t);r={props:e.formatProps(r.props),vals:e.formatToArray(t.vals)},n.push(r)}),n},innerTableProps:function(){return a()({border:!0,stripe:!0,fit:!0},this.tableProps)},sortedData:function(){var e=this.data.slice();if(this.sortData.order){var t=this.sortData.order,n=this.sortData.prop,r="descending"===t;e.sort(function(e,t){return e[n]>t[n]?1:e[n]-1})})},e)}),this.$emit("filtered-data",e),e},curTableData:function(){var e=this.innerPageSize*(this.currentPage-1),t=e+this.innerPageSize;return this.tableData.slice(e,t)},total:function(){return this.tableData.length},checkboxShow:function(){return this.innerCheckboxFilterDef.def.length>0},searchShow:function(){return!1!==this.innerSearchDef.show},actionsShow:function(){return this.innerActionsDef.def.length>0},paginationShow:function(){return!1!==this.paginationDef.show},filters:function(){var e=this.formatToArray(this.innerCustomFilters);return this.searchShow&&e.push({props:this.formatProps(this.innerSearchDef.props),vals:this.formatToArray(this.innerSearchKey),filterFunction:this.innerSearchDef.filterFunction}),this.checkboxShow&&e.push({props:this.formatProps(this.innerCheckboxFilterDef.props),vals:this.checkedFilters,filterFunction:this.innerCheckboxFilterDef.filterFunction}),e},updateInnerSearchKey:function(){var e=this,t=this.innerSearchDef.debounceTime;return l()(function(t){e.innerSearchKey=e.searchKey},t)}},methods:{formatProps:function(e){return e?[].concat(e):void 0},formatToArray:function(e){return e?[].concat(e):[]},handleSort:function(e){this.sortData=e,this.innerTableProps.defaultSort={prop:e.prop,order:e.order}},handleSizeChange:function(e){this.innerPageSize=e,this.$emit("size-change",e)},handleCurrentChange:function(e){this.currentPage=e,this.$emit("current-change",e)},handleFilterChange:function(e){this.checkedFilters=e}},watch:{innerPaginationDef:{immediate:!0,handler:function(e){this.innerPageSize=e.pageSize,this.currentPage=e.currentPage}},searchKey:function(){this.updateInnerSearchKey()},data:{immediate:!0,handler:function(e){this._allDataProps=o()(e&&e[0]||{})}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{checks:[Array]},data:function(){return{checkList:[]}},methods:{changeHandler:function(){this.$emit("checkChange",this.checkList)}}}},function(e,t,n){e.exports={default:n(22),__esModule:!0}},function(e,t,n){e.exports={default:n(23),__esModule:!0}},function(e,t,n){n(47),e.exports=n(0).Object.assign},function(e,t,n){n(48),e.exports=n(0).Object.keys},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(4);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(10),o=n(44),i=n(43);e.exports=function(e){return function(t,n,a){var c,s=r(t),u=o(s.length),f=i(a,u);if(e&&n!=n){for(;u>f;)if((c=s[f++])!=c)return!0}else for(;u>f;f++)if((e||f in s)&&s[f]===n)return e||f||0;return!e&&-1}}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(24);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(4),o=n(3).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(35),o=n(40);e.exports=n(2)?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},function(e,t,n){e.exports=!n(2)&&!n(1)(function(){return 7!=Object.defineProperty(n(29)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){"use strict";var r=n(8),o=n(36),i=n(38),a=n(11),c=n(7),s=Object.assign;e.exports=!s||n(1)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=s({},e)[n]||Object.keys(s({},t)).join("")!=r})?function(e,t){for(var n=a(e),s=arguments.length,u=1,f=o.f,l=i.f;s>u;)for(var p,h=c(arguments[u++]),d=f?r(h).concat(f(h)):r(h),v=d.length,g=0;v>g;)l.call(h,p=d[g++])&&(n[p]=h[p]);return n}:s},function(e,t,n){var r=n(25),o=n(33),i=n(45),a=Object.defineProperty;t.f=n(2)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t,n){var r=n(31),o=n(10),i=n(26)(!1),a=n(41)("IE_PROTO");e.exports=function(e,t){var n,c=o(e),s=0,u=[];for(n in c)n!=a&&r(c,n)&&u.push(n);for(;t.length>s;)r(c,n=t[s++])&&(~i(u,n)||u.push(n));return u}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){var r=n(6),o=n(0),i=n(1);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){var r=n(42)("keys"),o=n(46);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(3),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t,n){var r=n(9),o=Math.max,i=Math.min;e.exports=function(e,t){return e=r(e),e<0?o(e+t,0):i(e,t)}},function(e,t,n){var r=n(9),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){var r=n(4);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(6);r(r.S+r.F,"Object",{assign:n(34)})},function(e,t,n){var r=n(11),o=n(8);n(39)("keys",function(){return function(e){return o(r(e))}})},function(e,t,n){t=e.exports=n(12)(void 0),t.push([e.i,".sc-checkbox-group{padding-top:9px}",""])},function(e,t,n){t=e.exports=n(12)(void 0),t.push([e.i,".sc-table .tool-bar{margin-bottom:20px}.sc-table .action-list{text-align:center}.sc-table .action-list>span{margin-right:10px}.sc-table .action-list>span:last-child{margin-right:0}.sc-table .el-tooltip,.sc-table .el-tooltip__rel{display:inline-block!important}.sc-table .pagination-wrap{text-align:center;margin-top:20px}",""])},function(e,t,n){var r,o,i;/*!
- * javascript-debounce 1.0.0
- *
- * A lightweight, dependency-free JavaScript module for debouncing functions based on David Walsh's debounce function.
- *
- * Source code available at: https://github.com/jgarber623/javascript-debounce
- *
- * (c) 2015-present Jason Garber (http://sixtwothree.org)
- *
- * javascript-debounce may be freely distributed under the MIT license.
- */
-!function(n,a){o=[],r=a,void 0!==(i="function"==typeof r?r.apply(t,o):r)&&(e.exports=i)}(0,function(){"use strict";return function(e,t){var n;return function(){var r=this,o=arguments;clearTimeout(n),n=setTimeout(function(){e.apply(r,o)},t)}}})},function(e,t,n){function r(e){n(55)}var o=n(13)(n(19),n(53),r,null,null);e.exports=o.exports},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"sc-checkbox-group"},[n("el-checkbox-group",{on:{change:e.changeHandler},model:{value:e.checkList,callback:function(t){e.checkList=t},expression:"checkList"}},e._l(e.checks,function(t){return n("el-checkbox",{key:t.code,attrs:{label:t.code}},[e._v(e._s(t.name))])}))],1)},staticRenderFns:[]}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"sc-table"},[e.showActionBar?n("el-row",{staticClass:"tool-bar"},[e.actionsShow?n("el-col",e._b({staticClass:"actions"},"el-col",e.innerActionsDef.colProps,!1),e._l(e.innerActionsDef.def,function(t){return n("el-button",e._b({key:t.name,attrs:{icon:t.icon,type:t.buttonProps&&t.buttonProps.type||"primary"},on:{click:t.handler}},"el-button",t.buttonProps,!1),[e._v(e._s(t.name))])})):e._e(),e.checkboxShow?n("el-col",e._b({staticClass:"filters"},"el-col",e.innerCheckboxFilterDef.colProps,!1),[n("checkbox-group",{attrs:{checks:e.innerCheckboxFilterDef.def},on:{checkChange:e.handleFilterChange}})],1):e._e(),e.searchShow?n("el-col",e._b({staticClass:"search",attrs:{span:e.innerSearchDef.colProps&&e.innerSearchDef.colProps.span||5}},"el-col",e.innerSearchDef.colProps,!1),[n("el-input",e._b({attrs:{icon:"search"},model:{value:e.searchKey,callback:function(t){e.searchKey=t},expression:"searchKey"}},"el-input",e.innerSearchDef.inputProps,!1))],1):e._e()],1):e._e(),n("div",{staticClass:"custom-tool-bar"},[e._t("custom-tool-bar")],2),n("el-table",e._b({ref:"elTable",staticStyle:{width:"100%"},attrs:{data:e.curTableData},on:{"sort-change":e.handleSort}},"el-table",e.innerTableProps,!1),[e._t("default"),e.actionColShow?n("el-table-column",{attrs:{prop:e.actionColProp,fixed:e.innerActionColDef.fixed,label:e.innerActionColDef.label,type:e.innerActionColDef.type,width:e.innerActionColDef.width,minWidth:e.innerActionColDef.minWidth},scopedSlots:e._u([{key:"default",fn:function(t){return[n("div",{staticClass:"action-list"},e._l(e.innerActionColDef.def,function(r){return n("span",[n("el-button",{attrs:{type:r.type||"text",icon:r.icon},on:{click:function(e){r.handler(t.row,t.$index,t.column,t.store)}}},[e._v(e._s(r.name))])],1)}))]}}])}):e._e()],2),e.paginationShow?n("div",{staticClass:"pagination-wrap"},[n("el-pagination",{attrs:{"current-page":e.currentPage,"page-sizes":e.innerPaginationDef.pageSizes,"page-size":e.innerPageSize,layout:e.innerPaginationDef.layout,total:e.total},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1):e._e()],1)},staticRenderFns:[]}},function(e,t,n){var r=n(49);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(14)("668ac427",r,!0)},function(e,t,n){var r=n(50);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals);n(14)("16e9a3a6",r,!0)},function(e,t){e.exports=function(e,t){for(var n=[],r={},o=0;o tag
+var util = _interopRequireWildcard(_util);
-// load the styles
-var content = __webpack_require__(83);
-if(typeof content === 'string') content = [[module.i, content, '']];
-// Prepare cssTransformation
-var transform;
+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 options = {}
-options.transform = transform
-// add the styles to the DOM
-var update = __webpack_require__(86)(content, options);
-if(content.locals) module.exports = content.locals;
-// Hot Module Replacement
-if(false) {
- // When the styles change, update the