@varlet/ui 3.3.11 → 3.3.12

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
@@ -13675,7 +13675,27 @@ function usePopover(options) {
13675
13675
  let popoverInstance = null;
13676
13676
  let enterPopover = false;
13677
13677
  let enterHost = false;
13678
- const computeHostSize = () => {
13678
+ useEventListener(() => window, "keydown", handleKeydown);
13679
+ useClickOutside(getReference, "click", handleClickOutside);
13680
+ onWindowResize(resize);
13681
+ vue.watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
13682
+ vue.watch(() => options.disabled, close);
13683
+ vue.watch(
13684
+ () => show.value,
13685
+ (newValue) => {
13686
+ if (newValue) {
13687
+ resize();
13688
+ }
13689
+ }
13690
+ );
13691
+ vue.onMounted(() => {
13692
+ var _a;
13693
+ popoverInstance = createPopper((_a = getReference()) != null ? _a : host.value, popover.value, getPopperOptions());
13694
+ });
13695
+ vue.onUnmounted(() => {
13696
+ popoverInstance.destroy();
13697
+ });
13698
+ function computeHostSize() {
13679
13699
  if (!host.value) {
13680
13700
  return;
13681
13701
  }
@@ -13684,8 +13704,8 @@ function usePopover(options) {
13684
13704
  width: toPxNum(width),
13685
13705
  height: toPxNum(height)
13686
13706
  };
13687
- };
13688
- const getTransformOrigin = () => {
13707
+ }
13708
+ function getTransformOrigin() {
13689
13709
  switch (options.placement) {
13690
13710
  case "top":
13691
13711
  case "cover-bottom":
@@ -13716,64 +13736,71 @@ function usePopover(options) {
13716
13736
  case "cover-left":
13717
13737
  return "left";
13718
13738
  }
13719
- };
13720
- const handleHostMouseenter = () => {
13739
+ }
13740
+ function handleHostMouseenter() {
13721
13741
  if (options.trigger !== "hover") {
13722
13742
  return;
13723
13743
  }
13724
13744
  enterHost = true;
13725
13745
  open();
13726
- };
13727
- const handleHostMouseleave = () => __async$a(this, null, function* () {
13728
- if (options.trigger !== "hover") {
13729
- return;
13730
- }
13731
- enterHost = false;
13732
- yield doubleRaf();
13733
- if (enterPopover) {
13734
- return;
13735
- }
13736
- close();
13737
- });
13738
- const handlePopoverMouseenter = () => {
13746
+ }
13747
+ function handleHostMouseleave() {
13748
+ return __async$a(this, null, function* () {
13749
+ if (options.trigger !== "hover") {
13750
+ return;
13751
+ }
13752
+ enterHost = false;
13753
+ yield doubleRaf();
13754
+ if (enterPopover) {
13755
+ return;
13756
+ }
13757
+ close();
13758
+ });
13759
+ }
13760
+ function handlePopoverMouseenter() {
13739
13761
  if (options.trigger !== "hover") {
13740
13762
  return;
13741
13763
  }
13742
13764
  enterPopover = true;
13743
- };
13744
- const handlePopoverMouseleave = () => __async$a(this, null, function* () {
13745
- if (options.trigger !== "hover") {
13746
- return;
13747
- }
13748
- enterPopover = false;
13749
- yield doubleRaf();
13750
- if (enterHost) {
13765
+ }
13766
+ function handlePopoverMouseleave() {
13767
+ return __async$a(this, null, function* () {
13768
+ if (options.trigger !== "hover") {
13769
+ return;
13770
+ }
13771
+ enterPopover = false;
13772
+ yield doubleRaf();
13773
+ if (enterHost) {
13774
+ return;
13775
+ }
13776
+ close();
13777
+ });
13778
+ }
13779
+ function handleHostClick() {
13780
+ if (options.trigger !== "click") {
13751
13781
  return;
13752
13782
  }
13753
- close();
13754
- });
13755
- const handleHostClick = () => {
13756
13783
  if (options.closeOnClickReference && show.value) {
13757
13784
  close();
13758
- } else {
13759
- open();
13785
+ return;
13760
13786
  }
13761
- };
13762
- const handlePopoverClose = () => {
13787
+ open();
13788
+ }
13789
+ function handlePopoverClose() {
13763
13790
  close();
13764
- };
13765
- const handleClickOutside = (e) => {
13791
+ }
13792
+ function handleClickOutside(e) {
13766
13793
  if (options.trigger !== "click") {
13767
13794
  return;
13768
13795
  }
13769
13796
  handlePopoverClose();
13770
13797
  call(options.onClickOutside, e);
13771
- };
13772
- const handleClosed = () => {
13798
+ }
13799
+ function handleClosed() {
13773
13800
  resize();
13774
13801
  call(options.onClosed);
13775
- };
13776
- const getPosition = () => {
13802
+ }
13803
+ function getPosition() {
13777
13804
  const { offsetX, offsetY, placement } = options;
13778
13805
  computeHostSize();
13779
13806
  const offset2 = {
@@ -13862,8 +13889,8 @@ function usePopover(options) {
13862
13889
  distance: offset2.x
13863
13890
  };
13864
13891
  }
13865
- };
13866
- const getPopperOptions = () => {
13892
+ }
13893
+ function getPopperOptions() {
13867
13894
  const { placement, skidding, distance } = getPosition();
13868
13895
  const modifiers = [
13869
13896
  __spreadProps$4(__spreadValues$e({}, flip$1), {
@@ -13895,49 +13922,31 @@ function usePopover(options) {
13895
13922
  modifiers,
13896
13923
  strategy: options.strategy
13897
13924
  };
13898
- };
13899
- const getReference = () => options.reference ? host.value.querySelector(options.reference) : host.value;
13900
- const handleKeydown = (event) => {
13925
+ }
13926
+ function getReference() {
13927
+ return options.reference ? host.value.querySelector(options.reference) : host.value;
13928
+ }
13929
+ function handleKeydown(event) {
13901
13930
  const { closeOnKeyEscape = false } = options;
13902
13931
  if (event.key === "Escape" && closeOnKeyEscape && show.value) {
13903
13932
  preventDefault(event);
13904
13933
  close();
13905
13934
  }
13906
- };
13907
- const resize = () => {
13935
+ }
13936
+ function resize() {
13908
13937
  popoverInstance.setOptions(getPopperOptions());
13909
- };
13910
- const open = () => {
13938
+ }
13939
+ function open() {
13911
13940
  if (options.disabled) {
13912
13941
  return;
13913
13942
  }
13914
13943
  show.value = true;
13915
13944
  call(options["onUpdate:show"], true);
13916
- };
13917
- const close = () => {
13945
+ }
13946
+ function close() {
13918
13947
  show.value = false;
13919
13948
  call(options["onUpdate:show"], false);
13920
- };
13921
- useEventListener(() => window, "keydown", handleKeydown);
13922
- useClickOutside(getReference, "click", handleClickOutside);
13923
- onWindowResize(resize);
13924
- vue.watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
13925
- vue.watch(() => options.disabled, close);
13926
- vue.watch(
13927
- () => show.value,
13928
- (newValue) => {
13929
- if (newValue) {
13930
- resize();
13931
- }
13932
- }
13933
- );
13934
- vue.onMounted(() => {
13935
- var _a;
13936
- popoverInstance = createPopper((_a = getReference()) != null ? _a : host.value, popover.value, getPopperOptions());
13937
- });
13938
- vue.onUnmounted(() => {
13939
- popoverInstance.destroy();
13940
- });
13949
+ }
13941
13950
  return {
13942
13951
  show,
13943
13952
  popover,
@@ -29119,7 +29128,7 @@ withInstall(stdin_default$1);
29119
29128
  withPropsDefaultsSetter(stdin_default$1, props);
29120
29129
  const _WatermarkComponent = stdin_default$1;
29121
29130
  var stdin_default = stdin_default$1;
29122
- const version = "3.3.11";
29131
+ const version = "3.3.12";
29123
29132
  function install(app) {
29124
29133
  stdin_default$5G.install && app.use(stdin_default$5G);
29125
29134
  stdin_default$5E.install && app.use(stdin_default$5E);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "3.3.11",
3
+ "version": "3.3.12",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -48,9 +48,9 @@
48
48
  "@popperjs/core": "^2.11.6",
49
49
  "dayjs": "^1.10.4",
50
50
  "decimal.js": "^10.2.1",
51
- "@varlet/icons": "3.3.11",
52
- "@varlet/shared": "3.3.11",
53
- "@varlet/use": "3.3.11"
51
+ "@varlet/shared": "3.3.12",
52
+ "@varlet/icons": "3.3.12",
53
+ "@varlet/use": "3.3.12"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@vue/runtime-core": "3.4.21",
@@ -64,9 +64,9 @@
64
64
  "typescript": "^5.1.5",
65
65
  "vue": "3.4.21",
66
66
  "vue-router": "4.2.0",
67
- "@varlet/ui": "3.3.11",
68
- "@varlet/cli": "3.3.11",
69
- "@varlet/touch-emulator": "3.3.11"
67
+ "@varlet/ui": "3.3.12",
68
+ "@varlet/cli": "3.3.12",
69
+ "@varlet/touch-emulator": "3.3.12"
70
70
  },
71
71
  "scripts": {
72
72
  "dev": "varlet-cli dev",
package/types/menu.d.ts CHANGED
@@ -18,7 +18,7 @@ export type MenuPlacement =
18
18
  | 'cover-left'
19
19
  | 'cover-right'
20
20
 
21
- export type MenuTrigger = 'click' | 'hover'
21
+ export type MenuTrigger = 'click' | 'hover' | 'manual'
22
22
 
23
23
  export type MenuStrategy = PositioningStrategy
24
24
 
@@ -18,7 +18,7 @@ export type MenuSelectPlacement =
18
18
  | 'cover-left'
19
19
  | 'cover-right'
20
20
 
21
- export type MenuSelectTrigger = 'click' | 'hover'
21
+ export type MenuSelectTrigger = 'click' | 'hover' | 'manual'
22
22
 
23
23
  export type MenuSelectStrategy = PositioningStrategy
24
24
 
@@ -9,7 +9,7 @@ type TooltipNeededPopperPlacement = Exclude<PopperPlacement, 'auto' | 'auto-star
9
9
 
10
10
  export type TooltipPlacement = TooltipNeededPopperPlacement
11
11
 
12
- export type TooltipTrigger = 'click' | 'hover'
12
+ export type TooltipTrigger = 'click' | 'hover' | 'manual'
13
13
 
14
14
  export type TooltipType = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger'
15
15