vue-data-tables
Version:
A simple, customizable and pageable table, based on vue2 and element-ui.
1,672 lines (1,456 loc) • 64.4 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["DataTables"] = factory();
else
root["DataTables"] = factory();
})(this, function() {
return /******/ (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] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 21);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(27), __esModule: true };
/***/ }),
/* 1 */
/***/ (function(module, exports) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ }),
/* 2 */
/***/ (function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(2)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ }),
/* 4 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
/***/ }),
/* 5 */
/***/ (function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 6 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if(item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
}
// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/* 7 */
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// this module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
var functional = options.functional
var existing = functional
? options.render
: options.beforeCreate
if (!functional) {
// inject component registration as beforeCreate hook
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
} else {
// register for functioal component in vue file
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return existing(h, context)
}
}
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
throw new Error(
'vue-style-loader cannot be used in a non-browser environment. ' +
"Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
) }
}
var listToStyles = __webpack_require__(64)
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
module.exports = function (parentId, list, _isProduction) {
isProduction = _isProduction
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[data-vue-ssr-id~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_ScCheckboxGroup__ = __webpack_require__(57);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_ScCheckboxGroup___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__components_ScCheckboxGroup__);
/* harmony default export */ __webpack_exports__["a"] = ({
components: {
CheckboxGroup: __WEBPACK_IMPORTED_MODULE_1__components_ScCheckboxGroup___default.a
},
props: {
data: {
type: Array,
default: function _default() {
return [];
}
},
showActionBar: {
type: Boolean,
default: true
},
customFilters: {
type: [Object, Array],
default: function _default() {
return [];
}
},
tableProps: {
type: Object,
default: function _default() {
return {};
}
},
colNotRowClick: {
type: Array,
default: function _default() {
return [];
}
},
actionsDef: {
type: Object,
default: function _default() {
return {};
}
},
checkboxFilterDef: {
type: Object,
default: function _default() {
return {};
}
},
searchDef: {
type: Object,
default: function _default() {
return {};
}
},
actionColDef: {
type: Object,
default: function _default() {
return {};
}
},
paginationDef: {
type: Object,
default: function _default() {
return {};
}
}
},
mounted: function mounted() {
var _this = this;
var elTableVm = this.$refs['elTable'];
var oldEmit = elTableVm.$emit;
elTableVm.$emit = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var command = args[0];
if (command === 'row-click' || command === 'cell-click') {
var column = command === 'row-click' ? args[3] : args[2];
if (column && _this.innerColNotRowClick.indexOf(column.property) === -1) {
_this.$emit.apply(_this, args);
}
} else {
_this.$emit.apply(_this, args);
}
oldEmit.apply(elTableVm, args);
};
},
data: function data() {
return {
currentPage: 1,
innerPageSize: 20,
searchKey: '',
innerSearchKey: '',
checkBoxValues: [],
sortData: {},
actionColProp: 'e6e4c9de-7cf5-4f19-bb73-838e5182a372'
};
},
computed: {
innerActionsDef: function innerActionsDef() {
return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({
colProps: {
span: 5
},
def: []
}, this.actionsDef);
},
innerPaginationDef: function innerPaginationDef() {
var paginationDef = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({
layout: 'prev, pager, next, jumper, sizes, total',
pageSize: 20,
pageSizes: [20, 50, 100],
currentPage: 1
}, this.paginationDef);
if (paginationDef.show === false) {
paginationDef.pageSize = this.data.length;
} else {
if (paginationDef.pageSizes.indexOf(paginationDef.pageSize) === -1) {
console.warn('pageSize ' + paginationDef.pageSize + ' is not in pageSizes[' + paginationDef.pageSizes + '], use the first one(' + paginationDef.pageSizes[0] + ') in pageSizes');
paginationDef.pageSize = paginationDef.pageSizes[0];
}
}
return paginationDef;
},
innerActionColDef: function innerActionColDef() {
return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({
show: true,
label: '操作',
fixed: false,
def: []
}, this.actionColDef);
},
actionColShow: function actionColShow() {
return this.innerActionColDef.def.length > 0;
},
innerColNotRowClick: function innerColNotRowClick() {
return this.colNotRowClick.concat([this.actionColProp]);
},
innerCustomFilters: function innerCustomFilters() {
var _this2 = this;
var customFilterArray = this.formatToArray(this.customFilters);
var customFilters = [];
customFilterArray.forEach(function (filter) {
var filterCopy = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({}, filter, {
props: _this2.formatProps(filter.props),
vals: _this2.formatToArray(filter.vals)
});
customFilters.push(filterCopy);
});
return customFilters;
},
innerTableProps: function innerTableProps() {
return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({
border: true,
stripe: true,
fit: true
}, this.tableProps);
},
checkboxShow: function checkboxShow() {
return this.innerCheckboxFilterDef.def.length > 0;
},
searchShow: function searchShow() {
return this.innerSearchDef.show !== false;
},
actionsShow: function actionsShow() {
return this.innerActionsDef.def.length > 0;
},
paginationShow: function paginationShow() {
return this.paginationDef.show !== false;
}
},
methods: {
formatProps: function formatProps(props) {
return props ? [].concat(props) : undefined;
},
formatToArray: function formatToArray(filters) {
return filters ? [].concat(filters) : [];
}
},
watch: {
innerPaginationDef: {
immediate: true,
handler: function handler(val) {
this.innerPageSize = val.pageSize;
this.currentPage = val.currentPage;
}
},
searchKey: function searchKey() {
this.updateInnerSearchKey();
}
}
});
/***/ }),
/* 10 */
/***/ (function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(4)
, core = __webpack_require__(1)
, ctx = __webpack_require__(33)
, hide = __webpack_require__(37)
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, expProto = exports[PROTOTYPE]
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(a, b, c){
if(this instanceof C){
switch(arguments.length){
case 0: return new C;
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if(IS_PROTO){
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(32);
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(42)
, enumBugKeys = __webpack_require__(35);
module.exports = Object.keys || function keys(O){
return $keys(O, enumBugKeys);
};
/***/ }),
/* 14 */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil
, floor = Math.floor;
module.exports = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(12)
, defined = __webpack_require__(10);
module.exports = function(it){
return IObject(defined(it));
};
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(10);
module.exports = function(it){
return Object(defined(it));
};
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
* 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(root, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports === "object") {
module.exports = factory();
} else {
root.debounce = factory();
}
})(this, function() {
"use strict";
return function(callback, delay) {
var timeout;
return function() {
var context = this, args = arguments;
clearTimeout(timeout);
timeout = setTimeout(function() {
callback.apply(context, args);
}, delay);
};
};
});
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
function injectStyle (ssrContext) {
__webpack_require__(62)
}
var Component = __webpack_require__(7)(
/* script */
__webpack_require__(22),
/* template */
__webpack_require__(59),
/* styles */
injectStyle,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
function injectStyle (ssrContext) {
__webpack_require__(63)
}
var Component = __webpack_require__(7)(
/* script */
__webpack_require__(23),
/* template */
__webpack_require__(60),
/* styles */
injectStyle,
/* scopeId */
null,
/* moduleIdentifier (server only) */
null
)
module.exports = Component.exports
/***/ }),
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony default export */ __webpack_exports__["a"] = ({
propError: function propError(prop) {
return "prop " + prop + " not exist in the row, please confirm wether the prop is right, this may cause unpredictable filter result";
}
});
/***/ }),
/* 21 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_DataTables__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_DataTables___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__components_DataTables__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_DataTablesServer__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_DataTablesServer___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__components_DataTablesServer__);
/* harmony reexport (default from non-hamory) */ __webpack_require__.d(__webpack_exports__, "DataTables", function() { return __WEBPACK_IMPORTED_MODULE_0__components_DataTables___default.a; });
/* harmony reexport (default from non-hamory) */ __webpack_require__.d(__webpack_exports__, "DataTablesServer", function() { return __WEBPACK_IMPORTED_MODULE_1__components_DataTablesServer___default.a; });
var install = function install(Vue) {
Vue.component(__WEBPACK_IMPORTED_MODULE_0__components_DataTables___default.a.name, __WEBPACK_IMPORTED_MODULE_0__components_DataTables___default.a);
};
__WEBPACK_IMPORTED_MODULE_0__components_DataTables___default.a.install = install;
__WEBPACK_IMPORTED_MODULE_1__components_DataTablesServer___default.a.install = function (Vue) {
Vue.component(__WEBPACK_IMPORTED_MODULE_1__components_DataTablesServer___default.a.name, __WEBPACK_IMPORTED_MODULE_1__components_DataTablesServer___default.a);
};
/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__components_DataTables___default.a);
/***/ }),
/* 22 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__ = __webpack_require__(25);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ErrorTips_js__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__mixins_ShareMixin__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_javascript_debounce__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_javascript_debounce___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_javascript_debounce__);
/* harmony default export */ __webpack_exports__["default"] = ({
name: 'DataTables',
mixins: [__WEBPACK_IMPORTED_MODULE_3__mixins_ShareMixin__["a" /* default */]],
data: function data() {
return {
sortData: {}
};
},
computed: {
innerCheckboxFilterDef: function innerCheckboxFilterDef() {
var _allDataProps = this._allDataProps;
return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default()({
props: undefined,
def: [],
colProps: {
span: 14
},
filterFunction: function filterFunction(el, filter) {
var props = filter.props || _allDataProps;
return props.some(function (prop) {
var elVal = el[prop];
if (elVal === undefined) {
console.error(__WEBPACK_IMPORTED_MODULE_2__ErrorTips_js__["a" /* default */].propError(prop));
} else if (elVal === null) {
return false;
}
return filter.vals.some(function (val) {
return elVal.toString() === val;
});
});
}
}, this.checkboxFilterDef);
},
innerSearchDef: function innerSearchDef() {
return __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_object_assign___default()({
show: true,
props: undefined,
filterFunction: undefined,
debounceTime: 200,
prefixIcon: 'el-icon-search'
}, this.searchDef);
},
sortedData: function sortedData() {
var sortedData = this.data.slice();
if (this.sortData.order) {
var order = this.sortData.order;
var prop = this.sortData.prop;
var isDescending = order === 'descending';
sortedData.sort(function (a, b) {
if (a[prop] > b[prop]) {
return 1;
} else if (a[prop] < b[prop]) {
return -1;
} else {
return 0;
}
});
if (isDescending) {
sortedData.reverse();
}
}
return sortedData;
},
tableData: function tableData() {
var filteredData = this.sortedData.slice();
var _allDataProps = this._allDataProps;
var doFilter = function doFilter(defaultFilterFunction, filter) {
var filterFunction = filter.filterFunction || defaultFilterFunction;
filteredData = filteredData.filter(function (el) {
return filterFunction(el, filter);
});
};
this.filters.forEach(function (filter) {
var vals = filter.vals;
if (!vals || vals.length === 0) {
return true;
}
var defaultFilterFunction = function defaultFilterFunction(el, filter) {
var props = filter.props || _allDataProps;
return props.some(function (prop) {
var elVal = el[prop];
if (elVal === undefined) {
console.error(__WEBPACK_IMPORTED_MODULE_2__ErrorTips_js__["a" /* default */].propError(prop));
} else if (elVal === null) {
return false;
}
return filter.vals.some(function (val) {
return elVal.toString().toLowerCase().indexOf(val.toLowerCase()) > -1;
});
});
};
doFilter(defaultFilterFunction, filter);
});
this.$emit('filtered-data', filteredData);
return filteredData;
},
curTableData: function curTableData() {
var from = this.innerPageSize * (this.currentPage - 1);
var to = from + this.innerPageSize;
return this.tableData.slice(from, to);
},
total: function total() {
return this.tableData.length;
},
filters: function filters() {
var filters = this.formatToArray(this.innerCustomFilters);
if (this.showActionBar) {
if (this.searchShow) {
filters.push({
props: this.formatProps(this.innerSearchDef.props),
vals: this.formatToArray(this.innerSearchKey),
filterFunction: this.innerSearchDef.filterFunction
});
}
if (this.checkboxShow) {
filters.push({
props: this.formatProps(this.innerCheckboxFilterDef.props),
vals: this.checkBoxValues,
filterFunction: this.innerCheckboxFilterDef.filterFunction
});
}
}
return filters;
},
updateInnerSearchKey: function updateInnerSearchKey() {
var _this = this;
var timeout = this.innerSearchDef.debounceTime;
return __WEBPACK_IMPORTED_MODULE_4_javascript_debounce___default()(function (_) {
_this.innerSearchKey = _this.searchKey;
}, timeout);
}
},
methods: {
handleSizeChange: function handleSizeChange(size) {
this.innerPageSize = size;
this.$emit('size-change', size);
},
handlePageChange: function handlePageChange(currentPage) {
this.currentPage = currentPage;
this.$emit('current-change', currentPage);
},
handleCheckBoxValChange: function handleCheckBoxValChange(checkBoxValues) {
this.checkBoxValues = checkBoxValues;
},
handleSort: function handleSort(obj) {
this.sortData = obj;
}
},
watch: {
data: {
immediate: true,
handler: function handler(val) {
this._allDataProps = __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_keys___default()(val && val[0] || {});
}
}
}
});
/***/ }),
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__mixins_ShareMixin__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_javascript_debounce__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_javascript_debounce___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_javascript_debounce__);
/* harmony default export */ __webpack_exports__["default"] = ({
name: 'DataTablesServer',
mixins: [__WEBPACK_IMPORTED_MODULE_2__mixins_ShareMixin__["a" /* default */]],
props: {
loadingStr: {
type: String,
default: ''
},
total: {
type: Number
},
loadData: {
type: Function
},
loading: {
type: Boolean,
default: false
}
},
created: function created() {
this.loadData && this.innerLoadData(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default()({
type: 'init'
}, this.queryInfo));
},
data: function data() {
return {
innerLoading: false
};
},
computed: {
innerCheckboxFilterDef: function innerCheckboxFilterDef() {
return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({
props: undefined,
def: [],
colProps: {
span: 14
}
}, this.checkboxFilterDef);
},
innerSearchDef: function innerSearchDef() {
return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_object_assign___default()({
show: true,
props: undefined,
debounceTime: 200
}, this.searchDef);
},
filters: function filters() {
var filters = this.formatToArray(this.innerCustomFilters);
if (this.showActionBar) {
if (this.searchShow) {
filters.push({
props: this.formatProps(this.innerSearchDef.props),
vals: this.formatToArray(this.innerSearchKey)
});
}
if (this.checkboxShow) {
filters.push({
props: this.formatProps(this.innerCheckboxFilterDef.props),
vals: this.checkBoxValues
});
}
}
return filters;
},
curTableData: function curTableData() {
return this.data.length > this.innerPageSize ? this.data.slice(0, this.innerPageSize) : this.data;
},
queryInfo: function queryInfo() {
return {
page: this.currentPage,
pageSize: this.innerPageSize,
sortInfo: this.sortData,
filters: this.filters
};
},
updateInnerSearchKey: function updateInnerSearchKey() {
var _this = this;
var timeout = this.innerSearchDef.debounceTime;
return __WEBPACK_IMPORTED_MODULE_3_javascript_debounce___default()(function (_) {
_this.innerSearchKey = _this.searchKey;
_this.queryChange('searchBoxChange');
}, timeout);
}
},
methods: {
queryChange: function queryChange(type) {
var info = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_extends___default()({
type: type
}, this.queryInfo);
this.$emit('query-change', info);
this.loadData && this.innerLoadData(info);
},
handleSizeChange: function handleSizeChange(size) {
this.innerPageSize = size;
this.queryChange('sizeChange');
},
handlePageChange: function handlePageChange(currentPage) {
this.currentPage = currentPage;
this.queryChange('pageChange');
},
handleCheckBoxValChange: function handleCheckBoxValChange(checkBoxValues) {
this.checkBoxValues = checkBoxValues;
this.queryChange('checkBoxChange');
},
handleSort: function handleSort(obj) {
this.sortData = obj;
this.queryChange('sortChange');
},
innerLoadData: function innerLoadData(info) {
var _this2 = this;
this.innerLoading = true;
this.loadData && this.loadData(info).then(function (data) {
_this2.innerLoading = false;
_this2.$emit('load-data-success', data, info);
}).catch(function (error) {
_this2.innerLoading = false;
_this2.$emit('load-data-fail', error, info);
});
}
},
watch: {
innerCustomFilters: function innerCustomFilters() {
this.queryChange('customFilterChange');
},
loading: function loading(val) {
this.innerLoading = val;
}
}
});
/***/ }),
/* 24 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony default export */ __webpack_exports__["default"] = ({
props: {
checks: [Array]
},
data: function data() {
return {
checkList: []
};
},
methods: {
changeHandler: function changeHandler() {
this.$emit('checkChange', this.checkList);
}
}
});
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(28), __esModule: true };
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _assign = __webpack_require__(0);
var _assign2 = _interopRequireDefault(_assign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _assign2.default || 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;
};
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(52);
module.exports = __webpack_require__(1).Object.assign;
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(53);
module.exports = __webpack_require__(1).Object.keys;
/***/ }),
/* 29 */
/***/ (function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(5);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(15)
, toLength = __webpack_require__(49)
, toIndex = __webpack_require__(48);
module.exports = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = toIObject($this)
, length = toLength(O.length)
, index = toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ }),
/* 32 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(29);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(5)
, document = __webpack_require__(4).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
/***/ }),
/* 35 */
/***/ (function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ }),
/* 36 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(40)
, createDesc = __webpack_require__(45);
module.exports = __webpack_require__(3) ? function(object, key, value){
return dP.f(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(3) && !__webpack_require__(2)(function(){
return Object.defineProperty(__webpack_require__(34)('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// 19.1.2.1 Object.assign(target, source, ...)
var getKeys = __webpack_require__(13)
, gOPS = __webpack_require__(41)
, pIE = __webpack_require__(43)
, toObject = __webpack_require__(16)
, IObject = __webpack_require__(12)
, $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__(2)(function(){
var A = {}
, B = {}
, S = Symbol()
, K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function(k){ B[k] = k; });
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
var T = toObject(target)
, aLen = arguments.length
, index = 1
, getSymbols = gOPS.f
, isEnum = pIE.f;
while(aLen > index){
var S = IObject(arguments[index++])
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
} return T;
} : $assign;
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(30)
, IE8_DOM_DEFINE = __webpack_require__(38)
, toPrimitive = __webpack_require__(50)
, dP = Object.defineProperty;
exports.f = __webpack_require__(3) ? Object.defineProperty : function defineProperty(O, P, Attributes){
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if(IE8_DOM_DEFINE)try {
return dP(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)O[P] = Attributes.value;
return O;
};
/***/ }),
/* 41 */
/***/ (function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(36)
, toIObject = __webpack_require__(15)
, arrayIndexOf = __webpack_require__(31)(false)
, IE_PROTO = __webpack_require__(46)('IE_PROTO');
module.exports = function(object, names){
var O = toIObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(names.length > i)if(has(O, key = names[i++])){
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/* 43 */
/***/ (function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ }),
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(11)
, core = __webpack_require__(1)
, fails = __webpack_require__(2);
module.exports = function(KEY, exec){
var fn = (core.Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
};
/***/ }),
/* 45 */
/***/ (function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writ