@kylexd/vant-extend 0.0.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.
- package/README.md +64 -0
- package/dist/components/BaseTip/index.d.ts +1 -0
- package/dist/components/BaseTip/index.vue.d.ts +13 -0
- package/dist/components/CuEmpty/index.d.ts +1 -0
- package/dist/components/CuEmpty/index.vue.d.ts +25 -0
- package/dist/components/CuFloatingPanel/index.d.ts +1 -0
- package/dist/components/CuFloatingPanel/index.vue.d.ts +40 -0
- package/dist/components/CuImage/index.d.ts +1 -0
- package/dist/components/CuImage/index.vue.d.ts +37 -0
- package/dist/components/CuPopup/index.d.ts +1 -0
- package/dist/components/CuPopup/index.vue.d.ts +50 -0
- package/dist/components/CuSelect/index.d.ts +1 -0
- package/dist/components/CuSelect/index.vue.d.ts +32 -0
- package/dist/components/GridImage/index.d.ts +1 -0
- package/dist/components/GridImage/index.vue.d.ts +14 -0
- package/dist/components/Headroom/index.d.ts +1 -0
- package/dist/components/Headroom/index.vue.d.ts +16 -0
- package/dist/components/InputNumber/index.d.ts +1 -0
- package/dist/components/InputNumber/index.vue.d.ts +21 -0
- package/dist/components/SafeBottom/index.d.ts +1 -0
- package/dist/components/SafeBottom/index.vue.d.ts +2 -0
- package/dist/components/SelectDateRange/index.d.ts +1 -0
- package/dist/components/SelectDateRange/index.vue.d.ts +27 -0
- package/dist/components/SortGroup/InjectionKey.d.ts +15 -0
- package/dist/components/SortGroup/index.d.ts +1 -0
- package/dist/components/SortGroup/index.vue.d.ts +32 -0
- package/dist/components/SortItem/index.d.ts +1 -0
- package/dist/components/SortItem/index.vue.d.ts +45 -0
- package/dist/components/ViewportBottomLoad/index.d.ts +1 -0
- package/dist/components/ViewportBottomLoad/index.vue.d.ts +15 -0
- package/dist/composables/debounce.d.ts +4 -0
- package/dist/composables/useDialogRendered.d.ts +5 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +895 -0
- package/dist/types/shared.d.ts +2 -0
- package/package.json +53 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,895 @@
|
|
|
1
|
+
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, inject, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onMounted, openBlock, provide, ref, renderList, renderSlot, resolveComponent, toDisplayString, toRefs, unref, useAttrs, useModel, useTemplateRef, watch, withCtx, withModifiers } from "vue";
|
|
2
|
+
import { showDialog } from "vant";
|
|
3
|
+
import { useElementBounding, useWindowScroll, useWindowSize } from "@vueuse/core";
|
|
4
|
+
import { useGlobalZIndex } from "vant/es/composables/use-global-z-index";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/components/BaseTip/index.vue
|
|
8
|
+
var BaseTip_default = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "index",
|
|
10
|
+
props: {
|
|
11
|
+
size: { default: ".32rem" },
|
|
12
|
+
text: { default: "" },
|
|
13
|
+
title: { default: void 0 },
|
|
14
|
+
confirmButtonColor: { default: "#036af1" }
|
|
15
|
+
},
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
function handleClick() {
|
|
19
|
+
showDialog({
|
|
20
|
+
message: props.text,
|
|
21
|
+
title: props.title,
|
|
22
|
+
theme: "round-button",
|
|
23
|
+
messageAlign: "left",
|
|
24
|
+
confirmButtonColor: props.confirmButtonColor
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return (_ctx, _cache) => {
|
|
28
|
+
const _component_van_icon = resolveComponent("van-icon");
|
|
29
|
+
return openBlock(), createBlock(_component_van_icon, {
|
|
30
|
+
name: "question-o",
|
|
31
|
+
size: __props.size,
|
|
32
|
+
onClick: handleClick
|
|
33
|
+
}, null, 8, ["size"]);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/components/CuEmpty/index.vue
|
|
39
|
+
var CuEmpty_default = /* @__PURE__ */ defineComponent({
|
|
40
|
+
__name: "index",
|
|
41
|
+
props: {
|
|
42
|
+
image: { default: void 0 },
|
|
43
|
+
imageSize: { default: "6.667rem" },
|
|
44
|
+
description: { default: void 0 }
|
|
45
|
+
},
|
|
46
|
+
setup(__props) {
|
|
47
|
+
const props = __props;
|
|
48
|
+
return (_ctx, _cache) => {
|
|
49
|
+
const _component_van_empty = resolveComponent("van-empty");
|
|
50
|
+
return openBlock(), createBlock(_component_van_empty, {
|
|
51
|
+
class: "kv-cu-empty",
|
|
52
|
+
image: props.image,
|
|
53
|
+
"image-size": props.imageSize,
|
|
54
|
+
description: __props.description
|
|
55
|
+
}, createSlots({
|
|
56
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
57
|
+
_: 2
|
|
58
|
+
}, [_ctx.$slots.image ? {
|
|
59
|
+
name: "image",
|
|
60
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "image")]),
|
|
61
|
+
key: "0"
|
|
62
|
+
} : void 0, _ctx.$slots.description ? {
|
|
63
|
+
name: "description",
|
|
64
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "description")]),
|
|
65
|
+
key: "1"
|
|
66
|
+
} : void 0]), 1032, [
|
|
67
|
+
"image",
|
|
68
|
+
"image-size",
|
|
69
|
+
"description"
|
|
70
|
+
]);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region src/components/CuFloatingPanel/index.vue?vue&type=script&setup=true&lang.ts
|
|
76
|
+
var _hoisted_1$8 = { class: "kv-cu-floating-panel-title-row flex items-center px-[30px]" };
|
|
77
|
+
var _hoisted_2$2 = { class: "kv-cu-floating-panel-title flex-1 text-center text-[34px]/[48px] font-bold" };
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/components/CuFloatingPanel/index.vue
|
|
80
|
+
var CuFloatingPanel_default = /* @__PURE__ */ defineComponent({
|
|
81
|
+
__name: "index",
|
|
82
|
+
props: /*@__PURE__*/ mergeModels({
|
|
83
|
+
title: { default: "" },
|
|
84
|
+
zIndex: { default: void 0 },
|
|
85
|
+
heightPercent: { default: .7 },
|
|
86
|
+
panelClass: { default: "" }
|
|
87
|
+
}, {
|
|
88
|
+
"show-panel": { type: Boolean },
|
|
89
|
+
"show-panelModifiers": {}
|
|
90
|
+
}),
|
|
91
|
+
emits: /*@__PURE__*/ mergeModels(["close", "panelChange"], ["update:show-panel"]),
|
|
92
|
+
setup(__props, { emit: __emit }) {
|
|
93
|
+
const emit = __emit;
|
|
94
|
+
const props = __props;
|
|
95
|
+
const showOverlay = useModel(__props, "show-panel");
|
|
96
|
+
const { height: windowHeight } = useWindowSize();
|
|
97
|
+
const anchors = computed(() => [0, Math.round(props.heightPercent * windowHeight.value)]);
|
|
98
|
+
const height = ref(anchors.value[0]);
|
|
99
|
+
const zIndex = ref(props.zIndex);
|
|
100
|
+
function handleClose() {
|
|
101
|
+
height.value = anchors.value[0];
|
|
102
|
+
showOverlay.value = false;
|
|
103
|
+
emit("close");
|
|
104
|
+
}
|
|
105
|
+
function handleOffsetChange(params) {
|
|
106
|
+
if (params.height === 0) {
|
|
107
|
+
showOverlay.value = false;
|
|
108
|
+
emit("close");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
watch(showOverlay, (value) => {
|
|
112
|
+
if (value) {
|
|
113
|
+
zIndex.value = useGlobalZIndex();
|
|
114
|
+
nextTick(() => {
|
|
115
|
+
setTimeout(() => {
|
|
116
|
+
height.value = anchors.value[1];
|
|
117
|
+
}, 0);
|
|
118
|
+
});
|
|
119
|
+
} else height.value = anchors.value[0];
|
|
120
|
+
emit("panelChange", Boolean(value));
|
|
121
|
+
});
|
|
122
|
+
return (_ctx, _cache) => {
|
|
123
|
+
const _component_van_icon = resolveComponent("van-icon");
|
|
124
|
+
const _component_van_floating_panel = resolveComponent("van-floating-panel");
|
|
125
|
+
const _component_van_overlay = resolveComponent("van-overlay");
|
|
126
|
+
return openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(_component_van_overlay, {
|
|
127
|
+
show: showOverlay.value,
|
|
128
|
+
"z-index": zIndex.value,
|
|
129
|
+
"lock-scroll": false,
|
|
130
|
+
onClick: handleClose
|
|
131
|
+
}, {
|
|
132
|
+
default: withCtx(() => [createVNode(_component_van_floating_panel, {
|
|
133
|
+
height: height.value,
|
|
134
|
+
"onUpdate:height": _cache[0] || (_cache[0] = ($event) => height.value = $event),
|
|
135
|
+
duration: .3,
|
|
136
|
+
anchors: anchors.value,
|
|
137
|
+
"content-draggable": false,
|
|
138
|
+
"safe-area-inset-bottom": true,
|
|
139
|
+
class: normalizeClass(["kv-cu-floating-panel !left-[50%] max-w-[750px] !translate-x-[-50%] [&::after]:max-w-[750px]", __props.panelClass]),
|
|
140
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
|
|
141
|
+
onHeightChange: handleOffsetChange
|
|
142
|
+
}, {
|
|
143
|
+
header: withCtx(() => [renderSlot(_ctx.$slots, "header", { close: handleClose }, () => [_cache[3] || (_cache[3] = createElementVNode("div", { class: "kv-cu-floating-panel-handle flex h-[50px] items-center justify-center" }, [createElementVNode("span", { class: "kv-cu-floating-panel-handle-bar inline-block h-[10px] w-[70px] rounded-[10px] bg-[#CECECE]" })], -1)), createElementVNode("div", _hoisted_1$8, [
|
|
144
|
+
_cache[2] || (_cache[2] = createElementVNode("div", { class: "kv-cu-floating-panel-title-left w-[40px]" }, null, -1)),
|
|
145
|
+
createElementVNode("div", _hoisted_2$2, toDisplayString(__props.title), 1),
|
|
146
|
+
createElementVNode("div", {
|
|
147
|
+
class: "kv-cu-floating-panel-close flex w-[40px] items-center justify-center",
|
|
148
|
+
onClick: handleClose
|
|
149
|
+
}, [createVNode(_component_van_icon, {
|
|
150
|
+
name: "cross",
|
|
151
|
+
size: ".533rem",
|
|
152
|
+
color: "#1F1F1F"
|
|
153
|
+
})])
|
|
154
|
+
])])]),
|
|
155
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
156
|
+
_: 3
|
|
157
|
+
}, 8, [
|
|
158
|
+
"height",
|
|
159
|
+
"anchors",
|
|
160
|
+
"class"
|
|
161
|
+
])]),
|
|
162
|
+
_: 3
|
|
163
|
+
}, 8, ["show", "z-index"])]);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/components/CuImage/index.vue?vue&type=script&setup=true&lang.ts
|
|
169
|
+
var _hoisted_1$7 = ["src"];
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/components/CuImage/index.vue
|
|
172
|
+
var CuImage_default = /* @__PURE__ */ defineComponent({
|
|
173
|
+
__name: "index",
|
|
174
|
+
props: {
|
|
175
|
+
src: { default: "" },
|
|
176
|
+
fallbackSrc: { default: "" },
|
|
177
|
+
thumbnail: {
|
|
178
|
+
type: [Object, Boolean],
|
|
179
|
+
default: false
|
|
180
|
+
},
|
|
181
|
+
formatSrc: {
|
|
182
|
+
type: Function,
|
|
183
|
+
default: void 0
|
|
184
|
+
},
|
|
185
|
+
noReferrer: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: false
|
|
188
|
+
},
|
|
189
|
+
noReferrerHosts: { default: () => ["cbu01.alicdn.com"] },
|
|
190
|
+
loadingSize: { default: 20 }
|
|
191
|
+
},
|
|
192
|
+
setup(__props) {
|
|
193
|
+
const props = __props;
|
|
194
|
+
const attrs = useAttrs();
|
|
195
|
+
const imageSrc = computed(() => {
|
|
196
|
+
if (!props.src) return props.fallbackSrc;
|
|
197
|
+
if (props.thumbnail && props.formatSrc) return props.formatSrc(props.src, props.thumbnail === true ? void 0 : props.thumbnail);
|
|
198
|
+
return props.src;
|
|
199
|
+
});
|
|
200
|
+
const isNoReferrerImage = computed(() => {
|
|
201
|
+
if (props.noReferrer) return true;
|
|
202
|
+
return props.noReferrerHosts.some((host) => props.src?.includes(host));
|
|
203
|
+
});
|
|
204
|
+
return (_ctx, _cache) => {
|
|
205
|
+
const _component_van_loading = resolveComponent("van-loading");
|
|
206
|
+
const _component_van_image = resolveComponent("van-image");
|
|
207
|
+
return openBlock(), createBlock(_component_van_image, mergeProps(unref(attrs), {
|
|
208
|
+
class: "kv-cu-image",
|
|
209
|
+
src: imageSrc.value,
|
|
210
|
+
referrerpolicy: isNoReferrerImage.value ? "no-referrer" : void 0
|
|
211
|
+
}), {
|
|
212
|
+
loading: withCtx(() => [renderSlot(_ctx.$slots, "loading", {}, () => [createVNode(_component_van_loading, {
|
|
213
|
+
type: "spinner",
|
|
214
|
+
size: __props.loadingSize
|
|
215
|
+
}, null, 8, ["size"])])]),
|
|
216
|
+
error: withCtx(() => [renderSlot(_ctx.$slots, "error", {}, () => [__props.fallbackSrc ? (openBlock(), createElementBlock("img", {
|
|
217
|
+
key: 0,
|
|
218
|
+
src: __props.fallbackSrc,
|
|
219
|
+
alt: "",
|
|
220
|
+
class: "kv-cu-image-fallback h-full w-full object-cover"
|
|
221
|
+
}, null, 8, _hoisted_1$7)) : createCommentVNode("", true)])]),
|
|
222
|
+
_: 3
|
|
223
|
+
}, 16, ["src", "referrerpolicy"]);
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/composables/useDialogRendered.ts
|
|
229
|
+
function useDialogRendered(visible) {
|
|
230
|
+
const isRendered = ref(false);
|
|
231
|
+
watch(() => visible.value, (value) => {
|
|
232
|
+
if (value) isRendered.value = true;
|
|
233
|
+
}, { immediate: true });
|
|
234
|
+
function bindClosed() {
|
|
235
|
+
isRendered.value = false;
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
isRendered,
|
|
239
|
+
bindClosed
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/components/CuPopup/index.vue?vue&type=script&setup=true&lang.ts
|
|
244
|
+
var _hoisted_1$6 = { class: "kv-cu-popup-container flex h-full flex-col" };
|
|
245
|
+
var _hoisted_2$1 = { class: "kv-cu-popup-body flex-1 overflow-hidden" };
|
|
246
|
+
var _hoisted_3 = { class: "kv-cu-popup-footer sticky bottom-0 mt-auto" };
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/components/CuPopup/index.vue
|
|
249
|
+
var CuPopup_default = /* @__PURE__ */ defineComponent({
|
|
250
|
+
__name: "index",
|
|
251
|
+
props: /*@__PURE__*/ mergeModels({
|
|
252
|
+
title: { default: "" },
|
|
253
|
+
teleport: { default: "body" },
|
|
254
|
+
position: { default: "bottom" },
|
|
255
|
+
contentClass: { default: "" },
|
|
256
|
+
headerClass: { default: "" },
|
|
257
|
+
popupClass: { default: "" },
|
|
258
|
+
height: { default: "80%" },
|
|
259
|
+
closeable: {
|
|
260
|
+
type: Boolean,
|
|
261
|
+
default: true
|
|
262
|
+
},
|
|
263
|
+
round: {
|
|
264
|
+
type: Boolean,
|
|
265
|
+
default: true
|
|
266
|
+
}
|
|
267
|
+
}, {
|
|
268
|
+
"show": { type: Boolean },
|
|
269
|
+
"showModifiers": {}
|
|
270
|
+
}),
|
|
271
|
+
emits: /*@__PURE__*/ mergeModels(["close", "closed"], ["update:show"]),
|
|
272
|
+
setup(__props, { emit: __emit }) {
|
|
273
|
+
const emit = __emit;
|
|
274
|
+
const show = useModel(__props, "show");
|
|
275
|
+
const { isRendered, bindClosed } = useDialogRendered(show);
|
|
276
|
+
function handleClose() {
|
|
277
|
+
emit("close");
|
|
278
|
+
}
|
|
279
|
+
function handleClosed() {
|
|
280
|
+
bindClosed();
|
|
281
|
+
emit("closed");
|
|
282
|
+
}
|
|
283
|
+
return (_ctx, _cache) => {
|
|
284
|
+
const _component_van_popup = resolveComponent("van-popup");
|
|
285
|
+
return unref(isRendered) ? (openBlock(), createBlock(_component_van_popup, {
|
|
286
|
+
key: 0,
|
|
287
|
+
show: show.value,
|
|
288
|
+
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => show.value = $event),
|
|
289
|
+
"safe-area-inset-bottom": "",
|
|
290
|
+
class: normalizeClass(["kv-cu-popup h-[80%] overflow-hidden", __props.popupClass]),
|
|
291
|
+
style: normalizeStyle({ height: __props.height }),
|
|
292
|
+
teleport: __props.teleport,
|
|
293
|
+
position: __props.position,
|
|
294
|
+
round: __props.round,
|
|
295
|
+
closeable: __props.closeable,
|
|
296
|
+
"transition-appear": true,
|
|
297
|
+
onClosed: handleClosed,
|
|
298
|
+
onClose: handleClose
|
|
299
|
+
}, {
|
|
300
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1$6, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("div", { class: normalizeClass(["kv-cu-popup-header py-[30px] text-center text-[34px]/[48px] font-bold", [__props.popupClass ? "bg-transparent" : "bg-white", __props.headerClass]]) }, toDisplayString(__props.title), 3)]), createElementVNode("div", _hoisted_2$1, [createElementVNode("div", { class: normalizeClass(["kv-cu-popup-content flex h-full flex-col overflow-y-auto", __props.contentClass]) }, [renderSlot(_ctx.$slots, "default"), createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "footer")])], 2)])])]),
|
|
301
|
+
_: 3
|
|
302
|
+
}, 8, [
|
|
303
|
+
"show",
|
|
304
|
+
"class",
|
|
305
|
+
"style",
|
|
306
|
+
"teleport",
|
|
307
|
+
"position",
|
|
308
|
+
"round",
|
|
309
|
+
"closeable"
|
|
310
|
+
])) : createCommentVNode("", true);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/components/CuSelect/index.vue
|
|
316
|
+
var CuSelect_default = /* @__PURE__ */ defineComponent({
|
|
317
|
+
__name: "index",
|
|
318
|
+
props: /*@__PURE__*/ mergeModels({
|
|
319
|
+
required: { type: Boolean },
|
|
320
|
+
inputAlign: {},
|
|
321
|
+
border: { type: Boolean },
|
|
322
|
+
title: { default: "" },
|
|
323
|
+
actions: { default: () => [] },
|
|
324
|
+
placeholder: { default: "Select" },
|
|
325
|
+
cancelText: { default: "Cancel" },
|
|
326
|
+
type: { default: "cell" },
|
|
327
|
+
disabled: {
|
|
328
|
+
type: Boolean,
|
|
329
|
+
default: false
|
|
330
|
+
}
|
|
331
|
+
}, {
|
|
332
|
+
"modelValue": {},
|
|
333
|
+
"modelModifiers": {}
|
|
334
|
+
}),
|
|
335
|
+
emits: ["update:modelValue"],
|
|
336
|
+
setup(__props) {
|
|
337
|
+
const props = __props;
|
|
338
|
+
const { title, placeholder, required, border, type, inputAlign, disabled } = toRefs(props);
|
|
339
|
+
const modelValue = useModel(__props, "modelValue");
|
|
340
|
+
const show = ref(false);
|
|
341
|
+
const actionsList = computed(() => props.actions.map((item) => ({
|
|
342
|
+
name: item.label,
|
|
343
|
+
value: item.value,
|
|
344
|
+
disabled: item.disabled
|
|
345
|
+
})));
|
|
346
|
+
const actionLabel = computed(() => {
|
|
347
|
+
return actionsList.value.find((item) => item.value === modelValue.value)?.name;
|
|
348
|
+
});
|
|
349
|
+
function handleCancel() {
|
|
350
|
+
show.value = false;
|
|
351
|
+
}
|
|
352
|
+
function handleSelect(item) {
|
|
353
|
+
modelValue.value = item.value;
|
|
354
|
+
show.value = false;
|
|
355
|
+
}
|
|
356
|
+
function handleOpen() {
|
|
357
|
+
if (!props.disabled) show.value = true;
|
|
358
|
+
}
|
|
359
|
+
return (_ctx, _cache) => {
|
|
360
|
+
const _component_van_icon = resolveComponent("van-icon");
|
|
361
|
+
const _component_van_action_sheet = resolveComponent("van-action-sheet");
|
|
362
|
+
const _component_van_cell = resolveComponent("van-cell");
|
|
363
|
+
const _component_van_field = resolveComponent("van-field");
|
|
364
|
+
return openBlock(), createElementBlock(Fragment, null, [unref(type) === "cell" ? (openBlock(), createBlock(_component_van_cell, {
|
|
365
|
+
key: 0,
|
|
366
|
+
title: unref(title),
|
|
367
|
+
border: unref(border),
|
|
368
|
+
required: unref(required),
|
|
369
|
+
class: "kv-cu-select-cell rounded-[16px]"
|
|
370
|
+
}, {
|
|
371
|
+
value: withCtx(() => [createElementVNode("span", {
|
|
372
|
+
class: normalizeClass(["kv-cu-select-value", [{
|
|
373
|
+
"!text-[#1f1f1f]": actionLabel.value && !unref(disabled),
|
|
374
|
+
"!text-[#999]": unref(disabled)
|
|
375
|
+
}]]),
|
|
376
|
+
onClick: handleOpen
|
|
377
|
+
}, [createTextVNode(toDisplayString(actionLabel.value ?? unref(placeholder)) + " ", 1), createVNode(_component_van_icon, { name: "arrow" })], 2), createVNode(_component_van_action_sheet, {
|
|
378
|
+
show: show.value,
|
|
379
|
+
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => show.value = $event),
|
|
380
|
+
teleport: "body",
|
|
381
|
+
actions: actionsList.value,
|
|
382
|
+
"cancel-text": __props.cancelText,
|
|
383
|
+
"close-on-click-action": "",
|
|
384
|
+
onCancel: handleCancel,
|
|
385
|
+
onSelect: handleSelect
|
|
386
|
+
}, null, 8, [
|
|
387
|
+
"show",
|
|
388
|
+
"actions",
|
|
389
|
+
"cancel-text"
|
|
390
|
+
])]),
|
|
391
|
+
_: 1
|
|
392
|
+
}, 8, [
|
|
393
|
+
"title",
|
|
394
|
+
"border",
|
|
395
|
+
"required"
|
|
396
|
+
])) : createCommentVNode("", true), unref(type) === "field" ? (openBlock(), createBlock(_component_van_field, {
|
|
397
|
+
key: 1,
|
|
398
|
+
label: unref(title),
|
|
399
|
+
border: unref(border),
|
|
400
|
+
required: unref(required),
|
|
401
|
+
class: "kv-cu-select-field rounded-[16px]",
|
|
402
|
+
"input-align": unref(inputAlign)
|
|
403
|
+
}, {
|
|
404
|
+
input: withCtx(() => [createElementVNode("span", {
|
|
405
|
+
class: normalizeClass(["kv-cu-select-value", [{
|
|
406
|
+
"!text-[#1f1f1f]": actionLabel.value && !unref(disabled),
|
|
407
|
+
"!text-[#999]": unref(disabled)
|
|
408
|
+
}]]),
|
|
409
|
+
onClick: handleOpen
|
|
410
|
+
}, [createTextVNode(toDisplayString(actionLabel.value ?? unref(placeholder)) + " ", 1), createVNode(_component_van_icon, { name: "arrow" })], 2), createVNode(_component_van_action_sheet, {
|
|
411
|
+
show: show.value,
|
|
412
|
+
"onUpdate:show": _cache[1] || (_cache[1] = ($event) => show.value = $event),
|
|
413
|
+
teleport: "body",
|
|
414
|
+
actions: actionsList.value,
|
|
415
|
+
"cancel-text": __props.cancelText,
|
|
416
|
+
"close-on-click-action": "",
|
|
417
|
+
onCancel: handleCancel,
|
|
418
|
+
onSelect: handleSelect
|
|
419
|
+
}, null, 8, [
|
|
420
|
+
"show",
|
|
421
|
+
"actions",
|
|
422
|
+
"cancel-text"
|
|
423
|
+
])]),
|
|
424
|
+
_: 1
|
|
425
|
+
}, 8, [
|
|
426
|
+
"label",
|
|
427
|
+
"border",
|
|
428
|
+
"required",
|
|
429
|
+
"input-align"
|
|
430
|
+
])) : createCommentVNode("", true)], 64);
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/components/GridImage/index.vue?vue&type=script&setup=true&lang.ts
|
|
436
|
+
var _hoisted_1$5 = { class: "kv-grid-image relative overflow-hidden rounded-[20px] bg-[#f8f8f8]" };
|
|
437
|
+
var _hoisted_2 = {
|
|
438
|
+
key: 0,
|
|
439
|
+
class: "kv-grid-image-count absolute bottom-0 h-[40px] w-[100%] bg-[rgba(0,0,0,0.2)] text-center text-[20px]/[40px] text-[#ffffff]"
|
|
440
|
+
};
|
|
441
|
+
//#endregion
|
|
442
|
+
//#region src/components/GridImage/index.vue
|
|
443
|
+
var GridImage_default = /* @__PURE__ */ defineComponent({
|
|
444
|
+
__name: "index",
|
|
445
|
+
props: {
|
|
446
|
+
imageList: {},
|
|
447
|
+
imageIconSize: { default: 16 },
|
|
448
|
+
count: { default: void 0 },
|
|
449
|
+
countText: { default: "Items" },
|
|
450
|
+
fallbackSrc: { default: "" }
|
|
451
|
+
},
|
|
452
|
+
setup(__props) {
|
|
453
|
+
return (_ctx, _cache) => {
|
|
454
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [createElementVNode("div", { class: normalizeClass(["kv-grid-image-list grid h-[100%]", {
|
|
455
|
+
"grid-cols-1": __props.imageList.length === 1,
|
|
456
|
+
"grid-cols-2 grid-rows-2": __props.imageList.length > 1 && __props.imageList.length <= 4,
|
|
457
|
+
"grid-cols-3 grid-rows-3": __props.imageList.length > 4
|
|
458
|
+
}]) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.imageList.slice(0, 9), (image) => {
|
|
459
|
+
return openBlock(), createBlock(CuImage_default, {
|
|
460
|
+
key: image,
|
|
461
|
+
class: "kv-grid-image-item",
|
|
462
|
+
src: image,
|
|
463
|
+
"fallback-src": __props.fallbackSrc,
|
|
464
|
+
"icon-size": __props.imageIconSize ?? 16
|
|
465
|
+
}, null, 8, [
|
|
466
|
+
"src",
|
|
467
|
+
"fallback-src",
|
|
468
|
+
"icon-size"
|
|
469
|
+
]);
|
|
470
|
+
}), 128))], 2), __props.count && __props.count > 1 ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(__props.countText) + " " + toDisplayString(__props.count), 1)) : createCommentVNode("", true)]);
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region src/components/Headroom/index.vue
|
|
476
|
+
var Headroom_default = /* @__PURE__ */ defineComponent({
|
|
477
|
+
__name: "index",
|
|
478
|
+
props: {
|
|
479
|
+
basicTop: {},
|
|
480
|
+
class: {}
|
|
481
|
+
},
|
|
482
|
+
setup(__props) {
|
|
483
|
+
const props = __props;
|
|
484
|
+
const { y } = useWindowScroll();
|
|
485
|
+
const headroomRef = useTemplateRef("headroomRef");
|
|
486
|
+
const placeholderRef = useTemplateRef("placeholderRef");
|
|
487
|
+
const { height } = useElementBounding(headroomRef);
|
|
488
|
+
const { top } = useElementBounding(placeholderRef);
|
|
489
|
+
const style = ref({});
|
|
490
|
+
function hiddenStyle() {
|
|
491
|
+
return { top: `${-height.value}px` };
|
|
492
|
+
}
|
|
493
|
+
function visibleStyle(extra) {
|
|
494
|
+
return {
|
|
495
|
+
top: `${props.basicTop ?? 0}px`,
|
|
496
|
+
...extra
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
function updateStyle(isDownWard) {
|
|
500
|
+
const baseTop = props.basicTop ?? 0;
|
|
501
|
+
if (isDownWard) style.value = hiddenStyle();
|
|
502
|
+
else if (top.value <= baseTop) style.value = visibleStyle(top.value === baseTop ? { transition: "none" } : void 0);
|
|
503
|
+
else if (top.value > baseTop && top.value < height.value + baseTop) style.value = visibleStyle();
|
|
504
|
+
else style.value = hiddenStyle();
|
|
505
|
+
}
|
|
506
|
+
onMounted(() => {
|
|
507
|
+
nextTick(() => {
|
|
508
|
+
style.value = hiddenStyle();
|
|
509
|
+
});
|
|
510
|
+
});
|
|
511
|
+
watch(y, (newVal, oldVal) => {
|
|
512
|
+
updateStyle(newVal > oldVal);
|
|
513
|
+
});
|
|
514
|
+
return (_ctx, _cache) => {
|
|
515
|
+
return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", {
|
|
516
|
+
ref_key: "headroomRef",
|
|
517
|
+
ref: headroomRef,
|
|
518
|
+
class: normalizeClass(["kv-headroom sticky z-10 transition-[top] duration-500", props.class]),
|
|
519
|
+
style: normalizeStyle(style.value)
|
|
520
|
+
}, [renderSlot(_ctx.$slots, "default")], 6), createElementVNode("div", {
|
|
521
|
+
ref_key: "placeholderRef",
|
|
522
|
+
ref: placeholderRef,
|
|
523
|
+
class: "kv-headroom-placeholder placeholder"
|
|
524
|
+
}, null, 512)], 64);
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/components/InputNumber/index.vue?vue&type=script&setup=true&lang.ts
|
|
530
|
+
var _hoisted_1$4 = { class: "kv-input-number inline-flex h-[48px] w-[147px] items-center rounded-[26px] bg-[#f8f8f8] px-[12px]" };
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region src/components/InputNumber/index.vue
|
|
533
|
+
var InputNumber_default = /* @__PURE__ */ defineComponent({
|
|
534
|
+
__name: "index",
|
|
535
|
+
props: /*@__PURE__*/ mergeModels({
|
|
536
|
+
min: { default: 0 },
|
|
537
|
+
max: { default: Number.POSITIVE_INFINITY },
|
|
538
|
+
disabled: {
|
|
539
|
+
type: Boolean,
|
|
540
|
+
default: false
|
|
541
|
+
}
|
|
542
|
+
}, {
|
|
543
|
+
"modelValue": {},
|
|
544
|
+
"modelModifiers": {}
|
|
545
|
+
}),
|
|
546
|
+
emits: /*@__PURE__*/ mergeModels(["change"], ["update:modelValue"]),
|
|
547
|
+
setup(__props, { emit: __emit }) {
|
|
548
|
+
const emit = __emit;
|
|
549
|
+
const props = __props;
|
|
550
|
+
const modelValue = useModel(__props, "modelValue");
|
|
551
|
+
const minusDisabled = computed(() => props.disabled || (modelValue.value ?? 0) <= props.min);
|
|
552
|
+
const plusDisabled = computed(() => props.disabled || (modelValue.value ?? 0) >= props.max);
|
|
553
|
+
function updateValue(value) {
|
|
554
|
+
modelValue.value = value;
|
|
555
|
+
emit("change", value);
|
|
556
|
+
}
|
|
557
|
+
function normalize(value) {
|
|
558
|
+
if (Number.isNaN(value)) return void 0;
|
|
559
|
+
return Math.min(Math.max(value, props.min), props.max);
|
|
560
|
+
}
|
|
561
|
+
function handleMinus() {
|
|
562
|
+
if (minusDisabled.value) return;
|
|
563
|
+
updateValue(normalize((modelValue.value ?? 0) - 1));
|
|
564
|
+
}
|
|
565
|
+
function handlePlus() {
|
|
566
|
+
if (plusDisabled.value) return;
|
|
567
|
+
updateValue(normalize((modelValue.value ?? 0) + 1));
|
|
568
|
+
}
|
|
569
|
+
function handleChange(value) {
|
|
570
|
+
updateValue(normalize(Number(value)));
|
|
571
|
+
}
|
|
572
|
+
return (_ctx, _cache) => {
|
|
573
|
+
const _component_van_icon = resolveComponent("van-icon");
|
|
574
|
+
const _component_van_field = resolveComponent("van-field");
|
|
575
|
+
return openBlock(), createElementBlock("span", _hoisted_1$4, [
|
|
576
|
+
createVNode(_component_van_icon, {
|
|
577
|
+
class: "kv-input-number-minus",
|
|
578
|
+
name: "minus",
|
|
579
|
+
size: ".373rem",
|
|
580
|
+
color: minusDisabled.value ? "rgba(3, 106, 241, 0.16)" : "#036af1",
|
|
581
|
+
onClick: handleMinus
|
|
582
|
+
}, null, 8, ["color"]),
|
|
583
|
+
createVNode(_component_van_field, {
|
|
584
|
+
"model-value": modelValue.value,
|
|
585
|
+
type: "number",
|
|
586
|
+
class: "kv-input-number-field !bg-transparent !p-[0px] [&_.van-field__control]:!text-center",
|
|
587
|
+
disabled: __props.disabled,
|
|
588
|
+
"onUpdate:modelValue": handleChange
|
|
589
|
+
}, null, 8, ["model-value", "disabled"]),
|
|
590
|
+
createVNode(_component_van_icon, {
|
|
591
|
+
class: "kv-input-number-plus",
|
|
592
|
+
name: "plus",
|
|
593
|
+
size: ".373rem",
|
|
594
|
+
color: plusDisabled.value ? "rgba(3, 106, 241, 0.16)" : "#036af1",
|
|
595
|
+
onClick: handlePlus
|
|
596
|
+
}, null, 8, ["color"])
|
|
597
|
+
]);
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region \0plugin-vue:export-helper
|
|
603
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
604
|
+
const target = sfc.__vccOpts || sfc;
|
|
605
|
+
for (const [key, val] of props) target[key] = val;
|
|
606
|
+
return target;
|
|
607
|
+
};
|
|
608
|
+
//#endregion
|
|
609
|
+
//#region src/components/SafeBottom/index.vue
|
|
610
|
+
var _sfc_main = {};
|
|
611
|
+
var _hoisted_1$3 = { class: "kv-safe-bottom h-[env(safe-area-inset-bottom)] transition-[height] duration-300" };
|
|
612
|
+
function _sfc_render(_ctx, _cache) {
|
|
613
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3);
|
|
614
|
+
}
|
|
615
|
+
var SafeBottom_default = /*#__PURE__*/ _plugin_vue_export_helper_default(_sfc_main, [["render", _sfc_render]]);
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region src/components/SelectDateRange/index.vue?vue&type=script&setup=true&lang.ts
|
|
618
|
+
var _hoisted_1$2 = { class: "kv-date-range flex items-center gap-[30px]" };
|
|
619
|
+
//#endregion
|
|
620
|
+
//#region src/components/SelectDateRange/index.vue
|
|
621
|
+
var SelectDateRange_default = /* @__PURE__ */ defineComponent({
|
|
622
|
+
__name: "index",
|
|
623
|
+
props: /*@__PURE__*/ mergeModels({
|
|
624
|
+
minDate: { default: () => dayjs("2024-01-01").toDate() },
|
|
625
|
+
maxDate: { default: void 0 },
|
|
626
|
+
startPlaceholder: { default: "Start date" },
|
|
627
|
+
endPlaceholder: { default: "End date" },
|
|
628
|
+
dateFormat: { default: "YYYY-MM-DD" },
|
|
629
|
+
teleport: { default: "body" }
|
|
630
|
+
}, {
|
|
631
|
+
"startTime": {},
|
|
632
|
+
"startTimeModifiers": {},
|
|
633
|
+
"endTime": {},
|
|
634
|
+
"endTimeModifiers": {}
|
|
635
|
+
}),
|
|
636
|
+
emits: ["update:startTime", "update:endTime"],
|
|
637
|
+
setup(__props) {
|
|
638
|
+
const props = __props;
|
|
639
|
+
const startTime = useModel(__props, "startTime");
|
|
640
|
+
const endTime = useModel(__props, "endTime");
|
|
641
|
+
const show = ref(false);
|
|
642
|
+
const today = dayjs().toDate();
|
|
643
|
+
const range = computed({
|
|
644
|
+
set(value) {
|
|
645
|
+
startTime.value = dayjs(value[0]).format(props.dateFormat);
|
|
646
|
+
endTime.value = dayjs(value[1]).format(props.dateFormat);
|
|
647
|
+
},
|
|
648
|
+
get() {
|
|
649
|
+
if (startTime.value && endTime.value) return [dayjs(startTime.value).toDate(), dayjs(endTime.value).toDate()];
|
|
650
|
+
return [today, today];
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
function handleShow() {
|
|
654
|
+
show.value = true;
|
|
655
|
+
}
|
|
656
|
+
function onConfirm(date) {
|
|
657
|
+
range.value = date;
|
|
658
|
+
show.value = false;
|
|
659
|
+
}
|
|
660
|
+
return (_ctx, _cache) => {
|
|
661
|
+
const _component_van_button = resolveComponent("van-button");
|
|
662
|
+
const _component_van_calendar = resolveComponent("van-calendar");
|
|
663
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
664
|
+
createVNode(_component_van_button, {
|
|
665
|
+
size: "small",
|
|
666
|
+
round: "",
|
|
667
|
+
plain: "",
|
|
668
|
+
type: startTime.value ? "primary" : "default",
|
|
669
|
+
class: normalizeClass(["kv-date-range-start flex-1 !border-[2px]", [startTime.value ? "!bg-[#FFF8F2]" : "!border-[#F8F8F8] !bg-[#F8F8F8]"]]),
|
|
670
|
+
onClick: handleShow
|
|
671
|
+
}, {
|
|
672
|
+
default: withCtx(() => [createTextVNode(toDisplayString(startTime.value || __props.startPlaceholder), 1)]),
|
|
673
|
+
_: 1
|
|
674
|
+
}, 8, ["type", "class"]),
|
|
675
|
+
createVNode(_component_van_button, {
|
|
676
|
+
size: "small",
|
|
677
|
+
round: "",
|
|
678
|
+
plain: "",
|
|
679
|
+
type: startTime.value ? "primary" : "default",
|
|
680
|
+
class: normalizeClass(["kv-date-range-end flex-1 !border-[2px]", [startTime.value ? "!bg-[#FFF8F2]" : "!border-[#F8F8F8] !bg-[#F8F8F8]"]]),
|
|
681
|
+
onClick: handleShow
|
|
682
|
+
}, {
|
|
683
|
+
default: withCtx(() => [createTextVNode(toDisplayString(endTime.value || __props.endPlaceholder), 1)]),
|
|
684
|
+
_: 1
|
|
685
|
+
}, 8, ["type", "class"]),
|
|
686
|
+
createVNode(_component_van_calendar, {
|
|
687
|
+
class: "kv-date-range-calendar",
|
|
688
|
+
show: show.value,
|
|
689
|
+
"onUpdate:show": _cache[0] || (_cache[0] = ($event) => show.value = $event),
|
|
690
|
+
type: "range",
|
|
691
|
+
"default-date": range.value,
|
|
692
|
+
"safe-area-inset-bottom": true,
|
|
693
|
+
"min-date": __props.minDate,
|
|
694
|
+
"max-date": __props.maxDate,
|
|
695
|
+
teleport: __props.teleport,
|
|
696
|
+
onConfirm
|
|
697
|
+
}, null, 8, [
|
|
698
|
+
"show",
|
|
699
|
+
"default-date",
|
|
700
|
+
"min-date",
|
|
701
|
+
"max-date",
|
|
702
|
+
"teleport"
|
|
703
|
+
])
|
|
704
|
+
]);
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/components/SortGroup/InjectionKey.ts
|
|
710
|
+
var sortGroupKey = Symbol("sortGroup");
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/components/SortGroup/index.vue?vue&type=script&setup=true&lang.ts
|
|
713
|
+
var _hoisted_1$1 = { class: "kv-sort-group sort-group" };
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region src/components/SortGroup/index.vue
|
|
716
|
+
var SortGroup_default = /* @__PURE__ */ defineComponent({
|
|
717
|
+
__name: "index",
|
|
718
|
+
props: {
|
|
719
|
+
"modelValue": {},
|
|
720
|
+
"modelModifiers": {},
|
|
721
|
+
"activeValue": { default: void 0 },
|
|
722
|
+
"activeValueModifiers": {}
|
|
723
|
+
},
|
|
724
|
+
emits: /*@__PURE__*/ mergeModels(["change"], ["update:modelValue", "update:activeValue"]),
|
|
725
|
+
setup(__props, { emit: __emit }) {
|
|
726
|
+
const modelValue = useModel(__props, "modelValue");
|
|
727
|
+
const modelActiveValue = useModel(__props, "activeValue");
|
|
728
|
+
const emit = __emit;
|
|
729
|
+
provide(sortGroupKey, {
|
|
730
|
+
modelValue,
|
|
731
|
+
modelActiveValue,
|
|
732
|
+
setGroupModelValue: ({ value, activeValue }) => {
|
|
733
|
+
modelValue.value = value;
|
|
734
|
+
modelActiveValue.value = activeValue;
|
|
735
|
+
},
|
|
736
|
+
emitChange: ({ value, activeValue }) => {
|
|
737
|
+
emit("change", {
|
|
738
|
+
value,
|
|
739
|
+
activeValue
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
return (_ctx, _cache) => {
|
|
744
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [renderSlot(_ctx.$slots, "default")]);
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/components/SortItem/index.vue?vue&type=script&setup=true&lang.ts
|
|
750
|
+
var _hoisted_1 = { class: "kv-sort-item sort-item inline-flex select-none items-center gap-[10px]" };
|
|
751
|
+
//#endregion
|
|
752
|
+
//#region src/components/SortItem/index.vue
|
|
753
|
+
var SortItem_default = /* @__PURE__ */ defineComponent({
|
|
754
|
+
__name: "index",
|
|
755
|
+
props: /*@__PURE__*/ mergeModels({
|
|
756
|
+
title: {},
|
|
757
|
+
ascValue: { default: "asc" },
|
|
758
|
+
descValue: { default: "desc" },
|
|
759
|
+
activeValue: { default: void 0 },
|
|
760
|
+
sort: { default: void 0 },
|
|
761
|
+
activeColor: { default: "#036af1" },
|
|
762
|
+
color: { default: "#333333" },
|
|
763
|
+
iconColor: { default: "#333333" },
|
|
764
|
+
loopEmptyValue: {
|
|
765
|
+
type: Boolean,
|
|
766
|
+
default: true
|
|
767
|
+
}
|
|
768
|
+
}, {
|
|
769
|
+
"modelValue": {},
|
|
770
|
+
"modelModifiers": {}
|
|
771
|
+
}),
|
|
772
|
+
emits: /*@__PURE__*/ mergeModels(["change"], ["update:modelValue"]),
|
|
773
|
+
setup(__props, { emit: __emit }) {
|
|
774
|
+
const props = __props;
|
|
775
|
+
const { color, iconColor, activeColor } = toRefs(props);
|
|
776
|
+
const emit = __emit;
|
|
777
|
+
const modelValue = useModel(__props, "modelValue");
|
|
778
|
+
const sortGroup = inject(sortGroupKey);
|
|
779
|
+
const state = computed(() => {
|
|
780
|
+
const currentValue = sortGroup ? sortGroup.modelValue.value : modelValue.value;
|
|
781
|
+
const currentActiveValue = sortGroup ? sortGroup.modelActiveValue.value : props.activeValue;
|
|
782
|
+
return {
|
|
783
|
+
isAsc: currentValue === props.ascValue && currentActiveValue === props.activeValue,
|
|
784
|
+
isDesc: currentValue === props.descValue && currentActiveValue === props.activeValue
|
|
785
|
+
};
|
|
786
|
+
});
|
|
787
|
+
const valueList = computed(() => props.loopEmptyValue ? [
|
|
788
|
+
props.ascValue,
|
|
789
|
+
props.descValue,
|
|
790
|
+
void 0
|
|
791
|
+
] : [props.ascValue, props.descValue]);
|
|
792
|
+
function handleClick() {
|
|
793
|
+
const currentValue = sortGroup ? sortGroup.modelValue.value : modelValue.value;
|
|
794
|
+
const index = sortGroup?.modelActiveValue.value === props.activeValue ? valueList.value.indexOf(currentValue) : -1;
|
|
795
|
+
const nextIndex = index + 1 >= valueList.value.length ? 0 : index + 1;
|
|
796
|
+
const nextValue = valueList.value[nextIndex];
|
|
797
|
+
modelValue.value = nextValue;
|
|
798
|
+
sortGroup?.setGroupModelValue({
|
|
799
|
+
value: nextValue,
|
|
800
|
+
activeValue: nextValue ? props.activeValue : void 0
|
|
801
|
+
});
|
|
802
|
+
emit("change", nextValue);
|
|
803
|
+
sortGroup?.emitChange({
|
|
804
|
+
value: nextValue,
|
|
805
|
+
activeValue: nextValue ? props.activeValue : void 0
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
return (_ctx, _cache) => {
|
|
809
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("button", {
|
|
810
|
+
type: "button",
|
|
811
|
+
class: "kv-sort-item-title sort-item-title cursor-pointer border-0 bg-transparent p-0 text-[24px]",
|
|
812
|
+
style: normalizeStyle({ color: state.value.isAsc || state.value.isDesc ? unref(activeColor) : unref(color) }),
|
|
813
|
+
onClick: handleClick
|
|
814
|
+
}, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 4), renderSlot(_ctx.$slots, "icon", {}, () => [createElementVNode("button", {
|
|
815
|
+
type: "button",
|
|
816
|
+
class: "kv-sort-item-icon sort-item-icon flex cursor-pointer flex-col items-center gap-[4px] border-0 bg-transparent p-0",
|
|
817
|
+
onClick: handleClick
|
|
818
|
+
}, [__props.sort === "asc" || __props.sort === void 0 ? (openBlock(), createElementBlock("i", {
|
|
819
|
+
key: 0,
|
|
820
|
+
class: "kv-sort-item-icon-asc sort-item-icon-asc h-0 w-0 border-x-[10px] border-b-[10px] border-x-transparent",
|
|
821
|
+
style: normalizeStyle({ borderBottomColor: state.value.isAsc ? unref(activeColor) : unref(iconColor) })
|
|
822
|
+
}, null, 4)) : createCommentVNode("", true), __props.sort === "desc" || __props.sort === void 0 ? (openBlock(), createElementBlock("i", {
|
|
823
|
+
key: 1,
|
|
824
|
+
class: "kv-sort-item-icon-desc sort-item-icon-desc h-0 w-0 border-x-[10px] border-t-[10px] border-x-transparent",
|
|
825
|
+
style: normalizeStyle({ borderTopColor: state.value.isDesc ? unref(activeColor) : unref(iconColor) })
|
|
826
|
+
}, null, 4)) : createCommentVNode("", true)])])]);
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
});
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/composables/debounce.ts
|
|
832
|
+
function debounce(fn, wait) {
|
|
833
|
+
let timer;
|
|
834
|
+
const debounced = (...args) => {
|
|
835
|
+
if (timer) clearTimeout(timer);
|
|
836
|
+
timer = setTimeout(() => {
|
|
837
|
+
timer = void 0;
|
|
838
|
+
fn(...args);
|
|
839
|
+
}, wait);
|
|
840
|
+
};
|
|
841
|
+
debounced.cancel = () => {
|
|
842
|
+
if (timer) {
|
|
843
|
+
clearTimeout(timer);
|
|
844
|
+
timer = void 0;
|
|
845
|
+
}
|
|
846
|
+
};
|
|
847
|
+
return debounced;
|
|
848
|
+
}
|
|
849
|
+
//#endregion
|
|
850
|
+
//#region src/components/ViewportBottomLoad/index.vue
|
|
851
|
+
var ViewportBottomLoad_default = /* @__PURE__ */ defineComponent({
|
|
852
|
+
__name: "index",
|
|
853
|
+
props: {
|
|
854
|
+
distance: { default: 100 },
|
|
855
|
+
debounceNum: { default: 100 },
|
|
856
|
+
disabled: {
|
|
857
|
+
type: Boolean,
|
|
858
|
+
default: false
|
|
859
|
+
}
|
|
860
|
+
},
|
|
861
|
+
emits: ["load"],
|
|
862
|
+
setup(__props, { emit: __emit }) {
|
|
863
|
+
const props = __props;
|
|
864
|
+
const emit = __emit;
|
|
865
|
+
const { height } = useWindowSize();
|
|
866
|
+
const target = useTemplateRef("target");
|
|
867
|
+
const { top, update } = useElementBounding(target);
|
|
868
|
+
const locked = ref(false);
|
|
869
|
+
const isDisabled = computed(() => props.disabled || locked.value);
|
|
870
|
+
function checkBottomLoad() {
|
|
871
|
+
update();
|
|
872
|
+
if (top.value - height.value >= props.distance) return;
|
|
873
|
+
if (isDisabled.value) return;
|
|
874
|
+
emit("load");
|
|
875
|
+
}
|
|
876
|
+
const debouncedCheckBottomLoad = computed(() => props.debounceNum ? debounce(checkBottomLoad, props.debounceNum) : checkBottomLoad);
|
|
877
|
+
watch(() => [
|
|
878
|
+
top.value,
|
|
879
|
+
height.value,
|
|
880
|
+
props.disabled,
|
|
881
|
+
props.distance
|
|
882
|
+
], () => {
|
|
883
|
+
debouncedCheckBottomLoad.value();
|
|
884
|
+
});
|
|
885
|
+
return (_ctx, _cache) => {
|
|
886
|
+
return openBlock(), createElementBlock("div", {
|
|
887
|
+
ref_key: "target",
|
|
888
|
+
ref: target,
|
|
889
|
+
class: "kv-viewport-bottom-load h-[0px] w-[100%]"
|
|
890
|
+
}, null, 512);
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
});
|
|
894
|
+
//#endregion
|
|
895
|
+
export { BaseTip_default as BaseTip, CuEmpty_default as CuEmpty, CuFloatingPanel_default as CuFloatingPanel, CuImage_default as CuImage, CuPopup_default as CuPopup, CuSelect_default as CuSelect, GridImage_default as GridImage, Headroom_default as Headroom, InputNumber_default as InputNumber, SafeBottom_default as SafeBottom, SelectDateRange_default as SelectDateRange, SortGroup_default as SortGroup, SortItem_default as SortItem, ViewportBottomLoad_default as ViewportBottomLoad, useDialogRendered };
|