@opentiny/vue-pager
Advanced tools
Comparing version 2.6.0 to 2.6.1-alpha.0
542
lib/index.js
@@ -1,61 +0,78 @@ | ||
import Pager from '@opentiny/vue-pager-item'; | ||
import Popover from '@opentiny/vue-popover'; | ||
import { t } from '@opentiny/vue-locale'; | ||
import { $prefix, h } from '@opentiny/vue-common'; | ||
import { iconChevronLeft, iconChevronRight, iconDeltaUp, iconDeltaDown } from '@opentiny/vue-icon'; | ||
import { emitEvent } from '@opentiny/vue-renderless/common/event'; | ||
import '@opentiny/vue-theme/pager/index.css'; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
function _extends() { | ||
_extends = Object.assign ? Object.assign.bind() : 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; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
import PagerItem from "@opentiny/vue-pager-item"; | ||
import Popover from "@opentiny/vue-popover"; | ||
import { t } from "@opentiny/vue-locale"; | ||
import { defineComponent, $prefix, h } from "@opentiny/vue-common"; | ||
import { iconChevronLeft, iconChevronRight, iconDeltaUp, iconDeltaDown } from "@opentiny/vue-icon"; | ||
import { emitEvent } from "@opentiny/vue-renderless/common/event"; | ||
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) { | ||
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports; | ||
if (render) { | ||
options.render = render; | ||
options.staticRenderFns = staticRenderFns; | ||
options._compiled = true; | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
key = _toPropertyKey(key); | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
if (functionalTemplate) { | ||
options.functional = true; | ||
} | ||
return obj; | ||
} | ||
function _toPrimitive(input, hint) { | ||
if (typeof input !== "object" || input === null) return input; | ||
var prim = input[Symbol.toPrimitive]; | ||
if (prim !== undefined) { | ||
var res = prim.call(input, hint || "default"); | ||
if (typeof res !== "object") return res; | ||
throw new TypeError("@@toPrimitive must return a primitive value."); | ||
if (scopeId) { | ||
options._scopeId = "data-v-" + scopeId; | ||
} | ||
return (hint === "string" ? String : Number)(input); | ||
var hook; | ||
if (moduleIdentifier) { | ||
hook = function hook2(context) { | ||
context = context || // cached call | ||
this.$vnode && this.$vnode.ssrContext || // stateful | ||
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext; | ||
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") { | ||
context = __VUE_SSR_CONTEXT__; | ||
} | ||
if (injectStyles) { | ||
injectStyles.call(this, context); | ||
} | ||
if (context && context._registeredComponents) { | ||
context._registeredComponents.add(moduleIdentifier); | ||
} | ||
}; | ||
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) { | ||
options._injectStyles = hook; | ||
var originalRender = options.render; | ||
options.render = function renderWithStyleInjection(h, context) { | ||
hook.call(context); | ||
return originalRender(h, context); | ||
}; | ||
} else { | ||
var existing = options.beforeCreate; | ||
options.beforeCreate = existing ? [].concat(existing, hook) : [hook]; | ||
} | ||
} | ||
return { | ||
exports: scriptExports, | ||
options | ||
}; | ||
} | ||
function _toPropertyKey(arg) { | ||
var key = _toPrimitive(arg, "string"); | ||
return typeof key === "symbol" ? key : String(key); | ||
} | ||
var script = { | ||
name: $prefix + 'Pager', | ||
import "@opentiny/vue-theme/pager/index.css"; | ||
var __vue2_script = defineComponent({ | ||
name: $prefix + "Pager", | ||
props: { | ||
@@ -115,3 +132,3 @@ pageSize: { | ||
render: function render() { | ||
var h = arguments[0]; | ||
var h2 = arguments[0]; | ||
var layout = this.internalLayout; | ||
@@ -125,4 +142,4 @@ if (!layout) { | ||
var TEMPLATE_MAP = { | ||
prev: h("prev"), | ||
jumper: h("jumper", { | ||
prev: h2("prev"), | ||
jumper: h2("jumper", { | ||
"attrs": { | ||
@@ -136,4 +153,4 @@ "isBeforePageChange": this.isBeforePageChange, | ||
}), | ||
current: h("current"), | ||
pager: h("pager", { | ||
current: h2("current"), | ||
pager: h2("pager", { | ||
"attrs": { | ||
@@ -151,4 +168,4 @@ "isBeforePageChange": this.isBeforePageChange, | ||
}), | ||
next: h("next"), | ||
sizes: h("sizes", { | ||
next: h2("next"), | ||
sizes: h2("sizes", { | ||
"ref": "sizes", | ||
@@ -165,14 +182,14 @@ "attrs": { | ||
}), | ||
slot: h("slot", [typeof this.$slots.default === 'function' ? this.$slots.default() : this.$slots.default]), | ||
total: h("total") | ||
slot: h2("slot", [typeof this.$slots.default === "function" ? this.$slots.default() : this.$slots.default]), | ||
total: h2("total") | ||
}; | ||
var components = layout.split(',').map(function (item) { | ||
var components = layout.split(",").map(function(item) { | ||
return item.trim(); | ||
}); | ||
var templateChildren = []; | ||
components.forEach(function (compo) { | ||
components.forEach(function(compo) { | ||
templateChildren.push(TEMPLATE_MAP[compo]); | ||
}); | ||
return h("div", { | ||
"class": ['tiny-pager tiny-pager__number'] | ||
return h2("div", { | ||
"class": ["tiny-pager tiny-pager__number"] | ||
}, [templateChildren]); | ||
@@ -182,6 +199,6 @@ }, | ||
Prev: { | ||
render: function render() { | ||
var h = arguments[0]; | ||
render: function render2() { | ||
var h2 = arguments[0]; | ||
var ChevronLeft = iconChevronLeft(); | ||
return h("button", { | ||
return h2("button", { | ||
"attrs": { | ||
@@ -195,3 +212,3 @@ "type": "button", | ||
} | ||
}, [this.$parent.prevText ? h("span", [this.$parent.prevText]) : h(ChevronLeft, { | ||
}, [this.$parent.prevText ? h2("span", [this.$parent.prevText]) : h2(ChevronLeft, { | ||
"class": "tiny-svg-size" | ||
@@ -202,6 +219,6 @@ })]); | ||
Next: { | ||
render: function render() { | ||
var h = arguments[0]; | ||
render: function render3() { | ||
var h2 = arguments[0]; | ||
var ChevronRight = iconChevronRight(); | ||
return h("button", { | ||
return h2("button", { | ||
"attrs": { | ||
@@ -215,3 +232,3 @@ "type": "button", | ||
} | ||
}, [this.$parent.nextText ? h("span", [this.$parent.nextText]) : h(ChevronRight, { | ||
}, [this.$parent.nextText ? h2("span", [this.$parent.nextText]) : h2(ChevronRight, { | ||
"class": "tiny-svg-size" | ||
@@ -222,10 +239,10 @@ })]); | ||
Current: { | ||
render: function render() { | ||
var h = arguments[0]; | ||
render: function render4() { | ||
var h2 = arguments[0]; | ||
var internalCurrentPage = this.$parent.internalCurrentPage; | ||
return h("div", { | ||
return h2("div", { | ||
"class": "tiny-pager__group tiny-unselect" | ||
}, [h("ul", { | ||
}, [h2("ul", { | ||
"class": "tiny-pager__pages" | ||
}, [h("li", { | ||
}, [h2("li", { | ||
"class": "is-active", | ||
@@ -250,3 +267,3 @@ "directives": [{ | ||
}, | ||
data: function data() { | ||
data: function data2() { | ||
return { | ||
@@ -261,3 +278,3 @@ showSizes: false | ||
if (Array.isArray(newVal)) { | ||
this.$parent.internalPageSize = newVal.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.pageSizes[0]; | ||
this.$parent.internalPageSize = newVal.includes(this.$parent.pageSize) ? this.$parent.pageSize : this.pageSizes[0]; | ||
} | ||
@@ -267,5 +284,5 @@ } | ||
}, | ||
render: function render() { | ||
render: function render5() { | ||
var _this = this; | ||
var h = arguments[0]; | ||
var h2 = arguments[0]; | ||
var ChevronUp = iconDeltaUp(); | ||
@@ -275,8 +292,8 @@ var ChevronDown = iconDeltaDown(); | ||
reference: function reference() { | ||
return h("div", { | ||
return h2("div", { | ||
"slot": "reference", | ||
"class": "tiny-pager__popover" | ||
}, [h("div", { | ||
}, [h2("div", { | ||
"class": "tiny-pager__input" | ||
}, [h("input", { | ||
}, [h2("input", { | ||
"attrs": { | ||
@@ -289,18 +306,18 @@ "type": "text", | ||
} | ||
}), h("div", { | ||
}), h2("div", { | ||
"class": "tiny-pager__input-btn" | ||
}, [_this.showSizes ? h(ChevronUp, { | ||
}, [_this.showSizes ? h2(ChevronUp, { | ||
"class": "tiny-svg-size" | ||
}) : h(ChevronDown, { | ||
}) : h2(ChevronDown, { | ||
"class": "tiny-svg-size" | ||
})])])]); | ||
}, | ||
default: function _default() { | ||
return h("div", { | ||
default: function _default2() { | ||
return h2("div", { | ||
"class": "tiny-pager tiny-pager__selector-body" | ||
}, [h("ul", { | ||
}, [h2("ul", { | ||
"class": "tiny-pager__selector-poplist" | ||
}, [_this.pageSizes.map(function (item) { | ||
return h("li", { | ||
"class": ['list-item', item === _this.$parent.internalPageSize ? 'is-selected select-pre' : ''], | ||
}, [_this.pageSizes.map(function(item) { | ||
return h2("li", { | ||
"class": ["list-item", item === _this.$parent.internalPageSize ? "is-selected select-pre" : ""], | ||
"attrs": { | ||
@@ -319,14 +336,14 @@ "val": item, | ||
}; | ||
return h("div", { | ||
"class": ['tiny-pager__group', 'tiny-pager__sizes'] | ||
}, [h(Popover, { | ||
return h2("div", { | ||
"class": ["tiny-pager__group", "tiny-pager__sizes"] | ||
}, [h2(Popover, { | ||
props: { | ||
placement: 'bottom-start', | ||
placement: "bottom-start", | ||
appendToBody: this.popperAppendToBody, | ||
trigger: 'click', | ||
popperClass: 'tiny-pager__selector' + (this.popperClass ? ' ' + this.popperClass : ''), | ||
trigger: "click", | ||
popperClass: "tiny-pager__selector" + (this.popperClass ? " " + this.popperClass : ""), | ||
visibleArrow: false | ||
}, | ||
scopedSlots: scopedSlots, | ||
ref: 'sizesList' | ||
scopedSlots, | ||
ref: "sizesList" | ||
})]); | ||
@@ -338,3 +355,3 @@ }, | ||
if (val !== this.$parent.internalPageSize) { | ||
var callback = function callback() { | ||
var callback = function callback2() { | ||
if (!_this2.$parent.beforeChangeHandler()) { | ||
@@ -346,5 +363,5 @@ return false; | ||
_this2.showSizes = false; | ||
_this2.$parent.$emit('update:pageSize', val); | ||
_this2.$parent.$emit('size-change', val); | ||
_this2.$parent.$emit('page-change', { | ||
_this2.$parent.$emit("update:pageSize", val); | ||
_this2.$parent.$emit("size-change", val); | ||
_this2.$parent.$emit("page-change", { | ||
currentPage: _this2.$parent.internalCurrentPage, | ||
@@ -360,5 +377,5 @@ pageSize: val, | ||
var params = { | ||
newPageSize: newPageSize, | ||
currentPageSize: currentPageSize, | ||
callback: callback | ||
newPageSize, | ||
currentPageSize, | ||
callback | ||
}; | ||
@@ -390,3 +407,3 @@ this.$parent.beforePagerChangeHandler(params); | ||
}, | ||
data: function data() { | ||
data: function data3() { | ||
return { | ||
@@ -398,3 +415,3 @@ backupValue: String(this.initValue), | ||
watch: { | ||
'$parent.internalCurrentPage': function $parentInternalCurrentPage(currentPage) { | ||
"$parent.internalCurrentPage": function $parentInternalCurrentPage(currentPage) { | ||
var value = String(currentPage); | ||
@@ -412,3 +429,3 @@ if (this.value !== value) { | ||
if (!e.target.value) { | ||
this.value = ''; | ||
this.value = ""; | ||
} else if (/^\d+$/.test(e.target.value)) { | ||
@@ -419,9 +436,9 @@ this.value = Number(e.target.value) || 1; | ||
}, | ||
handleChange: function handleChange() { | ||
handleChange: function handleChange2() { | ||
var _this3 = this; | ||
this.parseValueNumber(); | ||
var callback = function callback() { | ||
var callback = function callback2() { | ||
_this3.handleClick(); | ||
}; | ||
var rollback = function rollback() { | ||
var rollback = function rollback2() { | ||
_this3.value = String(_this3.backupValue); | ||
@@ -433,6 +450,6 @@ }; | ||
var params = { | ||
newPage: newPage, | ||
currentPage: currentPage, | ||
callback: callback, | ||
rollback: rollback | ||
newPage, | ||
currentPage, | ||
callback, | ||
rollback | ||
}; | ||
@@ -452,3 +469,3 @@ this.$parent.beforePagerChangeHandler(params); | ||
parseValueNumber: function parseValueNumber() { | ||
var value = Number(String(this.value).split(/[^0-9-+.]/).join('')); | ||
var value = Number(String(this.value).split(/[^0-9-+.]/).join("")); | ||
if (isNaN(value)) { | ||
@@ -469,8 +486,8 @@ value = this.min; | ||
}, | ||
render: function render() { | ||
return h('div', { | ||
class: ['tiny-pager__group'] | ||
}, [h('div', { | ||
class: ['tiny-pager__goto'] | ||
}, [h('input', { | ||
render: function render6() { | ||
return h("div", { | ||
class: ["tiny-pager__group"] | ||
}, [h("div", { | ||
class: ["tiny-pager__goto"] | ||
}, [h("input", { | ||
domProps: { | ||
@@ -480,3 +497,3 @@ value: this.value | ||
attrs: { | ||
type: 'text', | ||
type: "text", | ||
disabled: this.disabled | ||
@@ -489,7 +506,7 @@ }, | ||
}, | ||
ref: 'input' | ||
}), h('button', { | ||
class: ['tiny-btn'], | ||
ref: "input" | ||
}), h("button", { | ||
class: ["tiny-btn"], | ||
attrs: { | ||
type: 'button' | ||
type: "button" | ||
}, | ||
@@ -499,66 +516,59 @@ on: { | ||
} | ||
}, [t('ui.page.goto')])])]); | ||
}, [t("ui.page.goto")])])]); | ||
} | ||
}, | ||
Total: { | ||
render: function render() { | ||
var h = arguments[0]; | ||
return typeof this.$parent.internalTotal === 'number' ? h("div", { | ||
"class": ['tiny-pager__group'] | ||
}, [' ', h("div", { | ||
render: function render7() { | ||
var h2 = arguments[0]; | ||
return typeof this.$parent.internalTotal === "number" ? h2("div", { | ||
"class": ["tiny-pager__group"] | ||
}, [" ", h2("div", { | ||
"class": "tiny-pager__total" | ||
}, [h("span", [t('ui.page.total'), "\uFF1A"]), h("span", { | ||
}, [h2("span", [t("ui.page.total"), ":"]), h2("span", { | ||
"class": "tiny-pager__total-allpage" | ||
}, [this.$parent.internalTotal])])]) : ''; | ||
}, [this.$parent.internalTotal])])]) : ""; | ||
} | ||
}, | ||
Pager: Pager | ||
Pager: PagerItem | ||
}, | ||
methods: { | ||
beforeSizeChangeHandler: function beforeSizeChangeHandler(params) { | ||
var newPageSize = params.newPageSize, | ||
currentPageSize = params.currentPageSize, | ||
callback = params.callback; | ||
var newPageSize = params.newPageSize, currentPageSize = params.currentPageSize, callback = params.callback; | ||
var newPage = 1; | ||
var currentPage = this.internalCurrentPage; | ||
var temp = { | ||
newPage: newPage, | ||
newPageSize: newPageSize, | ||
currentPage: currentPage, | ||
currentPageSize: currentPageSize, | ||
callback: callback | ||
newPage, | ||
newPageSize, | ||
currentPage, | ||
currentPageSize, | ||
callback | ||
}; | ||
this.$emit('before-page-change', temp); | ||
this.$emit("before-page-change", temp); | ||
}, | ||
beforePagerChangeHandler: function beforePagerChangeHandler(params) { | ||
var newPage = params.newPage, | ||
currentPage = params.currentPage, | ||
callback = params.callback; | ||
var newPage = params.newPage, currentPage = params.currentPage, callback = params.callback; | ||
var newPageSize = this.internalPageSize; | ||
var currentPageSize = this.internalPageSize; | ||
var temp = { | ||
newPage: newPage, | ||
newPageSize: newPageSize, | ||
currentPage: currentPage, | ||
currentPageSize: currentPageSize, | ||
callback: callback | ||
newPage, | ||
newPageSize, | ||
currentPage, | ||
currentPageSize, | ||
callback | ||
}; | ||
this.$emit('before-page-change', temp); | ||
this.$emit("before-page-change", temp); | ||
}, | ||
beforeJumperChangeHandler: function beforeJumperChangeHandler(params) { | ||
var newPage = params.newPage, | ||
currentPage = params.currentPage, | ||
callback = params.callback, | ||
rollback = params.rollback; | ||
var newPage = params.newPage, currentPage = params.currentPage, callback = params.callback, rollback = params.rollback; | ||
var newPageSize = this.internalPageSize; | ||
var currentPageSize = this.internalPageSize; | ||
var temp = { | ||
newPage: newPage, | ||
newPageSize: newPageSize, | ||
currentPage: currentPage, | ||
currentPageSize: currentPageSize, | ||
callback: callback, | ||
rollback: rollback | ||
newPage, | ||
newPageSize, | ||
currentPage, | ||
currentPageSize, | ||
callback, | ||
rollback | ||
}; | ||
this.$emit('before-page-change', temp); | ||
this.$emit("before-page-change", temp); | ||
}, | ||
@@ -571,5 +581,7 @@ copyEmit: function copyEmit() { | ||
}, | ||
beforeChangeHandler: function beforeChangeHandler() { | ||
var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1; | ||
return emitEvent(this.copyEmit, 'before-change', this.internalCurrentPage, this, val); | ||
beforeChangeHandler: function beforeChangeHandler(val) { | ||
if (val === void 0) { | ||
val = -1; | ||
} | ||
return emitEvent(this.copyEmit, "before-change", this.internalCurrentPage, this, val); | ||
}, | ||
@@ -586,3 +598,3 @@ handleCurrentChange: function handleCurrentChange(val) { | ||
var _this4 = this; | ||
var callback = function callback() { | ||
var callback = function callback2() { | ||
if (_this4.disabled || !_this4.beforeChangeHandler(_this4.internalCurrentPage - 1)) { | ||
@@ -593,3 +605,3 @@ return false; | ||
_this4.internalCurrentPage = _this4.getValidCurrentPage(newVal); | ||
_this4.$emit('prev-click', _this4.internalCurrentPage); | ||
_this4.$emit("prev-click", _this4.internalCurrentPage); | ||
_this4.emitChange(); | ||
@@ -600,6 +612,6 @@ }; | ||
var temp = this.buildBeforePageChangeParam({ | ||
newPage: newPage, | ||
callback: callback | ||
newPage, | ||
callback | ||
}); | ||
this.$emit('before-page-change', temp); | ||
this.$emit("before-page-change", temp); | ||
} else { | ||
@@ -611,3 +623,3 @@ callback(); | ||
var _this5 = this; | ||
var callback = function callback() { | ||
var callback = function callback2() { | ||
if (_this5.disabled || !_this5.beforeChangeHandler(_this5.internalCurrentPage + 1)) { | ||
@@ -618,3 +630,3 @@ return false; | ||
_this5.internalCurrentPage = _this5.getValidCurrentPage(newVal); | ||
_this5.$emit('next-click', _this5.internalCurrentPage); | ||
_this5.$emit("next-click", _this5.internalCurrentPage); | ||
_this5.emitChange(); | ||
@@ -625,6 +637,6 @@ }; | ||
var temp = this.buildBeforePageChangeParam({ | ||
newPage: newPage, | ||
callback: callback | ||
newPage, | ||
callback | ||
}); | ||
this.$emit('before-page-change', temp); | ||
this.$emit("before-page-change", temp); | ||
} else { | ||
@@ -638,6 +650,6 @@ callback(); | ||
var currentPageSize = this.internalPageSize; | ||
return _objectSpread2({ | ||
currentPage: currentPage, | ||
newPageSize: newPageSize, | ||
currentPageSize: currentPageSize | ||
return _extends({ | ||
currentPage, | ||
newPageSize, | ||
currentPageSize | ||
}, param); | ||
@@ -647,3 +659,3 @@ }, | ||
val = parseInt(val, 10); | ||
var hasPageCount = typeof this.internalPageCount === 'number'; | ||
var hasPageCount = typeof this.internalPageCount === "number"; | ||
var resetVal; | ||
@@ -661,3 +673,3 @@ if (hasPageCount) { | ||
} | ||
if (resetVal === undefined && isNaN(val)) { | ||
if (resetVal === void 0 && isNaN(val)) { | ||
resetVal = 1; | ||
@@ -667,11 +679,11 @@ } else if (resetVal === 0) { | ||
} | ||
return resetVal === undefined ? val : resetVal; | ||
return resetVal === void 0 ? val : resetVal; | ||
}, | ||
emitChange: function emitChange() { | ||
var _this6 = this; | ||
this.$nextTick(function () { | ||
this.$nextTick(function() { | ||
if (_this6.internalCurrentPage !== _this6.lastEmittedPage || _this6.userChangePageSize) { | ||
_this6.$emit('current-change', _this6.internalCurrentPage); | ||
_this6.$emit('update:current-page', _this6.internalCurrentPage); | ||
_this6.$emit('page-change', { | ||
_this6.$emit("current-change", _this6.internalCurrentPage); | ||
_this6.$emit("update:current-page", _this6.internalCurrentPage); | ||
_this6.$emit("page-change", { | ||
currentPage: _this6.internalCurrentPage, | ||
@@ -692,5 +704,5 @@ pageSize: _this6.internalPageSize, | ||
internalPageCount: function internalPageCount() { | ||
if (typeof this.internalTotal === 'number') { | ||
if (typeof this.internalTotal === "number") { | ||
return Math.max(1, Math.ceil(this.internalTotal / this.internalPageSize)); | ||
} else if (typeof this.pageCount === 'number') { | ||
} else if (typeof this.pageCount === "number") { | ||
return Math.max(1, this.pageCount); | ||
@@ -701,12 +713,12 @@ } | ||
internalLayout: function internalLayout() { | ||
var layout = ''; | ||
var layout = ""; | ||
if (this.mode && !this.layout) { | ||
this.mode === 'number' && (layout = 'total, sizes, prev, pager, next, jumper'); | ||
this.mode === 'simple' && (layout = 'sizes, total, prev, current, next'); | ||
this.mode === 'complete' && (layout = 'sizes, total, prev, pager, next, jumper'); | ||
this.mode === 'fixed' && (layout = 'prev,pager,next'); | ||
this.mode === "number" && (layout = "total, sizes, prev, pager, next, jumper"); | ||
this.mode === "simple" && (layout = "sizes, total, prev, current, next"); | ||
this.mode === "complete" && (layout = "sizes, total, prev, pager, next, jumper"); | ||
this.mode === "fixed" && (layout = "prev,pager,next"); | ||
} else if (!this.mode && this.layout || this.mode && this.layout) { | ||
layout = this.layout; | ||
} else { | ||
layout = 'total, prev, pager, next, jumper'; | ||
layout = "total, prev, pager, next, jumper"; | ||
} | ||
@@ -719,3 +731,3 @@ return layout; | ||
immediate: true, | ||
handler: function handler(val) { | ||
handler: function handler2(val) { | ||
this.internalCurrentPage = this.getValidCurrentPage(val); | ||
@@ -726,3 +738,3 @@ } | ||
immediate: true, | ||
handler: function handler(val) { | ||
handler: function handler3(val) { | ||
this.internalPageSize = isNaN(val) ? 10 : val; | ||
@@ -733,8 +745,8 @@ } | ||
immediate: true, | ||
handler: function handler(newVal) { | ||
this.$emit('update:currentPage', newVal); | ||
handler: function handler4(newVal) { | ||
this.$emit("update:currentPage", newVal); | ||
this.lastEmittedPage = -1; | ||
} | ||
}, | ||
internalPageCount: function internalPageCount(newVal) { | ||
internalPageCount: function internalPageCount2(newVal) { | ||
var oldPage = this.internalCurrentPage; | ||
@@ -753,101 +765,21 @@ if (newVal > 0 && oldPage === 0) { | ||
} | ||
}; | ||
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier | ||
/* server only */ | ||
, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) { | ||
if (typeof shadowMode !== 'boolean') { | ||
createInjectorSSR = createInjector; | ||
createInjector = shadowMode; | ||
shadowMode = false; | ||
} // Vue.extend constructor export interop. | ||
var options = typeof script === 'function' ? script.options : script; // render functions | ||
if (template && template.render) { | ||
options.render = template.render; | ||
options.staticRenderFns = template.staticRenderFns; | ||
options._compiled = true; // functional template | ||
if (isFunctionalTemplate) { | ||
options.functional = true; | ||
} | ||
} // scopedId | ||
if (scopeId) { | ||
options._scopeId = scopeId; | ||
}); | ||
var __vue2_render, __vue2_staticRenderFns; | ||
var __cssModules = {}; | ||
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, __vue2_render, __vue2_staticRenderFns, false, __vue2_injectStyles, null, null, null); | ||
function __vue2_injectStyles(context) { | ||
for (var o in __cssModules) { | ||
this[o] = __cssModules[o]; | ||
} | ||
var hook; | ||
if (moduleIdentifier) { | ||
// server build | ||
hook = function hook(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 (style) { | ||
style.call(this, createInjectorSSR(context)); | ||
} // register component module identifier for async chunk inference | ||
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 (style) { | ||
hook = shadowMode ? function () { | ||
style.call(this, createInjectorShadow(this.$root.$options.shadowRoot)); | ||
} : function (context) { | ||
style.call(this, createInjector(context)); | ||
}; | ||
} | ||
if (hook) { | ||
if (options.functional) { | ||
// 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 script; | ||
} | ||
var normalizeComponent_1 = normalizeComponent; | ||
var __vue_script__ = script; | ||
var __vue_inject_styles__ = undefined; | ||
var __vue_scope_id__ = undefined; | ||
var __vue_module_identifier__ = undefined; | ||
var __vue_is_functional_template__ = undefined; | ||
var __vue_component__ = normalizeComponent_1({}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined); | ||
__vue_component__.install = function (Vue) { | ||
Vue.component(__vue_component__.name, __vue_component__); | ||
var Pager = /* @__PURE__ */ function() { | ||
return __component__.exports; | ||
}(); | ||
var version = "3.7.0"; | ||
Pager.install = function(Vue) { | ||
Vue.component(Pager.name, Pager); | ||
}; | ||
__vue_component__.version = '2.6.0'; | ||
export { __vue_component__ as default }; | ||
Pager.version = version; | ||
export { | ||
Pager as default | ||
}; |
{ | ||
"name": "@opentiny/vue-pager", | ||
"version": "2.6.0", | ||
"version": "2.6.1-alpha.0", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"lint": "eslint src/**/*{.js,.html,.vue} --quiet", | ||
"build:ui2": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../build/build-ui.js", | ||
"build:ui3": "cross-env BUILD_TARGET=single NODE_ENV=production node ../../example/build/build-ui.js" | ||
}, | ||
"main": "./lib/index.js", | ||
"dependencies": { | ||
"@opentiny/vue-renderless": "~3.6.0", | ||
"@opentiny/vue-icon": "~2.6.0", | ||
"@opentiny/vue-popover": "~2.6.0", | ||
"@opentiny/vue-locale": "~2.6.0", | ||
"@opentiny/vue-pager-item": "~2.6.0", | ||
"@opentiny/vue-common": "~2.6.0", | ||
"@opentiny/vue-theme": "~3.6.0", | ||
"@opentiny/vue-theme-mobile": "~3.6.0" | ||
"@opentiny/vue-renderless": "~3.6.1-alpha.0", | ||
"@opentiny/vue-icon": "~2.6.1-alpha.0", | ||
"@opentiny/vue-popover": "~2.6.1-alpha.0", | ||
"@opentiny/vue-locale": "~2.6.1-alpha.0", | ||
"@opentiny/vue-pager-item": "~2.6.1-alpha.0" | ||
}, | ||
"license": "MIT", | ||
"sideEffects": false | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"build": "pnpm -w build:ui $npm_package_name", | ||
"//postversion": "pnpm build" | ||
} | ||
} |
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
29989
5
5
898
2
80
2
- Removed@opentiny/vue-common@~2.6.0
- Removed@opentiny/vue-theme@~3.6.0
- Removed@opentiny/vue-theme-mobile@~3.6.0