@varlet/ui 3.5.0-alpha.1726249557629 → 3.5.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
  import { defineListenerProp } from "../utils/components.mjs";
2
2
  const props = {
3
3
  modelValue: {
4
- type: [String, Number],
4
+ type: Number,
5
5
  default: 0
6
6
  },
7
7
  min: [String, Number],
@@ -25,6 +25,7 @@ import { isEmpty, getStyle, call, doubleRaf } from "@varlet/shared";
25
25
  import { createNamespace } from "../utils/components.mjs";
26
26
  import { onWindowResize, onSmartMounted } from "@varlet/use";
27
27
  import { usePopup } from "../popup/provide.mjs";
28
+ import { useSwipeResizeDispatcher } from "../swipe/provide.mjs";
28
29
  const { name, n, classes } = createNamespace("field-decorator");
29
30
  import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, Teleport as _Teleport, createBlock as _createBlock, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
30
31
  const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
@@ -237,6 +238,7 @@ const __sfc__ = defineComponent({
237
238
  const transitionDisabled = ref(true);
238
239
  const isFloating = computed(() => props2.hint && (!isEmpty(props2.value) || props2.isFocusing));
239
240
  const { popup, bindPopup } = usePopup();
241
+ const { bindSwipeResizeDispatcher } = useSwipeResizeDispatcher();
240
242
  const color = computed(
241
243
  () => !props2.isError ? props2.isFocusing ? props2.focusColor : props2.blurColor : void 0
242
244
  );
@@ -249,6 +251,11 @@ const __sfc__ = defineComponent({
249
251
  });
250
252
  onUpdated(resize);
251
253
  call(bindPopup, null);
254
+ call(bindSwipeResizeDispatcher, {
255
+ onResize() {
256
+ nextTick().then(resize);
257
+ }
258
+ });
252
259
  if (popup) {
253
260
  watch(
254
261
  () => popup.show.value,
@@ -268,7 +268,7 @@ import './tooltip/style/index.mjs'
268
268
  import './uploader/style/index.mjs'
269
269
  import './watermark/style/index.mjs'
270
270
 
271
- const version = '3.5.0-alpha.1726249557629'
271
+ const version = '3.5.0'
272
272
 
273
273
  function install(app) {
274
274
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -178,7 +178,7 @@ export * from './tooltip/index.mjs'
178
178
  export * from './uploader/index.mjs'
179
179
  export * from './watermark/index.mjs'
180
180
 
181
- const version = '3.5.0-alpha.1726249557629'
181
+ const version = '3.5.0'
182
182
 
183
183
  function install(app) {
184
184
  ActionSheet.install && app.use(ActionSheet)
@@ -22,7 +22,7 @@ import VarButton from "../button/index.mjs";
22
22
  import VarIcon from "../icon/index.mjs";
23
23
  import Hover from "../hover/index.mjs";
24
24
  import { defineComponent, ref, computed, watch, onActivated } from "vue";
25
- import { useSwipeItems } from "./provide.mjs";
25
+ import { useSwipeItems, useSwipeResizeListeners } from "./provide.mjs";
26
26
  import { props } from "./props.mjs";
27
27
  import { clamp, isNumber, toNumber, doubleRaf, preventDefault, call } from "@varlet/shared";
28
28
  import { createNamespace } from "../utils/components.mjs";
@@ -212,6 +212,7 @@ const __sfc__ = defineComponent({
212
212
  const index = ref(0);
213
213
  const hovering = ref(false);
214
214
  const { swipeItems, bindSwipeItems, length } = useSwipeItems();
215
+ const { swipeResizeListeners, bindSwipeResizeListeners } = useSwipeResizeListeners();
215
216
  const { popup, bindPopup } = usePopup();
216
217
  const {
217
218
  deltaX,
@@ -238,6 +239,7 @@ const __sfc__ = defineComponent({
238
239
  bindSwipeItems(swipeProvider);
239
240
  useEventListener(() => window, "keydown", handleKeydown);
240
241
  call(bindPopup, null);
242
+ call(bindSwipeResizeListeners, null);
241
243
  watch(
242
244
  () => length.value,
243
245
  () => __async(this, null, function* () {
@@ -440,6 +442,9 @@ const __sfc__ = defineComponent({
440
442
  setTimeout(() => {
441
443
  lockDuration.value = false;
442
444
  });
445
+ swipeResizeListeners.forEach(({ onResize }) => {
446
+ onResize();
447
+ });
443
448
  }
444
449
  function next(options) {
445
450
  return __async(this, null, function* () {
@@ -1,5 +1,8 @@
1
- import { useChildren } from "@varlet/use";
1
+ import { useChildren, useParent } from "@varlet/use";
2
2
  const SWIPE_BIND_SWIPE_ITEM_KEY = Symbol("SWIPE_BIND_SWIPE_ITEM_KEY");
3
+ const SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY = Symbol(
4
+ "SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY"
5
+ );
3
6
  function useSwipeItems() {
4
7
  const { childProviders, length, bindChildren } = useChildren(
5
8
  SWIPE_BIND_SWIPE_ITEM_KEY
@@ -10,7 +13,28 @@ function useSwipeItems() {
10
13
  bindSwipeItems: bindChildren
11
14
  };
12
15
  }
16
+ function useSwipeResizeListeners() {
17
+ const { childProviders, bindChildren } = useChildren(
18
+ SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY
19
+ );
20
+ return {
21
+ swipeResizeListeners: childProviders,
22
+ bindSwipeResizeListeners: bindChildren
23
+ };
24
+ }
25
+ function useSwipeResizeDispatcher() {
26
+ const { parentProvider, bindParent } = useParent(
27
+ SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY
28
+ );
29
+ return {
30
+ swipeResizeDispatcher: parentProvider,
31
+ bindSwipeResizeDispatcher: bindParent
32
+ };
33
+ }
13
34
  export {
14
35
  SWIPE_BIND_SWIPE_ITEM_KEY,
15
- useSwipeItems
36
+ SWIPE_RESIZE_DISPATCHER_BIND_SWIPE_RESIZE_LISTENER_KEY,
37
+ useSwipeItems,
38
+ useSwipeResizeDispatcher,
39
+ useSwipeResizeListeners
16
40
  };