sard-uniapp 1.18.0 → 1.19.1

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +6 -1
  3. package/components/button/button.vue +2 -0
  4. package/components/button/common.d.ts +1 -0
  5. package/components/button/index.scss +9 -0
  6. package/components/cascader/cascader.vue +7 -0
  7. package/components/cascader-input/cascader-input.vue +1 -1
  8. package/components/crop-image/crop-image.vue +7 -7
  9. package/components/dialog-agent/common.d.ts +3 -0
  10. package/components/dialog-agent/dialog-agent.vue +10 -1
  11. package/components/dropdown/common.d.ts +5 -0
  12. package/components/dropdown/index.d.ts +1 -1
  13. package/components/dropdown-item/dropdown-item.vue +77 -21
  14. package/components/floating-bubble/floating-bubble.vue +4 -4
  15. package/components/form/form.vue +4 -1
  16. package/components/form-item/index.scss +10 -0
  17. package/components/marquee/marquee.vue +8 -5
  18. package/components/notice-bar/notice-bar.vue +8 -5
  19. package/components/notify/notify.vue +10 -7
  20. package/components/picker-item/index.scss +0 -1
  21. package/components/pull-down-refresh/pull-down-refresh.vue +15 -9
  22. package/components/swipe-action/common.d.ts +23 -0
  23. package/components/swipe-action/common.js +1 -0
  24. package/components/swipe-action/index.d.ts +1 -0
  25. package/components/swipe-action/index.js +1 -0
  26. package/components/swipe-action/index.scss +53 -0
  27. package/components/swipe-action/swipe-action.d.ts +16 -0
  28. package/components/swipe-action/swipe-action.vue +275 -0
  29. package/components/swipe-action/variables.scss +3 -0
  30. package/components/toast/toast.vue +10 -7
  31. package/global.d.ts +1 -0
  32. package/index.d.ts +1 -0
  33. package/index.js +1 -0
  34. package/index.scss +1 -0
  35. package/package.json +2 -7
  36. package/use/index.d.ts +3 -1
  37. package/use/index.js +3 -1
  38. package/use/useScrollSpy.js +4 -4
  39. package/use/useSimulatedClick.js +4 -4
  40. package/use/useSimulatedPress.js +5 -5
  41. package/use/useStopMovedClick.d.ts +6 -0
  42. package/use/useStopMovedClick.js +26 -0
  43. package/use/useTimeout.d.ts +11 -0
  44. package/use/useTimeout.js +39 -0
  45. package/use/useTimeoutLoading.js +9 -7
  46. package/use/useSetTimeout.d.ts +0 -1
  47. package/use/useSetTimeout.js +0 -24
package/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ ## [1.19.1](https://github.com/sutras/sard-uniapp/compare/v1.19.0...v1.19.1) (2025-06-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * dropdown 新增 before-close 属性 ([fca24ac](https://github.com/sutras/sard-uniapp/commit/fca24ac536bc3840fbc9562fde4992f864968080))
7
+
8
+
9
+
10
+ # [1.19.0](https://github.com/sutras/sard-uniapp/compare/v1.18.0...v1.19.0) (2025-06-10)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * 修复 dialog 命令式回调选项参数问题 ([5af4fd8](https://github.com/sutras/sard-uniapp/commit/5af4fd81b6528501f2103b8db1b40a14f6186926))
16
+ * 修复 form fields 错乱删除问题 ([8250da9](https://github.com/sutras/sard-uniapp/commit/8250da9770152a4f6a93e873c70c01e13c91ce56))
17
+ * 修复cascader组件因值不存在时不显示列表的问题 ([4bae371](https://github.com/sutras/sard-uniapp/commit/4bae37167ccd88db3286d3bc233dfa250cfad4f9))
18
+ * 修复picker最后一列在安卓偏移问题 ([a041836](https://github.com/sutras/sard-uniapp/commit/a04183687b4291c04a0c5381dbc8fbf0b0f5afba))
19
+
20
+
21
+ ### Features
22
+
23
+ * button 新增 square 属性 ([41db4ac](https://github.com/sutras/sard-uniapp/commit/41db4acd6804f52e02cff5eeb3eaaf005dfc7f5e))
24
+ * dropdown 新增 before-close 属性 ([3407a6b](https://github.com/sutras/sard-uniapp/commit/3407a6b5a9cb4038c7d63de9bfdb81498e6afd76))
25
+ * 新增 swipe-action 组件 ([9a390c6](https://github.com/sutras/sard-uniapp/commit/9a390c61d036a016d2ee8d706130589e3ca4009c))
26
+
27
+
28
+
1
29
  # [1.18.0](https://github.com/sutras/sard-uniapp/compare/v1.17.1...v1.18.0) (2025-06-06)
2
30
 
3
31
 
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  ## 特性
27
27
 
28
- - 🧩 80+个高质量组件,覆盖移动端主流场景
28
+ - 🧩 90+个高质量组件,覆盖移动端主流场景
29
29
  - 💪 支持一套代码同时开发 H5 / 小程序 / App
30
30
  - 🌿 支持按需引入和 `Tree Shaking`
31
31
  - 📖 详尽的文档和案例展示
@@ -46,6 +46,11 @@
46
46
 
47
47
  ## 如何维护
48
48
 
49
+ ### 前提条件
50
+
51
+ - 确保 node >= 20
52
+ - 建议使用 pnpm
53
+
49
54
  ### 克隆仓库到本地
50
55
 
51
56
  ```bash
@@ -79,6 +79,7 @@ export default _defineComponent({
79
79
  theme: { type: String, required: false },
80
80
  size: { type: String, required: false },
81
81
  round: { type: Boolean, required: false },
82
+ square: { type: Boolean, required: false },
82
83
  disabled: { type: Boolean, required: false },
83
84
  loading: { type: Boolean, required: false },
84
85
  loadingType: { type: String, required: false },
@@ -162,6 +163,7 @@ export default _defineComponent({
162
163
  bem.m(props.type),
163
164
  bem.m(`${props.type}-${props.theme}`),
164
165
  bem.m("round", props.round),
166
+ bem.m("square", props.square),
165
167
  bem.m("disabled", isDisabled.value),
166
168
  bem.m("loading", props.loading),
167
169
  bem.m("block", props.icon || props.inline ? false : props.block),
@@ -6,6 +6,7 @@ export interface ButtonProps {
6
6
  theme?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger' | 'neutral';
7
7
  size?: 'mini' | 'small' | 'medium' | 'large';
8
8
  round?: boolean;
9
+ square?: boolean;
9
10
  disabled?: boolean;
10
11
  loading?: boolean;
11
12
  loadingType?: 'clock' | 'circular';
@@ -190,6 +190,15 @@
190
190
  }
191
191
  }
192
192
 
193
+ // # 方形按钮
194
+ @include m(square) {
195
+ border-radius: 0;
196
+
197
+ &::after {
198
+ border-radius: 0;
199
+ }
200
+ }
201
+
193
202
  // # active 状态
194
203
  @include m(default, pale, mild, outline, text) {
195
204
  &:not(#{bem($b: button, $m: disabled)}):not(
@@ -153,6 +153,13 @@ export default _defineComponent({
153
153
  selected: null
154
154
  });
155
155
  }
156
+ } else {
157
+ nextTabs = [
158
+ {
159
+ options: props.options || [],
160
+ selected: null
161
+ }
162
+ ];
156
163
  }
157
164
  }
158
165
  if (nextTabs) {
@@ -103,7 +103,7 @@ export default _defineComponent({
103
103
  function getOutletText(options, value, fieldKeys) {
104
104
  const selectedOptions = getSelectedOptionsByValue(options, value, fieldKeys);
105
105
  if (!selectedOptions) {
106
- return "";
106
+ return isNullish(value) ? "" : String(value);
107
107
  }
108
108
  const labels = selectedOptions.map((option) => option[fieldKeys.label]);
109
109
  return labels.join("/");
@@ -109,7 +109,7 @@ import {
109
109
  import {
110
110
  defaultCropImageProps
111
111
  } from "./common";
112
- import { useDragPinch, useSetTimeout } from "../../use";
112
+ import { useDragPinch, useTimeout } from "../../use";
113
113
  import { useTranslate } from "../locale";
114
114
  import SarPopup from "../popup/popup.vue";
115
115
  import SarIcon from "../icon/icon.vue";
@@ -186,23 +186,23 @@ export default _defineComponent({
186
186
  });
187
187
  const rotate = ref(0);
188
188
  const actualRotate = ref(0);
189
- const [onRotateEnd] = useSetTimeout(() => {
189
+ const { start: onRotateEnd } = useTimeout(() => {
190
190
  actualRotate.value = rotate.value;
191
- });
191
+ }, 150 + 100);
192
192
  watch(rotate, () => {
193
- onRotateEnd(150 + 100);
193
+ onRotateEnd();
194
194
  });
195
195
  const isRotating = computed(() => rotate.value !== actualRotate.value);
196
196
  const isStillRotating = ref(false);
197
- const [stopRotateLater, cancelStopRotate] = useSetTimeout(() => {
197
+ const { start: stopRotateLater, stop: cancelStopRotate } = useTimeout(() => {
198
198
  isStillRotating.value = false;
199
- });
199
+ }, 150);
200
200
  watch(isRotating, () => {
201
201
  cancelStopRotate();
202
202
  if (isRotating.value) {
203
203
  isStillRotating.value = true;
204
204
  } else {
205
- stopRotateLater(150);
205
+ stopRotateLater();
206
206
  }
207
207
  });
208
208
  const maskStyle = computed(() => {
@@ -1,6 +1,9 @@
1
1
  import { type DialogProps } from '../dialog/common';
2
2
  export interface DialogAgentProps extends DialogProps {
3
3
  id?: string;
4
+ onClose?: () => void;
5
+ onCancel?: () => void;
6
+ onConfirm?: () => void;
4
7
  }
5
8
  export declare const defaultDialogAgentProps: () => {
6
9
  id: string;
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <sar-dialog v-bind="innerProps" v-model:visible="innerProps.visible" />
2
+ <sar-dialog
3
+ v-bind="innerProps"
4
+ v-model:visible="innerProps.visible"
5
+ @confirm="innerProps.onConfirm"
6
+ @close="innerProps.onClose"
7
+ @cancel="innerProps.onCancel"
8
+ />
3
9
  </template>
4
10
 
5
11
  <script>
@@ -24,6 +30,9 @@ export default _defineComponent({
24
30
  __name: "dialog-agent",
25
31
  props: _mergeDefaults({
26
32
  id: { type: String, required: false },
33
+ onClose: { type: Function, required: false },
34
+ onCancel: { type: Function, required: false },
35
+ onConfirm: { type: Function, required: false },
27
36
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
28
37
  rootClass: { type: String, required: false },
29
38
  popupStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
@@ -23,6 +23,9 @@ export interface DropdownOption {
23
23
  label?: string;
24
24
  value?: any;
25
25
  }
26
+ export type DropdownCloseType = 'overlay' | 'away' | 'other-button' | 'option' | 'button';
27
+ export type DropdownBeforeClose = (type: DropdownCloseType) => any;
28
+ export type DropdownBeforeOpen = () => any;
26
29
  export interface DropdownItemProps {
27
30
  rootStyle?: StyleValue;
28
31
  rootClass?: string;
@@ -34,6 +37,8 @@ export interface DropdownItemProps {
34
37
  visible?: boolean;
35
38
  separator?: string;
36
39
  placeholder?: string;
40
+ beforeClose?: DropdownBeforeClose;
41
+ beforeOpen?: DropdownBeforeOpen;
37
42
  }
38
43
  export declare const defaultDropdownItemProps: {
39
44
  options: () => never[];
@@ -1 +1 @@
1
- export type { DropdownProps, DropdownSlots, DropdownItemProps, DropdownItemSlots, DropdownItemEmits, } from './common';
1
+ export type { DropdownProps, DropdownSlots, DropdownItemProps, DropdownItemSlots, DropdownItemEmits, DropdownCloseType, DropdownBeforeClose, } from './common';
@@ -47,17 +47,17 @@
47
47
  <slot>
48
48
  <sar-list inlaid>
49
49
  <sar-list-item
50
- v-for="(item, i) in options"
50
+ v-for="(option, i) in options"
51
51
  :key="i"
52
- :title="item.label"
52
+ :title="option.label"
53
53
  hover
54
54
  :root-class="
55
55
  classNames(
56
56
  bem.e('option'),
57
- bem.em('option', 'active', item.value === innerValue),
57
+ bem.em('option', 'active', option.value === innerValue),
58
58
  )
59
59
  "
60
- @click="onOptionClick(item)"
60
+ @click="onOptionClick(option)"
61
61
  >
62
62
  <template #arrow>
63
63
  <view :class="bem.e('option-icon')">
@@ -91,7 +91,10 @@ import {
91
91
  uniqid,
92
92
  getBoundingClientRect,
93
93
  getWindowInfo,
94
- isNullish
94
+ isNullish,
95
+ isFunction,
96
+ isObject,
97
+ noop
95
98
  } from "../../utils";
96
99
  import SarList from "../list/list.vue";
97
100
  import SarListItem from "../list-item/list-item.vue";
@@ -126,7 +129,9 @@ export default _defineComponent({
126
129
  modelValue: { type: null, required: false },
127
130
  visible: { type: Boolean, required: false },
128
131
  separator: { type: String, required: false },
129
- placeholder: { type: String, required: false }
132
+ placeholder: { type: String, required: false },
133
+ beforeClose: { type: Function, required: false },
134
+ beforeOpen: { type: Function, required: false }
130
135
  }, defaultDropdownItemProps),
131
136
  emits: ["update:model-value", "change", "update:visible", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
132
137
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -206,34 +211,73 @@ export default _defineComponent({
206
211
  emit("update:visible", visible);
207
212
  }
208
213
  };
214
+ let isClosing = false;
215
+ const perhapsClose = (type) => {
216
+ if (isClosing) {
217
+ return;
218
+ }
219
+ if (isFunction(props.beforeClose)) {
220
+ const result = props.beforeClose(type);
221
+ if (isObject(result) && isFunction(result.then)) {
222
+ isClosing = true;
223
+ return result.then(() => {
224
+ setInnerVisible(false);
225
+ }).catch(noop);
226
+ } else if (result === false) {
227
+ return;
228
+ }
229
+ }
230
+ setInnerVisible(false);
231
+ };
232
+ let isOpening = false;
233
+ const perhapsOpen = () => {
234
+ if (isOpening) {
235
+ return;
236
+ }
237
+ if (isFunction(props.beforeOpen)) {
238
+ const result = props.beforeOpen();
239
+ if (isObject(result) && isFunction(result.then)) {
240
+ isOpening = true;
241
+ return result.then(() => {
242
+ setInnerVisible(true);
243
+ }).catch(noop);
244
+ } else if (result === false) {
245
+ return;
246
+ }
247
+ }
248
+ setInnerVisible(true);
249
+ };
209
250
  const onItemClick = () => {
210
251
  if (!context.disabled && !props.disabled) {
211
- setInnerVisible(!innerVisible.value);
252
+ if (innerVisible.value) {
253
+ perhapsClose("button");
254
+ } else {
255
+ perhapsOpen();
256
+ }
212
257
  }
213
258
  };
214
- const onOptionClick = (item) => {
215
- if (item.value !== innerValue.value) {
216
- innerValue.value = item.value;
217
- emit("update:model-value", item.value);
218
- emit("change", item.value);
259
+ const onOptionClick = (option) => {
260
+ if (option.value !== innerValue.value) {
261
+ innerValue.value = option.value;
262
+ emit("update:model-value", option.value);
263
+ emit("change", option.value);
219
264
  }
220
- setInnerVisible(false);
265
+ perhapsClose("option");
221
266
  };
222
267
  const onOverlayClick = () => {
223
268
  if (context.overlayClosable) {
224
- setInnerVisible(false);
269
+ perhapsClose("overlay");
225
270
  }
226
271
  };
227
272
  const onAwayClick = () => {
228
273
  if (context.awayClosable) {
229
- setInnerVisible(false);
274
+ perhapsClose("away");
230
275
  }
231
276
  };
232
- const onAfterLeave = () => {
233
- wholeVisible.value = false;
234
- };
235
277
  const hide = () => {
236
- setInnerVisible(false);
278
+ if (innerVisible.value) {
279
+ perhapsClose("other-button");
280
+ }
237
281
  };
238
282
  onMounted(() => {
239
283
  context.register(instance, {
@@ -250,9 +294,13 @@ export default _defineComponent({
250
294
  onVisibleHook: (name) => {
251
295
  if (name === "before-enter") {
252
296
  increaseZIndex();
297
+ isOpening = false;
253
298
  }
254
299
  if (name === "after-leave") {
255
- onAfterLeave();
300
+ wholeVisible.value = false;
301
+ }
302
+ if (name === "leave-cancelled" || name === "after-leave") {
303
+ isClosing = false;
256
304
  }
257
305
  emit("visible-hook", name);
258
306
  emit(name);
@@ -298,7 +346,15 @@ export default _defineComponent({
298
346
  const dropdownItemStyle = computed(() => {
299
347
  return stringifyStyle(props.rootStyle);
300
348
  });
301
- 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() {
349
+ const __returned__ = { props, emit, bem, context, itemId, instance, innerValue, innerVisible, wholeVisible, popupVisible, popupInset, awayInset, setPosition, setInnerVisible, get isClosing() {
350
+ return isClosing;
351
+ }, set isClosing(v) {
352
+ isClosing = v;
353
+ }, perhapsClose, get isOpening() {
354
+ return isOpening;
355
+ }, set isOpening(v) {
356
+ isOpening = v;
357
+ }, perhapsOpen, onItemClick, onOptionClick, onOverlayClick, onAwayClick, hide, zIndex, increaseZIndex, realVisible, transitionClass, onTransitionEnd, popupClass, popupStyle, currentLabel, currentArrow, popupEffect, dropdownItemClass, dropdownItemStyle, get classNames() {
302
358
  return classNames;
303
359
  }, get isNullish() {
304
360
  return isNullish;
@@ -28,7 +28,7 @@ import {
28
28
  import {
29
29
  defaultFloatingBubbleProps
30
30
  } from "./common";
31
- import { useMouseDown, useSetTimeout } from "../../use";
31
+ import { useMouseDown, useTimeout } from "../../use";
32
32
  export default _defineComponent({
33
33
  ...{
34
34
  options: {
@@ -74,9 +74,9 @@ export default _defineComponent({
74
74
  }
75
75
  );
76
76
  const animated = ref(false);
77
- const [nonAnimatedLater, cancelNonAnimated] = useSetTimeout(() => {
77
+ const { start: nonAnimatedLater, stop: cancelNonAnimated } = useTimeout(() => {
78
78
  animated.value = false;
79
- });
79
+ }, 500);
80
80
  function getMinX() {
81
81
  return props.gapX;
82
82
  }
@@ -154,7 +154,7 @@ export default _defineComponent({
154
154
  }
155
155
  }
156
156
  animated.value = true;
157
- nonAnimatedLater(500);
157
+ nonAnimatedLater();
158
158
  bubbleRect = void 0;
159
159
  };
160
160
  const onMouseDown = useMouseDown(onTouchStart, onTouchMove, onTouchEnd);
@@ -116,7 +116,10 @@ export default _defineComponent({
116
116
  fields.push(formItemContext);
117
117
  };
118
118
  const removeField = (formItemContext) => {
119
- fields.splice(fields.indexOf(formItemContext), 1);
119
+ const index = fields.indexOf(formItemContext);
120
+ if (index !== -1) {
121
+ fields.splice(index, 1);
122
+ }
120
123
  };
121
124
  const validator = markRaw(new Validator());
122
125
  const { select } = useTranslate("form.defaultValidateMessages");
@@ -6,6 +6,16 @@
6
6
  flex-direction: row;
7
7
  padding: var(--sar-form-item-padding-y) var(--sar-form-item-padding-x);
8
8
 
9
+ &:first-child {
10
+ border-top-left-radius: inherit;
11
+ border-top-right-radius: inherit;
12
+ }
13
+
14
+ &:last-child {
15
+ border-bottom-left-radius: inherit;
16
+ border-bottom-right-radius: inherit;
17
+ }
18
+
9
19
  &:not(:first-child) {
10
20
  &::before {
11
21
  @include border-top(var(--sar-form-item-border-color));
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  defaultMarqueeProps
21
21
  } from "./common";
22
- import { useSetTimeout } from "../../use";
22
+ import { useTimeout } from "../../use";
23
23
  export default _defineComponent({
24
24
  ...{
25
25
  options: {
@@ -49,11 +49,14 @@ export default _defineComponent({
49
49
  const size = props.direction === "vertical" ? height : width;
50
50
  duration.value = size / props.speed * 1e3;
51
51
  };
52
- const [updateLater] = useSetTimeout(() => {
53
- update();
54
- });
52
+ const { start: updateLater } = useTimeout(
53
+ () => {
54
+ update();
55
+ },
56
+ () => props.delay
57
+ );
55
58
  onMounted(() => {
56
- updateLater(props.delay);
59
+ updateLater();
57
60
  });
58
61
  __expose({
59
62
  update
@@ -44,7 +44,7 @@ import SarIcon from "../icon/icon.vue";
44
44
  import {
45
45
  defaultNoticeBarProps
46
46
  } from "./common";
47
- import { useSetTimeout } from "../../use";
47
+ import { useTimeout } from "../../use";
48
48
  export default _defineComponent({
49
49
  components: {
50
50
  SarIcon,
@@ -120,12 +120,15 @@ export default _defineComponent({
120
120
  emit("close");
121
121
  }
122
122
  };
123
- const [updateLater] = useSetTimeout(() => {
124
- update();
125
- });
123
+ const { start: updateLater } = useTimeout(
124
+ () => {
125
+ update();
126
+ },
127
+ () => props.delay
128
+ );
126
129
  onMounted(() => {
127
130
  if (props.scrollable) {
128
- updateLater(props.delay);
131
+ updateLater();
129
132
  }
130
133
  });
131
134
  const onClick = (event) => {
@@ -16,7 +16,7 @@
16
16
  import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
17
17
  import { computed, ref, watch, nextTick } from "vue";
18
18
  import { classNames, stringifyStyle, createBem } from "../../utils";
19
- import { useSetTimeout } from "../../use";
19
+ import { useTimeout } from "../../use";
20
20
  import {
21
21
  defaultNotifyProps
22
22
  } from "./common";
@@ -59,15 +59,18 @@ export default _defineComponent({
59
59
  }[props.position];
60
60
  });
61
61
  const innerVisible = ref(props.visible);
62
- const [hideLater, cancelHide] = useSetTimeout(() => {
63
- innerVisible.value = false;
64
- emit("update:visible", false);
65
- });
62
+ const { start: hideLater, stop: cancelHide } = useTimeout(
63
+ () => {
64
+ innerVisible.value = false;
65
+ emit("update:visible", false);
66
+ },
67
+ () => props.timeout
68
+ );
66
69
  const reHideLater = () => {
67
70
  cancelHide();
68
71
  nextTick(() => {
69
72
  if (props.timeout > 0) {
70
- hideLater(props.timeout);
73
+ hideLater();
71
74
  }
72
75
  });
73
76
  };
@@ -77,7 +80,7 @@ export default _defineComponent({
77
80
  innerVisible.value = props.visible;
78
81
  if (props.visible) {
79
82
  if (props.timeout > 0) {
80
- hideLater(props.timeout);
83
+ hideLater();
81
84
  }
82
85
  }
83
86
  }
@@ -2,7 +2,6 @@
2
2
 
3
3
  @include bem(picker) {
4
4
  @include e(item) {
5
- height: var(--sar-picker-item-height);
6
5
  line-height: var(--sar-picker-item-height);
7
6
  font-size: var(--sar-picker-item-font-size);
8
7
  text-align: center;
@@ -79,7 +79,7 @@ import { classNames, stringifyStyle, createBem } from "../../utils";
79
79
  import {
80
80
  defaultPullDownRefreshProps
81
81
  } from "./common";
82
- import { useMouseDown, useSetTimeout } from "../../use";
82
+ import { useMouseDown, useTimeout } from "../../use";
83
83
  import SarLoading from "../loading/loading.vue";
84
84
  export default _defineComponent({
85
85
  components: {
@@ -113,12 +113,18 @@ export default _defineComponent({
113
113
  const progress = computed(() => {
114
114
  return Math.min(translateY.value / props.threshold, 1);
115
115
  });
116
- const [toInitialLater, cancelToInitial] = useSetTimeout(() => {
117
- status.value = "initial";
118
- });
119
- const [toRecoveringLater, cancelToRecovering] = useSetTimeout(() => {
120
- toRecovering();
121
- });
116
+ const { start: toInitialLater, stop: cancelToInitial } = useTimeout(
117
+ () => {
118
+ status.value = "initial";
119
+ },
120
+ () => props.transitionDuration
121
+ );
122
+ const { start: toRecoveringLater, stop: cancelToRecovering } = useTimeout(
123
+ () => {
124
+ toRecovering();
125
+ },
126
+ () => props.doneDuration
127
+ );
122
128
  const toLoading = () => {
123
129
  cancelToRecovering();
124
130
  cancelToInitial();
@@ -128,11 +134,11 @@ export default _defineComponent({
128
134
  const toRecovering = () => {
129
135
  status.value = "recovering";
130
136
  translateY.value = 0;
131
- toInitialLater(props.transitionDuration);
137
+ toInitialLater();
132
138
  };
133
139
  const toDone = () => {
134
140
  status.value = "done";
135
- toRecoveringLater(props.doneDuration);
141
+ toRecoveringLater();
136
142
  };
137
143
  watch(
138
144
  () => props.loading,
@@ -0,0 +1,23 @@
1
+ import { type StyleValue } from 'vue';
2
+ export type SwipeActionVisible = 'left' | 'right' | false;
3
+ export interface SwipeActionProps {
4
+ rootStyle?: StyleValue;
5
+ rootClass?: string;
6
+ disabled?: boolean;
7
+ visible?: SwipeActionVisible;
8
+ }
9
+ export interface SwipeActionSlots {
10
+ default?(props: Record<string, never>): any;
11
+ left?(props: {
12
+ hide: () => void;
13
+ }): any;
14
+ right?(props: {
15
+ hide: () => void;
16
+ }): any;
17
+ }
18
+ export interface SwipeActionEmits {
19
+ (e: 'update:visible', value: SwipeActionVisible): void;
20
+ }
21
+ export interface SwipeActionExpose {
22
+ hide: () => void;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export type { SwipeActionProps, SwipeActionSlots, SwipeActionEmits, SwipeActionExpose, SwipeActionVisible, } from './common';
@@ -0,0 +1 @@
1
+ export {};