uniapp-dyckui 4.1.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 (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +104 -0
  3. package/dist/assets/style.BFlsbpSj.css +1472 -0
  4. package/dist/index.cjs.js +1380 -0
  5. package/dist/index.cjs.js.map +1 -0
  6. package/dist/index.es.js +1380 -0
  7. package/dist/index.es.js.map +1 -0
  8. package/dist/src/components/MyComs/Button/index.d.ts +3 -0
  9. package/dist/src/components/MyComs/Button/index.vue.d.ts +93 -0
  10. package/dist/src/components/MyComs/Dialog/index.d.ts +3 -0
  11. package/dist/src/components/MyComs/Dialog/index.vue.d.ts +65 -0
  12. package/dist/src/components/MyComs/Divider/index.d.ts +3 -0
  13. package/dist/src/components/MyComs/Divider/index.vue.d.ts +53 -0
  14. package/dist/src/components/MyComs/DropdownSelect/dropdownSelect.d.ts +10 -0
  15. package/dist/src/components/MyComs/DropdownSelect/index.d.ts +4 -0
  16. package/dist/src/components/MyComs/DropdownSelect/index.vue.d.ts +26 -0
  17. package/dist/src/components/MyComs/DropdownSelect/type.d.ts +13 -0
  18. package/dist/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.d.ts +5 -0
  19. package/dist/src/components/MyComs/DropdownWithBadge/index.d.ts +4 -0
  20. package/dist/src/components/MyComs/DropdownWithBadge/index.vue.d.ts +26 -0
  21. package/dist/src/components/MyComs/DropdownWithBadge/type.d.ts +9 -0
  22. package/dist/src/components/MyComs/FilterDrawer/hasBadge.d.ts +8 -0
  23. package/dist/src/components/MyComs/FilterDrawer/index.d.ts +5 -0
  24. package/dist/src/components/MyComs/FilterDrawer/index.vue.d.ts +26 -0
  25. package/dist/src/components/MyComs/FilterDrawer/type.d.ts +8 -0
  26. package/dist/src/components/MyComs/FilterDrawer/useFilterDrawer.d.ts +10 -0
  27. package/dist/src/components/MyComs/InfiniteScroll/index.d.ts +3 -0
  28. package/dist/src/components/MyComs/InfiniteScroll/index.vue.d.ts +65 -0
  29. package/dist/src/components/MyComs/Popup/index.d.ts +3 -0
  30. package/dist/src/components/MyComs/Popup/index.vue.d.ts +119 -0
  31. package/dist/src/components/MyComs/PullRefresh/index.d.ts +3 -0
  32. package/dist/src/components/MyComs/PullRefresh/index.vue.d.ts +117 -0
  33. package/dist/src/components/MyComs/Swiper/index.d.ts +3 -0
  34. package/dist/src/components/MyComs/Swiper/index.vue.d.ts +79 -0
  35. package/dist/src/components/MyComs/Toast/index.d.ts +3 -0
  36. package/dist/src/components/MyComs/Toast/index.vue.d.ts +108 -0
  37. package/dist/src/components/MyComs/index.d.ts +20 -0
  38. package/package.json +218 -0
  39. package/src/components/MyComs/Button/README.md +235 -0
  40. package/src/components/MyComs/Button/index.ts +3 -0
  41. package/src/components/MyComs/Button/index.vue +413 -0
  42. package/src/components/MyComs/Dialog/README.md +160 -0
  43. package/src/components/MyComs/Dialog/index.ts +2 -0
  44. package/src/components/MyComs/Dialog/index.vue +275 -0
  45. package/src/components/MyComs/Divider/README.md +0 -0
  46. package/src/components/MyComs/Divider/index.ts +2 -0
  47. package/src/components/MyComs/Divider/index.vue +106 -0
  48. package/src/components/MyComs/DropdownSelect/README.md +112 -0
  49. package/src/components/MyComs/DropdownSelect/dropdownSelect.less +75 -0
  50. package/src/components/MyComs/DropdownSelect/dropdownSelect.ts +59 -0
  51. package/src/components/MyComs/DropdownSelect/index.ts +4 -0
  52. package/src/components/MyComs/DropdownSelect/index.vue +88 -0
  53. package/src/components/MyComs/DropdownSelect/type.ts +15 -0
  54. package/src/components/MyComs/DropdownWithBadge/README.md +77 -0
  55. package/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.less +11 -0
  56. package/src/components/MyComs/DropdownWithBadge/dropdownWithBadge.ts +10 -0
  57. package/src/components/MyComs/DropdownWithBadge/index.ts +4 -0
  58. package/src/components/MyComs/DropdownWithBadge/index.vue +39 -0
  59. package/src/components/MyComs/DropdownWithBadge/type.ts +12 -0
  60. package/src/components/MyComs/FilterDrawer/filterDrawer.less +117 -0
  61. package/src/components/MyComs/FilterDrawer/hasBadge.ts +41 -0
  62. package/src/components/MyComs/FilterDrawer/index.ts +5 -0
  63. package/src/components/MyComs/FilterDrawer/index.vue +53 -0
  64. package/src/components/MyComs/FilterDrawer/type.ts +9 -0
  65. package/src/components/MyComs/FilterDrawer/useFilterDrawer.ts +38 -0
  66. package/src/components/MyComs/InfiniteScroll/index.ts +2 -0
  67. package/src/components/MyComs/InfiniteScroll/index.vue +171 -0
  68. package/src/components/MyComs/Popup/README.md +684 -0
  69. package/src/components/MyComs/Popup/index.ts +2 -0
  70. package/src/components/MyComs/Popup/index.vue +835 -0
  71. package/src/components/MyComs/PullRefresh/README.md +600 -0
  72. package/src/components/MyComs/PullRefresh/index.ts +2 -0
  73. package/src/components/MyComs/PullRefresh/index.vue +599 -0
  74. package/src/components/MyComs/Swiper/README.md +202 -0
  75. package/src/components/MyComs/Swiper/index.ts +2 -0
  76. package/src/components/MyComs/Swiper/index.vue +245 -0
  77. package/src/components/MyComs/Toast/README.md +604 -0
  78. package/src/components/MyComs/Toast/index.ts +2 -0
  79. package/src/components/MyComs/Toast/index.vue +372 -0
  80. package/src/components/MyComs/index.ts +33 -0
@@ -0,0 +1,1380 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const vue = require("vue");
4
+ const _withScopeId$4 = (n) => (vue.pushScopeId("data-v-02c23a30"), n = n(), vue.popScopeId(), n);
5
+ const _hoisted_1$a = ["disabled"];
6
+ const _hoisted_2$9 = {
7
+ key: 0,
8
+ class: "sw-button__loading"
9
+ };
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 = {
15
+ key: 0,
16
+ class: "sw-button__icon"
17
+ };
18
+ const _hoisted_6$5 = {
19
+ key: 2,
20
+ class: "sw-button__text"
21
+ };
22
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
23
+ __name: "index",
24
+ props: {
25
+ type: { default: "primary" },
26
+ size: { default: "normal" },
27
+ shape: { default: "default" },
28
+ disabled: { type: Boolean, default: false },
29
+ loading: { type: Boolean, default: false },
30
+ block: { type: Boolean, default: false },
31
+ round: { type: Boolean, default: false },
32
+ plain: { type: Boolean, default: false },
33
+ outline: { type: Boolean, default: false },
34
+ link: { type: Boolean, default: false },
35
+ icon: { default: "" },
36
+ customClass: { default: "" },
37
+ customStyle: { default: () => ({}) }
38
+ },
39
+ emits: ["click"],
40
+ setup(__props, { emit: __emit }) {
41
+ const props = __props;
42
+ const emit = __emit;
43
+ function handleClick(event) {
44
+ if (!props.disabled && !props.loading) {
45
+ emit("click", event);
46
+ }
47
+ }
48
+ return (_ctx, _cache) => {
49
+ return vue.openBlock(), vue.createElementBlock("view", {
50
+ 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 }
61
+ ]]),
62
+ disabled: _ctx.disabled || _ctx.loading,
63
+ onClick: handleClick
64
+ }, [
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, [
68
+ vue.renderSlot(_ctx.$slots, "icon", {}, void 0, true)
69
+ ])) : vue.createCommentVNode("", true),
70
+ _ctx.icon ? (vue.openBlock(), vue.createElementBlock("text", {
71
+ key: 1,
72
+ class: vue.normalizeClass(["sw-button__icon", [_ctx.icon]])
73
+ }, null, 2)) : vue.createCommentVNode("", true)
74
+ ], 64)) : vue.createCommentVNode("", true),
75
+ _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_6$5, [
76
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
77
+ ])) : vue.createCommentVNode("", true)
78
+ ], 10, _hoisted_1$a);
79
+ };
80
+ }
81
+ });
82
+ const _export_sfc = (sfc, props) => {
83
+ const target = sfc.__vccOpts || sfc;
84
+ for (const [key, val] of props) {
85
+ target[key] = val;
86
+ }
87
+ return target;
88
+ };
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);
91
+ const _hoisted_1$9 = { class: "dialog-content" };
92
+ const _hoisted_2$8 = { class: "dialog-icon" };
93
+ const _hoisted_3$8 = ["src"];
94
+ const _hoisted_4$6 = {
95
+ key: 1,
96
+ class: "default-icon"
97
+ };
98
+ const _hoisted_5$4 = { class: "dialog-title" };
99
+ 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" };
102
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
103
+ __name: "index",
104
+ props: {
105
+ modelValue: { type: Boolean, default: false },
106
+ type: { default: "confirm" },
107
+ title: { default: "" },
108
+ description: { default: "" },
109
+ icon: { default: "" },
110
+ mask: { type: Boolean, default: true },
111
+ maskOpacity: { default: 0.5 },
112
+ closeOnMaskClick: { type: Boolean, default: true }
113
+ },
114
+ emits: ["update:modelValue", "confirm", "cancel"],
115
+ setup(__props, { emit: __emit }) {
116
+ vue.useCssVars((_ctx) => ({
117
+ "1f434a4e": _ctx.maskOpacity
118
+ }));
119
+ const props = __props;
120
+ const emit = __emit;
121
+ const showDialog = vue.ref(props.modelValue);
122
+ vue.watch(() => props.modelValue, (newVal) => {
123
+ showDialog.value = newVal;
124
+ });
125
+ vue.watch(() => showDialog.value, (newVal) => {
126
+ emit("update:modelValue", newVal);
127
+ });
128
+ function handleMaskClick() {
129
+ if (props.closeOnMaskClick) {
130
+ showDialog.value = false;
131
+ }
132
+ }
133
+ function handleConfirm() {
134
+ emit("confirm");
135
+ showDialog.value = false;
136
+ }
137
+ function handleCancel() {
138
+ emit("cancel");
139
+ showDialog.value = false;
140
+ }
141
+ return (_ctx, _cache) => {
142
+ return showDialog.value ? (vue.openBlock(), vue.createElementBlock("view", {
143
+ key: 0,
144
+ class: "dialog-wrapper",
145
+ onClick: handleMaskClick
146
+ }, [
147
+ vue.createElementVNode("view", {
148
+ class: "dialog-container",
149
+ onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
150
+ }, ["stop"]))
151
+ }, [
152
+ vue.createElementVNode("view", _hoisted_1$9, [
153
+ vue.createElementVNode("view", _hoisted_2$8, [
154
+ _ctx.icon ? (vue.openBlock(), vue.createElementBlock("image", {
155
+ key: 0,
156
+ src: _ctx.icon,
157
+ alt: "dialog-icon"
158
+ }, null, 8, _hoisted_3$8)) : (vue.openBlock(), vue.createElementBlock("view", _hoisted_4$6))
159
+ ]),
160
+ vue.createElementVNode("text", _hoisted_5$4, vue.toDisplayString(_ctx.title), 1),
161
+ vue.createElementVNode("text", _hoisted_6$4, vue.toDisplayString(_ctx.description), 1)
162
+ ]),
163
+ _hoisted_7$4,
164
+ vue.createElementVNode("view", _hoisted_8$4, [
165
+ _ctx.type === "open-app" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
166
+ vue.createElementVNode("view", {
167
+ class: "dialog-button dialog-button-cancel",
168
+ onClick: handleCancel
169
+ }, " 取消 "),
170
+ vue.createElementVNode("view", {
171
+ class: "dialog-button dialog-button-primary",
172
+ onClick: handleConfirm
173
+ }, " 打开app ")
174
+ ], 64)) : _ctx.type === "confirm" ? (vue.openBlock(), vue.createElementBlock("view", {
175
+ key: 1,
176
+ class: "dialog-button dialog-button-full dialog-button-primary",
177
+ onClick: handleConfirm
178
+ }, " 知道了 ")) : _ctx.type === "continue" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
179
+ vue.createElementVNode("view", {
180
+ class: "dialog-button dialog-button-cancel",
181
+ onClick: handleCancel
182
+ }, " 取消 "),
183
+ vue.createElementVNode("view", {
184
+ class: "dialog-button dialog-button-primary",
185
+ onClick: handleConfirm
186
+ }, " 继续访问 ")
187
+ ], 64)) : vue.createCommentVNode("", true)
188
+ ])
189
+ ])
190
+ ])) : vue.createCommentVNode("", true);
191
+ };
192
+ }
193
+ });
194
+ const index$6 = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a2785685"]]);
195
+ const _hoisted_1$8 = {
196
+ key: 0,
197
+ class: "sw-divider__text"
198
+ };
199
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
200
+ __name: "index",
201
+ props: {
202
+ vertical: { type: Boolean, default: false },
203
+ dashed: { type: Boolean, default: false },
204
+ position: { default: "center" },
205
+ customClass: { default: "" },
206
+ customStyle: { default: () => ({}) }
207
+ },
208
+ setup(__props) {
209
+ return (_ctx, _cache) => {
210
+ return vue.openBlock(), vue.createElementBlock("view", {
211
+ class: vue.normalizeClass(["sw-divider", [
212
+ { "is-vertical": _ctx.vertical },
213
+ { "is-dashed": _ctx.dashed },
214
+ { [`sw-divider--${_ctx.position}`]: _ctx.position !== "center" }
215
+ ]])
216
+ }, [
217
+ _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("text", _hoisted_1$8, [
218
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
219
+ ])) : vue.createCommentVNode("", true)
220
+ ], 2);
221
+ };
222
+ }
223
+ });
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
+ ];
248
+ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
249
+ __name: "index",
250
+ 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 }
268
+ },
269
+ emits: ["update:modelValue", "open", "close", "maskClick", "confirm", "cancel", "closeButtonClick"],
270
+ setup(__props, { emit: __emit }) {
271
+ const props = __props;
272
+ 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
+ }
284
+ });
285
+ vue.watch(() => showPopup.value, (newVal) => {
286
+ emit("update:modelValue", newVal);
287
+ if (newVal) {
288
+ onOpen();
289
+ } 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
+ handleClose();
335
+ }
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
+ }
348
+ function handleConfirm() {
349
+ emit("confirm");
350
+ }
351
+ function handleCancel() {
352
+ emit("cancel");
353
+ handleClose();
354
+ }
355
+ vue.onMounted(() => {
356
+ if (showPopup.value) {
357
+ onOpen();
358
+ }
359
+ });
360
+ vue.onUnmounted(() => {
361
+ if (showPopup.value) {
362
+ onClose();
363
+ }
364
+ });
365
+ 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),
380
+ 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
393
+ }, [
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]
424
+ ]);
425
+ };
426
+ }
427
+ });
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 = {
446
+ key: 0,
447
+ class: "sw-toast__icon--success"
448
+ };
449
+ const _hoisted_6$2 = {
450
+ key: 1,
451
+ class: "sw-toast__icon--fail"
452
+ };
453
+ const _hoisted_7$2 = {
454
+ key: 2,
455
+ class: "sw-toast__custom-icon"
456
+ };
457
+ const _hoisted_8$2 = {
458
+ key: 2,
459
+ class: "sw-toast__text"
460
+ };
461
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
462
+ __name: "index",
463
+ props: {
464
+ modelValue: { type: Boolean, default: false },
465
+ type: { default: "text" },
466
+ position: { default: "middle" },
467
+ message: { default: "" },
468
+ duration: { default: 3e3 },
469
+ loading: { type: Boolean, default: false },
470
+ icon: { type: Boolean, default: true },
471
+ customIcon: { default: "" },
472
+ large: { type: Boolean, default: false },
473
+ customStyle: { default: () => ({}) }
474
+ },
475
+ emits: ["update:modelValue", "close", "click"],
476
+ setup(__props, { expose: __expose, emit: __emit }) {
477
+ const props = __props;
478
+ 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;
489
+ });
490
+ function onClick() {
491
+ emit("click");
492
+ }
493
+ function close() {
494
+ if (!showToast.value)
495
+ 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
+ }
506
+ }
507
+ function clearTimer() {
508
+ if (timer) {
509
+ clearTimeout(timer);
510
+ timer = null;
511
+ }
512
+ }
513
+ function handleTransitionEnd() {
514
+ if (isClosing.value) {
515
+ showToast.value = false;
516
+ isClosing.value = false;
517
+ emit("update:modelValue", false);
518
+ }
519
+ }
520
+ vue.watch(() => props.modelValue, (newVal) => {
521
+ if (newVal) {
522
+ showToast.value = true;
523
+ isClosing.value = false;
524
+ startTimer();
525
+ } else {
526
+ close();
527
+ }
528
+ });
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
+ 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
563
+ }, [
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)
568
+ ])) : 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
+ ]);
573
+ };
574
+ }
575
+ });
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 = {
579
+ key: 0,
580
+ class: "swiper-indicators"
581
+ };
582
+ const _hoisted_3$5 = ["onClick"];
583
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
584
+ __name: "index",
585
+ 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 }
594
+ },
595
+ emits: ["change", "prev", "next"],
596
+ setup(__props, { expose: __expose, emit: __emit }) {
597
+ const props = __props;
598
+ 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);
606
+ }
607
+ }
608
+ function stopAutoPlay() {
609
+ if (timer) {
610
+ clearInterval(timer);
611
+ timer = null;
612
+ }
613
+ }
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--;
619
+ }
620
+ emit("prev", currentIndex.value);
621
+ emit("change", currentIndex.value);
622
+ }
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++;
628
+ }
629
+ emit("next", currentIndex.value);
630
+ emit("change", currentIndex.value);
631
+ }
632
+ vue.watch(() => props.items, (newItems) => {
633
+ if (newItems.length < currentIndex.value + 1) {
634
+ currentIndex.value = Math.min(currentIndex.value, newItems.length - 1);
635
+ }
636
+ stopAutoPlay();
637
+ startAutoPlay();
638
+ }, { deep: true });
639
+ vue.watch(() => props.autoPlay, (autoPlay) => {
640
+ if (autoPlay) {
641
+ startAutoPlay();
642
+ } else {
643
+ stopAutoPlay();
644
+ }
645
+ });
646
+ vue.onMounted(() => {
647
+ startAutoPlay();
648
+ });
649
+ vue.onUnmounted(() => {
650
+ stopAutoPlay();
651
+ });
652
+ __expose({
653
+ prev,
654
+ next,
655
+ currentIndex
656
+ });
657
+ return (_ctx, _cache) => {
658
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$5, [
659
+ 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
+ })
665
+ }, [
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)
697
+ ]);
698
+ };
699
+ }
700
+ });
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 = {
785
+ key: 0,
786
+ class: "refresh-content"
787
+ };
788
+ const _hoisted_2$3 = { class: "refresh-icon" };
789
+ const _hoisted_3$3 = {
790
+ key: 0,
791
+ class: "refresh-loading"
792
+ };
793
+ const _hoisted_4$2 = {
794
+ key: 1,
795
+ class: "refresh-arrow"
796
+ };
797
+ const _hoisted_5$1 = { class: "refresh-text" };
798
+ const _hoisted_6$1 = { class: "infinite-scroll-content" };
799
+ const _hoisted_7$1 = { class: "infinite-scroll-indicator" };
800
+ const _hoisted_8$1 = {
801
+ key: 0,
802
+ class: "infinite-scroll-loading"
803
+ };
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 = {
809
+ key: 1,
810
+ class: "infinite-scroll-error"
811
+ };
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 = {
815
+ key: 2,
816
+ class: "infinite-scroll-no-more"
817
+ };
818
+ const _hoisted_15 = { class: "no-more-text" };
819
+ const _hoisted_16 = {
820
+ key: 3,
821
+ class: "infinite-scroll-trigger",
822
+ style: { height: `0px` }
823
+ };
824
+ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
825
+ __name: "index",
826
+ props: {
827
+ loading: { type: Boolean, default: false },
828
+ refreshLoading: { type: Boolean, default: false },
829
+ hasMore: { type: Boolean, default: true },
830
+ error: { type: Boolean, default: false },
831
+ threshold: { default: 30 },
832
+ refreshThreshold: { default: 40 },
833
+ throttleTime: { default: 200 },
834
+ loadingText: { default: "加载中..." },
835
+ errorText: { default: "加载失败" },
836
+ retryText: { default: "点击重试" },
837
+ noMoreText: { default: "没有更多数据了" },
838
+ refreshText: { default: "下拉刷新" },
839
+ releaseText: { default: "释放可刷新" },
840
+ refreshingText: { default: "正在刷新..." },
841
+ refreshSuccessText: { default: "刷新成功" },
842
+ refreshErrorText: { default: "刷新失败" },
843
+ useWindowScroll: { type: Boolean, default: false },
844
+ enableInfiniteScroll: { type: Boolean, default: false },
845
+ enableRefresh: { type: Boolean, default: true }
846
+ },
847
+ emits: ["loadMore", "retry", "refresh"],
848
+ setup(__props, { emit: __emit }) {
849
+ const props = __props;
850
+ const emit = __emit;
851
+ const containerRef = vue.ref(null);
852
+ let scrollContainer = null;
853
+ let lastScrollTime = 0;
854
+ const pullDistance = vue.ref(0);
855
+ const startY = vue.ref(0);
856
+ const isPulling = vue.ref(false);
857
+ const isRefreshing = vue.ref(false);
858
+ const refreshStatus = vue.ref("normal");
859
+ function getScrollContainer() {
860
+ if (props.useWindowScroll) {
861
+ return window;
862
+ }
863
+ return containerRef.value;
864
+ }
865
+ function throttle(fn, delay) {
866
+ return (...args) => {
867
+ const now = Date.now();
868
+ if (now - lastScrollTime >= delay) {
869
+ lastScrollTime = now;
870
+ fn.apply(null, args);
871
+ }
872
+ };
873
+ }
874
+ function checkLoadMore() {
875
+ if (!props.enableInfiniteScroll) {
876
+ return;
877
+ }
878
+ if (props.loading || !props.hasMore || props.error) {
879
+ return;
880
+ }
881
+ let scrollTop = 0;
882
+ let scrollHeight = 0;
883
+ let clientHeight = 0;
884
+ if (props.useWindowScroll) {
885
+ scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
886
+ scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
887
+ clientHeight = window.innerHeight;
888
+ } else {
889
+ if (!containerRef.value)
890
+ return;
891
+ if (typeof containerRef.value.scrollTop !== "number" || typeof containerRef.value.scrollHeight !== "number" || typeof containerRef.value.clientHeight !== "number") {
892
+ return;
893
+ }
894
+ scrollTop = containerRef.value.scrollTop;
895
+ scrollHeight = containerRef.value.scrollHeight;
896
+ clientHeight = containerRef.value.clientHeight;
897
+ }
898
+ if ((props.useWindowScroll ? scrollTop > 0 : true) && (scrollHeight <= clientHeight || scrollHeight - scrollTop - clientHeight <= props.threshold)) {
899
+ emit("loadMore");
900
+ }
901
+ }
902
+ function onRetry() {
903
+ emit("retry");
904
+ }
905
+ function handleTouchStart(e) {
906
+ var _a;
907
+ if (!props.enableRefresh || props.refreshLoading) {
908
+ return;
909
+ }
910
+ let scrollTop = 0;
911
+ if (props.useWindowScroll) {
912
+ scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
913
+ } else {
914
+ scrollTop = ((_a = containerRef.value) == null ? void 0 : _a.scrollTop) || 0;
915
+ }
916
+ if (scrollTop > 0) {
917
+ return;
918
+ }
919
+ startY.value = e.touches[0].clientY;
920
+ isPulling.value = true;
921
+ refreshStatus.value = "pulling";
922
+ }
923
+ function handleTouchMove(e) {
924
+ if (!isPulling.value || props.refreshLoading) {
925
+ return;
926
+ }
927
+ const currentY = e.touches[0].clientY;
928
+ const distance = currentY - startY.value;
929
+ if (distance <= 0) {
930
+ if (pullDistance.value > 0) {
931
+ pullDistance.value = 0;
932
+ refreshStatus.value = "normal";
933
+ }
934
+ return;
935
+ }
936
+ pullDistance.value = Math.min(distance * 0.5, props.refreshThreshold * 1.5);
937
+ if (pullDistance.value >= props.refreshThreshold) {
938
+ refreshStatus.value = "triggered";
939
+ } else {
940
+ refreshStatus.value = "pulling";
941
+ }
942
+ e.preventDefault();
943
+ }
944
+ function handleTouchEnd() {
945
+ if (!isPulling.value) {
946
+ return;
947
+ }
948
+ isPulling.value = false;
949
+ if (pullDistance.value >= props.refreshThreshold && !props.refreshLoading) {
950
+ isRefreshing.value = true;
951
+ refreshStatus.value = "refreshing";
952
+ emit("refresh");
953
+ } else {
954
+ pullDistance.value = 0;
955
+ refreshStatus.value = "normal";
956
+ }
957
+ }
958
+ const handleScroll = throttle(() => {
959
+ checkLoadMore();
960
+ }, props.throttleTime);
961
+ function addScrollListener() {
962
+ vue.nextTick(() => {
963
+ scrollContainer = getScrollContainer();
964
+ if (scrollContainer && typeof scrollContainer.addEventListener === "function") {
965
+ scrollContainer.addEventListener("scroll", handleScroll, { passive: true });
966
+ checkLoadMore();
967
+ }
968
+ });
969
+ }
970
+ function removeScrollListener() {
971
+ if (scrollContainer && typeof scrollContainer.removeEventListener === "function") {
972
+ scrollContainer.removeEventListener("scroll", handleScroll);
973
+ scrollContainer = null;
974
+ }
975
+ }
976
+ const handleResize = throttle(() => {
977
+ checkLoadMore();
978
+ }, props.throttleTime);
979
+ vue.watch(() => props.loading, (newVal) => {
980
+ if (!newVal) {
981
+ vue.nextTick(() => {
982
+ checkLoadMore();
983
+ });
984
+ }
985
+ });
986
+ vue.watch(() => props.error, (newVal) => {
987
+ if (!newVal) {
988
+ vue.nextTick(() => {
989
+ checkLoadMore();
990
+ });
991
+ }
992
+ });
993
+ vue.watch(() => props.refreshLoading, (newVal) => {
994
+ isRefreshing.value = newVal;
995
+ if (newVal) {
996
+ refreshStatus.value = "refreshing";
997
+ } else {
998
+ pullDistance.value = 0;
999
+ setTimeout(() => {
1000
+ refreshStatus.value = "normal";
1001
+ }, 300);
1002
+ }
1003
+ });
1004
+ vue.onMounted(() => {
1005
+ addScrollListener();
1006
+ window.addEventListener("resize", handleResize, { passive: true });
1007
+ });
1008
+ vue.onUnmounted(() => {
1009
+ removeScrollListener();
1010
+ window.removeEventListener("resize", handleResize);
1011
+ });
1012
+ return (_ctx, _cache) => {
1013
+ return vue.openBlock(), vue.createElementBlock("view", {
1014
+ ref_key: "containerRef",
1015
+ ref: containerRef,
1016
+ class: "infinite-scroll-container",
1017
+ onTouchstart: handleTouchStart,
1018
+ onTouchmove: handleTouchMove,
1019
+ onTouchend: handleTouchEnd,
1020
+ onScroll: _cache[0] || (_cache[0] = //@ts-ignore
1021
+ (...args) => vue.unref(handleScroll) && vue.unref(handleScroll)(...args))
1022
+ }, [
1023
+ vue.createElementVNode("view", {
1024
+ class: "refresh-indicator",
1025
+ style: vue.normalizeStyle({ height: `${pullDistance.value}px` })
1026
+ }, [
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, "↓"))
1030
+ ]),
1031
+ vue.createElementVNode("text", _hoisted_5$1, [
1032
+ props.refreshLoading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
1033
+ vue.createTextVNode(vue.toDisplayString(props.refreshingText), 1)
1034
+ ], 64)) : refreshStatus.value === "triggered" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
1035
+ vue.createTextVNode(vue.toDisplayString(props.releaseText), 1)
1036
+ ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
1037
+ vue.createTextVNode(vue.toDisplayString(props.refreshText), 1)
1038
+ ], 64))
1039
+ ])
1040
+ ])) : vue.createCommentVNode("", true)
1041
+ ], 4),
1042
+ vue.createElementVNode("view", _hoisted_6$1, [
1043
+ vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
1044
+ ]),
1045
+ 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),
1052
+ vue.createElementVNode("view", {
1053
+ class: "retry-btn",
1054
+ 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))
1059
+ ])
1060
+ ], 544);
1061
+ };
1062
+ }
1063
+ });
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({
1115
+ __name: "index",
1116
+ props: {
1117
+ modelValue: {},
1118
+ iconName: { default: "arrow-down" },
1119
+ options: {}
1120
+ },
1121
+ emits: ["update:modelValue", "change"],
1122
+ setup(__props, { emit: __emit }) {
1123
+ const props = __props;
1124
+ 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();
1138
+ }
1139
+ }
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();
1146
+ }
1147
+ function onPickerCancel() {
1148
+ isOpen.value = false;
1149
+ handleClose();
1150
+ }
1151
+ return (_ctx, _cache) => {
1152
+ const _component_picker = vue.resolveComponent("picker");
1153
+ return vue.openBlock(), vue.createElementBlock("view", _hoisted_1$2, [
1154
+ vue.createElementVNode("view", {
1155
+ class: "dropdown-trigger",
1156
+ onTap: togglePicker
1157
+ }, [
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)
1183
+ ]);
1184
+ };
1185
+ }
1186
+ });
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);
1288
+ const _hoisted_2 = {
1289
+ key: 0,
1290
+ class: "filter-drawer__badge-dot"
1291
+ };
1292
+ const _hoisted_3 = {
1293
+ key: 1,
1294
+ class: "filter-drawer__popup",
1295
+ style: { height: "100vh", width: "100vw" }
1296
+ };
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
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1303
+ __name: "index",
1304
+ props: {
1305
+ hasBadge: { type: Boolean, default: false },
1306
+ modelValue: {}
1307
+ },
1308
+ emits: ["reset", "query"],
1309
+ setup(__props, { emit: __emit }) {
1310
+ const props = __props;
1311
+ const emit = __emit;
1312
+ const { visible, openDrawer, closeDrawer, resetDrawer, queryDrawer, hasBadge } = useFilterDrawer(props, emit);
1313
+ 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);
1363
+ };
1364
+ }
1365
+ });
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;
1377
+ exports.useDropdownSelect = useDropdownSelect;
1378
+ exports.useDropdownWithBadge = useDropdownWithBadge;
1379
+ exports.useFilterDrawer = useFilterDrawer;
1380
+ //# sourceMappingURL=index.cjs.js.map