@mdsfe/mds-ui
Version:
A set of enterprise-class Vue UI components.
1,730 lines (1,526 loc) • 123 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"), require("./_util/proptype"), require("./_mixin/locale"), require("./transition"));
else if(typeof define === 'function' && define.amd)
define(["vue", "./_util/proptype", "./_mixin/locale", "./transition"], factory);
else {
var a = typeof exports === 'object' ? factory(require("vue"), require("./_util/proptype"), require("./_mixin/locale"), require("./transition")) : factory(root["Vue"], root["./_util/proptype"], root["./_mixin/locale"], root["./transition"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function(__WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__12__) {
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;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // 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 = "/dist/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 119);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + 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 = shadowMode
? function () {
injectStyles.call(
this,
(options.functional ? this.parent : this).$root.$options.shadowRoot
)
}
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functional component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 1:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return on; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return off; });
/* unused harmony export once */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return removeClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getStyle; });
/* unused harmony export setStyle */
/* unused harmony export isScroll */
/* unused harmony export getScrollContainer */
/* unused harmony export isInContainer */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return merge; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollBarWidth; });
/* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(10);
/* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_1__);
/* eslint-disable */
var isServer = vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer;
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
var ieVersion = isServer ? 0 : Number(document.documentMode);
/* istanbul ignore next */
var trim = function trim(string) {
return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
};
/* istanbul ignore next */
var camelCase = function camelCase(name) {
return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
return offset ? letter.toUpperCase() : letter;
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
};
/* istanbul ignore next */
var on = function () {
if (!isServer && document.addEventListener) {
return function (element, event, handler) {
if (element && event && handler) {
element.addEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event && handler) {
element.attachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var off = function () {
if (!isServer && document.removeEventListener) {
return function (element, event, handler) {
if (element && event) {
element.removeEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event) {
element.detachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var once = function once(el, event, fn) {
var listener = function listener() {
if (fn) {
fn.apply(this, arguments);
}
off(el, event, listener);
};
on(el, event, listener);
};
/* istanbul ignore next */
function hasClass(el, cls) {
if (!el || !cls) return false;
if (cls.indexOf(' ') !== -1) {
throw new Error('className should not contain space.');
}
if (el.classList) {
return el.classList.contains(cls);
} else {
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
}
/* istanbul ignore next */
function addClass(el, cls) {
if (!el) return;
var curClass = el.className;
var classes = (cls || '').split(' ');
for (var i = 0, j = classes.length; i < j; i++) {
var clsName = classes[i];
if (!clsName) continue;
if (el.classList) {
el.classList.add(clsName);
} else if (!hasClass(el, clsName)) {
curClass += ' ' + clsName;
}
}
if (!el.classList) {
el.setAttribute('class', curClass);
}
}
/* istanbul ignore next */
function removeClass(el, cls) {
if (!el || !cls) return;
var classes = cls.split(' ');
var curClass = ' ' + el.className + ' ';
for (var i = 0, j = classes.length; i < j; i++) {
var clsName = classes[i];
if (!clsName) continue;
if (el.classList) {
el.classList.remove(clsName);
} else if (hasClass(el, clsName)) {
curClass = curClass.replace(' ' + clsName + ' ', ' ');
}
}
if (!el.classList) {
el.setAttribute('class', trim(curClass));
}
}
/* istanbul ignore next */
var getStyle = ieVersion < 9 ? function (element, styleName) {
if (isServer) return;
if (!element || !styleName) return null;
styleName = camelCase(styleName);
if (styleName === 'float') {
styleName = 'styleFloat';
}
try {
switch (styleName) {
case 'opacity':
try {
return element.filters.item('alpha').opacity / 100;
} catch (e) {
return 1.0;
}
default:
return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
}
} catch (e) {
return element.style[styleName];
}
} : function (element, styleName) {
if (isServer) return;
if (!element || !styleName) return null;
styleName = camelCase(styleName);
if (styleName === 'float') {
styleName = 'cssFloat';
}
try {
var computed = document.defaultView.getComputedStyle(element, '');
return element.style[styleName] || computed ? computed[styleName] : null;
} catch (e) {
return element.style[styleName];
}
};
/* istanbul ignore next */
function setStyle(element, styleName, value) {
if (!element || !styleName) return;
if ((typeof styleName === 'undefined' ? 'undefined' : babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(styleName)) === 'object') {
for (var prop in styleName) {
if (styleName.hasOwnProperty(prop)) {
setStyle(element, prop, styleName[prop]);
}
}
} else {
styleName = camelCase(styleName);
if (styleName === 'opacity' && ieVersion < 9) {
element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
} else {
element.style[styleName] = value;
}
}
}
var isScroll = function isScroll(el, vertical) {
if (isServer) return;
var determinedDirection = vertical !== null && vertical !== undefined;
var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
return overflow.match(/(scroll|auto|overlay)/);
};
var getScrollContainer = function getScrollContainer(el, vertical) {
if (isServer) return;
var parent = el;
while (parent) {
if ([window, document, document.documentElement].includes(parent)) {
return window;
}
if (isScroll(parent, vertical)) {
return parent;
}
parent = parent.parentNode;
}
return parent;
};
var isInContainer = function isInContainer(el, container) {
if (isServer || !el || !container) return false;
var elRect = el.getBoundingClientRect();
var containerRect = void 0;
if ([window, document, document.documentElement, null, undefined].includes(container)) {
containerRect = {
top: 0,
right: window.innerWidth,
bottom: window.innerHeight,
left: 0
};
} else {
containerRect = container.getBoundingClientRect();
}
return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
};
function merge(target) {
for (var i = 1, j = arguments.length; i < j; i++) {
var source = arguments[i] || {};
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
var value = source[prop];
if (value !== undefined) {
target[prop] = value;
}
}
}
}
return target;
}
var scrollBarWidth = void 0;
function getScrollBarWidth() {
if (vue__WEBPACK_IMPORTED_MODULE_1___default.a.prototype.$isServer) return 0;
if (scrollBarWidth !== undefined) return scrollBarWidth;
var outer = document.createElement('div');
outer.className = 'el-scrollbar__wrap';
outer.style.visibility = 'hidden';
outer.style.width = '100px';
outer.style.position = 'absolute';
outer.style.top = '-9999px';
document.body.appendChild(outer);
var widthNoScroll = outer.offsetWidth;
outer.style.overflow = 'scroll';
var inner = document.createElement('div');
inner.style.width = '100%';
outer.appendChild(inner);
var widthWithScroll = inner.offsetWidth;
outer.parentNode.removeChild(outer);
scrollBarWidth = widthNoScroll - widthWithScroll;
return scrollBarWidth;
}
/***/ }),
/***/ 10:
/***/ (function(module, exports) {
module.exports = require("babel-runtime/helpers/typeof");
/***/ }),
/***/ 11:
/***/ (function(module, exports) {
module.exports = require("babel-runtime/core-js/object/keys");
/***/ }),
/***/ 119:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./components/style/index.less
var style = __webpack_require__(142);
// EXTERNAL MODULE: ./components/slot-table/style/index.less
var slot_table_style = __webpack_require__(229);
// CONCATENATED MODULE: ./components/slot-table/style/index.js
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/slot-table/src/table.vue?vue&type=template&id=0d34df4e&
var tablevue_type_template_id_0d34df4e_render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "mds-slot-table-block" },
[
_c(
"mds-loading",
{
staticClass: "mds-slot-table-loading",
style:
"opacity: " +
(_vm.loading ? 1 : 0) +
";z-index: " +
(_vm.loading ? 2000 : -1),
attrs: {
isLoading: "",
type: _vm.loadingType,
color: _vm.loadingColor,
loadingText: _vm.displayLoadText,
maskColor: _vm.loadingMaskColor,
},
},
[_vm._t("loading")],
2
),
_c("div", { staticClass: "mds-slot-table-slot" }, [_vm._t("default")], 2),
_c(
"div",
{ ref: "tableHeader", staticClass: "mds-slot-table-header" },
[
_c("mds-slot-table-header", {
ref: "head",
attrs: {
showHeader: _vm.showHeader,
headerRowClassName: _vm.headerRowClassName,
headerRowStyle: _vm.headerRowStyle,
headerCellClassName: _vm.headerCellClassName,
headerCellStyle: _vm.headerCellStyle,
resizeWidth: _vm.resizeWidth,
tableSize: _vm.tableSize,
columns: _vm.columns,
width: _vm.doWidth,
border: _vm.border,
"has-gutter": _vm.hasGutter,
"gutter-width": _vm.scrollWidth,
},
on: {
"col-resize": _vm.thColResize,
headerInit: _vm.handleHeaderInit,
},
}),
],
1
),
_c(
"div",
{
ref: "tableBody",
staticClass: "mds-slot-table-body",
style: {
height: _vm.bodyHeight,
maxHeight: _vm.bodyMaxHeight,
},
on: { scroll: _vm.onscroll },
},
[
_c(
"mds-slot-table-body",
_vm._g(
{
attrs: {
tableSize: _vm.tableSize,
stripe: _vm.stripe,
border: _vm.border,
width: _vm.doWidth,
rowClassName: _vm.rowClassName,
rowStyle: _vm.rowStyle,
columns: _vm.columns,
data: _vm.data,
},
},
_vm.$listeners
)
),
_vm.data.length === 0
? _c(
"div",
{ staticClass: "mds-slot-table-void" },
[
_vm.hasCustomEmpty
? [_vm._t("customEmpty")]
: [
_c(
"mds-empty",
{
attrs: {
desc: _vm.emptyDesc,
size: _vm.emptySize,
image: _vm.emptyImage,
imageStyle: _vm.emptyImageStyle,
},
},
[
_c(
"template",
{ slot: "custom" },
[_vm._t("empty")],
2
),
],
2
),
],
],
2
)
: _vm._e(),
],
1
),
],
1
)
}
var staticRenderFns = []
tablevue_type_template_id_0d34df4e_render._withStripped = true
// CONCATENATED MODULE: ./components/slot-table/src/table.vue?vue&type=template&id=0d34df4e&
// EXTERNAL MODULE: external "babel-runtime/helpers/extends"
var extends_ = __webpack_require__(26);
var extends_default = /*#__PURE__*/__webpack_require__.n(extends_);
// CONCATENATED MODULE: ./components/slot-table/src/util.js
// 转化长宽
function toPxNumber(val) {
if (val !== undefined) {
val = parseInt(val, 10);
if (isNaN(val)) {
val = null;
}
}
return val;
}
function addAlignClass(col, type) {
var name = '';
switch (col[type]) {
case 'center':
name = 'is-center';
break;
case 'right':
name = 'is-right';
break;
default:
name = col.index ? 'is-center' : 'is-left';
}
return name;
}
var scrollBarWidth = void 0;
function getScrollBarWidth() {
if (scrollBarWidth !== undefined) return scrollBarWidth;
var outer = document.createElement('div');
outer.style.visibility = 'hidden';
outer.style.width = '100px';
outer.style.position = 'absolute';
outer.style.top = '-9999px';
document.body.appendChild(outer);
var widthNoScroll = outer.offsetWidth;
outer.style.overflow = 'scroll';
var inner = document.createElement('div');
inner.style.width = '100%';
outer.appendChild(inner);
var widthWithScroll = inner.offsetWidth;
outer.parentNode.removeChild(outer);
scrollBarWidth = widthNoScroll - widthWithScroll;
return scrollBarWidth;
}
function toCamelCase(str) {
var arr = str.split('-');
for (var i = 1; i < arr.length; i++) {
arr[i] = arr[i].charAt(0).toUpperCase() + arr[i].substring(1);
}
return arr.join('');
}
function handleRowFunctionOrString(val, row, rowIndex) {
return typeof val === 'function' ? val({ row: extends_default()({}, row), rowIndex: rowIndex }) : val;
}
function handleCellFunctionOrString(val, row, column, rowIndex, columnIndex) {
return typeof val === 'function' ? val({ row: extends_default()({}, row), column: extends_default()({}, column), rowIndex: rowIndex, columnIndex: columnIndex }) : val;
}
// EXTERNAL MODULE: external "babel-runtime/helpers/toConsumableArray"
var toConsumableArray_ = __webpack_require__(19);
var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray_);
// CONCATENATED MODULE: ./components/slot-table/src/table-header.js
/* harmony default export */ var table_header = ({
name: 'MdsSlotTableHeader',
props: {
tableSize: String,
showHeader: Boolean,
headerRowClassName: [String, Function],
headerRowStyle: [Object, Function],
headerCellClassName: [String, Function],
headerCellStyle: [Object, Function],
columns: Array,
width: [String, Number],
border: Boolean,
hasGutter: Boolean,
gutterWidth: [String, Number],
resizeWidth: Boolean
},
methods: {
cellClass: function cellClass(col, index) {
var align = addAlignClass(col, col.headerAlign ? 'headerAlign' : 'align');
var tableSzie = 'mds-slot-table-' + this.tableSize;
var elli = col.elli ? 'elli' : '';
var thClass = typeof col.labelClassName === 'function' ? col.labelClassName({ column: extends_default()({}, col), index: index }) : col.labelClassName;
return [align, tableSzie, elli, thClass];
},
// 定制列宽,距离小于10的时候出现resize标识
thMouseMove: function thMouseMove(e) {
if (!this.resizeWidth) {
return;
}
var offsetRight = e.target.offsetWidth - e.offsetX;
if (offsetRight < 10) {
e.target.style.cursor = 'col-resize';
} else {
e.target.style.cursor = '';
}
},
thMouseDown: function thMouseDown(e, index) {
if (!this.resizeWidth) {
return;
}
var offsetRight = e.target.offsetWidth - e.offsetX;
if (offsetRight > 10) return null;
this.$emit('col-resize', {
event: e,
column: this.columns[index]
});
}
// setCol() {
// // 注释节点不进行判断
// if (this.$el.nodeType === 8) { return }
// let childs = this.$el.querySelectorAll('thead > th')
// let len = childs.length
// if (!len) return
// for (let i = 0; i < len; i++) {
// const th = childs[i]
// if (th.className.indexOf('gutter') === -1) {
// debugger
// this.columns[i].width = th.offsetWidth
// }
// }
// }
},
mounted: function mounted() {
if (this.$ready) return;
// this.setCol()
this.$ready = true;
this.$emit('headerInit');
},
render: function render() {
var _this = this;
var h = arguments[0];
if (this.showHeader) {
return h(
'table',
{
'class': {
'mds-slot-table': true,
'mds-slot-table-head': true,
'mds-slot-table__border': this.border
},
style: {
width: this.width
}
},
[h('colgroup', [this.columns.map(function (column, index) {
return h('col', { key: column.id, attrs: { width: toPxNumber(column.width) }
});
}), this.hasGutter ? h('col', {
attrs: { name: 'gutter', width: this.gutterWidth },
style: '' }) : null]), h(
'thead',
{ ref: 'thead' },
[h(
'tr',
{
'class': ['mds-slot-table-head-tr', handleRowFunctionOrString(this.headerRowClassName, undefined, 0)],
style: handleRowFunctionOrString(this.headerRowStyle, undefined, 0)
},
[this.columns.map(function (column, index) {
return h(
'th',
{
attrs: {
colspan: '1',
rowspan: '1'
},
key: column.id,
style: extends_default()({}, handleCellFunctionOrString(_this.headerCellStyle, undefined, column, 0, index)),
'class': ['mds-slot-table-column'].concat(toConsumableArray_default()(_this.cellClass(column, index)), [handleCellFunctionOrString(_this.headerCellClassName, undefined, column, 0, index)]),
on: {
'mousemove': _this.thMouseMove,
'mousedown': function mousedown($event) {
return _this.thMouseDown($event, index);
}
}
},
[column.label]
);
}), this.hasGutter ? h('th', { 'class': 'mds-slot-table-column mds-slot-table-th-gutter' }) : null]
)]
)]
);
}
}
});
// CONCATENATED MODULE: ./components/slot-table/src/table-body.js
/* harmony default export */ var table_body = ({
name: 'MdsSlotTableBody',
props: {
tableSize: String,
columns: {
type: Array,
default: []
},
data: {
type: Array,
default: []
},
stripe: Boolean,
border: Boolean,
width: String,
rowClassName: [String, Function],
rowStyle: [Object, Function]
},
methods: {
cellClass: function cellClass(col, row, rindex, cindex) {
var align = addAlignClass(col, 'align');
var tableSzie = 'mds-slot-table-' + this.tableSize;
var light = col.light ? 'mds-slot-table-column--light' : '';
var hoverlight = col.hoverlight ? 'mds-slot-table-column--hoverlight' : '';
var cell = typeof col.className === 'function' ? col.className({
column: extends_default()({}, col),
row: extends_default()({}, row),
rindex: rindex,
cindex: cindex
}) : col.className;
return ['mds-slot-table-column', align, tableSzie, light, hoverlight, cell];
}
},
render: function render() {
var _this = this;
var h = arguments[0];
return h(
'table',
{
ref: 'table',
'class': {
'mds-slot-table': true,
'mds-slot-table__stripe': this.stripe,
'mds-slot-table__border': this.border
},
style: {
width: this.width
}
},
[h('colgroup', [this.columns.map(function (column, index) {
return h('col', {
key: column.id,
attrs: { width: toPxNumber(column.width)
}
});
})]), h('tbody', [this.data.map(function (row, rindex) {
return h(
'tr',
{
'class': ['mds-slot-table-row', handleRowFunctionOrString(_this.rowClassName, row, rindex)],
style: handleRowFunctionOrString(_this.rowStyle, row, rindex),
key: rindex,
on: {
'click': function click(event) {
return _this.$emit('row-click', { event: event, row: row, index: rindex });
},
'mouseover': function mouseover(event) {
return _this.$emit('row-hover', { event: event, row: row, index: rindex });
}
}
},
[_this.columns.map(function (column, cindex) {
return h(
'td',
{
key: rindex + '-' + cindex,
'class': _this.cellClass(column, row, rindex, cindex)
},
[column.renderCell({
row: row,
column: column,
rowIndex: rindex,
columnIndex: cindex
})]
);
})]
);
})])]
);
}
});
// EXTERNAL MODULE: ./components/empty/empty.vue + 4 modules
var empty = __webpack_require__(39);
// EXTERNAL MODULE: external "./_mixin/locale"
var locale_ = __webpack_require__(9);
var locale_default = /*#__PURE__*/__webpack_require__.n(locale_);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/slot-table/src/table.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// 用于生成table key
var tableIdSeed = 1;
/* harmony default export */ var tablevue_type_script_lang_js_ = ({
name: 'MdsSlotTable',
componentName: 'MdsSlotTable',
components: {
MdsSlotTableHeader: table_header,
MdsSlotTableBody: table_body,
MdsEmpty: empty["a" /* default */]
},
mixins: [locale_default.a],
props: {
size: {
type: String,
default: 'normal'
},
data: {
type: Array,
default: function _default() {
return [];
}
},
stripe: Boolean,
border: Boolean,
rowClassName: [String, Function],
rowStyle: [Object, Function],
height: [String, Number],
maxHeight: [String, Number],
showHeader: {
type: Boolean,
default: true
},
headerRowClassName: [String, Function],
headerRowStyle: [Object, Function],
headerCellClassName: [String, Function],
headerCellStyle: [Object, Function],
// 空状态相关属性
emptyDesc: String,
emptySize: String,
emptyImage: String,
emptyImageStyle: Object,
// loading相关属性
loading: Boolean,
loadingType: {
type: String,
default: 'ball-pulse'
},
loadingColor: String,
loadingMaskColor: String,
loadingText: {
type: String
},
resizeWidth: Boolean
},
data: function data() {
return {
columns: [],
isColResize: false,
startOffsetX: 0,
startWidth: 0,
currentColumn: null,
tableWidth: null,
scrollTop: 0,
scrollLeft: 0,
hasGutter: false,
// 滚动条宽度
scrollWidth: null,
bodyHeight: null,
bodyMaxHeight: null
};
},
watch: {
scrollLeft: function scrollLeft(val) {
this.$refs.tableHeader.scrollLeft = val;
}
},
computed: {
hasCustomEmpty: function hasCustomEmpty() {
return !!this.$slots.customEmpty;
},
tableSize: function tableSize() {
var sizeObj = {
normal: 'normal',
mini: 'mini'
};
return sizeObj[this.size] ? sizeObj[this.size] : 'normal';
},
doWidth: function doWidth() {
return this.tableWidth ? this.tableWidth + 'px' : null;
},
displayLoadText: function displayLoadText() {
return this.loadingText || this.t('mds.table.loadText');
}
},
methods: {
handleHeaderInit: function handleHeaderInit() {
var _this = this;
this.$nextTick(function () {
if (_this.height) {
_this.handleHeaderHeight('height');
}
if (_this.maxHeight) {
_this.handleHeaderHeight('maxHeight');
}
});
},
handleHeaderHeight: function handleHeaderHeight(key) {
var val = toPxNumber(this[key]);
var headerHeight = this.$refs['tableHeader'].offsetHeight;
this[toCamelCase('body-' + key)] = val - headerHeight + 'px';
},
// header更改列宽时初始化计算数据
thColResize: function thColResize(params) {
var event = params.event,
column = params.column;
this.isColResize = true;
this.startOffsetX = event.clientX;
this.startWidth = event.target.offsetWidth;
this.currentColumn = column;
this.oldTableWidth = this.$refs.tableBody.offsetWidth;
},
colResizeMouseUp: function colResizeMouseUp(e) {
// EventBus.$emit('ChangeColumnWidth', {colId: this.currentColumn.id, tableId: this.tableId})
this.isColResize = false;
},
// 拖拽列宽时改变表格宽度
colResizeMouseMove: function colResizeMouseMove(e) {
if (this.isColResize) {
var width = this.startWidth + e.clientX - this.startOffsetX;
// 默认index列最新40,其他80
var minWidth = parseInt(this.currentColumn.minWidth) || (this.currentColumn.index ? 40 : 80);
if (width >= minWidth) {
this.currentColumn.width = width;
this.tableWidth = this.oldTableWidth + e.clientX - this.startOffsetX;
}
}
},
onscroll: function onscroll(e) {
this.scrollLeft = e.target.scrollLeft;
this.scrollTop = e.target.scrollTop;
},
// body有滚动条的情况下设置header宽度
setGutter: function setGutter() {
var _this2 = this;
var tableBody = this.$refs.tableBody;
setTimeout(function () {
if (tableBody.offsetHeight < tableBody.scrollHeight) {
_this2.hasGutter = true;
} else {
_this2.hasGutter = false;
}
});
},
addListener: function addListener() {
this.$refs.tableHeader.addEventListener('mousemove', this.colResizeMouseMove);
this.$refs.tableHeader.addEventListener('mouseup', this.colResizeMouseUp);
},
removeListener: function removeListener() {
this.$refs.tableHeader.removeEventListener('mousemove', this.colResizeMouseMove);
this.$refs.tableHeader.removeEventListener('mouseup', this.colResizeMouseUp);
}
},
created: function created() {
this.scrollWidth = getScrollBarWidth();
this.toPxNumber = toPxNumber;
this.tableId = 'mds-slot-table_' + tableIdSeed++;
},
updated: function updated() {
this.setGutter();
},
mounted: function mounted() {
this.addListener();
this.setGutter();
},
beforeDestroy: function beforeDestroy() {
this.removeListener();
}
});
// CONCATENATED MODULE: ./components/slot-table/src/table.vue?vue&type=script&lang=js&
/* harmony default export */ var src_tablevue_type_script_lang_js_ = (tablevue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./components/slot-table/src/table.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
src_tablevue_type_script_lang_js_,
tablevue_type_template_id_0d34df4e_render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "components/slot-table/src/table.vue"
/* harmony default export */ var table = (component.exports);
// EXTERNAL MODULE: external "babel-runtime/core-js/object/keys"
var keys_ = __webpack_require__(11);
var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
// EXTERNAL MODULE: external "babel-helper-vue-jsx-merge-props"
var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(73);
var external_babel_helper_vue_jsx_merge_props_default = /*#__PURE__*/__webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
// EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
var defineProperty_ = __webpack_require__(3);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
// EXTERNAL MODULE: ./components/tooltip/index.js + 1 modules
var tooltip = __webpack_require__(42);
// CONCATENATED MODULE: ./components/slot-table/src/table-column.js
/* harmony default export */ var table_column = ({
name: 'MdsSlotTableColumn',
componentName: 'MdsSlotTableColumn',
components: {
MdsTooltip: tooltip["default"]
},
props: {
prop: String,
label: String,
align: String,
width: [Number, String],
// 标记是不是index列(暂未实现)
index: Boolean,
// 默认高亮
light: Boolean,
// hover高亮
hoverlight: Boolean,
// 是否溢出打点
elli: Boolean,
// 是否显示toopTip
tooltip: Boolean,
minWidth: [Number, String],
className: [String, Function],
labelClassName: [String, Function],
headerAlign: String,
tooltipOptions: {
type: Object,
default: function _default() {
return { effect: 'dark', placement: 'bottom' };
}
}
},
methods: {
// 递归寻找table节点
getParent: function getParent(name) {
var parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== name) {
parent = parent.$parent;
} else {
return parent;
}
}
return null;
},
// 设置要传给table的column实例
setColumnRender: function setColumnRender() {
var _this = this;
var h = this.$createElement;
var column = extends_default()({}, this.$props);
column.renderCell = function (data) {
var cellId = 'row_' + data.rowIndex + '_col_' + data.columnIndex;
var render = void 0;
// 返回插槽内容,不响应一般内容的额外属性
if (_this.$scopedSlots.default) {
render = function render() {
return _this.$scopedSlots.default(data);
};
return h(
'div',
{ 'class': 'cell' },
[render()]
);
}
render = function render(data) {
return column.index ? data.rowindex + 1 : data.row[column.prop];
};
var tempTemplete = void 0;
if (column.tooltip && column.elli) {
var _ref;
tempTemplete = h(
'mds-tooltip',
external_babel_helper_vue_jsx_merge_props_default()([{ props: _this.tooltipOptions }, {
attrs: {
title: data.row[column.prop]
}
}]),
[h(
'div',
{
'class': (_ref = { cell: true }, defineProperty_default()(_ref, cellId, true), defineProperty_default()(_ref, 'elli', column.elli), _ref),
ref: 'cell-' + cellId
},
[render(data)]
)]
);
} else {
var _ref2;
tempTemplete = h(
'div',
{
'class': (_ref2 = { cell: true }, defineProperty_default()(_ref2, cellId, true), defineProperty_default()(_ref2, 'elli', column.elli), _ref2),
ref: 'cell-' + cellId
},
[render(data)]
);
}
return tempTemplete;
};
return column;
},
// 注册watcher
registerWatchers: function registerWatchers() {
var _this2 = this;
keys_default()(this.$props).forEach(function (key) {
_this2.$watch(key, function (newVal, oldVal) {
_this2.column[key] = newVal;
});
});
}
},
created: function created() {
this.column = {};
this.parent = this.getParent('MdsSlotTable');
this.column = this.setColumnRender();
},
mounted: function mounted() {
this.column.id = this.parent.columns.length;
this.parent.columns.push(this.column);
this.registerWatchers();
},
destroyed: function destroyed() {
if (this.parent) {
var index = this.parent.columns.map(function (e) {
return e.id;
}).indexOf(this.column.id);
if (index > -1) {
this.parent.columns.splice(index, 1);
}
}
},
render: function render(h) {
return null;
}
});
// CONCATENATED MODULE: ./components/slot-table/index.js
/* istanbul ignore next */
table.install = function (Vue) {
Vue.component(table.name, table);
Vue.component(table_column.name, table_column);
};
/* harmony default export */ var slot_table = __webpack_exports__["default"] = (table);
/***/ }),
/***/ 12:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__12__;
/***/ }),
/***/ 142:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 15:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _dom_helper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
/* harmony import */ var _popup_manager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _popup_manager__WEBPACK_IMPORTED_MODULE_2__["a"]; });
var idSeed = 1;
var scrollBarWidth = void 0;
/* harmony default export */ __webpack_exports__["b"] = ({
props: {
visibility: {
type: Boolean,
default: false
},
openDelay: {},
closeDelay: {},
zIndex: {},
modal: {
type: Boolean,
default: false
},
modalFade: {
type: Boolean,
default: true
},
modalClass: {},
modalAppendToBody: {
type: Boolean,
default: false
},
lockScroll: {
type: Boolean,
default: true
},
closeOnPressEscape: {
type: Boolean,
default: false
},
closeOnClickModal: {
type: Boolean,
default: false
}
},
beforeMount: function beforeMount() {
this._popupId = 'popup-' + idSeed++;
_popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].register(this._popupId, this);
},
beforeDestroy: function beforeDestroy() {
_popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].deregister(this._popupId);
_popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
this.restoreBodyStyle();
},
data: function data() {
return {
opened: false,
bodyPaddingRight: null,
computedBodyPaddingRight: 0,
withoutHiddenClass: true,
rendered: false
};
},
watch: {
visibility: function visibility(val) {
var _this = this;
if (val) {
if (this._opening) return;
if (!this.rendered) {
this.rendered = true;
vue__WEBPACK_IMPORTED_MODULE_0___default.a.nextTick(function () {
_this.open();
});
} else {
this.open();
}
} else {
this.close();
}
}
},
methods: {
open: function open(options) {
var _this2 = this;
if (!this.rendered) {
this.rendered = true;
}
var props = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* merge */ "e"])({}, this.$props || this, options);
if (this._closeTimer) {
clearTimeout(this._closeTimer);
this._closeTimer = null;
}
clearTimeout(this._openTimer);
var openDelay = Number(props.openDelay);
if (openDelay > 0) {
this._openTimer = setTimeout(function () {
_this2._openTimer = null;
_this2.doOpen(props);
}, openDelay);
} else {
this.doOpen(props);
}
},
doOpen: function doOpen(props) {
if (this.$isServer) return;
if (this.willOpen && !this.willOpen()) return;
if (this.opened) return;
this._opening = true;
var dom = this.$el;
var modal = props.modal;
var zIndex = props.zIndex;
if (zIndex) {
_popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].zIndex = zIndex;
}
if (modal) {
if (this._closing) {
_popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
this._closing = false;
}
_popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].openModal(this._popupId, _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].nextZIndex(), this.modalAppendToBody ? undefined : dom, props.modalClass, props.modalFade);
if (props.lockScroll) {
this.withoutHiddenClass = !Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* hasClass */ "d"])(document.body, 'mds-popup-parent--hidden');
if (this.withoutHiddenClass) {
this.bodyPaddingRight = document.body.style.paddingRight;
this.computedBodyPaddingRight = parseInt(Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'paddingRight'), 10);
}
scrollBarWidth = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getScrollBarWidth */ "b"])();
var bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
var bodyOverflowY = Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* getStyle */ "c"])(document.body, 'overflowY');
if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === 'scroll') && this.withoutHiddenClass) {
document.body.style.paddingRight = this.computedBodyPaddingRight + scrollBarWidth + 'px';
}
Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* addClass */ "a"])(document.body, 'mds-popup-parent--hidden');
}
}
if (getComputedStyle(dom).position === 'static') {
dom.style.position = 'absolute';
}
dom.style.zIndex = _popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].nextZIndex();
this.opened = true;
this.onOpen && this.onOpen();
this.doAfterOpen();
},
doAfterOpen: function doAfterOpen() {
this._opening = false;
},
close: function close() {
var _this3 = this;
if (this.willClose && !this.willClose()) return;
if (this._openTimer !== null) {
clearTimeout(this._openTimer);
this._openTimer = null;
}
clearTimeout(this._closeTimer);
var closeDelay = Number(this.closeDelay);
if (closeDelay > 0) {
this._closeTimer = setTimeout(function () {
_this3._closeTimer = null;
_this3.doClose();
}, closeDelay);
} else {
this.doClose();
}
},
doClose: function doClose() {
this._closing = true;
this.onClose && this.onClose();
if (this.lockScroll) {
setTimeout(this.restoreBodyStyle, 200);
}
this.opened = false;
this.doAfterClose();
},
doAfterClose: function doAfterClose() {
_popup_manager__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].closeModal(this._popupId);
this._closing = false;
},
restoreBodyStyle: function restoreBodyStyle() {
if (this.modal && this.withoutHiddenClass) {
document.body.style.paddingRight = this.bodyPaddingRight;
Object(_dom_helper__WEBPACK_IMPORTED_MODULE_1__[/* removeClass */ "h"])(document.body, 'mds-popup-parent--hidden');
}
this.withoutHiddenClass = true;
}
}
});
/***/ }),
/***/ 18:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./components/_util/_popper/popup/popup-main.js
var popup_main = __webpack_require__(15);
// EXTERNAL MODULE: external "babel-runtime/core-js/object/get-own-property-descriptor"
var get_own_property_descriptor_ = __webpack_require__(20);
var get_own_property_descriptor_default = /*#__PURE__*/__webpack_require__.n(get_own_property_descriptor_);
// EXTERNAL MODULE: external "babel-runtime/core-js/object/keys"
var keys_ = __webpack_require__(11);
var keys_default = /*#__PURE__*/__webpack_require__.n(keys_);
// EXTERNAL MODULE: external "babel-runtime/core-js/object/assign"
var assign_ = __webpack_require__(6);
var assign_default = /*#__PURE__*/__webpack_require__.n(assign_);
// CONCATENATED MODULE: ./components/_util/_popper/popper.js
/**
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @