sard-uniapp 1.14.2 → 1.14.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.14.3](https://github.com/sutras/sard-uniapp/compare/v1.14.2...v1.14.3) (2025-05-14)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * 修复dropdown弹出框问题 ([5eeaf2e](https://github.com/sutras/sard-uniapp/commit/5eeaf2edf2a9a02978848fbbd68fc91a00901618))
7
+
8
+
9
+
1
10
  ## [1.14.2](https://github.com/sutras/sard-uniapp/compare/v1.14.1...v1.14.2) (2025-05-14)
2
11
 
3
12
 
@@ -32,20 +32,17 @@
32
32
  @touchmove.stop.prevent
33
33
  />
34
34
  <view v-if="wholeVisible" :class="bem.e('popover')" :style="popupInset">
35
- <sar-popup
36
- :root-class="bem.e('popup')"
37
- :root-style="
38
- stringifyStyle({
39
- position: 'absolute',
40
- })
41
- "
42
- :overlay-style="stringifyStyle({ position: 'absolute' })"
43
- :overlay-class="bem.e('overlay')"
44
- :effect="popupEffect"
35
+ <sar-overlay
36
+ root-style="position: absolute"
45
37
  :visible="popupVisible"
46
38
  :duration="context.duration"
47
- @after-leave="onAfterLeave"
48
- @overlay-click="onOverlayClick"
39
+ :z-index="zIndex"
40
+ @click="onOverlayClick"
41
+ />
42
+ <view
43
+ :class="popupClass"
44
+ :style="popupStyle"
45
+ @transitionend="onTransitionEnd"
49
46
  >
50
47
  <slot>
51
48
  <sar-list inlaid>
@@ -70,7 +67,7 @@
70
67
  </sar-list-item>
71
68
  </sar-list>
72
69
  </slot>
73
- </sar-popup>
70
+ </view>
74
71
  </view>
75
72
  </template>
76
73
 
@@ -83,7 +80,9 @@ import {
83
80
  watch,
84
81
  inject,
85
82
  onMounted,
86
- onUnmounted
83
+ onUnmounted,
84
+ reactive,
85
+ toRef
87
86
  } from "vue";
88
87
  import {
89
88
  classNames,
@@ -94,20 +93,21 @@ import {
94
93
  getWindowInfo,
95
94
  isNullish
96
95
  } from "../../utils";
97
- import SarPopup from "../popup/popup.vue";
98
96
  import SarList from "../list/list.vue";
99
97
  import SarListItem from "../list-item/list-item.vue";
100
98
  import SarIcon from "../icon/icon.vue";
99
+ import SarOverlay from "../overlay/overlay.vue";
101
100
  import {
102
101
  dropdownContextSymbol,
103
102
  defaultDropdownItemProps
104
103
  } from "../dropdown/common";
104
+ import { useTransition, useZIndex } from "../../use";
105
105
  export default _defineComponent({
106
106
  components: {
107
- SarPopup,
108
107
  SarList,
109
108
  SarListItem,
110
109
  SarIcon,
110
+ SarOverlay,
111
111
  },
112
112
  ...{
113
113
  options: {
@@ -241,6 +241,36 @@ export default _defineComponent({
241
241
  visible: wholeVisible
242
242
  });
243
243
  });
244
+ const [zIndex, increaseZIndex] = useZIndex();
245
+ const { realVisible, transitionClass, onTransitionEnd } = useTransition(
246
+ reactive({
247
+ visible: toRef(() => popupVisible.value),
248
+ duration: toRef(() => context.duration),
249
+ prefix: computed(() => bem.em("popup", popupEffect.value) + "-"),
250
+ onVisibleHook: (name) => {
251
+ if (name === "before-enter") {
252
+ increaseZIndex();
253
+ }
254
+ if (name === "after-leave") {
255
+ onAfterLeave();
256
+ }
257
+ }
258
+ })
259
+ );
260
+ const popupClass = computed(() => {
261
+ return classNames(
262
+ bem.e("popup"),
263
+ bem.em("popup", popupEffect.value),
264
+ transitionClass.value
265
+ );
266
+ });
267
+ const popupStyle = computed(() => {
268
+ return stringifyStyle(props.rootStyle, {
269
+ zIndex: zIndex.value,
270
+ display: realVisible.value ? "flex" : "none",
271
+ transitionDuration: context.duration + "ms"
272
+ });
273
+ });
244
274
  onUnmounted(() => {
245
275
  context.unregister(instance);
246
276
  });
@@ -266,13 +296,11 @@ export default _defineComponent({
266
296
  const dropdownItemStyle = computed(() => {
267
297
  return stringifyStyle(props.rootStyle);
268
298
  });
269
- const __returned__ = { props, emit, bem, context, itemId, instance, innerValue, innerVisible, wholeVisible, popupVisible, popupInset, awayInset, setPosition, setInnerVisible, onItemClick, onOptionClick, onOverlayClick, onAwayClick, onAfterLeave, hide, currentLabel, currentArrow, popupEffect, dropdownItemClass, dropdownItemStyle, get classNames() {
299
+ const __returned__ = { props, emit, bem, context, itemId, instance, innerValue, innerVisible, wholeVisible, popupVisible, popupInset, awayInset, setPosition, setInnerVisible, onItemClick, onOptionClick, onOverlayClick, onAwayClick, onAfterLeave, hide, zIndex, increaseZIndex, realVisible, transitionClass, onTransitionEnd, popupClass, popupStyle, currentLabel, currentArrow, popupEffect, dropdownItemClass, dropdownItemStyle, get classNames() {
270
300
  return classNames;
271
- }, get stringifyStyle() {
272
- return stringifyStyle;
273
301
  }, get isNullish() {
274
302
  return isNullish;
275
- }, SarPopup, SarList, SarListItem, SarIcon };
303
+ }, SarList, SarListItem, SarIcon, SarOverlay };
276
304
  return __returned__;
277
305
  }
278
306
  });
@@ -45,6 +45,49 @@
45
45
  touch-action: none;
46
46
  }
47
47
 
48
+ @include e(popup) {
49
+ @include universal;
50
+ position: absolute;
51
+ width: 100%;
52
+
53
+ @include m(slide-top) {
54
+ top: 0;
55
+ left: 0;
56
+ width: 100%;
57
+ }
58
+
59
+ @include m(slide-bottom) {
60
+ left: 0;
61
+ bottom: 0;
62
+ width: 100%;
63
+ }
64
+
65
+ @include m(slide-top-enter-from, slide-top-leave-to) {
66
+ transform: translate3d(0, -100%, 0);
67
+ }
68
+
69
+ @include m(slide-bottom-enter-from, slide-bottom-leave-to) {
70
+ transform: translate3d(0, 100%, 0);
71
+ }
72
+
73
+ @include m(
74
+ slide-top-enter-to,
75
+ slide-bottom-enter-to,
76
+ slide-top-leave-from,
77
+ slide-bottom-leave-from
78
+ ) {
79
+ transform: translate3d(0, 0, 0);
80
+ }
81
+
82
+ @include m(slide-top-enter-active, slide-bottom-enter-active) {
83
+ transition: transform var(--sar-popup-duration) ease-out;
84
+ }
85
+
86
+ @include m(slide-top-leave-active, slide-bottom-leave-active) {
87
+ transition: transform var(--sar-popup-duration) ease-in;
88
+ }
89
+ }
90
+
48
91
  @include e(option) {
49
92
  @include m(active) {
50
93
  color: var(--sar-dropdown-option-active-color);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "sard-uniapp",
3
3
  "name": "sard-uniapp",
4
4
  "displayName": "sard-uniapp",
5
- "version": "1.14.2",
5
+ "version": "1.14.3",
6
6
  "description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
7
7
  "main": "index.js",
8
8
  "scripts": {