@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.
@@ -265,7 +265,7 @@ import './tooltip/style/index.mjs'
265
265
  import './uploader/style/index.mjs'
266
266
  import './watermark/style/index.mjs'
267
267
 
268
- const version = '3.3.11'
268
+ const version = '3.3.12'
269
269
 
270
270
  function install(app) {
271
271
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -176,7 +176,7 @@ export * from './tooltip/index.mjs'
176
176
  export * from './uploader/index.mjs'
177
177
  export * from './watermark/index.mjs'
178
178
 
179
- const version = '3.3.11'
179
+ const version = '3.3.12'
180
180
 
181
181
  function install(app) {
182
182
  ActionSheet.install && app.use(ActionSheet)
@@ -67,7 +67,27 @@ function usePopover(options) {
67
67
  let popoverInstance = null;
68
68
  let enterPopover = false;
69
69
  let enterHost = false;
70
- const computeHostSize = () => {
70
+ useEventListener(() => window, "keydown", handleKeydown);
71
+ useClickOutside(getReference, "click", handleClickOutside);
72
+ onWindowResize(resize);
73
+ watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
74
+ watch(() => options.disabled, close);
75
+ watch(
76
+ () => show.value,
77
+ (newValue) => {
78
+ if (newValue) {
79
+ resize();
80
+ }
81
+ }
82
+ );
83
+ onMounted(() => {
84
+ var _a;
85
+ popoverInstance = createPopper((_a = getReference()) != null ? _a : host.value, popover.value, getPopperOptions());
86
+ });
87
+ onUnmounted(() => {
88
+ popoverInstance.destroy();
89
+ });
90
+ function computeHostSize() {
71
91
  if (!host.value) {
72
92
  return;
73
93
  }
@@ -76,8 +96,8 @@ function usePopover(options) {
76
96
  width: toPxNum(width),
77
97
  height: toPxNum(height)
78
98
  };
79
- };
80
- const getTransformOrigin = () => {
99
+ }
100
+ function getTransformOrigin() {
81
101
  switch (options.placement) {
82
102
  case "top":
83
103
  case "cover-bottom":
@@ -108,64 +128,71 @@ function usePopover(options) {
108
128
  case "cover-left":
109
129
  return "left";
110
130
  }
111
- };
112
- const handleHostMouseenter = () => {
131
+ }
132
+ function handleHostMouseenter() {
113
133
  if (options.trigger !== "hover") {
114
134
  return;
115
135
  }
116
136
  enterHost = true;
117
137
  open();
118
- };
119
- const handleHostMouseleave = () => __async(this, null, function* () {
120
- if (options.trigger !== "hover") {
121
- return;
122
- }
123
- enterHost = false;
124
- yield doubleRaf();
125
- if (enterPopover) {
126
- return;
127
- }
128
- close();
129
- });
130
- const handlePopoverMouseenter = () => {
138
+ }
139
+ function handleHostMouseleave() {
140
+ return __async(this, null, function* () {
141
+ if (options.trigger !== "hover") {
142
+ return;
143
+ }
144
+ enterHost = false;
145
+ yield doubleRaf();
146
+ if (enterPopover) {
147
+ return;
148
+ }
149
+ close();
150
+ });
151
+ }
152
+ function handlePopoverMouseenter() {
131
153
  if (options.trigger !== "hover") {
132
154
  return;
133
155
  }
134
156
  enterPopover = true;
135
- };
136
- const handlePopoverMouseleave = () => __async(this, null, function* () {
137
- if (options.trigger !== "hover") {
138
- return;
139
- }
140
- enterPopover = false;
141
- yield doubleRaf();
142
- if (enterHost) {
157
+ }
158
+ function handlePopoverMouseleave() {
159
+ return __async(this, null, function* () {
160
+ if (options.trigger !== "hover") {
161
+ return;
162
+ }
163
+ enterPopover = false;
164
+ yield doubleRaf();
165
+ if (enterHost) {
166
+ return;
167
+ }
168
+ close();
169
+ });
170
+ }
171
+ function handleHostClick() {
172
+ if (options.trigger !== "click") {
143
173
  return;
144
174
  }
145
- close();
146
- });
147
- const handleHostClick = () => {
148
175
  if (options.closeOnClickReference && show.value) {
149
176
  close();
150
- } else {
151
- open();
177
+ return;
152
178
  }
153
- };
154
- const handlePopoverClose = () => {
179
+ open();
180
+ }
181
+ function handlePopoverClose() {
155
182
  close();
156
- };
157
- const handleClickOutside = (e) => {
183
+ }
184
+ function handleClickOutside(e) {
158
185
  if (options.trigger !== "click") {
159
186
  return;
160
187
  }
161
188
  handlePopoverClose();
162
189
  call(options.onClickOutside, e);
163
- };
164
- const handleClosed = () => {
190
+ }
191
+ function handleClosed() {
165
192
  resize();
166
193
  call(options.onClosed);
167
- };
168
- const getPosition = () => {
194
+ }
195
+ function getPosition() {
169
196
  const { offsetX, offsetY, placement } = options;
170
197
  computeHostSize();
171
198
  const offset2 = {
@@ -254,8 +281,8 @@ function usePopover(options) {
254
281
  distance: offset2.x
255
282
  };
256
283
  }
257
- };
258
- const getPopperOptions = () => {
284
+ }
285
+ function getPopperOptions() {
259
286
  const { placement, skidding, distance } = getPosition();
260
287
  const modifiers = [
261
288
  __spreadProps(__spreadValues({}, flip), {
@@ -287,49 +314,31 @@ function usePopover(options) {
287
314
  modifiers,
288
315
  strategy: options.strategy
289
316
  };
290
- };
291
- const getReference = () => options.reference ? host.value.querySelector(options.reference) : host.value;
292
- const handleKeydown = (event) => {
317
+ }
318
+ function getReference() {
319
+ return options.reference ? host.value.querySelector(options.reference) : host.value;
320
+ }
321
+ function handleKeydown(event) {
293
322
  const { closeOnKeyEscape = false } = options;
294
323
  if (event.key === "Escape" && closeOnKeyEscape && show.value) {
295
324
  preventDefault(event);
296
325
  close();
297
326
  }
298
- };
299
- const resize = () => {
327
+ }
328
+ function resize() {
300
329
  popoverInstance.setOptions(getPopperOptions());
301
- };
302
- const open = () => {
330
+ }
331
+ function open() {
303
332
  if (options.disabled) {
304
333
  return;
305
334
  }
306
335
  show.value = true;
307
336
  call(options["onUpdate:show"], true);
308
- };
309
- const close = () => {
337
+ }
338
+ function close() {
310
339
  show.value = false;
311
340
  call(options["onUpdate:show"], false);
312
- };
313
- useEventListener(() => window, "keydown", handleKeydown);
314
- useClickOutside(getReference, "click", handleClickOutside);
315
- onWindowResize(resize);
316
- watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
317
- watch(() => options.disabled, close);
318
- watch(
319
- () => show.value,
320
- (newValue) => {
321
- if (newValue) {
322
- resize();
323
- }
324
- }
325
- );
326
- onMounted(() => {
327
- var _a;
328
- popoverInstance = createPopper((_a = getReference()) != null ? _a : host.value, popover.value, getPopperOptions());
329
- });
330
- onUnmounted(() => {
331
- popoverInstance.destroy();
332
- });
341
+ }
333
342
  return {
334
343
  show,
335
344
  popover,
@@ -1,7 +1,7 @@
1
1
  import '../../styles/common.css'
2
+ import '../SnackbarSfc.css'
2
3
  import '../../styles/elevation.css'
3
4
  import '../../loading/loading.css'
4
5
  import '../../icon/icon.css'
5
6
  import '../snackbar.css'
6
7
  import '../coreSfc.css'
7
- import '../SnackbarSfc.css'
package/es/varlet.esm.js CHANGED
@@ -9805,7 +9805,18 @@ function _p(e) {
9805
9805
  }), { zIndex: a } = Jt(() => r.value, 1);
9806
9806
  us(() => r.value, a);
9807
9807
  let i = null, l = !1, s = !1;
9808
- const u = () => {
9808
+ Ke(() => window, "keydown", z), Od(O, "click", $), ro(A), ce(() => [e.offsetX, e.offsetY, e.placement, e.strategy], A), ce(() => e.disabled, E), ce(
9809
+ () => r.value,
9810
+ (B) => {
9811
+ B && A();
9812
+ }
9813
+ ), Yo(() => {
9814
+ var B;
9815
+ i = Cw((B = O()) != null ? B : n.value, o.value, C());
9816
+ }), Wt(() => {
9817
+ i.destroy();
9818
+ });
9819
+ function u() {
9809
9820
  if (!n.value)
9810
9821
  return;
9811
9822
  const { width: B, height: N } = qo(n.value);
@@ -9813,7 +9824,8 @@ function _p(e) {
9813
9824
  width: nn(B),
9814
9825
  height: nn(N)
9815
9826
  };
9816
- }, c = () => {
9827
+ }
9828
+ function c() {
9817
9829
  switch (e.placement) {
9818
9830
  case "top":
9819
9831
  case "cover-bottom":
@@ -9844,23 +9856,42 @@ function _p(e) {
9844
9856
  case "cover-left":
9845
9857
  return "left";
9846
9858
  }
9847
- }, d = () => {
9859
+ }
9860
+ function d() {
9848
9861
  e.trigger === "hover" && (s = !0, T());
9849
- }, f = () => mc(this, null, function* () {
9850
- e.trigger === "hover" && (s = !1, yield $n(), !l && E());
9851
- }), v = () => {
9862
+ }
9863
+ function f() {
9864
+ return mc(this, null, function* () {
9865
+ e.trigger === "hover" && (s = !1, yield $n(), !l && E());
9866
+ });
9867
+ }
9868
+ function v() {
9852
9869
  e.trigger === "hover" && (l = !0);
9853
- }, b = () => mc(this, null, function* () {
9854
- e.trigger === "hover" && (l = !1, yield $n(), !s && E());
9855
- }), m = () => {
9856
- e.closeOnClickReference && r.value ? E() : T();
9857
- }, y = () => {
9870
+ }
9871
+ function b() {
9872
+ return mc(this, null, function* () {
9873
+ e.trigger === "hover" && (l = !1, yield $n(), !s && E());
9874
+ });
9875
+ }
9876
+ function m() {
9877
+ if (e.trigger === "click") {
9878
+ if (e.closeOnClickReference && r.value) {
9879
+ E();
9880
+ return;
9881
+ }
9882
+ T();
9883
+ }
9884
+ }
9885
+ function y() {
9858
9886
  E();
9859
- }, $ = (B) => {
9887
+ }
9888
+ function $(B) {
9860
9889
  e.trigger === "click" && (y(), P(e.onClickOutside, B));
9861
- }, w = () => {
9890
+ }
9891
+ function w() {
9862
9892
  A(), P(e.onClosed);
9863
- }, g = () => {
9893
+ }
9894
+ function g() {
9864
9895
  const { offsetX: B, offsetY: N, placement: H } = e;
9865
9896
  u();
9866
9897
  const Y = {
@@ -9949,7 +9980,8 @@ function _p(e) {
9949
9980
  distance: Y.x
9950
9981
  };
9951
9982
  }
9952
- }, C = () => {
9983
+ }
9984
+ function C() {
9953
9985
  const { placement: B, skidding: N, distance: H } = g(), Y = [
9954
9986
  Ei(Ti({}, _$), {
9955
9987
  enabled: r.value
@@ -9980,27 +10012,24 @@ function _p(e) {
9980
10012
  modifiers: Y,
9981
10013
  strategy: e.strategy
9982
10014
  };
9983
- }, O = () => e.reference ? n.value.querySelector(e.reference) : n.value, z = (B) => {
10015
+ }
10016
+ function O() {
10017
+ return e.reference ? n.value.querySelector(e.reference) : n.value;
10018
+ }
10019
+ function z(B) {
9984
10020
  const { closeOnKeyEscape: N = !1 } = e;
9985
10021
  B.key === "Escape" && N && r.value && (Fe(B), E());
9986
- }, A = () => {
10022
+ }
10023
+ function A() {
9987
10024
  i.setOptions(C());
9988
- }, T = () => {
10025
+ }
10026
+ function T() {
9989
10027
  e.disabled || (r.value = !0, P(e["onUpdate:show"], !0));
9990
- }, E = () => {
10028
+ }
10029
+ function E() {
9991
10030
  r.value = !1, P(e["onUpdate:show"], !1);
9992
- };
9993
- return Ke(() => window, "keydown", z), Od(O, "click", $), ro(A), ce(() => [e.offsetX, e.offsetY, e.placement, e.strategy], A), ce(() => e.disabled, E), ce(
9994
- () => r.value,
9995
- (B) => {
9996
- B && A();
9997
- }
9998
- ), Yo(() => {
9999
- var B;
10000
- i = Cw((B = O()) != null ? B : n.value, o.value, C());
10001
- }), Wt(() => {
10002
- i.destroy();
10003
- }), {
10031
+ }
10032
+ return {
10004
10033
  show: r,
10005
10034
  popover: o,
10006
10035
  zIndex: a,
@@ -22854,7 +22883,7 @@ oe(Ci);
22854
22883
  le(Ci, sh);
22855
22884
  const IT = Ci;
22856
22885
  var ts = Ci;
22857
- const Z8 = "3.3.11";
22886
+ const Z8 = "3.3.12";
22858
22887
  function J8(e) {
22859
22888
  Li.install && e.use(Li), Ri.install && e.use(Ri), Hi.install && e.use(Hi), Yi.install && e.use(Yi), ji.install && e.use(ji), Er.install && e.use(Er), Wi.install && e.use(Wi), Ki.install && e.use(Ki), qi.install && e.use(qi), Gi.install && e.use(Gi), Pn.install && e.use(Pn), Xi.install && e.use(Xi), Zi.install && e.use(Zi), Ji.install && e.use(Ji), lt.install && e.use(lt), Qi.install && e.use(Qi), Br.install && e.use(Br), _i.install && e.use(_i), xi.install && e.use(xi), el.install && e.use(el), nl.install && e.use(nl), Nn.install && e.use(Nn), al.install && e.use(al), dl.install && e.use(dl), pl.install && e.use(pl), vl.install && e.use(vl), ml.install && e.use(ml), Vr.install && e.use(Vr), bl.install && e.use(bl), yl.install && e.use(yl), Vt.install && e.use(Vt), kl.install && e.use(kl), $l.install && e.use($l), En.install && e.use(En), Tn.install && e.use(Tn), Ln.install && e.use(Ln), Je.install && e.use(Je), wl.install && e.use(wl), Ft.install && e.use(Ft), Cl.install && e.use(Cl), Sl.install && e.use(Sl), Rr.install && e.use(Rr), Dt.install && e.use(Dt), Pl.install && e.use(Pl), zl.install && e.use(zl), it.install && e.use(it), Ol.install && e.use(Ol), Ai.install && e.use(Ai), Tl.install && e.use(Tl), Ut.install && e.use(Ut), Ht.install && e.use(Ht), Fr.install && e.use(Fr), Ur.install && e.use(Ur), El.install && e.use(El), Bl.install && e.use(Bl), Il.install && e.use(Il), Dl.install && e.use(Dl), Po.install && e.use(Po), Ml.install && e.use(Ml), Nl.install && e.use(Nl), Hr.install && e.use(Hr), Al.install && e.use(Al), Vl.install && e.use(Vl), Ll.install && e.use(Ll), rn.install && e.use(rn), Rl.install && e.use(Rl), Fl.install && e.use(Fl), Ul.install && e.use(Ul), Hl.install && e.use(Hl), jl.install && e.use(jl), Wl.install && e.use(Wl), Kl.install && e.use(Kl), ql.install && e.use(ql), ct.install && e.use(ct), Gl.install && e.use(Gl), Lt.install && e.use(Lt), Rt.install && e.use(Rt), Xl.install && e.use(Xl), Zl.install && e.use(Zl), Jl.install && e.use(Jl), Ql.install && e.use(Ql), _l.install && e.use(_l), xl.install && e.use(xl), es.install && e.use(es), ns.install && e.use(ns), Lr.install && e.use(Lr), os.install && e.use(os), ts.install && e.use(ts);
22860
22889
  }
@@ -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": "3.3.11",
4
+ "version": "3.3.12",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -4352,7 +4352,7 @@
4352
4352
  },
4353
4353
  {
4354
4354
  "name": "trigger",
4355
- "description": "Menu trigger method, optional value is `click` `hover`, `click` is triggered when clicked, `hover` is triggered when hovered",
4355
+ "description": "Menu trigger method, optional value is `click` `hover` `manual`",
4356
4356
  "default": "click",
4357
4357
  "value": {
4358
4358
  "type": "string",
@@ -4617,7 +4617,7 @@
4617
4617
  },
4618
4618
  {
4619
4619
  "name": "trigger",
4620
- "description": "Menu trigger method, optional value is `click` `hover`, `click` is triggered when clicked, `hover` is triggered when hovered",
4620
+ "description": "Menu trigger method, optional value is `click` `hover` `manual`",
4621
4621
  "default": "click",
4622
4622
  "value": {
4623
4623
  "type": "string",
@@ -7712,7 +7712,7 @@
7712
7712
  },
7713
7713
  {
7714
7714
  "name": "trigger",
7715
- "description": "Tooltip trigger method, optional value is `click` `hover`, `click` is triggered when clicked, `hover` is triggered when hovered",
7715
+ "description": "Tooltip trigger method, optional value is `click` `hover` `manual`",
7716
7716
  "default": "hover",
7717
7717
  "value": {
7718
7718
  "type": "string",
@@ -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": "3.3.11",
4
+ "version": "3.3.12",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -4511,7 +4511,7 @@
4511
4511
  },
4512
4512
  {
4513
4513
  "name": "trigger",
4514
- "description": "菜单触发方式,可选值为 `click` `hover`, `click` 为点击时触发, `hover` 为悬停时触发",
4514
+ "description": "菜单触发方式,可选值为 `click` `hover` `manual`",
4515
4515
  "default": "click",
4516
4516
  "value": {
4517
4517
  "type": "string",
@@ -4776,7 +4776,7 @@
4776
4776
  },
4777
4777
  {
4778
4778
  "name": "trigger",
4779
- "description": "菜单触发方式,可选值为 `click` `hover`, `click` 为点击时触发, `hover` 为悬停时触发",
4779
+ "description": "菜单触发方式,可选值为 `click` `hover` `manual`",
4780
4780
  "default": "click",
4781
4781
  "value": {
4782
4782
  "type": "string",
@@ -8048,7 +8048,7 @@
8048
8048
  },
8049
8049
  {
8050
8050
  "name": "trigger",
8051
- "description": "触发方式,可选值为 `click` `hover`, `click` 为点击时触发, `hover` 为悬停时触发",
8051
+ "description": "触发方式,可选值为 `click` `hover` `manual`",
8052
8052
  "default": "hover",
8053
8053
  "value": {
8054
8054
  "type": "string",