@varlet/ui 2.12.0-alpha.1688105697429 → 2.12.0

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,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.12.0-alpha.1688105697429",
4
+ "version": "2.12.0",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -2944,11 +2944,11 @@
2944
2944
  }
2945
2945
  },
2946
2946
  {
2947
- "name": "current",
2948
- "description": "URL from which the image preview starts",
2949
- "default": "-",
2947
+ "name": "initial-index",
2948
+ "description": "Index from which the image preview starts",
2949
+ "default": "0",
2950
2950
  "value": {
2951
- "type": "string",
2951
+ "type": "string | number",
2952
2952
  "kind": "expression"
2953
2953
  }
2954
2954
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.12.0-alpha.1688105697429",
4
+ "version": "2.12.0",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -3103,11 +3103,11 @@
3103
3103
  }
3104
3104
  },
3105
3105
  {
3106
- "name": "current",
3107
- "description": "图片预览起始的 URL",
3108
- "default": "-",
3106
+ "name": "initial-index",
3107
+ "description": "图片预览起始的索引",
3108
+ "default": "0",
3109
3109
  "value": {
3110
- "type": "string",
3110
+ "type": "string | number",
3111
3111
  "kind": "expression"
3112
3112
  }
3113
3113
  },
package/lib/varlet.cjs.js CHANGED
@@ -13362,8 +13362,8 @@ const Fab = vue.defineComponent({
13362
13362
  };
13363
13363
  var renderFab = () => {
13364
13364
  var _slot;
13365
- var _slots$default;
13366
- var children = flatFragment((_slots$default = slots.default == null ? void 0 : slots.default()) != null ? _slots$default : []);
13365
+ var _call;
13366
+ var children = flatFragment((_call = call(slots.default)) != null ? _call : []);
13367
13367
  return vue.createVNode("div", vue.mergeProps({
13368
13368
  "class": classes$B(n$J(), n$J("--position-" + props2.position), n$J("--direction-" + props2.direction), [props2.fixed, n$J("--fixed"), n$J("--absolute")], [props2.safeArea, n$J("--safe-area")]),
13369
13369
  "style": {
@@ -14305,9 +14305,14 @@ var props$C = _extends$7({
14305
14305
  type: Array,
14306
14306
  default: () => []
14307
14307
  },
14308
+ /** @deprecated Use initialIndex to instead. */
14308
14309
  current: {
14309
14310
  type: String
14310
14311
  },
14312
+ initialIndex: {
14313
+ type: [String, Number],
14314
+ default: 0
14315
+ },
14311
14316
  zoom: {
14312
14317
  type: [String, Number],
14313
14318
  default: 2
@@ -14360,6 +14365,7 @@ function __render__$F(_ctx, _cache) {
14360
14365
  onRouteChange: _ctx.onRouteChange
14361
14366
  }, {
14362
14367
  default: vue.withCtx(() => [vue.createVNode(_component_var_swipe, vue.mergeProps({
14368
+ ref: "swipeRef",
14363
14369
  class: _ctx.n("swipe"),
14364
14370
  "var-image-preview-cover": "",
14365
14371
  touchable: _ctx.canSwipe,
@@ -14461,8 +14467,12 @@ var __sfc__$G = vue.defineComponent({
14461
14467
  var initialIndex = vue.computed(() => {
14462
14468
  var {
14463
14469
  images,
14464
- current
14470
+ current,
14471
+ initialIndex: initialIndex2
14465
14472
  } = props2;
14473
+ if (initialIndex2 != null) {
14474
+ return toNumber(initialIndex2);
14475
+ }
14466
14476
  var index = images.findIndex((image2) => image2 === current);
14467
14477
  return index >= 0 ? index : 0;
14468
14478
  });
@@ -14472,6 +14482,7 @@ var __sfc__$G = vue.defineComponent({
14472
14482
  var transitionTimingFunction = vue.ref(void 0);
14473
14483
  var transitionDuration = vue.ref(void 0);
14474
14484
  var canSwipe = vue.ref(true);
14485
+ var swipeRef = vue.ref(null);
14475
14486
  var startTouch = null;
14476
14487
  var prevTouch = null;
14477
14488
  var closeRunner = null;
@@ -14647,6 +14658,18 @@ var __sfc__$G = vue.defineComponent({
14647
14658
  }
14648
14659
  call(props2["onUpdate:show"], false);
14649
14660
  };
14661
+ var prev = (options) => {
14662
+ var _swipeRef$value;
14663
+ (_swipeRef$value = swipeRef.value) == null ? void 0 : _swipeRef$value.prev(options);
14664
+ };
14665
+ var next = (options) => {
14666
+ var _swipeRef$value2;
14667
+ (_swipeRef$value2 = swipeRef.value) == null ? void 0 : _swipeRef$value2.next(options);
14668
+ };
14669
+ var to = (idx, options) => {
14670
+ var _swipeRef$value3;
14671
+ (_swipeRef$value3 = swipeRef.value) == null ? void 0 : _swipeRef$value3.to(idx, options);
14672
+ };
14650
14673
  var preventImageDefault = (event) => {
14651
14674
  props2.imagePreventDefault && props2.show && event.preventDefault();
14652
14675
  };
@@ -14672,7 +14695,10 @@ var __sfc__$G = vue.defineComponent({
14672
14695
  handleTouchmove,
14673
14696
  handleTouchend,
14674
14697
  handleTouchcancel,
14675
- close
14698
+ close,
14699
+ prev,
14700
+ next,
14701
+ to
14676
14702
  };
14677
14703
  }
14678
14704
  });
@@ -24768,7 +24794,7 @@ const TimePickerSfc = "";
24768
24794
  const TooltipSfc = "";
24769
24795
  const uploader = "";
24770
24796
  const UploaderSfc = "";
24771
- const version = "2.12.0-alpha.1688105697429";
24797
+ const version = "2.12.0";
24772
24798
  function install(app) {
24773
24799
  ActionSheet.install && app.use(ActionSheet);
24774
24800
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.12.0-alpha.1688105697429",
3
+ "version": "2.12.0",
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/shared": "2.12.0-alpha.1688105697429",
50
- "@varlet/icons": "2.12.0-alpha.1688105697429",
51
- "@varlet/use": "2.12.0-alpha.1688105697429"
49
+ "@varlet/icons": "2.12.0",
50
+ "@varlet/shared": "2.12.0",
51
+ "@varlet/use": "2.12.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@vue/runtime-core": "3.3.4",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^5.1.5",
64
64
  "vue": "3.3.4",
65
65
  "vue-router": "4.2.0",
66
- "@varlet/cli": "2.12.0-alpha.1688105697429",
67
- "@varlet/touch-emulator": "2.12.0-alpha.1688105697429"
66
+ "@varlet/touch-emulator": "2.12.0",
67
+ "@varlet/cli": "2.12.0"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",
@@ -1,11 +1,12 @@
1
1
  import { VarComponent, BasicAttributes, ListenerProp } from './varComponent'
2
+ import { SwipeToOptions } from './swipe'
2
3
  import { App, TeleportProps, VNode } from 'vue'
3
4
 
4
5
  export declare const imagePreviewProps: Record<string, any>
5
6
 
6
7
  export interface ImagePreviewProps extends BasicAttributes {
7
8
  show?: boolean
8
- current?: string
9
+ initialIndex?: string | number
9
10
  images?: string[]
10
11
  zoom?: string | number
11
12
  lockScroll?: boolean
@@ -20,10 +21,13 @@ export interface ImagePreviewProps extends BasicAttributes {
20
21
  onChange?: ListenerProp<(index: number) => void>
21
22
  onLongPress?: ListenerProp<(index: number) => void>
22
23
  'onUpdate:show'?: ListenerProp<(show: boolean) => void>
24
+
25
+ /** @deprecated Use initialIndex to instead. */
26
+ current?: string
23
27
  }
24
28
 
25
29
  export interface ImagePreviewOptions {
26
- current?: string
30
+ initialIndex?: string | number
27
31
  images?: string[]
28
32
  zoom?: string | number
29
33
  lockScroll?: boolean
@@ -36,6 +40,9 @@ export interface ImagePreviewOptions {
36
40
  onClosed?: () => void
37
41
  onChange?: (index: number) => void
38
42
  onLongPress?: (index: number) => void
43
+
44
+ /** @deprecated Use initialIndex to instead. */
45
+ current?: string
39
46
  }
40
47
 
41
48
  export class ImagePreviewComponent extends VarComponent {
@@ -46,6 +53,12 @@ export class ImagePreviewComponent extends VarComponent {
46
53
  extra(): VNode[]
47
54
  'close-icon'(): VNode[]
48
55
  }
56
+
57
+ prev(options?: SwipeToOptions): void
58
+
59
+ next(options?: SwipeToOptions): void
60
+
61
+ to(index: number, options?: SwipeToOptions): void
49
62
  }
50
63
 
51
64
  export interface IImagePreview {
@@ -23,3 +23,5 @@ export interface ILoadingBar {
23
23
  }
24
24
 
25
25
  export declare const LoadingBar: ILoadingBar
26
+
27
+ export class _LoadingBarComponent {}