@varlet/ui 3.5.0 → 3.5.1-alpha.1726764162524

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.
Files changed (64) hide show
  1. package/es/action-sheet/style/index.mjs +1 -1
  2. package/es/auto-complete/AutoComplete.mjs +1 -2
  3. package/es/avatar/Avatar.mjs +1 -2
  4. package/es/badge/Badge.mjs +1 -2
  5. package/es/button/Button.mjs +1 -2
  6. package/es/card/Card.mjs +2 -4
  7. package/es/checkbox/Checkbox.mjs +1 -2
  8. package/es/collapse/Collapse.mjs +1 -2
  9. package/es/collapse-item/CollapseItem.mjs +1 -2
  10. package/es/counter/Counter.mjs +1 -2
  11. package/es/date-picker/DatePicker.mjs +30 -60
  12. package/es/date-picker/src/day-picker-panel.mjs +18 -33
  13. package/es/date-picker/src/month-picker-panel.mjs +21 -39
  14. package/es/date-picker/src/panel-header.mjs +3 -6
  15. package/es/date-picker/src/year-picker-panel.mjs +19 -35
  16. package/es/ellipsis/Ellipsis.mjs +1 -2
  17. package/es/fab/Fab.mjs +1 -1
  18. package/es/field-decorator/FieldDecorator.mjs +1 -2
  19. package/es/form-details/FormDetails.mjs +1 -2
  20. package/es/hover/index.mjs +1 -2
  21. package/es/image/Image.mjs +1 -2
  22. package/es/image-preview/ImagePreview.mjs +1 -2
  23. package/es/index-bar/IndexBar.mjs +3 -6
  24. package/es/index.bundle.mjs +1 -1
  25. package/es/index.mjs +1 -1
  26. package/es/input/Input.mjs +1 -2
  27. package/es/loading/Loading.mjs +17 -20
  28. package/es/menu-option/MenuOption.mjs +1 -2
  29. package/es/option/Option.mjs +1 -2
  30. package/es/overlay/Overlay.mjs +1 -2
  31. package/es/pagination/Pagination.mjs +5 -10
  32. package/es/picker/Picker.mjs +1 -2
  33. package/es/popup/Popup.mjs +1 -2
  34. package/es/progress/Progress.mjs +1 -2
  35. package/es/radio/Radio.mjs +1 -2
  36. package/es/rate/Rate.mjs +1 -2
  37. package/es/result/Empty.mjs +13 -16
  38. package/es/result/Error.mjs +10 -13
  39. package/es/result/Info.mjs +10 -13
  40. package/es/result/Question.mjs +10 -13
  41. package/es/result/Warning.mjs +10 -13
  42. package/es/select/Select.mjs +1 -2
  43. package/es/slider/Slider.mjs +1 -2
  44. package/es/snackbar/index.mjs +4 -5
  45. package/es/space/Space.mjs +1 -2
  46. package/es/step/Step.mjs +1 -2
  47. package/es/style.css +1 -1
  48. package/es/swipe/Swipe.mjs +1 -2
  49. package/es/swipe-item/SwipeItem.mjs +1 -2
  50. package/es/switch/Switch.mjs +17 -20
  51. package/es/tabs/Tabs.mjs +1 -2
  52. package/es/time-picker/TimePicker.mjs +13 -26
  53. package/es/time-picker/clock.mjs +11 -22
  54. package/es/time-picker/utils.mjs +4 -8
  55. package/es/uploader/Uploader.mjs +1 -2
  56. package/es/utils/elements.mjs +1 -2
  57. package/es/utils/test.mjs +1 -4
  58. package/es/varlet.esm.js +5120 -5252
  59. package/es/watermark/Watermark.mjs +1 -2
  60. package/highlight/web-types.en-US.json +1 -1
  61. package/highlight/web-types.zh-CN.json +1 -1
  62. package/lib/varlet.cjs.js +501 -842
  63. package/package.json +7 -7
  64. package/umd/varlet.js +8 -8
@@ -32,8 +32,7 @@ import { toSizeUnit } from "../utils/elements.mjs";
32
32
  const SWIPE_DELAY = 250;
33
33
  const SWIPE_OFFSET = 20;
34
34
  const { name, n, classes } = createNamespace("swipe");
35
- import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, Transition as _Transition, mergeProps as _mergeProps, renderList as _renderList, Fragment as _Fragment, resolveDirective as _resolveDirective, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
36
- const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
35
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeProps as _normalizeProps, guardReactiveProps as _guardReactiveProps, resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, Transition as _Transition, mergeProps as _mergeProps, renderList as _renderList, Fragment as _Fragment, resolveDirective as _resolveDirective, withDirectives as _withDirectives } from "vue";
37
36
  const _hoisted_1 = ["onClick"];
38
37
  function __render__(_ctx, _cache) {
39
38
  const _component_var_icon = _resolveComponent("var-icon");
@@ -3,8 +3,7 @@ import { useSwipe } from "./provide.mjs";
3
3
  import { createNamespace } from "../utils/components.mjs";
4
4
  import { toSizeUnit } from "../utils/elements.mjs";
5
5
  const { name, n } = createNamespace("swipe-item");
6
- import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
7
- const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
6
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
8
7
  const _hoisted_1 = ["aria-hidden"];
9
8
  function __render__(_ctx, _cache) {
10
9
  return _openBlock(), _createElementBlock("div", {
@@ -10,27 +10,9 @@ import { props } from "./props.mjs";
10
10
  import { call, preventDefault } from "@varlet/shared";
11
11
  import { useEventListener } from "@varlet/use";
12
12
  const { name, n, classes } = createNamespace("switch");
13
- import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, resolveDirective as _resolveDirective, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
14
- const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
13
+ import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, resolveDirective as _resolveDirective, withDirectives as _withDirectives } from "vue";
15
14
  const _hoisted_1 = ["aria-checked"];
16
15
  const _hoisted_2 = ["tabindex"];
17
- const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ _createElementVNode(
18
- "svg",
19
- { viewBox: "25 25 50 50" },
20
- [
21
- /* @__PURE__ */ _createElementVNode("circle", {
22
- cx: "50",
23
- cy: "50",
24
- r: "20",
25
- fill: "none"
26
- })
27
- ],
28
- -1
29
- /* HOISTED */
30
- ));
31
- const _hoisted_4 = [
32
- _hoisted_3
33
- ];
34
16
  function __render__(_ctx, _cache) {
35
17
  const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
36
18
  const _component_var_form_details = _resolveComponent("var-form-details");
@@ -92,7 +74,22 @@ function __render__(_ctx, _cache) {
92
74
  height: _ctx.radius
93
75
  })
94
76
  },
95
- [..._hoisted_4],
77
+ _cache[3] || (_cache[3] = [
78
+ _createElementVNode(
79
+ "svg",
80
+ { viewBox: "25 25 50 50" },
81
+ [
82
+ _createElementVNode("circle", {
83
+ cx: "50",
84
+ cy: "50",
85
+ r: "20",
86
+ fill: "none"
87
+ })
88
+ ],
89
+ -1
90
+ /* HOISTED */
91
+ )
92
+ ]),
96
93
  6
97
94
  /* CLASS, STYLE */
98
95
  )) : _createCommentVNode("v-if", true)
package/es/tabs/Tabs.mjs CHANGED
@@ -174,8 +174,7 @@ const __sfc__ = defineComponent({
174
174
  }
175
175
  function moveIndicator({ element }) {
176
176
  const el = element.value;
177
- if (!el)
178
- return;
177
+ if (!el) return;
179
178
  if (props2.layoutDirection === "horizontal") {
180
179
  indicatorWidth.value = `${el.offsetWidth}px`;
181
180
  indicatorX.value = `${el.offsetLeft}px`;
@@ -242,10 +242,8 @@ const __sfc__ = defineComponent({
242
242
  y: []
243
243
  });
244
244
  const getRad = computed(() => {
245
- if (type.value === "hour")
246
- return hourRad.value;
247
- if (type.value === "minute")
248
- return minuteRad.value;
245
+ if (type.value === "hour") return hourRad.value;
246
+ if (type.value === "minute") return minuteRad.value;
249
247
  return secondRad.value;
250
248
  });
251
249
  const { t: pt } = injectLocaleProvider();
@@ -293,12 +291,10 @@ const __sfc__ = defineComponent({
293
291
  });
294
292
  }
295
293
  function checkAmpm(ampmType) {
296
- if (props2.readonly)
297
- return;
294
+ if (props2.readonly) return;
298
295
  ampm.value = ampmType;
299
296
  const newHour = findAvailableHour(ampmType);
300
- if (!newHour)
301
- return;
297
+ if (!newHour) return;
302
298
  const second = props2.useSeconds ? `:${time.value.second}` : "";
303
299
  const newTime = `${padStart(newHour, 2, "0")}:${time.value.minute}${second}`;
304
300
  update(newTime);
@@ -343,12 +339,10 @@ const __sfc__ = defineComponent({
343
339
  if (!disableHour.includes(anotherHour)) {
344
340
  isInner.value = props2.format === "24hr" ? getInner(clientX, clientY) : false;
345
341
  }
346
- if (isInner.value !== isActualInner.value)
347
- return;
342
+ if (isInner.value !== isActualInner.value) return;
348
343
  const newHour = isInner.value || ampm.value === "pm" ? hours24[index] : hoursAmpm[index];
349
344
  isDisableHour.value = disableHour.includes(newHour);
350
- if (isDisableHour.value)
351
- return;
345
+ if (isDisableHour.value) return;
352
346
  hourRad.value = rad;
353
347
  isChosenUsableHour.value = true;
354
348
  }
@@ -367,8 +361,7 @@ const __sfc__ = defineComponent({
367
361
  allowedTime: props2.allowedTime
368
362
  };
369
363
  isDisableMinute.value = getIsDisableMinute(values);
370
- if (isDisableMinute.value)
371
- return;
364
+ if (isDisableMinute.value) return;
372
365
  minuteRad.value = rad;
373
366
  isChosenUsableMinute.value = true;
374
367
  }
@@ -387,8 +380,7 @@ const __sfc__ = defineComponent({
387
380
  disableHour,
388
381
  allowedTime: props2.allowedTime
389
382
  };
390
- if (!getIsDisableSecond(values))
391
- secondRad.value = rad;
383
+ if (!getIsDisableSecond(values)) secondRad.value = rad;
392
384
  }
393
385
  function setCenterAndRange() {
394
386
  const { left, top, width, height } = getRect(container.value);
@@ -402,23 +394,18 @@ const __sfc__ = defineComponent({
402
394
  }
403
395
  function moveHand(event) {
404
396
  preventDefault(event);
405
- if (props2.readonly)
406
- return;
397
+ if (props2.readonly) return;
407
398
  setCenterAndRange();
408
399
  const { clientX, clientY } = event.touches[0];
409
400
  const x = clientX - center.x;
410
401
  const y = clientY - center.y;
411
402
  const roundDeg = Math.round(rad2deg(Math.atan2(y, x)));
412
- if (type.value === "hour")
413
- setHourRad(clientX, clientY, roundDeg);
414
- else if (type.value === "minute")
415
- setMinuteRad(roundDeg);
416
- else
417
- setSecondRad(roundDeg);
403
+ if (type.value === "hour") setHourRad(clientX, clientY, roundDeg);
404
+ else if (type.value === "minute") setMinuteRad(roundDeg);
405
+ else setSecondRad(roundDeg);
418
406
  }
419
407
  function end() {
420
- if (props2.readonly)
421
- return;
408
+ if (props2.readonly) return;
422
409
  if (type.value === "hour" && isChosenUsableHour.value) {
423
410
  type.value = "minute";
424
411
  return;
@@ -148,14 +148,12 @@ const __sfc__ = defineComponent({
148
148
  borderColor: getHandleColor()
149
149
  }));
150
150
  const activeItemIndex = computed(() => {
151
- if (props.rad === void 0)
152
- return;
151
+ if (props.rad === void 0) return;
153
152
  const value = props.rad / 30;
154
153
  return value >= 0 ? value : value + 12;
155
154
  });
156
155
  const timeScales = computed(() => {
157
- if (props.type === "hour")
158
- return hoursAmpm;
156
+ if (props.type === "hour") return hoursAmpm;
159
157
  return minSec;
160
158
  });
161
159
  const isDisableMinSec = (time, isDisable2) => {
@@ -172,13 +170,11 @@ const __sfc__ = defineComponent({
172
170
  allowedTime: props.allowedTime,
173
171
  disableHour: disableHour.value
174
172
  };
175
- if (isDisable2 && props.type === "minute")
176
- Reflect.deleteProperty(values, "minute");
173
+ if (isDisable2 && props.type === "minute") Reflect.deleteProperty(values, "minute");
177
174
  return disableMethod(values);
178
175
  };
179
176
  const getHandleColor = () => {
180
- if (activeItemIndex.value === void 0)
181
- return props.color;
177
+ if (activeItemIndex.value === void 0) return props.color;
182
178
  const hour = props.isInner ? hours24[activeItemIndex.value] : timeScales.value[activeItemIndex.value];
183
179
  if (timeScales.value === minSec) {
184
180
  return isDisableMinSec() ? "var(--time-picker-clock-item-disable-background)" : props.color;
@@ -186,14 +182,12 @@ const __sfc__ = defineComponent({
186
182
  return isDisable(hour) ? "var(--time-picker-clock-item-disable-background)" : props.color;
187
183
  };
188
184
  const isActive = (index, inner2) => {
189
- if (inner2)
190
- return activeItemIndex.value === index && props.isInner;
185
+ if (inner2) return activeItemIndex.value === index && props.isInner;
191
186
  return activeItemIndex.value === index && (!props.isInner || props.type !== "hour");
192
187
  };
193
188
  const isDisable = (time) => {
194
189
  if (props.type === "hour") {
195
- if (notConvert(props.format, props.ampm))
196
- return disableHour.value.includes(time);
190
+ if (notConvert(props.format, props.ampm)) return disableHour.value.includes(time);
197
191
  const timeIndex = hoursAmpm.findIndex((hour) => hour === time);
198
192
  return disable24HourIndex.value.includes(timeIndex);
199
193
  }
@@ -237,31 +231,26 @@ const __sfc__ = defineComponent({
237
231
  };
238
232
  };
239
233
  const getHour = () => {
240
- if (activeItemIndex.value === void 0)
241
- return void 0;
234
+ if (activeItemIndex.value === void 0) return void 0;
242
235
  const hours = props.ampm === "am" ? hoursAmpm : hours24;
243
236
  return padStart(hours[activeItemIndex.value], 2, "0");
244
237
  };
245
238
  watch([activeItemIndex, () => props.isInner], ([index, inner2], [oldIndex, oldInner]) => {
246
239
  const isSame = index === oldIndex && inner2 === oldInner;
247
- if (isSame || props.type !== "hour" || activeItemIndex.value === void 0)
248
- return;
240
+ if (isSame || props.type !== "hour" || activeItemIndex.value === void 0) return;
249
241
  const newHour = inner2 ? hours24[activeItemIndex.value] : getHour();
250
242
  const second = props.useSeconds ? `:${props.time.second}` : "";
251
243
  const newTime = `${newHour}:${props.time.minute}${second}`;
252
- if (!props.preventNextUpdate)
253
- emit("update", newTime);
244
+ if (!props.preventNextUpdate) emit("update", newTime);
254
245
  emit("change-prevent-update");
255
246
  });
256
247
  watch(
257
248
  () => props.rad,
258
249
  (rad, oldRad) => {
259
- if (props.type === "hour" || rad === void 0 || oldRad === void 0)
260
- return;
250
+ if (props.type === "hour" || rad === void 0 || oldRad === void 0) return;
261
251
  const radToMinSec = rad / 6 >= 0 ? rad / 6 : rad / 6 + 60;
262
252
  const oldRadToMinSec = oldRad / 6 >= 0 ? oldRad / 6 : oldRad / 6 + 60;
263
- if (radToMinSec === oldRadToMinSec)
264
- return;
253
+ if (radToMinSec === oldRadToMinSec) return;
265
254
  let newTime;
266
255
  const { hourStr } = convertHour(props.format, props.ampm, props.time.hour);
267
256
  if (props.type === "minute") {
@@ -23,8 +23,7 @@ const getIsDisableMinute = (values) => {
23
23
  const { hourStr, hourNum } = convertHour(format, ampm, hour);
24
24
  let isBetweenMinMax = false;
25
25
  let isAllow = false;
26
- if (disableHour.includes(hourStr))
27
- return true;
26
+ if (disableHour.includes(hourStr)) return true;
28
27
  if (max && !min) {
29
28
  const { hour: maxHour, minute: maxMinute } = getNumberTime(max);
30
29
  isBetweenMinMax = maxHour === hourNum && time > maxMinute;
@@ -38,8 +37,7 @@ const getIsDisableMinute = (values) => {
38
37
  const { hour: minHour, minute: minMinute } = getNumberTime(min);
39
38
  isBetweenMinMax = minHour === hourNum && time < minMinute || maxHour === hourNum && time > maxMinute;
40
39
  }
41
- if ((_a = values.allowedTime) == null ? void 0 : _a.minutes)
42
- isAllow = (_b = values.allowedTime) == null ? void 0 : _b.minutes(time);
40
+ if ((_a = values.allowedTime) == null ? void 0 : _a.minutes) isAllow = (_b = values.allowedTime) == null ? void 0 : _b.minutes(time);
43
41
  return isBetweenMinMax || isAllow;
44
42
  };
45
43
  const getIsDisableSecond = (values) => {
@@ -48,8 +46,7 @@ const getIsDisableSecond = (values) => {
48
46
  const { hourStr, hourNum } = convertHour(format, ampm, hour);
49
47
  let isBetweenMinMax = false;
50
48
  let isAllow = false;
51
- if (disableHour.includes(hourStr))
52
- return true;
49
+ if (disableHour.includes(hourStr)) return true;
53
50
  if (max && !min) {
54
51
  const { hour: maxHour, minute: maxMinute, second: maxSecond } = getNumberTime(max);
55
52
  isBetweenMinMax = maxHour === hourNum && maxMinute < minute || maxMinute === minute && time > maxSecond;
@@ -63,8 +60,7 @@ const getIsDisableSecond = (values) => {
63
60
  const { hour: minHour, minute: minMinute, second: minSecond } = getNumberTime(min);
64
61
  isBetweenMinMax = maxHour === hourNum && maxMinute < minute || minHour === hourNum && minMinute > minute || maxHour === hourNum && maxMinute === minute && time > maxSecond || minHour === hourNum && minMinute === minute && time < minSecond;
65
62
  }
66
- if ((_a = values.allowedTime) == null ? void 0 : _a.seconds)
67
- isAllow = (_b = values.allowedTime) == null ? void 0 : _b.seconds(time);
63
+ if ((_a = values.allowedTime) == null ? void 0 : _a.seconds) isAllow = (_b = values.allowedTime) == null ? void 0 : _b.seconds(time);
68
64
  return isBetweenMinMax || isAllow;
69
65
  };
70
66
  export {
@@ -35,8 +35,7 @@ import { toSizeUnit } from "../utils/elements.mjs";
35
35
  import { useEventListener } from "@varlet/use";
36
36
  const { name, n, classes } = createNamespace("uploader");
37
37
  let fid = 0;
38
- import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, renderSlot as _renderSlot, withCtx as _withCtx, createSlots as _createSlots, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
39
- const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
38
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, renderSlot as _renderSlot, withCtx as _withCtx, createSlots as _createSlots } from "vue";
40
39
  const _hoisted_1 = ["onClick"];
41
40
  const _hoisted_2 = ["onClick"];
42
41
  const _hoisted_3 = ["src", "alt"];
@@ -60,8 +60,7 @@ function getTarget(target, componentName) {
60
60
  }
61
61
  return el;
62
62
  }
63
- if (isObject(target))
64
- return target;
63
+ if (isObject(target)) return target;
65
64
  error(componentName, 'type of prop "target" should be a selector or an element object');
66
65
  }
67
66
  function getViewportSize() {
package/es/utils/test.mjs CHANGED
@@ -1,9 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
4
  var __async = (__this, __arguments, generator) => {
8
5
  return new Promise((resolve, reject) => {
9
6
  var fulfilled = (value) => {