@varlet/ui 2.9.3-alpha.1679397001839 → 2.9.3-alpha.1679420700979

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,4 +1,4 @@
1
- import { defineComponent, ref, nextTick, watch, computed } from 'vue';
1
+ import { defineComponent, ref, watch, computed } from 'vue';
2
2
  import { nextTickFrame, requestAnimationFrame } from '../utils/elements.mjs';
3
3
  import { isArray } from '@varlet/shared';
4
4
  import { createNamespace } from '../utils/components.mjs';
@@ -100,7 +100,7 @@ var __sfc__ = defineComponent({
100
100
  if (!contentEl.value) return;
101
101
  contentEl.value.style.height = '';
102
102
  show.value = true;
103
- nextTick(() => {
103
+ requestAnimationFrame(() => {
104
104
  var {
105
105
  offsetHeight
106
106
  } = contentEl.value;
package/es/fab/Fab.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { mergeProps as _mergeProps, isVNode as _isVNode, withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
2
2
  import Button from '../button/index.mjs';
3
3
  import Icon from '../icon/index.mjs';
4
- import { computed, defineComponent, ref, Teleport, Transition, watch } from 'vue';
5
- import { useClickOutside } from '@varlet/use';
4
+ import { defineComponent, ref, Teleport, Transition, watch } from 'vue';
5
+ import { useClickOutside, useVModel } from '@varlet/use';
6
6
  import { call, createNamespace, flatFragment, useTeleport } from '../utils/components.mjs';
7
7
  import { toSizeUnit } from '../utils/elements.mjs';
8
8
  import { toNumber } from '@varlet/shared';
@@ -33,22 +33,13 @@ export default defineComponent({
33
33
  slots,
34
34
  attrs
35
35
  } = _ref;
36
- var localActive = ref(false);
36
+ var isActive = useVModel(props, 'active', {
37
+ emit: (event, value) => call(props['onUpdate:active'], value)
38
+ });
37
39
  var host = ref(null);
38
40
  var {
39
41
  disabled
40
42
  } = useTeleport();
41
- var isActive = computed({
42
- get() {
43
- return localActive.value;
44
- },
45
-
46
- set(value) {
47
- localActive.value = value;
48
- call(props['onUpdate:active'], value);
49
- }
50
-
51
- });
52
43
 
53
44
  var handleClick = (e, value, childrenLength) => {
54
45
  e.stopPropagation();
@@ -152,11 +143,6 @@ export default defineComponent({
152
143
  })]);
153
144
  };
154
145
 
155
- watch(() => props.active, value => {
156
- localActive.value = value;
157
- }, {
158
- immediate: true
159
- });
160
146
  watch(() => props.trigger, () => {
161
147
  isActive.value = false;
162
148
  });
@@ -241,7 +241,7 @@ import './time-picker/style/index.mjs'
241
241
  import './tooltip/style/index.mjs'
242
242
  import './uploader/style/index.mjs'
243
243
 
244
- const version = '2.9.3-alpha.1679397001839'
244
+ const version = '2.9.3-alpha.1679420700979'
245
245
 
246
246
  function install(app) {
247
247
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -160,7 +160,7 @@ export * from './time-picker/index.mjs'
160
160
  export * from './tooltip/index.mjs'
161
161
  export * from './uploader/index.mjs'
162
162
 
163
- const version = '2.9.3-alpha.1679397001839'
163
+ const version = '2.9.3-alpha.1679420700979'
164
164
 
165
165
  function install(app) {
166
166
  ActionSheet.install && app.use(ActionSheet)
@@ -6,7 +6,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
6
6
 
7
7
  import flip from '@popperjs/core/lib/modifiers/flip';
8
8
  import offset from '@popperjs/core/lib/modifiers/offset';
9
- import { useClickOutside } from '@varlet/use';
9
+ import { useClickOutside, useVModel } from '@varlet/use';
10
10
  import { doubleRaf, toPxNum } from '../utils/elements.mjs';
11
11
  import { call } from '../utils/components.mjs';
12
12
  import { onMounted, onUnmounted, ref, watch } from 'vue';
@@ -15,11 +15,24 @@ import { useZIndex } from '../context/zIndex.mjs';
15
15
  export function usePopover(options) {
16
16
  var host = ref(null);
17
17
  var popover = ref(null);
18
- var show = ref(false);
19
18
  var hostSize = ref({
20
19
  width: 0,
21
20
  height: 0
22
21
  });
22
+ var show = useVModel(options, 'show', {
23
+ passive: true,
24
+ defaultValue: false,
25
+
26
+ emit(event, value) {
27
+ if (value) {
28
+ resize();
29
+ call(options.onOpen);
30
+ } else {
31
+ call(options.onClose);
32
+ }
33
+ }
34
+
35
+ });
23
36
  var {
24
37
  zIndex
25
38
  } = useZIndex(() => show.value, 1);
@@ -261,22 +274,9 @@ export function usePopover(options) {
261
274
  };
262
275
 
263
276
  useClickOutside(host, 'click', handleClickOutside);
264
- watch(() => options.show, newValue => {
265
- show.value = newValue != null ? newValue : false;
266
- }, {
267
- immediate: true
268
- });
269
277
  watch(() => options.offsetX, resize);
270
278
  watch(() => options.offsetY, resize);
271
279
  watch(() => options.placement, resize);
272
- watch(() => show.value, newValue => {
273
- if (newValue) {
274
- resize();
275
- call(options.onOpen);
276
- } else {
277
- call(options.onClose);
278
- }
279
- });
280
280
  watch(() => options.disabled, close);
281
281
  onMounted(() => {
282
282
  var _host$value;