@varlet/ui 3.19.1 → 3.19.2

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.
@@ -18,7 +18,7 @@ var __async = (__this, __arguments, generator) => {
18
18
  step((generator = generator.apply(__this, __arguments)).next());
19
19
  });
20
20
  };
21
- import { call, doubleRaf, getStyle, isEmpty } from "@varlet/shared";
21
+ import { call, doubleRaf, getStyle, isEmpty, raf } from "@varlet/shared";
22
22
  import { onSmartMounted, onWindowResize, useResizeObserver } from "@varlet/use";
23
23
  import { computed, defineComponent, nextTick, onUpdated, ref, watch } from "vue";
24
24
  import VarIcon from "../icon/index.mjs";
@@ -237,11 +237,12 @@ const __sfc__ = defineComponent({
237
237
  const isFloating = computed(() => props2.hint && (!isEmpty(props2.value) || props2.isFocusing));
238
238
  const { popup, bindPopup } = usePopup();
239
239
  const { bindSwipeResizeDispatcher } = useSwipeResizeDispatcher();
240
+ let transitionVersion = 0;
240
241
  const color = computed(
241
242
  () => !props2.isError ? props2.isFocusing ? props2.focusColor : props2.blurColor : void 0
242
243
  );
243
- onWindowResize(resize);
244
- useResizeObserver(middleEl, resize);
244
+ onWindowResize(() => resize(true));
245
+ useResizeObserver(middleEl, () => resize(true));
245
246
  onSmartMounted(() => {
246
247
  resize();
247
248
  nextTick().then(() => {
@@ -252,7 +253,7 @@ const __sfc__ = defineComponent({
252
253
  call(bindPopup, null);
253
254
  call(bindSwipeResizeDispatcher, {
254
255
  onResize() {
255
- nextTick().then(resize);
256
+ nextTick().then(() => resize(true));
256
257
  }
257
258
  });
258
259
  if (popup) {
@@ -261,7 +262,7 @@ const __sfc__ = defineComponent({
261
262
  (show) => __async(null, null, function* () {
262
263
  if (show) {
263
264
  yield doubleRaf();
264
- resize();
265
+ resize(true);
265
266
  }
266
267
  })
267
268
  );
@@ -281,18 +282,32 @@ const __sfc__ = defineComponent({
281
282
  function handleClick(e) {
282
283
  call(props2.onClick, e);
283
284
  }
284
- function resize() {
285
- if (!middleEl.value) {
286
- return;
287
- }
288
- middleOffsetLeft.value = `${middleEl.value.offsetLeft}px`;
289
- middleOffsetWidth.value = `${middleEl.value.offsetWidth}px`;
290
- middleOffsetHeight.value = `${middleEl.value.offsetHeight}px`;
291
- if (props2.variant === "outlined" && placeholderTextEl.value) {
292
- const placeholderTextStyle = getStyle(placeholderTextEl.value);
293
- const placeholderSpace = `var(--field-decorator-outlined-${props2.size}-placeholder-space)`;
294
- legendWidth.value = `calc(${placeholderTextStyle.width} * 0.75 + ${placeholderSpace} * 2)`;
295
- }
285
+ function resize(disableTransition = false) {
286
+ return __async(this, null, function* () {
287
+ if (!middleEl.value) {
288
+ return;
289
+ }
290
+ if (disableTransition) {
291
+ transitionVersion++;
292
+ transitionDisabled.value = true;
293
+ }
294
+ const currentTransitionVersion = transitionVersion;
295
+ middleOffsetLeft.value = `${middleEl.value.offsetLeft}px`;
296
+ middleOffsetWidth.value = `${middleEl.value.offsetWidth}px`;
297
+ middleOffsetHeight.value = `${middleEl.value.offsetHeight}px`;
298
+ if (props2.variant === "outlined" && placeholderTextEl.value) {
299
+ const placeholderTextStyle = getStyle(placeholderTextEl.value);
300
+ const placeholderSpace = `var(--field-decorator-outlined-${props2.size}-placeholder-space)`;
301
+ legendWidth.value = `calc(${placeholderTextStyle.width} * 0.75 + ${placeholderSpace} * 2)`;
302
+ }
303
+ if (disableTransition) {
304
+ yield nextTick();
305
+ yield raf();
306
+ if (currentTransitionVersion === transitionVersion) {
307
+ transitionDisabled.value = false;
308
+ }
309
+ }
310
+ });
296
311
  }
297
312
  return {
298
313
  placeholderTextEl,
@@ -307,7 +307,7 @@ import './tree-menu/style/index.mjs'
307
307
  import './uploader/style/index.mjs'
308
308
  import './watermark/style/index.mjs'
309
309
 
310
- const version = '3.19.1'
310
+ const version = '3.19.2'
311
311
 
312
312
  function install(app) {
313
313
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -204,7 +204,7 @@ export * from './tree-menu/index.mjs'
204
204
  export * from './uploader/index.mjs'
205
205
  export * from './watermark/index.mjs'
206
206
 
207
- const version = '3.19.1'
207
+ const version = '3.19.2'
208
208
 
209
209
  function install(app) {
210
210
  ActionSheet.install && app.use(ActionSheet)
@@ -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'