uniapp-dyckui 4.1.2 → 4.1.4

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 (34) hide show
  1. package/dist/assets/{style.BFlsbpSj.css → style.BEkFuBVh.css} +776 -774
  2. package/dist/{index.cjs.js → index.cjs} +841 -839
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/{index.es.js → index.mjs} +841 -839
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/src/components/MyComs/Button/index.vue.d.ts +6 -6
  7. package/dist/src/components/MyComs/Dialog/index.vue.d.ts +6 -6
  8. package/dist/src/components/MyComs/Divider/index.vue.d.ts +5 -5
  9. package/dist/src/components/MyComs/DropdownSelect/dropdownSelect.d.ts +2 -2
  10. package/dist/src/components/MyComs/DropdownSelect/index.vue.d.ts +3 -6
  11. package/dist/src/components/MyComs/DropdownWithBadge/index.vue.d.ts +3 -6
  12. package/dist/src/components/MyComs/FilterDrawer/index.vue.d.ts +3 -6
  13. package/dist/src/components/MyComs/FilterDrawer/useFilterDrawer.d.ts +1 -1
  14. package/dist/src/components/MyComs/InfiniteScroll/index.vue.d.ts +5 -5
  15. package/dist/src/components/MyComs/Popup/index.vue.d.ts +5 -5
  16. package/dist/src/components/MyComs/PullRefresh/index.vue.d.ts +5 -5
  17. package/dist/src/components/MyComs/Swiper/index.vue.d.ts +7 -7
  18. package/dist/src/components/MyComs/Toast/index.vue.d.ts +7 -7
  19. package/dist/src/components/MyComs/index.d.ts +1590 -17
  20. package/package.json +104 -97
  21. package/src/components/MyComs/Dialog/index.ts +3 -2
  22. package/src/components/MyComs/Divider/index.ts +3 -2
  23. package/src/components/MyComs/InfiniteScroll/index.ts +3 -2
  24. package/src/components/MyComs/Popup/index.ts +3 -2
  25. package/src/components/MyComs/Popup/index.vue +837 -835
  26. package/src/components/MyComs/PullRefresh/index.ts +3 -2
  27. package/src/components/MyComs/PullRefresh/index.vue +2 -1
  28. package/src/components/MyComs/Swiper/index.ts +3 -2
  29. package/src/components/MyComs/Swiper/index.vue +246 -245
  30. package/src/components/MyComs/Toast/index.ts +3 -2
  31. package/src/components/MyComs/Toast/index.vue +373 -372
  32. package/src/components/MyComs/index.ts +57 -20
  33. package/dist/index.cjs.js.map +0 -1
  34. package/dist/index.es.js.map +0 -1
@@ -1,21 +1,16 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const vue = require("vue");
4
- const _withScopeId$4 = (n) => (vue.pushScopeId("data-v-02c23a30"), n = n(), vue.popScopeId(), n);
5
4
  const _hoisted_1$a = ["disabled"];
6
5
  const _hoisted_2$9 = {
7
6
  key: 0,
8
7
  class: "sw-button__loading"
9
8
  };
10
- const _hoisted_3$9 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ vue.createElementVNode("text", { class: "loading-spinner" }, null, -1));
11
- const _hoisted_4$7 = [
12
- _hoisted_3$9
13
- ];
14
- const _hoisted_5$5 = {
9
+ const _hoisted_3$9 = {
15
10
  key: 0,
16
11
  class: "sw-button__icon"
17
12
  };
18
- const _hoisted_6$5 = {
13
+ const _hoisted_4$6 = {
19
14
  key: 2,
20
15
  class: "sw-button__text"
21
16
  };
@@ -48,31 +43,33 @@ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
48
43
  return (_ctx, _cache) => {
49
44
  return vue.openBlock(), vue.createElementBlock("view", {
50
45
  class: vue.normalizeClass(["sw-button", [
51
- `sw-button--${_ctx.type}`,
52
- `sw-button--${_ctx.size}`,
53
- `sw-button--${_ctx.shape}`,
54
- { "is-disabled": _ctx.disabled },
55
- { "is-loading": _ctx.loading },
56
- { "is-block": _ctx.block },
57
- { "is-round": _ctx.round },
58
- { "is-plain": _ctx.plain },
59
- { "is-outline": _ctx.outline },
60
- { "is-link": _ctx.link }
46
+ `sw-button--${__props.type}`,
47
+ `sw-button--${__props.size}`,
48
+ `sw-button--${__props.shape}`,
49
+ { "is-disabled": __props.disabled },
50
+ { "is-loading": __props.loading },
51
+ { "is-block": __props.block },
52
+ { "is-round": __props.round },
53
+ { "is-plain": __props.plain },
54
+ { "is-outline": __props.outline },
55
+ { "is-link": __props.link }
61
56
  ]]),
62
- disabled: _ctx.disabled || _ctx.loading,
57
+ disabled: __props.disabled || __props.loading,
63
58
  onClick: handleClick
64
59
  }, [
65
- _ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$9, _hoisted_4$7)) : vue.createCommentVNode("", true),
66
- !_ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
67
- _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_5$5, [
60
+ __props.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$9, [..._cache[0] || (_cache[0] = [
61
+ vue.createElementVNode("text", { class: "loading-spinner" }, null, -1)
62
+ ])])) : vue.createCommentVNode("", true),
63
+ !__props.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
64
+ _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_3$9, [
68
65
  vue.renderSlot(_ctx.$slots, "icon", {}, void 0, true)
69
66
  ])) : vue.createCommentVNode("", true),
70
- _ctx.icon ? (vue.openBlock(), vue.createElementBlock("text", {
67
+ __props.icon ? (vue.openBlock(), vue.createElementBlock("text", {
71
68
  key: 1,
72
- class: vue.normalizeClass(["sw-button__icon", [_ctx.icon]])
69
+ class: vue.normalizeClass(["sw-button__icon", [__props.icon]])
73
70
  }, null, 2)) : vue.createCommentVNode("", true)
74
71
  ], 64)) : vue.createCommentVNode("", true),
75
- _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_6$5, [
72
+ _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_4$6, [
76
73
  vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
77
74
  ])) : vue.createCommentVNode("", true)
78
75
  ], 10, _hoisted_1$a);
@@ -86,19 +83,17 @@ const _export_sfc = (sfc, props) => {
86
83
  }
87
84
  return target;
88
85
  };
89
- const index$7 = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-02c23a30"]]);
90
- const _withScopeId$3 = (n) => (vue.pushScopeId("data-v-a2785685"), n = n(), vue.popScopeId(), n);
86
+ const Button = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-02c23a30"]]);
91
87
  const _hoisted_1$9 = { class: "dialog-content" };
92
88
  const _hoisted_2$8 = { class: "dialog-icon" };
93
89
  const _hoisted_3$8 = ["src"];
94
- const _hoisted_4$6 = {
90
+ const _hoisted_4$5 = {
95
91
  key: 1,
96
92
  class: "default-icon"
97
93
  };
98
94
  const _hoisted_5$4 = { class: "dialog-title" };
99
95
  const _hoisted_6$4 = { class: "dialog-description" };
100
- const _hoisted_7$4 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ vue.createElementVNode("view", { class: "dialog-divider" }, null, -1));
101
- const _hoisted_8$4 = { class: "dialog-buttons" };
96
+ const _hoisted_7$2 = { class: "dialog-buttons" };
102
97
  const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
103
98
  __name: "index",
104
99
  props: {
@@ -114,7 +109,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
114
109
  emits: ["update:modelValue", "confirm", "cancel"],
115
110
  setup(__props, { emit: __emit }) {
116
111
  vue.useCssVars((_ctx) => ({
117
- "1f434a4e": _ctx.maskOpacity
112
+ "v1f434a4e": _ctx.maskOpacity
118
113
  }));
119
114
  const props = __props;
120
115
  const emit = __emit;
@@ -151,18 +146,18 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
151
146
  }, [
152
147
  vue.createElementVNode("view", _hoisted_1$9, [
153
148
  vue.createElementVNode("view", _hoisted_2$8, [
154
- _ctx.icon ? (vue.openBlock(), vue.createElementBlock("image", {
149
+ __props.icon ? (vue.openBlock(), vue.createElementBlock("image", {
155
150
  key: 0,
156
- src: _ctx.icon,
151
+ src: __props.icon,
157
152
  alt: "dialog-icon"
158
- }, null, 8, _hoisted_3$8)) : (vue.openBlock(), vue.createElementBlock("view", _hoisted_4$6))
153
+ }, null, 8, _hoisted_3$8)) : (vue.openBlock(), vue.createElementBlock("view", _hoisted_4$5))
159
154
  ]),
160
- vue.createElementVNode("text", _hoisted_5$4, vue.toDisplayString(_ctx.title), 1),
161
- vue.createElementVNode("text", _hoisted_6$4, vue.toDisplayString(_ctx.description), 1)
155
+ vue.createElementVNode("text", _hoisted_5$4, vue.toDisplayString(__props.title), 1),
156
+ vue.createElementVNode("text", _hoisted_6$4, vue.toDisplayString(__props.description), 1)
162
157
  ]),
163
- _hoisted_7$4,
164
- vue.createElementVNode("view", _hoisted_8$4, [
165
- _ctx.type === "open-app" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
158
+ _cache[1] || (_cache[1] = vue.createElementVNode("view", { class: "dialog-divider" }, null, -1)),
159
+ vue.createElementVNode("view", _hoisted_7$2, [
160
+ __props.type === "open-app" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
166
161
  vue.createElementVNode("view", {
167
162
  class: "dialog-button dialog-button-cancel",
168
163
  onClick: handleCancel
@@ -171,11 +166,11 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
171
166
  class: "dialog-button dialog-button-primary",
172
167
  onClick: handleConfirm
173
168
  }, " 打开app ")
174
- ], 64)) : _ctx.type === "confirm" ? (vue.openBlock(), vue.createElementBlock("view", {
169
+ ], 64)) : __props.type === "confirm" ? (vue.openBlock(), vue.createElementBlock("view", {
175
170
  key: 1,
176
171
  class: "dialog-button dialog-button-full dialog-button-primary",
177
172
  onClick: handleConfirm
178
- }, " 知道了 ")) : _ctx.type === "continue" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
173
+ }, " 知道了 ")) : __props.type === "continue" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
179
174
  vue.createElementVNode("view", {
180
175
  class: "dialog-button dialog-button-cancel",
181
176
  onClick: handleCancel
@@ -191,7 +186,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
191
186
  };
192
187
  }
193
188
  });
194
- const index$6 = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a2785685"]]);
189
+ const Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a2785685"]]);
195
190
  const _hoisted_1$8 = {
196
191
  key: 0,
197
192
  class: "sw-divider__text"
@@ -209,9 +204,9 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
209
204
  return (_ctx, _cache) => {
210
205
  return vue.openBlock(), vue.createElementBlock("view", {
211
206
  class: vue.normalizeClass(["sw-divider", [
212
- { "is-vertical": _ctx.vertical },
213
- { "is-dashed": _ctx.dashed },
214
- { [`sw-divider--${_ctx.position}`]: _ctx.position !== "center" }
207
+ { "is-vertical": __props.vertical },
208
+ { "is-dashed": __props.dashed },
209
+ { [`sw-divider--${__props.position}`]: __props.position !== "center" }
215
210
  ]])
216
211
  }, [
217
212
  _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_1$8, [
@@ -221,576 +216,596 @@ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
221
216
  };
222
217
  }
223
218
  });
224
- const index$5 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b668cd0b"]]);
225
- const _withScopeId$2 = (n) => (vue.pushScopeId("data-v-00bcefd1"), n = n(), vue.popScopeId(), n);
226
- const _hoisted_1$7 = {
227
- key: 0,
228
- class: "popup-header"
229
- };
230
- const _hoisted_2$7 = {
231
- key: 1,
232
- class: "popup-header"
233
- };
234
- const _hoisted_3$7 = { class: "popup-title" };
235
- const _hoisted_4$5 = { class: "popup-content" };
236
- const _hoisted_5$3 = {
237
- key: 2,
238
- class: "popup-footer"
239
- };
240
- const _hoisted_6$3 = {
241
- key: 3,
242
- class: "popup-footer"
243
- };
244
- const _hoisted_7$3 = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ vue.createElementVNode("text", { class: "close-icon" }, "×", -1));
245
- const _hoisted_8$3 = [
246
- _hoisted_7$3
247
- ];
219
+ const Divider = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-b668cd0b"]]);
220
+ function useDropdownSelect(props, emit) {
221
+ const isOpen = vue.ref(false);
222
+ const displayText = vue.computed(() => {
223
+ var _a, _b;
224
+ if (!((_a = props.options) == null ? void 0 : _a.length)) {
225
+ return "请选择";
226
+ }
227
+ if (props.modelValue !== void 0 && props.modelValue !== null) {
228
+ const matched = props.options.find(
229
+ (opt) => opt.value === props.modelValue
230
+ );
231
+ if (matched)
232
+ return matched.text;
233
+ }
234
+ return ((_b = props.options[0]) == null ? void 0 : _b.text) || "请选择";
235
+ });
236
+ const internalValue = vue.computed({
237
+ get() {
238
+ var _a, _b;
239
+ if (props.modelValue !== void 0 && props.modelValue !== null) {
240
+ return props.modelValue;
241
+ }
242
+ return ((_b = (_a = props.options) == null ? void 0 : _a[0]) == null ? void 0 : _b.value) ?? "";
243
+ },
244
+ set(val) {
245
+ emit("update:modelValue", val);
246
+ }
247
+ });
248
+ const handleChange = (value) => {
249
+ emit("change", value);
250
+ };
251
+ const handleOpen = () => {
252
+ isOpen.value = true;
253
+ };
254
+ const handleClose = () => {
255
+ isOpen.value = false;
256
+ };
257
+ return {
258
+ displayText,
259
+ internalValue,
260
+ isOpen,
261
+ handleChange,
262
+ handleOpen,
263
+ handleClose
264
+ };
265
+ }
266
+ const _hoisted_1$7 = { class: "dropdown-select" };
267
+ const _hoisted_2$7 = { class: "dropdown-title" };
268
+ const _hoisted_3$7 = { class: "dropdown-text" };
248
269
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
249
270
  __name: "index",
250
271
  props: {
251
- modelValue: { type: Boolean, default: false },
252
- title: { default: "" },
253
- position: { default: "center" },
254
- animation: { default: "slide" },
255
- mask: { type: Boolean, default: true },
256
- maskOpacity: { default: 0.5 },
257
- closeOnMaskClick: { type: Boolean, default: true },
258
- showCloseButton: { type: Boolean, default: true },
259
- closeOnEsc: { type: Boolean, default: true },
260
- showConfirmButton: { type: Boolean, default: false },
261
- confirmText: { default: "确定" },
262
- showCancelButton: { type: Boolean, default: false },
263
- cancelText: { default: "取消" },
264
- width: { default: "50%" },
265
- height: { default: "100%" },
266
- maxWidth: { default: "500px" },
267
- lockScroll: { type: Boolean, default: true }
272
+ modelValue: {},
273
+ iconName: { default: "arrow-down" },
274
+ options: {}
268
275
  },
269
- emits: ["update:modelValue", "open", "close", "maskClick", "confirm", "cancel", "closeButtonClick"],
276
+ emits: ["update:modelValue", "change"],
270
277
  setup(__props, { emit: __emit }) {
271
278
  const props = __props;
272
279
  const emit = __emit;
273
- const popupRef = vue.ref(null);
274
- const showPopup = vue.ref(props.modelValue);
275
- const isClosing = vue.ref(false);
276
- const lastScrollY = vue.ref(0);
277
- vue.watch(() => props.modelValue, (newVal) => {
278
- showPopup.value = newVal;
279
- if (newVal) {
280
- onOpen();
281
- } else {
282
- onClose();
283
- }
280
+ const { displayText, internalValue, handleChange, handleOpen, handleClose } = useDropdownSelect(props, emit);
281
+ const isOpen = vue.ref(false);
282
+ const selectedIndex = vue.computed(() => {
283
+ if (!props.options || !props.options.length)
284
+ return 0;
285
+ return props.options.findIndex((opt) => opt.value === internalValue.value);
284
286
  });
285
- vue.watch(() => showPopup.value, (newVal) => {
286
- emit("update:modelValue", newVal);
287
- if (newVal) {
288
- onOpen();
287
+ function togglePicker() {
288
+ isOpen.value = !isOpen.value;
289
+ if (isOpen.value) {
290
+ handleOpen();
289
291
  } else {
290
- onClose();
291
- }
292
- });
293
- function onOpen() {
294
- if (props.lockScroll) {
295
- lockScroll();
296
- }
297
- if (props.closeOnEsc) {
298
- window.addEventListener("keydown", handleKeyDown);
299
- }
300
- emit("open");
301
- }
302
- function onClose() {
303
- if (props.lockScroll) {
304
- unlockScroll();
305
- }
306
- window.removeEventListener("keydown", handleKeyDown);
307
- emit("close");
308
- }
309
- function lockScroll() {
310
- lastScrollY.value = window.scrollY;
311
- document.body.style.position = "fixed";
312
- document.body.style.top = `-${lastScrollY.value}px`;
313
- document.body.style.left = "0";
314
- document.body.style.right = "0";
315
- document.body.style.overflow = "hidden";
316
- uni.hideTabBar();
317
- }
318
- function unlockScroll() {
319
- document.body.style.position = "";
320
- document.body.style.top = "";
321
- document.body.style.left = "";
322
- document.body.style.right = "";
323
- document.body.style.overflow = "";
324
- window.scrollTo(0, lastScrollY.value);
325
- uni.showTabBar();
326
- }
327
- function handleKeyDown(e) {
328
- if (e.key === "Escape" && props.closeOnEsc && showPopup.value) {
329
- handleClose();
330
- }
331
- }
332
- function handleMaskClick() {
333
- if (props.closeOnMaskClick) {
334
292
  handleClose();
335
293
  }
336
- emit("maskClick");
337
- }
338
- function handleClose() {
339
- isClosing.value = true;
340
- emit("closeButtonClick");
341
- }
342
- function handleAnimationEnd() {
343
- if (isClosing.value) {
344
- isClosing.value = false;
345
- showPopup.value = false;
346
- }
347
294
  }
348
- function handleConfirm() {
349
- emit("confirm");
295
+ function onPickerChange(e) {
296
+ const index2 = e.detail.value;
297
+ const selectedOption = props.options[index2];
298
+ handleChange(selectedOption.value);
299
+ isOpen.value = false;
300
+ handleClose();
350
301
  }
351
- function handleCancel() {
352
- emit("cancel");
302
+ function onPickerCancel() {
303
+ isOpen.value = false;
353
304
  handleClose();
354
305
  }
355
- vue.onMounted(() => {
356
- if (showPopup.value) {
357
- onOpen();
358
- }
359
- });
360
- vue.onUnmounted(() => {
361
- if (showPopup.value) {
362
- onClose();
363
- }
364
- });
365
306
  return (_ctx, _cache) => {
366
- return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
367
- class: vue.normalizeClass(["popup-wrapper", {
368
- "modal": _ctx.mask,
369
- "non-modal": !_ctx.mask,
370
- "closing": isClosing.value
371
- }]),
372
- onClick: vue.withModifiers(handleMaskClick, ["self"])
373
- }, [
374
- _ctx.mask ? (vue.openBlock(), vue.createElementBlock("view", {
375
- key: 0,
376
- class: "popup-mask",
377
- style: vue.normalizeStyle({ opacity: _ctx.maskOpacity }),
378
- onClick: handleMaskClick
379
- }, null, 4)) : vue.createCommentVNode("", true),
307
+ const _component_picker = vue.resolveComponent("picker");
308
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$7, [
380
309
  vue.createElementVNode("view", {
381
- ref_key: "popupRef",
382
- ref: popupRef,
383
- class: vue.normalizeClass(["popup-container", [
384
- `position-${_ctx.position}`,
385
- `animation-${_ctx.animation}`,
386
- { closing: isClosing.value }
387
- ]]),
388
- onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
389
- }, ["stop"])),
390
- onTouchmove: _cache[1] || (_cache[1] = vue.withModifiers(() => {
391
- }, ["stop"])),
392
- onAnimationend: handleAnimationEnd
310
+ class: "dropdown-trigger",
311
+ onTap: togglePicker
393
312
  }, [
394
- _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1$7, [
395
- vue.renderSlot(_ctx.$slots, "header", {}, void 0, true)
396
- ])) : _ctx.title ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$7, [
397
- vue.createElementVNode("text", _hoisted_3$7, vue.toDisplayString(_ctx.title), 1)
398
- ])) : vue.createCommentVNode("", true),
399
- vue.createElementVNode("view", _hoisted_4$5, [
400
- vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
401
- ]),
402
- _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_5$3, [
403
- vue.renderSlot(_ctx.$slots, "footer", {}, void 0, true)
404
- ])) : _ctx.showConfirmButton || _ctx.showCancelButton ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_6$3, [
405
- _ctx.showCancelButton ? (vue.openBlock(), vue.createElementBlock("view", {
406
- key: 0,
407
- class: "popup-button popup-button-cancel",
408
- onClick: handleCancel
409
- }, vue.toDisplayString(_ctx.cancelText), 1)) : vue.createCommentVNode("", true),
410
- _ctx.showConfirmButton ? (vue.openBlock(), vue.createElementBlock("view", {
411
- key: 1,
412
- class: "popup-button popup-button-confirm",
413
- onClick: handleConfirm
414
- }, vue.toDisplayString(_ctx.confirmText), 1)) : vue.createCommentVNode("", true)
415
- ])) : vue.createCommentVNode("", true),
416
- _ctx.showCloseButton ? (vue.openBlock(), vue.createElementBlock("view", {
417
- key: 4,
418
- class: "popup-close-button",
419
- onClick: handleClose
420
- }, _hoisted_8$3)) : vue.createCommentVNode("", true)
421
- ], 34)
422
- ], 2)), [
423
- [vue.vShow, showPopup.value]
313
+ vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps({ text: vue.unref(displayText) })), () => [
314
+ vue.createElementVNode("view", _hoisted_2$7, [
315
+ vue.createElementVNode("text", _hoisted_3$7, vue.toDisplayString(vue.unref(displayText)), 1),
316
+ vue.createElementVNode("text", {
317
+ class: vue.normalizeClass(["dropdown-icon", { "is-active": isOpen.value }])
318
+ }, [
319
+ vue.renderSlot(_ctx.$slots, "icon", {}, () => [
320
+ vue.createElementVNode("view", {
321
+ class: vue.normalizeClass(["uni-icon", __props.iconName])
322
+ }, null, 2)
323
+ ])
324
+ ], 2)
325
+ ])
326
+ ])
327
+ ], 32),
328
+ isOpen.value ? (vue.openBlock(), vue.createBlock(_component_picker, {
329
+ key: 0,
330
+ mode: "selector",
331
+ range: __props.options,
332
+ "range-key": "text",
333
+ value: selectedIndex.value,
334
+ class: "dropdown-picker",
335
+ onChange: onPickerChange,
336
+ onCancel: onPickerCancel
337
+ }, null, 8, ["range", "value"])) : vue.createCommentVNode("", true)
424
338
  ]);
425
339
  };
426
340
  }
427
341
  });
428
- const index$4 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-00bcefd1"]]);
429
- const _hoisted_1$6 = {
430
- key: 0,
431
- class: "sw-toast__loading"
432
- };
433
- const _hoisted_2$6 = {
434
- key: 0,
435
- class: "sw-toast__spinner"
436
- };
437
- const _hoisted_3$6 = {
438
- key: 1,
439
- class: "sw-toast__custom-icon"
440
- };
441
- const _hoisted_4$4 = {
442
- key: 1,
443
- class: "sw-toast__icon"
444
- };
445
- const _hoisted_5$2 = {
342
+ function useDropdownWithBadge(props) {
343
+ const hasBadge = vue.computed(() => {
344
+ return props.hideBadge(props.modelValue);
345
+ });
346
+ return { hasBadge };
347
+ }
348
+ const _hoisted_1$6 = { class: "dropdown-title" };
349
+ const _hoisted_2$6 = { class: "dropdown-text" };
350
+ const _hoisted_3$6 = { class: "dropdown-icon" };
351
+ const _hoisted_4$4 = { class: "dropdown-with-badge__dot" };
352
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
353
+ __name: "index",
354
+ props: {
355
+ hideBadge: { type: Function, default: (modelValue) => modelValue === "" || modelValue === null || modelValue === void 0 }
356
+ },
357
+ emits: ["update:modelValue", "change"],
358
+ setup(__props, { emit: __emit }) {
359
+ const props = __props;
360
+ const emit = __emit;
361
+ const { hasBadge } = useDropdownWithBadge(props);
362
+ return (_ctx, _cache) => {
363
+ return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$7), vue.mergeProps({ modelValue: _ctx.modelValue, options: _ctx.options }, { class: "dropdown-with-badge" }, vue.toHandlers(emit)), {
364
+ default: vue.withCtx(({ text }) => [
365
+ vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps({ text })), () => [
366
+ vue.createElementVNode("view", _hoisted_1$6, [
367
+ vue.createElementVNode("text", _hoisted_2$6, vue.toDisplayString(text), 1),
368
+ vue.createElementVNode("text", _hoisted_3$6, [
369
+ vue.renderSlot(_ctx.$slots, "icon", {}, () => [
370
+ vue.createElementVNode("view", {
371
+ class: vue.normalizeClass(["uni-icon", _ctx.iconName])
372
+ }, null, 2)
373
+ ])
374
+ ])
375
+ ]),
376
+ vue.withDirectives(vue.createElementVNode("text", _hoisted_4$4, null, 512), [
377
+ [vue.vShow, !vue.unref(hasBadge)]
378
+ ])
379
+ ])
380
+ ]),
381
+ _: 3
382
+ }, 16);
383
+ };
384
+ }
385
+ });
386
+ function useHasBadge(model) {
387
+ if (!model) {
388
+ return vue.computed(() => false);
389
+ }
390
+ if (typeof model === "function") {
391
+ return vue.computed(() => model());
392
+ }
393
+ if (vue.isRef(model)) {
394
+ return vue.computed(() => {
395
+ if (!model.value)
396
+ return false;
397
+ const obj = model.value;
398
+ for (const key in obj) {
399
+ if (obj[key]) {
400
+ return true;
401
+ }
402
+ }
403
+ return false;
404
+ });
405
+ }
406
+ return vue.computed(() => {
407
+ for (const key in model) {
408
+ const val = model[key];
409
+ if (val) {
410
+ return true;
411
+ }
412
+ }
413
+ return false;
414
+ });
415
+ }
416
+ function useFilterDrawer(props, emit) {
417
+ const visible = vue.ref(false);
418
+ const hasBadge = useHasBadge(props.modelValue);
419
+ const openDrawer = () => {
420
+ visible.value = true;
421
+ };
422
+ const closeDrawer = () => {
423
+ visible.value = false;
424
+ };
425
+ const resetDrawer = () => {
426
+ emit("reset");
427
+ closeDrawer();
428
+ };
429
+ const queryDrawer = () => {
430
+ emit("query");
431
+ closeDrawer();
432
+ };
433
+ return {
434
+ visible,
435
+ openDrawer,
436
+ closeDrawer,
437
+ resetDrawer,
438
+ queryDrawer,
439
+ hasBadge
440
+ };
441
+ }
442
+ const _hoisted_1$5 = {
446
443
  key: 0,
447
- class: "sw-toast__icon--success"
444
+ class: "filter-drawer__badge-dot"
448
445
  };
449
- const _hoisted_6$2 = {
446
+ const _hoisted_2$5 = {
450
447
  key: 1,
451
- class: "sw-toast__icon--fail"
448
+ class: "filter-drawer__popup",
449
+ style: { height: "100vh", width: "100vw" }
452
450
  };
453
- const _hoisted_7$2 = {
454
- key: 2,
455
- class: "sw-toast__custom-icon"
451
+ const _hoisted_3$5 = { class: "filter-drawer" };
452
+ const _hoisted_4$3 = { class: "filter-drawer__header" };
453
+ const _hoisted_5$3 = { class: "filter-drawer__body" };
454
+ const _hoisted_6$3 = { class: "filter-drawer__footer" };
455
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
456
+ __name: "index",
457
+ props: {
458
+ hasBadge: { type: Boolean, default: false },
459
+ modelValue: {}
460
+ },
461
+ emits: ["reset", "query"],
462
+ setup(__props, { emit: __emit }) {
463
+ const props = __props;
464
+ const emit = __emit;
465
+ const { visible, openDrawer, closeDrawer, resetDrawer, queryDrawer, hasBadge } = useFilterDrawer(props, emit);
466
+ return (_ctx, _cache) => {
467
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
468
+ vue.createElementVNode("view", {
469
+ class: "filter-drawer__trigger",
470
+ onClick: _cache[0] || (_cache[0] = //@ts-ignore
471
+ (...args) => vue.unref(openDrawer) && vue.unref(openDrawer)(...args))
472
+ }, [
473
+ vue.renderSlot(_ctx.$slots, "trigger", {}, () => [
474
+ _cache[5] || (_cache[5] = vue.createElementVNode("view", { class: "uni-icon icon-filter-o" }, null, -1))
475
+ ]),
476
+ vue.unref(hasBadge) ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_1$5)) : vue.createCommentVNode("", true)
477
+ ]),
478
+ vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("view", {
479
+ key: 0,
480
+ class: "filter-drawer__popup-mask",
481
+ onClick: _cache[1] || (_cache[1] = //@ts-ignore
482
+ (...args) => vue.unref(closeDrawer) && vue.unref(closeDrawer)(...args))
483
+ })) : vue.createCommentVNode("", true),
484
+ vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$5, [
485
+ vue.createElementVNode("view", {
486
+ class: "filter-drawer__close",
487
+ onClick: _cache[2] || (_cache[2] = //@ts-ignore
488
+ (...args) => vue.unref(closeDrawer) && vue.unref(closeDrawer)(...args))
489
+ }, " × "),
490
+ vue.createElementVNode("view", _hoisted_3$5, [
491
+ vue.createElementVNode("view", _hoisted_4$3, [
492
+ vue.renderSlot(_ctx.$slots, "header", {}, () => [
493
+ _cache[6] || (_cache[6] = vue.createElementVNode("text", { class: "filter-drawer__title" }, "筛选", -1))
494
+ ])
495
+ ]),
496
+ vue.createElementVNode("view", _hoisted_5$3, [
497
+ vue.renderSlot(_ctx.$slots, "default")
498
+ ]),
499
+ vue.createElementVNode("view", _hoisted_6$3, [
500
+ vue.renderSlot(_ctx.$slots, "footer", {}, () => [
501
+ vue.createElementVNode("view", {
502
+ class: "filter-drawer__button filter-drawer__button--plain",
503
+ onClick: _cache[3] || (_cache[3] = //@ts-ignore
504
+ (...args) => vue.unref(resetDrawer) && vue.unref(resetDrawer)(...args))
505
+ }, " 重置条件 "),
506
+ vue.createElementVNode("view", {
507
+ class: "filter-drawer__button",
508
+ onClick: _cache[4] || (_cache[4] = //@ts-ignore
509
+ (...args) => vue.unref(queryDrawer) && vue.unref(queryDrawer)(...args))
510
+ }, " 查询 ")
511
+ ])
512
+ ])
513
+ ])
514
+ ])) : vue.createCommentVNode("", true)
515
+ ], 64);
516
+ };
517
+ }
518
+ });
519
+ const _hoisted_1$4 = { class: "sw-infinite-scroll__content" };
520
+ const _hoisted_2$4 = {
521
+ key: 0,
522
+ class: "sw-infinite-scroll__loading"
456
523
  };
457
- const _hoisted_8$2 = {
458
- key: 2,
459
- class: "sw-toast__text"
524
+ const _hoisted_3$4 = {
525
+ key: 1,
526
+ class: "sw-infinite-scroll__finished"
460
527
  };
461
- const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
528
+ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
462
529
  __name: "index",
463
530
  props: {
464
- modelValue: { type: Boolean, default: false },
465
- type: { default: "text" },
466
- position: { default: "middle" },
467
- message: { default: "" },
468
- duration: { default: 3e3 },
469
531
  loading: { type: Boolean, default: false },
470
- icon: { type: Boolean, default: true },
471
- customIcon: { default: "" },
472
- large: { type: Boolean, default: false },
473
- customStyle: { default: () => ({}) }
532
+ finished: { type: Boolean, default: false },
533
+ offset: { default: 100 },
534
+ loadingText: { default: "加载中..." },
535
+ finishedText: { default: "没有更多了" },
536
+ disabled: { type: Boolean, default: false },
537
+ height: { default: "auto" }
474
538
  },
475
- emits: ["update:modelValue", "close", "click"],
476
- setup(__props, { expose: __expose, emit: __emit }) {
539
+ emits: ["load"],
540
+ setup(__props, { emit: __emit }) {
477
541
  const props = __props;
478
542
  const emit = __emit;
479
- const toastRef = vue.ref(null);
480
- let timer = null;
481
- const showToast = vue.ref(props.modelValue);
482
- const isClosing = vue.ref(false);
483
- const showIcon = vue.computed(() => {
484
- if (props.loading)
485
- return true;
486
- if (props.type === "text")
487
- return props.icon;
488
- return true;
543
+ const scrollContainer = vue.ref(null);
544
+ const containerStyle = vue.computed(() => {
545
+ return {
546
+ height: typeof props.height === "number" ? `${props.height}px` : props.height
547
+ };
489
548
  });
490
- function onClick() {
491
- emit("click");
492
- }
493
- function close() {
494
- if (!showToast.value)
549
+ function handleScroll() {
550
+ if (!scrollContainer.value || props.loading || props.finished || props.disabled) {
495
551
  return;
496
- isClosing.value = true;
497
- emit("close");
498
- }
499
- function startTimer() {
500
- clearTimer();
501
- if (props.duration > 0 && !props.loading) {
502
- timer = setTimeout(() => {
503
- close();
504
- }, props.duration);
505
552
  }
506
- }
507
- function clearTimer() {
508
- if (timer) {
509
- clearTimeout(timer);
510
- timer = null;
553
+ const { scrollTop, scrollHeight, clientHeight } = scrollContainer.value;
554
+ if (scrollHeight - scrollTop - clientHeight <= props.offset) {
555
+ emit("load");
511
556
  }
512
557
  }
513
- function handleTransitionEnd() {
514
- if (isClosing.value) {
515
- showToast.value = false;
516
- isClosing.value = false;
517
- emit("update:modelValue", false);
558
+ let resizeTimeout = null;
559
+ function handleResize() {
560
+ if (resizeTimeout) {
561
+ clearTimeout(resizeTimeout);
518
562
  }
563
+ resizeTimeout = setTimeout(() => {
564
+ handleScroll();
565
+ }, 100);
519
566
  }
520
- vue.watch(() => props.modelValue, (newVal) => {
521
- if (newVal) {
522
- showToast.value = true;
523
- isClosing.value = false;
524
- startTimer();
525
- } else {
526
- close();
567
+ vue.onMounted(() => {
568
+ handleScroll();
569
+ window.addEventListener("resize", handleResize);
570
+ });
571
+ vue.onUnmounted(() => {
572
+ window.removeEventListener("resize", handleResize);
573
+ if (resizeTimeout) {
574
+ clearTimeout(resizeTimeout);
527
575
  }
528
576
  });
529
- vue.watch(() => props.message, () => {
530
- if (showToast.value && !props.loading) {
531
- startTimer();
532
- }
533
- });
534
- vue.onMounted(() => {
535
- if (props.modelValue) {
536
- startTimer();
537
- }
538
- });
539
- vue.onUnmounted(() => {
540
- clearTimer();
541
- });
542
- __expose({
543
- /**
544
- * 手动关闭Toast
545
- */
546
- close
547
- });
548
577
  return (_ctx, _cache) => {
549
- return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
550
- ref_key: "toastRef",
551
- ref: toastRef,
552
- class: vue.normalizeClass(["sw-toast", [
553
- `sw-toast--${_ctx.type}`,
554
- `sw-toast--${_ctx.position}`,
555
- { "sw-toast--large": _ctx.large },
556
- { "sw-toast--text": !showIcon.value && _ctx.type === "text" },
557
- { "sw-toast--show": showToast.value && !isClosing.value },
558
- { "sw-toast--hide": showToast.value && isClosing.value }
559
- ]]),
560
- style: vue.normalizeStyle(_ctx.customStyle),
561
- onClick,
562
- onTransitionend: handleTransitionEnd
578
+ return vue.openBlock(), vue.createElementBlock("view", {
579
+ ref_key: "scrollContainer",
580
+ ref: scrollContainer,
581
+ class: "sw-infinite-scroll",
582
+ style: vue.normalizeStyle(containerStyle.value),
583
+ onScroll: handleScroll
563
584
  }, [
564
- _ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1$6, [
565
- !_ctx.customIcon ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_2$6)) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_3$6, vue.toDisplayString(_ctx.customIcon), 1))
566
- ])) : showIcon.value ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_4$4, [
567
- _ctx.type === "success" ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_5$2, "✓")) : _ctx.type === "fail" ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_6$2, "✗")) : _ctx.customIcon ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_7$2, vue.toDisplayString(_ctx.customIcon), 1)) : vue.createCommentVNode("", true)
585
+ vue.createElementVNode("view", _hoisted_1$4, [
586
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
587
+ ]),
588
+ __props.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$4, [
589
+ _cache[0] || (_cache[0] = vue.createElementVNode("view", { class: "loading-spinner" }, null, -1)),
590
+ vue.createElementVNode("text", null, vue.toDisplayString(__props.loadingText), 1)
568
591
  ])) : vue.createCommentVNode("", true),
569
- _ctx.message ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_8$2, vue.toDisplayString(_ctx.message), 1)) : vue.createCommentVNode("", true)
570
- ], 38)), [
571
- [vue.vShow, showToast.value]
572
- ]);
592
+ __props.finished && !__props.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_3$4, vue.toDisplayString(__props.finishedText), 1)) : vue.createCommentVNode("", true)
593
+ ], 36);
573
594
  };
574
595
  }
575
596
  });
576
- const index$3 = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-2b648fd9"]]);
577
- const _hoisted_1$5 = { class: "sw-swiper" };
578
- const _hoisted_2$5 = {
597
+ const InfiniteScroll = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2e49050a"]]);
598
+ const _hoisted_1$3 = {
579
599
  key: 0,
580
- class: "swiper-indicators"
600
+ class: "popup-header"
581
601
  };
582
- const _hoisted_3$5 = ["onClick"];
583
- const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
602
+ const _hoisted_2$3 = {
603
+ key: 1,
604
+ class: "popup-header"
605
+ };
606
+ const _hoisted_3$3 = { class: "popup-title" };
607
+ const _hoisted_4$2 = { class: "popup-content" };
608
+ const _hoisted_5$2 = {
609
+ key: 2,
610
+ class: "popup-footer"
611
+ };
612
+ const _hoisted_6$2 = {
613
+ key: 3,
614
+ class: "popup-footer"
615
+ };
616
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
584
617
  __name: "index",
585
618
  props: {
586
- items: {},
587
- initialIndex: { default: 0 },
588
- autoPlay: { type: Boolean, default: true },
589
- interval: { default: 3e3 },
590
- duration: { default: 300 },
591
- showIndicators: { type: Boolean, default: true },
592
- showArrows: { type: Boolean, default: false },
593
- loop: { type: Boolean, default: true }
619
+ modelValue: { type: Boolean, default: false },
620
+ title: { default: "" },
621
+ position: { default: "center" },
622
+ animation: { default: "slide" },
623
+ mask: { type: Boolean, default: true },
624
+ maskOpacity: { default: 0.5 },
625
+ closeOnMaskClick: { type: Boolean, default: true },
626
+ showCloseButton: { type: Boolean, default: true },
627
+ closeOnEsc: { type: Boolean, default: true },
628
+ showConfirmButton: { type: Boolean, default: false },
629
+ confirmText: { default: "确定" },
630
+ showCancelButton: { type: Boolean, default: false },
631
+ cancelText: { default: "取消" },
632
+ width: { default: "50%" },
633
+ height: { default: "100%" },
634
+ maxWidth: { default: "500px" },
635
+ lockScroll: { type: Boolean, default: true }
594
636
  },
595
- emits: ["change", "prev", "next"],
596
- setup(__props, { expose: __expose, emit: __emit }) {
637
+ emits: ["update:modelValue", "open", "close", "maskClick", "confirm", "cancel", "closeButtonClick"],
638
+ setup(__props, { emit: __emit }) {
597
639
  const props = __props;
598
640
  const emit = __emit;
599
- const currentIndex = vue.ref(props.initialIndex);
600
- let timer = null;
601
- function startAutoPlay() {
602
- if (props.autoPlay && props.items.length > 1) {
603
- timer = setInterval(() => {
604
- next();
605
- }, props.interval);
641
+ const popupRef = vue.ref(null);
642
+ const showPopup = vue.ref(props.modelValue);
643
+ const isClosing = vue.ref(false);
644
+ const lastScrollY = vue.ref(0);
645
+ vue.watch(() => props.modelValue, (newVal) => {
646
+ showPopup.value = newVal;
647
+ if (newVal) {
648
+ onOpen();
649
+ } else {
650
+ onClose();
606
651
  }
607
- }
608
- function stopAutoPlay() {
609
- if (timer) {
610
- clearInterval(timer);
611
- timer = null;
652
+ });
653
+ vue.watch(() => showPopup.value, (newVal) => {
654
+ emit("update:modelValue", newVal);
655
+ if (newVal) {
656
+ onOpen();
657
+ } else {
658
+ onClose();
659
+ }
660
+ });
661
+ function onOpen() {
662
+ if (props.lockScroll) {
663
+ lockScroll();
664
+ }
665
+ if (props.closeOnEsc) {
666
+ window.addEventListener("keydown", handleKeyDown);
612
667
  }
668
+ emit("open");
613
669
  }
614
- function prev() {
615
- if (props.loop) {
616
- currentIndex.value = currentIndex.value === 0 ? props.items.length - 1 : currentIndex.value - 1;
617
- } else if (currentIndex.value > 0) {
618
- currentIndex.value--;
670
+ function onClose() {
671
+ if (props.lockScroll) {
672
+ unlockScroll();
619
673
  }
620
- emit("prev", currentIndex.value);
621
- emit("change", currentIndex.value);
674
+ window.removeEventListener("keydown", handleKeyDown);
675
+ emit("close");
622
676
  }
623
- function next() {
624
- if (props.loop) {
625
- currentIndex.value = currentIndex.value === props.items.length - 1 ? 0 : currentIndex.value + 1;
626
- } else if (currentIndex.value < props.items.length - 1) {
627
- currentIndex.value++;
677
+ function lockScroll() {
678
+ lastScrollY.value = window.scrollY;
679
+ document.body.style.position = "fixed";
680
+ document.body.style.top = `-${lastScrollY.value}px`;
681
+ document.body.style.left = "0";
682
+ document.body.style.right = "0";
683
+ document.body.style.overflow = "hidden";
684
+ uni.hideTabBar();
685
+ }
686
+ function unlockScroll() {
687
+ document.body.style.position = "";
688
+ document.body.style.top = "";
689
+ document.body.style.left = "";
690
+ document.body.style.right = "";
691
+ document.body.style.overflow = "";
692
+ window.scrollTo(0, lastScrollY.value);
693
+ uni.showTabBar();
694
+ }
695
+ function handleKeyDown(e) {
696
+ if (e.key === "Escape" && props.closeOnEsc && showPopup.value) {
697
+ handleClose();
628
698
  }
629
- emit("next", currentIndex.value);
630
- emit("change", currentIndex.value);
631
699
  }
632
- vue.watch(() => props.items, (newItems) => {
633
- if (newItems.length < currentIndex.value + 1) {
634
- currentIndex.value = Math.min(currentIndex.value, newItems.length - 1);
700
+ function handleMaskClick() {
701
+ if (props.closeOnMaskClick) {
702
+ handleClose();
635
703
  }
636
- stopAutoPlay();
637
- startAutoPlay();
638
- }, { deep: true });
639
- vue.watch(() => props.autoPlay, (autoPlay) => {
640
- if (autoPlay) {
641
- startAutoPlay();
642
- } else {
643
- stopAutoPlay();
704
+ emit("maskClick");
705
+ }
706
+ function handleClose() {
707
+ isClosing.value = true;
708
+ emit("closeButtonClick");
709
+ }
710
+ function handleAnimationEnd() {
711
+ if (isClosing.value) {
712
+ isClosing.value = false;
713
+ showPopup.value = false;
644
714
  }
645
- });
715
+ }
716
+ function handleConfirm() {
717
+ emit("confirm");
718
+ }
719
+ function handleCancel() {
720
+ emit("cancel");
721
+ handleClose();
722
+ }
646
723
  vue.onMounted(() => {
647
- startAutoPlay();
724
+ if (showPopup.value) {
725
+ onOpen();
726
+ }
648
727
  });
649
728
  vue.onUnmounted(() => {
650
- stopAutoPlay();
651
- });
652
- __expose({
653
- prev,
654
- next,
655
- currentIndex
729
+ if (showPopup.value) {
730
+ onClose();
731
+ }
656
732
  });
657
733
  return (_ctx, _cache) => {
658
- return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$5, [
734
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
735
+ class: vue.normalizeClass(["popup-wrapper", {
736
+ "modal": __props.mask,
737
+ "non-modal": !__props.mask,
738
+ "closing": isClosing.value
739
+ }]),
740
+ onClick: vue.withModifiers(handleMaskClick, ["self"])
741
+ }, [
742
+ __props.mask ? (vue.openBlock(), vue.createElementBlock("view", {
743
+ key: 0,
744
+ class: "popup-mask",
745
+ style: vue.normalizeStyle({ opacity: __props.maskOpacity }),
746
+ onClick: handleMaskClick
747
+ }, null, 4)) : vue.createCommentVNode("", true),
659
748
  vue.createElementVNode("view", {
660
- class: "swiper-wrapper",
661
- style: vue.normalizeStyle({
662
- transform: `translateX(-${currentIndex.value * 100}%)`,
663
- transition: `transform ${_ctx.duration}ms ease`
664
- })
749
+ ref_key: "popupRef",
750
+ ref: popupRef,
751
+ class: vue.normalizeClass(["popup-container", [
752
+ `position-${__props.position}`,
753
+ `animation-${__props.animation}`,
754
+ { closing: isClosing.value }
755
+ ]]),
756
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
757
+ }, ["stop"])),
758
+ onTouchmove: _cache[1] || (_cache[1] = vue.withModifiers(() => {
759
+ }, ["stop"])),
760
+ onAnimationend: handleAnimationEnd
665
761
  }, [
666
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.items, (item, index2) => {
667
- return vue.openBlock(), vue.createElementBlock("view", {
668
- key: index2,
669
- class: "swiper-item"
670
- }, [
671
- vue.renderSlot(_ctx.$slots, "default", {
672
- item,
673
- index: index2
674
- }, void 0, true)
675
- ]);
676
- }), 128))
677
- ], 4),
678
- _ctx.showIndicators ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$5, [
679
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.items, (item, index2) => {
680
- return vue.openBlock(), vue.createElementBlock("view", {
681
- key: index2,
682
- class: vue.normalizeClass(["indicator-item", { active: index2 === currentIndex.value }]),
683
- onClick: ($event) => currentIndex.value = index2
684
- }, null, 10, _hoisted_3$5);
685
- }), 128))
686
- ])) : vue.createCommentVNode("", true),
687
- _ctx.showArrows ? (vue.openBlock(), vue.createElementBlock("view", {
688
- key: 1,
689
- class: "swiper-arrow swiper-arrow-left",
690
- onClick: prev
691
- })) : vue.createCommentVNode("", true),
692
- _ctx.showArrows ? (vue.openBlock(), vue.createElementBlock("view", {
693
- key: 2,
694
- class: "swiper-arrow swiper-arrow-right",
695
- onClick: next
696
- })) : vue.createCommentVNode("", true)
762
+ _ctx.$slots.header ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1$3, [
763
+ vue.renderSlot(_ctx.$slots, "header", {}, void 0, true)
764
+ ])) : __props.title ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$3, [
765
+ vue.createElementVNode("text", _hoisted_3$3, vue.toDisplayString(__props.title), 1)
766
+ ])) : vue.createCommentVNode("", true),
767
+ vue.createElementVNode("view", _hoisted_4$2, [
768
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
769
+ ]),
770
+ _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_5$2, [
771
+ vue.renderSlot(_ctx.$slots, "footer", {}, void 0, true)
772
+ ])) : __props.showConfirmButton || __props.showCancelButton ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_6$2, [
773
+ __props.showCancelButton ? (vue.openBlock(), vue.createElementBlock("view", {
774
+ key: 0,
775
+ class: "popup-button popup-button-cancel",
776
+ onClick: handleCancel
777
+ }, vue.toDisplayString(__props.cancelText), 1)) : vue.createCommentVNode("", true),
778
+ __props.showConfirmButton ? (vue.openBlock(), vue.createElementBlock("view", {
779
+ key: 1,
780
+ class: "popup-button popup-button-confirm",
781
+ onClick: handleConfirm
782
+ }, vue.toDisplayString(__props.confirmText), 1)) : vue.createCommentVNode("", true)
783
+ ])) : vue.createCommentVNode("", true),
784
+ __props.showCloseButton ? (vue.openBlock(), vue.createElementBlock("view", {
785
+ key: 4,
786
+ class: "popup-close-button",
787
+ onClick: handleClose
788
+ }, [..._cache[2] || (_cache[2] = [
789
+ vue.createElementVNode("text", { class: "close-icon" }, "×", -1)
790
+ ])])) : vue.createCommentVNode("", true)
791
+ ], 34)
792
+ ], 2)), [
793
+ [vue.vShow, showPopup.value]
697
794
  ]);
698
795
  };
699
796
  }
700
797
  });
701
- const index$2 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-3735cbbd"]]);
702
- const _withScopeId$1 = (n) => (vue.pushScopeId("data-v-2e49050a"), n = n(), vue.popScopeId(), n);
703
- const _hoisted_1$4 = { class: "sw-infinite-scroll__content" };
704
- const _hoisted_2$4 = {
705
- key: 0,
706
- class: "sw-infinite-scroll__loading"
707
- };
708
- const _hoisted_3$4 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ vue.createElementVNode("view", { class: "loading-spinner" }, null, -1));
709
- const _hoisted_4$3 = {
710
- key: 1,
711
- class: "sw-infinite-scroll__finished"
712
- };
713
- const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
714
- __name: "index",
715
- props: {
716
- loading: { type: Boolean, default: false },
717
- finished: { type: Boolean, default: false },
718
- offset: { default: 100 },
719
- loadingText: { default: "加载中..." },
720
- finishedText: { default: "没有更多了" },
721
- disabled: { type: Boolean, default: false },
722
- height: { default: "auto" }
723
- },
724
- emits: ["load"],
725
- setup(__props, { emit: __emit }) {
726
- const props = __props;
727
- const emit = __emit;
728
- const scrollContainer = vue.ref(null);
729
- const containerStyle = vue.computed(() => {
730
- return {
731
- height: typeof props.height === "number" ? `${props.height}px` : props.height
732
- };
733
- });
734
- function handleScroll() {
735
- if (!scrollContainer.value || props.loading || props.finished || props.disabled) {
736
- return;
737
- }
738
- const { scrollTop, scrollHeight, clientHeight } = scrollContainer.value;
739
- if (scrollHeight - scrollTop - clientHeight <= props.offset) {
740
- emit("load");
741
- }
742
- }
743
- let resizeTimeout = null;
744
- function handleResize() {
745
- if (resizeTimeout) {
746
- clearTimeout(resizeTimeout);
747
- }
748
- resizeTimeout = setTimeout(() => {
749
- handleScroll();
750
- }, 100);
751
- }
752
- vue.onMounted(() => {
753
- handleScroll();
754
- window.addEventListener("resize", handleResize);
755
- });
756
- vue.onUnmounted(() => {
757
- window.removeEventListener("resize", handleResize);
758
- if (resizeTimeout) {
759
- clearTimeout(resizeTimeout);
760
- }
761
- });
762
- return (_ctx, _cache) => {
763
- return vue.openBlock(), vue.createElementBlock("view", {
764
- ref_key: "scrollContainer",
765
- ref: scrollContainer,
766
- class: "sw-infinite-scroll",
767
- style: vue.normalizeStyle(containerStyle.value),
768
- onScroll: handleScroll
769
- }, [
770
- vue.createElementVNode("view", _hoisted_1$4, [
771
- vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
772
- ]),
773
- _ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$4, [
774
- _hoisted_3$4,
775
- vue.createElementVNode("text", null, vue.toDisplayString(_ctx.loadingText), 1)
776
- ])) : vue.createCommentVNode("", true),
777
- _ctx.finished && !_ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_4$3, vue.toDisplayString(_ctx.finishedText), 1)) : vue.createCommentVNode("", true)
778
- ], 36);
779
- };
780
- }
781
- });
782
- const index$1 = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-2e49050a"]]);
783
- const _withScopeId = (n) => (vue.pushScopeId("data-v-d2876eca"), n = n(), vue.popScopeId(), n);
784
- const _hoisted_1$3 = {
798
+ const Popup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-a8084c82"]]);
799
+ const _hoisted_1$2 = {
785
800
  key: 0,
786
801
  class: "refresh-content"
787
802
  };
788
- const _hoisted_2$3 = { class: "refresh-icon" };
789
- const _hoisted_3$3 = {
803
+ const _hoisted_2$2 = { class: "refresh-icon" };
804
+ const _hoisted_3$2 = {
790
805
  key: 0,
791
806
  class: "refresh-loading"
792
807
  };
793
- const _hoisted_4$2 = {
808
+ const _hoisted_4$1 = {
794
809
  key: 1,
795
810
  class: "refresh-arrow"
796
811
  };
@@ -801,27 +816,23 @@ const _hoisted_8$1 = {
801
816
  key: 0,
802
817
  class: "infinite-scroll-loading"
803
818
  };
804
- const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("view", { class: "loading-spinner" }, [
805
- /* @__PURE__ */ vue.createElementVNode("text", { class: "loading-icon" }, "●")
806
- ], -1));
807
- const _hoisted_10 = { class: "loading-text" };
808
- const _hoisted_11 = {
819
+ const _hoisted_9 = { class: "loading-text" };
820
+ const _hoisted_10 = {
809
821
  key: 1,
810
822
  class: "infinite-scroll-error"
811
823
  };
812
- const _hoisted_12 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode("text", { class: "error-icon" }, "×", -1));
813
- const _hoisted_13 = { class: "error-text" };
814
- const _hoisted_14 = {
824
+ const _hoisted_11 = { class: "error-text" };
825
+ const _hoisted_12 = {
815
826
  key: 2,
816
827
  class: "infinite-scroll-no-more"
817
828
  };
818
- const _hoisted_15 = { class: "no-more-text" };
819
- const _hoisted_16 = {
829
+ const _hoisted_13 = { class: "no-more-text" };
830
+ const _hoisted_14 = {
820
831
  key: 3,
821
832
  class: "infinite-scroll-trigger",
822
833
  style: { height: `0px` }
823
834
  };
824
- const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
835
+ const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
825
836
  __name: "index",
826
837
  props: {
827
838
  loading: { type: Boolean, default: false },
@@ -1024,9 +1035,9 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1024
1035
  class: "refresh-indicator",
1025
1036
  style: vue.normalizeStyle({ height: `${pullDistance.value}px` })
1026
1037
  }, [
1027
- refreshStatus.value !== "normal" && (refreshStatus.value === "refreshing" || pullDistance.value > 0) ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1$3, [
1028
- vue.createElementVNode("view", _hoisted_2$3, [
1029
- props.refreshLoading ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_3$3, "●")) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_4$2, "↓"))
1038
+ refreshStatus.value !== "normal" && (refreshStatus.value === "refreshing" || pullDistance.value > 0) ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1$2, [
1039
+ vue.createElementVNode("view", _hoisted_2$2, [
1040
+ props.refreshLoading ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_3$2, "●")) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_4$1, "↓"))
1030
1041
  ]),
1031
1042
  vue.createElementVNode("text", _hoisted_5$1, [
1032
1043
  props.refreshLoading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
@@ -1043,338 +1054,329 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
1043
1054
  vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
1044
1055
  ]),
1045
1056
  vue.createElementVNode("view", _hoisted_7$1, [
1046
- _ctx.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_8$1, [
1047
- _hoisted_9,
1048
- vue.createElementVNode("text", _hoisted_10, vue.toDisplayString(_ctx.loadingText), 1)
1049
- ])) : _ctx.error ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_11, [
1050
- _hoisted_12,
1051
- vue.createElementVNode("text", _hoisted_13, vue.toDisplayString(_ctx.errorText), 1),
1057
+ __props.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_8$1, [
1058
+ _cache[1] || (_cache[1] = vue.createElementVNode("view", { class: "loading-spinner" }, [
1059
+ vue.createElementVNode("text", { class: "loading-icon" }, "●")
1060
+ ], -1)),
1061
+ vue.createElementVNode("text", _hoisted_9, vue.toDisplayString(__props.loadingText), 1)
1062
+ ])) : __props.error ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_10, [
1063
+ _cache[2] || (_cache[2] = vue.createElementVNode("text", { class: "error-icon" }, "×", -1)),
1064
+ vue.createElementVNode("text", _hoisted_11, vue.toDisplayString(__props.errorText), 1),
1052
1065
  vue.createElementVNode("view", {
1053
1066
  class: "retry-btn",
1054
1067
  onClick: onRetry
1055
- }, vue.toDisplayString(_ctx.retryText), 1)
1056
- ])) : !_ctx.hasMore ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_14, [
1057
- vue.createElementVNode("text", _hoisted_15, vue.toDisplayString(_ctx.noMoreText), 1)
1058
- ])) : (vue.openBlock(), vue.createElementBlock("view", _hoisted_16))
1068
+ }, vue.toDisplayString(__props.retryText), 1)
1069
+ ])) : !__props.hasMore ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_12, [
1070
+ vue.createElementVNode("text", _hoisted_13, vue.toDisplayString(__props.noMoreText), 1)
1071
+ ])) : (vue.openBlock(), vue.createElementBlock("view", _hoisted_14))
1059
1072
  ])
1060
1073
  ], 544);
1061
1074
  };
1062
1075
  }
1063
1076
  });
1064
- const index = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-d2876eca"]]);
1065
- function useDropdownSelect(props, emit) {
1066
- const isOpen = vue.ref(false);
1067
- const displayText = vue.computed(() => {
1068
- var _a, _b;
1069
- if (!((_a = props.options) == null ? void 0 : _a.length)) {
1070
- return "请选择";
1071
- }
1072
- if (props.modelValue !== void 0 && props.modelValue !== null) {
1073
- const matched = props.options.find(
1074
- (opt) => opt.value === props.modelValue
1075
- );
1076
- if (matched)
1077
- return matched.text;
1078
- }
1079
- return ((_b = props.options[0]) == null ? void 0 : _b.text) || "请选择";
1080
- });
1081
- const internalValue = vue.computed({
1082
- get() {
1083
- var _a, _b;
1084
- if (props.modelValue !== void 0 && props.modelValue !== null) {
1085
- return props.modelValue;
1086
- }
1087
- return ((_b = (_a = props.options) == null ? void 0 : _a[0]) == null ? void 0 : _b.value) ?? "";
1088
- },
1089
- set(val) {
1090
- emit("update:modelValue", val);
1091
- }
1092
- });
1093
- const handleChange = (value) => {
1094
- emit("change", value);
1095
- };
1096
- const handleOpen = () => {
1097
- isOpen.value = true;
1098
- };
1099
- const handleClose = () => {
1100
- isOpen.value = false;
1101
- };
1102
- return {
1103
- displayText,
1104
- internalValue,
1105
- isOpen,
1106
- handleChange,
1107
- handleOpen,
1108
- handleClose
1109
- };
1110
- }
1111
- const _hoisted_1$2 = { class: "dropdown-select" };
1112
- const _hoisted_2$2 = { class: "dropdown-title" };
1113
- const _hoisted_3$2 = { class: "dropdown-text" };
1114
- const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
1077
+ const PullRefresh = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-b591b189"]]);
1078
+ const _hoisted_1$1 = { class: "sw-swiper" };
1079
+ const _hoisted_2$1 = {
1080
+ key: 0,
1081
+ class: "swiper-indicators"
1082
+ };
1083
+ const _hoisted_3$1 = ["onClick"];
1084
+ const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
1115
1085
  __name: "index",
1116
1086
  props: {
1117
- modelValue: {},
1118
- iconName: { default: "arrow-down" },
1119
- options: {}
1087
+ items: {},
1088
+ initialIndex: { default: 0 },
1089
+ autoPlay: { type: Boolean, default: true },
1090
+ interval: { default: 3e3 },
1091
+ duration: { default: 300 },
1092
+ showIndicators: { type: Boolean, default: true },
1093
+ showArrows: { type: Boolean, default: false },
1094
+ loop: { type: Boolean, default: true }
1120
1095
  },
1121
- emits: ["update:modelValue", "change"],
1122
- setup(__props, { emit: __emit }) {
1096
+ emits: ["change", "prev", "next"],
1097
+ setup(__props, { expose: __expose, emit: __emit }) {
1123
1098
  const props = __props;
1124
1099
  const emit = __emit;
1125
- const { displayText, internalValue, handleChange, handleOpen, handleClose } = useDropdownSelect(props, emit);
1126
- const isOpen = vue.ref(false);
1127
- const selectedIndex = vue.computed(() => {
1128
- if (!props.options || !props.options.length)
1129
- return 0;
1130
- return props.options.findIndex((opt) => opt.value === internalValue.value);
1131
- });
1132
- function togglePicker() {
1133
- isOpen.value = !isOpen.value;
1134
- if (isOpen.value) {
1135
- handleOpen();
1136
- } else {
1137
- handleClose();
1100
+ const currentIndex = vue.ref(props.initialIndex);
1101
+ let timer = null;
1102
+ function startAutoPlay() {
1103
+ if (props.autoPlay && props.items.length > 1) {
1104
+ timer = setInterval(() => {
1105
+ next();
1106
+ }, props.interval);
1138
1107
  }
1139
1108
  }
1140
- function onPickerChange(e) {
1141
- const index2 = e.detail.value;
1142
- const selectedOption = props.options[index2];
1143
- handleChange(selectedOption.value);
1144
- isOpen.value = false;
1145
- handleClose();
1109
+ function stopAutoPlay() {
1110
+ if (timer) {
1111
+ clearInterval(timer);
1112
+ timer = null;
1113
+ }
1146
1114
  }
1147
- function onPickerCancel() {
1148
- isOpen.value = false;
1149
- handleClose();
1115
+ function prev() {
1116
+ if (props.loop) {
1117
+ currentIndex.value = currentIndex.value === 0 ? props.items.length - 1 : currentIndex.value - 1;
1118
+ } else if (currentIndex.value > 0) {
1119
+ currentIndex.value--;
1120
+ }
1121
+ emit("prev", currentIndex.value);
1122
+ emit("change", currentIndex.value);
1123
+ }
1124
+ function next() {
1125
+ if (props.loop) {
1126
+ currentIndex.value = currentIndex.value === props.items.length - 1 ? 0 : currentIndex.value + 1;
1127
+ } else if (currentIndex.value < props.items.length - 1) {
1128
+ currentIndex.value++;
1129
+ }
1130
+ emit("next", currentIndex.value);
1131
+ emit("change", currentIndex.value);
1150
1132
  }
1133
+ vue.watch(() => props.items, (newItems) => {
1134
+ if (newItems.length < currentIndex.value + 1) {
1135
+ currentIndex.value = Math.min(currentIndex.value, newItems.length - 1);
1136
+ }
1137
+ stopAutoPlay();
1138
+ startAutoPlay();
1139
+ }, { deep: true });
1140
+ vue.watch(() => props.autoPlay, (autoPlay) => {
1141
+ if (autoPlay) {
1142
+ startAutoPlay();
1143
+ } else {
1144
+ stopAutoPlay();
1145
+ }
1146
+ });
1147
+ vue.onMounted(() => {
1148
+ startAutoPlay();
1149
+ });
1150
+ vue.onUnmounted(() => {
1151
+ stopAutoPlay();
1152
+ });
1153
+ __expose({
1154
+ prev,
1155
+ next,
1156
+ currentIndex
1157
+ });
1151
1158
  return (_ctx, _cache) => {
1152
- const _component_picker = vue.resolveComponent("picker");
1153
- return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$2, [
1159
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$1, [
1154
1160
  vue.createElementVNode("view", {
1155
- class: "dropdown-trigger",
1156
- onTap: togglePicker
1161
+ class: "swiper-wrapper",
1162
+ style: vue.normalizeStyle({
1163
+ transform: `translateX(-${currentIndex.value * 100}%)`,
1164
+ transition: `transform ${__props.duration}ms ease`
1165
+ })
1157
1166
  }, [
1158
- vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps({ text: vue.unref(displayText) })), () => [
1159
- vue.createElementVNode("view", _hoisted_2$2, [
1160
- vue.createElementVNode("text", _hoisted_3$2, vue.toDisplayString(vue.unref(displayText)), 1),
1161
- vue.createElementVNode("text", {
1162
- class: vue.normalizeClass(["dropdown-icon", { "is-active": isOpen.value }])
1163
- }, [
1164
- vue.renderSlot(_ctx.$slots, "icon", {}, () => [
1165
- vue.createElementVNode("view", {
1166
- class: vue.normalizeClass(["uni-icon", _ctx.iconName])
1167
- }, null, 2)
1168
- ])
1169
- ], 2)
1170
- ])
1171
- ])
1172
- ], 32),
1173
- isOpen.value ? (vue.openBlock(), vue.createBlock(_component_picker, {
1174
- key: 0,
1175
- mode: "selector",
1176
- range: _ctx.options,
1177
- "range-key": "text",
1178
- value: selectedIndex.value,
1179
- class: "dropdown-picker",
1180
- onChange: onPickerChange,
1181
- onCancel: onPickerCancel
1182
- }, null, 8, ["range", "value"])) : vue.createCommentVNode("", true)
1167
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.items, (item, index2) => {
1168
+ return vue.openBlock(), vue.createElementBlock("view", {
1169
+ key: index2,
1170
+ class: "swiper-item"
1171
+ }, [
1172
+ vue.renderSlot(_ctx.$slots, "default", {
1173
+ item,
1174
+ index: index2
1175
+ }, void 0, true)
1176
+ ]);
1177
+ }), 128))
1178
+ ], 4),
1179
+ __props.showIndicators ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_2$1, [
1180
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.items, (item, index2) => {
1181
+ return vue.openBlock(), vue.createElementBlock("view", {
1182
+ key: index2,
1183
+ class: vue.normalizeClass(["indicator-item", { active: index2 === currentIndex.value }]),
1184
+ onClick: ($event) => currentIndex.value = index2
1185
+ }, null, 10, _hoisted_3$1);
1186
+ }), 128))
1187
+ ])) : vue.createCommentVNode("", true),
1188
+ __props.showArrows ? (vue.openBlock(), vue.createElementBlock("view", {
1189
+ key: 1,
1190
+ class: "swiper-arrow swiper-arrow-left",
1191
+ onClick: prev
1192
+ })) : vue.createCommentVNode("", true),
1193
+ __props.showArrows ? (vue.openBlock(), vue.createElementBlock("view", {
1194
+ key: 2,
1195
+ class: "swiper-arrow swiper-arrow-right",
1196
+ onClick: next
1197
+ })) : vue.createCommentVNode("", true)
1183
1198
  ]);
1184
1199
  };
1185
1200
  }
1186
1201
  });
1187
- function useDropdownWithBadge(props) {
1188
- const hasBadge = vue.computed(() => {
1189
- return props.hideBadge(props.modelValue);
1190
- });
1191
- return { hasBadge };
1192
- }
1193
- const _hoisted_1$1 = { class: "dropdown-title" };
1194
- const _hoisted_2$1 = { class: "dropdown-text" };
1195
- const _hoisted_3$1 = { class: "dropdown-icon" };
1196
- const _hoisted_4$1 = { class: "dropdown-with-badge__dot" };
1197
- const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
1198
- __name: "index",
1199
- props: {
1200
- hideBadge: { type: Function, default: (modelValue) => modelValue === "" || modelValue === null || modelValue === void 0 }
1201
- },
1202
- emits: ["update:modelValue", "change"],
1203
- setup(__props, { emit: __emit }) {
1204
- const props = __props;
1205
- const emit = __emit;
1206
- const { hasBadge } = useDropdownWithBadge(props);
1207
- return (_ctx, _cache) => {
1208
- return vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$2), vue.mergeProps({ modelValue: _ctx.modelValue, options: _ctx.options }, { class: "dropdown-with-badge" }, vue.toHandlers(emit)), {
1209
- default: vue.withCtx(({ text }) => [
1210
- vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps({ text })), () => [
1211
- vue.createElementVNode("view", _hoisted_1$1, [
1212
- vue.createElementVNode("text", _hoisted_2$1, vue.toDisplayString(text), 1),
1213
- vue.createElementVNode("text", _hoisted_3$1, [
1214
- vue.renderSlot(_ctx.$slots, "icon", {}, () => [
1215
- vue.createElementVNode("view", {
1216
- class: vue.normalizeClass(["uni-icon", _ctx.iconName])
1217
- }, null, 2)
1218
- ])
1219
- ])
1220
- ]),
1221
- vue.withDirectives(vue.createElementVNode("text", _hoisted_4$1, null, 512), [
1222
- [vue.vShow, !vue.unref(hasBadge)]
1223
- ])
1224
- ])
1225
- ]),
1226
- _: 3
1227
- }, 16);
1228
- };
1229
- }
1230
- });
1231
- function useHasBadge(model) {
1232
- if (!model) {
1233
- return vue.computed(() => false);
1234
- }
1235
- if (typeof model === "function") {
1236
- return vue.computed(() => model());
1237
- }
1238
- if (vue.isRef(model)) {
1239
- return vue.computed(() => {
1240
- if (!model.value)
1241
- return false;
1242
- const obj = model.value;
1243
- for (const key in obj) {
1244
- if (obj[key]) {
1245
- return true;
1246
- }
1247
- }
1248
- return false;
1249
- });
1250
- }
1251
- return vue.computed(() => {
1252
- for (const key in model) {
1253
- const val = model[key];
1254
- if (val) {
1255
- return true;
1256
- }
1257
- }
1258
- return false;
1259
- });
1260
- }
1261
- function useFilterDrawer(props, emit) {
1262
- const visible = vue.ref(false);
1263
- const hasBadge = useHasBadge(props.modelValue);
1264
- const openDrawer = () => {
1265
- visible.value = true;
1266
- };
1267
- const closeDrawer = () => {
1268
- visible.value = false;
1269
- };
1270
- const resetDrawer = () => {
1271
- emit("reset");
1272
- closeDrawer();
1273
- };
1274
- const queryDrawer = () => {
1275
- emit("query");
1276
- closeDrawer();
1277
- };
1278
- return {
1279
- visible,
1280
- openDrawer,
1281
- closeDrawer,
1282
- resetDrawer,
1283
- queryDrawer,
1284
- hasBadge
1285
- };
1286
- }
1287
- const _hoisted_1 = /* @__PURE__ */ vue.createElementVNode("view", { class: "uni-icon icon-filter-o" }, null, -1);
1202
+ const Swiper = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4f860ae8"]]);
1203
+ const _hoisted_1 = {
1204
+ key: 0,
1205
+ class: "sw-toast__loading"
1206
+ };
1288
1207
  const _hoisted_2 = {
1289
1208
  key: 0,
1290
- class: "filter-drawer__badge-dot"
1209
+ class: "sw-toast__spinner"
1291
1210
  };
1292
1211
  const _hoisted_3 = {
1293
1212
  key: 1,
1294
- class: "filter-drawer__popup",
1295
- style: { height: "100vh", width: "100vw" }
1213
+ class: "sw-toast__custom-icon"
1214
+ };
1215
+ const _hoisted_4 = {
1216
+ key: 1,
1217
+ class: "sw-toast__icon"
1218
+ };
1219
+ const _hoisted_5 = {
1220
+ key: 0,
1221
+ class: "sw-toast__icon--success"
1222
+ };
1223
+ const _hoisted_6 = {
1224
+ key: 1,
1225
+ class: "sw-toast__icon--fail"
1226
+ };
1227
+ const _hoisted_7 = {
1228
+ key: 2,
1229
+ class: "sw-toast__custom-icon"
1230
+ };
1231
+ const _hoisted_8 = {
1232
+ key: 2,
1233
+ class: "sw-toast__text"
1296
1234
  };
1297
- const _hoisted_4 = { class: "filter-drawer" };
1298
- const _hoisted_5 = { class: "filter-drawer__header" };
1299
- const _hoisted_6 = /* @__PURE__ */ vue.createElementVNode("text", { class: "filter-drawer__title" }, "筛选", -1);
1300
- const _hoisted_7 = { class: "filter-drawer__body" };
1301
- const _hoisted_8 = { class: "filter-drawer__footer" };
1302
1235
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1303
1236
  __name: "index",
1304
1237
  props: {
1305
- hasBadge: { type: Boolean, default: false },
1306
- modelValue: {}
1238
+ modelValue: { type: Boolean, default: false },
1239
+ type: { default: "text" },
1240
+ position: { default: "middle" },
1241
+ message: { default: "" },
1242
+ duration: { default: 3e3 },
1243
+ loading: { type: Boolean, default: false },
1244
+ icon: { type: Boolean, default: true },
1245
+ customIcon: { default: "" },
1246
+ large: { type: Boolean, default: false },
1247
+ customStyle: { default: () => ({}) }
1307
1248
  },
1308
- emits: ["reset", "query"],
1309
- setup(__props, { emit: __emit }) {
1249
+ emits: ["update:modelValue", "close", "click"],
1250
+ setup(__props, { expose: __expose, emit: __emit }) {
1310
1251
  const props = __props;
1311
1252
  const emit = __emit;
1312
- const { visible, openDrawer, closeDrawer, resetDrawer, queryDrawer, hasBadge } = useFilterDrawer(props, emit);
1253
+ const toastRef = vue.ref(null);
1254
+ let timer = null;
1255
+ const showToast = vue.ref(props.modelValue);
1256
+ const isClosing = vue.ref(false);
1257
+ const showIcon = vue.computed(() => {
1258
+ if (props.loading)
1259
+ return true;
1260
+ if (props.type === "text")
1261
+ return props.icon;
1262
+ return true;
1263
+ });
1264
+ function onClick() {
1265
+ emit("click");
1266
+ }
1267
+ function close() {
1268
+ if (!showToast.value)
1269
+ return;
1270
+ isClosing.value = true;
1271
+ emit("close");
1272
+ }
1273
+ function startTimer() {
1274
+ clearTimer();
1275
+ if (props.duration > 0 && !props.loading) {
1276
+ timer = setTimeout(() => {
1277
+ close();
1278
+ }, props.duration);
1279
+ }
1280
+ }
1281
+ function clearTimer() {
1282
+ if (timer) {
1283
+ clearTimeout(timer);
1284
+ timer = null;
1285
+ }
1286
+ }
1287
+ function handleTransitionEnd() {
1288
+ if (isClosing.value) {
1289
+ showToast.value = false;
1290
+ isClosing.value = false;
1291
+ emit("update:modelValue", false);
1292
+ }
1293
+ }
1294
+ vue.watch(() => props.modelValue, (newVal) => {
1295
+ if (newVal) {
1296
+ showToast.value = true;
1297
+ isClosing.value = false;
1298
+ startTimer();
1299
+ } else {
1300
+ close();
1301
+ }
1302
+ });
1303
+ vue.watch(() => props.message, () => {
1304
+ if (showToast.value && !props.loading) {
1305
+ startTimer();
1306
+ }
1307
+ });
1308
+ vue.onMounted(() => {
1309
+ if (props.modelValue) {
1310
+ startTimer();
1311
+ }
1312
+ });
1313
+ vue.onUnmounted(() => {
1314
+ clearTimer();
1315
+ });
1316
+ __expose({
1317
+ /**
1318
+ * 手动关闭Toast
1319
+ */
1320
+ close
1321
+ });
1313
1322
  return (_ctx, _cache) => {
1314
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1315
- vue.createElementVNode("view", {
1316
- class: "filter-drawer__trigger",
1317
- onClick: _cache[0] || (_cache[0] = //@ts-ignore
1318
- (...args) => vue.unref(openDrawer) && vue.unref(openDrawer)(...args))
1319
- }, [
1320
- vue.renderSlot(_ctx.$slots, "trigger", {}, () => [
1321
- _hoisted_1
1322
- ]),
1323
- vue.unref(hasBadge) ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_2)) : vue.createCommentVNode("", true)
1324
- ]),
1325
- vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("view", {
1326
- key: 0,
1327
- class: "filter-drawer__popup-mask",
1328
- onClick: _cache[1] || (_cache[1] = //@ts-ignore
1329
- (...args) => vue.unref(closeDrawer) && vue.unref(closeDrawer)(...args))
1330
- })) : vue.createCommentVNode("", true),
1331
- vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_3, [
1332
- vue.createElementVNode("view", {
1333
- class: "filter-drawer__close",
1334
- onClick: _cache[2] || (_cache[2] = //@ts-ignore
1335
- (...args) => vue.unref(closeDrawer) && vue.unref(closeDrawer)(...args))
1336
- }, " × "),
1337
- vue.createElementVNode("view", _hoisted_4, [
1338
- vue.createElementVNode("view", _hoisted_5, [
1339
- vue.renderSlot(_ctx.$slots, "header", {}, () => [
1340
- _hoisted_6
1341
- ])
1342
- ]),
1343
- vue.createElementVNode("view", _hoisted_7, [
1344
- vue.renderSlot(_ctx.$slots, "default")
1345
- ]),
1346
- vue.createElementVNode("view", _hoisted_8, [
1347
- vue.renderSlot(_ctx.$slots, "footer", {}, () => [
1348
- vue.createElementVNode("view", {
1349
- class: "filter-drawer__button filter-drawer__button--plain",
1350
- onClick: _cache[3] || (_cache[3] = //@ts-ignore
1351
- (...args) => vue.unref(resetDrawer) && vue.unref(resetDrawer)(...args))
1352
- }, " 重置条件 "),
1353
- vue.createElementVNode("view", {
1354
- class: "filter-drawer__button",
1355
- onClick: _cache[4] || (_cache[4] = //@ts-ignore
1356
- (...args) => vue.unref(queryDrawer) && vue.unref(queryDrawer)(...args))
1357
- }, " 查询 ")
1358
- ])
1359
- ])
1360
- ])
1361
- ])) : vue.createCommentVNode("", true)
1362
- ], 64);
1323
+ return vue.withDirectives((vue.openBlock(), vue.createElementBlock("view", {
1324
+ ref_key: "toastRef",
1325
+ ref: toastRef,
1326
+ class: vue.normalizeClass(["sw-toast", [
1327
+ `sw-toast--${__props.type}`,
1328
+ `sw-toast--${__props.position}`,
1329
+ { "sw-toast--large": __props.large },
1330
+ { "sw-toast--text": !showIcon.value && __props.type === "text" },
1331
+ { "sw-toast--show": showToast.value && !isClosing.value },
1332
+ { "sw-toast--hide": showToast.value && isClosing.value }
1333
+ ]]),
1334
+ style: vue.normalizeStyle(__props.customStyle),
1335
+ onClick,
1336
+ onTransitionend: handleTransitionEnd
1337
+ }, [
1338
+ __props.loading ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_1, [
1339
+ !__props.customIcon ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_2)) : (vue.openBlock(), vue.createElementBlock("text", _hoisted_3, vue.toDisplayString(__props.customIcon), 1))
1340
+ ])) : showIcon.value ? (vue.openBlock(), vue.createElementBlock("view", _hoisted_4, [
1341
+ __props.type === "success" ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_5, "✓")) : __props.type === "fail" ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_6, "✗")) : __props.customIcon ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_7, vue.toDisplayString(__props.customIcon), 1)) : vue.createCommentVNode("", true)
1342
+ ])) : vue.createCommentVNode("", true),
1343
+ __props.message ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_8, vue.toDisplayString(__props.message), 1)) : vue.createCommentVNode("", true)
1344
+ ], 38)), [
1345
+ [vue.vShow, showToast.value]
1346
+ ]);
1363
1347
  };
1364
1348
  }
1365
1349
  });
1366
- exports.Button = index$7;
1367
- exports.Dialog = index$6;
1368
- exports.Divider = index$5;
1369
- exports.DropdownSelect = _sfc_main$2;
1370
- exports.DropdownWithBadge = _sfc_main$1;
1371
- exports.FilterDrawer = _sfc_main;
1372
- exports.InfiniteScroll = index$1;
1373
- exports.Popup = index$4;
1374
- exports.PullRefresh = index;
1375
- exports.Swiper = index$2;
1376
- exports.Toast = index$3;
1350
+ const Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-482db7a0"]]);
1351
+ const index = {
1352
+ Button,
1353
+ Dialog,
1354
+ Divider,
1355
+ useDropdownSelect,
1356
+ DropdownSelect: _sfc_main$7,
1357
+ useDropdownWithBadge,
1358
+ DropdownWithBadge: _sfc_main$6,
1359
+ FilterDrawer: _sfc_main$5,
1360
+ useFilterDrawer,
1361
+ InfiniteScroll,
1362
+ Popup,
1363
+ PullRefresh,
1364
+ Swiper,
1365
+ Toast
1366
+ };
1367
+ exports.Button = Button;
1368
+ exports.Dialog = Dialog;
1369
+ exports.Divider = Divider;
1370
+ exports.DropdownSelect = _sfc_main$7;
1371
+ exports.DropdownWithBadge = _sfc_main$6;
1372
+ exports.FilterDrawer = _sfc_main$5;
1373
+ exports.InfiniteScroll = InfiniteScroll;
1374
+ exports.Popup = Popup;
1375
+ exports.PullRefresh = PullRefresh;
1376
+ exports.Swiper = Swiper;
1377
+ exports.Toast = Toast;
1378
+ exports.default = index;
1377
1379
  exports.useDropdownSelect = useDropdownSelect;
1378
1380
  exports.useDropdownWithBadge = useDropdownWithBadge;
1379
1381
  exports.useFilterDrawer = useFilterDrawer;
1380
- //# sourceMappingURL=index.cjs.js.map
1382
+ //# sourceMappingURL=index.cjs.map