@varlet/ui 2.9.5 → 2.9.6-alpha.1680971883189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/varlet.cjs.js CHANGED
@@ -17138,12 +17138,12 @@ function __render__$v(_ctx, _cache) {
17138
17138
  [vue.createVNode(
17139
17139
  _component_var_input,
17140
17140
  {
17141
- modelValue: _ctx.simpleValue,
17142
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.simpleValue = $event),
17141
+ modelValue: _ctx.simpleCurrentValue,
17142
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.simpleCurrentValue = $event),
17143
17143
  disabled: _ctx.disabled,
17144
17144
  "var-pagination-cover": "",
17145
- onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.setPage("simple", _ctx.simpleValue, $event)),
17146
- onKeydown: _cache[3] || (_cache[3] = vue.withKeys(($event) => _ctx.setPage("simple", _ctx.simpleValue, $event), ["enter"]))
17145
+ onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.setPage("simple", _ctx.simpleCurrentValue, $event)),
17146
+ onKeydown: _cache[3] || (_cache[3] = vue.withKeys(($event) => _ctx.setPage("simple", _ctx.simpleCurrentValue, $event), ["enter"]))
17147
17147
  },
17148
17148
  null,
17149
17149
  8,
@@ -17294,12 +17294,12 @@ function __render__$v(_ctx, _cache) {
17294
17294
  ), vue.createVNode(
17295
17295
  _component_var_input,
17296
17296
  {
17297
- modelValue: _ctx.inputValue,
17298
- "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.inputValue = $event),
17297
+ modelValue: _ctx.quickJumperValue,
17298
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => _ctx.quickJumperValue = $event),
17299
17299
  disabled: _ctx.disabled,
17300
17300
  "var-pagination-cover": "",
17301
- onBlur: _cache[8] || (_cache[8] = ($event) => _ctx.setPage("quick", _ctx.inputValue, $event)),
17302
- onKeydown: _cache[9] || (_cache[9] = vue.withKeys(($event) => _ctx.setPage("quick", _ctx.inputValue, $event), ["enter"]))
17301
+ onBlur: _cache[8] || (_cache[8] = ($event) => _ctx.setPage("quick", _ctx.quickJumperValue, $event)),
17302
+ onKeydown: _cache[9] || (_cache[9] = vue.withKeys(($event) => _ctx.setPage("quick", _ctx.quickJumperValue, $event), ["enter"]))
17303
17303
  },
17304
17304
  null,
17305
17305
  8,
@@ -17335,8 +17335,8 @@ var __sfc__$w = vue.defineComponent({
17335
17335
  props: props$p,
17336
17336
  setup(props2) {
17337
17337
  var menuVisible = vue.ref(false);
17338
- var inputValue = vue.ref("");
17339
- var simpleValue = vue.ref("1");
17338
+ var quickJumperValue = vue.ref("");
17339
+ var simpleCurrentValue = vue.ref("1");
17340
17340
  var isHideEllipsisHead = vue.ref(false);
17341
17341
  var isHideEllipsisTail = vue.ref(false);
17342
17342
  var current = vue.ref(toNumber(props2.current) || 1);
@@ -17365,50 +17365,55 @@ var __sfc__$w = vue.defineComponent({
17365
17365
  return index === 1 ? "head" : "tail";
17366
17366
  };
17367
17367
  var clickItem = (item, index) => {
17368
- if (item === current.value || props2.disabled)
17368
+ if (item === current.value || props2.disabled) {
17369
17369
  return;
17370
- if (isNumber(item))
17370
+ }
17371
+ if (item === "...") {
17372
+ current.value = index === 1 ? Math.max(current.value - props2.maxPagerCount, 1) : Math.min(current.value + props2.maxPagerCount, pageCount.value);
17373
+ return;
17374
+ }
17375
+ if (item === "prev") {
17376
+ current.value = ensureCurrentBoundary(current.value - 1);
17377
+ return;
17378
+ }
17379
+ if (item === "next") {
17380
+ current.value = ensureCurrentBoundary(current.value + 1);
17381
+ return;
17382
+ }
17383
+ if (isNumber(item)) {
17371
17384
  current.value = item;
17372
- else if (item === "prev")
17373
- current.value > 1 && (current.value -= 1);
17374
- else if (item === "next")
17375
- current.value < pageCount.value && (current.value += 1);
17376
- else if (item === "...") {
17377
- if (index === 1) {
17378
- current.value = Math.max(current.value - props2.maxPagerCount, 1);
17379
- } else {
17380
- current.value = Math.min(current.value + props2.maxPagerCount, pageCount.value);
17381
- }
17382
17385
  }
17383
17386
  };
17384
17387
  var showMenu = () => {
17385
- if (props2.disabled)
17388
+ if (props2.disabled) {
17386
17389
  return;
17390
+ }
17387
17391
  menuVisible.value = true;
17388
17392
  };
17389
17393
  var clickSize = (option2) => {
17390
17394
  size.value = option2;
17391
17395
  menuVisible.value = false;
17396
+ var targetCurrent = ensureCurrentBoundary(current.value);
17397
+ simpleCurrentValue.value = String(targetCurrent);
17398
+ current.value = targetCurrent;
17392
17399
  };
17393
- var isValidatePage = (value) => {
17394
- var pattern = /^[1-9][0-9]*$/;
17395
- return pattern.test(value);
17400
+ var ensureCurrentBoundary = (targetCurrent) => {
17401
+ if (targetCurrent > pageCount.value) {
17402
+ return pageCount.value;
17403
+ }
17404
+ if (targetCurrent < 1) {
17405
+ return 1;
17406
+ }
17407
+ return targetCurrent;
17396
17408
  };
17397
- var setPage = (type, value, event) => {
17409
+ var setPage = (type, page, event) => {
17398
17410
  event.target.blur();
17399
- if (isValidatePage(value)) {
17400
- var valueNum = toNumber(value);
17401
- if (valueNum > pageCount.value) {
17402
- valueNum = pageCount.value;
17403
- simpleValue.value = "" + valueNum;
17404
- }
17405
- if (valueNum !== current.value)
17406
- current.value = valueNum;
17411
+ var targetCurrent = ensureCurrentBoundary(toNumber(page));
17412
+ simpleCurrentValue.value = String(targetCurrent);
17413
+ current.value = targetCurrent;
17414
+ if (type === "quick") {
17415
+ quickJumperValue.value = "";
17407
17416
  }
17408
- if (type === "quick")
17409
- inputValue.value = "";
17410
- if (type === "simple" && !isValidatePage(value))
17411
- simpleValue.value = "" + current.value;
17412
17417
  };
17413
17418
  vue.watch([() => props2.current, () => props2.size], (_ref) => {
17414
17419
  var [newCurrent, newSize] = _ref;
@@ -17426,7 +17431,7 @@ var __sfc__$w = vue.defineComponent({
17426
17431
  } = props2;
17427
17432
  var oldCount = Math.ceil(toNumber(total) / toNumber(oldSize));
17428
17433
  var rEllipseSign = newCount - (maxPagerCount - activePosition.value) - 1;
17429
- simpleValue.value = "" + newCurrent;
17434
+ simpleCurrentValue.value = "" + newCurrent;
17430
17435
  if (newCount - 2 > maxPagerCount) {
17431
17436
  if (oldCurrent === void 0 || newCount !== oldCount) {
17432
17437
  for (var i = 2; i < maxPagerCount + 2; i++) {
@@ -17464,7 +17469,7 @@ var __sfc__$w = vue.defineComponent({
17464
17469
  }
17465
17470
  }
17466
17471
  pageList.value = list2;
17467
- if (oldCurrent !== void 0 && newCount > 0) {
17472
+ if (oldCurrent != null && newCount > 0) {
17468
17473
  call(onChange, newCurrent, newSize);
17469
17474
  }
17470
17475
  call(props2["onUpdate:current"], newCurrent);
@@ -17481,8 +17486,8 @@ var __sfc__$w = vue.defineComponent({
17481
17486
  size,
17482
17487
  pageCount,
17483
17488
  pageList,
17484
- inputValue,
17485
- simpleValue,
17489
+ quickJumperValue,
17490
+ simpleCurrentValue,
17486
17491
  totalText,
17487
17492
  getMode,
17488
17493
  isHideEllipsis,
@@ -25098,7 +25103,7 @@ const TimePickerSfc = "";
25098
25103
  const TooltipSfc = "";
25099
25104
  const uploader = "";
25100
25105
  const UploaderSfc = "";
25101
- const version = "2.9.5";
25106
+ const version = "2.9.6-alpha.1680971883189";
25102
25107
  function install(app) {
25103
25108
  ActionSheet.install && app.use(ActionSheet);
25104
25109
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.9.5",
3
+ "version": "2.9.6-alpha.1680971883189",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -46,9 +46,9 @@
46
46
  "@popperjs/core": "^2.11.6",
47
47
  "dayjs": "^1.10.4",
48
48
  "decimal.js": "^10.2.1",
49
- "@varlet/icons": "2.9.5",
50
- "@varlet/use": "2.9.5",
51
- "@varlet/shared": "2.9.5"
49
+ "@varlet/icons": "2.9.6-alpha.1680971883189",
50
+ "@varlet/shared": "2.9.6-alpha.1680971883189",
51
+ "@varlet/use": "2.9.6-alpha.1680971883189"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/jest": "^26.0.15",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^4.4.4",
64
64
  "vue": "3.2.47",
65
65
  "vue-router": "4.1.6",
66
- "@varlet/cli": "2.9.5",
67
- "@varlet/touch-emulator": "2.9.5"
66
+ "@varlet/cli": "2.9.6-alpha.1680971883189",
67
+ "@varlet/touch-emulator": "2.9.6-alpha.1680971883189"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",