@mdsfe/mds-ui
Version:
A set of enterprise-class Vue UI components.
1,305 lines (1,192 loc) • 34.4 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("./_util/proptype"), require("./_mixin/locale"), require("./input"));
else if(typeof define === 'function' && define.amd)
define(["./_util/proptype", "./_mixin/locale", "./input"], factory);
else {
var a = typeof exports === 'object' ? factory(require("./_util/proptype"), require("./_mixin/locale"), require("./input")) : factory(root["./_util/proptype"], root["./_mixin/locale"], root["./input"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function(__WEBPACK_EXTERNAL_MODULE__8__, __WEBPACK_EXTERNAL_MODULE__9__, __WEBPACK_EXTERNAL_MODULE__17__) {
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 = 98);
/******/ })
/************************************************************************/
/******/ ({
/***/ 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
}
}
/***/ }),
/***/ 142:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 17:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__17__;
/***/ }),
/***/ 186:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 204:
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/***/ 3:
/***/ (function(module, exports) {
module.exports = require("babel-runtime/helpers/defineProperty");
/***/ }),
/***/ 60:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(142);
/* harmony import */ var _style_index_less__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_index_less__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(186);
/* harmony import */ var _index_less__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_index_less__WEBPACK_IMPORTED_MODULE_1__);
/***/ }),
/***/ 8:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__8__;
/***/ }),
/***/ 9:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__9__;
/***/ }),
/***/ 98:
/***/ (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/pagination/style/index.less
var pagination_style = __webpack_require__(204);
// EXTERNAL MODULE: ./components/input/style/index.js
var input_style = __webpack_require__(60);
// CONCATENATED MODULE: ./components/pagination/style/index.js
// style dependencies
// import '../../select/style'
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/pagination/pagination.vue?vue&type=template&id=0d372f84&
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"ul",
{
class: [
_vm.simple ? _vm.prefixCls + "-simple" : "" + _vm.prefixCls,
_vm.disabled ? _vm.prefixCls + "-disabled" : "" + _vm.prefixCls,
_vm.mini ? "mini" : "",
],
},
[
!_vm.simple &&
(_vm.showTotalString || _vm.showTotalSize) &&
!_vm.mini &&
_vm.totalSeat === "left"
? _c("li", { class: _vm.prefixCls + "-total" }, [
_vm._v("\n " + _vm._s(_vm.dispatchTotal) + "\n\n "),
])
: _vm._e(),
!_vm.simple &&
_vm.showPageSize &&
!_vm.mini &&
_vm.pageSizesSeat === "left"
? _c("change-page", {
attrs: { pageSizes: _vm.pageSizes, pageSizeNum: _vm.pageSizeNum },
on: { changePageSize: _vm.changePageSize },
})
: _vm._e(),
_c(
"li",
{
class:
(_vm.hasPrev ? "" : _vm.prefixCls + "-disabled") +
" " +
_vm.prefixCls +
"-prev",
attrs: {
tabIndex: "0",
title: _vm.showTitle ? _vm.locale.prev_page : null,
"aria-disabled": !_vm.hasPrev,
},
on: { click: _vm.prev, keypress: _vm.runIfEnterPrev },
},
[
_vm._t("prev", [
_c("mds-icon", {
staticClass: "mds-pagination-item-link",
attrs: { type: "line-caret-left" },
}),
]),
],
2
),
_vm.simple
? _c(
"li",
{ class: _vm.prefixCls + "-simple-pager" },
[
_c("mds-input", {
attrs: { type: "text" },
on: { blur: _vm.handleJump, "press-enter": _vm.handleJump },
model: {
value: _vm.currentPage,
callback: function ($$v) {
_vm.currentPage = $$v
},
expression: "currentPage",
},
}),
_c("span", [_vm._v("/")]),
_c("span", { staticClass: "total" }, [
_vm._v(_vm._s(_vm.calculatePage)),
]),
],
1
)
: _vm._e(),
_vm.pageRange[0] !== 1 && !_vm.simple
? _c(
"li",
{
class: _vm.prefixCls + "-item",
attrs: { tabIndex: "0" },
on: {
click: function ($event) {
return _vm.handleChange(1)
},
},
},
[_c("a", [_vm._v("1")])]
)
: _vm._e(),
_vm.showJumpPrev && !_vm.simple
? _c(
"li",
{
class: _vm.prefixCls + "-jump-prev",
attrs: { tabIndex: "0" },
on: { click: _vm.jumpPrev, keypress: _vm.runIfEnterJumpPrev },
},
[_c("a", { class: _vm.prefixCls + "-item-link" })]
)
: _vm._e(),
!_vm.simple
? _vm._l(_vm.pageRange, function (i) {
return _c(
"li",
{
key: i,
ref: "page",
refInFor: true,
class: _vm.pagerClasses(i),
attrs: { tabIndex: "0" },
on: {
click: function ($event) {
return _vm.clickPage(i)
},
},
},
[_c("a", [_vm._v(_vm._s(i))])]
)
})
: _vm._e(),
_vm.showJumpNext && !_vm.simple
? _c(
"li",
{
class: _vm.prefixCls + "-jump-next",
attrs: { tabIndex: "0" },
on: { click: _vm.jumpNext, keypress: _vm.runIfEnterJumpNext },
},
[_c("a", { class: _vm.prefixCls + "-item-link" })]
)
: _vm._e(),
_vm.pageRange.length &&
_vm.pageRange[_vm.pageRange.length - 1] !== _vm.calculatePage &&
!_vm.simple
? _c(
"li",
{
class: _vm.prefixCls + "-item",
attrs: { tabIndex: "0" },
on: {
click: function ($event) {
return _vm.handleChange(_vm.calculatePage)
},
},
},
[_c("a", [_vm._v(_vm._s(_vm.calculatePage))])]
)
: _vm._e(),
_c(
"li",
{
class:
"" +
(_vm.hasNext ? "" : _vm.prefixCls + "-disabled ") +
_vm.prefixCls +
"-next",
attrs: { tabIndex: "0", "aria-disabled": !_vm.hasNext },
on: { click: _vm.next, keydown: _vm.runIfEnterNext },
},
[
_vm._t("next", [
_c("mds-icon", {
staticClass: "mds-pagination-item-link",
attrs: { type: "line-caret-right" },
}),
]),
],
2
),
_vm.showQuickJumper || _vm.showJumper
? _c("mds-page-option", {
attrs: {
"current-page": _vm.currentPage,
"calculate-page": _vm.calculatePage,
},
on: { "jump-to": _vm.handleQuickJump },
})
: _vm._e(),
!_vm.simple && _vm.showPageNumber && !_vm.mini
? _c("li", { class: _vm.prefixCls + "-more" }, [
_vm._v("\n 共 "),
_c("b", [_vm._v(_vm._s(_vm.calculatePage))]),
_vm._v(" 页\n "),
])
: _vm._e(),
!_vm.simple &&
_vm.showPageSize &&
!_vm.mini &&
_vm.pageSizesSeat === "right"
? _c("change-page", {
attrs: { pageSizes: _vm.pageSizes, pageSizeNum: _vm.pageSizeNum },
on: { changePageSize: _vm.changePageSize },
})
: _vm._e(),
!_vm.simple &&
(_vm.showTotalString || _vm.showTotalSize) &&
!_vm.mini &&
_vm.totalSeat === "right"
? _c(
"li",
{
staticClass: "total-seat-right",
class: _vm.prefixCls + "-total",
},
[_vm._v("\n " + _vm._s(_vm.dispatchTotal) + "\n ")]
)
: _vm._e(),
],
2
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./components/pagination/pagination.vue?vue&type=template&id=0d372f84&
// EXTERNAL MODULE: external "babel-runtime/helpers/defineProperty"
var defineProperty_ = __webpack_require__(3);
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty_);
// CONCATENATED MODULE: ./components/pagination/locale/zh_CN.js
/* harmony default export */ var zh_CN = ({
// Options.jsx
items_per_page: '条/页',
jump_to: '跳至',
jump_to_confirm: '确定',
page: '页',
// Pagination.jsx
prev_page: '上一页',
next_page: '下一页',
prev_5: '向前 5 页',
next_5: '向后 5 页',
prev_3: '向前 3 页',
next_3: '向后 3 页'
});
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/pagination/option.vue?vue&type=template&id=1ad093df&
var optionvue_type_template_id_1ad093df_render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("li", { class: "" + _vm.prefixCls }, [
_c(
"div",
{ class: _vm.prefixCls + "-quick-jumper" },
[
_vm._v("\n " + _vm._s(_vm.dispatchJumpTo) + "\n "),
_c("mds-input", {
attrs: { type: "text" },
on: { "press-enter": _vm.handleJump, blur: _vm.blurJump },
model: {
value: _vm.pageText,
callback: function ($$v) {
_vm.pageText = $$v
},
expression: "pageText",
},
}),
_vm._v("\n " + _vm._s(_vm.dispatchPageText) + "\n "),
],
1
),
])
}
var optionvue_type_template_id_1ad093df_staticRenderFns = []
optionvue_type_template_id_1ad093df_render._withStripped = true
// CONCATENATED MODULE: ./components/pagination/option.vue?vue&type=template&id=1ad093df&
// EXTERNAL MODULE: external "./input"
var external_input_ = __webpack_require__(17);
var external_input_default = /*#__PURE__*/__webpack_require__.n(external_input_);
// 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/pagination/option.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var optionvue_type_script_lang_js_ = ({
name: 'MdsPaginationOption',
mixins: [locale_default.a],
props: {
calculatePage: {
type: Number,
default: 1
},
currentPage: {
type: Number,
default: 1
},
prefixCls: {
type: String,
default: 'mds-pagination-options'
}
},
data: function data() {
return {
locale: zh_CN,
pageText: this.currentPage
};
},
methods: {
handlPage: function handlPage() {
var jumpPage = parseInt(this.pageText || 1, 10);
return jumpPage > this.calculatePage ? this.calculatePage : jumpPage;
},
handleJump: function handleJump(event) {
if (this.disabled) {
return;
}
(event.key === 'Enter' || event.charCode === 13) && this.$emit('jump-to', this.handlPage());
this.pageText = this.handlPage();
},
blurJump: function blurJump() {
if (this.disabled) {
return false;
}
this.$emit('jump-to', this.handlPage());
this.pageText = this.handlPage();
}
},
components: {
MdsInput: external_input_default.a
},
watch: {
currentPage: function currentPage() {
this.pageText = this.currentPage;
}
},
computed: {
dispatchJumpTo: function dispatchJumpTo() {
return this.t('mds.pagination.goto');
},
dispatchPageText: function dispatchPageText() {
return this.t('mds.pagination.pageClassifier');
}
}
});
// CONCATENATED MODULE: ./components/pagination/option.vue?vue&type=script&lang=js&
/* harmony default export */ var pagination_optionvue_type_script_lang_js_ = (optionvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./components/pagination/option.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
pagination_optionvue_type_script_lang_js_,
optionvue_type_template_id_1ad093df_render,
optionvue_type_template_id_1ad093df_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "components/pagination/option.vue"
/* harmony default export */ var pagination_option = (component.exports);
// EXTERNAL MODULE: external "./_util/proptype"
var proptype_ = __webpack_require__(8);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./components/pagination/changePage.vue?vue&type=template&id=26e49fc9&
var changePagevue_type_template_id_26e49fc9_render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"li",
{ class: "" + _vm.prefixCls },
[
_c(
"mds-select",
{
staticStyle: { width: "120px" },
attrs: {
placeholder: _vm.dispatchPlaceholder,
value: _vm.newSizeValue,
size: "medium",
},
on: { change: _vm.handleChange },
},
_vm._l(_vm.pageSizes, function (item) {
return _c(
"mds-option",
{ key: item, attrs: { value: "" + item + _vm.dispatchPageSize } },
[_vm._v(_vm._s("" + item + _vm.dispatchPageSize))]
)
}),
1
),
],
1
)
}
var changePagevue_type_template_id_26e49fc9_staticRenderFns = []
changePagevue_type_template_id_26e49fc9_render._withStripped = true
// CONCATENATED MODULE: ./components/pagination/changePage.vue?vue&type=template&id=26e49fc9&
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/pagination/changePage.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
// import locale from './locale/zh_CN'
/* harmony default export */ var changePagevue_type_script_lang_js_ = ({
name: 'MdsPaginationOption',
mixins: [locale_default.a],
props: {
prefixCls: {
type: String,
default: 'mds-pagination-pagesize-changer'
},
pageSizes: {
type: Array,
default: function _default() {
return [10, 20, 30, 50];
}
},
pageSizeNum: {
type: Number,
default: 10
}
},
data: function data() {
return {
// locale,
sizeValue: this.newSizeValue || this.pageSizes[0] + this.dispatchPageSize
};
},
computed: {
newSizeValue: function newSizeValue() {
if (this.pageSizes.includes(this.pageSizeNum)) {
return this.pageSizeNum + this.dispatchPageSize;
} else {
return this.pageSizes[0] + this.dispatchPageSize;
}
},
dispatchPageSize: function dispatchPageSize() {
return this.t('mds.pagination.pagesize');
},
dispatchPlaceholder: function dispatchPlaceholder() {
return this.t('mds.pagination.placeholder');
}
},
methods: {
handleChange: function handleChange(value) {
var newVal = parseFloat(value);
this.$emit('changePageSize', newVal);
}
}
});
// CONCATENATED MODULE: ./components/pagination/changePage.vue?vue&type=script&lang=js&
/* harmony default export */ var pagination_changePagevue_type_script_lang_js_ = (changePagevue_type_script_lang_js_);
// CONCATENATED MODULE: ./components/pagination/changePage.vue
/* normalize component */
var changePage_component = Object(componentNormalizer["a" /* default */])(
pagination_changePagevue_type_script_lang_js_,
changePagevue_type_template_id_26e49fc9_render,
changePagevue_type_template_id_26e49fc9_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var changePage_api; }
changePage_component.options.__file = "components/pagination/changePage.vue"
/* harmony default export */ var changePage = (changePage_component.exports);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./components/pagination/pagination.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var paginationvue_type_script_lang_js_ = ({
name: 'MdsPagination',
mixins: [locale_default.a],
props: {
controlled: {
type: Boolean,
default: false
},
current: {
type: Number,
default: 1
},
pageSize: {
type: Number,
default: 10
},
prefixCls: {
type: String,
default: 'mds-pagination'
},
showQuickJumper: {
type: Boolean,
default: false
},
showSizeChanger: {
type: Boolean,
default: false
},
showTitle: Boolean,
showTotal: {
type: Boolean,
default: false
},
mini: {
type: Boolean,
default: false
},
simple: {
type: Boolean,
default: false
},
size: {
type: String,
validator: function validator(value) {
return Object(proptype_["oneOf"])(value, [value, '']);
},
default: ''
},
total: {
type: Number,
default: 0
},
disabled: {
type: Boolean,
default: false
},
custom: {
type: String,
default: ''
},
pageSizes: {
type: Array,
default: function _default() {
return [10, 20, 30, 50];
}
},
totalSeat: {
type: String,
default: 'right'
},
pageSizesSeat: {
type: String,
default: 'left'
},
totalNum: {
type: String
},
totalPage: {
type: String
}
},
data: function data() {
return {
locale: zh_CN,
currentPage: this.current,
changeByPager: false,
pageSizeChange: 0
// showTotal: false,
// showPageSize: false,
// showPageNumber: false,
// pageSizeNum: 10,
// showJumper: false
};
},
created: function created() {
// this.pageSizeNum = this.pageSize
// this.showTotal = this.custom.indexOf('total') !== -1
// this.showPageSize = this.custom.indexOf('pageSize') !== -1
// this.showPageNumber = this.custom.indexOf('pageNumber') !== -1
// this.showJumper = this.custom.indexOf('jumper') !== -1
},
computed: {
pageSizeNum: function pageSizeNum() {
return this.pageSizeChange || this.pageSize;
},
domailList: function domailList() {
if (this.custom.indexOf(',') !== -1) {
return this.custom.split(',');
} else {
return this.custom ? [this.custom] : [];
}
},
showTotalString: function showTotalString() {
return this.custom.includes('total') || this.showTotal;
},
showPageSize: function showPageSize() {
return this.custom.includes('pageSize');
},
showPageNumber: function showPageNumber() {
return this.custom.includes('pageNumber');
},
showJumper: function showJumper() {
return this.custom.includes('jumper');
},
calculatePage: function calculatePage() {
return Math.floor((this.total - 1) / this.pageSizeNum) + 1;
},
hasPrev: function hasPrev() {
return this.currentPage > 1;
},
hasNext: function hasNext() {
return this.currentPage < this.calculatePage;
},
pageRange: function pageRange() {
var rs = [];
if (this.calculatePage > 5) {
if (this.currentPage > 2 && this.currentPage < this.calculatePage - 2) {
rs = this.range(this.currentPage - 2, this.currentPage + 2);
} else if (this.currentPage <= 2) {
rs = this.range(1, 5);
} else {
rs = this.range(this.calculatePage - 4, this.calculatePage);
}
} else {
rs = this.range(1, this.calculatePage);
}
return rs;
},
showJumpNext: function showJumpNext() {
return this.calculatePage - this.currentPage > 3 && this.calculatePage > 5;
},
showJumpPrev: function showJumpPrev() {
return this.currentPage > 4 && this.calculatePage > 5;
},
dispatchTotalPage: function dispatchTotalPage() {
return this.totalPage || this.t('mds.pagination.totalPage', { total: this.total });
},
dispatchTotal: function dispatchTotal() {
return this.totalNum || this.t('mds.pagination.total', { total: this.total });
}
},
watch: {
current: function current() {
this.currentPage = this.current;
},
currentPage: function currentPage(val) {
this.$emit('change-page', val, this.pageSizeNum);
this.$emit('update:current', val);
},
pageRange: function pageRange() {
if (this.pageRange[0] !== 1 && this.pageRange[this.pageRange.length - 1] !== this.calculatePage && this.changeByPager) {
this.changeByPager = false;
this.$refs.page[2].focus();
}
}
},
methods: {
clickPage: function clickPage(i) {
if (this.disabled) {
return;
}
this.changeByPager = true;
this.handleChange(i);
},
handleChange: function handleChange(i) {
if (this.disabled) {
return;
}
if (!this.controlled) {
this.currentPage = i;
}
},
handleJump: function handleJump(event) {
if (event.type === 'blur' || event.key === 'Enter') {
this.handleQuickJump(event.target ? event.target.value : this.currentPage);
}
},
handleQuickJump: function handleQuickJump(newPageText) {
if (this.disabled) {
return;
}
var newPage = parseInt(newPageText || 1, 10);
this.currentPage = newPage;
console.log(newPage, isNaN(newPage));
// if (isNaN(newPage)) return false
if (newPage < 1 || isNaN(newPage)) {
this.handleChange(1);
} else if (newPage > this.calculatePage) {
this.currentPage = this.calculatePage;
this.handleChange(this.calculatePage);
} else {
this.handleChange(newPage);
}
},
pagerClasses: function pagerClasses(i) {
var _ref;
// if(this.disabled){
// this.prefixCls = `${prefixCls}-disabled`
// }
return [this.prefixCls + '-item', (_ref = {}, defineProperty_default()(_ref, this.prefixCls + '-item-active', this.currentPage === i), defineProperty_default()(_ref, this.prefixCls + '-item-after-jump-prev', i === this.pageRange[0] && this.showJumpPrev), defineProperty_default()(_ref, this.prefixCls + '-item-before-jump-next', i === this.pageRange[this.pageRange.length - 1] && this.showJumpNext), _ref)];
},
jumpPrev: function jumpPrev() {
if (this.disabled) {
return;
}
var realCurrentPage = this.currentPage > 5 ? this.currentPage - 5 : 1;
this.$emit('prev-click', realCurrentPage, this.pageSizeNum);
this.handleChange(realCurrentPage);
},
jumpNext: function jumpNext() {
if (this.disabled) {
return;
}
var realCurrentPage = this.calculatePage - this.currentPage > 5 ? this.currentPage + 5 : this.calculatePage;
this.$emit('next-click', realCurrentPage, this.pageSizeNum);
this.handleChange(realCurrentPage);
},
prev: function prev() {
if (this.hasPrev) {
this.$emit('prev-click', this.currentPage - 1, this.pageSizeNum);
this.handleChange(this.currentPage - 1);
}
},
next: function next() {
if (this.hasNext) {
this.$emit('next-click', this.currentPage + 1, this.pageSizeNum);
this.handleChange(this.currentPage + 1);
}
},
range: function range(start, end) {
var arr = [];
for (var i = start; i <= end; i++) {
arr.push(i);
}
return arr;
},
runIfEnterJumpNext: function runIfEnterJumpNext(event) {
;(event.key === 'Enter' || event.charCode === 13) && this.jumpNext();
},
runIfEnterJumpPrev: function runIfEnterJumpPrev(event) {
;(event.key === 'Enter' || event.charCode === 13) && this.jumpPrev();
},
runIfEnterNext: function runIfEnterNext(event) {
;(event.key === 'Enter' || event.charCode === 13) && this.next();
},
runIfEnterPrev: function runIfEnterPrev(event) {
;(event.key === 'Enter' || event.charCode === 13) && this.prev();
},
changePageSize: function changePageSize(val) {
this.$emit('change-page-size', val);
this.pageSizeChange = val;
}
},
components: {
MdsPageOption: pagination_option,
MdsInput: external_input_default.a,
ChangePage: changePage
}
});
// CONCATENATED MODULE: ./components/pagination/pagination.vue?vue&type=script&lang=js&
/* harmony default export */ var pagination_paginationvue_type_script_lang_js_ = (paginationvue_type_script_lang_js_);
// CONCATENATED MODULE: ./components/pagination/pagination.vue
/* normalize component */
var pagination_component = Object(componentNormalizer["a" /* default */])(
pagination_paginationvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var pagination_api; }
pagination_component.options.__file = "components/pagination/pagination.vue"
/* harmony default export */ var pagination = (pagination_component.exports);
// CONCATENATED MODULE: ./components/pagination/index.js
/*
* @Descripttion: 2222
* @version: 2222
* @Author: sueRimn
* @Date: 2020-07-14 14:50:06
* @LastEditors: sueRimn
* @LastEditTime: 2020-07-24 14:15:04
*/
/* istanbul ignore next */
pagination.install = function (Vue) {
Vue.component(pagination.name, pagination);
};
/* harmony default export */ var components_pagination = __webpack_exports__["default"] = (pagination);
/***/ })
/******/ });
});