UNPKG

xdesign-vue-next

Version:

XDesign Component for vue-next

90 lines (86 loc) 3.53 kB
/** * xdesign v1.0.6 * (c) 2023 xdesign * @license MIT */ import _defineProperty from '@babel/runtime/helpers/defineProperty'; import { computed } from 'vue'; import { getIEVersion } from '../_common/js/utils/helper.js'; import { useCommonClassName } from '../hooks/useConfig.js'; import '@babel/runtime/helpers/toConsumableArray'; import '@babel/runtime/helpers/objectWithoutProperties'; import '@babel/runtime/helpers/slicedToArray'; import 'lodash/isString'; import 'lodash/isNull'; import 'lodash/isUndefined'; import 'lodash/isNumber'; import 'lodash/isArray'; import '../config-provider/useConfig.js'; import 'lodash/isFunction'; import 'lodash/cloneDeep'; import '../config-provider/context.js'; import 'lodash/mergeWith'; import 'lodash/merge'; import '../_common/js/global-config/default-config.js'; import '../_common/js/global-config/locale/en_US.js'; import '../_chunks/dep-3a1cce9f.js'; function usePaginationClasses(props, innerCurrent, innerPageSize, name) { var _useCommonClassName = useCommonClassName(), SIZE = _useCommonClassName.SIZE, STATUS = _useCommonClassName.STATUS; var pageCount = computed(function () { var c = Math.ceil(props.total / innerPageSize.value); return c > 0 ? c : 1; }); var paginationClass = computed(function () { var _ref; return ["".concat(name.value), SIZE.value[props.size], (_ref = {}, _defineProperty(_ref, STATUS.value.disabled, props.disabled), _defineProperty(_ref, "".concat(name.value, "-ie"), getIEVersion() < 11), _ref)]; }); var totalClass = computed(function () { return ["".concat(name.value, "__total")]; }); var sizerClass = computed(function () { return ["".concat(name.value, "__select")]; }); var preBtnClass = computed(function () { return ["".concat(name.value, "__btn"), "".concat(name.value, "__btn-prev"), _defineProperty({}, STATUS.value.disabled, props.disabled || innerCurrent.value === 1)]; }); var nextBtnClass = computed(function () { return ["".concat(name.value, "__btn"), "".concat(name.value, "__btn-next"), _defineProperty({}, STATUS.value.disabled, props.disabled || innerCurrent.value === pageCount.value)]; }); var btnWrapClass = computed(function () { return ["".concat(name.value, "__pager")]; }); var btnMoreClass = computed(function () { return ["".concat(name.value, "__number"), "".concat(name.value, "__number--more"), _defineProperty({}, STATUS.value.disabled, props.disabled)]; }); var jumperClass = computed(function () { return ["".concat(name.value, "__jump")]; }); var jumperInputClass = computed(function () { return ["".concat(name.value, "__input")]; }); var simpleClass = computed(function () { return ["".concat(name.value, "__select")]; }); var getButtonClass = function getButtonClass(index) { var _ref5; return ["".concat(name.value, "__number"), (_ref5 = {}, _defineProperty(_ref5, STATUS.value.disabled, props.disabled), _defineProperty(_ref5, STATUS.value.current, innerCurrent.value === index), _ref5)]; }; return { pageCount: pageCount, paginationClass: paginationClass, totalClass: totalClass, sizerClass: sizerClass, preBtnClass: preBtnClass, nextBtnClass: nextBtnClass, btnWrapClass: btnWrapClass, btnMoreClass: btnMoreClass, jumperClass: jumperClass, jumperInputClass: jumperInputClass, simpleClass: simpleClass, getButtonClass: getButtonClass }; } export { usePaginationClasses as default }; //# sourceMappingURL=usePaginationClasses.js.map