@varlet/ui 2.13.5-alpha.1690452851997 → 2.13.5-alpha.1690486822677

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.
@@ -244,7 +244,7 @@ import './time-picker/style/index.mjs'
244
244
  import './tooltip/style/index.mjs'
245
245
  import './uploader/style/index.mjs'
246
246
 
247
- const version = '2.13.5-alpha.1690452851997'
247
+ const version = '2.13.5-alpha.1690486822677'
248
248
 
249
249
  function install(app) {
250
250
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -162,7 +162,7 @@ export * from './time-picker/index.mjs'
162
162
  export * from './tooltip/index.mjs'
163
163
  export * from './uploader/index.mjs'
164
164
 
165
- const version = '2.13.5-alpha.1690452851997'
165
+ const version = '2.13.5-alpha.1690486822677'
166
166
 
167
167
  function install(app) {
168
168
  ActionSheet.install && app.use(ActionSheet)
package/es/menu/Menu.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { createNamespace, formatElevation } from '../utils/components.mjs';
1
+ import { createNamespace, formatElevation, useTeleport } from '../utils/components.mjs';
2
2
  import { defineComponent } from 'vue';
3
3
  import { props } from './props.mjs';
4
4
  import { usePopover } from './usePopover.mjs';
@@ -22,7 +22,8 @@ function __render__(_ctx, _cache) {
22
22
  return _ctx.handleHostMouseleave && _ctx.handleHostMouseleave(...arguments);
23
23
  })
24
24
  }, [_renderSlot(_ctx.$slots, "default"), (_openBlock(), _createBlock(_Teleport, {
25
- to: _ctx.teleport
25
+ to: _ctx.teleport,
26
+ disabled: _ctx.teleportDisabled
26
27
  }, [_createVNode(_Transition, {
27
28
  name: _ctx.n(),
28
29
  onAfterEnter: _ctx.onOpened,
@@ -45,13 +46,16 @@ function __render__(_ctx, _cache) {
45
46
  })
46
47
  }, [_renderSlot(_ctx.$slots, "menu")], 38 /* CLASS, STYLE, HYDRATE_EVENTS */), [[_vShow, _ctx.show]])]),
47
48
  _: 3 /* FORWARDED */
48
- }, 8 /* PROPS */, ["name", "onAfterEnter", "onAfterLeave"])], 8 /* PROPS */, ["to"]))], 34 /* CLASS, HYDRATE_EVENTS */);
49
+ }, 8 /* PROPS */, ["name", "onAfterEnter", "onAfterLeave"])], 8 /* PROPS */, ["to", "disabled"]))], 34 /* CLASS, HYDRATE_EVENTS */);
49
50
  }
50
51
 
51
52
  var __sfc__ = defineComponent({
52
53
  name: 'VarMenu',
53
54
  props,
54
55
  setup(props) {
56
+ var {
57
+ disabled: teleportDisabled
58
+ } = useTeleport();
55
59
  var {
56
60
  popover,
57
61
  host,
@@ -78,6 +82,7 @@ var __sfc__ = defineComponent({
78
82
  hostSize,
79
83
  show,
80
84
  zIndex,
85
+ teleportDisabled,
81
86
  formatElevation,
82
87
  toSizeUnit,
83
88
  n,
package/es/menu/props.mjs CHANGED
@@ -5,6 +5,9 @@ function triggerValidator(trigger) {
5
5
  function placementValidator(alignment) {
6
6
  return ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end', 'cover-top', 'cover-top-start', 'cover-top-end', 'cover-bottom', 'cover-bottom-start', 'cover-bottom-end', 'cover-left', 'cover-right'].includes(alignment);
7
7
  }
8
+ function strategyValidator(strategy) {
9
+ return ['absolute', 'fixed'].includes(strategy);
10
+ }
8
11
  export var props = {
9
12
  show: {
10
13
  type: Boolean,
@@ -27,6 +30,11 @@ export var props = {
27
30
  default: 'cover-top-start',
28
31
  validator: placementValidator
29
32
  },
33
+ strategy: {
34
+ type: String,
35
+ default: 'absolute',
36
+ validator: strategyValidator
37
+ },
30
38
  offsetX: {
31
39
  type: [Number, String],
32
40
  default: 0
@@ -144,12 +144,17 @@ export function usePopover(options) {
144
144
  call(options.onClosed);
145
145
  };
146
146
  var getPosition = () => {
147
+ var {
148
+ offsetX,
149
+ offsetY,
150
+ placement
151
+ } = options;
147
152
  computeHostSize();
148
153
  var offset = {
149
- x: toPxNum(options.offsetX),
150
- y: toPxNum(options.offsetY)
154
+ x: toPxNum(offsetX),
155
+ y: toPxNum(offsetY)
151
156
  };
152
- switch (options.placement) {
157
+ switch (placement) {
153
158
  case 'cover-top':
154
159
  return {
155
160
  placement: 'bottom',
@@ -202,7 +207,7 @@ export function usePopover(options) {
202
207
  case 'left-start':
203
208
  case 'left-end':
204
209
  return {
205
- placement: options.placement,
210
+ placement,
206
211
  skidding: offset.y,
207
212
  distance: -offset.x
208
213
  };
@@ -210,7 +215,7 @@ export function usePopover(options) {
210
215
  case 'top-start':
211
216
  case 'top-end':
212
217
  return {
213
- placement: options.placement,
218
+ placement,
214
219
  skidding: offset.x,
215
220
  distance: -offset.y
216
221
  };
@@ -218,7 +223,7 @@ export function usePopover(options) {
218
223
  case 'bottom-start':
219
224
  case 'bottom-end':
220
225
  return {
221
- placement: options.placement,
226
+ placement,
222
227
  skidding: offset.x,
223
228
  distance: offset.y
224
229
  };
@@ -226,7 +231,7 @@ export function usePopover(options) {
226
231
  case 'right-start':
227
232
  case 'right-end':
228
233
  return {
229
- placement: options.placement,
234
+ placement,
230
235
  skidding: offset.y,
231
236
  distance: offset.x
232
237
  };
@@ -263,7 +268,8 @@ export function usePopover(options) {
263
268
  }];
264
269
  return {
265
270
  placement,
266
- modifiers
271
+ modifiers,
272
+ strategy: options.strategy
267
273
  };
268
274
  };
269
275
  var getReference = () => options.reference ? host.value.querySelector(options.reference) : host.value;
@@ -291,9 +297,7 @@ export function usePopover(options) {
291
297
  call(options['onUpdate:show'], false);
292
298
  };
293
299
  useClickOutside(getReference, 'click', handleClickOutside);
294
- watch(() => options.offsetX, resize);
295
- watch(() => options.offsetY, resize);
296
- watch(() => options.placement, resize);
300
+ watch(() => [options.offsetX, options.offsetY, options.placement, options.strategy], resize);
297
301
  watch(() => options.disabled, close);
298
302
  onMounted(() => {
299
303
  var _getReference;
@@ -1,4 +1,4 @@
1
- import { createNamespace } from '../utils/components.mjs';
1
+ import { createNamespace, useTeleport } from '../utils/components.mjs';
2
2
  import { defineComponent } from 'vue';
3
3
  import { toSizeUnit } from '../utils/elements.mjs';
4
4
  import { usePopover } from '../menu/usePopover.mjs';
@@ -22,7 +22,8 @@ function __render__(_ctx, _cache) {
22
22
  return _ctx.handleHostMouseleave && _ctx.handleHostMouseleave(...arguments);
23
23
  })
24
24
  }, [_renderSlot(_ctx.$slots, "default"), (_openBlock(), _createBlock(_Teleport, {
25
- to: _ctx.teleport
25
+ to: _ctx.teleport,
26
+ disabled: _ctx.teleportDisabled
26
27
  }, [_createVNode(_Transition, {
27
28
  name: _ctx.n(),
28
29
  onAfterEnter: _ctx.onOpened,
@@ -50,13 +51,16 @@ function __render__(_ctx, _cache) {
50
51
  class: _normalizeClass(_ctx.classes(_ctx.n('content-container'), _ctx.n("--" + _ctx.type)))
51
52
  }, [_renderSlot(_ctx.$slots, "content", {}, () => [_createTextVNode(_toDisplayString(_ctx.content), 1 /* TEXT */)])], 6 /* CLASS, STYLE */)], 38 /* CLASS, STYLE, HYDRATE_EVENTS */), [[_vShow, _ctx.show]])]),
52
53
  _: 3 /* FORWARDED */
53
- }, 8 /* PROPS */, ["name", "onAfterEnter", "onAfterLeave"])], 8 /* PROPS */, ["to"]))], 34 /* CLASS, HYDRATE_EVENTS */);
54
+ }, 8 /* PROPS */, ["name", "onAfterEnter", "onAfterLeave"])], 8 /* PROPS */, ["to", "disabled"]))], 34 /* CLASS, HYDRATE_EVENTS */);
54
55
  }
55
56
 
56
57
  var __sfc__ = defineComponent({
57
58
  name: 'VarTooltip',
58
59
  props,
59
60
  setup(props) {
61
+ var {
62
+ disabled: teleportDisabled
63
+ } = useTeleport();
60
64
  var {
61
65
  popover,
62
66
  host,
@@ -84,6 +88,7 @@ var __sfc__ = defineComponent({
84
88
  hostSize,
85
89
  show,
86
90
  zIndex,
91
+ teleportDisabled,
87
92
  n,
88
93
  classes,
89
94
  handleHostClick,
@@ -8,6 +8,9 @@ function placementValidator(alignment) {
8
8
  function typeValidator(type) {
9
9
  return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
10
10
  }
11
+ function strategyValidator(strategy) {
12
+ return ['absolute', 'fixed'].includes(strategy);
13
+ }
11
14
  export var props = {
12
15
  type: {
13
16
  type: String,
@@ -41,6 +44,11 @@ export var props = {
41
44
  default: 'bottom',
42
45
  validator: placementValidator
43
46
  },
47
+ strategy: {
48
+ type: String,
49
+ default: 'absolute',
50
+ validator: strategyValidator
51
+ },
44
52
  offsetX: {
45
53
  type: [Number, String],
46
54
  default: 0