@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.
@@ -1 +1 @@
1
- :root { --checkbox-checked-color: var(--color-primary); --checkbox-unchecked-color: #555; --checkbox-disabled-color: var(--color-text-disabled); --checkbox-error-color: var(--color-danger); --checkbox-action-padding: 6px; --checkbox-text-padding: 6px 6px 6px 0; --checkbox-icon-size: 24px;}@keyframes var-vibrate-animation { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); }}.var-checkbox { display: flex; align-items: center; transform: translateX(calc(-1 * var(--checkbox-action-padding))); cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-checkbox__wrap { display: inline-flex; flex-direction: column;}.var-checkbox__action { position: relative; display: flex; justify-content: center; align-items: center; padding: var(--checkbox-action-padding); border-radius: 50%; transition: background-color 0.25s, color 0.25s;}.var-checkbox__icon[var-checkbox-cover] { display: block; font-size: var(--checkbox-icon-size);}.var-checkbox--with-animation { animation: var-vibrate-animation 0.25s;}.var-checkbox--checked { color: var(--checkbox-checked-color);}.var-checkbox--unchecked { color: var(--checkbox-unchecked-color);}.var-checkbox--disabled { color: var(--checkbox-disabled-color); cursor: not-allowed;}.var-checkbox--error { color: var(--checkbox-error-color);}
1
+ :root { --checkbox-checked-color: var(--color-primary); --checkbox-unchecked-color: #555; --checkbox-disabled-color: var(--color-text-disabled); --checkbox-error-color: var(--color-danger); --checkbox-action-padding: 6px; --checkbox-text-padding: 6px 6px 6px 0; --checkbox-icon-size: 24px;}@keyframes var-vibrate-animation { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); }}.var-checkbox { display: flex; align-items: center; transform: translateX(calc(-1 * var(--checkbox-action-padding))); cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-checkbox__wrap { display: inline-flex; flex-direction: column;}.var-checkbox__action { position: relative; display: flex; justify-content: center; align-items: center; flex-shrink: 0; padding: var(--checkbox-action-padding); border-radius: 50%; transition: background-color 0.25s, color 0.25s;}.var-checkbox__icon[var-checkbox-cover] { display: block; font-size: var(--checkbox-icon-size);}.var-checkbox--with-animation { animation: var-vibrate-animation 0.25s;}.var-checkbox--checked { color: var(--checkbox-checked-color);}.var-checkbox--unchecked { color: var(--checkbox-unchecked-color);}.var-checkbox--disabled { color: var(--checkbox-disabled-color); cursor: not-allowed;}.var-checkbox--error { color: var(--checkbox-error-color);}
@@ -241,7 +241,7 @@ import './time-picker/style/index.mjs'
241
241
  import './tooltip/style/index.mjs'
242
242
  import './uploader/style/index.mjs'
243
243
 
244
- const version = '2.9.5'
244
+ const version = '2.9.6-alpha.1680971883189'
245
245
 
246
246
  function install(app) {
247
247
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -160,7 +160,7 @@ export * from './time-picker/index.mjs'
160
160
  export * from './tooltip/index.mjs'
161
161
  export * from './uploader/index.mjs'
162
162
 
163
- const version = '2.9.5'
163
+ const version = '2.9.6-alpha.1680971883189'
164
164
 
165
165
  function install(app) {
166
166
  ActionSheet.install && app.use(ActionSheet)
@@ -44,12 +44,12 @@ function __render__(_ctx, _cache) {
44
44
  key: 0,
45
45
  class: _normalizeClass(_ctx.classes(_ctx.n('simple'), [_ctx.disabled, _ctx.n('item--disabled')]))
46
46
  }, [_createVNode(_component_var_input, {
47
- modelValue: _ctx.simpleValue,
48
- "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.simpleValue = $event),
47
+ modelValue: _ctx.simpleCurrentValue,
48
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => _ctx.simpleCurrentValue = $event),
49
49
  disabled: _ctx.disabled,
50
50
  "var-pagination-cover": "",
51
- onBlur: _cache[2] || (_cache[2] = $event => _ctx.setPage('simple', _ctx.simpleValue, $event)),
52
- onKeydown: _cache[3] || (_cache[3] = _withKeys($event => _ctx.setPage('simple', _ctx.simpleValue, $event), ["enter"]))
51
+ onBlur: _cache[2] || (_cache[2] = $event => _ctx.setPage('simple', _ctx.simpleCurrentValue, $event)),
52
+ onKeydown: _cache[3] || (_cache[3] = _withKeys($event => _ctx.setPage('simple', _ctx.simpleCurrentValue, $event), ["enter"]))
53
53
  }, null, 8
54
54
  /* PROPS */
55
55
  , ["modelValue", "disabled"]), _createElementVNode("span", null, [_createTextVNode(" / " + _toDisplayString(_ctx.pageCount) + " ", 1
@@ -142,12 +142,12 @@ function __render__(_ctx, _cache) {
142
142
  }, [_createTextVNode(_toDisplayString(_ctx.pack.paginationJump) + " ", 1
143
143
  /* TEXT */
144
144
  ), _createVNode(_component_var_input, {
145
- modelValue: _ctx.inputValue,
146
- "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => _ctx.inputValue = $event),
145
+ modelValue: _ctx.quickJumperValue,
146
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = $event => _ctx.quickJumperValue = $event),
147
147
  disabled: _ctx.disabled,
148
148
  "var-pagination-cover": "",
149
- onBlur: _cache[8] || (_cache[8] = $event => _ctx.setPage('quick', _ctx.inputValue, $event)),
150
- onKeydown: _cache[9] || (_cache[9] = _withKeys($event => _ctx.setPage('quick', _ctx.inputValue, $event), ["enter"]))
149
+ onBlur: _cache[8] || (_cache[8] = $event => _ctx.setPage('quick', _ctx.quickJumperValue, $event)),
150
+ onKeydown: _cache[9] || (_cache[9] = _withKeys($event => _ctx.setPage('quick', _ctx.quickJumperValue, $event), ["enter"]))
151
151
  }, null, 8
152
152
  /* PROPS */
153
153
  , ["modelValue", "disabled"])], 2
@@ -177,8 +177,8 @@ var __sfc__ = defineComponent({
177
177
 
178
178
  setup(props) {
179
179
  var menuVisible = ref(false);
180
- var inputValue = ref('');
181
- var simpleValue = ref('1');
180
+ var quickJumperValue = ref('');
181
+ var simpleCurrentValue = ref('1');
182
182
  var isHideEllipsisHead = ref(false);
183
183
  var isHideEllipsisTail = ref(false);
184
184
  var current = ref(toNumber(props.current) || 1);
@@ -207,48 +207,68 @@ var __sfc__ = defineComponent({
207
207
  };
208
208
 
209
209
  var clickItem = (item, index) => {
210
- if (item === current.value || props.disabled) return;
211
- if (isNumber(item)) current.value = item;else if (item === 'prev') current.value > 1 && (current.value -= 1);else if (item === 'next') current.value < pageCount.value && (current.value += 1);else if (item === '...') {
212
- if (index === 1) {
213
- current.value = Math.max(current.value - props.maxPagerCount, 1);
214
- } else {
215
- current.value = Math.min(current.value + props.maxPagerCount, pageCount.value);
216
- }
210
+ if (item === current.value || props.disabled) {
211
+ return;
212
+ }
213
+
214
+ if (item === '...') {
215
+ current.value = index === 1 ? Math.max(current.value - props.maxPagerCount, 1) : Math.min(current.value + props.maxPagerCount, pageCount.value);
216
+ return;
217
+ }
218
+
219
+ if (item === 'prev') {
220
+ current.value = ensureCurrentBoundary(current.value - 1);
221
+ return;
222
+ }
223
+
224
+ if (item === 'next') {
225
+ current.value = ensureCurrentBoundary(current.value + 1);
226
+ return;
227
+ }
228
+
229
+ if (isNumber(item)) {
230
+ current.value = item;
217
231
  }
218
232
  };
219
233
 
220
234
  var showMenu = () => {
221
- if (props.disabled) return;
235
+ if (props.disabled) {
236
+ return;
237
+ }
238
+
222
239
  menuVisible.value = true;
223
240
  };
224
241
 
225
242
  var clickSize = option => {
226
243
  size.value = option;
227
244
  menuVisible.value = false;
245
+ var targetCurrent = ensureCurrentBoundary(current.value);
246
+ simpleCurrentValue.value = String(targetCurrent);
247
+ current.value = targetCurrent;
228
248
  };
229
249
 
230
- var isValidatePage = value => {
231
- var pattern = /^[1-9][0-9]*$/;
232
- return pattern.test(value);
250
+ var ensureCurrentBoundary = targetCurrent => {
251
+ if (targetCurrent > pageCount.value) {
252
+ return pageCount.value;
253
+ }
254
+
255
+ if (targetCurrent < 1) {
256
+ return 1;
257
+ }
258
+
259
+ return targetCurrent;
233
260
  };
234
261
 
235
- var setPage = (type, value, event) => {
262
+ var setPage = (type, page, event) => {
236
263
  ;
237
264
  event.target.blur();
265
+ var targetCurrent = ensureCurrentBoundary(toNumber(page));
266
+ simpleCurrentValue.value = String(targetCurrent);
267
+ current.value = targetCurrent;
238
268
 
239
- if (isValidatePage(value)) {
240
- var valueNum = toNumber(value);
241
-
242
- if (valueNum > pageCount.value) {
243
- valueNum = pageCount.value;
244
- simpleValue.value = "" + valueNum;
245
- }
246
-
247
- if (valueNum !== current.value) current.value = valueNum;
269
+ if (type === 'quick') {
270
+ quickJumperValue.value = '';
248
271
  }
249
-
250
- if (type === 'quick') inputValue.value = '';
251
- if (type === 'simple' && !isValidatePage(value)) simpleValue.value = "" + current.value;
252
272
  };
253
273
 
254
274
  watch([() => props.current, () => props.size], _ref => {
@@ -267,7 +287,7 @@ var __sfc__ = defineComponent({
267
287
  } = props;
268
288
  var oldCount = Math.ceil(toNumber(total) / toNumber(oldSize));
269
289
  var rEllipseSign = newCount - (maxPagerCount - activePosition.value) - 1;
270
- simpleValue.value = "" + newCurrent;
290
+ simpleCurrentValue.value = "" + newCurrent;
271
291
 
272
292
  if (newCount - 2 > maxPagerCount) {
273
293
  if (oldCurrent === undefined || newCount !== oldCount) {
@@ -322,7 +342,7 @@ var __sfc__ = defineComponent({
322
342
 
323
343
  pageList.value = list;
324
344
 
325
- if (oldCurrent !== undefined && newCount > 0) {
345
+ if (oldCurrent != null && newCount > 0) {
326
346
  call(onChange, newCurrent, newSize);
327
347
  }
328
348
 
@@ -340,8 +360,8 @@ var __sfc__ = defineComponent({
340
360
  size,
341
361
  pageCount,
342
362
  pageList,
343
- inputValue,
344
- simpleValue,
363
+ quickJumperValue,
364
+ simpleCurrentValue,
345
365
  totalText,
346
366
  getMode,
347
367
  isHideEllipsis,
@@ -1 +1 @@
1
- :root { --radio-checked-color: var(--color-primary); --radio-unchecked-color: #555; --radio-disabled-color: var(--color-text-disabled); --radio-error-color: var(--color-danger); --radio-icon-size: 24px; --radio-action-padding: 6px; --radio-text-padding: 6px 6px 6px 0;}@keyframes var-vibrate-animation { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); }}.var-radio { display: flex; align-items: center; transform: translateX(calc(-1 * var(--radio-action-padding))); cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-radio__wrap { display: inline-flex; flex-direction: column;}.var-radio__action { display: flex; justify-content: center; position: relative; align-items: center; padding: var(--radio-action-padding); border-radius: 50%; transition: background-color 0.25s, color 0.25s;}.var-radio__icon[var-radio-cover] { display: block; font-size: var(--radio-icon-size);}.var-radio--with-animation[var-radio-cover] { animation: var-vibrate-animation 0.25s;}.var-radio--checked { color: var(--radio-checked-color);}.var-radio--unchecked { color: var(--radio-unchecked-color);}.var-radio--disabled { color: var(--radio-disabled-color); cursor: not-allowed;}.var-radio--error { color: var(--radio-error-color);}
1
+ :root { --radio-checked-color: var(--color-primary); --radio-unchecked-color: #555; --radio-disabled-color: var(--color-text-disabled); --radio-error-color: var(--color-danger); --radio-icon-size: 24px; --radio-action-padding: 6px; --radio-text-padding: 6px 6px 6px 0;}@keyframes var-vibrate-animation { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1); }}.var-radio { display: flex; align-items: center; transform: translateX(calc(-1 * var(--radio-action-padding))); cursor: pointer; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.var-radio__wrap { display: inline-flex; flex-direction: column;}.var-radio__action { position: relative; display: flex; justify-content: center; align-items: center; flex-shrink: 0; padding: var(--radio-action-padding); border-radius: 50%; transition: background-color 0.25s, color 0.25s;}.var-radio__icon[var-radio-cover] { display: block; font-size: var(--radio-icon-size);}.var-radio--with-animation[var-radio-cover] { animation: var-vibrate-animation 0.25s;}.var-radio--checked { color: var(--radio-checked-color);}.var-radio--unchecked { color: var(--radio-unchecked-color);}.var-radio--disabled { color: var(--radio-disabled-color); cursor: not-allowed;}.var-radio--error { color: var(--radio-error-color);}